Struct near_workspaces::rpc::patch::ImportContractTransaction
source · pub struct ImportContractTransaction<'a> { /* private fields */ }Expand description
A Transaction-like object that allows us to specify details about importing
a contract from a different network into our sandbox local network. This creates
a new Transaction to be committed to the sandbox network once transact()
has been called. This does not commit any new transactions from the network
this object is importing from.
Implementations§
source§impl<'a, 'b> ImportContractTransaction<'a>
impl<'a, 'b> ImportContractTransaction<'a>
sourcepub fn block_height(self, block_height: BlockHeight) -> Self
pub fn block_height(self, block_height: BlockHeight) -> Self
Specify at which block height to import the contract from. This is usable with any network this object is importing from, but be aware that only archival networks will have the full history while networks like mainnet or testnet only has the history from 5 or less epochs ago.
sourcepub fn block_hash(self, block_hash: CryptoHash) -> Self
pub fn block_hash(self, block_hash: CryptoHash) -> Self
Specify at which block hash to import the contract from. This is usable with any network this object is importing from, but be aware that only archival networks will have the full history while networks like mainnet or testnet only has the history from 5 or less epochs ago.
sourcepub fn with_data(self) -> Self
pub fn with_data(self) -> Self
Along with importing the contract code, this will import the state from the contract itself. This is useful for testing current network state or state at a specific block. Note that there is a limit of 50kb of state data that can be pulled down using the usual RPC service. To get beyond this, our own RPC node has to be spun up and used instead.
sourcepub fn initial_balance(self, initial_balance: Balance) -> Self
pub fn initial_balance(self, initial_balance: Balance) -> Self
Specifies the balance of the contract. This will override the balance currently on the network this transaction is importing from.