Struct workspaces::Worker

source ·
pub struct Worker<T: ?Sized> { /* private fields */ }
Expand description

The Worker type allows us to interact with any NEAR related networks, such as mainnet and testnet. This controls where the environment the worker is running on top of is. Refer to this for all network related actions such as deploying a contract, or interacting with transactions.

Implementations§

Call into a contract’s change function. Returns a CallTransaction object that we will make use to populate the rest of the call details. The signer will be used to sign the transaction.

Call into a contract’s view function. Returns a Query which allows us to specify further details like the arguments of the view call, or at what point in the chain we want to view.

View the WASM code bytes of a contract on the network.

View the state of a account/contract on the network. This will return the internal state of the account in the form of a map of key-value pairs; where STATE contains info on a contract’s internal data.

View the block from the network. Supply additional parameters such as block_height or block_hash to get the block.

View the chunk from the network once awaited. Supply additional parameters such as block_hash_and_shard, block_height_and_shard or chunk_hash to get the chunk at a specific reference point. If none of those are supplied, the default reference point will be used, which will be the latest block_hash with a shard_id of 0.

Views the AccessKey of the account specified by AccountId associated with the PublicKey

Views all the AccessKeys of the account specified by AccountId. This will return a list of AccessKeys along with the associated PublicKey.

Transfer tokens from one account to another. The signer is the account that will be used to to send from.

Deletes an account from the network. The beneficiary will receive the balance of the account deleted.

View account details of a specific account on the network.

Import a contract from the the given network, and return us a ImportContractTransaction which allows to specify further details, such as being able to import contract data and how far back in time we wanna grab the contract.

Patch state into the sandbox network, given a key and value. This will allow us to set state that we have acquired in some manner. This allows us to test random cases that are hard to come up naturally as state evolves.

Fast forward to a point in the future. The delta block height is supplied to tell the network to advanced a certain amount of blocks. This comes with the advantage only having to wait a fraction of the time it takes to produce the same number of blocks.

Estimate as to how long it takes: if our delta_height crosses X epochs, then it would roughly take X * 5 seconds for the fast forward request to be processed.

The port being used by RPC

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more