访问IOST交易相关RPC的接口
constructor
不要 构造实例,使用rpc.transaction
getTxByHash
通过hash获取交易
Parameters
| Name | Type | Description |
| hash | String | base58编码的交易hash |
Returns
Promise returns transaction object.
Transaction Object
| Name | Type | Description |
| hash | String | 交易 hash |
| time | Number | 交易时间戳 |
| expiration | Number | 超时时间戳 |
| gas_ratio | Number | gas的倍率 |
| gas_limit | Number | gas限额 |
| delay | Number | 延迟时间,以纳秒计 |
| actions | Array | Action Object数组 |
| signers | Array | 签名者的数组 |
| publisher | String | 交易发送者 |
| referred_tx | String | 延迟交易生成的交易hash |
| amount_limit | Array | AmountLimit Object数组 |
| tx_receipt | Object | TxReceipt Object |
Action Object
| Name | Type | Description |
| contract | String | 智能合约名 |
| action_name | String | ABI名 |
| data | String | 传入的参数 |
AmountLimit Object
| Name | Type | Description |
| token | String | token名字 |
| value | Number | 限额 |
TxReceipt Object
| Name | Type | Description |
| tx_hash | String | 交易 hash |
| gas_usage | Number | gas 使用量 |
| ram_usage | Map | ram 使用量 |
| status_code | String | 状态码 |
| message | String | 信息 |
| returns | Array | 交易的返回值 |
| receipts | Array | Receipt Object交易的内部凭条数组 |
Receipt Object
| Name | Type | Description |
| func_name | String | 函数名 |
| content | String | 内容 |
Example
const rpc = new IOST.RPC(new IOST.HTTPProvider('http://127.0.0.1:30001'));
rpc.transaction.getTxByHash("5YdA8qPq5N6W47rZV4u31FdbQzeMt2QX9KGj4uPyERZa").then(console.log);
getTxReceiptByTxHash
通过交易hash获取交易Receipt
Parameters
| Name | Type | Description |
| hash | String | base58编码的交易hash |
Returns
Promise returns TxReceipt Object
Example
const rpc = new IOST.RPC(new IOST.HTTPProvider('http://127.0.0.1:30001'));
rpc.transaction.getTxByHash("5YdA8qPq5N6W47rZV4u31FdbQzeMt2QX9KGj4uPyERZa").then(console.log);
sendTx
向链上发送交易,不建议直接使用