zoukankan      html  css  js  c++  java
  • Understanding ABI Files

    Understanding ABI Files

      ABI files can be generated using the eosio-cpp utility provided by eosio.cdt. The Application Binary Interface (ABI) is a JSON-based description.

    1、ABI的基本结构

    {
       "version": "eosio::abi/1.0",
       "types": [],
       "structs": [],
       "actions": [],
       "tables": [],
       "ricardian_clauses": [],
       "abi_extensions": [],
       "___comment" : ""
    }

    2、types describe the custom types that are used as a parameter in any public action or struct that needs to be described in the ABI.

      EOSIO implements a number of custom built-ins. Built-in types don't need to be described in an ABI file. If you would like to familiarize yourself with EOSIO's built-ins, they are defined here

      

    3、structs

      action的数据会存在于 structs中。如create action。

    {
      "name": "create",
      "base": "",
      "fields": [
        {
          "name":"issuer", 
          "type":"name"
        },
        {
          "name":"maximum_supply", 
          "type":"asset"
        }
      ]
    }

      

      struct会被写入 structs中。

    {
      "name": "currency_stats",
      "base": "",
      "fields": [
        {
          "name":"supply", 
          "type":"asset"
        },
        {
          "name":"max_supply", 
          "type":"asset"
        },
        {
          "name":"issuer", 
          "type":"account_name"
        }
      ]
    }

      

    4、actions

    {
      "name": "transfer",             //The name of the action as defined in the contract
      "type": "transfer",             //The name of the implicit struct as described in the ABI
      "ricardian_contract": ""     //An optional ricardian clause to associate to this action describing its intended functionality.
    }

      每一个action会隐含(implicit)创建一个struct,通过type来指向。action'name struct'name are not required to be equal.

    5、tables

    6、Every time you 1)change a struct, 2)add a table, 3)add an action or 4)add parameters to an action, 5)use a new type, you will need to remember to update your ABI file. In many cases failure to update your ABI file will not produce any error.

    7、

    参考:

    1、https://developers.eos.io/eosio-home/docs/the-abi

  • 相关阅读:
    ural 1080 Map Coloring DFS染色
    hdu 4287 Intelligent IME
    hdu 4268 Alice and Bob 区域赛 1002 (STL、SBT实现)
    SBT专题训练
    hdu 4276 The Ghost Blows Light 区域网络赛 1010 树上背包+spfa
    hdu 4278 Faulty Odometer
    hdu 4279 Number
    VIM 插件(转)
    Linux环境变量的设置(转)
    福昕PDF阅读器 v3.3 破解
  • 原文地址:https://www.cnblogs.com/tekkaman/p/10002370.html
Copyright © 2011-2022 走看看