diff --git a/web/cashtab/src/utils/__mocks__/incrementalUtxoMocks.js b/web/cashtab/src/utils/__mocks__/incrementalUtxoMocks.js index 7e644ac80..7c7b8282a 100644 --- a/web/cashtab/src/utils/__mocks__/incrementalUtxoMocks.js +++ b/web/cashtab/src/utils/__mocks__/incrementalUtxoMocks.js @@ -1,538 +1,3515 @@ export const previousUtxosObjUtxoArray = [ { height: 680782, tx_hash: '525457276f1b6984170c9b35a8312d4988fce495723eabadd2afcdb3b872b2f1', tx_pos: 1, value: 546, }, { height: 680784, tx_hash: '28f061fee068d3b9cb578141bac3d4d9ec4eccebec680464bf0aafaac414811f', tx_pos: 1, value: 546, }, { height: 680784, tx_hash: '5fa3ffccea55c968beb7d214c563c92336ce2bbccbb714ba819848a7f7060bdb', tx_pos: 1, value: 546, }, { height: 680784, tx_hash: 'daa98a872b7d88fefd2257b006db001ef82a601f3943b92e0c753076598a7b75', tx_pos: 1, value: 546, }, { height: 681190, tx_hash: 'e9dca9aa954131a0004325fff11dfddcd6e5843c468116cf4d38cb264032cdc0', tx_pos: 2, value: 546, }, { height: 681191, tx_hash: 'b35c502f388cdfbdd6841b7a73e973149b3c8deca76295a3e4665939e0562796', tx_pos: 2, value: 546, }, { height: 685181, tx_hash: '7987f68aa70d29ac0e0ac31d74354a8b1cd515c9893f6a5cdc7a3bf505e08b05', tx_pos: 1, value: 546, }, { height: 686546, tx_hash: 'bd84598096c113cd2110bc1748dd0613a933e2ddc440654c12ca4db4659933ed', tx_pos: 1, value: 546, }, { height: 687240, tx_hash: 'cd9e5bc5fc041e46e8ce01ddb232c54fe48f1fb4a7288f10fdd03a6c2af875e1', tx_pos: 2, value: 546, }, { height: 688194, tx_hash: '3de671a7107d3803d78f7f4a4e5c794d0903a8d28d16076445c084943c1e2db8', tx_pos: 1, value: 546, }, { height: 688449, tx_hash: 'ab5079e9d24c33b31893cb98d409d24acdc396b5ab751e4c428d2463e991030c', tx_pos: 2, value: 546, }, { height: 692599, tx_hash: '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', tx_pos: 1, value: 546, }, { height: 692599, tx_hash: '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', tx_pos: 1, value: 546, }, { height: 693606, tx_hash: '9989f6f4941d7cf3206b327d957b022b41bf7e449a11fd5dd5cf1e9bc93f1ecf', tx_pos: 2, value: 546, }, { height: 699216, tx_hash: '6f4e602620f5df257df8655f5834d5cfbbb73f62601c69afa96198f8ab4c2680', tx_pos: 2, value: 546, }, { height: 699359, tx_hash: 'b99cb29050779d4f185c3c31c22e664436966314c8b260075b38bbb453180603', tx_pos: 2, value: 546, }, { height: 700185, tx_hash: '71e458d9fd68a72fd5b13e2c758c6ba246495fa2933764876221450c096938b8', tx_pos: 2, value: 546, }, { height: 700469, tx_hash: '41b9da9a5719b7bf61a02a598a37ee918a4da01e6ff5b1fb5366221ee93fd498', tx_pos: 2, value: 546, }, { height: 700469, tx_hash: '6e24e89b6d5284138c69777527760500b99614631bca7f2a5c38f4648dae9524', tx_pos: 1, value: 546, }, { height: 700469, tx_hash: 'bab327965a4fd423a383859b021ea2971987ceaa6fa3bc3994c3a3266a237db5', tx_pos: 2, value: 546, }, { height: 700572, tx_hash: '431f527f657b399d8753fb63aee6c806ca0f8907d93606c46b36a33dcb5cb5b9', tx_pos: 2, value: 546, }, { height: 700677, tx_hash: 'da9460ce4b1c92b4f6ef4e4a6bc2d05539f49d02b17681389d9ce22b8dca50f0', tx_pos: 1, value: 546, }, { height: 700915, tx_hash: 'ef80e1ceeada69a9639c320c1fba47ea4417cd3aad1be1635c3472ce28aaef33', tx_pos: 2, value: 546, }, { height: 701079, tx_hash: '0d5408adeefc0d9468d957a0a2bca1b63c371e68e61b3fd9c30de60058471935', tx_pos: 1, value: 546, }, { height: 701079, tx_hash: '6397497c053e5c641ae624d4af80e8aa931a0e7b018f17a9543afed9b705cf29', tx_pos: 1, value: 546, }, { height: 701079, tx_hash: 'c665bfd2353940648b018a3126ddbc7ac309729c7ca4598ebd7941930fd80b60', tx_pos: 1, value: 546, }, { height: 701079, tx_hash: 'ebf864950d862ebb53e121350d15c8b34b2374eb22afffb98fcb655b38441d59', tx_pos: 1, value: 546, }, { height: 701079, tx_hash: 'fe10460f822163c33515f3a853c1470d68223c9c0e8f8cbc6c954ca537129f30', tx_pos: 1, value: 546, }, { height: 701189, tx_hash: '3656afe8682997be4cab4275e4bbec3f81c8aa264cec206a7215d449ee6b9af4', tx_pos: 1, value: 546, }, { height: 701189, tx_hash: '87656bf2c2f2d46d16ba6b41b4ff488a3eff1e852c64bc921322f580e375f3cb', tx_pos: 1, value: 546, }, { height: 701191, tx_hash: 'c212e45f21418fa7fd5bbf2941892353c1d6ddb9d6d16ff12fba3f7919c37b43', tx_pos: 1, value: 546, }, { height: 701194, tx_hash: 'ff61be814b18f60a640169c5d70b42ce29bd9caf2f5e5592655e924760634c1e', tx_pos: 1, value: 546, }, { height: 701208, tx_hash: '0e9179929b71d8a94ce9de75434d9e0901eacf3b2b882fa02a56eab450d0bd0b', tx_pos: 1, value: 546, }, { height: 701211, tx_hash: '4ad31e5ab9cfcead7d8b48b81a542044e44e63124eb96d6463fe4bbe5b77e9ad', tx_pos: 1, value: 546, }, { height: 701211, tx_hash: '72d4827a9a0b9adac9430ba799cb049af14fd79df11569b4e1a4741ac114b84d', tx_pos: 1, value: 546, }, { height: 701221, tx_hash: '42d3e2d97604f09c002df701f964adacacd28bc328acc0066a2563d63f522681', tx_pos: 1, value: 546, }, { height: 701223, tx_hash: '890bd4d72e75c4123b73dc81b9f4f89716fabe456a9047f9a5a5ef4a5162d218', tx_pos: 2, value: 546, }, { height: 709251, tx_hash: '9e8483407944d9b75c331ebd6178b0cabc3e8c3b5bb0492b7b2256c8740f655a', tx_pos: 1, value: 546, }, { height: 709259, tx_hash: '4f4fc78f7a008fc109789722d89fe95fe75ca1f15af625f24ae4ec74d420552e', tx_pos: 1, value: 546, }, { height: 709668, tx_hash: 'da371839612b153543d0cffb09e0220dca7c7acfebda660785807b269bd0341c', tx_pos: 1, value: 546, }, { height: 710065, tx_hash: '117939de3822734df69fb5cc27a6429860ee2f7a78917603da8b8aebba2a9150', tx_pos: 1, value: 546, }, { height: 711088, tx_hash: '982ca55c84510e4184ff5a6e7fc310a1de7833e8c617b46014f962ed89bf0f57', tx_pos: 2, value: 546, }, { height: 711227, tx_hash: 'e26db37d5c64b265514cd5cbb9d5194a7f2967b5974d167236d46be4954e435c', tx_pos: 2, value: 546, }, { height: 715111, tx_hash: 'b39fdb53e21d67fa5fd3a11122f1452f15884047f2b80e8efe633c3b520b7a39', tx_pos: 1, value: 546, }, { height: 715815, tx_hash: '3515f4a9851ad44124e0ddf6149344deb27a97720fc7e5254a9d2c86da7415a9', tx_pos: 1, value: 546, }, { height: 715815, tx_hash: '6fb6122742cac8fd1df2d68997fdfa4c077bc22d9ef4a336bfb63d24225f9060', tx_pos: 1, value: 546, }, { height: 715816, tx_hash: '2936188a41f22a3e0a47d13296147fb3f9ddd2f939fe6382904d21a610e8e49c', tx_pos: 1, value: 546, }, { height: 717055, tx_hash: '18c0360f0db5399223cbed48f55c4cee9d9914c8a4a7dedcf9172a36201e9896', tx_pos: 1, value: 546, }, { height: 717653, tx_hash: '3adbf501e21c711d20118e003711168eb39f560c01f4c6d6736fa3f3fceaa577', tx_pos: 1, value: 546, }, { height: 717824, tx_hash: 'c0fe05d7bf71cd0f476ea18cdd4ecb26e1b9a33c911f4aaf143b2b18bc3b5f4f', tx_pos: 1, value: 546, }, { height: 718091, tx_hash: '905cc5662cad77df56c3770863634ce498dde9d4772dc494d33b7ce3f36fa66c', tx_pos: 2, value: 546, }, { height: 718280, tx_hash: 'f31f4ad7bf035cfb587a07a12ec60937cb8cbeafa7e4d7ed4f3276fea26fcfec', tx_pos: 1, value: 546, }, { height: 718790, tx_hash: '67faa4753da2940d053f32edcda2c052a16c683aeb73f10cfde5c18266c14fe2', tx_pos: 2, value: 546, }, { height: 720056, tx_hash: '9c6363fb537d529f512a12d292ea9682fe7159e6bf5ebfec5b7067b401d2dba4', tx_pos: 1, value: 546, }, { height: 720070, tx_hash: '4eed87ba70864d9daa46d201c47db4513f77e5d4cc01256ab4dcc6dae9dfa055', tx_pos: 1, value: 546, }, { height: 720070, tx_hash: '7975514a3185cbb70900e9767e5fcc91c86913cb1d2ad9a28474253875271e33', tx_pos: 1, value: 546, }, { height: 720070, tx_hash: 'e10ae7a1bc78561ed367d59f150aebc13ef2054ba62f1a0db08fc7612d5ed58b', tx_pos: 1, value: 546, }, { height: 720070, tx_hash: 'fb71c88bd5369cb8278f49ac672a9721833c36fc69143848b46ae15860339ea6', tx_pos: 1, value: 546, }, { height: 720078, tx_hash: 'c3c6c6fb1619d001c29f17a701d042bc6b983e71113822aeeb66ca434fd9fa6c', tx_pos: 1, value: 546, }, { height: 720951, tx_hash: 'fb50eac73a4fd5e2a701e0dbf4e575cea9c083e061b1db722e057164c7317e5b', tx_pos: 2, value: 546, }, { height: 721083, tx_hash: 'dfb3dbf90fd87f6d66465ff05a61ddf1e1ca30900fadfe9cd4b73468649935ed', tx_pos: 2, value: 546, }, { height: 724822, tx_hash: 'ed0dab39d5e976e433a705785726901dc83daa7d579412c18ee997341de010d3', tx_pos: 1, value: 546, }, { height: 725143, tx_hash: 'e99296764134d6ea9ba7521490563762cfaf1541854ba9babc26c0df8665ac32', tx_pos: 1, value: 546, }, { height: 725871, tx_hash: '82a3fe0b03ab07a564351443634da1b1ed3960e4771c59b6f8abbf7ef4b3258d', tx_pos: 1, value: 546, }, { height: 725882, tx_hash: '1db1bef70013d178d7912731435029f9c8588f1d0089944c53eccffd255b5efc', tx_pos: 2, value: 546, }, { height: 0, tx_hash: '6c70ada5dfda75788b48ad6da211a3ea56b4b2bad8fa807954b553742e62c73d', tx_pos: 0, value: 60000, }, { height: 0, tx_hash: '94b34b291f3c77d008f3521462563ea1656542f9f8908d18a489edf5eda27fdb', tx_pos: 0, value: 900, }, { height: 0, tx_hash: '9e6d5d346effd3b57bd68d95a9bfc9de1e5787f110589aa3b88d7852eebb425f', tx_pos: 1, value: 673, }, { height: 0, tx_hash: '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', tx_pos: 2, value: 546, }, { height: 0, tx_hash: '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', tx_pos: 3, value: 95212726, }, ]; export const includedUtxoAlpha = { height: 680784, tx_hash: '28f061fee068d3b9cb578141bac3d4d9ec4eccebec680464bf0aafaac414811f', tx_pos: 1, value: 546, }; export const includedUtxoBeta = { height: 0, tx_hash: '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', tx_pos: 3, value: 95212726, }; export const excludedUtxoAlpha = { // Note this is includedUtxoAlpha with tx_pos of 0 instead of 1 height: 680784, tx_hash: '28f061fee068d3b9cb578141bac3d4d9ec4eccebec680464bf0aafaac414811f', tx_pos: 0, value: 546, }; export const excludedUtxoBeta = { // Note this is includedUtxoBeta with value 95212725 instead of 95212726 height: 0, tx_hash: '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', tx_pos: 3, value: 95212725, }; export const validUtxo = { height: 724992, tx_hash: '8d4bdedb7c4443412e0c2f316a330863aef54d9ba73560ca60cca6408527b247', tx_pos: 0, value: 10200, }; export const invalidUtxoMissingHeight = { tx_hash: '8d4bdedb7c4443412e0c2f316a330863aef54d9ba73560ca60cca6408527b247', tx_pos: 0, value: 10200, }; export const invalidUtxoTxidUndefined = { height: 724992, tx_hash: undefined, tx_pos: 0, value: 10200, }; + +export const previousUtxosTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'Consumed utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 7500000, + }, + { + tx_hash: + 'Consumed utxo from a tx sending 100,000 XEC, not necessarily the same txid', + tx_pos: 1, + value: 5000000, + }, + { + tx_hash: 'Consumed utxo from sending an eToken tx (XEC utxo)', + tx_pos: 0, + value: 10546, + }, + { + tx_hash: + 'Consumed utxo from sending an eToken tx (eToken utxo)', + tx_pos: 1, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; + +export const currentUtxosAfterSingleXecReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random new xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'Consumed utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 7500000, + }, + { + tx_hash: + 'Consumed utxo from a tx sending 100,000 XEC, not necessarily the same txid', + tx_pos: 1, + value: 5000000, + }, + { + tx_hash: 'Consumed utxo from sending an eToken tx (XEC utxo)', + tx_pos: 0, + value: 10546, + }, + { + tx_hash: + 'Consumed utxo from sending an eToken tx (eToken utxo)', + tx_pos: 1, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const utxosAddedBySingleXecReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random new xec utxo', + tx_pos: 1, + value: 1000, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const previousUtxosBeforeSingleXecReceiveTx = [ + { + utxos: [ + { + height: 660149, + tx_hash: + '976753770d4fd3baa0a36e0792ba6b0f906efc771b25690b5300f5437ba0f0db', + tx_pos: 2, + value: 546, + }, + { + height: 660971, + tx_hash: + 'aefc3f3c65760d0f0fa716a84d12c4dc76ca7552953d6c7a4358abb6e24c5d7c', + tx_pos: 2, + value: 546, + }, + { + height: 661700, + tx_hash: + '854d49d29819cdb5c4d9248146ffc82771cd3a7727f25a22993456f68050503e', + tx_pos: 1, + value: 546, + }, + { + height: 662159, + tx_hash: + '05e90e9f35bc041a2939e0e28cf9c436c9adb0f247a7fb0d1f4abb26d418f096', + tx_pos: 2, + value: 546, + }, + { + height: 662935, + tx_hash: + 'ec423d0089f5cd85973ff6d875e9507f6b396b3b82bf6e9f5cfb24b7c70273bd', + tx_pos: 2, + value: 546, + }, + { + height: 666954, + tx_hash: + '1b19314963be975c57eb37df12b6a8e0598bcb743226cdc684895520f51c4dfe', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + }, + { + utxos: [], + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + }, + { + utxos: [ + { + height: 669673, + tx_hash: + 'bd8b527df1d5d3bd611a8f0ee8f14af83cb7d107fb2e140dbd2d9f4b3a86786a', + tx_pos: 1, + value: 546, + }, + { + height: 669673, + tx_hash: + 'd2ad75a6974e4dc021483f381f314d260e958cbcc444230b485436b6264eaf3d', + tx_pos: 1, + value: 546, + }, + { + height: 669942, + tx_hash: + 'ff5fe4c631a5dd3e3b1cc74cb12b9eebf04d177c206eaadb8d949cc4fbb6a092', + tx_pos: 0, + value: 546, + }, + { + height: 669958, + tx_hash: + '0da32e1f64a12ed2a4afd406368cc76ab3f8c462b26fbdd9817675ffa0fa7668', + tx_pos: 0, + value: 546, + }, + { + height: 669959, + tx_hash: + '182f50952631c4bcdd46f4d42ac68376674727fa40dbcbf1101e40fbfd58b55a', + tx_pos: 0, + value: 546, + }, + { + height: 670076, + tx_hash: + '4064e02fe523cb107fecaf3f5abaabb89f7e2bb6662751ba4f86f8d18ebeb1fa', + tx_pos: 1, + value: 546, + }, + { + height: 670482, + tx_hash: + 'b78a3f8d17fc69cd1314517c36abad85f09fbca4d43ac108bced2ac78428f2c8', + tx_pos: 0, + value: 546, + }, + { + height: 670670, + tx_hash: + '55eec1cb63d2b3aa604ba2f505735de07cb224fcdbd8e554aa1180f59cdd0541', + tx_pos: 0, + value: 546, + }, + { + height: 671724, + tx_hash: + '37f63a9b1bcdc4733425dcfc3a7f3564d5095467ad7f64707fe52dbe5c1e1897', + tx_pos: 2, + value: 546, + }, + { + height: 672701, + tx_hash: + 'f90631b48521a4147dd9dd7091ce936eddc0c3e6221ec87fa4fabacc453a0b95', + tx_pos: 1, + value: 546, + }, + { + height: 691329, + tx_hash: + '8d38f2f805ed3f4089cd28cd89ca279628a9fa933b04fd4820d14e66fc4d4ed5', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 2, + value: 546, + }, + { + height: 714696, + tx_hash: + 'a3add503bba986398b39fa2200ce658423a597b4f7fe9de04a2da4501f8b05a3', + tx_pos: 1, + value: 546, + }, + { + height: 714696, + tx_hash: + 'f29939b961d8f3b27d7826e3f22451fcf9273ac84421312a20148b1e083a5bb0', + tx_pos: 1, + value: 546, + }, + { + height: 714701, + tx_hash: + '2502bdc75d3afdce0742505d53e6d50cefb1268d7c2a835c06b701702b79e1b8', + tx_pos: 1, + value: 546, + }, + { + height: 714705, + tx_hash: + '742a8e656fe7a6cff86e688ec191be780974fc54b900f58cd15049be89e9e1c5', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'c70d5f036368e184d2a52389b2f4c2471855aebaccbd418db24d4515ce062dbe', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'edb693529851379bcbd75008f78940df8232510e6a1c64d8dc81693ae2a53f66', + tx_pos: 1, + value: 546, + }, + { + height: 722860, + tx_hash: + 'afe4bc6ff9a3e26b6fb8803b754223b9f368402f479b21c39b2ff8f54bfb7f5e', + tx_pos: 2, + value: 546, + }, + { + height: 723247, + tx_hash: + 'cc03f4b178f54327d5c337650531abf2a2464e2a9a486c38c6194f8ac96e9842', + tx_pos: 2, + value: 546, + }, + { + height: 724544, + tx_hash: + '83b9bab68c36364035976c7590df0b19d2f7b16c98d51d124891289bf3a122a5', + tx_pos: 2, + value: 546, + }, + { + height: 724545, + tx_hash: + '9ea438223212fc98af2ada411ecf75e83a10ad091bebfb0adc3925f32f311c71', + tx_pos: 2, + value: 546, + }, + { + height: 725144, + tx_hash: + '69fdd3dc4914c33f980aee4dcc04e65706e43498acf92f48bf70c159cb708111', + tx_pos: 1, + value: 1254435, + }, + { + height: 725144, + tx_hash: + 'ef67e7785c2a991c4f5fc20f88b2649dd2fb2c637b6861a9586d4449ea1b06b3', + tx_pos: 1, + value: 463186023, + }, + ], + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + }, +]; +export const currentUtxosAfterSingleXecReceiveTx = [ + { + utxos: [ + { + height: 660149, + tx_hash: + '976753770d4fd3baa0a36e0792ba6b0f906efc771b25690b5300f5437ba0f0db', + tx_pos: 2, + value: 546, + }, + { + height: 660971, + tx_hash: + 'aefc3f3c65760d0f0fa716a84d12c4dc76ca7552953d6c7a4358abb6e24c5d7c', + tx_pos: 2, + value: 546, + }, + { + height: 661700, + tx_hash: + '854d49d29819cdb5c4d9248146ffc82771cd3a7727f25a22993456f68050503e', + tx_pos: 1, + value: 546, + }, + { + height: 662159, + tx_hash: + '05e90e9f35bc041a2939e0e28cf9c436c9adb0f247a7fb0d1f4abb26d418f096', + tx_pos: 2, + value: 546, + }, + { + height: 662935, + tx_hash: + 'ec423d0089f5cd85973ff6d875e9507f6b396b3b82bf6e9f5cfb24b7c70273bd', + tx_pos: 2, + value: 546, + }, + { + height: 666954, + tx_hash: + '1b19314963be975c57eb37df12b6a8e0598bcb743226cdc684895520f51c4dfe', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + }, + { + utxos: [], + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + }, + { + utxos: [ + { + height: 669673, + tx_hash: + 'bd8b527df1d5d3bd611a8f0ee8f14af83cb7d107fb2e140dbd2d9f4b3a86786a', + tx_pos: 1, + value: 546, + }, + { + height: 669673, + tx_hash: + 'd2ad75a6974e4dc021483f381f314d260e958cbcc444230b485436b6264eaf3d', + tx_pos: 1, + value: 546, + }, + { + height: 669942, + tx_hash: + 'ff5fe4c631a5dd3e3b1cc74cb12b9eebf04d177c206eaadb8d949cc4fbb6a092', + tx_pos: 0, + value: 546, + }, + { + height: 669958, + tx_hash: + '0da32e1f64a12ed2a4afd406368cc76ab3f8c462b26fbdd9817675ffa0fa7668', + tx_pos: 0, + value: 546, + }, + { + height: 669959, + tx_hash: + '182f50952631c4bcdd46f4d42ac68376674727fa40dbcbf1101e40fbfd58b55a', + tx_pos: 0, + value: 546, + }, + { + height: 670076, + tx_hash: + '4064e02fe523cb107fecaf3f5abaabb89f7e2bb6662751ba4f86f8d18ebeb1fa', + tx_pos: 1, + value: 546, + }, + { + height: 670482, + tx_hash: + 'b78a3f8d17fc69cd1314517c36abad85f09fbca4d43ac108bced2ac78428f2c8', + tx_pos: 0, + value: 546, + }, + { + height: 670670, + tx_hash: + '55eec1cb63d2b3aa604ba2f505735de07cb224fcdbd8e554aa1180f59cdd0541', + tx_pos: 0, + value: 546, + }, + { + height: 671724, + tx_hash: + '37f63a9b1bcdc4733425dcfc3a7f3564d5095467ad7f64707fe52dbe5c1e1897', + tx_pos: 2, + value: 546, + }, + { + height: 672701, + tx_hash: + 'f90631b48521a4147dd9dd7091ce936eddc0c3e6221ec87fa4fabacc453a0b95', + tx_pos: 1, + value: 546, + }, + { + height: 691329, + tx_hash: + '8d38f2f805ed3f4089cd28cd89ca279628a9fa933b04fd4820d14e66fc4d4ed5', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 2, + value: 546, + }, + { + height: 714696, + tx_hash: + 'a3add503bba986398b39fa2200ce658423a597b4f7fe9de04a2da4501f8b05a3', + tx_pos: 1, + value: 546, + }, + { + height: 714696, + tx_hash: + 'f29939b961d8f3b27d7826e3f22451fcf9273ac84421312a20148b1e083a5bb0', + tx_pos: 1, + value: 546, + }, + { + height: 714701, + tx_hash: + '2502bdc75d3afdce0742505d53e6d50cefb1268d7c2a835c06b701702b79e1b8', + tx_pos: 1, + value: 546, + }, + { + height: 714705, + tx_hash: + '742a8e656fe7a6cff86e688ec191be780974fc54b900f58cd15049be89e9e1c5', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'c70d5f036368e184d2a52389b2f4c2471855aebaccbd418db24d4515ce062dbe', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'edb693529851379bcbd75008f78940df8232510e6a1c64d8dc81693ae2a53f66', + tx_pos: 1, + value: 546, + }, + { + height: 722860, + tx_hash: + 'afe4bc6ff9a3e26b6fb8803b754223b9f368402f479b21c39b2ff8f54bfb7f5e', + tx_pos: 2, + value: 546, + }, + { + height: 723247, + tx_hash: + 'cc03f4b178f54327d5c337650531abf2a2464e2a9a486c38c6194f8ac96e9842', + tx_pos: 2, + value: 546, + }, + { + height: 724544, + tx_hash: + '83b9bab68c36364035976c7590df0b19d2f7b16c98d51d124891289bf3a122a5', + tx_pos: 2, + value: 546, + }, + { + height: 724545, + tx_hash: + '9ea438223212fc98af2ada411ecf75e83a10ad091bebfb0adc3925f32f311c71', + tx_pos: 2, + value: 546, + }, + { + height: 725144, + tx_hash: + '69fdd3dc4914c33f980aee4dcc04e65706e43498acf92f48bf70c159cb708111', + tx_pos: 1, + value: 1254435, + }, + { + height: 725144, + tx_hash: + 'ef67e7785c2a991c4f5fc20f88b2649dd2fb2c637b6861a9586d4449ea1b06b3', + tx_pos: 1, + value: 463186023, + }, + { + height: 0, + tx_hash: + 'c1d76ac732b84b9cbd6d94c1463c1739e1a701c5e6bd966f904226ae43c13e0c', + tx_pos: 0, + value: 42069, + }, + ], + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + }, +]; +export const utxosAddedBySingleXecReceiveTx = [ + { + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + utxos: [], + }, + { + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + utxos: [], + }, + { + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + utxos: [ + { + height: 0, + tx_hash: + 'c1d76ac732b84b9cbd6d94c1463c1739e1a701c5e6bd966f904226ae43c13e0c', + tx_pos: 0, + value: 42069, + }, + ], + }, +]; +export const currentUtxosAfterMultiXecReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 0, + value: 1000, + }, + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 2, + value: 1000, + }, + { + tx_hash: 'Consumed utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 7500000, + }, + { + tx_hash: + 'Consumed utxo from a tx sending 100,000 XEC, not necessarily the same txid', + tx_pos: 1, + value: 5000000, + }, + { + tx_hash: 'Consumed utxo from sending an eToken tx (XEC utxo)', + tx_pos: 0, + value: 10546, + }, + { + tx_hash: + 'Consumed utxo from sending an eToken tx (eToken utxo)', + tx_pos: 1, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const utxosAddedByMultiXecReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 0, + value: 1000, + }, + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random new xec utxo from a multi-send tx', + tx_pos: 2, + value: 1000, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const previousUtxosBeforeMultiXecReceiveTx = + currentUtxosAfterSingleXecReceiveTx; + +export const currentUtxosAfterMultiXecReceiveTx = [ + { + utxos: [ + { + height: 660149, + tx_hash: + '976753770d4fd3baa0a36e0792ba6b0f906efc771b25690b5300f5437ba0f0db', + tx_pos: 2, + value: 546, + }, + { + height: 660971, + tx_hash: + 'aefc3f3c65760d0f0fa716a84d12c4dc76ca7552953d6c7a4358abb6e24c5d7c', + tx_pos: 2, + value: 546, + }, + { + height: 661700, + tx_hash: + '854d49d29819cdb5c4d9248146ffc82771cd3a7727f25a22993456f68050503e', + tx_pos: 1, + value: 546, + }, + { + height: 662159, + tx_hash: + '05e90e9f35bc041a2939e0e28cf9c436c9adb0f247a7fb0d1f4abb26d418f096', + tx_pos: 2, + value: 546, + }, + { + height: 662935, + tx_hash: + 'ec423d0089f5cd85973ff6d875e9507f6b396b3b82bf6e9f5cfb24b7c70273bd', + tx_pos: 2, + value: 546, + }, + { + height: 666954, + tx_hash: + '1b19314963be975c57eb37df12b6a8e0598bcb743226cdc684895520f51c4dfe', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + }, + { + utxos: [], + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + }, + { + utxos: [ + { + height: 669673, + tx_hash: + 'bd8b527df1d5d3bd611a8f0ee8f14af83cb7d107fb2e140dbd2d9f4b3a86786a', + tx_pos: 1, + value: 546, + }, + { + height: 669673, + tx_hash: + 'd2ad75a6974e4dc021483f381f314d260e958cbcc444230b485436b6264eaf3d', + tx_pos: 1, + value: 546, + }, + { + height: 669942, + tx_hash: + 'ff5fe4c631a5dd3e3b1cc74cb12b9eebf04d177c206eaadb8d949cc4fbb6a092', + tx_pos: 0, + value: 546, + }, + { + height: 669958, + tx_hash: + '0da32e1f64a12ed2a4afd406368cc76ab3f8c462b26fbdd9817675ffa0fa7668', + tx_pos: 0, + value: 546, + }, + { + height: 669959, + tx_hash: + '182f50952631c4bcdd46f4d42ac68376674727fa40dbcbf1101e40fbfd58b55a', + tx_pos: 0, + value: 546, + }, + { + height: 670076, + tx_hash: + '4064e02fe523cb107fecaf3f5abaabb89f7e2bb6662751ba4f86f8d18ebeb1fa', + tx_pos: 1, + value: 546, + }, + { + height: 670482, + tx_hash: + 'b78a3f8d17fc69cd1314517c36abad85f09fbca4d43ac108bced2ac78428f2c8', + tx_pos: 0, + value: 546, + }, + { + height: 670670, + tx_hash: + '55eec1cb63d2b3aa604ba2f505735de07cb224fcdbd8e554aa1180f59cdd0541', + tx_pos: 0, + value: 546, + }, + { + height: 671724, + tx_hash: + '37f63a9b1bcdc4733425dcfc3a7f3564d5095467ad7f64707fe52dbe5c1e1897', + tx_pos: 2, + value: 546, + }, + { + height: 672701, + tx_hash: + 'f90631b48521a4147dd9dd7091ce936eddc0c3e6221ec87fa4fabacc453a0b95', + tx_pos: 1, + value: 546, + }, + { + height: 691329, + tx_hash: + '8d38f2f805ed3f4089cd28cd89ca279628a9fa933b04fd4820d14e66fc4d4ed5', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 2, + value: 546, + }, + { + height: 714696, + tx_hash: + 'a3add503bba986398b39fa2200ce658423a597b4f7fe9de04a2da4501f8b05a3', + tx_pos: 1, + value: 546, + }, + { + height: 714696, + tx_hash: + 'f29939b961d8f3b27d7826e3f22451fcf9273ac84421312a20148b1e083a5bb0', + tx_pos: 1, + value: 546, + }, + { + height: 714701, + tx_hash: + '2502bdc75d3afdce0742505d53e6d50cefb1268d7c2a835c06b701702b79e1b8', + tx_pos: 1, + value: 546, + }, + { + height: 714705, + tx_hash: + '742a8e656fe7a6cff86e688ec191be780974fc54b900f58cd15049be89e9e1c5', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'c70d5f036368e184d2a52389b2f4c2471855aebaccbd418db24d4515ce062dbe', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'edb693529851379bcbd75008f78940df8232510e6a1c64d8dc81693ae2a53f66', + tx_pos: 1, + value: 546, + }, + { + height: 722860, + tx_hash: + 'afe4bc6ff9a3e26b6fb8803b754223b9f368402f479b21c39b2ff8f54bfb7f5e', + tx_pos: 2, + value: 546, + }, + { + height: 723247, + tx_hash: + 'cc03f4b178f54327d5c337650531abf2a2464e2a9a486c38c6194f8ac96e9842', + tx_pos: 2, + value: 546, + }, + { + height: 724544, + tx_hash: + '83b9bab68c36364035976c7590df0b19d2f7b16c98d51d124891289bf3a122a5', + tx_pos: 2, + value: 546, + }, + { + height: 724545, + tx_hash: + '9ea438223212fc98af2ada411ecf75e83a10ad091bebfb0adc3925f32f311c71', + tx_pos: 2, + value: 546, + }, + { + height: 725144, + tx_hash: + '69fdd3dc4914c33f980aee4dcc04e65706e43498acf92f48bf70c159cb708111', + tx_pos: 1, + value: 1254435, + }, + { + height: 725144, + tx_hash: + 'ef67e7785c2a991c4f5fc20f88b2649dd2fb2c637b6861a9586d4449ea1b06b3', + tx_pos: 1, + value: 463186023, + }, + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 0, + value: 42000, + }, + { + height: 0, + tx_hash: + 'c1d76ac732b84b9cbd6d94c1463c1739e1a701c5e6bd966f904226ae43c13e0c', + tx_pos: 0, + value: 42069, + }, + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 1, + value: 6900, + }, + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 2, + value: 3300, + }, + ], + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + }, +]; +export const utxosAddedByMultiXecReceiveTx = [ + { + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + utxos: [], + }, + { + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + utxos: [], + }, + { + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + utxos: [ + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 0, + value: 42000, + }, + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 1, + value: 6900, + }, + { + height: 0, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 2, + value: 3300, + }, + ], + }, +]; +export const currentUtxosAfterEtokenReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'Newly Received eToken Utxo', + tx_pos: 0, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const utxosAddedByEtokenReceiveTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'Newly Received eToken Utxo', + tx_pos: 0, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const previousUtxosBeforeEtokenReceiveTx = + currentUtxosAfterMultiXecReceiveTx; +export const currentUtxosAfterEtokenReceiveTx = [ + { + utxos: [ + { + height: 660149, + tx_hash: + '976753770d4fd3baa0a36e0792ba6b0f906efc771b25690b5300f5437ba0f0db', + tx_pos: 2, + value: 546, + }, + { + height: 660971, + tx_hash: + 'aefc3f3c65760d0f0fa716a84d12c4dc76ca7552953d6c7a4358abb6e24c5d7c', + tx_pos: 2, + value: 546, + }, + { + height: 661700, + tx_hash: + '854d49d29819cdb5c4d9248146ffc82771cd3a7727f25a22993456f68050503e', + tx_pos: 1, + value: 546, + }, + { + height: 662159, + tx_hash: + '05e90e9f35bc041a2939e0e28cf9c436c9adb0f247a7fb0d1f4abb26d418f096', + tx_pos: 2, + value: 546, + }, + { + height: 662935, + tx_hash: + 'ec423d0089f5cd85973ff6d875e9507f6b396b3b82bf6e9f5cfb24b7c70273bd', + tx_pos: 2, + value: 546, + }, + { + height: 666954, + tx_hash: + '1b19314963be975c57eb37df12b6a8e0598bcb743226cdc684895520f51c4dfe', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + }, + { + utxos: [], + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + }, + { + utxos: [ + { + height: 669673, + tx_hash: + 'bd8b527df1d5d3bd611a8f0ee8f14af83cb7d107fb2e140dbd2d9f4b3a86786a', + tx_pos: 1, + value: 546, + }, + { + height: 669673, + tx_hash: + 'd2ad75a6974e4dc021483f381f314d260e958cbcc444230b485436b6264eaf3d', + tx_pos: 1, + value: 546, + }, + { + height: 669942, + tx_hash: + 'ff5fe4c631a5dd3e3b1cc74cb12b9eebf04d177c206eaadb8d949cc4fbb6a092', + tx_pos: 0, + value: 546, + }, + { + height: 669958, + tx_hash: + '0da32e1f64a12ed2a4afd406368cc76ab3f8c462b26fbdd9817675ffa0fa7668', + tx_pos: 0, + value: 546, + }, + { + height: 669959, + tx_hash: + '182f50952631c4bcdd46f4d42ac68376674727fa40dbcbf1101e40fbfd58b55a', + tx_pos: 0, + value: 546, + }, + { + height: 670076, + tx_hash: + '4064e02fe523cb107fecaf3f5abaabb89f7e2bb6662751ba4f86f8d18ebeb1fa', + tx_pos: 1, + value: 546, + }, + { + height: 670482, + tx_hash: + 'b78a3f8d17fc69cd1314517c36abad85f09fbca4d43ac108bced2ac78428f2c8', + tx_pos: 0, + value: 546, + }, + { + height: 670670, + tx_hash: + '55eec1cb63d2b3aa604ba2f505735de07cb224fcdbd8e554aa1180f59cdd0541', + tx_pos: 0, + value: 546, + }, + { + height: 671724, + tx_hash: + '37f63a9b1bcdc4733425dcfc3a7f3564d5095467ad7f64707fe52dbe5c1e1897', + tx_pos: 2, + value: 546, + }, + { + height: 672701, + tx_hash: + 'f90631b48521a4147dd9dd7091ce936eddc0c3e6221ec87fa4fabacc453a0b95', + tx_pos: 1, + value: 546, + }, + { + height: 691329, + tx_hash: + '8d38f2f805ed3f4089cd28cd89ca279628a9fa933b04fd4820d14e66fc4d4ed5', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 2, + value: 546, + }, + { + height: 714696, + tx_hash: + 'a3add503bba986398b39fa2200ce658423a597b4f7fe9de04a2da4501f8b05a3', + tx_pos: 1, + value: 546, + }, + { + height: 714696, + tx_hash: + 'f29939b961d8f3b27d7826e3f22451fcf9273ac84421312a20148b1e083a5bb0', + tx_pos: 1, + value: 546, + }, + { + height: 714701, + tx_hash: + '2502bdc75d3afdce0742505d53e6d50cefb1268d7c2a835c06b701702b79e1b8', + tx_pos: 1, + value: 546, + }, + { + height: 714705, + tx_hash: + '742a8e656fe7a6cff86e688ec191be780974fc54b900f58cd15049be89e9e1c5', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'c70d5f036368e184d2a52389b2f4c2471855aebaccbd418db24d4515ce062dbe', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'edb693529851379bcbd75008f78940df8232510e6a1c64d8dc81693ae2a53f66', + tx_pos: 1, + value: 546, + }, + { + height: 722860, + tx_hash: + 'afe4bc6ff9a3e26b6fb8803b754223b9f368402f479b21c39b2ff8f54bfb7f5e', + tx_pos: 2, + value: 546, + }, + { + height: 723247, + tx_hash: + 'cc03f4b178f54327d5c337650531abf2a2464e2a9a486c38c6194f8ac96e9842', + tx_pos: 2, + value: 546, + }, + { + height: 724544, + tx_hash: + '83b9bab68c36364035976c7590df0b19d2f7b16c98d51d124891289bf3a122a5', + tx_pos: 2, + value: 546, + }, + { + height: 724545, + tx_hash: + '9ea438223212fc98af2ada411ecf75e83a10ad091bebfb0adc3925f32f311c71', + tx_pos: 2, + value: 546, + }, + { + height: 725144, + tx_hash: + '69fdd3dc4914c33f980aee4dcc04e65706e43498acf92f48bf70c159cb708111', + tx_pos: 1, + value: 1254435, + }, + { + height: 725144, + tx_hash: + 'ef67e7785c2a991c4f5fc20f88b2649dd2fb2c637b6861a9586d4449ea1b06b3', + tx_pos: 1, + value: 463186023, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 0, + value: 42000, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 1, + value: 6900, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 2, + value: 3300, + }, + { + height: 726142, + tx_hash: + 'c1d76ac732b84b9cbd6d94c1463c1739e1a701c5e6bd966f904226ae43c13e0c', + tx_pos: 0, + value: 42069, + }, + { + height: 0, + tx_hash: + '66f0663e79f6a7fa3bf0834a16b48cb86fa42076c0df25ae89b402d5ee97c311', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + }, +]; +export const utxosAddedByEtokenReceiveTx = [ + { + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + utxos: [], + }, + { + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + utxos: [], + }, + { + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + utxos: [ + { + height: 0, + tx_hash: + '66f0663e79f6a7fa3bf0834a16b48cb86fa42076c0df25ae89b402d5ee97c311', + tx_pos: 1, + value: 546, + }, + ], + }, +]; +export const previousUtxosBeforeSendAllTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25550, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const currentUtxosAfterSendAllTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const previousUtxosBeforeSendAllTx = [ + { + utxos: [], + address: 'bitcoincash:qq3q2vr3qkawa3m2lhg5wurzgpxjqvek6crvxgpsrf', + }, + { + utxos: [], + address: 'bitcoincash:qzv8arsknrmda2n4xg02rvtp2yzh072c6s5ms7jhfq', + }, + { + utxos: [ + { + height: 726153, + tx_hash: + 'a40216751b8c9c5ade1dd2962afcdc657e4e2c92416fb0b2dd956bce75425afb', + tx_pos: 0, + value: 4206900, + }, + ], + address: 'bitcoincash:qq3af2r4n5ndek40cq3lq8y5qjq8v0aq4sc0faj07q', + }, +]; +export const currentUtxosAfterSendAllTx = [ + { + utxos: [], + address: 'bitcoincash:qq3q2vr3qkawa3m2lhg5wurzgpxjqvek6crvxgpsrf', + }, + { + utxos: [], + address: 'bitcoincash:qzv8arsknrmda2n4xg02rvtp2yzh072c6s5ms7jhfq', + }, + { + utxos: [], + address: 'bitcoincash:qq3af2r4n5ndek40cq3lq8y5qjq8v0aq4sc0faj07q', + }, +]; +export const previousUtxosBeforeSingleXecSendTx = + currentUtxosAfterEtokenReceiveTx; +export const currentUtxosAfterSingleXecSendTx = [ + { + utxos: [ + { + height: 660149, + tx_hash: + '976753770d4fd3baa0a36e0792ba6b0f906efc771b25690b5300f5437ba0f0db', + tx_pos: 2, + value: 546, + }, + { + height: 660971, + tx_hash: + 'aefc3f3c65760d0f0fa716a84d12c4dc76ca7552953d6c7a4358abb6e24c5d7c', + tx_pos: 2, + value: 546, + }, + { + height: 661700, + tx_hash: + '854d49d29819cdb5c4d9248146ffc82771cd3a7727f25a22993456f68050503e', + tx_pos: 1, + value: 546, + }, + { + height: 662159, + tx_hash: + '05e90e9f35bc041a2939e0e28cf9c436c9adb0f247a7fb0d1f4abb26d418f096', + tx_pos: 2, + value: 546, + }, + { + height: 662935, + tx_hash: + 'ec423d0089f5cd85973ff6d875e9507f6b396b3b82bf6e9f5cfb24b7c70273bd', + tx_pos: 2, + value: 546, + }, + { + height: 666954, + tx_hash: + '1b19314963be975c57eb37df12b6a8e0598bcb743226cdc684895520f51c4dfe', + tx_pos: 1, + value: 546, + }, + ], + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + }, + { + utxos: [], + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + }, + { + utxos: [ + { + height: 669673, + tx_hash: + 'bd8b527df1d5d3bd611a8f0ee8f14af83cb7d107fb2e140dbd2d9f4b3a86786a', + tx_pos: 1, + value: 546, + }, + { + height: 669673, + tx_hash: + 'd2ad75a6974e4dc021483f381f314d260e958cbcc444230b485436b6264eaf3d', + tx_pos: 1, + value: 546, + }, + { + height: 669942, + tx_hash: + 'ff5fe4c631a5dd3e3b1cc74cb12b9eebf04d177c206eaadb8d949cc4fbb6a092', + tx_pos: 0, + value: 546, + }, + { + height: 669958, + tx_hash: + '0da32e1f64a12ed2a4afd406368cc76ab3f8c462b26fbdd9817675ffa0fa7668', + tx_pos: 0, + value: 546, + }, + { + height: 669959, + tx_hash: + '182f50952631c4bcdd46f4d42ac68376674727fa40dbcbf1101e40fbfd58b55a', + tx_pos: 0, + value: 546, + }, + { + height: 670076, + tx_hash: + '4064e02fe523cb107fecaf3f5abaabb89f7e2bb6662751ba4f86f8d18ebeb1fa', + tx_pos: 1, + value: 546, + }, + { + height: 670482, + tx_hash: + 'b78a3f8d17fc69cd1314517c36abad85f09fbca4d43ac108bced2ac78428f2c8', + tx_pos: 0, + value: 546, + }, + { + height: 670670, + tx_hash: + '55eec1cb63d2b3aa604ba2f505735de07cb224fcdbd8e554aa1180f59cdd0541', + tx_pos: 0, + value: 546, + }, + { + height: 671724, + tx_hash: + '37f63a9b1bcdc4733425dcfc3a7f3564d5095467ad7f64707fe52dbe5c1e1897', + tx_pos: 2, + value: 546, + }, + { + height: 672701, + tx_hash: + 'f90631b48521a4147dd9dd7091ce936eddc0c3e6221ec87fa4fabacc453a0b95', + tx_pos: 1, + value: 546, + }, + { + height: 691329, + tx_hash: + '8d38f2f805ed3f4089cd28cd89ca279628a9fa933b04fd4820d14e66fc4d4ed5', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 2, + value: 546, + }, + { + height: 714696, + tx_hash: + 'a3add503bba986398b39fa2200ce658423a597b4f7fe9de04a2da4501f8b05a3', + tx_pos: 1, + value: 546, + }, + { + height: 714696, + tx_hash: + 'f29939b961d8f3b27d7826e3f22451fcf9273ac84421312a20148b1e083a5bb0', + tx_pos: 1, + value: 546, + }, + { + height: 714701, + tx_hash: + '2502bdc75d3afdce0742505d53e6d50cefb1268d7c2a835c06b701702b79e1b8', + tx_pos: 1, + value: 546, + }, + { + height: 714705, + tx_hash: + '742a8e656fe7a6cff86e688ec191be780974fc54b900f58cd15049be89e9e1c5', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'c70d5f036368e184d2a52389b2f4c2471855aebaccbd418db24d4515ce062dbe', + tx_pos: 1, + value: 546, + }, + { + height: 714823, + tx_hash: + 'edb693529851379bcbd75008f78940df8232510e6a1c64d8dc81693ae2a53f66', + tx_pos: 1, + value: 546, + }, + { + height: 722860, + tx_hash: + 'afe4bc6ff9a3e26b6fb8803b754223b9f368402f479b21c39b2ff8f54bfb7f5e', + tx_pos: 2, + value: 546, + }, + { + height: 723247, + tx_hash: + 'cc03f4b178f54327d5c337650531abf2a2464e2a9a486c38c6194f8ac96e9842', + tx_pos: 2, + value: 546, + }, + { + height: 724544, + tx_hash: + '83b9bab68c36364035976c7590df0b19d2f7b16c98d51d124891289bf3a122a5', + tx_pos: 2, + value: 546, + }, + { + height: 724545, + tx_hash: + '9ea438223212fc98af2ada411ecf75e83a10ad091bebfb0adc3925f32f311c71', + tx_pos: 2, + value: 546, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 0, + value: 42000, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 1, + value: 6900, + }, + { + height: 726142, + tx_hash: + '19130781afa8476b82797b0abb8ee5206f6f84ab4b1c296b900020f2a885d29a', + tx_pos: 2, + value: 3300, + }, + { + height: 726142, + tx_hash: + 'c1d76ac732b84b9cbd6d94c1463c1739e1a701c5e6bd966f904226ae43c13e0c', + tx_pos: 0, + value: 42069, + }, + { + height: 726143, + tx_hash: + '66f0663e79f6a7fa3bf0834a16b48cb86fa42076c0df25ae89b402d5ee97c311', + tx_pos: 1, + value: 546, + }, + { + height: 0, + tx_hash: + '082fb2d1289f1c6576c34c714c3a7b3e8fef89e16802d0ea47777fcf339c99ee', + tx_pos: 1, + value: 460232806, + }, + ], + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + }, +]; +// i.e. change +export const utxosAddedBySingleXecSendTx = [ + { + address: 'bitcoincash:qpv9fx6mjdpgltygudnpw3tvmxdyzx7savhphtzswu', + utxos: [], + }, + { + address: 'bitcoincash:qppc593r2hhksvrz5l77n5yd6usrj74waqnqemgjgf', + utxos: [], + }, + { + address: 'bitcoincash:qpmytrdsakt0axrrlswvaj069nat3p9s7ct4lsf8k9', + utxos: [ + { + height: 0, + tx_hash: + '082fb2d1289f1c6576c34c714c3a7b3e8fef89e16802d0ea47777fcf339c99ee', + tx_pos: 1, + value: 460232806, + }, + ], + }, +]; +export const currentUtxosAfterSingleXecSendTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'Change utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 2500000, + }, + { + tx_hash: 'Consumed utxo from sending an eToken tx (XEC utxo)', + tx_pos: 0, + value: 10546, + }, + { + tx_hash: + 'Consumed utxo from sending an eToken tx (eToken utxo)', + tx_pos: 1, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const utxosAddedBySingleXecSendTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'Change utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 2500000, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const currentUtxosAfterEtokenSendTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'some random xec utxo', + tx_pos: 1, + value: 1000, + }, + { + tx_hash: 'some random eToken utxo', + tx_pos: 1, + value: 546, + }, + { + tx_hash: 'alpha', + tx_pos: 1, + value: 25000, + }, + { + tx_hash: 'Consumed utxo from a tx sending 100,000 XEC', + tx_pos: 0, + value: 7500000, + }, + { + tx_hash: + 'Consumed utxo from a tx sending 100,000 XEC, not necessarily the same txid', + tx_pos: 1, + value: 5000000, + }, + { + tx_hash: 'Change utxo from an eToken tx (XEC change)', + tx_pos: 0, + value: 9454, + }, + { + tx_hash: 'Change utxo from an eToken tx (eToken change)', + tx_pos: 0, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const utxosAddedByEtokenSendTxTemplate = [ + { + utxos: [], + address: 'Cashtab 145 address probably with no utxos', + }, + { + utxos: [], + address: 'Cashtab 245 address probably with no utxos', + }, + { + utxos: [ + { + tx_hash: 'Change utxo from an eToken tx (XEC change)', + tx_pos: 0, + value: 9454, + }, + { + tx_hash: 'Change utxo from an eToken tx (eToken change)', + tx_pos: 0, + value: 546, + }, + ], + address: 'Cashtab 1899 address probably with all the utxos', + }, +]; +export const previousUtxosBeforeEtokenSendTx = [ + { + utxos: [], + address: 'bitcoincash:qq0mw6nah9huwaxt45qw3fegjpszkjlrqsvttwy36p', + }, + { + utxos: [], + address: 'bitcoincash:qz5lf9pxde9neq3hzte8mmwts03sktl9nuz6m3dynu', + }, + { + utxos: [ + { + height: 680782, + tx_hash: + '525457276f1b6984170c9b35a8312d4988fce495723eabadd2afcdb3b872b2f1', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + '28f061fee068d3b9cb578141bac3d4d9ec4eccebec680464bf0aafaac414811f', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + '5fa3ffccea55c968beb7d214c563c92336ce2bbccbb714ba819848a7f7060bdb', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + 'daa98a872b7d88fefd2257b006db001ef82a601f3943b92e0c753076598a7b75', + tx_pos: 1, + value: 546, + }, + { + height: 681190, + tx_hash: + 'e9dca9aa954131a0004325fff11dfddcd6e5843c468116cf4d38cb264032cdc0', + tx_pos: 2, + value: 546, + }, + { + height: 681191, + tx_hash: + 'b35c502f388cdfbdd6841b7a73e973149b3c8deca76295a3e4665939e0562796', + tx_pos: 2, + value: 546, + }, + { + height: 685181, + tx_hash: + '7987f68aa70d29ac0e0ac31d74354a8b1cd515c9893f6a5cdc7a3bf505e08b05', + tx_pos: 1, + value: 546, + }, + { + height: 686546, + tx_hash: + 'bd84598096c113cd2110bc1748dd0613a933e2ddc440654c12ca4db4659933ed', + tx_pos: 1, + value: 546, + }, + { + height: 687240, + tx_hash: + 'cd9e5bc5fc041e46e8ce01ddb232c54fe48f1fb4a7288f10fdd03a6c2af875e1', + tx_pos: 2, + value: 546, + }, + { + height: 688194, + tx_hash: + '3de671a7107d3803d78f7f4a4e5c794d0903a8d28d16076445c084943c1e2db8', + tx_pos: 1, + value: 546, + }, + { + height: 688449, + tx_hash: + 'ab5079e9d24c33b31893cb98d409d24acdc396b5ab751e4c428d2463e991030c', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 1, + value: 546, + }, + { + height: 693606, + tx_hash: + '9989f6f4941d7cf3206b327d957b022b41bf7e449a11fd5dd5cf1e9bc93f1ecf', + tx_pos: 2, + value: 546, + }, + { + height: 699216, + tx_hash: + '6f4e602620f5df257df8655f5834d5cfbbb73f62601c69afa96198f8ab4c2680', + tx_pos: 2, + value: 546, + }, + { + height: 699359, + tx_hash: + 'b99cb29050779d4f185c3c31c22e664436966314c8b260075b38bbb453180603', + tx_pos: 2, + value: 546, + }, + { + height: 700185, + tx_hash: + '71e458d9fd68a72fd5b13e2c758c6ba246495fa2933764876221450c096938b8', + tx_pos: 2, + value: 546, + }, + { + height: 700469, + tx_hash: + '41b9da9a5719b7bf61a02a598a37ee918a4da01e6ff5b1fb5366221ee93fd498', + tx_pos: 2, + value: 546, + }, + { + height: 700469, + tx_hash: + '6e24e89b6d5284138c69777527760500b99614631bca7f2a5c38f4648dae9524', + tx_pos: 1, + value: 546, + }, + { + height: 700469, + tx_hash: + 'bab327965a4fd423a383859b021ea2971987ceaa6fa3bc3994c3a3266a237db5', + tx_pos: 2, + value: 546, + }, + { + height: 700572, + tx_hash: + '431f527f657b399d8753fb63aee6c806ca0f8907d93606c46b36a33dcb5cb5b9', + tx_pos: 2, + value: 546, + }, + { + height: 700677, + tx_hash: + 'da9460ce4b1c92b4f6ef4e4a6bc2d05539f49d02b17681389d9ce22b8dca50f0', + tx_pos: 1, + value: 546, + }, + { + height: 700915, + tx_hash: + 'ef80e1ceeada69a9639c320c1fba47ea4417cd3aad1be1635c3472ce28aaef33', + tx_pos: 2, + value: 546, + }, + { + height: 701079, + tx_hash: + '0d5408adeefc0d9468d957a0a2bca1b63c371e68e61b3fd9c30de60058471935', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + '6397497c053e5c641ae624d4af80e8aa931a0e7b018f17a9543afed9b705cf29', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'c665bfd2353940648b018a3126ddbc7ac309729c7ca4598ebd7941930fd80b60', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'ebf864950d862ebb53e121350d15c8b34b2374eb22afffb98fcb655b38441d59', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'fe10460f822163c33515f3a853c1470d68223c9c0e8f8cbc6c954ca537129f30', + tx_pos: 1, + value: 546, + }, + { + height: 701189, + tx_hash: + '3656afe8682997be4cab4275e4bbec3f81c8aa264cec206a7215d449ee6b9af4', + tx_pos: 1, + value: 546, + }, + { + height: 701189, + tx_hash: + '87656bf2c2f2d46d16ba6b41b4ff488a3eff1e852c64bc921322f580e375f3cb', + tx_pos: 1, + value: 546, + }, + { + height: 701191, + tx_hash: + 'c212e45f21418fa7fd5bbf2941892353c1d6ddb9d6d16ff12fba3f7919c37b43', + tx_pos: 1, + value: 546, + }, + { + height: 701194, + tx_hash: + 'ff61be814b18f60a640169c5d70b42ce29bd9caf2f5e5592655e924760634c1e', + tx_pos: 1, + value: 546, + }, + { + height: 701208, + tx_hash: + '0e9179929b71d8a94ce9de75434d9e0901eacf3b2b882fa02a56eab450d0bd0b', + tx_pos: 1, + value: 546, + }, + { + height: 701211, + tx_hash: + '4ad31e5ab9cfcead7d8b48b81a542044e44e63124eb96d6463fe4bbe5b77e9ad', + tx_pos: 1, + value: 546, + }, + { + height: 701211, + tx_hash: + '72d4827a9a0b9adac9430ba799cb049af14fd79df11569b4e1a4741ac114b84d', + tx_pos: 1, + value: 546, + }, + { + height: 701221, + tx_hash: + '42d3e2d97604f09c002df701f964adacacd28bc328acc0066a2563d63f522681', + tx_pos: 1, + value: 546, + }, + { + height: 701223, + tx_hash: + '890bd4d72e75c4123b73dc81b9f4f89716fabe456a9047f9a5a5ef4a5162d218', + tx_pos: 2, + value: 546, + }, + { + height: 709251, + tx_hash: + '9e8483407944d9b75c331ebd6178b0cabc3e8c3b5bb0492b7b2256c8740f655a', + tx_pos: 1, + value: 546, + }, + { + height: 709259, + tx_hash: + '4f4fc78f7a008fc109789722d89fe95fe75ca1f15af625f24ae4ec74d420552e', + tx_pos: 1, + value: 546, + }, + { + height: 709668, + tx_hash: + 'da371839612b153543d0cffb09e0220dca7c7acfebda660785807b269bd0341c', + tx_pos: 1, + value: 546, + }, + { + height: 710065, + tx_hash: + '117939de3822734df69fb5cc27a6429860ee2f7a78917603da8b8aebba2a9150', + tx_pos: 1, + value: 546, + }, + { + height: 711088, + tx_hash: + '982ca55c84510e4184ff5a6e7fc310a1de7833e8c617b46014f962ed89bf0f57', + tx_pos: 2, + value: 546, + }, + { + height: 711227, + tx_hash: + 'e26db37d5c64b265514cd5cbb9d5194a7f2967b5974d167236d46be4954e435c', + tx_pos: 2, + value: 546, + }, + { + height: 715111, + tx_hash: + 'b39fdb53e21d67fa5fd3a11122f1452f15884047f2b80e8efe633c3b520b7a39', + tx_pos: 1, + value: 546, + }, + { + height: 715815, + tx_hash: + '3515f4a9851ad44124e0ddf6149344deb27a97720fc7e5254a9d2c86da7415a9', + tx_pos: 1, + value: 546, + }, + { + height: 715815, + tx_hash: + '6fb6122742cac8fd1df2d68997fdfa4c077bc22d9ef4a336bfb63d24225f9060', + tx_pos: 1, + value: 546, + }, + { + height: 715816, + tx_hash: + '2936188a41f22a3e0a47d13296147fb3f9ddd2f939fe6382904d21a610e8e49c', + tx_pos: 1, + value: 546, + }, + { + height: 717055, + tx_hash: + '18c0360f0db5399223cbed48f55c4cee9d9914c8a4a7dedcf9172a36201e9896', + tx_pos: 1, + value: 546, + }, + { + height: 717653, + tx_hash: + '3adbf501e21c711d20118e003711168eb39f560c01f4c6d6736fa3f3fceaa577', + tx_pos: 1, + value: 546, + }, + { + height: 717824, + tx_hash: + 'c0fe05d7bf71cd0f476ea18cdd4ecb26e1b9a33c911f4aaf143b2b18bc3b5f4f', + tx_pos: 1, + value: 546, + }, + { + height: 718091, + tx_hash: + '905cc5662cad77df56c3770863634ce498dde9d4772dc494d33b7ce3f36fa66c', + tx_pos: 2, + value: 546, + }, + { + height: 718280, + tx_hash: + 'f31f4ad7bf035cfb587a07a12ec60937cb8cbeafa7e4d7ed4f3276fea26fcfec', + tx_pos: 1, + value: 546, + }, + { + height: 718790, + tx_hash: + '67faa4753da2940d053f32edcda2c052a16c683aeb73f10cfde5c18266c14fe2', + tx_pos: 2, + value: 546, + }, + { + height: 720056, + tx_hash: + '9c6363fb537d529f512a12d292ea9682fe7159e6bf5ebfec5b7067b401d2dba4', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + '4eed87ba70864d9daa46d201c47db4513f77e5d4cc01256ab4dcc6dae9dfa055', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + '7975514a3185cbb70900e9767e5fcc91c86913cb1d2ad9a28474253875271e33', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + 'e10ae7a1bc78561ed367d59f150aebc13ef2054ba62f1a0db08fc7612d5ed58b', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + 'fb71c88bd5369cb8278f49ac672a9721833c36fc69143848b46ae15860339ea6', + tx_pos: 1, + value: 546, + }, + { + height: 720078, + tx_hash: + 'c3c6c6fb1619d001c29f17a701d042bc6b983e71113822aeeb66ca434fd9fa6c', + tx_pos: 1, + value: 546, + }, + { + height: 720951, + tx_hash: + 'fb50eac73a4fd5e2a701e0dbf4e575cea9c083e061b1db722e057164c7317e5b', + tx_pos: 2, + value: 546, + }, + { + height: 721083, + tx_hash: + 'dfb3dbf90fd87f6d66465ff05a61ddf1e1ca30900fadfe9cd4b73468649935ed', + tx_pos: 2, + value: 546, + }, + { + height: 724822, + tx_hash: + 'ed0dab39d5e976e433a705785726901dc83daa7d579412c18ee997341de010d3', + tx_pos: 1, + value: 546, + }, + { + height: 725143, + tx_hash: + 'e99296764134d6ea9ba7521490563762cfaf1541854ba9babc26c0df8665ac32', + tx_pos: 1, + value: 546, + }, + { + height: 725871, + tx_hash: + '82a3fe0b03ab07a564351443634da1b1ed3960e4771c59b6f8abbf7ef4b3258d', + tx_pos: 1, + value: 546, + }, + { + height: 725882, + tx_hash: + '1db1bef70013d178d7912731435029f9c8588f1d0089944c53eccffd255b5efc', + tx_pos: 2, + value: 546, + }, + { + height: 726001, + tx_hash: + '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', + tx_pos: 2, + value: 546, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 0, + value: 10000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 1, + value: 20000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 2, + value: 30000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 3, + value: 40000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 4, + value: 50000, + }, + { + height: 726009, + tx_hash: + '52d2fd9d10debecbed6f8c3554517dada688c83197c4e57ad74556f0317c84b4', + tx_pos: 1, + value: 546, + }, + { + height: 726009, + tx_hash: + '9a0ba92af0aaaf16ec6a8bf0fc12d919078cd4c3f556a27dc792689803337ef9', + tx_pos: 1, + value: 95202647, + }, + { + height: 726009, + tx_hash: + 'b7bc037936eaac55cb2f377bbf564a06e86c419875f4ab2879f452e598aa999b', + tx_pos: 1, + value: 50148, + }, + { + height: 726009, + tx_hash: + 'd2e7d88785948ea46d1162401abf6e26b42b886df5c7fe5a64fe14ed292ebcdd', + tx_pos: 1, + value: 5146, + }, + ], + address: 'bitcoincash:qz2708636snqhsxu8wnlka78h6fdp77ar5ulhz04hr', + }, +]; +export const currentUtxosAfterEtokenSendTx = [ + { + utxos: [], + address: 'bitcoincash:qq0mw6nah9huwaxt45qw3fegjpszkjlrqsvttwy36p', + }, + { + utxos: [], + address: 'bitcoincash:qz5lf9pxde9neq3hzte8mmwts03sktl9nuz6m3dynu', + }, + { + utxos: [ + { + height: 680782, + tx_hash: + '525457276f1b6984170c9b35a8312d4988fce495723eabadd2afcdb3b872b2f1', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + '28f061fee068d3b9cb578141bac3d4d9ec4eccebec680464bf0aafaac414811f', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + '5fa3ffccea55c968beb7d214c563c92336ce2bbccbb714ba819848a7f7060bdb', + tx_pos: 1, + value: 546, + }, + { + height: 680784, + tx_hash: + 'daa98a872b7d88fefd2257b006db001ef82a601f3943b92e0c753076598a7b75', + tx_pos: 1, + value: 546, + }, + { + height: 681190, + tx_hash: + 'e9dca9aa954131a0004325fff11dfddcd6e5843c468116cf4d38cb264032cdc0', + tx_pos: 2, + value: 546, + }, + { + height: 681191, + tx_hash: + 'b35c502f388cdfbdd6841b7a73e973149b3c8deca76295a3e4665939e0562796', + tx_pos: 2, + value: 546, + }, + { + height: 685181, + tx_hash: + '7987f68aa70d29ac0e0ac31d74354a8b1cd515c9893f6a5cdc7a3bf505e08b05', + tx_pos: 1, + value: 546, + }, + { + height: 686546, + tx_hash: + 'bd84598096c113cd2110bc1748dd0613a933e2ddc440654c12ca4db4659933ed', + tx_pos: 1, + value: 546, + }, + { + height: 687240, + tx_hash: + 'cd9e5bc5fc041e46e8ce01ddb232c54fe48f1fb4a7288f10fdd03a6c2af875e1', + tx_pos: 2, + value: 546, + }, + { + height: 688194, + tx_hash: + '3de671a7107d3803d78f7f4a4e5c794d0903a8d28d16076445c084943c1e2db8', + tx_pos: 1, + value: 546, + }, + { + height: 688449, + tx_hash: + 'ab5079e9d24c33b31893cb98d409d24acdc396b5ab751e4c428d2463e991030c', + tx_pos: 2, + value: 546, + }, + { + height: 692599, + tx_hash: + '0158981b89b75bd923d511aaaaccd94b8d1d86babeeb69c29e3caf71e33bcc11', + tx_pos: 1, + value: 546, + }, + { + height: 692599, + tx_hash: + '1ef9ad7d3e01fd9d83983eac92eefb4900b343225a80c29bff025deff9aab57c', + tx_pos: 1, + value: 546, + }, + { + height: 693606, + tx_hash: + '9989f6f4941d7cf3206b327d957b022b41bf7e449a11fd5dd5cf1e9bc93f1ecf', + tx_pos: 2, + value: 546, + }, + { + height: 699216, + tx_hash: + '6f4e602620f5df257df8655f5834d5cfbbb73f62601c69afa96198f8ab4c2680', + tx_pos: 2, + value: 546, + }, + { + height: 699359, + tx_hash: + 'b99cb29050779d4f185c3c31c22e664436966314c8b260075b38bbb453180603', + tx_pos: 2, + value: 546, + }, + { + height: 700185, + tx_hash: + '71e458d9fd68a72fd5b13e2c758c6ba246495fa2933764876221450c096938b8', + tx_pos: 2, + value: 546, + }, + { + height: 700469, + tx_hash: + '41b9da9a5719b7bf61a02a598a37ee918a4da01e6ff5b1fb5366221ee93fd498', + tx_pos: 2, + value: 546, + }, + { + height: 700469, + tx_hash: + '6e24e89b6d5284138c69777527760500b99614631bca7f2a5c38f4648dae9524', + tx_pos: 1, + value: 546, + }, + { + height: 700469, + tx_hash: + 'bab327965a4fd423a383859b021ea2971987ceaa6fa3bc3994c3a3266a237db5', + tx_pos: 2, + value: 546, + }, + { + height: 700572, + tx_hash: + '431f527f657b399d8753fb63aee6c806ca0f8907d93606c46b36a33dcb5cb5b9', + tx_pos: 2, + value: 546, + }, + { + height: 700677, + tx_hash: + 'da9460ce4b1c92b4f6ef4e4a6bc2d05539f49d02b17681389d9ce22b8dca50f0', + tx_pos: 1, + value: 546, + }, + { + height: 700915, + tx_hash: + 'ef80e1ceeada69a9639c320c1fba47ea4417cd3aad1be1635c3472ce28aaef33', + tx_pos: 2, + value: 546, + }, + { + height: 701079, + tx_hash: + '0d5408adeefc0d9468d957a0a2bca1b63c371e68e61b3fd9c30de60058471935', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + '6397497c053e5c641ae624d4af80e8aa931a0e7b018f17a9543afed9b705cf29', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'c665bfd2353940648b018a3126ddbc7ac309729c7ca4598ebd7941930fd80b60', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'ebf864950d862ebb53e121350d15c8b34b2374eb22afffb98fcb655b38441d59', + tx_pos: 1, + value: 546, + }, + { + height: 701079, + tx_hash: + 'fe10460f822163c33515f3a853c1470d68223c9c0e8f8cbc6c954ca537129f30', + tx_pos: 1, + value: 546, + }, + { + height: 701189, + tx_hash: + '3656afe8682997be4cab4275e4bbec3f81c8aa264cec206a7215d449ee6b9af4', + tx_pos: 1, + value: 546, + }, + { + height: 701189, + tx_hash: + '87656bf2c2f2d46d16ba6b41b4ff488a3eff1e852c64bc921322f580e375f3cb', + tx_pos: 1, + value: 546, + }, + { + height: 701191, + tx_hash: + 'c212e45f21418fa7fd5bbf2941892353c1d6ddb9d6d16ff12fba3f7919c37b43', + tx_pos: 1, + value: 546, + }, + { + height: 701194, + tx_hash: + 'ff61be814b18f60a640169c5d70b42ce29bd9caf2f5e5592655e924760634c1e', + tx_pos: 1, + value: 546, + }, + { + height: 701208, + tx_hash: + '0e9179929b71d8a94ce9de75434d9e0901eacf3b2b882fa02a56eab450d0bd0b', + tx_pos: 1, + value: 546, + }, + { + height: 701211, + tx_hash: + '4ad31e5ab9cfcead7d8b48b81a542044e44e63124eb96d6463fe4bbe5b77e9ad', + tx_pos: 1, + value: 546, + }, + { + height: 701211, + tx_hash: + '72d4827a9a0b9adac9430ba799cb049af14fd79df11569b4e1a4741ac114b84d', + tx_pos: 1, + value: 546, + }, + { + height: 701221, + tx_hash: + '42d3e2d97604f09c002df701f964adacacd28bc328acc0066a2563d63f522681', + tx_pos: 1, + value: 546, + }, + { + height: 701223, + tx_hash: + '890bd4d72e75c4123b73dc81b9f4f89716fabe456a9047f9a5a5ef4a5162d218', + tx_pos: 2, + value: 546, + }, + { + height: 709251, + tx_hash: + '9e8483407944d9b75c331ebd6178b0cabc3e8c3b5bb0492b7b2256c8740f655a', + tx_pos: 1, + value: 546, + }, + { + height: 709259, + tx_hash: + '4f4fc78f7a008fc109789722d89fe95fe75ca1f15af625f24ae4ec74d420552e', + tx_pos: 1, + value: 546, + }, + { + height: 709668, + tx_hash: + 'da371839612b153543d0cffb09e0220dca7c7acfebda660785807b269bd0341c', + tx_pos: 1, + value: 546, + }, + { + height: 710065, + tx_hash: + '117939de3822734df69fb5cc27a6429860ee2f7a78917603da8b8aebba2a9150', + tx_pos: 1, + value: 546, + }, + { + height: 711227, + tx_hash: + 'e26db37d5c64b265514cd5cbb9d5194a7f2967b5974d167236d46be4954e435c', + tx_pos: 2, + value: 546, + }, + { + height: 715111, + tx_hash: + 'b39fdb53e21d67fa5fd3a11122f1452f15884047f2b80e8efe633c3b520b7a39', + tx_pos: 1, + value: 546, + }, + { + height: 715815, + tx_hash: + '3515f4a9851ad44124e0ddf6149344deb27a97720fc7e5254a9d2c86da7415a9', + tx_pos: 1, + value: 546, + }, + { + height: 715815, + tx_hash: + '6fb6122742cac8fd1df2d68997fdfa4c077bc22d9ef4a336bfb63d24225f9060', + tx_pos: 1, + value: 546, + }, + { + height: 715816, + tx_hash: + '2936188a41f22a3e0a47d13296147fb3f9ddd2f939fe6382904d21a610e8e49c', + tx_pos: 1, + value: 546, + }, + { + height: 717055, + tx_hash: + '18c0360f0db5399223cbed48f55c4cee9d9914c8a4a7dedcf9172a36201e9896', + tx_pos: 1, + value: 546, + }, + { + height: 717653, + tx_hash: + '3adbf501e21c711d20118e003711168eb39f560c01f4c6d6736fa3f3fceaa577', + tx_pos: 1, + value: 546, + }, + { + height: 717824, + tx_hash: + 'c0fe05d7bf71cd0f476ea18cdd4ecb26e1b9a33c911f4aaf143b2b18bc3b5f4f', + tx_pos: 1, + value: 546, + }, + { + height: 718091, + tx_hash: + '905cc5662cad77df56c3770863634ce498dde9d4772dc494d33b7ce3f36fa66c', + tx_pos: 2, + value: 546, + }, + { + height: 718280, + tx_hash: + 'f31f4ad7bf035cfb587a07a12ec60937cb8cbeafa7e4d7ed4f3276fea26fcfec', + tx_pos: 1, + value: 546, + }, + { + height: 718790, + tx_hash: + '67faa4753da2940d053f32edcda2c052a16c683aeb73f10cfde5c18266c14fe2', + tx_pos: 2, + value: 546, + }, + { + height: 720056, + tx_hash: + '9c6363fb537d529f512a12d292ea9682fe7159e6bf5ebfec5b7067b401d2dba4', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + '4eed87ba70864d9daa46d201c47db4513f77e5d4cc01256ab4dcc6dae9dfa055', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + '7975514a3185cbb70900e9767e5fcc91c86913cb1d2ad9a28474253875271e33', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + 'e10ae7a1bc78561ed367d59f150aebc13ef2054ba62f1a0db08fc7612d5ed58b', + tx_pos: 1, + value: 546, + }, + { + height: 720070, + tx_hash: + 'fb71c88bd5369cb8278f49ac672a9721833c36fc69143848b46ae15860339ea6', + tx_pos: 1, + value: 546, + }, + { + height: 720078, + tx_hash: + 'c3c6c6fb1619d001c29f17a701d042bc6b983e71113822aeeb66ca434fd9fa6c', + tx_pos: 1, + value: 546, + }, + { + height: 720951, + tx_hash: + 'fb50eac73a4fd5e2a701e0dbf4e575cea9c083e061b1db722e057164c7317e5b', + tx_pos: 2, + value: 546, + }, + { + height: 721083, + tx_hash: + 'dfb3dbf90fd87f6d66465ff05a61ddf1e1ca30900fadfe9cd4b73468649935ed', + tx_pos: 2, + value: 546, + }, + { + height: 724822, + tx_hash: + 'ed0dab39d5e976e433a705785726901dc83daa7d579412c18ee997341de010d3', + tx_pos: 1, + value: 546, + }, + { + height: 725143, + tx_hash: + 'e99296764134d6ea9ba7521490563762cfaf1541854ba9babc26c0df8665ac32', + tx_pos: 1, + value: 546, + }, + { + height: 725871, + tx_hash: + '82a3fe0b03ab07a564351443634da1b1ed3960e4771c59b6f8abbf7ef4b3258d', + tx_pos: 1, + value: 546, + }, + { + height: 725882, + tx_hash: + '1db1bef70013d178d7912731435029f9c8588f1d0089944c53eccffd255b5efc', + tx_pos: 2, + value: 546, + }, + { + height: 726001, + tx_hash: + '3c89d42ff868c74546ba819aaf4e5c5d5e5c63437d91c9c1cf5406ccbec3d952', + tx_pos: 2, + value: 546, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 0, + value: 10000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 1, + value: 20000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 2, + value: 30000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 3, + value: 40000, + }, + { + height: 726008, + tx_hash: + '85e9379d5b9b371aa7f9464376290fbc6a40083ec14883460b649898f6d7c60b', + tx_pos: 4, + value: 50000, + }, + { + height: 726009, + tx_hash: + '52d2fd9d10debecbed6f8c3554517dada688c83197c4e57ad74556f0317c84b4', + tx_pos: 1, + value: 546, + }, + { + height: 726009, + tx_hash: + 'b7bc037936eaac55cb2f377bbf564a06e86c419875f4ab2879f452e598aa999b', + tx_pos: 1, + value: 50148, + }, + { + height: 726009, + tx_hash: + 'd2e7d88785948ea46d1162401abf6e26b42b886df5c7fe5a64fe14ed292ebcdd', + tx_pos: 1, + value: 5146, + }, + { + height: 0, + tx_hash: + 'b8982cf5531afcba125a9e17550d42a01045c3aa5ee70a485f8fbcde3dae191d', + tx_pos: 2, + value: 546, + }, + { + height: 0, + tx_hash: + 'b8982cf5531afcba125a9e17550d42a01045c3aa5ee70a485f8fbcde3dae191d', + tx_pos: 3, + value: 95200829, + }, + ], + address: 'bitcoincash:qz2708636snqhsxu8wnlka78h6fdp77ar5ulhz04hr', + }, +]; +export const utxosAddedByEtokenSendTx = [ + { + address: 'bitcoincash:qq0mw6nah9huwaxt45qw3fegjpszkjlrqsvttwy36p', + utxos: [], + }, + { + address: 'bitcoincash:qz5lf9pxde9neq3hzte8mmwts03sktl9nuz6m3dynu', + utxos: [], + }, + { + address: 'bitcoincash:qz2708636snqhsxu8wnlka78h6fdp77ar5ulhz04hr', + utxos: [ + { + height: 0, + tx_hash: + 'b8982cf5531afcba125a9e17550d42a01045c3aa5ee70a485f8fbcde3dae191d', + tx_pos: 2, + value: 546, + }, + { + height: 0, + tx_hash: + 'b8982cf5531afcba125a9e17550d42a01045c3aa5ee70a485f8fbcde3dae191d', + tx_pos: 3, + value: 95200829, + }, + ], + }, +]; diff --git a/web/cashtab/src/utils/__tests__/cashMethods.test.js b/web/cashtab/src/utils/__tests__/cashMethods.test.js index 575537e63..60e1ab1b5 100644 --- a/web/cashtab/src/utils/__tests__/cashMethods.test.js +++ b/web/cashtab/src/utils/__tests__/cashMethods.test.js @@ -1,378 +1,505 @@ import { ValidationError } from 'ecashaddrjs'; import { fromSmallestDenomination, batchArray, flattenBatchedHydratedUtxos, loadStoredWallet, isValidStoredWallet, fromLegacyDecimals, convertToEcashPrefix, checkNullUtxosForTokenStatus, confirmNonEtokenUtxos, isLegacyMigrationRequired, toLegacyCash, toLegacyToken, toLegacyCashArray, parseOpReturn, isExcludedUtxo, + whichUtxosWereAdded, } from '@utils/cashMethods'; import { unbatchedArray, arrayBatchedByThree, } from '../__mocks__/mockBatchedArrays'; import { validAddressArrayInput, validAddressArrayInputMixedPrefixes, validAddressArrayOutput, validLargeAddressArrayInput, validLargeAddressArrayOutput, invalidAddressArrayInput, } from '../__mocks__/mockAddressArray'; import { unflattenedHydrateUtxosResponse, flattenedHydrateUtxosResponse, } from '../__mocks__/flattenBatchedHydratedUtxosMocks'; import { cachedUtxos, utxosLoadedFromCache, } from '../__mocks__/mockCachedUtxos'; import { validStoredWallet, invalidStoredWallet, } from '../__mocks__/mockStoredWallets'; import { mockTxDataResults, mockNonEtokenUtxos, mockTxDataResultsWithEtoken, mockHydratedUtxosWithNullValues, mockHydratedUtxosWithNullValuesSetToFalse, } from '../__mocks__/nullUtxoMocks'; import { missingPath1899Wallet, missingPublicKeyInPath1899Wallet, missingPublicKeyInPath145Wallet, missingPublicKeyInPath245Wallet, notLegacyWallet, } from '../__mocks__/mockLegacyWallets'; import { shortCashtabMessageInputHex, longCashtabMessageInputHex, shortExternalMessageInputHex, longExternalMessageInputHex, shortSegmentedExternalMessageInputHex, longSegmentedExternalMessageInputHex, mixedSegmentedExternalMessageInputHex, mockParsedShortCashtabMessageArray, mockParsedLongCashtabMessageArray, mockParsedShortExternalMessageArray, mockParsedLongExternalMessageArray, mockParsedShortSegmentedExternalMessageArray, mockParsedLongSegmentedExternalMessageArray, mockParsedMixedSegmentedExternalMessageArray, eTokenInputHex, mockParsedETokenOutputArray, } from '../__mocks__/mockOpReturnParsedArray'; import { excludedUtxoAlpha, excludedUtxoBeta, includedUtxoAlpha, includedUtxoBeta, previousUtxosObjUtxoArray, + previousUtxosTemplate, + currentUtxosAfterSingleXecReceiveTxTemplate, + utxosAddedBySingleXecReceiveTxTemplate, + previousUtxosBeforeSingleXecReceiveTx, + currentUtxosAfterSingleXecReceiveTx, + utxosAddedBySingleXecReceiveTx, + currentUtxosAfterMultiXecReceiveTxTemplate, + utxosAddedByMultiXecReceiveTxTemplate, + previousUtxosBeforeMultiXecReceiveTx, + currentUtxosAfterMultiXecReceiveTx, + utxosAddedByMultiXecReceiveTx, + currentUtxosAfterEtokenReceiveTxTemplate, + utxosAddedByEtokenReceiveTxTemplate, + previousUtxosBeforeEtokenReceiveTx, + currentUtxosAfterEtokenReceiveTx, + utxosAddedByEtokenReceiveTx, + previousUtxosBeforeSendAllTxTemplate, + currentUtxosAfterSendAllTxTemplate, + previousUtxosBeforeSendAllTx, + currentUtxosAfterSendAllTx, + previousUtxosBeforeSingleXecSendTx, + currentUtxosAfterSingleXecSendTx, + utxosAddedBySingleXecSendTx, + currentUtxosAfterSingleXecSendTxTemplate, + utxosAddedBySingleXecSendTxTemplate, + currentUtxosAfterEtokenSendTxTemplate, + utxosAddedByEtokenSendTxTemplate, + previousUtxosBeforeEtokenSendTx, + currentUtxosAfterEtokenSendTx, + utxosAddedByEtokenSendTx, } from '../__mocks__/incrementalUtxoMocks'; describe('Correctly executes cash utility functions', () => { it(`Correctly converts smallest base unit to smallest decimal for cashDecimals = 2`, () => { expect(fromSmallestDenomination(1, 2)).toBe(0.01); }); it(`Correctly converts largest base unit to smallest decimal for cashDecimals = 2`, () => { expect(fromSmallestDenomination(1000000012345678, 2)).toBe( 10000000123456.78, ); }); it(`Correctly converts smallest base unit to smallest decimal for cashDecimals = 8`, () => { expect(fromSmallestDenomination(1, 8)).toBe(0.00000001); }); it(`Correctly converts largest base unit to smallest decimal for cashDecimals = 8`, () => { expect(fromSmallestDenomination(1000000012345678, 8)).toBe( 10000000.12345678, ); }); it(`Correctly converts an array of length 10 to an array of 4 arrays, each with max length 3`, () => { expect(batchArray(unbatchedArray, 3)).toStrictEqual( arrayBatchedByThree, ); }); it(`If array length is less than batch size, return original array as first and only element of new array`, () => { expect(batchArray(unbatchedArray, 20)).toStrictEqual([unbatchedArray]); }); it(`Flattens hydrateUtxos from Promise.all() response into array that can be parsed by getSlpBalancesAndUtxos`, () => { expect( flattenBatchedHydratedUtxos(unflattenedHydrateUtxosResponse), ).toStrictEqual(flattenedHydrateUtxosResponse); }); it(`Accepts a cachedWalletState that has not preserved BigNumber object types, and returns the same wallet state with BigNumber type re-instituted`, () => { expect(loadStoredWallet(cachedUtxos)).toStrictEqual( utxosLoadedFromCache, ); }); it(`Recognizes a stored wallet as valid if it has all required fields`, () => { expect(isValidStoredWallet(validStoredWallet)).toBe(true); }); it(`Recognizes a stored wallet as invalid if it is missing required fields`, () => { expect(isValidStoredWallet(invalidStoredWallet)).toBe(false); }); it(`Converts a legacy BCH amount to an XEC amount`, () => { expect(fromLegacyDecimals(0.00000546, 2)).toStrictEqual(5.46); }); it(`Leaves a legacy BCH amount unchanged if currency.cashDecimals is 8`, () => { expect(fromLegacyDecimals(0.00000546, 8)).toStrictEqual(0.00000546); }); it(`convertToEcashPrefix converts a bitcoincash: prefixed address to an ecash: prefixed address`, () => { expect( convertToEcashPrefix( 'bitcoincash:qz2708636snqhsxu8wnlka78h6fdp77ar5ulhz04hr', ), ).toBe('ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035'); }); it(`convertToEcashPrefix returns an ecash: prefix address unchanged`, () => { expect( convertToEcashPrefix( 'ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035', ), ).toBe('ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035'); }); it(`toLegacyToken returns an etoken: prefix address as simpleledger:`, () => { expect( toLegacyToken('etoken:qz2708636snqhsxu8wnlka78h6fdp77ar5tv2tzg4r'), ).toBe('simpleledger:qz2708636snqhsxu8wnlka78h6fdp77ar5syue64fa'); }); it(`toLegacyToken returns an prefixless valid etoken address in simpleledger: format with prefix`, () => { expect( toLegacyToken('qz2708636snqhsxu8wnlka78h6fdp77ar5tv2tzg4r'), ).toBe('simpleledger:qz2708636snqhsxu8wnlka78h6fdp77ar5syue64fa'); }); it(`Correctly parses utxo vout tx data to confirm the transactions are not eToken txs`, () => { expect(checkNullUtxosForTokenStatus(mockTxDataResults)).toStrictEqual( mockNonEtokenUtxos, ); }); it(`Correctly parses utxo vout tx data and screens out an eToken by asm field`, () => { expect( checkNullUtxosForTokenStatus(mockTxDataResultsWithEtoken), ).toStrictEqual([]); }); it(`Changes isValid from 'null' to 'false' for confirmed nonEtokenUtxos`, () => { expect( confirmNonEtokenUtxos( mockHydratedUtxosWithNullValues, mockNonEtokenUtxos, ), ).toStrictEqual(mockHydratedUtxosWithNullValuesSetToFalse); }); it(`Recognizes a wallet with missing Path1889 is a Legacy Wallet and requires migration`, () => { expect(isLegacyMigrationRequired(missingPath1899Wallet)).toBe(true); }); it(`Recognizes a wallet with missing PublicKey in Path1889 is a Legacy Wallet and requires migration`, () => { expect( isLegacyMigrationRequired(missingPublicKeyInPath1899Wallet), ).toBe(true); }); it(`Recognizes a wallet with missing PublicKey in Path145 is a Legacy Wallet and requires migration`, () => { expect(isLegacyMigrationRequired(missingPublicKeyInPath145Wallet)).toBe( true, ); }); it(`Recognizes a wallet with missing PublicKey in Path245 is a Legacy Wallet and requires migration`, () => { expect(isLegacyMigrationRequired(missingPublicKeyInPath245Wallet)).toBe( true, ); }); it(`Recognizes a latest, current wallet that does not require migration`, () => { expect(isLegacyMigrationRequired(notLegacyWallet)).toBe(false); }); test('toLegacyCash() converts a valid ecash: prefix address to a valid bitcoincash: prefix address', async () => { const result = toLegacyCash( 'ecash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gtfza25mc', ); expect(result).toStrictEqual( 'bitcoincash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gjykk3wa0', ); }); test('toLegacyCash() converts a valid ecash: prefixless address to a valid bitcoincash: prefix address', async () => { const result = toLegacyCash( 'qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gtfza25mc', ); expect(result).toStrictEqual( 'bitcoincash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gjykk3wa0', ); }); test('toLegacyCash throws error if input address has invalid checksum', async () => { const result = toLegacyCash( 'ecash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gtfza25m', ); expect(result).toStrictEqual( new Error( 'ecash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gtfza25m is not a valid ecash address', ), ); }); test('toLegacyCash() throws error with input of etoken: address', async () => { const result = toLegacyCash( 'etoken:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4g9htlunl0', ); expect(result).toStrictEqual( new Error( 'etoken:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4g9htlunl0 is not a valid ecash address', ), ); }); test('toLegacyCash() throws error with input of legacy address', async () => { const result = toLegacyCash('13U6nDrkRsC3Eb1pxPhNY8XJ5W9zdp6rNk'); expect(result).toStrictEqual( new Error( '13U6nDrkRsC3Eb1pxPhNY8XJ5W9zdp6rNk is not a valid ecash address', ), ); }); test('toLegacyCash() throws error with input of bitcoincash: address', async () => { const result = toLegacyCash( 'bitcoincash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gjykk3wa0', ); expect(result).toStrictEqual( new Error( 'bitcoincash:qqd3qn4zazjhygk5a2vzw2gvqgqwempr4gjykk3wa0 is not a valid ecash address', ), ); }); test('toLegacyCashArray throws error if the addressArray input is null', async () => { const result = toLegacyCashArray(null); expect(result).toStrictEqual(new Error('Invalid addressArray input')); }); test('toLegacyCashArray throws error if the addressArray input is empty', async () => { const result = toLegacyCashArray([]); expect(result).toStrictEqual(new Error('Invalid addressArray input')); }); test('toLegacyCashArray throws error if the addressArray input is a number', async () => { const result = toLegacyCashArray(12345); expect(result).toStrictEqual(new Error('Invalid addressArray input')); }); test('toLegacyCashArray throws error if the addressArray input is undefined', async () => { const result = toLegacyCashArray(undefined); expect(result).toStrictEqual(new Error('Invalid addressArray input')); }); test('toLegacyCashArray successfully converts a standard sized valid addressArray input', async () => { const result = toLegacyCashArray(validAddressArrayInput); expect(result).toStrictEqual(validAddressArrayOutput); }); test('toLegacyCashArray successfully converts a standard sized valid addressArray input including prefixless ecash addresses', async () => { const result = toLegacyCashArray(validAddressArrayInputMixedPrefixes); expect(result).toStrictEqual(validAddressArrayOutput); }); test('toLegacyCashArray successfully converts a large valid addressArray input', async () => { const result = toLegacyCashArray(validLargeAddressArrayInput); expect(result).toStrictEqual(validLargeAddressArrayOutput); }); test('toLegacyCashArray throws an error on an addressArray with invalid addresses', async () => { const result = toLegacyCashArray(invalidAddressArrayInput); expect(result).toStrictEqual( new Error( 'ecash:qrqgwxrrrrrrrrrrrrrrrrrrrrrrrrr7zsvk is not a valid ecash address', ), ); }); test('parseOpReturn() successfully parses a short cashtab message', async () => { const result = parseOpReturn(shortCashtabMessageInputHex); expect(result).toStrictEqual(mockParsedShortCashtabMessageArray); }); test('parseOpReturn() successfully parses a long cashtab message where an additional PUSHDATA1 is present', async () => { const result = parseOpReturn(longCashtabMessageInputHex); expect(result).toStrictEqual(mockParsedLongCashtabMessageArray); }); test('parseOpReturn() successfully parses a short external message', async () => { const result = parseOpReturn(shortExternalMessageInputHex); expect(result).toStrictEqual(mockParsedShortExternalMessageArray); }); test('parseOpReturn() successfully parses a long external message where an additional PUSHDATA1 is present', async () => { const result = parseOpReturn(longExternalMessageInputHex); expect(result).toStrictEqual(mockParsedLongExternalMessageArray); }); test('parseOpReturn() successfully parses an external message that is segmented into separate short parts', async () => { const result = parseOpReturn(shortSegmentedExternalMessageInputHex); expect(result).toStrictEqual( mockParsedShortSegmentedExternalMessageArray, ); }); test('parseOpReturn() successfully parses an external message that is segmented into separate long parts', async () => { const result = parseOpReturn(longSegmentedExternalMessageInputHex); expect(result).toStrictEqual( mockParsedLongSegmentedExternalMessageArray, ); }); test('parseOpReturn() successfully parses an external message that is segmented into separate long and short parts', async () => { const result = parseOpReturn(mixedSegmentedExternalMessageInputHex); expect(result).toStrictEqual( mockParsedMixedSegmentedExternalMessageArray, ); }); test('parseOpReturn() successfully parses an eToken output', async () => { const result = parseOpReturn(eTokenInputHex); expect(result).toStrictEqual(mockParsedETokenOutputArray); }); test('isExcludedUtxo returns true for a utxo with different tx_pos and same txid as an existing utxo in the set', async () => { expect( isExcludedUtxo(excludedUtxoAlpha, previousUtxosObjUtxoArray), ).toBe(true); }); test('isExcludedUtxo returns true for a utxo with different value and same txid as an existing utxo in the set', async () => { expect( isExcludedUtxo(excludedUtxoBeta, previousUtxosObjUtxoArray), ).toBe(true); }); test('isExcludedUtxo returns false for a utxo with different tx_pos and same txid', async () => { expect( isExcludedUtxo(includedUtxoAlpha, previousUtxosObjUtxoArray), ).toBe(false); }); test('isExcludedUtxo returns false for a utxo with different value and same txid', async () => { expect( isExcludedUtxo(includedUtxoBeta, previousUtxosObjUtxoArray), ).toBe(false); }); + test('whichUtxosWereAdded correctly identifies a single added utxo after a received XEC tx [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosTemplate, + currentUtxosAfterSingleXecReceiveTxTemplate, + ), + ).toStrictEqual(utxosAddedBySingleXecReceiveTxTemplate); + }); + test('whichUtxosWereAdded correctly identifies a single added utxo after a received XEC tx', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeSingleXecReceiveTx, + currentUtxosAfterSingleXecReceiveTx, + ), + ).toStrictEqual(utxosAddedBySingleXecReceiveTx); + }); + test('whichUtxosWereAdded correctly identifies multiple added utxos with the same txid [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosTemplate, + currentUtxosAfterMultiXecReceiveTxTemplate, + ), + ).toStrictEqual(utxosAddedByMultiXecReceiveTxTemplate); + }); + test('whichUtxosWereAdded correctly identifies multiple added utxos with the same txid', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeMultiXecReceiveTx, + currentUtxosAfterMultiXecReceiveTx, + ), + ).toStrictEqual(utxosAddedByMultiXecReceiveTx); + }); + test('whichUtxosWereAdded correctly identifies an added utxos from received eToken tx [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosTemplate, + currentUtxosAfterEtokenReceiveTxTemplate, + ), + ).toStrictEqual(utxosAddedByEtokenReceiveTxTemplate); + }); + test('whichUtxosWereAdded correctly identifies an added utxos from received eToken tx', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeEtokenReceiveTx, + currentUtxosAfterEtokenReceiveTx, + ), + ).toStrictEqual(utxosAddedByEtokenReceiveTx); + }); + test('whichUtxosWereAdded correctly identifies no utxos were added in a send all XEC tx (no change) [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeSendAllTxTemplate, + currentUtxosAfterSendAllTxTemplate, + ), + ).toStrictEqual(false); + }); + test('whichUtxosWereAdded correctly identifies no utxos were added in a send all XEC tx (no change)', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeSendAllTx, + currentUtxosAfterSendAllTx, + ), + ).toStrictEqual(false); + }); + test('whichUtxosWereAdded correctly identifies an added utxo from a single send XEC tx', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeSingleXecSendTx, + currentUtxosAfterSingleXecSendTx, + ), + ).toStrictEqual(utxosAddedBySingleXecSendTx); + }); + test('whichUtxosWereAdded correctly identifies an added utxo from a single send XEC tx [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosTemplate, + currentUtxosAfterSingleXecSendTxTemplate, + ), + ).toStrictEqual(utxosAddedBySingleXecSendTxTemplate); + }); + test('whichUtxosWereAdded correctly identifies added change utxos from a send eToken tx [template]', async () => { + expect( + whichUtxosWereAdded( + previousUtxosTemplate, + currentUtxosAfterEtokenSendTxTemplate, + ), + ).toStrictEqual(utxosAddedByEtokenSendTxTemplate); + }); + test('whichUtxosWereAdded correctly identifies added change utxos from a send eToken tx', async () => { + expect( + whichUtxosWereAdded( + previousUtxosBeforeEtokenSendTx, + currentUtxosAfterEtokenSendTx, + ), + ).toStrictEqual(utxosAddedByEtokenSendTx); + }); }); diff --git a/web/cashtab/src/utils/cashMethods.js b/web/cashtab/src/utils/cashMethods.js index 9ff344663..e376ed049 100644 --- a/web/cashtab/src/utils/cashMethods.js +++ b/web/cashtab/src/utils/cashMethods.js @@ -1,529 +1,595 @@ import { currency } from '@components/Common/Ticker'; import { isValidXecAddress, isValidEtokenAddress, isValidUtxo, } from '@utils/validation'; import BigNumber from 'bignumber.js'; import cashaddr from 'ecashaddrjs'; export function parseOpReturn(hexStr) { if ( !hexStr || typeof hexStr !== 'string' || hexStr.substring(0, 2) !== currency.opReturn.opReturnPrefixHex ) { return false; } hexStr = hexStr.slice(2); // remove the first byte i.e. 6a /* * @Return: resultArray is structured as follows: * resultArray[0] is the transaction type i.e. eToken prefix, cashtab prefix, external message itself if unrecognized prefix * resultArray[1] is the actual cashtab message or the 2nd part of an external message * resultArray[2 - n] are the additional messages for future protcols */ let resultArray = []; let message = ''; let hexStrLength = hexStr.length; for (let i = 0; hexStrLength !== 0; i++) { // part 1: check the preceding byte value for the subsequent message let byteValue = hexStr.substring(0, 2); let msgByteSize = 0; if (byteValue === currency.opReturn.opPushDataOne) { // if this byte is 4c then the next byte is the message byte size - retrieve the message byte size only msgByteSize = parseInt(hexStr.substring(2, 4), 16); // hex base 16 to decimal base 10 hexStr = hexStr.slice(4); // strip the 4c + message byte size info } else { // take the byte as the message byte size msgByteSize = parseInt(hexStr.substring(0, 2), 16); // hex base 16 to decimal base 10 hexStr = hexStr.slice(2); // strip the message byte size info } // part 2: parse the subsequent message based on bytesize const msgCharLength = 2 * msgByteSize; message = hexStr.substring(0, msgCharLength); if (i === 0 && message === currency.opReturn.appPrefixesHex.eToken) { // add the extracted eToken prefix to array then exit loop resultArray[i] = currency.opReturn.appPrefixesHex.eToken; break; } else if ( i === 0 && message === currency.opReturn.appPrefixesHex.cashtab ) { // add the extracted Cashtab prefix to array resultArray[i] = currency.opReturn.appPrefixesHex.cashtab; } else if ( i === 0 && message === currency.opReturn.appPrefixesHex.cashtabEncrypted ) { // add the Cashtab encryption prefix to array resultArray[i] = currency.opReturn.appPrefixesHex.cashtabEncrypted; } else { // this is either an external message or a subsequent cashtab message loop to extract the message resultArray[i] = message; } // strip out the parsed message hexStr = hexStr.slice(msgCharLength); hexStrLength = hexStr.length; } return resultArray; } export const fromLegacyDecimals = ( amount, cashDecimals = currency.cashDecimals, ) => { // Input 0.00000546 BCH // Output 5.46 XEC or 0.00000546 BCH, depending on currency.cashDecimals const amountBig = new BigNumber(amount); const conversionFactor = new BigNumber(10 ** (8 - cashDecimals)); const amountSmallestDenomination = amountBig .times(conversionFactor) .toNumber(); return amountSmallestDenomination; }; export const fromSmallestDenomination = ( amount, cashDecimals = currency.cashDecimals, ) => { const amountBig = new BigNumber(amount); const multiplier = new BigNumber(10 ** (-1 * cashDecimals)); const amountInBaseUnits = amountBig.times(multiplier); return amountInBaseUnits.toNumber(); }; export const toSmallestDenomination = ( sendAmount, cashDecimals = currency.cashDecimals, ) => { // Replace the BCH.toSatoshi method with an equivalent function that works for arbitrary decimal places // Example, for an 8 decimal place currency like Bitcoin // Input: a BigNumber of the amount of Bitcoin to be sent // Output: a BigNumber of the amount of satoshis to be sent, or false if input is invalid // Validate // Input should be a BigNumber with no more decimal places than cashDecimals const isValidSendAmount = BigNumber.isBigNumber(sendAmount) && sendAmount.dp() <= cashDecimals; if (!isValidSendAmount) { return false; } const conversionFactor = new BigNumber(10 ** cashDecimals); const sendAmountSmallestDenomination = sendAmount.times(conversionFactor); return sendAmountSmallestDenomination; }; export const batchArray = (inputArray, batchSize) => { // take an array of n elements, return an array of arrays each of length batchSize const batchedArray = []; for (let i = 0; i < inputArray.length; i += batchSize) { const tempArray = inputArray.slice(i, i + batchSize); batchedArray.push(tempArray); } return batchedArray; }; export const flattenBatchedHydratedUtxos = batchedHydratedUtxoDetails => { // Return same result as if only the bulk API call were made // to do this, just need to move all utxos under one slpUtxos /* given [ { slpUtxos: [ { utxos: [], address: '', } ], }, { slpUtxos: [ { utxos: [], address: '', } ], } ] return [ { slpUtxos: [ { utxos: [], address: '' }, { utxos: [], address: '' }, ] } */ const flattenedBatchedHydratedUtxos = { slpUtxos: [] }; for (let i = 0; i < batchedHydratedUtxoDetails.length; i += 1) { const theseSlpUtxos = batchedHydratedUtxoDetails[i].slpUtxos[0]; flattenedBatchedHydratedUtxos.slpUtxos.push(theseSlpUtxos); } return flattenedBatchedHydratedUtxos; }; export const loadStoredWallet = walletStateFromStorage => { // Accept cached tokens array that does not save BigNumber type of BigNumbers // Return array with BigNumbers converted // See BigNumber.js api for how to create a BigNumber object from an object // https://mikemcl.github.io/bignumber.js/ const liveWalletState = walletStateFromStorage; const { slpBalancesAndUtxos, tokens } = liveWalletState; for (let i = 0; i < tokens.length; i += 1) { const thisTokenBalance = tokens[i].balance; thisTokenBalance._isBigNumber = true; tokens[i].balance = new BigNumber(thisTokenBalance); } // Also confirm balance is correct // Necessary step in case currency.decimals changed since last startup const balancesRebased = normalizeBalance(slpBalancesAndUtxos); liveWalletState.balances = balancesRebased; return liveWalletState; }; export const normalizeBalance = slpBalancesAndUtxos => { const totalBalanceInSatoshis = slpBalancesAndUtxos.nonSlpUtxos.reduce( (previousBalance, utxo) => previousBalance + utxo.value, 0, ); return { totalBalanceInSatoshis, totalBalance: fromSmallestDenomination(totalBalanceInSatoshis), }; }; export const isValidStoredWallet = walletStateFromStorage => { return ( typeof walletStateFromStorage === 'object' && 'state' in walletStateFromStorage && typeof walletStateFromStorage.state === 'object' && 'balances' in walletStateFromStorage.state && 'utxos' in walletStateFromStorage.state && 'hydratedUtxoDetails' in walletStateFromStorage.state && 'slpBalancesAndUtxos' in walletStateFromStorage.state && 'tokens' in walletStateFromStorage.state ); }; export const getWalletState = wallet => { if (!wallet || !wallet.state) { return { balances: { totalBalance: 0, totalBalanceInSatoshis: 0 }, hydratedUtxoDetails: {}, tokens: [], slpBalancesAndUtxos: {}, parsedTxHistory: [], utxos: [], }; } return wallet.state; }; export function convertToEcashPrefix(bitcoincashPrefixedAddress) { // Prefix-less addresses may be valid, but the cashaddr.decode function used below // will throw an error without a prefix. Hence, must ensure prefix to use that function. const hasPrefix = bitcoincashPrefixedAddress.includes(':'); if (hasPrefix) { // Is it bitcoincash: or simpleledger: const { type, hash, prefix } = cashaddr.decode( bitcoincashPrefixedAddress, ); let newPrefix; if (prefix === 'bitcoincash') { newPrefix = 'ecash'; } else if (prefix === 'simpleledger') { newPrefix = 'etoken'; } else { return bitcoincashPrefixedAddress; } const convertedAddress = cashaddr.encode(newPrefix, type, hash); return convertedAddress; } else { return bitcoincashPrefixedAddress; } } export function toLegacyCash(addr) { // Confirm input is a valid ecash address const isValidInput = isValidXecAddress(addr); if (!isValidInput) { return new Error(`${addr} is not a valid ecash address`); } // Check for ecash: prefix const isPrefixedXecAddress = addr.slice(0, 6) === 'ecash:'; // If no prefix, assume it is checksummed for an ecash: prefix const testedXecAddr = isPrefixedXecAddress ? addr : `ecash:${addr}`; let legacyCashAddress; try { const { type, hash } = cashaddr.decode(testedXecAddr); legacyCashAddress = cashaddr.encode(currency.legacyPrefix, type, hash); } catch (err) { return err; } return legacyCashAddress; } export function toLegacyCashArray(addressArray) { let cleanArray = []; // array of bch converted addresses to be returned if ( addressArray === null || addressArray === undefined || !addressArray.length || addressArray === '' ) { return new Error('Invalid addressArray input'); } const arrayLength = addressArray.length; for (let i = 0; i < arrayLength; i++) { let addressValueArr = addressArray[i].split(','); let address = addressValueArr[0]; let value = addressValueArr[1]; // NB that toLegacyCash() includes address validation; will throw error for invalid address input const legacyAddress = toLegacyCash(address); if (legacyAddress instanceof Error) { return legacyAddress; } let convertedArrayData = legacyAddress + ',' + value + '\n'; cleanArray.push(convertedArrayData); } return cleanArray; } export function toLegacyToken(addr) { // Confirm input is a valid ecash address const isValidInput = isValidEtokenAddress(addr); if (!isValidInput) { return new Error(`${addr} is not a valid etoken address`); } // Check for ecash: prefix const isPrefixedEtokenAddress = addr.slice(0, 7) === 'etoken:'; // If no prefix, assume it is checksummed for an ecash: prefix const testedEtokenAddr = isPrefixedEtokenAddress ? addr : `etoken:${addr}`; let legacyTokenAddress; try { const { type, hash } = cashaddr.decode(testedEtokenAddr); legacyTokenAddress = cashaddr.encode('simpleledger', type, hash); } catch (err) { return err; } return legacyTokenAddress; } export const confirmNonEtokenUtxos = (hydratedUtxos, nonEtokenUtxos) => { // scan through hydratedUtxoDetails for (let i = 0; i < hydratedUtxos.length; i += 1) { // Find utxos with txids matching nonEtokenUtxos if (nonEtokenUtxos.includes(hydratedUtxos[i].txid)) { // Confirm that such utxos are not eToken utxos hydratedUtxos[i].isValid = false; } } return hydratedUtxos; }; export const checkNullUtxosForTokenStatus = txDataResults => { const nonEtokenUtxos = []; for (let j = 0; j < txDataResults.length; j += 1) { const thisUtxoTxid = txDataResults[j].txid; const thisUtxoVout = txDataResults[j].details.vout; // Iterate over outputs for (let k = 0; k < thisUtxoVout.length; k += 1) { const thisOutput = thisUtxoVout[k]; if (thisOutput.scriptPubKey.type === 'nulldata') { const asmOutput = thisOutput.scriptPubKey.asm; if (asmOutput.includes('OP_RETURN 5262419')) { // then it's an eToken tx that has not been properly validated // Do not include it in nonEtokenUtxos // App will ignore it until SLPDB is able to validate it /* console.log( `utxo ${thisUtxoTxid} requires further eToken validation, ignoring`, );*/ } else { // Otherwise it's just an OP_RETURN tx that SLPDB has some issue with // It should still be in the user's utxo set // Include it in nonEtokenUtxos /* console.log( `utxo ${thisUtxoTxid} is not an eToken tx, adding to nonSlpUtxos`, ); */ nonEtokenUtxos.push(thisUtxoTxid); } } } } return nonEtokenUtxos; }; /* Converts a serialized buffer containing encrypted data into an object * that can be interpreted by the ecies-lite library. * * For reference on the parsing logic in this function refer to the link below on the segment of * ecies-lite's encryption function where the encKey, macKey, iv and cipher are sliced and concatenated * https://github.com/tibetty/ecies-lite/blob/8fd97e80b443422269d0223ead55802378521679/index.js#L46-L55 * * A similar PSF implmentation can also be found at: * https://github.com/Permissionless-Software-Foundation/bch-encrypt-lib/blob/master/lib/encryption.js * * For more detailed overview on the ecies encryption scheme, see https://cryptobook.nakov.com/asymmetric-key-ciphers/ecies-public-key-encryption */ export const convertToEncryptStruct = encryptionBuffer => { // based on ecies-lite's encryption logic, the encryption buffer is concatenated as follows: // [ epk + iv + ct + mac ] whereby: // - The first 32 or 64 chars of the encryptionBuffer is the epk // - Both iv and ct params are 16 chars each, hence their combined substring is 32 chars from the end of the epk string // - within this combined iv/ct substring, the first 16 chars is the iv param, and ct param being the later half // - The mac param is appended to the end of the encryption buffer // validate input buffer if (!encryptionBuffer) { throw new Error( 'cashmethods.convertToEncryptStruct() error: input must be a buffer', ); } try { // variable tracking the starting char position for string extraction purposes let startOfBuf = 0; // *** epk param extraction *** // The first char of the encryptionBuffer indicates the type of the public key // If the first char is 4, then the public key is 64 chars // If the first char is 3 or 2, then the public key is 32 chars // Otherwise this is not a valid encryption buffer compatible with the ecies-lite library let publicKey; switch (encryptionBuffer[0]) { case 4: publicKey = encryptionBuffer.slice(0, 65); // extract first 64 chars as public key break; case 3: case 2: publicKey = encryptionBuffer.slice(0, 33); // extract first 32 chars as public key break; default: throw new Error(`Invalid type: ${encryptionBuffer[0]}`); } // *** iv and ct param extraction *** startOfBuf += publicKey.length; // sets the starting char position to the end of the public key (epk) in order to extract subsequent iv and ct substrings const encryptionTagLength = 32; // the length of the encryption tag (i.e. mac param) computed from each block of ciphertext, and is used to verify no one has tampered with the encrypted data const ivCtSubstring = encryptionBuffer.slice( startOfBuf, encryptionBuffer.length - encryptionTagLength, ); // extract the substring containing both iv and ct params, which is after the public key but before the mac param i.e. the 'encryption tag' const ivbufParam = ivCtSubstring.slice(0, 16); // extract the first 16 chars of substring as the iv param const ctbufParam = ivCtSubstring.slice(16); // extract the last 16 chars as substring the ct param // *** mac param extraction *** const macParam = encryptionBuffer.slice( encryptionBuffer.length - encryptionTagLength, encryptionBuffer.length, ); // extract the mac param appended to the end of the buffer return { iv: ivbufParam, epk: publicKey, ct: ctbufParam, mac: macParam, }; } catch (err) { console.error(`useBCH.convertToEncryptStruct() error: `, err); throw err; } }; export const getPublicKey = async (BCH, address) => { try { const publicKey = await BCH.encryption.getPubKey(address); return publicKey.publicKey; } catch (err) { if (err['error'] === 'No transaction history.') { throw new Error( 'Cannot send an encrypted message to a wallet with no outgoing transactions', ); } else { throw err; } } }; export const isLegacyMigrationRequired = wallet => { // If the wallet does not have Path1899, // Or each Path1899, Path145, Path245 does not have a public key // Then it requires migration if ( !wallet.Path1899 || !wallet.Path1899.publicKey || !wallet.Path145.publicKey || !wallet.Path245.publicKey ) { return true; } return false; }; export const isExcludedUtxo = (utxo, utxoArray) => { /* utxo is a single utxo of model { height: 724992 tx_hash: "8d4bdedb7c4443412e0c2f316a330863aef54d9ba73560ca60cca6408527b247" tx_pos: 0 value: 10200 } utxoArray is an array of utxos */ let isExcludedUtxo = true; const { tx_hash, tx_pos, value } = utxo; for (let i = 0; i < utxoArray.length; i += 1) { const thisUtxo = utxoArray[i]; // NOTE // You can't match height, as this changes from 0 to blockheight after confirmation //const thisUtxoHeight = thisUtxo.height; const thisUtxoTxid = thisUtxo.tx_hash; const thisUtxoTxPos = thisUtxo.tx_pos; const thisUtxoValue = thisUtxo.value; // If you find a utxo such that each object key is identical if ( tx_hash === thisUtxoTxid && tx_pos === thisUtxoTxPos && value === thisUtxoValue ) { // Then this utxo is not excluded from the array isExcludedUtxo = false; } } return isExcludedUtxo; }; + +export const whichUtxosWereAdded = (previousUtxos, currentUtxos) => { + let utxosAddedFlag = false; + const utxosAdded = []; + + // Iterate over currentUtxos + // For each currentUtxo -- does it exist in previousUtxos? + // If no, it's added + + // Note that the inputs are arrays of arrays, model + /* + previousUtxos = [{address: 'string', utxos: []}, ...] + */ + + // Iterate over the currentUtxos array of {address: 'string', utxos: []} objects + for (let i = 0; i < currentUtxos.length; i += 1) { + // Take the first object + const thisCurrentUtxoObject = currentUtxos[i]; + const thisCurrentUtxoObjectAddress = thisCurrentUtxoObject.address; + const thisCurrentUtxoObjectUtxos = thisCurrentUtxoObject.utxos; + // Iterate over the previousUtxos array of {address: 'string', utxos: []} objects + for (let j = 0; j < previousUtxos.length; j += 1) { + const thisPreviousUtxoObject = previousUtxos[j]; + const thisPreviousUtxoObjectAddress = + thisPreviousUtxoObject.address; + // When you find the utxos object at the same address + if ( + thisCurrentUtxoObjectAddress === thisPreviousUtxoObjectAddress + ) { + // Create a utxosAddedObject with the address + const utxosAddedObject = { + address: thisCurrentUtxoObjectAddress, + utxos: [], + }; + utxosAdded.push(utxosAddedObject); + + // Grab the previousUtxoObject utxos array. thisCurrentUtxoObjectUtxos has changed compared to thisPreviousUtxoObjectUtxos + const thisPreviousUtxoObjectUtxos = + thisPreviousUtxoObject.utxos; + // To see if any utxos exist in thisCurrentUtxoObjectUtxos that do not exist in thisPreviousUtxoObjectUtxos + // iterate over thisPreviousUtxoObjectUtxos for each utxo in thisCurrentUtxoObjectUtxos + for (let k = 0; k < thisCurrentUtxoObjectUtxos.length; k += 1) { + const thisCurrentUtxo = thisCurrentUtxoObjectUtxos[k]; + + if ( + isExcludedUtxo( + thisCurrentUtxo, + thisPreviousUtxoObjectUtxos, + ) + ) { + // If thisCurrentUtxo was not in the corresponding previous utxos + // Then it was added + utxosAdded[j].utxos.push(thisCurrentUtxo); + utxosAddedFlag = true; + } + } + } + } + } + // If utxos were added, return them + if (utxosAddedFlag) { + return utxosAdded; + } + // Else return false + return utxosAddedFlag; +};