jsonRpc.get_code()
get_code()
方法是对RPC接口/v1/chain/get_code
的封装。
函数原型
get_code(account_name: string): Promise<GetCodeResult>
参数
account_name:合约托管账号,string
返回值
get_code()
方法返回一个Promise对象,其解析值为RPC响应结果对象,
成员如下:
- account_name:账号名称,string
- abi:Abi对象,成员如下:
- version:ABI版本,string
- types:ABI类型别名定义,数组
- structs:ABI结构定义,数组
- actions:ABI动作定义,数组
- tables:ABI数据表定义,数组
- abi_extensions:ABI扩展定义,数组
- variants:ABI变量定义,数组
- ricardian_clauses:合约的李嘉图语句,数组
- code_hash:代码的哈希值,string
- wasm:wasm格式的代码,string
- wast:wast格式的代码,string
示例代码
(async ()=>{
let ret = await rpc.get_code('eosio')
console.log(ret.code_hash)
})()