• 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

  • 相关阅读:
    JAVA CookieUtil
    Maven打包时提示No runnable methods的解决方案
    Spring MVC中Junit测试简单讲解
    C# 连接MongoDB,含用户验证
    Spring中同一个service中方法相互调用事务不生效问题解决方案
    004. vue html模板字符串转为ast(js对象)
    03事件模型-发布订阅模式
    000 学习vue源码里面一些处理技巧
    02 响应式原理
    my-ts-axios
  • 原文地址:https://www.cnblogs.com/tekkaman/p/10002370.html
Copyright © 2020-2023  润新知