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

  • 相关阅读:
    Redis分布式锁
    SpringCloud之服务网关gateway
    SpringCloud之服务注册中心Eureka、zookeeper、consul
    查询list对象
    获取当前列表值,返回图片路径展示刀前台
    js获取当前时间
    checkbox事件
    Python接口自动化测试(7):Jmeter安装与启动
    Python接口自动化测试(8):Jmeter发送请求
    Python接口自动化测试(6):Postman使用-jenkins集成
  • 原文地址:https://www.cnblogs.com/tekkaman/p/10002370.html
Copyright © 2011-2022 走看看