EOS Action API -C

4572 ワード

クエリー操作の属性を定義するAPI.
関数#カンスウ#
uint32_t read_action_data (void *msg, uint32_t len)
               .

uint32_t action_data_size ()

void require_recipient (account_name name)

void require_auth (account_name name)

bool has_auth (account_name name)
void require_auth2 (account_name name, permission_name permission)

void send_inline (char *serialized_action, size_t size)
void send_context_free_inline (char *serialized_action, size_t size)
void require_write_lock (account_name name)

void require_read_lock (account_name name)

time publication_time ()

account_name current_sender ()

account_name current_receiver ()

詳細な説明
EOS.IOのactionには、以下の抽象構造があります.
struct action {
  scope_name scope; // the contract defining the primary code to execute for code/type
  action_name name; // the action to be taken
  permission_level[] authorization; // the accounts and permission levels provided
  bytes data; // opaque data processed by code
};
 API                       。

例:
// Assume this action is used for the following examples:
// {
//  "code": "eos",
//  "type": "transfer",
//  "authorization": [{ "account": "inita", "permission": "active" }],
//  "data": {
//    "from": "inita",
//    "to": "initb",
//    "amount": 1000
//  }
// }
char buffer[128];
uint32_t total = read_action(buffer, 5); // buffer contains the content of the action up to 5 bytes
print(total); // Output: 5
uint32_t msgsize = action_size();
print(msgsize); // Output: size of the above action's data field
require_recipient(N(initc)); // initc account will be notified for this action
require_auth(N(inita)); // Do nothing since inita exists in the auth list
require_auth(N(initb)); // Throws an exception
print(now()); // Output: timestamp of last accepted block

関数ドキュメント
action_data_size()
uint32_t action_data_size()
                       action   
  • は、現在動作するデータフィールドの長さ
  • を返す.
    current_receiver()
    account_name current_receiver()
      action    。
    
  • 現在のaction受信者のアカウント
  • を返します.
    current_sender()
    account_name current_sender()
        action      
    
  • は、現在のaction送信者のアカウント
  • を返す.
    has_auth()
    bool has_auth(account_name name)
    publication_time()
    time publication_time()
      publication_time 1970         .
    
  • はpublicationを返します.timeは1970年に秒単位の時間であった.

  • read_action_data()
    uint32_t read_action_data(void * msg, uint32_t len)
            len           
    
  • パラメータ-msg-現在の操作データをコピーできるlenバイト-len-lenコピーする現在の操作データ
  • までのポインタ
  • は、msgにコピーされたバイト数
  • を返す.
    require_auth()
    void require_auth(account_name name)
                          。      , throws
    
  • パラメータname-認証対象アカウントの名前
  • require_auth2()
    void require_auth2(account_name name,permission_name permission)
                          。      , throws
    
  • パラメータ
  • name-認証対象アカウントの名前
  • permission-パーミッションレベルの検証

  • require_read_lock()
    void require_read_lock(account_name name)
                      。      , throws
    
  • パラメータ
  • name-認証対象アカウントの名前require_recipient()
    void require_recipient(account_name name)

  • 通知する勘定科目セットに指定した勘定科目を追加します.
  • パラメータ-name-認証対象アカウントの名前
  • require_write_lock()
    void require_write_lock(account_name name)
                         。      , throws
    
  • パラメータ
  • name-認証対象アカウントの名前

  • send_context_free_inline()
    void send_context_free_inline(char * serialized_action, size_t size)
                              
    
  • パラメータ-serialized_Action-シーケンス化操作-size-シーケンス化操作のサイズ、バイト単位
  • send_inline()
    void send_inline(char * serialized_action, size_t size)
                         
    
  • パラメータ-serialized_Action-シーケンス化操作-size-シーケンス化操作のサイズ、バイト単位