Struct elrond_wasm_node::ArwenApiImpl [−][src]
pub struct ArwenApiImpl {}
Expand description
The reference to the API implementation based on Arwen hooks. It continas no data, can be embedded at no cost. Cloning it is a no-op.
Trait Implementations
type BalanceType = ArwenBigUint
type BalanceType = ArwenBigUint
The type of the token balances.
Not named BigUint
to avoid name collisions in types that implement multiple API traits. Read more
fn get_esdt_balance(
&self,
address: &Address,
token: &TokenIdentifier,
nonce: u64
) -> ArwenBigUint
[src]fn get_esdt_token_data(
&self,
address: &Address,
token: &TokenIdentifier,
nonce: u64
) -> EsdtTokenData<ArwenBigUint>
[src]Retrieves validator rewards, as set by the protocol. TODO: move to the storage API, once BigUint gets refactored Read more
Retrieves local roles for the token, by reading protected storage.
type AmountType = ArwenBigUint
type AmountType = ArwenBigUint
The type of the payment arguments.
Not named BigUint
to avoid name collisions in types that implement multiple API traits. Read more
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). Read more
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). Read more
Returns the call value token identifier of the current call. The identifier is wrapped in a TokenIdentifier object, to hide underlying logic. Read more
Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer. Read more
Returns the ESDT token type. Will return “Fungible” for EGLD. Read more
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. Read more
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. Read more
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. Read more
Should be no-op. The API implementation is zero-sized.
type BigUint = ArwenBigUint
type BigInt = ArwenBigInt
type Storage = Self
type Storage = Self
Abstracts the lower-level storage functionality.
type CallValue = Self
type CallValue = Self
Abstracts the call value handling at the beginning of a function call.
type SendApi = Self
type SendApi = Self
Abstracts the sending of EGLD & ESDT transactions, as well as async calls.
type BlockchainApi = Self
type CryptoApi = Self
type LogApi = Self
type ErrorApi = Self
Gateway into the lower-level storage functionality. Storage related annotations make use of this. Using it directly is not recommended. Read more
Gateway into the call value retrieval functionality. The payment annotations should normally be the ones to handle this, but the developer is also given direct access to the API. Read more
Gateway to the functionality related to sending transactions from the current contract.
Gateway blockchain info related to the current transaction and to accounts.
Gateway into the lower-level event log functionality.
Gets called in auto-generated
Using it directly is not recommended.
TODO: consider moving to ContractPrivateApi
. Read more
Currently for some auto-generated code involving callbacks. Please avoid using it directly. TODO: find a way to hide this API. Read more
Note: the signature is minimum 2 bytes in length, the second byte encodes the length of the remaining signature bytes. Read more
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
Saves an event log.
The legacy Arwen hook for saving event logs. It does the same, but only accepts 32-byte topics. Only kept for backwards compatibility. Read more
type AmountType = ArwenBigUint
type AmountType = ArwenBigUint
The type of the payment arguments.
Not named BigUint
to avoid name collisions in types that implement multiple API traits. Read more
type ProxyBigInt = ArwenBigInt
type ProxyBigInt = ArwenBigInt
Not used by SendApi
, but forwarded to the proxy traits.
type ProxyStorage = Self
type ProxyStorage = Self
Not used by SendApi
, but forwarded to the proxy traits.
Required for ESDTNFTTransfer. Same as the implementation from BlockchainApi. Read more
To be used internally by the SendApi implementation. Do not use directly from contracts. It might be removed from this trait at some point or reworked. Read more
Sends EGLD to a given address, directly. Used especially for sending EGLD to regular accounts. Read more
fn direct_egld_execute(
&self,
to: &Address,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]
fn direct_egld_execute(
&self,
to: &Address,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]Sends EGLD to an address (optionally) and executes like an async call, but without callback.
fn direct_esdt_execute(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]
fn direct_esdt_execute(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]Sends ESDT to an address and executes like an async call, but without callback.
fn direct_esdt_nft_execute(
&self,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]
fn direct_esdt_nft_execute(
&self,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &ArwenBigUint,
gas_limit: u64,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
[src]Sends ESDT NFT to an address and executes like an async call, but without callback.
Sends an asynchronous call to another contract. Calling this method immediately terminates tx execution. Using it directly is generally discouraged. Read more
fn deploy_contract(
&self,
gas: u64,
amount: &ArwenBigUint,
code: &BoxedBytes,
code_metadata: CodeMetadata,
arg_buffer: &ArgBuffer
) -> Address
[src]
fn deploy_contract(
&self,
gas: u64,
amount: &ArwenBigUint,
code: &BoxedBytes,
code_metadata: CodeMetadata,
arg_buffer: &ArgBuffer
) -> Address
[src]Deploys a new contract in the same shard.
Unlike async_call_raw
, the deployment is synchronous and tx execution continues afterwards.
Also unlike async_call_raw
, it uses an argument buffer to pass arguments Read more
fn execute_on_dest_context_raw(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]
fn execute_on_dest_context_raw(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]Same shard, in-line execution of another contract.
fn execute_on_dest_context_raw_custom_result_range<F>(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer,
range_closure: F
) -> Vec<BoxedBytes> where
F: FnOnce(usize, usize) -> (usize, usize),
[src]
fn execute_on_dest_context_raw_custom_result_range<F>(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer,
range_closure: F
) -> Vec<BoxedBytes> where
F: FnOnce(usize, usize) -> (usize, usize),
[src]Same shard, in-line execution of another contract.
Allows the contract to specify which result range to extract as sync call result.
This is a workaround to handle nested sync calls.
Please do not use this method unless there is absolutely no other option.
Will be eliminated after some future Arwen hook redesign.
range_closure
takes the number of results before, the number of results after,
and is expected to return the start index (inclusive) and end index (exclusive). Read more
fn execute_on_dest_context_by_caller_raw(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
[src]fn execute_on_same_context_raw(
&self,
gas: u64,
address: &Address,
amount: &ArwenBigUint,
function: &[u8],
arg_buffer: &ArgBuffer
)
[src]Used to store data between async call and callback.
Used to store data between async call and callback.
fn call_local_esdt_built_in_function(
&self,
gas: u64,
function: &[u8],
arg_buffer: &ArgBuffer
)
[src]
fn call_local_esdt_built_in_function(
&self,
gas: u64,
function: &[u8],
arg_buffer: &ArgBuffer
)
[src]Allows synchronously calling a local function by name. Execution is resumed afterwards. You should never have to call this function directly. Use the other specific methods instead. Read more
fn transfer_esdt_via_async_call(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &Self::AmountType,
data: &[u8]
) -> !
[src]
fn transfer_esdt_via_async_call(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &Self::AmountType,
data: &[u8]
) -> !
[src]Performs a simple ESDT transfer, but via async call. This is the preferred way to send ESDT. Read more
fn direct(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &Self::AmountType,
data: &[u8]
)
[src]
fn direct(
&self,
to: &Address,
token: &TokenIdentifier,
amount: &Self::AmountType,
data: &[u8]
)
[src]Sends either EGLD or an ESDT token to the target address, depending on what token identifier was specified. Read more
fn direct_nft(
&self,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType,
data: &[u8]
)
[src]Sends an asynchronous call to another contract, with either EGLD or ESDT value.
The token
argument decides which one it will be.
Calling this method immediately terminates tx execution. Read more
Allows synchronous minting of ESDT tokens. Execution is resumed afterwards.
Allows synchronous burning of ESDT tokens. Execution is resumed afterwards.
fn esdt_nft_create<T>(
&self,
token: &TokenIdentifier,
amount: &Self::AmountType,
name: &BoxedBytes,
royalties: &Self::AmountType,
hash: &BoxedBytes,
attributes: &T,
uris: &[BoxedBytes]
) where
T: TopEncode,
[src]
fn esdt_nft_create<T>(
&self,
token: &TokenIdentifier,
amount: &Self::AmountType,
name: &BoxedBytes,
royalties: &Self::AmountType,
hash: &BoxedBytes,
attributes: &T,
uris: &[BoxedBytes]
) where
T: TopEncode,
[src]Creates a new NFT token of a certain type (determined by token_identifier
).
attributes
can be any serializable custom struct.
This is a built-in function, so the smart contract execution is resumed after. Read more
fn esdt_nft_add_quantity(
&self,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType
)
[src]
fn esdt_nft_add_quantity(
&self,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType
)
[src]Adds quantity for an Non-Fungible Token. (which makes it a Semi-Fungible Token by definition)
This is a built-in function, so the smart contract execution is resumed after. Read more
The reverse operation of esdt_nft_add_quantity
, this locally decreases
This is a built-in function, so the smart contract execution is resumed after. Read more
fn transfer_esdt_nft_via_async_call(
&self,
from: &Address,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType,
data: &[u8]
)
[src]
fn transfer_esdt_nft_via_async_call(
&self,
from: &Address,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType,
data: &[u8]
)
[src]Performs a simple ESDT NFT transfer, but via async call.
This is the preferred way to send ESDT.
Note: call is done to the SC itself, so from
should be the SCs own address Read more
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more