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

  • 相关阅读:
    webpack(4) 配置
    query 与 params 使用
    git 操作
    一个vue练手的小项目
    9/10案例
    9/9python案例
    jmeter录制移动端脚本(二) --- badboy工具
    用jmeter连接数据库并进行操作
    jmeter录制脚本(一) --本身自带功能
    Jmeter组件使用
  • 原文地址:https://www.cnblogs.com/tekkaman/p/10002370.html
Copyright © 2011-2022 走看看