Last active
March 25, 2019 02:58
-
-
Save tidusvn05/dfd4cc90ca6021e69e4600cafebf863a to your computer and use it in GitHub Desktop.
Revisions
-
tidusvn05 revised this gist
Mar 25, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,4 +96,10 @@ console.log({ tranDetailSuccess, receiptSuccess }); nonce: undefined, gas: undefined } } ------ Final: using getTransactionReceipt to detect tx status
-
tidusvn05 created this gist
Mar 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,99 @@ const web3 = web3Helper.getWeb3(); // For Fail transaction const txFail = '0x0547db129efe2059939365fa4ab658559c51413f96134b5aaef3cf0b760a66ca'; const tranDetailFail = await web3.eth.getTransaction(txFail); const receiptFail = await web3.eth.getTransactionReceipt(txFail); console.log({ tranDetailFail, receiptFail }); // => Result log { tranDetailFail: { blockHash: '0x5671e0f09ddfc58b6c49420097aeb651449ccaae3e933eb740564d4eb513f890', blockNumber: 4090110, from: '0x19d3ec5da861e899EE029B994089485233C7e0F0', gas: 6000000, gasPrice: '1000000000', hash: '0x0547db129efe2059939365fa4ab658559c51413f96134b5aaef3cf0b760a66ca', input: '0x1c5d254a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000006668589b42f8417a68f294fc666e81f554df35ad000000000000000000000000000000000000000000000000000000000000002464366461663261612d383632332d343436302d623532332d6666313537343861666539650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000843078613438666333666161366237383133343462623238353030396135623261333062643131376564623039306166646461646137356331646637313362323839623264363237363762303361393935666532313665376630336230353662623638633438346131336534623362343231363861663765333833346336636363303031620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000', nonce: 28568, r: '0x5ece6c93dd65fa6955677e019a31e63a44c079f35fd18063d9f756f4fa79478c', s: '0x1d6566c8419b5baeec3334bd0f0b34f03eb04f3bf45c2a5832927f62831d9011', to: '0xaa564c68cdCa2a9a091edaAC29FeF2D326a87636', transactionIndex: 6, v: '0x2b', value: '0' }, receiptFail: { blockHash: '0x5671e0f09ddfc58b6c49420097aeb651449ccaae3e933eb740564d4eb513f890', blockNumber: 4090110, contractAddress: null, cumulativeGasUsed: '0xbeeb9', from: '0x19d3ec5da861e899EE029B994089485233C7e0F0', gasUsed: '0x9609', logs: [], logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', status: '0x0', to: '0xaa564c68cdCa2a9a091edaAC29FeF2D326a87636', transactionHash: '0x0547db129efe2059939365fa4ab658559c51413f96134b5aaef3cf0b760a66ca', transactionIndex: 6, nonce: undefined, gas: undefined } } // For Success transaction const txSuccess = '0xcda454c26505b635424b9e5a8cd778337c5875f9524419b247faf46ca5606546'; const tranDetailSuccess = await web3.eth.getTransaction(txSuccess); const receiptSuccess = await web3.eth.getTransactionReceipt(txSuccess); console.log({ tranDetailSuccess, receiptSuccess }); => Resuls log for success { tranDetailSuccess: { blockHash: '0xa2fb728b116be52d81c070efa168d4560b787040a3d073b6abfd5fcbc04795c0', blockNumber: 4072464, from: '0xA39730733a80be9183590eaa65aA0256b2398A37', gas: 4300000, gasPrice: '22000000000', hash: '0xcda454c26505b635424b9e5a8cd778337c5875f9524419b247faf46ca5606546', input: '0xa9059cbb0000000000000000000000004132c88403de7f6b07f533811fe952cdb9ba21d40000000000000000000000000000000000000000000000000de0b6b3a7640000', nonce: 1297, r: '0x91094745ea9f8385bd32f5e293baef0deda61d7ccd209734f4560513142c95c2', s: '0x11a81737b3583ecce46cc26ff6cf89b60cb608974023bba15ae445cdf44e1e35', to: '0xB9078DaF26539471A405439cECcc47d5fFe14beF', transactionIndex: 0, v: '0x1c', value: '0' }, receiptSuccess: { blockHash: '0xa2fb728b116be52d81c070efa168d4560b787040a3d073b6abfd5fcbc04795c0', blockNumber: 4072464, contractAddress: null, cumulativeGasUsed: '0x9251', from: '0xA39730733a80be9183590eaa65aA0256b2398A37', gasUsed: '0x9251', logs: [ [Object] ], logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000010000000000000000000000000000040000000000000000000000000000400000400000000000000000000000000000000000000000000000000000002000000000000000000000002000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000040000000000000', status: '0x1', to: '0xB9078DaF26539471A405439cECcc47d5fFe14beF', transactionHash: '0xcda454c26505b635424b9e5a8cd778337c5875f9524419b247faf46ca5606546', transactionIndex: 0, nonce: undefined, gas: undefined } }