본문으로 건너뛰기

Transaction API

Defines C API for sending transactions and inline actions. More...

Functions

Name
attribute((eosio_wasm_import) ) const
Cancels a deferred transaction.

Attributes

Name
capi_namepayer
capi_name const char *serialized_transaction
capi_name const char size_tsize
capi_name const char size_t uint32_treplace_existing
uint32_tindex
uint32_t char *buff

Detailed Description

Defines C API for sending transactions and inline actions.

Deferred transactions will not be processed until a future block. They can therefore have no effect on the success of failure of their parent transaction so long as they appear well formed. If any other condition causes the parent transaction to be marked as failing, then the deferred transaction will never be processed.

Deferred transactions must adhere to the permissions available to the parent transaction or, in the future, delegated to the contract account for future use.

An inline message allows one contract to send another contract a message which is processed immediately after the current message's processing ends such that the success or failure of the parent transaction is dependent on the success of the message. If an inline message fails in processing then the whole tree of transactions and actions rooted in the block will me marked as failing and none of effects on the database will persist.

Inline actions and Deferred transactions must adhere to the permissions available to the parent transaction or, in the future, delegated to the contract account for future use.

Functions Documentation

function attribute

__attribute__(
(eosio_wasm_import)
) const

Cancels a deferred transaction.

Parameters:

  • sender_id - ID of sender
  • payer - Account paying for RAM
  • serialized_transaction - Pointer of serialized transaction to be deferred
  • size - Size to reserve
  • replace_existing - f this is 0 then if the provided sender_id is already in use by an in-flight transaction from this contract, which will be a failing assert. If 1 then transaction will atomically cancel/replace the inflight transaction
  • sender_id - The id of the sender
  • buffer - a buffer to write the current transaction to
  • size - the size of the buffer, 0 to return required size
  • type - 0 for context free action, 1 for action
  • index - the index of the requested action
  • buff - output packed buff of the action
  • size - amount of buff read, pass 0 to have size returned
  • index - the index of the context_free_data entry to retrieve
  • buff - output buff of the context_free_data entry
  • size - amount of context_free_data[index] to retrieve into buff, 0 to report required size

Return:

  • 1 if transaction was canceled, 0 if transaction was not found
  • the size of the transaction written to the buffer, or number of bytes that can be copied if size==0 passed
  • size of the currently executing transaction
  • block number used for TAPOS on the currently executing transaction Example:
int tbn = tapos_block_num();
  • block prefix used for TAPOS on the currently executing transaction Example:
int tbp = tapos_block_prefix();
  • expiration of the currently executing transaction in seconds since Unix epoch Example:
uint32_t tm = expiration();
eosio_print(tm);
  • the size of the action, -1 on failure
  • size copied, or context_free_data[index].size() if 0 passed for size, or -1 if index not valid

Precondition:

  • The deferred transaction ID exists.
  • The deferred transaction ID has not yet been published.

Postcondition: Deferred transaction canceled.

Retrieve the signed_transaction.context_free_data[index].

Retrieves the indicated action from the active transaction.

Gets the expiration of the currently executing transaction.

Gets the block prefix used for TAPOS on the currently executing transaction.

Gets the block number used for TAPOS on the currently executing transaction.

Gets the size of the currently executing transaction.

Access a copy of the currently executing transaction.

Sends a deferred transaction.

Cancels a deferred transaction.

Example:

id = 0xffffffffffffffff
cancel_deferred( id );

Access a copy of the currently executing transaction.

Gets the size of the currently executing transaction.

Gets the block number used for TAPOS on the currently executing transaction.

Gets the block prefix used for TAPOS on the currently executing transaction.

Gets the expiration of the currently executing transaction.

Retrieves the indicated action from the active transaction.

Retrieve the signed_transaction.context_free_data[index].

Attributes Documentation

variable payer

capi_name payer;

variable serialized_transaction

capi_name const char * serialized_transaction;

variable size

capi_name const char size_t size;

variable replace_existing

capi_name const char size_t uint32_t replace_existing;

variable index

uint32_t index;

variable buff

uint32_t char * buff;

Updated on 2022-12-05 at 15:38:07 +0000