getTransactionFromBlock

Returns a transaction based on a block hash or number and the transactions index position.

Usage

visionWeb.vs.getTransactionFromBlock(block, index);

Parameters

ParameterDescriptionTypeDefault
blockA block number or hash.number | string-
indexThe transactions index position.number-

Returns

Array |\ Object

Example

// 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'
}