Trait elrond_wasm::api::CallValueApi [−][src]
pub trait CallValueApi: ManagedTypeApi + ErrorApi + Sized {
Show 15 methods
fn check_not_payable(&self);
fn egld_value(&self) -> BigUint<Self>;
fn esdt_value(&self) -> BigUint<Self>;
fn token(&self) -> TokenIdentifier<Self>;
fn esdt_token_nonce(&self) -> u64;
fn esdt_token_type(&self) -> EsdtTokenType;
fn esdt_num_transfers(&self) -> usize;
fn esdt_value_by_index(&self, index: usize) -> BigUint<Self>;
fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>;
fn esdt_token_nonce_by_index(&self, index: usize) -> u64;
fn esdt_token_type_by_index(&self, index: usize) -> EsdtTokenType;
fn require_egld(&self) -> BigUint<Self> { ... }
fn require_esdt(&self, token: &[u8]) -> BigUint<Self> { ... }
fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>) { ... }
fn get_all_esdt_transfers(&self) -> ManagedVec<Self, EsdtTokenPayment<Self>> { ... }
}
Required methods
fn check_not_payable(&self)
fn egld_value(&self) -> BigUint<Self>
fn egld_value(&self) -> BigUint<Self>
Retrieves the EGLD call value from the VM. Will return 0 in case of an ESDT transfer (cannot have both EGLD and ESDT transfer simultaneously).
fn esdt_value(&self) -> BigUint<Self>
fn esdt_value(&self) -> BigUint<Self>
Retrieves the ESDT call value from the VM. Will return 0 in case of an EGLD transfer (cannot have both EGLD and ESDT transfer simultaneously).
fn token(&self) -> TokenIdentifier<Self>
fn token(&self) -> TokenIdentifier<Self>
Returns the call value token identifier of the current call. The identifier is wrapped in a TokenIdentifier object, to hide underlying logic.
A note on implementation: even though the underlying api returns an empty name for EGLD,
but the EGLD TokenIdentifier is serialized as EGLD
.
fn esdt_token_nonce(&self) -> u64
fn esdt_token_nonce(&self) -> u64
Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer.
fn esdt_token_type(&self) -> EsdtTokenType
fn esdt_token_type(&self) -> EsdtTokenType
Returns the ESDT token type. Will return “Fungible” for EGLD.
fn esdt_num_transfers(&self) -> usize
fn esdt_value_by_index(&self, index: usize) -> BigUint<Self>
fn token_by_index(&self, index: usize) -> TokenIdentifier<Self>
fn esdt_token_nonce_by_index(&self, index: usize) -> u64
fn esdt_token_type_by_index(&self, index: usize) -> EsdtTokenType
Provided methods
fn require_egld(&self) -> BigUint<Self>
fn require_egld(&self) -> BigUint<Self>
Will return the EGLD call value, but also fail with an error if ESDT is sent. Especially used in the auto-generated call value processing.
Will return the ESDT call value, but also fail with an error if EGLD or the wrong ESDT token is sent. Especially used in the auto-generated call value processing.
fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>)
fn payment_token_pair(&self) -> (BigUint<Self>, TokenIdentifier<Self>)
Returns both the call value (either EGLD or ESDT) and the token identifier. Especially used in the `#[payable(“*”)] auto-generated snippets. The method might seem redundant, but there is such a hook in Arwen that might be used in this scenario in the future.