Struct dharitri_wasm::api::uncallable::UncallableApi
source · pub struct UncallableApi;Expand description
Dummy type with no implementation. Provides context in ABI generators.
Trait Implementations§
source§impl Clone for UncallableApi
impl Clone for UncallableApi
source§fn clone(&self) -> UncallableApi
fn clone(&self) -> UncallableApi
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl ErrorApi for UncallableApi
impl ErrorApi for UncallableApi
fn signal_error(&self, _message: &[u8]) -> !
source§impl SendApi for UncallableApi
impl SendApi for UncallableApi
§type AmountType = BigUintUncallable
type AmountType = BigUintUncallable
The type of the payment arguments.
Not named
BigUint to avoid name collisions in types that implement multiple API traits.§type ProxyBigInt = BigIntUncallable
type ProxyBigInt = BigIntUncallable
Not used by
SendApi, but forwarded to the proxy traits.type ProxyEllipticCurve = EllipticCurveUncallable
§type ProxyStorage = UncallableApi
type ProxyStorage = UncallableApi
Not used by
SendApi, but forwarded to the proxy traits.source§fn get_sc_address(&self) -> Address
fn get_sc_address(&self) -> Address
Required for DCTNFTTransfer.
Same as the implementation from BlockchainApi.
source§fn get_gas_left(&self) -> u64
fn get_gas_left(&self) -> u64
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.
source§fn get_dct_token_data(
&self,
_address: &Address,
_token: &TokenIdentifier,
_nonce: u64
) -> DctTokenData<Self::AmountType>
fn get_dct_token_data( &self, _address: &Address, _token: &TokenIdentifier, _nonce: u64 ) -> DctTokenData<Self::AmountType>
Used internally for sell_nft.
Do not use directly from contracts.
source§fn direct_moax(&self, _to: &Address, _amount: &BigUintUncallable, _data: &[u8])
fn direct_moax(&self, _to: &Address, _amount: &BigUintUncallable, _data: &[u8])
Sends MOAX to a given address, directly.
Used especially for sending MOAX to regular accounts.
source§fn direct_moax_execute(
&self,
_to: &Address,
_amount: &BigUintUncallable,
_gas_limit: u64,
_function: &[u8],
_arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
fn direct_moax_execute( &self, _to: &Address, _amount: &BigUintUncallable, _gas_limit: u64, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>
Sends MOAX to an address (optionally) and executes like an async call, but without callback.
source§fn direct_dct_execute(
&self,
_to: &Address,
_token: &TokenIdentifier,
_amount: &BigUintUncallable,
_gas: u64,
_function: &[u8],
_arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
fn direct_dct_execute( &self, _to: &Address, _token: &TokenIdentifier, _amount: &BigUintUncallable, _gas: u64, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>
Sends DCT to an address and executes like an async call, but without callback.
source§fn direct_dct_nft_execute(
&self,
_to: &Address,
_token: &TokenIdentifier,
_nonce: u64,
_amount: &BigUintUncallable,
_gas_limit: u64,
_function: &[u8],
_arg_buffer: &ArgBuffer
) -> Result<(), &'static [u8]>
fn direct_dct_nft_execute( &self, _to: &Address, _token: &TokenIdentifier, _nonce: u64, _amount: &BigUintUncallable, _gas_limit: u64, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Result<(), &'static [u8]>
Sends DCT NFT to an address and executes like an async call, but without callback.
source§fn async_call_raw(
&self,
_to: &Address,
_amount: &BigUintUncallable,
_data: &[u8]
) -> !
fn async_call_raw( &self, _to: &Address, _amount: &BigUintUncallable, _data: &[u8] ) -> !
Sends an asynchronous call to another contract.
Calling this method immediately terminates tx execution.
Using it directly is generally discouraged. Read more
source§fn deploy_contract(
&self,
_gas: u64,
_amount: &BigUintUncallable,
_code: &BoxedBytes,
_code_metadata: CodeMetadata,
_arg_buffer: &ArgBuffer
) -> Option<Address>
fn deploy_contract( &self, _gas: u64, _amount: &BigUintUncallable, _code: &BoxedBytes, _code_metadata: CodeMetadata, _arg_buffer: &ArgBuffer ) -> Option<Address>
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
If the deployment fails, Option::None is returnedsource§fn deploy_from_source_contract(
&self,
_gas: u64,
_amount: &BigUintUncallable,
_source_contract_address: &Address,
_code_metadata: CodeMetadata,
_arg_buffer: &ArgBuffer
) -> Option<Address>
fn deploy_from_source_contract( &self, _gas: u64, _amount: &BigUintUncallable, _source_contract_address: &Address, _code_metadata: CodeMetadata, _arg_buffer: &ArgBuffer ) -> Option<Address>
Deploys a new contract in the same shard by re-using the code of an already deployed source contract.
The deployment is done synchronously and the new contract’s address is returned.
If the deployment fails, Option::None is returned
source§fn upgrade_contract(
&self,
_sc_address: &Address,
_gas: u64,
_amount: &BigUintUncallable,
_code: &BoxedBytes,
_code_metadata: CodeMetadata,
_arg_buffer: &ArgBuffer
)
fn upgrade_contract( &self, _sc_address: &Address, _gas: u64, _amount: &BigUintUncallable, _code: &BoxedBytes, _code_metadata: CodeMetadata, _arg_buffer: &ArgBuffer )
Upgrades a child contract of the currently executing contract.
The upgrade is synchronous, and the current transaction will fail if the upgrade fails.
The child contract’s new init function will be called with the provided arguments
source§fn execute_on_dest_context_raw(
&self,
_gas: u64,
_address: &Address,
_value: &BigUintUncallable,
_function: &[u8],
_arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
fn execute_on_dest_context_raw( &self, _gas: u64, _address: &Address, _value: &BigUintUncallable, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>
Same shard, in-line execution of another contract.
source§fn execute_on_dest_context_raw_custom_result_range<F>(
&self,
_gas: u64,
_address: &Address,
_value: &BigUintUncallable,
_function: &[u8],
_arg_buffer: &ArgBuffer,
_range_closure: F
) -> Vec<BoxedBytes>
fn execute_on_dest_context_raw_custom_result_range<F>( &self, _gas: u64, _address: &Address, _value: &BigUintUncallable, _function: &[u8], _arg_buffer: &ArgBuffer, _range_closure: F ) -> Vec<BoxedBytes>
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).fn execute_on_dest_context_by_caller_raw( &self, _gas: u64, _address: &Address, _value: &BigUintUncallable, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>
fn execute_on_same_context_raw( &self, _gas: u64, _address: &Address, _value: &BigUintUncallable, _function: &[u8], _arg_buffer: &ArgBuffer )
source§fn storage_store_tx_hash_key(&self, _data: &[u8])
fn storage_store_tx_hash_key(&self, _data: &[u8])
Used to store data between async call and callback.
source§fn storage_load_tx_hash_key(&self) -> BoxedBytes
fn storage_load_tx_hash_key(&self) -> BoxedBytes
Used to store data between async call and callback.
source§fn call_local_dct_built_in_function(
&self,
_gas: u64,
_function: &[u8],
_arg_buffer: &ArgBuffer
) -> Vec<BoxedBytes>
fn call_local_dct_built_in_function( &self, _gas: u64, _function: &[u8], _arg_buffer: &ArgBuffer ) -> Vec<BoxedBytes>
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.
source§fn sell_nft(
&self,
_nft_id: &TokenIdentifier,
_nft_nonce: u64,
_nft_amount: &Self::AmountType,
_buyer: &Address,
_payment_token: &TokenIdentifier,
_payment_nonce: u64,
_payment_amount: &Self::AmountType
) -> Self::AmountType
fn sell_nft( &self, _nft_id: &TokenIdentifier, _nft_nonce: u64, _nft_amount: &Self::AmountType, _buyer: &Address, _payment_token: &TokenIdentifier, _payment_nonce: u64, _payment_amount: &Self::AmountType ) -> Self::AmountType
Sends thr NFTs to the buyer address and calculates and sends the required royalties to the NFT creator.
Returns the payment amount left after sending royalties.
source§fn direct(
&self,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType,
data: &[u8]
)
fn direct( &self, to: &Address, token: &TokenIdentifier, nonce: u64, amount: &Self::AmountType, data: &[u8] )
Sends either MOAX, DCT or NFT to the target address,
depending on the token identifier and nonce
source§fn async_call(&self, async_call: AsyncCall<Self>) -> !
fn async_call(&self, async_call: AsyncCall<Self>) -> !
Sends an asynchronous call to another contract, with either MOAX or DCT value.
The
token argument decides which one it will be.
Calling this method immediately terminates tx execution.source§fn transfer_dct_via_async_call(
&self,
to: &Address,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType,
data: &[u8]
) -> !
fn transfer_dct_via_async_call( &self, to: &Address, token: &TokenIdentifier, nonce: u64, amount: &Self::AmountType, data: &[u8] ) -> !
Performs a simple DCT/NFT transfer, but via async call.
As with any async call, this immediately terminates the execution of the current call.
So only use as the last call in your endpoint.
If you want to perform multiple transfers, use
Note that MOAX can NOT be transfered with this function.
As with any async call, this immediately terminates the execution of the current call.
So only use as the last call in your endpoint.
If you want to perform multiple transfers, use
self.send().direct() instead.Note that MOAX can NOT be transfered with this function.
fn change_owner_address(&self, child_sc_address: &Address, new_owner: &Address)
source§fn dct_local_mint(
&self,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType
)
fn dct_local_mint( &self, token: &TokenIdentifier, nonce: u64, amount: &Self::AmountType )
Allows synchronous minting of DCT/SFT (depending on nonce). Execution is resumed afterwards.
Note that the SC must have the DCTLocalMint or DCTNftAddQuantity roles set,
or this will fail with “action is not allowed”
For SFTs, you must use
self.send().dct_nft_create() before adding additional quantity.
This function cannot be used for NFTs.source§fn dct_local_burn(
&self,
token: &TokenIdentifier,
nonce: u64,
amount: &Self::AmountType
)
fn dct_local_burn( &self, token: &TokenIdentifier, nonce: u64, amount: &Self::AmountType )
Allows synchronous burning of DCT/SFT/NFT (depending on nonce). Execution is resumed afterwards.
Note that the SC must have the DCTLocalBurn or DCTNftBurn roles set,
or this will fail with “action is not allowed”
source§fn dct_nft_create<T: TopEncode>(
&self,
token: &TokenIdentifier,
amount: &Self::AmountType,
name: &BoxedBytes,
royalties: &Self::AmountType,
hash: &BoxedBytes,
attributes: &T,
uris: &[BoxedBytes]
) -> u64
fn dct_nft_create<T: TopEncode>( &self, token: &TokenIdentifier, amount: &Self::AmountType, name: &BoxedBytes, royalties: &Self::AmountType, hash: &BoxedBytes, attributes: &T, uris: &[BoxedBytes] ) -> u64
Creates a new NFT token of a certain type (determined by
This is a built-in function, so the smart contract execution is resumed after. Must have DCTNftCreate role set, or this will fail with “action is not allowed”. Returns the nonce of the newly created NFT.
token_identifier).attributes can be any serializable custom struct.This is a built-in function, so the smart contract execution is resumed after. Must have DCTNftCreate role set, or this will fail with “action is not allowed”. Returns the nonce of the newly created NFT.
source§impl StorageReadApi for UncallableApi
impl StorageReadApi for UncallableApi
fn storage_load_len(&self, _key: &[u8]) -> usize
fn storage_load_vec_u8(&self, _key: &[u8]) -> Vec<u8>
fn storage_load_big_uint_raw(&self, _key: &[u8]) -> i32
fn storage_load_u64(&self, _key: &[u8]) -> u64
fn storage_load_i64(&self, _key: &[u8]) -> i64
fn storage_load_boxed_bytes(&self, key: &[u8]) -> BoxedBytes
source§impl StorageWriteApi for UncallableApi
impl StorageWriteApi for UncallableApi
fn storage_store_slice_u8(&self, _key: &[u8], _value: &[u8])
fn storage_store_big_uint_raw(&self, _key: &[u8], _handle: i32)
fn storage_store_u64(&self, _key: &[u8], _value: u64)
fn storage_store_i64(&self, _key: &[u8], _value: i64)
Auto Trait Implementations§
impl RefUnwindSafe for UncallableApi
impl Send for UncallableApi
impl Sync for UncallableApi
impl Unpin for UncallableApi
impl UnwindSafe for UncallableApi
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more