From 4db4e6d6e98d0b7f9d2b0cb81bfe3b3a5af0c545 Mon Sep 17 00:00:00 2001 From: Vijay-Jagannathan Date: Thu, 9 Nov 2023 15:33:41 +0530 Subject: [PATCH] feat(sdk-coin-ada): increase min amount to 1.5 ADA for token consolidation Ticket: WIN-736 --- modules/sdk-coin-ada/src/lib/transactionBuilder.ts | 4 ++-- modules/sdk-coin-ada/test/resources/index.ts | 8 ++++---- modules/sdk-coin-ada/test/unit/transactionBuilder.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/sdk-coin-ada/src/lib/transactionBuilder.ts b/modules/sdk-coin-ada/src/lib/transactionBuilder.ts index ce96767c3b..6073b1e1fc 100644 --- a/modules/sdk-coin-ada/src/lib/transactionBuilder.ts +++ b/modules/sdk-coin-ada/src/lib/transactionBuilder.ts @@ -282,7 +282,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder { // support for multi-asset consolidation if (this._multiAssets !== undefined) { const totalNumberOfAssets = CardanoWasm.BigNum.from_str(this._multiAssets.length.toString()); - const minAmountNeededForOneAssetOutput = CardanoWasm.BigNum.from_str('1000000'); + const minAmountNeededForOneAssetOutput = CardanoWasm.BigNum.from_str('1500000'); const minAmountNeededForTotalAssetOutputs = minAmountNeededForOneAssetOutput.checked_mul(totalNumberOfAssets); if (!change.less_than(minAmountNeededForTotalAssetOutputs)) { @@ -317,7 +317,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder { outputs.add(changeOutput); } else { throw new BuildTransactionError( - 'Insufficient funds: need a minimum of 1 ADA per output to construct token consolidation' + 'Insufficient funds: need a minimum of 1.5 ADA per output to construct token consolidation' ); } } else { diff --git a/modules/sdk-coin-ada/test/resources/index.ts b/modules/sdk-coin-ada/test/resources/index.ts index 3d8cf1b00c..3d2b30ebf9 100644 --- a/modules/sdk-coin-ada/test/resources/index.ts +++ b/modules/sdk-coin-ada/test/resources/index.ts @@ -120,17 +120,17 @@ export const rawTx = { unsignedTx2: '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c6ffe9021a00028d5d031a2faf08000480a10080f5f6', unsignedTx3: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a000f4240a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a011f63bf021a00028701031a2faf08000480a10080f5f6', + '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0117c29f021a00028701031a2faf08000480a10080f5f6', unsignedTx4: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101838258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a000f4240a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a000f4240a1581c1f7a58a1aa1e6b047a42109ade331ce26c9c2cce027d043ff264fb1fa146425249434b531a004c4b408258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0110217f021a00028701031a2faf08000480a10080f5f6', + '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101838258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c1f7a58a1aa1e6b047a42109ade331ce26c9c2cce027d043ff264fb1fa146425249434b531a004c4b408258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0100df3f021a00028701031a2faf08000480a10080f5f6', unsignedTx5: '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101818258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a012ea5ff021a00028701031a2faf08000480a10080f5f6', signedTx2: '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c6ffe9021a00028d5d031a2faf08000480a10081825820a5cdaab58f8c0cb82897b855b8a2315fba8061122072fcae1e0790641d9f9e675840765ee4f52bd3a2ae85a7d921ab2068698d70cf4ff291af2cf56f0858548d9e30c37b4f3e44c39ca885f18eb3c3648cbcaf30d1acb650d0a9c7d377591a214404f5f6', txHash: '0933ee2669649595c39150cdad64418303744352e1d315aa2f060f291980639a', txHash2: '1088141814e014e07d5e6c3ffb6c877a5c6ee2210694570e01bfc9a6ee6eedf5', - txHash3: '5c45b86ce5df2f4aa20aa38ffb8428b9cc09ad8b6de0b30e81dea6ef786723e7', - txHash4: '1abec9dd3798daf69245fa99bd29729de868113815641298b86735b29435e4a3', + txHash3: '90f44d429d33ab1103d8f8e8d7d38ad292a9ba454ca898ef67b52b3ffd2a5f32', + txHash4: '69b2ef1aef04d2d9d0db517a424daacc2950aa2b150992014483d7c771480cb2', txHash5: '65c0b30500a9283fd787bdcd98c2a44cbeaeb3c3768e36f555adb257c00c9299', outputAddress1: { address: diff --git a/modules/sdk-coin-ada/test/unit/transactionBuilder.ts b/modules/sdk-coin-ada/test/unit/transactionBuilder.ts index 012bef0c96..9585929475 100644 --- a/modules/sdk-coin-ada/test/unit/transactionBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/transactionBuilder.ts @@ -105,7 +105,7 @@ describe('ADA Transaction Builder', async () => { asset_name: assetName, quantity: quantity, }); - const minAmountForSingleAsset = 1000000; + const minAmountForSingleAsset = 1500000; const totalInput = 20000000; txBuilder.changeAddress(testData.rawTx.outputAddress1.address, totalInput.toString()); txBuilder.ttl(800000000); @@ -166,7 +166,7 @@ describe('ADA Transaction Builder', async () => { }); const totalInput = 20000000; - const minAmountForSingleAsset = 1000000; + const minAmountForSingleAsset = 1500000; txBuilder.changeAddress(testData.rawTx.outputAddress1.address, totalInput.toString()); txBuilder.ttl(800000000); const tx = (await txBuilder.build()) as Transaction; @@ -231,7 +231,7 @@ describe('ADA Transaction Builder', async () => { txBuilder.ttl(800000000); await txBuilder .build() - .should.rejectedWith('Insufficient funds: need a minimum of 1 ADA per output to construct token consolidation'); + .should.rejectedWith('Insufficient funds: need a minimum of 1.5 ADA per output to construct token consolidation'); }); it('build and sign a transfer tx', async () => {