jest.mock(".."); import { TransactionOutput } from "../builders/transaction.builder"; import { AssetUtils, Multiasset } from "./assets"; import { CborTransaction } from "./cbor/transaction"; import { AdaUTXOs, CardanoUTXO, ExceedingInputs, RequiredOutputs, UTXOS, } from "./utxos"; describe("UTXOs", () => { describe("getAdaUtxos", () => { let mockUtxos: CardanoUTXO[]; let adaUtxos: AdaUTXOs; describe("case 1", () => { beforeAll(() => { mockUtxos = [ "82825820610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a001e8480a1581c24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92a14a4d7574616e7443726f6301", "8282582075901d6fadc37ea8750f8ebadd28492ef1fd1e22d4bf717303ad406471b08c6e0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a22cb73b0a1581cf1980ebcf616bc54b2206795bbec8a9217613de6c4fc041158b581d4a14c4d7574616e7443726f63303201", "8282582006fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d30082583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e71a3b9aca00", ].map(CborTransaction.decode); }); describe("when value is 2 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 2000000); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(true); }); test("ada total coin should be 1000000000", () => { expect(adaUtxos.totalCoin).toBe(1000000000); }); test("one utxo should be enough to fulfill request", () => { expect(adaUtxos.utxos).toHaveLength(1); }); test("utxo value should be 1000 ADA", () => { expect(adaUtxos.utxos[0].utxo.amount.coin).toBe(1000000000); }); test("utxo hash should be 06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3", () => { expect(adaUtxos.utxos[0].transaction.hash).toBe( "06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3" ); }); }); describe("when value is 1500 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 1500000000); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(true); }); test("ada total coin should be 1582379488", () => { expect(adaUtxos.totalCoin).toBe(1582379488); }); test("one utxo should be enough to fulfill request", () => { expect(adaUtxos.utxos).toHaveLength(2); }); test("utxo hash should be 06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3", () => { expect(adaUtxos.utxos[0].transaction.hash).toBe( "06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3" ); }); }); describe("when value is 1800 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 1800000000); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(false); }); }); }); describe("case 2", () => { beforeAll(() => { mockUtxos = [ "82825820610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a001e8480a1581c24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92a14a4d7574616e7443726f6301", ].map(CborTransaction.decode); }); describe("when value is 1.5 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 1500000); }); test("ada utxo should not be satisfied", () => { expect(adaUtxos.satisfied).toBe(false); }); test("ada total coin should be 2000000", () => { expect(adaUtxos.totalCoin).toBe(620720); }); test("no utxo should be found", () => { expect(adaUtxos.utxos).toEqual([ { transaction: { hash: "610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd", index: 1, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 2000000, multiasset: { "24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92": { "4d7574616e7443726f63": 1 }, }, }, }, }, ]); }); }); }); describe("case 3", () => { beforeAll(() => { mockUtxos = [ "82825820610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a01312D00a1581c24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92a14a4d7574616e7443726f6301", ].map(CborTransaction.decode); }); describe("when value is 1.5 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 1500000); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(true); }); test("ada total coin should be 18620720", () => { expect(adaUtxos.totalCoin).toBe(18620720); }); test("one utxo should be enough to fulfill request", () => { expect(adaUtxos.utxos).toHaveLength(1); }); test("utxo value should be 20 ADA", () => { expect(adaUtxos.utxos[0].utxo.amount.coin).toBe(20000000); }); test("utxo hash should be 610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd", () => { expect(adaUtxos.utxos[0].transaction.hash).toBe( "610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd" ); }); }); }); describe("case 4", () => { beforeAll(() => { mockUtxos = [ "8282582029fd4158bfd4efa8b0ced300c246d0afb65b828c7cbbb2cf4f048ef2500532bf0082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303030323501", "828258200c375b6a8653a5ddac3ba1c44c71ccf97587dec7b63e6614c4f887c8c2413a8f0082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303337353501", "8282582034026ca961564d05dd4a461cf9ce75c4a2f17046f404641c57836b912cc177a00082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303333303101", "828258203a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e0082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303332353901", "828258203a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e0182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303335333901", "828258203a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e0282583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303334343501", "8282582072130845e270eab1ee9739736a34d6300614b403f6d52175ec87f0de390e859b0082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303430333101", "8282582072130845e270eab1ee9739736a34d6300614b403f6d52175ec87f0de390e859b0182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303431373201", "8282582085ee38fe32a2edd5eaa5d1001e94bf2df53cbef6432c1ae03024b7cde03eef330082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303432313201", "82825820083c10e9fad814f6627131f0eee20482e9c0d6f4b3f9c31bf2b75d04d15009040082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303433323701", "82825820083c10e9fad814f6627131f0eee20482e9c0d6f4b3f9c31bf2b75d04d15009040182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303231323401", "8282582042aabd37887d2f159f78c82307f9a4cef061fd7d65b141a3a4d2f5fa1fc52ef30082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303232373301", "8282582042aabd37887d2f159f78c82307f9a4cef061fd7d65b141a3a4d2f5fa1fc52ef30182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303233353401", "828258208d651476a8064c436e2c56a6164a54313450ce4e14f4c5b3df990793a18fb8bb0082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303234303001", "828258208d651476a8064c436e2c56a6164a54313450ce4e14f4c5b3df990793a18fb8bb0182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303237313101", "82825820fd33a58bb62a2942356d5967989289fd6cda11cbc16a7f8de54c97eab67a2d970082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303237373301", "82825820fd33a58bb62a2942356d5967989289fd6cda11cbc16a7f8de54c97eab67a2d970182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303237393501", "82825820fd33a58bb62a2942356d5967989289fd6cda11cbc16a7f8de54c97eab67a2d970282583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303331313501", "82825820b4fbc15980786aec997d33e94e7e47a47a7cd019e853c87bbb403c3128764bd90082583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303332333501", "82825820b4fbc15980786aec997d33e94e7e47a47a7cd019e853c87bbb403c3128764bd90182583901e0a8fc05d7df79458b896cdfcbe7ff9a2194aeff93c8b7becd70bb408a09f77e183688048588a1d9b58f1c7948d65d47f9d2b6d2f7149fbf821a001e8480a1581c1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358ca14f4d7574616e74546f6164303332353301", ].map(CborTransaction.decode); }); describe("when value is 4 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 4000000, [ "29fd4158bfd4efa8b0ced300c246d0afb65b828c7cbbb2cf4f048ef2500532bf0", ]); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(true); }); test("total available coin should be 4345040", () => { expect(adaUtxos.totalCoin).toBe(4345040); }); test("utxos should be correctly set", () => { expect(adaUtxos.utxos).toEqual([ { transaction: { hash: "0c375b6a8653a5ddac3ba1c44c71ccf97587dec7b63e6614c4f887c8c2413a8f", index: 0, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033373535": 1 }, }, }, }, }, { transaction: { hash: "34026ca961564d05dd4a461cf9ce75c4a2f17046f404641c57836b912cc177a0", index: 0, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033333031": 1 }, }, }, }, }, { transaction: { hash: "3a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e", index: 0, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033323539": 1 }, }, }, }, }, { transaction: { hash: "3a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e", index: 1, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033353339": 1 }, }, }, }, }, { transaction: { hash: "3a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e", index: 2, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033343435": 1 }, }, }, }, }, { transaction: { hash: "72130845e270eab1ee9739736a34d6300614b403f6d52175ec87f0de390e859b", index: 0, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643034303331": 1 }, }, }, }, }, { transaction: { hash: "72130845e270eab1ee9739736a34d6300614b403f6d52175ec87f0de390e859b", index: 1, }, utxo: { address: "addr_test1q8s23lq96l0hj3vt39kdljl8l7dzr99wl7fu3da7e4ctksy2p8mhuxpk3qzgtz9pmx6c78refrt963le62md9ac5n7ls4punzl", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643034313732": 1 }, }, }, }, }, ]); }); }); }); describe("case 5", () => { beforeAll(() => { mockUtxos = [ "82825820610b4ef721ac542cd96af0e4e58dde5aac51641a29f7497a14ba3835281687dd0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a001e8480a1581c24d41af96ef693136a5c1eb616114f028dfdb92b10f31c648b2fac92a14a4d7574616e7443726f6301", "8282582075901d6fadc37ea8750f8ebadd28492ef1fd1e22d4bf717303ad406471b08c6e0182583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e7821a22cb73b0a1581cf1980ebcf616bc54b2206795bbec8a9217613de6c4fc041158b581d4a14c4d7574616e7443726f63303201", "8282582006fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d30082583900e922e8166852073d6c1c9be0736530404c9c26d9ba1773e11d32d11c0f7b2c7f8924528d797a8f86d8210d6276e09f47b82ecd53a24900e71a005b8d80", ].map(CborTransaction.decode); }); describe("when value is 2 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 2000000); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(true); }); test("ada total coin should be 6000000", () => { expect(adaUtxos.totalCoin).toBe(6000000); }); test("one utxo should be enough to fulfill request", () => { expect(adaUtxos.utxos).toHaveLength(1); }); test("utxo value should be 6000000 ADA", () => { expect(adaUtxos.utxos[0].utxo.amount.coin).toBe(6000000); }); test("utxo hash should be 06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3", () => { expect(adaUtxos.utxos[0].transaction.hash).toBe( "06fc2419824d3b110187461f02fc546eba7801c0dcd1cdceba12154ec21016d3" ); }); }); }); describe("case 6", () => { beforeAll(() => { mockUtxos = [ "82825820450d9f97cc5f939b9d4d2fb89269e2a98503599c5c8d78d22cba26a31c0ae2ea0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a004c4b40", "82825820fc3e6a7f440798fbed49087d32e30412b30162862749957f566b4876d0fe5f3d0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a004c4b40", "828258208a592b0aaa7bf4221bf8989c3ed0c7a82649bcc14057de991491cbda238985f90082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a004c4b40", "828258208de0abee7e652ed32cc049923610b82cac1fd5acc5ed4b1976c420aa776883ac0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a004c4b40", "828258207d596a646fba9b100aa26dca7c4e1b2ae52dbcbf37e6661275a9df0293a3bdfc0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a004c4b40", "828258209b1050ef32184ae48a3e117f3915690950342678941a0e90ef84f7e6067216cb0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a0045d2e6", "82825820d31bbb1ecc7163e85a56124ec14348d467c9a9bff69b66a4e9b69b24e56955040082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a1a6c7d68", "828258208c4d0cd1c340c98fa72598bbbc9aba873e90558794121d277806d99884cc93f50082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a01a5e7fe", "82825820817ad3a98dce33d5bcad308dcb87731bd4d195363721753f01e3817827d6fd840082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a3b9aca00", "82825820f4b8aee55f94b1710cca3dd8bd2ee6354834dbda00bb336f4777b560cbde713a0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a3b9aca00", "82825820da6739ec3c706279c656567a6861ecd3b0ef2454b06477f28b938e274e407e3a0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a3b9aca00", "8282582006afe0b71783d75a19a724a1566cd47f846ada568cfea1075c4ba11eead5932d0082583900c500ec4531b06edd8e958d06b7797f8290ee47cdc14c57ac425a3f8a2e6fcd4bcb190de895f42cfaa1353b84ec0b777a832ea97f4d84454c1a28c65307", ].map(CborTransaction.decode); }); describe("when value is 4179825510 ADA", () => { beforeAll(async () => { adaUtxos = await UTXOS.getAdaUtxo(mockUtxos, 4179825510); }); test("ada utxo should be satisfied", () => { expect(adaUtxos.satisfied).toBe(false); // This may be wrong - we are not considering the first transaction as it was throwing BadInputsUtxo (for no reason?) }); }); }); }); describe("getExceedingInputs", () => { let exceedingInputs: ExceedingInputs; describe("case 1: Address 1 inputs 3 assets and 100 ADA and required input is 1 asset and 1 ADA", () => { beforeEach(() => { const utxo: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address1", amount: { coin: 100000000, // 100 ADA multiasset: { policyid1: { asset1: 1, asset2: 1, asset3: 1, }, policyid2: { asset1: 1, }, }, }, }, }; jest.spyOn(AssetUtils, "getAssetsFromUtxo").mockReturnValueOnce([ { asset: "asset1", policy: "policyid1", quantity: 1, }, { asset: "asset2", policy: "policyid1", quantity: 1, }, { asset: "asset3", policy: "policyid1", quantity: 1, }, ]); exceedingInputs = UTXOS.getExceedingInputs([utxo], { address1: { totalCoin: 1000000, tokens: [ { asset: "asset1", policy: "policyid1", quantity: 1, }, ], }, }); }); test("should not contain policyid1 and asset 1", () => { expect(exceedingInputs["address1"].tokens).not.toContainEqual({ asset: "asset1", policy: "policyid1", quantity: 1, }); }); test("should contain policyid1 and asset 2", () => { expect(exceedingInputs["address1"].tokens).toContainEqual({ asset: "asset2", policy: "policyid1", quantity: 1, }); }); test("should contain policyid1 and asset 3", () => { expect(exceedingInputs["address1"].tokens).toContainEqual({ asset: "asset3", policy: "policyid1", quantity: 1, }); }); test("should have 99 ADA exceeding", () => { expect(exceedingInputs["address1"].totalCoin).toBe(-99000000); }); }); describe("case 2: Address 1 inputs 100 ADA and 3 assets to buy 2 assets from address 2 for 50 ADA", () => { beforeEach(() => { const inputAddress1: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address1", amount: { coin: 100000000, // 100 ADA multiasset: {}, // This is mocked below }, }, }; const firstInputAddress2: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address2", amount: { coin: 100000000, // 100 ADA multiasset: {}, // This is mocked below }, }, }; const secondInputAddress2: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address2", amount: { coin: 50000000, // 50 ADA multiasset: {}, // This is mocked below }, }, }; jest .spyOn(AssetUtils, "getAssetsFromUtxo") .mockReturnValueOnce([ // Address 1 input { asset: "asset1", policy: "address1policyid", quantity: 1, }, { asset: "asset2", policy: "address1policyid", quantity: 1, }, { asset: "asset3", policy: "address1policyid", quantity: 1, }, ]) .mockReturnValueOnce([ // Address 2 first input { asset: "asset1", policy: "address2policyid", quantity: 1, }, { asset: "asset2", policy: "address2policyid", quantity: 1, }, ]) .mockReturnValueOnce([ // Address 2 second input { asset: "asset3", policy: "address2policyid", quantity: 1, }, { asset: "asset4", policy: "address2policyid", quantity: 1, }, ]); exceedingInputs = UTXOS.getExceedingInputs( [inputAddress1, firstInputAddress2, secondInputAddress2], { address1: { totalCoin: 50000000, }, address2: { tokens: [ { asset: "asset2", policy: "address2policyid", quantity: 1, }, { asset: "asset3", policy: "address2policyid", quantity: 1, }, ], }, } ); }); test("should contain address1policyid asset 1 for address 1", () => { expect(exceedingInputs["address1"].tokens).toContainEqual({ asset: "asset1", policy: "address1policyid", quantity: 1, }); }); test("should contain address1policyid asset 2 for address 1", () => { expect(exceedingInputs["address1"].tokens).toContainEqual({ asset: "asset2", policy: "address1policyid", quantity: 1, }); }); test("should contain address1policyid asset 3 for address 1", () => { expect(exceedingInputs["address1"].tokens).toContainEqual({ asset: "asset3", policy: "address1policyid", quantity: 1, }); }); test("should return 50 ADA to address 1", () => { expect(exceedingInputs["address1"].totalCoin).toBe(-50000000); }); test("should contain address2policyid asset 1 for address 2", () => { expect(exceedingInputs["address2"].tokens).toContainEqual({ asset: "asset1", policy: "address2policyid", quantity: 1, }); }); test("should NOT contain address2policyid asset 2 for address 2", () => { expect(exceedingInputs["address2"].tokens).not.toContainEqual({ asset: "asset2", policy: "address2policyid", quantity: 1, }); }); test("should NOT contain address2policyid asset 3 for address 2", () => { expect(exceedingInputs["address2"].tokens).not.toContainEqual({ asset: "asset3", policy: "address2policyid", quantity: 1, }); }); test("should NOT contain address2policyid asset 4 for address 2", () => { expect(exceedingInputs["address2"].tokens).toContainEqual({ asset: "asset4", policy: "address2policyid", quantity: 1, }); }); test("should return 150 ada to address 2", () => { expect(exceedingInputs["address2"].totalCoin).toBe(-150000000); }); }); test("case 3: Multiple native tokens", () => { const utxos = [ { transaction: { hash: "78e84c5862c84af0afa807d5879dabe5b6a5e12f210bb72c17f3158d0f03168a", index: 0, }, utxo: { address: "addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc", amount: { coin: 1344798, multiasset: { "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37": { "4d544e54": 235, }, }, }, }, }, { transaction: { hash: "f659d42f4c7e83e04288639264cfd6d08cfcf8d32b198cc94793246f431c1df2", index: 0, }, utxo: { address: "addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc", amount: { coin: 183442619, multiasset: { "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37": { "4d544e54": 9765, }, }, }, }, }, ]; const reqInputs = { addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc: { totalCoin: 5270347, tokens: [ { asset: "4d544e54", policy: "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37", quantity: 235, }, ], }, }; expect(UTXOS.getExceedingInputs(utxos, reqInputs)).toEqual({ addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc: { tokens: [ { asset: "4d544e54", policy: "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37", quantity: 9765, }, ], totalCoin: -179517070, }, }); }); test("case 4: Multiple native tokens with different required input quantity", () => { const utxos = [ { transaction: { hash: "78e84c5862c84af0afa807d5879dabe5b6a5e12f210bb72c17f3158d0f03168a", index: 0, }, utxo: { address: "addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc", amount: { coin: 1344798, multiasset: { "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37": { "4d544e54": 295, }, }, }, }, }, { transaction: { hash: "f659d42f4c7e83e04288639264cfd6d08cfcf8d32b198cc94793246f431c1df2", index: 0, }, utxo: { address: "addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc", amount: { coin: 183442619, multiasset: { "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37": { "4d544e54": 9765, }, }, }, }, }, ]; const reqInputs = { addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc: { totalCoin: 5270347, tokens: [ { asset: "4d544e54", policy: "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37", quantity: 235, }, ], }, }; expect(UTXOS.getExceedingInputs(utxos, reqInputs)).toEqual({ addr_test1qzx6uhec8grfy5agxp9lh77aew3y32nlfpzrpplzpzuh9hejp7vjs02kwqmwlufkfqxtkmt9vcl5e59272fd5303kehs3mermc: { tokens: [ { asset: "4d544e54", policy: "1f5687fdf36d26418efc5cde5e4cb2d4a80df5ad3bc623aa35706b37", quantity: 9825, }, ], totalCoin: -179517070, }, }); }); }); describe("calculateOutputs", () => { let outputs: TransactionOutput[]; describe("case 1: buy action with extra assets and extra ADA from seller and extra ADA from buyer", () => { beforeEach(() => { const utxoSeller: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address1", amount: { coin: 100000000, // 100 ADA multiasset: { policyid1: { asset1: 1, asset2: 1, asset3: 1, }, policyid2: { asset1: 1, }, }, }, }, }; const utxoBuyer: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address2", amount: { coin: 100000000, // 100 ADA multiasset: { policyid3: { asset1: 1, asset2: 1, }, policyid4: { asset1: 1, }, }, }, }, }; outputs = UTXOS.calculateOutputs( [utxoSeller, utxoBuyer], { address1: { tokens: [ { asset: "asset1", policy: "policyid1", quantity: 1, }, ], }, address2: { totalCoin: 50000000, }, }, { address2: { totalCoin: 2000000, tokens: [ { asset: "asset1", policy: "policyid1", quantity: 1, }, ], }, } ); }); test("should have 5 outputs", () => { expect(outputs.length).toBe(3); }); describe("first output", () => { let output: TransactionOutput; beforeAll(() => { output = outputs[0]; }); test("should be from address1", () => { expect(output.address).toBe("address1"); }); test("should have an of amounts", () => { expect(Array.isArray(output.amount)).toBe(true); }); test("should have 100000000 ADA as amount coin", () => { expect((output.amount as [number, Multiasset])[0]).toBe(100000000); }); test("should contain policy id 1 assets", () => { expect((output.amount as [number, Multiasset])[1]).toHaveProperty( "policyid1" ); }); test("should NOT give back policyid1.asset1 to address 1", () => { const amount = output.amount as [number, Multiasset]; expect(amount[1]["policyid1"]).not.toHaveProperty("asset1"); }); test("should give back policyid1.asset2 to address 1", () => { const amount = output.amount as [number, Multiasset]; const policyId1Assets = amount[1]["policyid1"] as Multiasset; expect(amount[1]["policyid1"]).toHaveProperty("asset2"); expect(policyId1Assets["asset2"]).toBe(1); }); }); describe("second output", () => { let output: TransactionOutput; beforeAll(() => { output = outputs[1]; }); test("should be from address2", () => { expect(output.address).toBe("address2"); }); test("should have an of amounts", () => { expect(Array.isArray(output.amount)).toBe(true); }); test("should have 50000000 ADA as amount coin", () => { expect((output.amount as [number, Multiasset])[0]).toBe(50000000); }); test("should send policyid3.asset1 back to buyer", () => { const amount = output.amount as [number, Multiasset]; const policyId3Assets = amount[1]["policyid3"] as Multiasset; expect(amount[1]["policyid3"]).toHaveProperty("asset1"); expect(policyId3Assets["asset1"]).toBe(1); }); }); }); describe("case 2", () => { beforeEach(() => { const utxoSeller: CardanoUTXO = { transaction: { hash: "7c7fdf7ea29ed242af394ba7f61c2cd1f9e701a3adc319f3a558f71466269dbd", index: 0, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 40000000, multiasset: { "12b9e177c14fb0f9836c46fa423dba1a5ab63b39489b413304888d64": { "4d7574616e7443726f633030303034": 1, "4d7574616e7443726f633030303038": 1, "4d7574616e7443726f633030303133": 1, "4d7574616e7443726f633030303135": 1, "4d7574616e7443726f633030303231": 1, "4d7574616e7443726f633030303232": 1, "4d7574616e7443726f633030303330": 1, "4d7574616e7443726f633030303338": 1, "4d7574616e7443726f633030303430": 1, "4d7574616e7443726f633030303434": 1, "4d7574616e7443726f633030303436": 1, "4d7574616e7443726f633030303439": 1, "4d7574616e7443726f633030303536": 1, "4d7574616e7443726f633030303631": 1, "4d7574616e7443726f633030303633": 1, "4d7574616e7443726f633030303635": 1, "4d7574616e7443726f633030303739": 1, "4d7574616e7443726f633030303831": 1, "4d7574616e7443726f633030303834": 1, "4d7574616e7443726f633030303933": 1, }, }, }, }, }; outputs = UTXOS.calculateOutputs( [utxoSeller], { addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g: { totalCoin: 500000, tokens: [ { asset: "4d7574616e7443726f633030303035", policy: "3d073eba80d5641fef164752a8755bbdcd2d3a2597e5f0e78fb867aa", quantity: 1, }, ], }, }, { address2: { totalCoin: 2000000, tokens: [ { asset: "4d7574616e7443726f633030303035", policy: "3d073eba80d5641fef164752a8755bbdcd2d3a2597e5f0e78fb867aa", quantity: 1, }, ], }, } ); }); test("should have the correct outputs", () => { expect(outputs).toEqual([ { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: [ 39500000, { "12b9e177c14fb0f9836c46fa423dba1a5ab63b39489b413304888d64": { "4d7574616e7443726f633030303034": 1, "4d7574616e7443726f633030303038": 1, "4d7574616e7443726f633030303133": 1, "4d7574616e7443726f633030303135": 1, "4d7574616e7443726f633030303231": 1, "4d7574616e7443726f633030303232": 1, "4d7574616e7443726f633030303330": 1, "4d7574616e7443726f633030303338": 1, "4d7574616e7443726f633030303430": 1, "4d7574616e7443726f633030303434": 1, "4d7574616e7443726f633030303436": 1, "4d7574616e7443726f633030303439": 1, "4d7574616e7443726f633030303536": 1, "4d7574616e7443726f633030303631": 1, "4d7574616e7443726f633030303633": 1, "4d7574616e7443726f633030303635": 1, "4d7574616e7443726f633030303739": 1, "4d7574616e7443726f633030303831": 1, "4d7574616e7443726f633030303834": 1, "4d7574616e7443726f633030303933": 1, }, }, ], }, { address: "address2", amount: [ 2000000, { "3d073eba80d5641fef164752a8755bbdcd2d3a2597e5f0e78fb867aa": { "4d7574616e7443726f633030303035": 1, }, }, ], }, ]); }); }); describe("case 3", () => { beforeEach(() => { const utxoSeller: CardanoUTXO = { transaction: { hash: "1658f615e42efc2f328c33667dc5cd207c308309cb0501bb53cc92d520dcf8ed", index: 1, }, utxo: { address: "addr_test1wp4u9s0ta2xwzau2z9r6meqgcwwrrj9mkr360h3mah3mcwseyp4tt", amount: { coin: 2000000, multiasset: { "8dedaeef462fb2cfefbfbd5cfc12ab702b47d8b79259d0190142dc4a": { "43617264616e6f776f726c64": 1, }, }, }, }, }; const utxoBuyer: CardanoUTXO = { transaction: { hash: "97ed356bfd887dc1fe564ca9310ee5edc2281a09c771d4d84c48b5643b6bbcc7", index: 0, }, utxo: { address: "addr_test1qp0fz3yxwdhxvk5kdsqs4e2qzavn7mtfumsq4ngdcef3arfn036xnydynnhynmgepuhaaffgslfnlp83uln37w6p252sytjvdq", amount: { coin: 51432063, }, }, }; outputs = UTXOS.calculateOutputs( [utxoSeller, utxoBuyer], { addr_test1wp4u9s0ta2xwzau2z9r6meqgcwwrrj9mkr360h3mah3mcwseyp4tt: { totalCoin: 2000000, tokens: [ { asset: "43617264616e6f776f726c64", policy: "8dedaeef462fb2cfefbfbd5cfc12ab702b47d8b79259d0190142dc4a", quantity: 1, }, ], }, addr_test1qp0fz3yxwdhxvk5kdsqs4e2qzavn7mtfumsq4ngdcef3arfn036xnydynnhynmgepuhaaffgslfnlp83uln37w6p252sytjvdq: { totalCoin: 50000000 + 1010373, }, }, { addr_test1qp0fz3yxwdhxvk5kdsqs4e2qzavn7mtfumsq4ngdcef3arfn036xnydynnhynmgepuhaaffgslfnlp83uln37w6p252sytjvdq: { totalCoin: 2000000, tokens: [ { asset: "43617264616e6f776f726c64", policy: "8dedaeef462fb2cfefbfbd5cfc12ab702b47d8b79259d0190142dc4a", quantity: 1, }, ], }, } ); }); test("should have the correct outputs", () => { expect(outputs).toEqual([ { address: "addr_test1qp0fz3yxwdhxvk5kdsqs4e2qzavn7mtfumsq4ngdcef3arfn036xnydynnhynmgepuhaaffgslfnlp83uln37w6p252sytjvdq", amount: [ 2421690, { "8dedaeef462fb2cfefbfbd5cfc12ab702b47d8b79259d0190142dc4a": { "43617264616e6f776f726c64": 1, }, }, ], }, ]); }); }); describe("case 4", () => { beforeEach(() => { const utxosSeller: CardanoUTXO[] = [ { transaction: { hash: "0c375b6a8653a5ddac3ba1c44c71ccf97587dec7b63e6614c4f887c8c2413a8f", index: 0, }, utxo: { address: "sellerAddress", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033373535": 1, }, }, }, }, }, { transaction: { hash: "34026ca961564d05dd4a461cf9ce75c4a2f17046f404641c57836b912cc177a0", index: 0, }, utxo: { address: "sellerAddress", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033333031": 1, }, }, }, }, }, { transaction: { hash: "3a4f1122e4ded73072b98def02ddaf790321bd05e07380f92b3258a316ff677e", index: 0, }, utxo: { address: "sellerAddress", amount: { coin: 2000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033323539": 1, }, }, }, }, }, ]; outputs = UTXOS.calculateOutputs( utxosSeller, { sellerAddress: { totalCoin: 2000000, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643030303235", quantity: "1", }), ], }, }, { validatorAddress: { totalCoin: 2000000, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643030303235", quantity: "1", }), ], }, } ); }); test("outputs", () => { expect(outputs).toEqual([ { address: "sellerAddress", amount: [ 4000000, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033323539": 1, "4d7574616e74546f61643033333031": 1, "4d7574616e74546f61643033373535": 1, }, }, ], datum: undefined, }, { address: "validatorAddress", amount: [ 2000000, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030303235": 1, }, }, ], datum: undefined, }, ]); }); }); describe("case 5", () => { beforeEach(() => { const inputs: CardanoUTXO[] = [ { transaction: { hash: "sellerinput1", index: 0, }, utxo: { address: "selleraddress", amount: { coin: 31930332, multiasset: { "092a5162d7d3ff43e1e3c020fb54f258acb71c36295d7fe5037cf4d4": { "48617070794e65775965617232303232": 1, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030313939": 1, "4d7574616e74546f61643031303136": 1, "4d7574616e74546f61643031353430": 1, "4d7574616e74546f61643033323536": 1, }, "22d843e9e8b39d105c645944cc848abee2673d64e60f1f022791ec85": { "457175696e6550696f6e656572536b696e3038393231": 1, }, "23a000a839f04bb71b59b4ae74bf8cf5ed21ee0be520690e665ae4b4": { "457175696e6550696f6e6565724a6f636b65793130393536": 1, }, "2ad6da7b4a5d25ec369e784981704488528028bf6771a5a21a1ff5b9": { "706c616e6574756e7369673237333430783035": 1, "706c616e6574756e7369673239323232783033": 1, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "3352d182856ba195248e745843b3aec5c03c6ef1437f1c05f39c4e55": { "4e616e6f43686573733035353636": 1, }, "40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728": { "436c61794e6174696f6e33353631": 1, }, "547ceed647f57e64dc40a29b16be4f36b0d38b5aa3cd7afb286fc094": { "6262486f736b79": 500, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "5c80d8420b415e6f277d830e780190f288993019108bebecf5ccf9e1": { "46726573636f7323313136": 1, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 1000, }, "691d5cd8edee42c504f63a8801a242fe75303543dedd8df981ae538a": { "445241474f4e5a313833": 1, }, "7ac0d60912f331a8114a6bc520c8e67b617f2249a4f4482d136bb17a": { "4c6f76654c61636531373631": 1, }, "7d2d1ee92be476d47043d26ac5a45402e3bdb50a34aa8d716babeefc": { "53706f6f70794e6172753033313737": 1, }, "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc3": { "4c4f4253544552": 1000000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 2288926, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 322927025, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 2000, }, a71d0b299a811b657c9434068077a118a273e1062e8b1da572769651: { "4b696e674178656c73536576656e7468426f726e": 1, }, aec5a6dac10ec781df9f337d33ef7d55b9b48535668b8038affa326c: { "4c696c476f61743031393934": 1, "4c696c476f61743032363938": 1, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 2000000000, }, b0446f1c9105f0cc5bb6bd092f5c3e523e13f8a999b31c870298fa40: { "51554944": 3, }, b1814c6d3b0f7a42c9ee990c06c9d504a42bb22bf0e34e7908ae21b2: { "4e6172753036303336": 1, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 50000000, }, b2d25f829ebb7f4c97b5e847923a1115b23ebf78000722c229c9c9f7: { "44523034373133": 1, "44523037353730": 1, }, b59e91a4f77f06d0369f67441517a7e048b5f098ffc8497ab2487b6c: { "506978656e646f537061636573686970373136": 1, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 640899319, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 150, }, b92f6473f18d4b78733d022fd89f3cacc1484fab6eddfd3c5d4b9494: { "44503036393434": 1, }, c56d4cceb8a8550534968e1bf165137ca41e908d2d780cc1402079bd: { "4368696c6c65644b6f6e6737363939": 1, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 1260, }, d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633030313831": 1, "4d7574616e7443726f633030343131": 1, "4d7574616e7443726f633030343337": 1, "4d7574616e7443726f633031303833": 1, "4d7574616e7443726f633031323030": 1, "4d7574616e7443726f633031323332": 1, "4d7574616e7443726f633031393936": 1, "4d7574616e7443726f633032323339": 1, "4d7574616e7443726f633032323833": 1, "4d7574616e7443726f633032343731": 1, "4d7574616e7443726f633032353230": 1, "4d7574616e7443726f633032363039": 1, "4d7574616e7443726f633032383034": 1, "4d7574616e7443726f633032383138": 1, "4d7574616e7443726f633032383836": 1, "4d7574616e7443726f633032393633": 1, "4d7574616e7443726f633032393835": 1, "4d7574616e7443726f633032393939": 1, "4d7574616e7443726f633033303335": 1, "4d7574616e7443726f633033303337": 1, "4d7574616e7443726f633033303534": 1, "4d7574616e7443726f633033323039": 1, "4d7574616e7443726f633033333532": 1, "4d7574616e7443726f633033333632": 1, "4d7574616e7443726f633033333937": 1, "4d7574616e7443726f633033353132": 1, "4d7574616e7443726f633034303830": 1, "4d7574616e7443726f633034303837": 1, "4d7574616e7443726f633034313034": 1, "4d7574616e7443726f633034313533": 1, "4d7574616e7443726f633034313838": 1, "4d7574616e7443726f633034313932": 1, "4d7574616e7443726f633034313935": 1, "4d7574616e7443726f633034323435": 1, "4d7574616e7443726f633034323734": 1, "4d7574616e7443726f633034323735": 1, "4d7574616e7443726f633034333132": 1, "4d7574616e7443726f633034333830": 1, "4d7574616e7443726f633034343134": 1, "4d7574616e7443726f633034343135": 1, "4d7574616e7443726f633034343339": 1, "4d7574616e7443726f633034343739": 1, "4d7574616e7443726f633034343831": 1, "4d7574616e7443726f633034343839": 1, "4d7574616e7443726f633034343930": 1, "4d7574616e7443726f633034353130": 1, "4d7574616e7443726f633034353230": 1, "4d7574616e7443726f633034353630": 1, "4d7574616e7443726f633034353638": 1, "4d7574616e7443726f633034353739": 1, "4d7574616e7443726f633034363336": 1, "4d7574616e7443726f633034363435": 1, "4d7574616e7443726f633034373030": 1, "4d7574616e7443726f633034373236": 1, "4d7574616e7443726f633034373534": 1, "4d7574616e7443726f633034373639": 1, "4d7574616e7443726f633034383036": 1, "4d7574616e7443726f633034383430": 1, "4d7574616e7443726f633034383636": 1, "4d7574616e7443726f633034383639": 1, "4d7574616e7443726f633034393033": 1, "4d7574616e7443726f633034393035": 1, "4d7574616e7443726f633034393134": 1, "4d7574616e7443726f633034393434": 1, "4d7574616e7443726f633034393535": 1, "4d7574616e7443726f633034393732": 1, "4d7574616e7443726f633034393737": 1, "4d7574616e7443726f633035313130": 1, "4d7574616e7443726f633035313139": 1, "4d7574616e7443726f633035313330": 1, "4d7574616e7443726f633035313531": 1, "4d7574616e7443726f633035313538": 1, "4d7574616e7443726f633035313736": 1, "4d7574616e7443726f633035313830": 1, "4d7574616e7443726f633035323234": 1, "4d7574616e7443726f633035323331": 1, "4d7574616e7443726f633035323633": 1, "4d7574616e7443726f633035333030": 1, "4d7574616e7443726f633035333036": 1, "4d7574616e7443726f633035333237": 1, "4d7574616e7443726f633035333436": 1, "4d7574616e7443726f633035333933": 1, "4d7574616e7443726f633035343033": 1, "4d7574616e7443726f633035343434": 1, "4d7574616e7443726f633035343630": 1, "4d7574616e7443726f633035343637": 1, "4d7574616e7443726f633035343733": 1, "4d7574616e7443726f633035343830": 1, "4d7574616e7443726f633035343931": 1, "4d7574616e7443726f633035353138": 1, "4d7574616e7443726f633035353234": 1, "4d7574616e7443726f633035353431": 1, "4d7574616e7443726f633035353932": 1, "4d7574616e7443726f633035363133": 1, "4d7574616e7443726f633035363238": 1, "4d7574616e7443726f633035363530": 1, "4d7574616e7443726f633035363732": 1, "4d7574616e7443726f633035363931": 1, "4d7574616e7443726f633035373035": 1, "4d7574616e7443726f633035373230": 1, "4d7574616e7443726f633035373237": 1, "4d7574616e7443726f633035373533": 1, "4d7574616e7443726f633035373738": 1, "4d7574616e7443726f633035373837": 1, "4d7574616e7443726f633035383035": 1, "4d7574616e7443726f633035383132": 1, "4d7574616e7443726f633035383533": 1, "4d7574616e7443726f633035383633": 1, "4d7574616e7443726f633035383837": 1, "4d7574616e7443726f633035383938": 1, "4d7574616e7443726f633035393332": 1, "4d7574616e7443726f633035393531": 1, "4d7574616e7443726f633035393534": 1, "4d7574616e7443726f633036303130": 1, "4d7574616e7443726f633036303132": 1, "4d7574616e7443726f633036303136": 1, "4d7574616e7443726f633036313037": 1, "4d7574616e7443726f633036313231": 1, "4d7574616e7443726f633036313233": 1, "4d7574616e7443726f633036313330": 1, "4d7574616e7443726f633036313631": 1, "4d7574616e7443726f633036313730": 1, "4d7574616e7443726f633036323232": 1, "4d7574616e7443726f633036323432": 1, "4d7574616e7443726f633036323437": 1, "4d7574616e7443726f633036323632": 1, "4d7574616e7443726f633036323933": 1, "4d7574616e7443726f633036333030": 1, "4d7574616e7443726f633036333035": 1, "4d7574616e7443726f633036333432": 1, "4d7574616e7443726f633036333737": 1, "4d7574616e7443726f633036333931": 1, "4d7574616e7443726f633036333938": 1, "4d7574616e7443726f633036343239": 1, "4d7574616e7443726f633036343532": 1, "4d7574616e7443726f633036343534": 1, "4d7574616e7443726f633036353138": 1, "4d7574616e7443726f633036353232": 1, "4d7574616e7443726f633036353234": 1, "4d7574616e7443726f633036353237": 1, "4d7574616e7443726f633036353438": 1, "4d7574616e7443726f633036353531": 1, "4d7574616e7443726f633036353637": 1, "4d7574616e7443726f633036353830": 1, "4d7574616e7443726f633036353832": 1, "4d7574616e7443726f633036353834": 1, "4d7574616e7443726f633036363032": 1, "4d7574616e7443726f633036363130": 1, "4d7574616e7443726f633036363137": 1, "4d7574616e7443726f633036363338": 1, "4d7574616e7443726f633036363834": 1, "4d7574616e7443726f633036363936": 1, "4d7574616e7443726f633036373037": 1, "4d7574616e7443726f633036373139": 1, "4d7574616e7443726f633036373937": 1, "4d7574616e7443726f633036383031": 1, "4d7574616e7443726f633036383036": 1, "4d7574616e7443726f633036383232": 1, "4d7574616e7443726f633036383530": 1, "4d7574616e7443726f633036383638": 1, "4d7574616e7443726f633036383731": 1, "4d7574616e7443726f633036393030": 1, "4d7574616e7443726f633036393038": 1, "4d7574616e7443726f633036393238": 1, "4d7574616e7443726f633036393335": 1, "4d7574616e7443726f633036393531": 1, "4d7574616e7443726f633036393735": 1, "4d7574616e7443726f633036393738": 1, "4d7574616e7443726f633037303133": 1, "4d7574616e7443726f633037303235": 1, "4d7574616e7443726f633037303332": 1, "4d7574616e7443726f633037303836": 1, "4d7574616e7443726f633037303932": 1, "4d7574616e7443726f633037313036": 1, "4d7574616e7443726f633037313534": 1, "4d7574616e7443726f633037313732": 1, "4d7574616e7443726f633037313835": 1, "4d7574616e7443726f633037313938": 1, "4d7574616e7443726f633037323032": 1, "4d7574616e7443726f633037323331": 1, "4d7574616e7443726f633037323439": 1, "4d7574616e7443726f633037323931": 1, "4d7574616e7443726f633037333032": 1, "4d7574616e7443726f633037333231": 1, "4d7574616e7443726f633037333237": 1, "4d7574616e7443726f633037333434": 1, "4d7574616e7443726f633037333533": 1, "4d7574616e7443726f633037333633": 1, "4d7574616e7443726f633037343135": 1, "4d7574616e7443726f633037343336": 1, "4d7574616e7443726f633037343635": 1, "4d7574616e7443726f633037343935": 1, "4d7574616e7443726f633037353238": 1, }, }, }, }, }, { transaction: { hash: "sellerinput2", index: 1, }, utxo: { address: "selleraddress", amount: { coin: 70319833, }, }, }, ]; outputs = UTXOS.calculateOutputs( inputs, { selleraddress: { totalCoin: 1724100, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643030303235", quantity: "1", }), ], }, }, { validator: { totalCoin: 1724100, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643030303235", quantity: "1", }), ], }, } ); }); test("outputs", () => { expect(outputs).toEqual([ { address: "selleraddress", amount: [ 100526065, { "092a5162d7d3ff43e1e3c020fb54f258acb71c36295d7fe5037cf4d4": { "48617070794e65775965617232303232": 1, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030313939": 1, "4d7574616e74546f61643031303136": 1, "4d7574616e74546f61643031353430": 1, "4d7574616e74546f61643033323536": 1, }, "22d843e9e8b39d105c645944cc848abee2673d64e60f1f022791ec85": { "457175696e6550696f6e656572536b696e3038393231": 1, }, "23a000a839f04bb71b59b4ae74bf8cf5ed21ee0be520690e665ae4b4": { "457175696e6550696f6e6565724a6f636b65793130393536": 1, }, "2ad6da7b4a5d25ec369e784981704488528028bf6771a5a21a1ff5b9": { "706c616e6574756e7369673237333430783035": 1, "706c616e6574756e7369673239323232783033": 1, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "3352d182856ba195248e745843b3aec5c03c6ef1437f1c05f39c4e55": { "4e616e6f43686573733035353636": 1, }, "40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728": { "436c61794e6174696f6e33353631": 1, }, "547ceed647f57e64dc40a29b16be4f36b0d38b5aa3cd7afb286fc094": { "6262486f736b79": 500, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "5c80d8420b415e6f277d830e780190f288993019108bebecf5ccf9e1": { "46726573636f7323313136": 1, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 1000, }, "691d5cd8edee42c504f63a8801a242fe75303543dedd8df981ae538a": { "445241474f4e5a313833": 1, }, "7ac0d60912f331a8114a6bc520c8e67b617f2249a4f4482d136bb17a": { "4c6f76654c61636531373631": 1, }, "7d2d1ee92be476d47043d26ac5a45402e3bdb50a34aa8d716babeefc": { "53706f6f70794e6172753033313737": 1, }, "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc3": { "4c4f4253544552": 1000000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 2288926, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 322927025, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 2000, }, a71d0b299a811b657c9434068077a118a273e1062e8b1da572769651: { "4b696e674178656c73536576656e7468426f726e": 1, }, aec5a6dac10ec781df9f337d33ef7d55b9b48535668b8038affa326c: { "4c696c476f61743031393934": 1, "4c696c476f61743032363938": 1, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 2000000000, }, b0446f1c9105f0cc5bb6bd092f5c3e523e13f8a999b31c870298fa40: { "51554944": 3, }, b1814c6d3b0f7a42c9ee990c06c9d504a42bb22bf0e34e7908ae21b2: { "4e6172753036303336": 1, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 50000000, }, b2d25f829ebb7f4c97b5e847923a1115b23ebf78000722c229c9c9f7: { "44523034373133": 1, "44523037353730": 1, }, b59e91a4f77f06d0369f67441517a7e048b5f098ffc8497ab2487b6c: { "506978656e646f537061636573686970373136": 1, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 640899319, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 150, }, b92f6473f18d4b78733d022fd89f3cacc1484fab6eddfd3c5d4b9494: { "44503036393434": 1, }, c56d4cceb8a8550534968e1bf165137ca41e908d2d780cc1402079bd: { "4368696c6c65644b6f6e6737363939": 1, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 1260, }, d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633030313831": 1, "4d7574616e7443726f633030343131": 1, "4d7574616e7443726f633030343337": 1, "4d7574616e7443726f633031303833": 1, "4d7574616e7443726f633031323030": 1, "4d7574616e7443726f633031323332": 1, "4d7574616e7443726f633031393936": 1, "4d7574616e7443726f633032323339": 1, "4d7574616e7443726f633032323833": 1, "4d7574616e7443726f633032343731": 1, "4d7574616e7443726f633032353230": 1, "4d7574616e7443726f633032363039": 1, "4d7574616e7443726f633032383034": 1, "4d7574616e7443726f633032383138": 1, "4d7574616e7443726f633032383836": 1, "4d7574616e7443726f633032393633": 1, "4d7574616e7443726f633032393835": 1, "4d7574616e7443726f633032393939": 1, "4d7574616e7443726f633033303335": 1, "4d7574616e7443726f633033303337": 1, "4d7574616e7443726f633033303534": 1, "4d7574616e7443726f633033323039": 1, "4d7574616e7443726f633033333532": 1, "4d7574616e7443726f633033333632": 1, "4d7574616e7443726f633033333937": 1, "4d7574616e7443726f633033353132": 1, "4d7574616e7443726f633034303830": 1, "4d7574616e7443726f633034303837": 1, "4d7574616e7443726f633034313034": 1, "4d7574616e7443726f633034313533": 1, "4d7574616e7443726f633034313838": 1, "4d7574616e7443726f633034313932": 1, "4d7574616e7443726f633034313935": 1, "4d7574616e7443726f633034323435": 1, "4d7574616e7443726f633034323734": 1, "4d7574616e7443726f633034323735": 1, "4d7574616e7443726f633034333132": 1, "4d7574616e7443726f633034333830": 1, "4d7574616e7443726f633034343134": 1, "4d7574616e7443726f633034343135": 1, "4d7574616e7443726f633034343339": 1, "4d7574616e7443726f633034343739": 1, "4d7574616e7443726f633034343831": 1, "4d7574616e7443726f633034343839": 1, "4d7574616e7443726f633034343930": 1, "4d7574616e7443726f633034353130": 1, "4d7574616e7443726f633034353230": 1, "4d7574616e7443726f633034353630": 1, "4d7574616e7443726f633034353638": 1, "4d7574616e7443726f633034353739": 1, "4d7574616e7443726f633034363336": 1, "4d7574616e7443726f633034363435": 1, "4d7574616e7443726f633034373030": 1, "4d7574616e7443726f633034373236": 1, "4d7574616e7443726f633034373534": 1, "4d7574616e7443726f633034373639": 1, "4d7574616e7443726f633034383036": 1, "4d7574616e7443726f633034383430": 1, "4d7574616e7443726f633034383636": 1, "4d7574616e7443726f633034383639": 1, "4d7574616e7443726f633034393033": 1, "4d7574616e7443726f633034393035": 1, "4d7574616e7443726f633034393134": 1, "4d7574616e7443726f633034393434": 1, "4d7574616e7443726f633034393535": 1, "4d7574616e7443726f633034393732": 1, "4d7574616e7443726f633034393737": 1, "4d7574616e7443726f633035313130": 1, "4d7574616e7443726f633035313139": 1, "4d7574616e7443726f633035313330": 1, "4d7574616e7443726f633035313531": 1, "4d7574616e7443726f633035313538": 1, "4d7574616e7443726f633035313736": 1, "4d7574616e7443726f633035313830": 1, "4d7574616e7443726f633035323234": 1, "4d7574616e7443726f633035323331": 1, "4d7574616e7443726f633035323633": 1, "4d7574616e7443726f633035333030": 1, "4d7574616e7443726f633035333036": 1, "4d7574616e7443726f633035333237": 1, "4d7574616e7443726f633035333436": 1, "4d7574616e7443726f633035333933": 1, "4d7574616e7443726f633035343033": 1, "4d7574616e7443726f633035343434": 1, "4d7574616e7443726f633035343630": 1, "4d7574616e7443726f633035343637": 1, "4d7574616e7443726f633035343733": 1, "4d7574616e7443726f633035343830": 1, "4d7574616e7443726f633035343931": 1, "4d7574616e7443726f633035353138": 1, "4d7574616e7443726f633035353234": 1, "4d7574616e7443726f633035353431": 1, "4d7574616e7443726f633035353932": 1, "4d7574616e7443726f633035363133": 1, "4d7574616e7443726f633035363238": 1, "4d7574616e7443726f633035363530": 1, "4d7574616e7443726f633035363732": 1, "4d7574616e7443726f633035363931": 1, "4d7574616e7443726f633035373035": 1, "4d7574616e7443726f633035373230": 1, "4d7574616e7443726f633035373237": 1, "4d7574616e7443726f633035373533": 1, "4d7574616e7443726f633035373738": 1, "4d7574616e7443726f633035373837": 1, "4d7574616e7443726f633035383035": 1, "4d7574616e7443726f633035383132": 1, "4d7574616e7443726f633035383533": 1, "4d7574616e7443726f633035383633": 1, "4d7574616e7443726f633035383837": 1, "4d7574616e7443726f633035383938": 1, "4d7574616e7443726f633035393332": 1, "4d7574616e7443726f633035393531": 1, "4d7574616e7443726f633035393534": 1, "4d7574616e7443726f633036303130": 1, "4d7574616e7443726f633036303132": 1, "4d7574616e7443726f633036303136": 1, "4d7574616e7443726f633036313037": 1, "4d7574616e7443726f633036313231": 1, "4d7574616e7443726f633036313233": 1, "4d7574616e7443726f633036313330": 1, "4d7574616e7443726f633036313631": 1, "4d7574616e7443726f633036313730": 1, "4d7574616e7443726f633036323232": 1, "4d7574616e7443726f633036323432": 1, "4d7574616e7443726f633036323437": 1, "4d7574616e7443726f633036323632": 1, "4d7574616e7443726f633036323933": 1, "4d7574616e7443726f633036333030": 1, "4d7574616e7443726f633036333035": 1, "4d7574616e7443726f633036333432": 1, "4d7574616e7443726f633036333737": 1, "4d7574616e7443726f633036333931": 1, "4d7574616e7443726f633036333938": 1, "4d7574616e7443726f633036343239": 1, "4d7574616e7443726f633036343532": 1, "4d7574616e7443726f633036343534": 1, "4d7574616e7443726f633036353138": 1, "4d7574616e7443726f633036353232": 1, "4d7574616e7443726f633036353234": 1, "4d7574616e7443726f633036353237": 1, "4d7574616e7443726f633036353438": 1, "4d7574616e7443726f633036353531": 1, "4d7574616e7443726f633036353637": 1, "4d7574616e7443726f633036353830": 1, "4d7574616e7443726f633036353832": 1, "4d7574616e7443726f633036353834": 1, "4d7574616e7443726f633036363032": 1, "4d7574616e7443726f633036363130": 1, "4d7574616e7443726f633036363137": 1, "4d7574616e7443726f633036363338": 1, "4d7574616e7443726f633036363834": 1, "4d7574616e7443726f633036363936": 1, "4d7574616e7443726f633036373037": 1, "4d7574616e7443726f633036373139": 1, "4d7574616e7443726f633036373937": 1, "4d7574616e7443726f633036383031": 1, "4d7574616e7443726f633036383036": 1, "4d7574616e7443726f633036383232": 1, "4d7574616e7443726f633036383530": 1, "4d7574616e7443726f633036383638": 1, "4d7574616e7443726f633036383731": 1, "4d7574616e7443726f633036393030": 1, "4d7574616e7443726f633036393038": 1, "4d7574616e7443726f633036393238": 1, "4d7574616e7443726f633036393335": 1, "4d7574616e7443726f633036393531": 1, "4d7574616e7443726f633036393735": 1, "4d7574616e7443726f633036393738": 1, "4d7574616e7443726f633037303133": 1, "4d7574616e7443726f633037303235": 1, "4d7574616e7443726f633037303332": 1, "4d7574616e7443726f633037303836": 1, "4d7574616e7443726f633037303932": 1, "4d7574616e7443726f633037313036": 1, "4d7574616e7443726f633037313534": 1, "4d7574616e7443726f633037313732": 1, "4d7574616e7443726f633037313835": 1, "4d7574616e7443726f633037313938": 1, "4d7574616e7443726f633037323032": 1, "4d7574616e7443726f633037323331": 1, "4d7574616e7443726f633037323439": 1, "4d7574616e7443726f633037323931": 1, "4d7574616e7443726f633037333032": 1, "4d7574616e7443726f633037333231": 1, "4d7574616e7443726f633037333237": 1, "4d7574616e7443726f633037333434": 1, "4d7574616e7443726f633037333533": 1, "4d7574616e7443726f633037333633": 1, "4d7574616e7443726f633037343135": 1, "4d7574616e7443726f633037343336": 1, "4d7574616e7443726f633037343635": 1, "4d7574616e7443726f633037343935": 1, "4d7574616e7443726f633037353238": 1, }, }, ], datum: undefined, }, { address: "validator", amount: [ 1724100, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030303235": 1, }, }, ], datum: undefined, }, ]); }); }); describe("case 7", () => { beforeEach(() => { const inputs: CardanoUTXO[] = [ { transaction: { hash: "84b21c49cb7719f17a25b4caaaab31241a9aad6e5d152255304143104a5e62a1", index: 1, }, utxo: { address: "addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und", amount: { coin: 10221992, multiasset: { "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c702018": 7581268, }, "025146866af908340247fe4e9672d5ac7059f1e8534696b5f920c9e6": { "6362544843": 100000, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 6, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 500, }, ff97c85de383ebf0b047667ef23c697967719def58d380caf7f04b64: { "534f554c": 333, }, }, }, }, }, { transaction: { hash: "35adfc49cb7719f17a25b4caaaab31241a9aad6e5d152255304143104a5e62a1", index: 0, }, utxo: { address: "addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und", amount: { coin: 10000000, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032323637": 1, "4d7574616e74546f61643032333538": 1, "4d7574616e74546f61643033333531": 1, "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033363436": 1, "4d7574616e74546f61643034303832": 1, "4d7574616e74546f61643034353639": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "2b8822f7799f325e278991a244e7715591945b1c2a3589cc76035ca9": { "73637261746368": 25000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 200000, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 3, }, "437f3ba3b380f35b830ce588751d08affd24da14c927895cf1d4dbe3": { "50726f6a656374576967687473496368696d6930353134": 1, }, "544571c086d0e5c5022aca9717dd0f438e21190abb48f37b3ae129f0": { "47524f57": 2, }, "56673962a054070732569178ba2b3e1cb591e3413ecd7b57a9e3f18b": { "4245414e53": 10000, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 2000, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 20000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 5000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 5, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 1000, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 1000000000, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 100000000, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 277912268091, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 50, }, }, }, }, }, ]; outputs = UTXOS.calculateOutputs( inputs, { addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und: { totalCoin: 10721992, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643032333538", quantity: "1", }), ], }, }, { validator: { totalCoin: 1724100, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643032333538", quantity: "1", }), ], datum: { constructor: 0, fields: [{ bytes: "7551558" }], }, }, } ); }); test("outputs", () => { expect(outputs).toEqual([ { address: "addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und", amount: [ 9500000, { "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c702018": 7581268, }, "025146866af908340247fe4e9672d5ac7059f1e8534696b5f920c9e6": { "6362544843": 100000, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032323637": 1, "4d7574616e74546f61643033333531": 1, "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033363436": 1, "4d7574616e74546f61643034303832": 1, "4d7574616e74546f61643034353639": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "2b8822f7799f325e278991a244e7715591945b1c2a3589cc76035ca9": { "73637261746368": 25000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 200000, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 3, }, "437f3ba3b380f35b830ce588751d08affd24da14c927895cf1d4dbe3": { "50726f6a656374576967687473496368696d6930353134": 1, }, "544571c086d0e5c5022aca9717dd0f438e21190abb48f37b3ae129f0": { "47524f57": 2, }, "56673962a054070732569178ba2b3e1cb591e3413ecd7b57a9e3f18b": { "4245414e53": 10000, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 2000, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 20000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 5000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 5, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 1000, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 1000000000, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 100000000, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 277912268091, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 50, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 6, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 500, }, ff97c85de383ebf0b047667ef23c697967719def58d380caf7f04b64: { "534f554c": 333, }, }, ], datum: undefined, }, { address: "validator", amount: [ 1724100, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032333538": 1, }, }, ], datum: { constructor: 0, fields: [{ bytes: "7551558" }], }, }, ]); }); }); describe("case 6", () => { beforeEach(() => { const inputs: CardanoUTXO[] = [ { transaction: { hash: "84b21c49cb7719f17a25b4caaaab31241a9aad6e5d152255304143104a5e62a1", index: 1, }, utxo: { address: "addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und", amount: { coin: 10221992, multiasset: { "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c702018": 7581268, }, "025146866af908340247fe4e9672d5ac7059f1e8534696b5f920c9e6": { "6362544843": 100000, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032323637": 1, "4d7574616e74546f61643032333538": 1, "4d7574616e74546f61643033333531": 1, "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033363436": 1, "4d7574616e74546f61643034303832": 1, "4d7574616e74546f61643034353639": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "2b8822f7799f325e278991a244e7715591945b1c2a3589cc76035ca9": { "73637261746368": 25000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 200000, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 3, }, "437f3ba3b380f35b830ce588751d08affd24da14c927895cf1d4dbe3": { "50726f6a656374576967687473496368696d6930353134": 1, }, "544571c086d0e5c5022aca9717dd0f438e21190abb48f37b3ae129f0": { "47524f57": 2, }, "56673962a054070732569178ba2b3e1cb591e3413ecd7b57a9e3f18b": { "4245414e53": 10000, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 2000, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 20000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 5000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 5, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 1000, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 1000000000, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 100000000, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 277912268091, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 50, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 6, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 500, }, ff97c85de383ebf0b047667ef23c697967719def58d380caf7f04b64: { "534f554c": 333, }, }, }, }, }, ]; outputs = UTXOS.calculateOutputs( inputs, { addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und: { totalCoin: 1724100, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643032333538", quantity: "1", }), ], }, }, { validator: { totalCoin: 1724100, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643032333538", quantity: "1", }), ], datum: { constructor: 0, fields: [{ bytes: "7551558" }], }, }, } ); }); test("outputs", () => { expect(outputs).toEqual([ { address: "addr_test1qx8uz0nsv5nhutnkghaghlsp0gw2247yhzy9jmuz8svy0zs00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrns9r5und", amount: [ 8497892, { "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c702018": 7581268, }, "025146866af908340247fe4e9672d5ac7059f1e8534696b5f920c9e6": { "6362544843": 100000, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032323637": 1, "4d7574616e74546f61643033333531": 1, "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033363436": 1, "4d7574616e74546f61643034303832": 1, "4d7574616e74546f61643034353639": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "2b8822f7799f325e278991a244e7715591945b1c2a3589cc76035ca9": { "73637261746368": 25000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 200000, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 3, }, "437f3ba3b380f35b830ce588751d08affd24da14c927895cf1d4dbe3": { "50726f6a656374576967687473496368696d6930353134": 1, }, "544571c086d0e5c5022aca9717dd0f438e21190abb48f37b3ae129f0": { "47524f57": 2, }, "56673962a054070732569178ba2b3e1cb591e3413ecd7b57a9e3f18b": { "4245414e53": 10000, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 2000, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 20000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 5000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 5, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 1000, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 1000000000, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 100000000, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 277912268091, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 50, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 6, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 500, }, ff97c85de383ebf0b047667ef23c697967719def58d380caf7f04b64: { "534f554c": 333, }, }, ], datum: undefined, }, { address: "validator", amount: [ 1724100, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032333538": 1, }, }, ], datum: { constructor: 0, fields: [{ bytes: "7551558" }], }, }, ]); }); }); describe("case 7", () => { let requiredOutputs: RequiredOutputs; beforeEach(() => { const inputs: CardanoUTXO[] = [ { transaction: { hash: "178a5cd254ea8cc586459fe7516dad32c606e48929688560745bb667ea994a3c", index: 0, }, utxo: { address: "addr1q85j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnspq6sah", amount: { coin: 1728217, }, }, }, { transaction: { hash: "8090739b3a584da2f683b440ff9f84bbd3a17a2688664512600fc7203f8a498f", index: 1, }, utxo: { address: "addr1wyw38h96kahf87uqespzl37hj7pxhajv5fxnhah33pf89hswjepm0", amount: { coin: 1965474, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033383633": 1, "4d7574616e74546f61643034303832": 1, }, }, }, }, }, ]; const requiredInputs = { addr1wyw38h96kahf87uqespzl37hj7pxhajv5fxnhah33pf89hswjepm0: { totalCoin: 1965474, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643033343431", quantity: "1", }), AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643033383633", quantity: "1", }), AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643034303832", quantity: "1", }), ], }, addr1q85j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnspq6sah: { totalCoin: 945517, }, }; requiredOutputs = { addr1q85j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnspq6sah: { totalCoin: 1965474, tokens: [ AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643033343431", quantity: "1", }), AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643033383633", quantity: "1", }), AssetUtils.toCardanoAsset({ unit: "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c4d7574616e74546f61643034303832", quantity: "1", }), ], }, }; outputs = UTXOS.calculateOutputs( inputs, requiredInputs, requiredOutputs ); }); test("outputs", () => { expect(outputs).toEqual([ { address: "addr1q85j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnspq6sah", amount: [ 2748174, { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033383633": 1, "4d7574616e74546f61643034303832": 1, }, }, ], }, ]); }); }); }); describe("sort", () => { let utxos: CardanoUTXO[] = []; let sortedUtxos: CardanoUTXO[] = []; describe("case 1", () => { beforeEach(() => { const utxo0: CardanoUTXO = { transaction: { hash: "FCC4C4D79ADD692CB65BC553CACDDAB595BE075A3C29B632BB1AEE45EF2ECEEE", index: 1, }, utxo: { address: "irrelevant", amount: { coin: 1851850, multiasset: { "83c0ab67afc9148bd1571b7a14de1df03cd5624f5992d3b8ec84d6fb": { "4164614e696e6a617a31363033": 1, }, }, }, }, }; const utxo1: CardanoUTXO = { transaction: { hash: "D820D299A39BCDA6A57AD9E361E5003BE624B12DC1A6DC83CF3A342C56CEA64B", index: 1, }, utxo: { address: "irrelevant", amount: { coin: 2896500, }, }, }; const utxo2: CardanoUTXO = { transaction: { hash: "9E37F422F1421F2CBDFB69C7931CD0B0192C1C6A651DF84E51760B09B2BE0F89", index: 1, }, utxo: { address: "irrelevant", amount: { coin: 2619900, }, }, }; const utxo3: CardanoUTXO = { transaction: { hash: "CDB92DAF2855BDD0CAF24CCBA48E319A7B3033BCB2CE3115DE05BEFE7AA2E6D4", index: 1, }, utxo: { address: "irrelevant", amount: { coin: 10624662, multiasset: { d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633030323933": 1, }, }, }, }, }; const utxo4: CardanoUTXO = { transaction: { hash: "C76209BBCE6B4DC40F4A41A43DDC38259EA5EE816D815BD616E49BAAFFCE9F1B", index: 1, }, utxo: { address: "irrelevant", amount: { coin: 74831683, }, }, }; utxos = [utxo0, utxo1, utxo2, utxo3, utxo4]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "9E37F422F1421F2CBDFB69C7931CD0B0192C1C6A651DF84E51760B09B2BE0F89" ); expect(sortedUtxos[1].transaction.hash).toBe( "C76209BBCE6B4DC40F4A41A43DDC38259EA5EE816D815BD616E49BAAFFCE9F1B" ); expect(sortedUtxos[2].transaction.hash).toBe( "CDB92DAF2855BDD0CAF24CCBA48E319A7B3033BCB2CE3115DE05BEFE7AA2E6D4" ); expect(sortedUtxos[3].transaction.hash).toBe( "D820D299A39BCDA6A57AD9E361E5003BE624B12DC1A6DC83CF3A342C56CEA64B" ); expect(sortedUtxos[4].transaction.hash).toBe( "FCC4C4D79ADD692CB65BC553CACDDAB595BE075A3C29B632BB1AEE45EF2ECEEE" ); }); }); describe("case 2", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "050d2022f3b088e4c4f6eab931b850172c5421a37ee290bce341034076266e97", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "84feb8909ba2789e33854815a31356ae2381a7976b5466b389d206fb03605b5d", index: 0, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "050d2022f3b088e4c4f6eab931b850172c5421a37ee290bce341034076266e97" ); expect(sortedUtxos[1].transaction.hash).toBe( "84feb8909ba2789e33854815a31356ae2381a7976b5466b389d206fb03605b5d" ); }); }); describe("case 3", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "39771990a5c9547e4630672ba3e3835a4ebd20743bc0e0198a8a1ed1d798a8cd", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "dcf2bd36be155d1ab2caf9d1499b5cba7440da2f3c09741f7a2ce02338216296", index: 2, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "39771990a5c9547e4630672ba3e3835a4ebd20743bc0e0198a8a1ed1d798a8cd" ); expect(sortedUtxos[1].transaction.hash).toBe( "dcf2bd36be155d1ab2caf9d1499b5cba7440da2f3c09741f7a2ce02338216296" ); }); }); describe("case 4", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "1337a7a8921f4b74eeb8f044b464a24bb308293175bba5d5c51ad785004cdabf", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "953661f31b6488d7c9b09ae580251d4b7db586d21d6e578195d9e2d7db93bcee", index: 0, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "1337a7a8921f4b74eeb8f044b464a24bb308293175bba5d5c51ad785004cdabf" ); expect(sortedUtxos[1].transaction.hash).toBe( "953661f31b6488d7c9b09ae580251d4b7db586d21d6e578195d9e2d7db93bcee" ); }); }); describe("case 5", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "da32b343f5708fbdbc1ce0f08d66314f7e300057a98a9c6d84bb3e9248c7554a", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "96e3fb943d5c4c8104d98d355f6efbf6e6856f56af13c252a5a80f8b2cb6577e", index: 0, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "96e3fb943d5c4c8104d98d355f6efbf6e6856f56af13c252a5a80f8b2cb6577e" ); expect(sortedUtxos[1].transaction.hash).toBe( "da32b343f5708fbdbc1ce0f08d66314f7e300057a98a9c6d84bb3e9248c7554a" ); }); }); describe("case 6", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "f1b38d395f6dac93bd40a3a11f93c93a826f21e2982e17a1b4228304d9ced3e4", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "fc3e6a7f440798fbed49087d32e30412b30162862749957f566b4876d0fe5f3d", index: 1, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "f1b38d395f6dac93bd40a3a11f93c93a826f21e2982e17a1b4228304d9ced3e4" ); expect(sortedUtxos[1].transaction.hash).toBe( "fc3e6a7f440798fbed49087d32e30412b30162862749957f566b4876d0fe5f3d" ); }); }); describe("case 7", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "db0f4d47d50439a817968b9cb17fb6638d472ff9e752d8453c52125bb8a89df2", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "9ccc26e6eeeddfc06d8906974596ec71a876c0f1812af33323b52a8fa6248fcc", index: 1, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "9ccc26e6eeeddfc06d8906974596ec71a876c0f1812af33323b52a8fa6248fcc" ); expect(sortedUtxos[1].transaction.hash).toBe( "db0f4d47d50439a817968b9cb17fb6638d472ff9e752d8453c52125bb8a89df2" ); }); }); describe("case 8", () => { beforeEach(() => { const utxo1 = { transaction: { hash: "353ac8fabb2963d9c5fd2160b706973d70333a87f4b9421bf7404a7eb5ac7a42", index: 1, }, utxo: { address: "addr_test1wqxfvsqp2e4hqgkwr9sds723ygyfpm9kwx9e049df3dm72svt3al7", amount: { coin: 2000000, multiasset: { "8b9246dcb2f8b2626e4dee915560743dc1c18f17fa71472c2013f775": { "74657374": 1, }, }, }, }, }; const utxo2 = { transaction: { hash: "39c885ad9b66757b9e2c1b7f2c816ff67b8d56af857dc451752926c241f9c46f", index: 0, }, utxo: { address: "addr_test1qr5j96qkdpfqw0tvrjd7qum9xpqye8pxmxapwulpr5edz8q00vk8lzfy22xhj750smvzzrtzwmsf73ac9mx48gjfqrnszk8s3g", amount: { coin: 25877352, }, }, }; utxos = [utxo1, utxo2]; sortedUtxos = UTXOS.sort(utxos); }); test("should sort correctly", () => { expect(sortedUtxos[0].transaction.hash).toBe( "353ac8fabb2963d9c5fd2160b706973d70333a87f4b9421bf7404a7eb5ac7a42" ); expect(sortedUtxos[1].transaction.hash).toBe( "39c885ad9b66757b9e2c1b7f2c816ff67b8d56af857dc451752926c241f9c46f" ); }); }); }); describe("hasAsset", () => { test("should return true when the asset is present in the utxo", () => { const utxo: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address1", amount: { coin: 100000000, // 100 ADA multiasset: { policyid1: { asset1: 1, asset2: 1, asset3: 1, }, e8a9ee82be95327348407217dced95aa75fbc646a9e841778b029b61: { "74657374303031": 1, }, }, }, }, }; expect( UTXOS.hasAsset( utxo, "e8a9ee82be95327348407217dced95aa75fbc646a9e841778b029b6174657374303031" ) ).toBe(true); }); test("should return false when the asset is not present in the utxo", () => { const utxo: CardanoUTXO = { transaction: { hash: "transactionhash", index: 1, }, utxo: { address: "address1", amount: { coin: 100000000, // 100 ADA multiasset: { policyid1: { asset1: 1, asset2: 1, asset3: 1, }, }, }, }, }; expect( UTXOS.hasAsset( utxo, "e8a9ee82be95327348407217dced95aa75fbc646a9e841778b029b6174657374303031" ) ).toBe(false); }); }); describe("calculateMinUtxoCost", () => { test("case 1: with a single asset", () => { const utxo: CardanoUTXO = { transaction: { hash: "e5270d2d446a186cbcd0dd03568bbf1c8dc8b6062c7aae25edd3b7f30f4ee423", index: 1, }, utxo: { address: "sellerAddress", amount: { coin: 11034240, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030303135": 1, }, }, }, }, }; expect(UTXOS.calculateMinUtxoCost(utxo)).toBe(1379280); }); test("case 2: with multiple assets", () => { const utxo = { transaction: { hash: "e5270d2d446a186cbcd0dd03568bbf1c8dc8b6062c7aae25edd3b7f30f4ee423", index: 1, }, utxo: { address: "sellerAddress", amount: { coin: 11034240, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030303135": 1, "4d7574616e74546f61643030323831": 1, "4d7574616e74546f61643030323936": 1, "4d7574616e74546f61643030333130": 1, "4d7574616e74546f61643030343637": 1, "4d7574616e74546f61643030353538": 1, "4d7574616e74546f61643030353738": 1, "4d7574616e74546f61643030373233": 1, "4d7574616e74546f61643030373836": 1, "4d7574616e74546f61643030383030": 1, "4d7574616e74546f61643031313538": 1, "4d7574616e74546f61643031313932": 1, "4d7574616e74546f61643031323236": 1, "4d7574616e74546f61643031323538": 1, "4d7574616e74546f61643031333530": 1, "4d7574616e74546f61643031333930": 1, "4d7574616e74546f61643031353730": 1, "4d7574616e74546f61643031373630": 1, "4d7574616e74546f61643031373931": 1, "4d7574616e74546f61643031383031": 1, "4d7574616e74546f61643031383735": 1, "4d7574616e74546f61643031393937": 1, "4d7574616e74546f61643032303537": 1, "4d7574616e74546f61643032333737": 1, "4d7574616e74546f61643032343031": 1, "4d7574616e74546f61643032343135": 1, "4d7574616e74546f61643032343139": 1, "4d7574616e74546f61643032343331": 1, "4d7574616e74546f61643032343337": 1, "4d7574616e74546f61643032343430": 1, "4d7574616e74546f61643032343532": 1, "4d7574616e74546f61643032343835": 1, "4d7574616e74546f61643032353138": 1, "4d7574616e74546f61643032353430": 1, "4d7574616e74546f61643032363138": 1, "4d7574616e74546f61643032363639": 1, "4d7574616e74546f61643032393335": 1, "4d7574616e74546f61643033303139": 1, "4d7574616e74546f61643033303237": 1, "4d7574616e74546f61643033303731": 1, "4d7574616e74546f61643033313039": 1, "4d7574616e74546f61643033313531": 1, "4d7574616e74546f61643033313633": 1, "4d7574616e74546f61643033323237": 1, "4d7574616e74546f61643033323735": 1, "4d7574616e74546f61643033333039": 1, "4d7574616e74546f61643033333539": 1, "4d7574616e74546f61643033343234": 1, "4d7574616e74546f61643033343430": 1, "4d7574616e74546f61643033343438": 1, "4d7574616e74546f61643033353336": 1, "4d7574616e74546f61643033353431": 1, "4d7574616e74546f61643033353437": 1, "4d7574616e74546f61643033353634": 1, "4d7574616e74546f61643033373130": 1, "4d7574616e74546f61643033373634": 1, "4d7574616e74546f61643033373636": 1, "4d7574616e74546f61643033383136": 1, "4d7574616e74546f61643033383333": 1, "4d7574616e74546f61643033383736": 1, "4d7574616e74546f61643033393439": 1, "4d7574616e74546f61643034303536": 1, "4d7574616e74546f61643034303835": 1, "4d7574616e74546f61643034313438": 1, "4d7574616e74546f61643034313832": 1, "4d7574616e74546f61643034323133": 1, "4d7574616e74546f61643034323530": 1, "4d7574616e74546f61643034323838": 1, "4d7574616e74546f61643034333133": 1, "4d7574616e74546f61643034333238": 1, "4d7574616e74546f61643034333730": 1, "4d7574616e74546f61643034333731": 1, "4d7574616e74546f61643034333736": 1, "4d7574616e74546f61643034333833": 1, "4d7574616e74546f61643034333939": 1, "4d7574616e74546f61643034353133": 1, "4d7574616e74546f61643034353335": 1, "4d7574616e74546f61643034353635": 1, "4d7574616e74546f61643034363234": 1, "4d7574616e74546f61643034363631": 1, "4d7574616e74546f61643034363833": 1, "4d7574616e74546f61643034373737": 1, "4d7574616e74546f61643034373933": 1, "4d7574616e74546f61643034383036": 1, }, }, }, }, }; expect(UTXOS.calculateMinUtxoCost(utxo)).toBe(11034240); }); test("case 3: with a single asset and datum hash", () => { const utxo: CardanoUTXO = { transaction: { hash: "e5270d2d446a186cbcd0dd03568bbf1c8dc8b6062c7aae25edd3b7f30f4ee423", index: 1, }, utxo: { address: "sellerAddress", amount: { coin: 11034240, multiasset: { "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030303135": 1, }, }, datum: "8c377de6a487f44cf8b0d5800b82206cde41e39e6795042ea1e30e3baa71088a", }, }, }; expect(UTXOS.calculateMinUtxoCost(utxo)).toBe(1724100); }); test("case 4: with a single asset and datum hash", () => { const utxo: CardanoUTXO = { transaction: { hash: "e5270d2d446a186cbcd0dd03568bbf1c8dc8b6062c7aae25edd3b7f30f4ee423", index: 1, }, utxo: { address: "sellerAddress", amount: { coin: 11034240, multiasset: { d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633033303534": 1, }, }, datum: "7029a942815036bd07102f2a05442db2b9d1ea56eec11f687e6cf24aea6c9690", }, }, }; expect(UTXOS.calculateMinUtxoCost(utxo)).toBe(1724100); }); }); describe("calculateMinMultiassetCost", () => { test("case 1", () => { const minCost = UTXOS.calculateMinMultiassetCost({ "092a5162d7d3ff43e1e3c020fb54f258acb71c36295d7fe5037cf4d4": { "48617070794e65775965617232303232": 1, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030313939": 1, "4d7574616e74546f61643031303136": 1, "4d7574616e74546f61643031353430": 1, "4d7574616e74546f61643033323536": 1, }, "22d843e9e8b39d105c645944cc848abee2673d64e60f1f022791ec85": { "457175696e6550696f6e656572536b696e3038393231": 1, }, "23a000a839f04bb71b59b4ae74bf8cf5ed21ee0be520690e665ae4b4": { "457175696e6550696f6e6565724a6f636b65793130393536": 1, }, "2ad6da7b4a5d25ec369e784981704488528028bf6771a5a21a1ff5b9": { "706c616e6574756e7369673237333430783035": 1, "706c616e6574756e7369673239323232783033": 1, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "3352d182856ba195248e745843b3aec5c03c6ef1437f1c05f39c4e55": { "4e616e6f43686573733035353636": 1, }, "40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728": { "436c61794e6174696f6e33353631": 1, }, "547ceed647f57e64dc40a29b16be4f36b0d38b5aa3cd7afb286fc094": { "6262486f736b79": 500, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "5c80d8420b415e6f277d830e780190f288993019108bebecf5ccf9e1": { "46726573636f7323313136": 1, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 1000, }, "691d5cd8edee42c504f63a8801a242fe75303543dedd8df981ae538a": { "445241474f4e5a313833": 1, }, "7ac0d60912f331a8114a6bc520c8e67b617f2249a4f4482d136bb17a": { "4c6f76654c61636531373631": 1, }, "7d2d1ee92be476d47043d26ac5a45402e3bdb50a34aa8d716babeefc": { "53706f6f70794e6172753033313737": 1, }, "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc3": { "4c4f4253544552": 1000000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 2288926, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 322927025, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 2000, }, a71d0b299a811b657c9434068077a118a273e1062e8b1da572769651: { "4b696e674178656c73536576656e7468426f726e": 1, }, aec5a6dac10ec781df9f337d33ef7d55b9b48535668b8038affa326c: { "4c696c476f61743031393934": 1, "4c696c476f61743032363938": 1, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 2000000000, }, b0446f1c9105f0cc5bb6bd092f5c3e523e13f8a999b31c870298fa40: { "51554944": 3, }, b1814c6d3b0f7a42c9ee990c06c9d504a42bb22bf0e34e7908ae21b2: { "4e6172753036303336": 1, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 50000000, }, b2d25f829ebb7f4c97b5e847923a1115b23ebf78000722c229c9c9f7: { "44523034373133": 1, "44523037353730": 1, }, b59e91a4f77f06d0369f67441517a7e048b5f098ffc8497ab2487b6c: { "506978656e646f537061636573686970373136": 1, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 640899319, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 150, }, b92f6473f18d4b78733d022fd89f3cacc1484fab6eddfd3c5d4b9494: { "44503036393434": 1, }, c56d4cceb8a8550534968e1bf165137ca41e908d2d780cc1402079bd: { "4368696c6c65644b6f6e6737363939": 1, }, ca5fc915496a771109b98c4a2b76e32c21a8229f3332398cb8babcd7: { "5261747344616f3031333430": 1, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 1260, }, d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633030313831": 1, "4d7574616e7443726f633031303833": 1, "4d7574616e7443726f633031323030": 1, "4d7574616e7443726f633031323332": 1, "4d7574616e7443726f633031393936": 1, "4d7574616e7443726f633032323339": 1, "4d7574616e7443726f633032323833": 1, "4d7574616e7443726f633032343731": 1, "4d7574616e7443726f633032353230": 1, "4d7574616e7443726f633032363039": 1, "4d7574616e7443726f633032383034": 1, "4d7574616e7443726f633032383138": 1, "4d7574616e7443726f633032383836": 1, "4d7574616e7443726f633032393633": 1, "4d7574616e7443726f633032393835": 1, "4d7574616e7443726f633032393939": 1, "4d7574616e7443726f633033303335": 1, "4d7574616e7443726f633033303337": 1, "4d7574616e7443726f633033303534": 1, "4d7574616e7443726f633033323039": 1, "4d7574616e7443726f633033333532": 1, "4d7574616e7443726f633033333632": 1, "4d7574616e7443726f633033333937": 1, "4d7574616e7443726f633033353132": 1, "4d7574616e7443726f633034303830": 1, "4d7574616e7443726f633034303837": 1, "4d7574616e7443726f633034313034": 1, "4d7574616e7443726f633034313533": 1, "4d7574616e7443726f633034313838": 1, "4d7574616e7443726f633034313932": 1, "4d7574616e7443726f633034313935": 1, "4d7574616e7443726f633034323435": 1, "4d7574616e7443726f633034323734": 1, "4d7574616e7443726f633034323735": 1, "4d7574616e7443726f633034333132": 1, "4d7574616e7443726f633034333830": 1, "4d7574616e7443726f633034343134": 1, "4d7574616e7443726f633034343135": 1, "4d7574616e7443726f633034343339": 1, "4d7574616e7443726f633034343739": 1, "4d7574616e7443726f633034343831": 1, "4d7574616e7443726f633034343839": 1, "4d7574616e7443726f633034343930": 1, "4d7574616e7443726f633034353130": 1, "4d7574616e7443726f633034353230": 1, }, }); expect(minCost).toBe(14965188); }); test("case 2", () => { const minCost = UTXOS.calculateMinMultiassetCost({ "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c702018": 7581268, }, "025146866af908340247fe4e9672d5ac7059f1e8534696b5f920c9e6": { "6362544843": 100000, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 10000000, }, "1a71dc14baa0b4fcfb34464adc6656d0e562571e2ac1bc990c9ce5f6": { "574f4c46": 5555555555, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643032323637": 1, "4d7574616e74546f61643033333531": 1, "4d7574616e74546f61643033343431": 1, "4d7574616e74546f61643033363436": 1, "4d7574616e74546f61643034303832": 1, "4d7574616e74546f61643034353639": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 10000000, }, "2b8822f7799f325e278991a244e7715591945b1c2a3589cc76035ca9": { "73637261746368": 25000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 200000, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 3, }, "437f3ba3b380f35b830ce588751d08affd24da14c927895cf1d4dbe3": { "50726f6a656374576967687473496368696d6930353134": 1, }, "544571c086d0e5c5022aca9717dd0f438e21190abb48f37b3ae129f0": { "47524f57": 2, }, "56673962a054070732569178ba2b3e1cb591e3413ecd7b57a9e3f18b": { "4245414e53": 10000, }, "5ad8deb64bfec21ad2d96e1270b5873d0c4d0f231b928b4c39eb2435": { "61646f736961": 25000000, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 2000, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 20000, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 5000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 5, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 1000, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 1000000000, }, b24a29b9c16d349df16d9b5553b119e399e46ae19d6150c1a843ef61: { "646964697473": 100000000, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 277912268091, }, b7c783f6304eddbdf8f0dece4715d63cb9f453be89d97c8fba155d57: { "52455349": 50, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 6, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 500, }, ff97c85de383ebf0b047667ef23c697967719def58d380caf7f04b64: { "534f554c": 333, }, }); expect(minCost).toBe(7551558); }); test("case 3", () => { const minCost = UTXOS.calculateMinMultiassetCost({ "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913": { "6c70204b": 10525656, }, "0aa7ba1629821d8d3007ecaa07140c0370140ecd11f72fa486e57e64": { "547269616450616e64617331313233": 1, "547269616450616e6461733733": 1, }, "1774343241680e4daef7cbfe3536fc857ce23fb66cd0b66320b2e3dd": { "4249534f4e": 5000000, }, "1cda8886f4cbab2217346187a923b3be670e42ef5778a0ad7d25358c": { "4d7574616e74546f61643030333339": 1, "4d7574616e74546f61643032383333": 1, "4d7574616e74546f61643033323536": 1, "4d7574616e74546f61643033343236": 1, }, "1f4b1b277c9c001c1522727506a2cfb401a0d0ade069b0241f16f07d": { "4849": 2000000, }, "2afb448ef716bfbed1dcb676102194c3009bee5399e93b90def9db6a": { "4249534f4e": 5000000, }, "2d7444cf9e317a12e3eb72bf424fd2a0c8fbafedf10e20bfdb4ad8ab": { "434845444441": 100000, }, "368fb9e39d39599d2d14ce7e787f21d6810d23c5ba7c28b692a55b82": { "416e6369656e7448756d616e32353839": 1, "416e6369656e7448756d616e32383133": 1, }, "4247d5091db82330100904963ab8d0850976c80d3f1b927e052e07bd": { "546f6b68756e": 4, }, "4c10d43f20e066327fc7b57bdfa42f33bbf1e2d70f3753964ee29be7": { "38313530": 1, "39363933": 1, }, "547ceed647f57e64dc40a29b16be4f36b0d38b5aa3cd7afb286fc094": { "6262486f736b79": 1000, }, "5c80d8420b415e6f277d830e780190f288993019108bebecf5ccf9e1": { "46726573636f7323303239": 1, "46726573636f7323363339": 1, }, "641f0571d02b45b868ac1c479fc8118c5be6744ec3d2c5e13bd888b6": { "5a4f4d424945": 4000, }, "6a12613c4600155096be236b70dd27d42aa7c553adf367f8da748e6c": { "436f756e7448756d70756c613730": 1, }, "7ddc646d0e15b44db03f0f904e0ab6b72e57aa48d2e579ce66366a3d": { "4265617273436c75624d656d6265723030363638": 1, "4265617273436c75624d656d6265723031343234": 1, "4265617273436c75624d656d6265723031353231": 1, "4265617273436c75624d656d6265723032373136": 1, "4265617273436c75624d656d6265723033313634": 1, "4265617273436c75624d656d6265723038313636": 1, "4265617273436c75624d656d6265723039323535": 1, "4265617273436c75624d656d6265723039343031": 1, "4265617273436c75624d656d6265723039343438": 1, "4265617273436c75624d656d6265723039373831": 1, }, "7f376e3d1cf52e6c4350a1a91c8f8d0f0b63baedd443999ebe8fe57a": { "424f52475a": 60000, }, "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc3": { "4c4f4253544552": 4057000000, }, "8a291e1446e947d11e1198d1994d3b9881f44cb18218817a332c5ac7": { "4372696d65426c6f6330303637": 1, }, "8d0ae3c5b13b47907b16511a540d47436d12dcc96453c0f59089b451": { "42524f4f4d": 1290869, }, "9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d77": { "53554e444145": 20000000, }, "9c54bb728df9847b0358c84c942500646326a1b581a2b8c43689d220": { "5374726970706572436f696e": 29009, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3000000, }, a4da8764a57e66a0085b5bfcde96c89b798d92ee83a75f59237e375b: { "46495245": 136000, }, a5bb0e5bb275a573d744a021f9b3bff73595468e002755b447e01559: { "484f534b594361736847726162303030303639383538": 1, }, a8608df12a746799565a277c8c42cea5d1ee0bc9134f60e0cc72e16f: { "4275747446617274546f6b656e": 1000000, }, aa63d7de85fb677012ab0f3effa8ea1475d569c3801420b475efaefa: { "55474c593030323132": 1, "55474c593030353938": 1, "55474c593031343230": 1, "55474c593031343730": 1, "55474c593031393136": 1, "55474c593031393535": 1, "55474c593032333536": 1, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 1000000000, }, afc910d7a306d20c12903979d4935ae4307241d03245743548e76783: { "4153484942": 5000000000000, }, b108e563f733da680941310a11338cc39fdc79adf4be46f07cf19712: { "61646162756c6c73636c7562323730": 1, }, b788fbee71a32d2efc5ee7d151f3917d99160f78fb1e41a1bbf80d8f: { "4c454146544f4b454e": 961560900, }, bb78d3b6638537d6df7ae43791ead3d50e75fdae82131eff2b7ae994: { "556e626f756e64656445617274684d696e75733132364d696e75733639": 1, "556e626f756e64656445617274684d696e75733839506c75733436": 1, "556e626f756e6465644561727468506c7573313233506c75733239": 1, }, d030b626219d81673bd32932d2245e0c71ae5193281f971022b23a78: { "436172646f67656f": 420, }, d28f39739e0d19974ee3c961142b0e729b8341432158ccd9e5856ac8: { "41534854524159533031453032524530323037": 1, }, d3558649b7874a1a596378515f9b80da63e73f324439ea113d34c9bb: { "42454147": 100, }, d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f: { "4d7574616e7443726f633031373337": 1, }, d894897411707efa755a76deb66d26dfd50593f2e70863e1661e98a0: { "7370616365636f696e73": 15, }, df0172804f8418afc4e5b0a15b8fc78bdc3ca6d179405a7cd194f3b4: { "464c49434b": 1000, }, e4c93fac78423e2ed9e46271224a4f792722bbbf42795457ac589546: { "416461426f72656453616d7572616930313134": 1, }, ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2: { "4d414442554c": 1002000, }, ef76f6f0b3558ea0aaad6af5c9a5f3e5bf20b393314de747662e8ce9: { "506f6c795065657236393133": 1, }, f27a17e3a693d6994abf249bcd5cbf4599ea433eb6c66300dfaa5209: { "526f79616c526f6d616e73313731": 1, }, }); expect(minCost).toBe(12861786); }); test("case 4", () => { const minCost = UTXOS.calculateMinMultiassetCost({ "023cec350597bdf2a2b6945e62e0111d9808caf7a9353a2ab91e8beb": { "534f434945545932354c4d4231363837": 1, "534f434945545932354c4d4232343030": 1, "534f434945545932354c4d4232343731": 1, "534f434945545932354c4d42323833": 1, "534f434945545932354c4d42323937": 1, "534f434945545932354c4d4233333030": 1, "534f434945545932354c4d42333534": 1, "534f434945545932354c4d4233363233": 1, "534f434945545932354c4d4233373434": 1, "534f434945545932354c4d4234303237": 1, "534f434945545932354c4d4234313232": 1, "534f434945545932354c4d4234333834": 1, "534f434945545932354c4d4234353436": 1, "534f434945545932354c4d42343637": 1, "534f434945545932354c4d4234373832": 1, "534f434945545932354c4d4235323537": 1, "534f434945545932354c4d42353434": 1, "534f434945545932354c4d4235353136": 1, "534f434945545932354c4d4236303337": 1, "534f434945545932354c4d4236323137": 1, "534f434945545932354c4d4236323437": 1, "534f434945545932354c4d4236343134": 1, "534f434945545932354c4d4236353037": 1, "534f434945545932354c4d4236383330": 1, "534f434945545932354c4d4238303237": 1, "534f434945545932354c4d4238313638": 1, "534f434945545932354c4d4238323436": 1, "534f434945545932354c4d4238323939": 1, "534f434945545932354c4d4238343839": 1, "534f434945545932354c4d4238373934": 1, "534f434945545932354c4d4238383532": 1, "534f434945545932354c4d4238383938": 1, "534f434945545932354c4d4239303030": 1, "534f434945545932354c4d4239393135": 1, }, "3c2cfd4f1ad33678039cfd0347cca8df363c710067d739624218abc0": { "576f726c647357697468696e3030303833": 1, "576f726c647357697468696e3030303932": 1, "576f726c647357697468696e3030323632": 1, "576f726c647357697468696e3030363732": 1, "576f726c647357697468696e3032393934": 1, "576f726c647357697468696e3033333236": 1, "576f726c647357697468696e3033343530": 1, }, "45a5fa9311a12e74dcf6d463820a635d36b65469f0edee2ad9fff043": { "506f6973736f6e5765656b656e64733030303630": 1, "506f6973736f6e5765656b656e64733030303632": 1, "506f6973736f6e5765656b656e64733030303833": 1, "506f6973736f6e5765656b656e64733030303930": 1, }, "4c9f7d6c24ba8e2b12f3269ac38d706025e39a50a524afe6eaf79d95": { "5665676769656d6174653034383133": 1, "5665676769656d6174653037303534": 1, "5665676769656d6174653038353335": 1, }, "4f790fb0d3181ef4026deeb913bc748d7671666a07be8065c1a3a9aa": { "5341434669677572696e653030383938": 1, "5341434669677572696e653033363230": 1, }, "5a46271a9b32a4517ced20be4ba1f184c2f91b1a5dd480ab639eee57": { "42726967687450616c32313133": 1, }, "76dbbc78587bf972c710f22a0807a6905a8a5e713418515fc9abeed1": { "6e65777965617264726f703039363732": 1, "6e65777965617264726f703039363733": 1, "6e65777965617264726f703039393634": 1, "6e65777965617264726f703039393635": 1, "73747564696f73786d61733032323830": 1, "73747564696f73786d61733032323831": 1, "786d617364726f703036383431": 1, "786d617364726f703036383432": 1, "786d617364726f703036383433": 1, "786d617364726f703036383434": 1, "786d617364726f703036383435": 1, "786d617364726f703036383436": 1, "786d617364726f703036383437": 1, "786d617364726f703036383438": 1, "786d617364726f703036383439": 1, "786d617364726f703036383530": 1, }, "7ddc646d0e15b44db03f0f904e0ab6b72e57aa48d2e579ce66366a3d": { "4265617273436c75624d656d6265723031373637": 1, "4265617273436c75624d656d6265723035383239": 1, "4265617273436c75624d656d6265723036353538": 1, "4265617273436c75624d656d6265723036393136": 1, }, "83c0ab67afc9148bd1571b7a14de1df03cd5624f5992d3b8ec84d6fb": { "4164614e696e6a617a36343637": 1, "4164614e696e6a617a36373232": 1, }, "83cb87b69639e20d7c99755fcfc310fb47882c3591778a3c869ea34c": { "417473756b6f30363137": 1, "417473756b6f34333231": 1, "417473756b6f37373737": 1, }, "8447f40c8dbd543be271b2c817281b22e77bd0444b336fc92740915a": { "5769746368436f76656e303334": 1, }, "8654e8b350e298c80d2451beb5ed80fc9eee9f38ce6b039fb8706bc3": { "4c4f4253544552": 20654500000, }, "90465e141ecb7b72ed0cdbcbd848673177cd52be5af5518e95d0de1d": { "33444547454e5333333837": 1, "33444547454e5334383831": 1, }, "9cc83ea54377108dd022f18095040e8d5808a3061c4fe54f3fd64a7a": { "48616c6c6f7765656e41706534353634": 1, "48616c6c6f7765656e41706535313731": 1, "48616c6c6f7765656e41706536333033": 1, "48616c6c6f7765656e417065363430": 1, "48616c6c6f7765656e41706537313232": 1, "4d6f73744162756e64616e7442616e616e61": 1, "5a6f6d62696542616e616e61343330436f6d6d6f6e32": 1, "5a6f6d62696542616e616e61353238436f6d6d6f6e31": 1, }, a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235: { "484f534b59": 3941692, }, a4acdb40f495b61bc98f10c4df10ca7204f2efcaddc9e0a2af9c8e04: { "436861726c7a20466f756e6465722023353634": 1, "436861726c7a20466f756e6465722023353636": 1, }, aa4f61af3a968b979b53c5f2cbd9ebc656c172cef6a49626db24482d: { "507572706c65466f756e64657231303837": 1, "507572706c65466f756e646572323932": 1, "507572706c65466f756e6465723333": 1, "507572706c65466f756e646572393339": 1, }, af2e27f580f7f08e93190a81f72462f153026d06450924726645891b: { "44524950": 3999996000, }, ba7adcbe329cb7eac17efdd6ec986ed6b6127281307ae7b15701d710: { "43617264616e6f4c6574746572733130444e4b": 1, "43617264616e6f4c6574746572733132393732575057": 1, "43617264616e6f4c6574746572733133303135415158": 1, "43617264616e6f4c657474657273313337314d4542": 1, "43617264616e6f4c65747465727331343039334c4b41": 1, "43617264616e6f4c65747465727331343632354e4450": 1, "43617264616e6f4c657474657273313438313648434a": 1, "43617264616e6f4c6574746572733135353236534d59": 1, "43617264616e6f4c657474657273313535373355434a": 1, "43617264616e6f4c657474657273313536313058474d": 1, "43617264616e6f4c6574746572733135393536494a4f": 1, "43617264616e6f4c657474657273313633373057415a": 1, "43617264616e6f4c65747465727331373435314b4951": 1, "43617264616e6f4c65747465727332333938554655": 1, "43617264616e6f4c65747465727332353333564954": 1, "43617264616e6f4c657474657273323630385a4756": 1, "43617264616e6f4c657474657273323832485a58": 1, "43617264616e6f4c65747465727334373335534953": 1, "43617264616e6f4c65747465727335363233444c57": 1, "43617264616e6f4c657474657273363330324b4253": 1, "43617264616e6f4c65747465727337333136484148": 1, "43617264616e6f4c657474657273373436314e4443": 1, "43617264616e6f4c657474657273383135484b41": 1, "43617264616e6f4c6574746572733837313656544c": 1, "43617264616e6f4c65747465727339333635504e46": 1, "43617264616e6f4c65747465727339393430484549": 1, }, bff82d31352d9bdfdb49e243ab74af715488631f330b2cf064178f90: { "426c6f636b4f776c7354656c6c79303430": 1, }, c16777d742784b7acd3940e0356596d313e141200fe8e48c8df16ba7: { "42697446696e734861776b66696e556e636f6d6d6f6e323139": 1, "42697446696e7350656e67757068696e45786f746963313435": 1, }, e9c28a71273f825b13f38244ccf1fea97c4025813610d01a7c5d681f: { "436861726c7a20546f6b656e": 1425859375, }, ec2e1c314ee754cea4ba3afc69f74b2130f87bb3928e1a1e8534c209: { "526167696e675465656e3030333134": 1, "526167696e675465656e3030343136": 1, "526167696e675465656e3030363839": 1, "526167696e675465656e3030373637": 1, "526167696e675465656e3032373432": 1, "526167696e675465656e3033313239": 1, "526167696e675465656e3033353031": 1, "526167696e675465656e3033373937": 1, "526167696e675465656e3033393134": 1, "526167696e675465656e3034303133": 1, "526167696e675465656e3034313937": 1, "526167696e675465656e3034323039": 1, "526167696e675465656e3034353530": 1, "526167696e675465656e3034373132": 1, "526167696e675465656e3034383335": 1, }, ee6da4b71e0913cbebec02edc23653f9b970af69324fdddfed1285d9: { "53706163654170653030373236": 1, "53706163654170653031393438": 1, "53706163654170653034383432": 1, "53706163654170653035333735": 1, "53706163654170653036323231": 1, "53706163654170653036393032": 1, "53706163654170653037333438": 1, "53706163654170653037353338": 1, "53706163654170653039383838": 1, }, f33617a1fb3a5c37461fb88e3d510b6aed0feb6ee8bb0e162475f4f2: { "3331313144756e6b6d616e": 1, "3331373450726573746f": 1, "33333833576861745468654d5650": 1, "333931394a616d6573536576656e7465656e": 1, "34303536426c75655761766573": 1, "343336354d616d626153757065726865726f": 1, }, }); expect(minCost).toBe(23206386); }); }); });