Transactionクラスは、IOSTブロックチェーンやIOSTのスマートコントラクトを使って、トランザクションを送信したり、トランザクションを取得したりするためのクラスです。
constructor
constructorメソッドは、特殊なメソッドで、Transactionクラスを作成し、初期化します。
ユーザは初期化する必要はありません。ユーザはrpc.transactionでTransactionクラスを使えます。
getTxByHash
ブロックチェーンからハッシュを取得します。
パラメータ
| 名前 | 型 | 説明 |
| hash | String | Base58エンコードしたトランザクションハッシュ |
戻り値
トランザクションオブジェクトを返すPromise。
Transactionオブジェクト
| 名前 | 型 | 説明 |
| hash | String | トランザクションハッシュ |
| time | Number | トランザクションのタイムスタンプ |
| expiration | Number | 有効期限gas_ratio | Number | GAS比率gas_limit | Number | GAS上限delay | Number | 遅延時間(ナノ秒) |
| gas_ratio | Number | GASの割合 |
| gas_limit | Number | 使用するGASの上限 |
| delay | Number | delay nanoseconds |
| actions | Array | Actionオブジェクト配列 |
| signers | Array | 署名者の配列 |
| publisher | String | トランザクションパブリッシャー |
| referred_tx | String | 参照トランザクションハッシュ |
| amount_limit | Array | AmountLimitオブジェクト配列 |
| tx_receipt | Object | TxReceiptオブジェクト |
Actionオブジェクト
| 名前 | 型 | 説明 |
| contract | String | コントラクト名 |
| action_name | String | アクション名 |
| data | String | データ |
AmountLimitオブジェクト
| 名前 | 型 | 説明 |
| token | String | トークン名 |
| value | Number | 上限値 |
TxReceiptオブジェクト
| 名前 | 型 | 説明 |
| tx_hash | String | トランザクションハッシュ |
| gas_usage | Number | GAS使用量 |
| ram_usage | Map | RAM使用量 |
| status_code | String | ステータスコード |
| message | String | メッセージ |
| returns | Array | トランザクションの戻り値配列 |
| receipts | Array | Receiptオブジェクト配列 |
Receiptオブジェクト
| 名前 | 型 | 説明 |
| func_name | String | 関数名 |
| content | String | 内容 |
例
const rpc = new IOST.RPC(new IOST.HTTPProvider('http://127.0.0.1:30001'));
rpc.transaction.getTxByHash("5YdA8qPq5N6W47rZV4u31FdbQzeMt2QX9KGj4uPyERZa").then(console.log);
getTxReceiptByTxHash
トランザクションハッシュからトランザクションを取得します。
パラメータ
| 名前 | 型 | 説明 |
| hash | String | Base58エンコードしたトランザクションハッシュ |
戻り値
TxReceiptオブジェクトを返すPromise。
例
const rpc = new IOST.RPC(new IOST.HTTPProvider('http://127.0.0.1:30001'));
rpc.transaction.getTxByHash("5YdA8qPq5N6W47rZV4u31FdbQzeMt2QX9KGj4uPyERZa").then(console.log);
sendTx
IOSTブロックチェーンにトランザクションを送信します。