千家信息网

EOS推送操作怎么实现

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,这篇"EOS推送操作怎么实现"文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇"EOS推送
千家信息网最后更新 2025年02月02日EOS推送操作怎么实现

这篇"EOS推送操作怎么实现"文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇"EOS推送操作怎么实现"文章吧。

推送操作

根据合约ABI,消息应该是合约。

例如,货币合约的ABI被构造如下。

$ cleos get code -a currency.abi currencycode hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975saving abi to currency.abi$ cat currency.abi{  "types": [{      "newTypeName": "AccountName",      "type": "Name"    }  ],  "structs": [{      "name": "transfer",      "base": "",      "fields": {        "from": "AccountName",        "to": "AccountName",        "amount": "UInt64"      }    },{      "name": "account",      "base": "",      "fields": {        "account": "Name",        "balance": "UInt64"      }    }  ],  "actions": [{      "action": "transfer",      "type": "transfer"    }  ],  "tables": [{      "table": "account",      "indextype": "i64",      "keynames": [        "account"      ],      "keytype": [],      "type": "account"    }  ]}

从上面的abi中,我们可以看到货币合约接受一个叫做transfer的操作,它接受带有from,to和amount字段的消息。

$ ./cleos push message currency transfer '{"from":"currency","to":"tester","amount":50}' -S currency -S tester -p currency@active1589302ms thread-0   main.cpp:271                  operator()           ] Converting argument to binary...1589304ms thread-0   main.cpp:290                  operator()           ] Transaction result:{  "transaction_id": "1c4911c0b277566dce4217edbbca0f688f7bdef761ed445ff31b31f286720057",  "processed": {    "refBlockNum": 1173,    "refBlockPrefix": 2184027244,    "expiration": "2017-08-24T18:28:07",    "scope": [      "currency",      "tester"    ],    "signatures": [],    "messages": [{        "code": "currency",        "type": "transfer",        "authorization": [{            "account": "currency",            "permission": "active"          }        ],        "data": {          "from": "currency",          "to": "tester",          "quantity": 50        },        "hex_data": "00000079b822651d00000000c84267a13200000000000000"      }    ],    "output": [{        "notify": [{            "name": "tester",            "output": {              "notify": [],              "sync_transactions": [],              "async_transactions": []            }          }        ],        "sync_transactions": [],        "async_transactions": []      }    ]  }}

以上就是关于"EOS推送操作怎么实现"这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注行业资讯频道。

0