Skip to content

Commit

Permalink
feat(sdk-coin-ada): increase min amount to 1.5 ADA for token consolid…
Browse files Browse the repository at this point in the history
…ation

Ticket: WIN-736
  • Loading branch information
Vijay-Jagannathan committed Nov 9, 2023
1 parent 95b88f0 commit 4db4e6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions modules/sdk-coin-ada/src/lib/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions modules/sdk-coin-ada/test/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions modules/sdk-coin-ada/test/unit/transactionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit 4db4e6d

Please sign in to comment.