diff --git a/web/cashtab/src/hooks/__mocks__/mockNonSlpUtxos.js b/web/cashtab/src/hooks/__mocks__/mockNonSlpUtxos.js new file mode 100644 --- /dev/null +++ b/web/cashtab/src/hooks/__mocks__/mockNonSlpUtxos.js @@ -0,0 +1,91 @@ +export default [ + { + height: 669639, + tx_hash: + '0da6d49cf95d4603958e53360ad1e90bfccef41bfb327d6b2e8a77e242fa2d58', + tx_pos: 0, + value: '1000', + txid: '0da6d49cf95d4603958e53360ad1e90bfccef41bfb327d6b2e8a77e242fa2d58', + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: '0da6d49cf95d4603958e53360ad1e90bfccef41bfb327d6b2e8a77e242fa2d58', + }, + }, + { + height: 669639, + tx_hash: + '39521b38cd1b6126a57a68b8adfd836020cd53b195f3b4675c58095c5c300ef8', + tx_pos: 0, + value: 700000, + txid: '39521b38cd1b6126a57a68b8adfd836020cd53b195f3b4675c58095c5c300ef8', + + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: '39521b38cd1b6126a57a68b8adfd836020cd53b195f3b4675c58095c5c300ef8', + }, + }, + { + height: 669639, + tx_hash: + '93949923f02cb5271bd6d0b5a5b937ce5ae22df5bf6117161078f175f0c29d56', + tx_pos: 0, + value: 700000, + txid: '93949923f02cb5271bd6d0b5a5b937ce5ae22df5bf6117161078f175f0c29d56', + + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: '93949923f02cb5271bd6d0b5a5b937ce5ae22df5bf6117161078f175f0c29d56', + }, + }, + { + height: 669639, + tx_hash: + 'ddace66ea968e16e55ebf218814401acc38e0a39150529fa3d1108af04e81373', + tx_pos: 0, + value: 300000, + txid: 'ddace66ea968e16e55ebf218814401acc38e0a39150529fa3d1108af04e81373', + + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: 'ddace66ea968e16e55ebf218814401acc38e0a39150529fa3d1108af04e81373', + }, + }, + { + height: 669639, + tx_hash: + 'f1147285ac384159b5dfae513bda47a0459f876d046b48f13c8a7ec4f0d20d96', + tx_pos: 0, + value: 700000, + txid: 'f1147285ac384159b5dfae513bda47a0459f876d046b48f13c8a7ec4f0d20d96', + + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: 'f1147285ac384159b5dfae513bda47a0459f876d046b48f13c8a7ec4f0d20d96', + }, + }, + { + height: 669639, + tx_hash: + 'f4ca891d090f2682c7086b27a4d3bc2ed1543fb96123b6649e8f26b644a45b51', + tx_pos: 0, + value: 30000, + txid: 'f4ca891d090f2682c7086b27a4d3bc2ed1543fb96123b6649e8f26b644a45b51', + + isValid: false, + address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', + outpoint: { + outIdx: 0, + txid: 'f4ca891d090f2682c7086b27a4d3bc2ed1543fb96123b6649e8f26b644a45b51', + }, + }, +]; diff --git a/web/cashtab/src/hooks/__mocks__/mockReturnGetSlpBalancesAndUtxos.js b/web/cashtab/src/hooks/__mocks__/mockReturnGetSlpBalancesAndUtxos.js deleted file mode 100644 --- a/web/cashtab/src/hooks/__mocks__/mockReturnGetSlpBalancesAndUtxos.js +++ /dev/null @@ -1,841 +0,0 @@ -import BigNumber from 'bignumber.js'; - -export default { - tokens: [ - { - info: { - height: 660869, - tx_hash: - '16b624b60de4a1d8a06baa129e3a88a4becd499e1d5d0d40b9f2ff4d28e3f660', - tx_pos: 1, - value: 546, - txid: '16b624b60de4a1d8a06baa129e3a88a4becd499e1d5d0d40b9f2ff4d28e3f660', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd', - tokenTicker: 'ST', - tokenName: 'ST', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - 'bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd', - balance: new BigNumber('1'), - hasBaton: false, - }, - { - info: { - height: 660869, - tx_hash: - 'c7da9ae6a0ce9d4f2f3345f9f0e5da5371228c8aee72b6eeac1b42871b216e6b', - tx_pos: 1, - value: 546, - txid: 'c7da9ae6a0ce9d4f2f3345f9f0e5da5371228c8aee72b6eeac1b42871b216e6b', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '1f6a65e7a4bde92c0a012de2bcf4007034504a765377cdf08a3ee01d1eaa6901', - tokenTicker: '🍔', - tokenName: 'Burger', - tokenDocumentUrl: - 'https://c4.wallpaperflare.com/wallpaper/58/564/863/giant-hamburger-wallpaper-preview.jpg', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '2', - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - '1f6a65e7a4bde92c0a012de2bcf4007034504a765377cdf08a3ee01d1eaa6901', - balance: new BigNumber('2'), - hasBaton: false, - }, - { - info: { - height: 660869, - tx_hash: - 'dac23f10dd65caa51359c1643ffc93b94d14c05b739590ade85557d338a21040', - tx_pos: 1, - value: 546, - txid: 'dac23f10dd65caa51359c1643ffc93b94d14c05b739590ade85557d338a21040', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1', - tokenTicker: 'HONK', - tokenName: 'HONK HONK', - tokenDocumentUrl: 'THE REAL HONK SLP TOKEN', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1', - balance: new BigNumber('3'), - hasBaton: false, - }, - { - info: { - height: 660869, - tx_hash: - 'efa6f67078810875513a116b389886610d81ecf6daf97d55dd96d3fdd201dfac', - tx_pos: 1, - value: 546, - txid: 'efa6f67078810875513a116b389886610d81ecf6daf97d55dd96d3fdd201dfac', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'dd84ca78db4d617221b58eabc6667af8fe2f7eadbfcc213d35be9f1b419beb8d', - tokenTicker: 'TAP', - tokenName: 'Thoughts and Prayers', - tokenDocumentUrl: '', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '2', - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - 'dd84ca78db4d617221b58eabc6667af8fe2f7eadbfcc213d35be9f1b419beb8d', - balance: new BigNumber('2'), - hasBaton: false, - }, - { - info: { - height: 660978, - tx_hash: - 'b622b770f74f056e07e5d2ea4d7f8da1c4d865e21e11c31a263602a38d4a2474', - tx_pos: 2, - value: 546, - txid: 'b622b770f74f056e07e5d2ea4d7f8da1c4d865e21e11c31a263602a38d4a2474', - vout: 2, - utxoType: 'minting-baton', - transactionType: 'mint', - tokenId: - 'bef614aac85c0c866f4d39e4d12a96851267d38d1bca5bdd6488bbd42e28b6b1', - tokenType: 1, - tokenTicker: 'CTP', - tokenName: 'Cash Tab Points', - tokenDocumentUrl: 'https://cashtabapp.com/', - tokenDocumentHash: '', - decimals: 9, - mintBatonVout: 2, - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - 'bef614aac85c0c866f4d39e4d12a96851267d38d1bca5bdd6488bbd42e28b6b1', - balance: new BigNumber('310.000000001'), - hasBaton: true, - }, - { - info: { - height: 660982, - tx_hash: - '67605f3d18135b52d95a4877a427d100c14f2610c63ee84eaf4856f883a0b70e', - tx_pos: 2, - value: 546, - txid: '67605f3d18135b52d95a4877a427d100c14f2610c63ee84eaf4856f883a0b70e', - vout: 2, - utxoType: 'minting-baton', - transactionType: 'mint', - tokenId: - '7443f7c831cdf2b2b04d5f0465ed0bcf348582675b0e4f17906438c232c22f3d', - tokenType: 1, - tokenTicker: 'WDT', - tokenName: - 'Test Token With Exceptionally Long Name For CSS And Style Revisions', - tokenDocumentUrl: - 'https://www.ImpossiblyLongWebsiteDidYouThinkWebDevWouldBeFun.org', - tokenDocumentHash: - '����\\�IS\u001e9�����k+���\u0018���\u001b]�߷2��', - decimals: 7, - mintBatonVout: 2, - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - '7443f7c831cdf2b2b04d5f0465ed0bcf348582675b0e4f17906438c232c22f3d', - balance: new BigNumber('523512344.7961451'), - hasBaton: true, - }, - { - info: { - height: 667750, - tx_hash: - 'e9a94cc174839e3659d2fe4d33490528d18ad91404b65eb8cc35d8fa2d3f5096', - tx_pos: 2, - value: 546, - txid: 'e9a94cc174839e3659d2fe4d33490528d18ad91404b65eb8cc35d8fa2d3f5096', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '5.854300861', - isValid: true, - address: - 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - balance: new BigNumber('9897999885.211011069'), - hasBaton: false, - }, - { - info: { - height: 667793, - tx_hash: - '9c295332b7bc16758b2e328f21189fa0ea79f71908b47529749b3ba54e523817', - tx_pos: 1, - value: 546, - txid: '9c295332b7bc16758b2e328f21189fa0ea79f71908b47529749b3ba54e523817', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - tokenTicker: 'Sending Token', - tokenName: 'Sending Token', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: - 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - balance: new BigNumber('4e-9'), - hasBaton: false, - }, - { - info: { - height: 669057, - tx_hash: - 'dd560d87bd632e40c6548021006653a150197ede13fadb5eadfa29abe4400d0e', - tx_pos: 1, - value: 546, - txid: 'dd560d87bd632e40c6548021006653a150197ede13fadb5eadfa29abe4400d0e', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb', - tokenTicker: 'NAKAMOTO', - tokenName: 'NAKAMOTO', - tokenDocumentUrl: '', - tokenDocumentHash: '', - decimals: 8, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: - 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - tokenId: - 'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb', - balance: new BigNumber('1'), - hasBaton: false, - }, - ], - nonSlpUtxos: [ - { - height: 669639, - tx_hash: - '0da6d49cf95d4603958e53360ad1e90bfccef41bfb327d6b2e8a77e242fa2d58', - tx_pos: 0, - value: 1000, - txid: '0da6d49cf95d4603958e53360ad1e90bfccef41bfb327d6b2e8a77e242fa2d58', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - { - height: 669639, - tx_hash: - '39521b38cd1b6126a57a68b8adfd836020cd53b195f3b4675c58095c5c300ef8', - tx_pos: 0, - value: 700000, - txid: '39521b38cd1b6126a57a68b8adfd836020cd53b195f3b4675c58095c5c300ef8', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - { - height: 669639, - tx_hash: - '93949923f02cb5271bd6d0b5a5b937ce5ae22df5bf6117161078f175f0c29d56', - tx_pos: 0, - value: 700000, - txid: '93949923f02cb5271bd6d0b5a5b937ce5ae22df5bf6117161078f175f0c29d56', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - { - height: 669639, - tx_hash: - 'ddace66ea968e16e55ebf218814401acc38e0a39150529fa3d1108af04e81373', - tx_pos: 0, - value: 300000, - txid: 'ddace66ea968e16e55ebf218814401acc38e0a39150529fa3d1108af04e81373', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - { - height: 669639, - tx_hash: - 'f1147285ac384159b5dfae513bda47a0459f876d046b48f13c8a7ec4f0d20d96', - tx_pos: 0, - value: 700000, - txid: 'f1147285ac384159b5dfae513bda47a0459f876d046b48f13c8a7ec4f0d20d96', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - { - height: 669639, - tx_hash: - 'f4ca891d090f2682c7086b27a4d3bc2ed1543fb96123b6649e8f26b644a45b51', - tx_pos: 0, - value: 30000, - txid: 'f4ca891d090f2682c7086b27a4d3bc2ed1543fb96123b6649e8f26b644a45b51', - vout: 0, - isValid: false, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - wif: 'L58jqHoi5ynSdsskPVBJuGuVqTP8ZML1MwHQsBJY32Pv7cqDSCeH', - }, - ], - slpUtxos: [ - { - height: 660869, - tx_hash: - '16b624b60de4a1d8a06baa129e3a88a4becd499e1d5d0d40b9f2ff4d28e3f660', - tx_pos: 1, - value: 546, - txid: '16b624b60de4a1d8a06baa129e3a88a4becd499e1d5d0d40b9f2ff4d28e3f660', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd', - tokenTicker: 'ST', - tokenName: 'ST', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 660869, - tx_hash: - 'c7da9ae6a0ce9d4f2f3345f9f0e5da5371228c8aee72b6eeac1b42871b216e6b', - tx_pos: 1, - value: 546, - txid: 'c7da9ae6a0ce9d4f2f3345f9f0e5da5371228c8aee72b6eeac1b42871b216e6b', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '1f6a65e7a4bde92c0a012de2bcf4007034504a765377cdf08a3ee01d1eaa6901', - tokenTicker: '🍔', - tokenName: 'Burger', - tokenDocumentUrl: - 'https://c4.wallpaperflare.com/wallpaper/58/564/863/giant-hamburger-wallpaper-preview.jpg', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '2', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 660869, - tx_hash: - 'dac23f10dd65caa51359c1643ffc93b94d14c05b739590ade85557d338a21040', - tx_pos: 1, - value: 546, - txid: 'dac23f10dd65caa51359c1643ffc93b94d14c05b739590ade85557d338a21040', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1', - tokenTicker: 'HONK', - tokenName: 'HONK HONK', - tokenDocumentUrl: 'THE REAL HONK SLP TOKEN', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 660869, - tx_hash: - 'efa6f67078810875513a116b389886610d81ecf6daf97d55dd96d3fdd201dfac', - tx_pos: 1, - value: 546, - txid: 'efa6f67078810875513a116b389886610d81ecf6daf97d55dd96d3fdd201dfac', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'dd84ca78db4d617221b58eabc6667af8fe2f7eadbfcc213d35be9f1b419beb8d', - tokenTicker: 'TAP', - tokenName: 'Thoughts and Prayers', - tokenDocumentUrl: '', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '2', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 660978, - tx_hash: - 'b622b770f74f056e07e5d2ea4d7f8da1c4d865e21e11c31a263602a38d4a2474', - tx_pos: 2, - value: 546, - txid: 'b622b770f74f056e07e5d2ea4d7f8da1c4d865e21e11c31a263602a38d4a2474', - vout: 2, - utxoType: 'minting-baton', - transactionType: 'mint', - tokenId: - 'bef614aac85c0c866f4d39e4d12a96851267d38d1bca5bdd6488bbd42e28b6b1', - tokenType: 1, - tokenTicker: 'CTP', - tokenName: 'Cash Tab Points', - tokenDocumentUrl: 'https://cashtabapp.com/', - tokenDocumentHash: '', - decimals: 9, - mintBatonVout: 2, - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 660982, - tx_hash: - '67605f3d18135b52d95a4877a427d100c14f2610c63ee84eaf4856f883a0b70e', - tx_pos: 2, - value: 546, - txid: '67605f3d18135b52d95a4877a427d100c14f2610c63ee84eaf4856f883a0b70e', - vout: 2, - utxoType: 'minting-baton', - transactionType: 'mint', - tokenId: - '7443f7c831cdf2b2b04d5f0465ed0bcf348582675b0e4f17906438c232c22f3d', - tokenType: 1, - tokenTicker: 'WDT', - tokenName: - 'Test Token With Exceptionally Long Name For CSS And Style Revisions', - tokenDocumentUrl: - 'https://www.ImpossiblyLongWebsiteDidYouThinkWebDevWouldBeFun.org', - tokenDocumentHash: - '����\\�IS\u001e9�����k+���\u0018���\u001b]�߷2��', - decimals: 7, - mintBatonVout: 2, - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 662799, - tx_hash: - 'b399a5ae69e4ac4c96b27c680a541e6b8142006bdc2484a959821858fc0b4ca3', - tx_pos: 2, - value: 546, - txid: 'b399a5ae69e4ac4c96b27c680a541e6b8142006bdc2484a959821858fc0b4ca3', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bef614aac85c0c866f4d39e4d12a96851267d38d1bca5bdd6488bbd42e28b6b1', - tokenTicker: 'CTP', - tokenName: 'Cash Tab Points', - tokenDocumentUrl: 'https://cashtabapp.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '310', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 667561, - tx_hash: - '4ca7f70996c699b0f988597a2dd2700f1f24f305318ddc8fe137d96d5fa96bf5', - tx_pos: 1, - value: 546, - txid: '4ca7f70996c699b0f988597a2dd2700f1f24f305318ddc8fe137d96d5fa96bf5', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1', - tokenTicker: 'HONK', - tokenName: 'HONK HONK', - tokenDocumentUrl: 'THE REAL HONK SLP TOKEN', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 667750, - tx_hash: - 'de912bc7a6a1b14abe04960cd9a0ef88a4f59eb04db765f7bc2c0d2c2f997054', - tx_pos: 1, - value: 546, - txid: 'de912bc7a6a1b14abe04960cd9a0ef88a4f59eb04db765f7bc2c0d2c2f997054', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7443f7c831cdf2b2b04d5f0465ed0bcf348582675b0e4f17906438c232c22f3d', - tokenTicker: 'WDT', - tokenName: - 'Test Token With Exceptionally Long Name For CSS And Style Revisions', - tokenDocumentUrl: - 'https://www.ImpossiblyLongWebsiteDidYouThinkWebDevWouldBeFun.org', - tokenDocumentHash: - '����\\�IS\u001e9�����k+���\u0018���\u001b]�߷2��', - decimals: 7, - tokenType: 1, - tokenQty: '100.0000001', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 667750, - tx_hash: - 'e25cebd4cccbbdd91b36f672d51f5ce978e0817839be9854c3550704aec4359d', - tx_pos: 1, - value: 546, - txid: 'e25cebd4cccbbdd91b36f672d51f5ce978e0817839be9854c3550704aec4359d', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1', - tokenTicker: 'HONK', - tokenName: 'HONK HONK', - tokenDocumentUrl: 'THE REAL HONK SLP TOKEN', - tokenDocumentHash: '', - decimals: 0, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 667750, - tx_hash: - 'e9a94cc174839e3659d2fe4d33490528d18ad91404b65eb8cc35d8fa2d3f5096', - tx_pos: 2, - value: 546, - txid: 'e9a94cc174839e3659d2fe4d33490528d18ad91404b65eb8cc35d8fa2d3f5096', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '5.854300861', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 667751, - tx_hash: - '05e87142de1bb8c2a43d22a2e4b97855eb84c3c76f4ea956a654efda8d0557ca', - tx_pos: 1, - value: 546, - txid: '05e87142de1bb8c2a43d22a2e4b97855eb84c3c76f4ea956a654efda8d0557ca', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1.14669914', - isValid: true, - address: 'bitcoincash:qqvcsnz9x9nu7vq35vmrkjc7hkfxhhs9nuv44zm0ed', - }, - { - height: 666969, - tx_hash: - '99583b593a3bec993328b076f4988fd77b8423d788183bf2968ed43cec11c454', - tx_pos: 2, - value: 546, - txid: '99583b593a3bec993328b076f4988fd77b8423d788183bf2968ed43cec11c454', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '9897999873.21001107', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 667560, - tx_hash: - '34002080b2e1b42ff9f33d36dbbd0d8f1aaddc5a00b916054a40c45feebaf548', - tx_pos: 2, - value: 546, - txid: '34002080b2e1b42ff9f33d36dbbd0d8f1aaddc5a00b916054a40c45feebaf548', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '3.999999998', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 667560, - tx_hash: - '8edccfafe4b002da8f1aa71daae31846c51848968e7d92dcba5f0ff97beb734d', - tx_pos: 2, - value: 546, - txid: '8edccfafe4b002da8f1aa71daae31846c51848968e7d92dcba5f0ff97beb734d', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - '7443f7c831cdf2b2b04d5f0465ed0bcf348582675b0e4f17906438c232c22f3d', - tokenTicker: 'WDT', - tokenName: - 'Test Token With Exceptionally Long Name For CSS And Style Revisions', - tokenDocumentUrl: - 'https://www.ImpossiblyLongWebsiteDidYouThinkWebDevWouldBeFun.org', - tokenDocumentHash: - '����\\�IS\u001e9�����k+���\u0018���\u001b]�߷2��', - decimals: 7, - tokenType: 1, - tokenQty: '523512244.796145', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 667793, - tx_hash: - '9c295332b7bc16758b2e328f21189fa0ea79f71908b47529749b3ba54e523817', - tx_pos: 1, - value: 546, - txid: '9c295332b7bc16758b2e328f21189fa0ea79f71908b47529749b3ba54e523817', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - tokenTicker: 'Sending Token', - tokenName: 'Sending Token', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 667909, - tx_hash: - '5bb8f9831d616b3a859ffec4507f66bd5f2f3c057d7f5d5fa5c026216d6c2646', - tx_pos: 1, - value: 546, - txid: '5bb8f9831d616b3a859ffec4507f66bd5f2f3c057d7f5d5fa5c026216d6c2646', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bef614aac85c0c866f4d39e4d12a96851267d38d1bca5bdd6488bbd42e28b6b1', - tokenTicker: 'CTP', - tokenName: 'Cash Tab Points', - tokenDocumentUrl: 'https://cashtabapp.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 667909, - tx_hash: - 'd3183b663a8d67b2b558654896b95102bbe68d164de219da96273ae52de93813', - tx_pos: 1, - value: 546, - txid: 'd3183b663a8d67b2b558654896b95102bbe68d164de219da96273ae52de93813', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bd1acc4c986de57af8d6d2a64aecad8c30ee80f37ae9d066d758923732ddc9ba', - tokenTicker: 'TBS', - tokenName: 'TestBits', - tokenDocumentUrl: 'https://thecryptoguy.com/', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 668550, - tx_hash: - '38a692e3fa974ee186eedc3a03bf3410dd03a5f35bc44f1a07f287b669dce44b', - tx_pos: 2, - value: 546, - txid: '38a692e3fa974ee186eedc3a03bf3410dd03a5f35bc44f1a07f287b669dce44b', - vout: 2, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - tokenTicker: 'Sending Token', - tokenName: 'Sending Token', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 668779, - tx_hash: - '24604835e5c68aedad2dbf4200ecc1af8c3fa92738445323af86def84d48d572', - tx_pos: 1, - value: 546, - txid: '24604835e5c68aedad2dbf4200ecc1af8c3fa92738445323af86def84d48d572', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - tokenTicker: 'Sending Token', - tokenName: 'Sending Token', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 669057, - tx_hash: - 'dd560d87bd632e40c6548021006653a150197ede13fadb5eadfa29abe4400d0e', - tx_pos: 1, - value: 546, - txid: 'dd560d87bd632e40c6548021006653a150197ede13fadb5eadfa29abe4400d0e', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb', - tokenTicker: 'NAKAMOTO', - tokenName: 'NAKAMOTO', - tokenDocumentUrl: '', - tokenDocumentHash: '', - decimals: 8, - tokenType: 1, - tokenQty: '1', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - { - height: 669510, - tx_hash: - 'acbb66f826211f40b89e84d9bd2143dfb541d67e1e3c664b17ccd3ba66327a9e', - tx_pos: 1, - value: 546, - txid: 'acbb66f826211f40b89e84d9bd2143dfb541d67e1e3c664b17ccd3ba66327a9e', - vout: 1, - utxoType: 'token', - transactionType: 'send', - tokenId: - 'bfddfcfc9fb9a8d61ed74fa94b5e32ccc03305797eea461658303df5805578ef', - tokenTicker: 'Sending Token', - tokenName: 'Sending Token', - tokenDocumentUrl: 'developer.bitcoin.com', - tokenDocumentHash: '', - decimals: 9, - tokenType: 1, - tokenQty: '1e-9', - isValid: true, - address: 'bitcoincash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxavu346vqcl', - }, - ], -}; diff --git a/web/cashtab/src/hooks/__mocks__/sendBCH.js b/web/cashtab/src/hooks/__mocks__/sendBCH.js --- a/web/cashtab/src/hooks/__mocks__/sendBCH.js +++ b/web/cashtab/src/hooks/__mocks__/sendBCH.js @@ -12,7 +12,10 @@ address: 'bitcoincash:qrzuvj0vvnsz5949h4axercl5k420eygavv0awgz05', satoshis: 131689, txid: '6e83b4bf54b5a85b6c40c4e2076a6e3945b86e4d219a931d0eb93ba1a1e3bd6f', - vout: 1, + outpoint: { + outIdx: 1, + txid: '6e83b4bf54b5a85b6c40c4e2076a6e3945b86e4d219a931d0eb93ba1a1e3bd6f', + }, isValid: false, wif: 'L3ufcMjHZ2u8v2NeyHB2pCSE5ezCk8dvR7kcLLX2B3xK5VgK9wz4', }, diff --git a/web/cashtab/src/hooks/useBCH.js b/web/cashtab/src/hooks/useBCH.js --- a/web/cashtab/src/hooks/useBCH.js +++ b/web/cashtab/src/hooks/useBCH.js @@ -1278,8 +1278,8 @@ for (let i = 0; i < utxos.length; i++) { const utxo = utxos[i]; originalAmount = originalAmount.plus(utxo.value); - const vout = utxo.vout; - const txid = utxo.txid; + const vout = utxo.outpoint.outIdx; + const txid = utxo.outpoint.txid; // add input with txid and index of vout transactionBuilder.addInput(txid, vout); diff --git a/web/cashtab/src/utils/__tests__/cashMethods.test.js b/web/cashtab/src/utils/__tests__/cashMethods.test.js --- a/web/cashtab/src/utils/__tests__/cashMethods.test.js +++ b/web/cashtab/src/utils/__tests__/cashMethods.test.js @@ -90,7 +90,7 @@ disconnectedWebsocketAlpha, unsubscribedWebsocket, } from '../__mocks__/chronikWs'; -import mockReturnGetSlpBalancesAndUtxos from '../../hooks/__mocks__/mockReturnGetSlpBalancesAndUtxos'; +import mockNonSlpUtxos from '../../hooks/__mocks__/mockNonSlpUtxos'; import { mockOneToOneSendXecTxBuilderObj, mockOneToManySendXecTxBuilderObj, @@ -514,7 +514,7 @@ it(`generateTxInput() returns an input object for a valid one to one XEC tx`, async () => { const BCH = new BCHJS(); const isOneToMany = false; - const utxos = mockReturnGetSlpBalancesAndUtxos.nonSlpUtxos; + const utxos = mockNonSlpUtxos; let txBuilder = new BCH.TransactionBuilder(); const destinationAddressAndValueArray = null; const satoshisToSend = new BigNumber(2184); @@ -538,7 +538,7 @@ it(`generateTxInput() returns an input object for a valid one to many XEC tx`, async () => { const BCH = new BCHJS(); const isOneToMany = true; - const utxos = mockReturnGetSlpBalancesAndUtxos.nonSlpUtxos; + const utxos = mockNonSlpUtxos; let txBuilder = new BCH.TransactionBuilder(); const destinationAddressAndValueArray = [ 'ecash:qrmz0egsqxj35x5jmzf8szrszdeu72fx0uxgwk3r48,3000', @@ -566,7 +566,7 @@ it(`generateTxInput() throws error for a one to many XEC tx with invalid destinationAddressAndValueArray input`, async () => { const BCH = new BCHJS(); const isOneToMany = true; - const utxos = mockReturnGetSlpBalancesAndUtxos.nonSlpUtxos; + const utxos = mockNonSlpUtxos; let txBuilder = new BCH.TransactionBuilder(); const destinationAddressAndValueArray = null; // invalid since isOneToMany is true const satoshisToSend = new BigNumber(900000); diff --git a/web/cashtab/src/utils/cashMethods.js b/web/cashtab/src/utils/cashMethods.js --- a/web/cashtab/src/utils/cashMethods.js +++ b/web/cashtab/src/utils/cashMethods.js @@ -33,7 +33,7 @@ utxoEcPair, undefined, txBuilder.hashTypes.SIGHASH_ALL, - utxo.value, + parseInt(utxo.value), ); } @@ -74,8 +74,8 @@ for (let i = 0; i < utxos.length; i++) { const utxo = utxos[i]; totalInputUtxoValue = totalInputUtxoValue.plus(utxo.value); - const vout = utxo.vout; - const txid = utxo.txid; + const vout = utxo.outpoint.outIdx; + const txid = utxo.outpoint.txid; // add input with txid and index of vout txBuilder.addInput(txid, vout);