查询块中的交易信息。
用法
visionWeb.vs.getTransactionFromBlock(block, index);
入参
参数 | 描述 | 类型 | 默认值 |
---|---|---|---|
block | 区块高度或者区块 id | number | string | - |
index | 查出的 transaction 下标,不传 index 查出的是数组,如果有 index,则为精准查询 | number | - |
返回值
array |\ object,查询到的交易列表或者交易对象。
示例
// demo1
visionWeb.vs.getTransactionFromBlock(37259);
> [
{
ret: [ [Object] ],
signature: [
'c3150f0d0e1c195d4961e143f47b98bfa5a0323c8cca5608c6accc75557ca78678d5df42cbf3a364dc6a8ff7c78700f20ec25a529afb2fa4ecd7cb7c4c85a7dd01'
],
txID: 'c01bb6832a42129e8da3b05909de5245286bc2fbe2df148713c8f8a39a28c072',
raw_data: {
contract: [Array],
ref_block_bytes: '9189',
ref_block_hash: '1ee0e1079ccc9ce1',
expiration: 1608124335000,
timestamp: 1608124277800
},
raw_data_hex: '0a02918922081ee0e1079ccc9ce1409887b8dde62e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a154653cd48c2723cb985679f4e44d99c64d22d89f41d121546555e131d1c696677972a81bd86ff9975fd3b4792180a70a8c8b4dde62e'
}
]
// demo2
visionWeb.vs.getTransactionFromBlock(37259,0);
> {
ret: [ { contractRet: 'SUCCESS' } ],
signature: [
'c3150f0d0e1c195d4961e143f47b98bfa5a0323c8cca5608c6accc75557ca78678d5df42cbf3a364dc6a8ff7c78700f20ec25a529afb2fa4ecd7cb7c4c85a7dd01'
],
txID: 'c01bb6832a42129e8da3b05909de5245286bc2fbe2df148713c8f8a39a28c072',
raw_data: {
contract: [ [Object] ],
ref_block_bytes: '9189',
ref_block_hash: '1ee0e1079ccc9ce1',
expiration: 1608124335000,
timestamp: 1608124277800
},
raw_data_hex: '0a02918922081ee0e1079ccc9ce1409887b8dde62e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a154653cd48c2723cb985679f4e44d99c64d22d89f41d121546555e131d1c696677972a81bd86ff9975fd3b4792180a70a8c8b4dde62e'
}