transaction¶
- class CreateAccountAction¶
Create account action
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- to_json()¶
Convert to a JSON string.
- class DeployContractAction¶
Deploy contract action
- code¶
WebAssembly binary
- Type:
list[int]
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- to_json()¶
Convert to a JSON string.
- class FunctionCallAction¶
- args¶
Arguments to pass to method.
- Type:
list[int]
- deposit¶
Amount of NEAR (in yoctoNEAR) to send together with the call.
- Type:
int
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- gas¶
Max amount of gas that method call can use.
- Type:
int
- method_name¶
The name of the method to call
- Type:
str
- to_json()¶
Convert to a JSON string.
- class TransferAction¶
- deposit¶
The amount to transfer, in yoctoNEAR.
- Type:
int
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- to_json()¶
Convert to a JSON string.
- class StakeAction¶
An action which stakes signer_id tokens and sets up validator public key
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- public_key¶
Validator key which will be used to sign transactions on behalf of signer_id.
- Type:
PublicKey
- stake¶
Amount of tokens to stake.
- Type:
int
- to_json()¶
Convert to a JSON string.
- class AddKeyAction¶
-
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- public_key¶
A public key which will be associated with an access_key.
- Type:
PublicKey
- to_json()¶
Convert to a JSON string.
- class DeleteKeyAction¶
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- public_key¶
A public key associated with the access_key to be deleted.
- Type:
PublicKey
- to_json()¶
Convert to a JSON string.
- class DeleteAccountAction¶
-
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- to_json()¶
Convert to a JSON string.
- verify_transaction_signature(transaction, public_keys)¶
- class PartialExecutionStatusFieldless¶
- Failure = PartialExecutionStatusFieldless.Failure¶
- Unknown = PartialExecutionStatusFieldless.Unknown¶
- class ProfileData¶
Profile of gas consumption.
- action_gas()¶
-
- Returns:
int
- add_action_cost(action, value)¶
- Parameters:
action (ActionCosts) –
value (int) –
- Returns:
None
- compute_wasm_instruction_cost(total_gas_burnt)¶
WasmInstruction is the only cost we don’t explicitly account for. Instead, we compute it at the end of contract call as the difference between total gas burnt and what we’ve explicitly accounted for in the profile.
This is because WasmInstruction is the hottest cost and is implemented with the help on the VM side, so we don’t want to have profiling logic there both for simplicity and efficiency reasons.
- Parameters:
total_gas_burnt (Sequence[bytes]) – The total gas burnt by the contract call.
program_id (Pubkey) – The program ID.
- Returns:
the WASM instruction cost.
- Return type:
int
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- get_action_cost(action)¶
-
- Parameters:
action (ActionCosts) –
- Returns:
int
- host_gas()¶
-
- Returns:
int
- merge(other)¶
- Parameters:
other (ProfileData) –
- Returns:
None
- class Transaction¶
A
Transaction
is a collection of Actions that describe what should be done at the destination (the receiver account).See https://docs.near.org/concepts/basics/transactions/overview for more.
- Parameters:
signer_id (AccountId) – The account on whose behalf the transaciton is signed.
public_key (PublicKey) – A public key of the access key which was used to sign an account.
nonce (int) – Used to determine order of transaction in the pool. It increments for a combination of signer_id and public_key,
receiver_id (AccountId) – Receiver account for this transaction.
block_hash (CryptoHash) – The hash of the block in the blockchain on top of which the given transaction is valid.
actions (list[Action]) – A list of actions to be applied.
- actions¶
A list of actions to be applied
- Type:
list[Action]
- add_key(public_key, access_key)¶
Mutably add an
AddKey
action to this transaction.- Parameters:
public_key (PublicKey) – A public key which will be associated with an access_key.
access_key (AccessKey) – An access key with the permission.
- Returns:
the transaction object.
- Return type:
- block_hash¶
The hash of the block in the blockchain on top of which the given transaction is valid
- Type:
- create_account()¶
Mutably add a
CreateAccount
action to this transaction.- Returns:
the transaction object.
- Return type:
- delete_account(beneficiary_id)¶
Mutably add a
DeleteAccount
action to this transaction.- Parameters:
benficiary_id (AccountId) –
- Returns:
the transaction object.
- Return type:
- delete_key(public_key)¶
Mutably add a
DeleteKey
action to this transaction.- Parameters:
public_key (PublicKey) – A public key associated with the access_key to be deleted.
- Returns:
the transaction object.
- Return type:
- deploy_contract(code)¶
Mutably add a
DeployContract
action to this transaction.- Parameters:
code (bytes | Sequence[int]) – The webassembly binary.
- Returns:
the transaction object.
- Return type:
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- function_call(method_name, args, gas, deposit)¶
Mutably add a
FunctionCall
action to this transaction.- Parameters:
method_name (str) – The name of the method to call.
args (bytes | Sequence[int]) – The arguments.
gas (int) – Max amount of gas that method call can use.
deposit (int) – Amount of NEAR (in yoctoNEAR) to send together with the call.
- Returns:
the transaction object.
- Return type:
- get_hash_and_size()¶
Computes a hash of the transaction for signing and size of serialized transaction
- nonce¶
Nonce is used to determine order of transaction in the pool. It increments for a combination of signer_id and public_key
- Type:
int
- public_key¶
A public key of the access key which was used to sign an account. Access key holds permissions for calling certain kinds of actions.
- Type:
PublicKey
- sign(signer)¶
Sign this transaction.
- Parameters:
signer (Signer) – The transasction signer.
- Returns:
The signed transaction.
- Return type:
- stake(stake, public_key)¶
Mutably add a
Stake
action to this transaction.- Parameters:
stake (int) – Amount of tokens to stake.
public_key (PublicKey) – Validator key which will be used to sign transactions on behalf of signer_id.
- Returns:
the transaction object.
- Return type:
- to_json()¶
Convert to a JSON string.
- transfer(deposit)¶
Mutably add a
Transfer
action to this transaction.- Parameters:
deposit (int) – Amount of NEAR (in yoctoNEAR) to send.
- Returns:
the transaction object.
- Return type:
- class SignedTransaction¶
A
SignedTransction
is the result of callingTransaction.sign
. The data inside aSignedTransaction
cannot be changed. If you have aSignedTransction
and you want to make some changes, usemy_signed_tx.transaction
to retrieve an unsigned transaction object.- Parameters:
signature (Signature) – The transaction signature.
transaction (Transaction) – The unsigned transaction.
- static from_base64(s)¶
Build to a base64 string.
- Parameters:
s (str) – The base64-encoded transaction.
- Returns:
SignedTransaction
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- static from_json(raw)¶
Build from a JSON string.
- hash¶
The hash of the transaction.
- Type:
- signature¶
The transaction signature.
- Type:
Signature
- size¶
The size of the serialized transaction in bytes.
- Type:
int
- to_base64()¶
Convert to a base64 string.
- Returns:
str
- to_json()¶
Convert to a JSON string.
- transaction¶
The unsigned transaction.
- Type:
- class ExecutionOutcome¶
Execution outcome for one signed transaction or one receipt.
- executor_id¶
The id of the account on which the execution happens. For transaction this is signer_id, for receipt this is receiver_id.
- Type:
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- gas_burnt¶
The amount of the gas burnt by the given transaction or receipt.
- Type:
int
- logs¶
Logs from this transaction or receipt.
- Type:
list[str]
- metadata¶
Execution metadata, versioned
- Type:
ExecutionMetadata
- receipt_ids¶
Receipt IDs generated by this transaction or receipt.
- Type:
list[CryptoHash]
- status¶
Execution status. Contains the result in case of successful execution. NOTE: Should be the latest field since it contains unparsable by light client ExecutionStatus::Failure
- Type:
ExecutionStatus
- tokens_burnt¶
The amount of tokens burnt corresponding to the burnt gas amount. This value doesn’t always equal to the
gas_burnt
multiplied by the gas price, because the prepaid gas price might be lower than the actual gas price and it creates a deficit.- Type:
int
- class ExecutionOutcomeWithId¶
Execution outcome with the identifier. For a signed transaction, the ID is the hash of the transaction. For a receipt, the ID is the receipt ID.
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- id¶
The transaction hash or the receipt ID.
- Type:
- outcome¶
Should be the latest field since contains unparsable by light client ExecutionStatus::Failure
- Type:
- to_hashes()¶
Returns: list[CryptoHash]
- class ExecutionOutcomeWithIdAndProof¶
Execution outcome with path from it to the outcome root and ID.
- block_hash¶
The block hash.
- Type:
- static from_bytes(data)¶
Deserialize from bytes.
- Parameters:
data (bytes) – the serialized object.
Returns: the deserialized object.
- id()¶
Get the outcome ID.
- Returns:
outcome ID.
- Return type:
- outcome_with_id¶
Should be the latest field since contains unparsable by light client ExecutionStatus::Failure
- Type:
- proof¶
Path from the execution outcome to the outcome root.
- Type:
list[MerklePathItem]