From 16feeac2c47752d0d9e641f8c789be4654ead92a Mon Sep 17 00:00:00 2001 From: Sreeraj S Date: Sat, 31 Aug 2024 00:02:08 +0530 Subject: [PATCH] fix(sdk-coin-ada): bumb serialization library and fix tests Ticket: WIN-3256 TICKET: WIN-3256 --- modules/sdk-coin-ada/package.json | 4 +- modules/sdk-coin-ada/src/lib/keyPair.ts | 8 +-- .../src/lib/stakingActivateBuilder.ts | 2 +- .../src/lib/stakingDeactivateBuilder.ts | 2 +- modules/sdk-coin-ada/src/lib/transaction.ts | 2 +- modules/sdk-coin-ada/src/lib/utils.ts | 21 +++---- modules/sdk-coin-ada/test/resources/index.ts | 43 ++++++------- .../test/unit/StakingActivateBuilder.ts | 2 +- .../test/unit/StakingDeactivateBuilder.ts | 4 +- modules/sdk-coin-ada/test/unit/ada.ts | 20 +++---- .../test/unit/stakingClaimRewardsBuilder.ts | 2 +- .../test/unit/stakingPledgeBuilder.ts | 9 ++- .../test/unit/stakingWithdrawBuilder.ts | 4 +- .../test/unit/transactionBuilder.ts | 12 ++-- yarn.lock | 60 ++++--------------- 15 files changed, 81 insertions(+), 114 deletions(-) diff --git a/modules/sdk-coin-ada/package.json b/modules/sdk-coin-ada/package.json index 434b3aad1b..b136860666 100644 --- a/modules/sdk-coin-ada/package.json +++ b/modules/sdk-coin-ada/package.json @@ -43,8 +43,8 @@ "@bitgo/sdk-core": "^28.2.0", "@bitgo/sdk-lib-mpc": "^10.0.0", "@bitgo/statics": "^49.2.0", - "@emurgo/cardano-serialization-lib-browser": "^11.4.0", - "@emurgo/cardano-serialization-lib-nodejs": "^11.4.0", + "@emurgo/cardano-serialization-lib-browser": "^12.0.1", + "@emurgo/cardano-serialization-lib-nodejs": "^12.0.1", "bech32": "^2.0.0", "bignumber.js": "^9.0.2", "lodash": "^4.17.21", diff --git a/modules/sdk-coin-ada/src/lib/keyPair.ts b/modules/sdk-coin-ada/src/lib/keyPair.ts index cb72719096..2eb7eee8df 100644 --- a/modules/sdk-coin-ada/src/lib/keyPair.ts +++ b/modules/sdk-coin-ada/src/lib/keyPair.ts @@ -4,7 +4,7 @@ import { PrivateKey, EnterpriseAddress, NetworkInfo, - StakeCredential, + Credential, } from '@emurgo/cardano-serialization-lib-nodejs'; import * as nacl from 'tweetnacl'; @@ -28,13 +28,13 @@ export class KeyPair extends Ed25519KeyPair { let enterpriseAddress; if (format === AddressFormat.testnet) { enterpriseAddress = EnterpriseAddress.new( - NetworkInfo.testnet().network_id(), - StakeCredential.from_keyhash(pubKey.hash()) + NetworkInfo.testnet_preprod().network_id(), + Credential.from_keyhash(pubKey.hash()) ); } else if (format === AddressFormat.mainnet) { enterpriseAddress = EnterpriseAddress.new( NetworkInfo.mainnet().network_id(), - StakeCredential.from_keyhash(pubKey.hash()) + Credential.from_keyhash(pubKey.hash()) ); } return enterpriseAddress.to_address().to_bech32(); diff --git a/modules/sdk-coin-ada/src/lib/stakingActivateBuilder.ts b/modules/sdk-coin-ada/src/lib/stakingActivateBuilder.ts index 5c5d3d9b8a..7baceb80ee 100644 --- a/modules/sdk-coin-ada/src/lib/stakingActivateBuilder.ts +++ b/modules/sdk-coin-ada/src/lib/stakingActivateBuilder.ts @@ -26,7 +26,7 @@ export class StakingActivateBuilder extends TransactionBuilder { * @param poolHash Pool ID Hash of the pool we are going to delegate to */ stakingCredential(stakingPublicKey: string, poolHash: string): this { - const stakeCredential = CardanoWasm.StakeCredential.from_keyhash( + const stakeCredential = CardanoWasm.Credential.from_keyhash( CardanoWasm.PublicKey.from_bytes(Buffer.from(stakingPublicKey, 'hex')).hash() ); const stakeKeyRegistrationCert = CardanoWasm.Certificate.new_stake_registration( diff --git a/modules/sdk-coin-ada/src/lib/stakingDeactivateBuilder.ts b/modules/sdk-coin-ada/src/lib/stakingDeactivateBuilder.ts index 308bd671db..3021dbbc66 100644 --- a/modules/sdk-coin-ada/src/lib/stakingDeactivateBuilder.ts +++ b/modules/sdk-coin-ada/src/lib/stakingDeactivateBuilder.ts @@ -21,7 +21,7 @@ export class StakingDeactivateBuilder extends TransactionBuilder { * */ stakingCredential(stakingPublicKey: string): this { - const stakeCredential = CardanoWasm.StakeCredential.from_keyhash( + const stakeCredential = CardanoWasm.Credential.from_keyhash( CardanoWasm.PublicKey.from_bytes(Buffer.from(stakingPublicKey, 'hex')).hash() ); const stakeKeyDeregistrationCert = CardanoWasm.Certificate.new_stake_deregistration( diff --git a/modules/sdk-coin-ada/src/lib/transaction.ts b/modules/sdk-coin-ada/src/lib/transaction.ts index 924c0c2992..b834b41dc7 100644 --- a/modules/sdk-coin-ada/src/lib/transaction.ts +++ b/modules/sdk-coin-ada/src/lib/transaction.ts @@ -340,7 +340,7 @@ export class Transaction extends BaseTransaction { const owners: string[] = []; for (let i = 0; i < poolRegistration!.pool_params().pool_owners().len(); i++) { const poolOwner = poolRegistration!.pool_params().pool_owners().get(i); - const ownerStakeKey = CardanoWasm.StakeCredential.from_keyhash(poolOwner); + const ownerStakeKey = CardanoWasm.Credential.from_keyhash(poolOwner); owners.push(CardanoWasm.RewardAddress.new(networkId, ownerStakeKey).to_address().to_bech32()); } return { diff --git a/modules/sdk-coin-ada/src/lib/utils.ts b/modules/sdk-coin-ada/src/lib/utils.ts index ff1ea7c79f..771377acf5 100644 --- a/modules/sdk-coin-ada/src/lib/utils.ts +++ b/modules/sdk-coin-ada/src/lib/utils.ts @@ -4,7 +4,7 @@ import { PublicKey, Ed25519Signature, NetworkInfo, - StakeCredential, + Credential, RewardAddress, Transaction as CardanoTransaction, } from '@emurgo/cardano-serialization-lib-nodejs'; @@ -30,8 +30,8 @@ export class Utils implements BaseUtils { // 3. create full base address for staking baseAddr = BaseAddress.new( NetworkInfo.mainnet().network_id(), - StakeCredential.from_keyhash(paymentPub.hash()), - StakeCredential.from_keyhash(stakePub.hash()) + Credential.from_keyhash(paymentPub.hash()), + Credential.from_keyhash(stakePub.hash()) ); return baseAddr.to_address().to_bech32(); } else if (network === AddressFormat.testnet) { @@ -41,9 +41,9 @@ export class Utils implements BaseUtils { const paymentPub = PublicKey.from_bytes(Buffer.from(paymentKeyPair.getKeys().pub, 'hex')); // 3. create full base address for staking const baseAddr = BaseAddress.new( - NetworkInfo.testnet().network_id(), - StakeCredential.from_keyhash(paymentPub.hash()), - StakeCredential.from_keyhash(stakePub.hash()) + NetworkInfo.testnet_preprod().network_id(), + Credential.from_keyhash(paymentPub.hash()), + Credential.from_keyhash(stakePub.hash()) ); return baseAddr.to_address().to_bech32(); } else { @@ -65,14 +65,11 @@ export class Utils implements BaseUtils { const stakePub = PublicKey.from_bytes(Buffer.from(stakingPubKey, 'hex')); let rewardAddress; if (coinName === 'ada') { - rewardAddress = RewardAddress.new( - NetworkInfo.mainnet().network_id(), - StakeCredential.from_keyhash(stakePub.hash()) - ); + rewardAddress = RewardAddress.new(NetworkInfo.mainnet().network_id(), Credential.from_keyhash(stakePub.hash())); } else { rewardAddress = RewardAddress.new( - NetworkInfo.testnet().network_id(), - StakeCredential.from_keyhash(stakePub.hash()) + NetworkInfo.testnet_preprod().network_id(), + Credential.from_keyhash(stakePub.hash()) ); } return rewardAddress.to_address().to_bech32(); diff --git a/modules/sdk-coin-ada/test/resources/index.ts b/modules/sdk-coin-ada/test/resources/index.ts index 24f49dfc35..10e0a81e95 100644 --- a/modules/sdk-coin-ada/test/resources/index.ts +++ b/modules/sdk-coin-ada/test/resources/index.ts @@ -118,20 +118,20 @@ export const rawTx = { unsignedTxBody: 'a40081825820a71708d13fd0f143dd492540c0ec5fd85011860c2c8823c1facd70afd4d6e15a0101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a004c4b4082581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a0ecd33be0200031a03ba7680', unsignedTx2: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c6ffe9021a00028d5d031a2faf08000480a10080f5f6', + '84a400818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c70041021a00028d05031a2faf0800a0f5f6', unsignedTx3: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581ce16c2dc8ae937e8d3790c7fd7168d7b994621ba14ca11415f39fed72a1434d494e1a001e84808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0117b03b021a00029965031a2faf08000480a10080f5f6', + '84a400818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581ce16c2dc8ae937e8d3790c7fd7168d7b994621ba14ca11415f39fed72a1434d494e1a001e84808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0117b093021a0002990d031a2faf0800a0f5f6', unsignedTx4: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101838258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c1f7a58a1aa1e6b047a42109ade331ce26c9c2cce027d043ff264fb1fa146425249434b531a004c4b408258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0100b9c7021a0002ac79031a2faf08000480a10080f5f6', + '84a400818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101838258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3fa144534e454b1a005b8d808258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f821a0016e360a1581c1f7a58a1aa1e6b047a42109ade331ce26c9c2cce027d043ff264fb1fa146425249434b531a004c4b408258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a0100ba1f021a0002ac21031a2faf0800a0f5f6', unsignedTx5: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101818258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a012ea5ff021a00028701031a2faf08000480a10080f5f6', + '84a400818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101818258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a012ea657021a000286a9031a2faf0800a0f5f6', signedTx2: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c6ffe9021a00028d5d031a2faf08000480a10081825820a5cdaab58f8c0cb82897b855b8a2315fba8061122072fcae1e0790641d9f9e675840765ee4f52bd3a2ae85a7d921ab2068698d70cf4ff291af2cf56f0858548d9e30c37b4f3e44c39ca885f18eb3c3648cbcaf30d1acb650d0a9c7d377591a214404f5f6', + '84a400818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba210101828258390027360563c4479c6aa054cb2bd3ca9e394731ab59f8c45511ec8ba851aee1672f3f7fedc48feca58979967030dc8edc340c551b49d067638f1a00775f1182581d60ce3edb7ad0f096553830096453e97919efc0962ed9d09a3a2c82c5e11a00c70041021a00028d05031a2faf0800a10081825820a5cdaab58f8c0cb82897b855b8a2315fba8061122072fcae1e0790641d9f9e675840f93024e952ab089c1a21f7f17af651cb61010c806ca94085ea1af735ef006a9621c09849aa6d3997aed17ab32e09c4b556ab09908bde4b02a711ccaf418d8804f5f6', txHash: '0933ee2669649595c39150cdad64418303744352e1d315aa2f060f291980639a', - txHash2: '1088141814e014e07d5e6c3ffb6c877a5c6ee2210694570e01bfc9a6ee6eedf5', - txHash3: '4ce75c37d264d959ed85f9e0cdf6a466225c61f129d70841e114754b299d56fc', - txHash4: '2df3c81bbfb2e606a6e6dffbc2122baaae53dd368c77add4d34f2a4864aadf28', - txHash5: '65c0b30500a9283fd787bdcd98c2a44cbeaeb3c3768e36f555adb257c00c9299', + txHash2: 'f48f6ea0f75f3f942855cc0edf29e81e1e0724e75f5db8a1575b166fb202176c', + txHash3: '9bd530c481278231bcfcc9222922be7100aefe3c983e7c850aaa51a4921e1c0c', + txHash4: '2283f0d3769140712f6d7410b3942d34292dde8230426898aa1809b6a5919bb8', + txHash5: 'e55ca00c9a6644d34b835a343629c345010b44dec29a8a4465f79b0de69669e3', outputAddress1: { address: 'addr_test1qqnnvptrc3rec64q2n9jh572ncu5wvdtt8uvg4g3aj96s5dwu9nj70mlahzglm9939uevupsmj8dcdqv25d5n5r8vw8sn7prey', @@ -142,27 +142,27 @@ export const rawTx = { value: '248329150', }, unsignedStakingActiveTx: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a001bdb4b021a0002a935031a2faf0800048282008200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb83028200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb581c7a623c48348501c2380e60ac2307fcd1b67df4218f819930821a15b3a10080f5f6', + '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a001beca7021a000297d9031a2faf0800048282008200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb83028200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb581c7a623c48348501c2380e60ac2307fcd1b67df4218f819930821a15b3a0f5f6', unsignedStakingActiveTxBody: - 'a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a001bdb4b021a0002a935031a2faf0800048282008200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb83028200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb581c7a623c48348501c2380e60ac2307fcd1b67df4218f819930821a15b3', - unsignedStakingActiveTxHash: 'fdcf2d64cbe3e60bc98de5d99d36b1c643dc3fa705ebfbf752bcb47f486d539a', + 'a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a001beca7021a000297d9031a2faf0800048282008200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb83028200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb581c7a623c48348501c2380e60ac2307fcd1b67df4218f819930821a15b3', + unsignedStakingActiveTxHash: '4e2777152ebc92c73daebc0075cee8a52ca9fb8c00511ac2c035b58c52f27125', unsignedStakingDeactiveTx: - '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a0058ef4b021a00029e35031a2faf0800048182018200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdba10080f5f6', + '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a005900a7021a00028cd9031a2faf0800048182018200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdba0f5f6', unsignedStakingDeactiveTxBody: - 'a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a0058ef4b021a00029e35031a2faf0800048182018200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb', - unsignedStakingDeactiveTxHash: 'd113e9d1fbf3ddda4157d74abc753ff232e684f7a5f9de810235596dd7372679', + 'a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a005900a7021a00028cd9031a2faf0800048182018200581c188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb', + unsignedStakingDeactiveTxHash: '69b22d013b9f0218568433e3e656ae758f974f7f3fff31936bc55be485e7ef68', unsignedStakingWithdrawTx: - '84a600818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a004d52e2021a00029ee5031a2faf0800048005a1581de0188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb1a0012e8c7a10080f5f6', + '84a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a004d6496021a00028d31031a2faf080005a1581de0188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb1a0012e8c7a0f5f6', unsignedStakingWithdrawTxBody: - 'a600818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a004d52e2021a00029ee5031a2faf0800048005a1581de0188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb1a0012e8c7', - unsignedStakingWithdrawTxHash: 'd4aa6878f9b810bd566aba4447eaf079ca86478175ef6d92f8d0e0fa5701d50e', + 'a500818258203677e75c7ba699bfdc6cd57d42f246f86f63aefd76025006ac78313fad2bba2101018182583901c7b28bcea90d440b5455a6a02a27ca59b8696f067fc1967f47f933e79558e969caa9e57adcfc40b9907eb794363b590faf42fff48c38eb881a004d6496021a00028d31031a2faf080005a1581de0188fde65b1f9bd69b0edcc4e5a65fa93a13773090e1e2eef7a25cfdb1a0012e8c7', + unsignedStakingWithdrawTxHash: 'b38a52c79714916eb55c2a1cf62de47b93d3762527bf5adac6d0dc25c10106d0', unsignedNewPledgeTx: - '84a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004828a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f4483028200581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a0a10080f5f6', + '84a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004828a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f4483028200581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a0a0f5f6', unsignedNewPledgeTxBody: 'a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004828a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f4483028200581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a0', unsignedNewPledgeTxHash: '2acd6d314772eaa046d0cca7ef0306599d9d8dd961ad38da69e5f5b4cefafd7d', unsignedUpdatePledgeTx: - '84a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004818a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f44a10080f5f6', + '84a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004818a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f44a0f5f6', unsignedUpdatePledgeTxBody: 'a5008282582078e05b7941011b5275552d0e5074056273125e18aac81643bfc3de59abac0e8600825820ce6d283af95b4da0e4b86f20ddf25dfb0343a7402e35877307c1465bd7beeafa000181825839006d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec6d57dea46753025b2c4e0fd9244df6a08fdd059dd1432af5eb7abbec1a59682f00021a000f42400319ea6004818a03581c10324dc34187735de46f6260d94620cdcc819f7ed1f93e3fc58d06a058201cc18daee56cb67a5dfb860194cd1e878be38401f3990efd92e16c5f8f4d959c1a05f5e1001a1dcd6500d81e820314581de0a9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a16181581ca9fd4c265da033970e0b22b06422e12b3479e8dbd35abc82d405a161818301191770782572656c6179732d6e65772e63617264616e6f2d746573746e65742e696f686b6465762e696f827368747470733a2f2f72622e67792f697a747a71582010c343fe0f6c01291df08de0ddc8fcbc07bccb503c51ffc051785e783b8d2f44', unsignedUpdatePledgeTxHash: '671dfd283740d707e03a8ee5d21b3b9e3e50f57db68dc930606740ac7043151c', @@ -171,6 +171,9 @@ export const rawTx = { pledgeNodeKeyPubkey: '1b400d60aaf34eaf6dcbab9bba46001a23497886cf11066f7846933d30e5ad3f', pledgeNodeWitnessSignature: '6c92508135cb060187a2706ade8154782867b1526e9615d06742be5c56f037ab85894c098c2ab07971133c0477baee92adf3527ad7cc816f13e1e4c361041206', + pledgeWalletKeyPubkey: 'a5cdaab58f8c0cb82897b855b8a2315fba8061122072fcae1e0790641d9f9e67', + pledgeWalletWitnessSignature: + '765ee4f52bd3a2ae85a7d921ab2068698d70cf4ff291af2cf56f0858548d9e30c37b4f3e44c39ca885f18eb3c3648cbcaf30d1acb650d0a9c7d377591a214404', }; export const wrwUser = { diff --git a/modules/sdk-coin-ada/test/unit/StakingActivateBuilder.ts b/modules/sdk-coin-ada/test/unit/StakingActivateBuilder.ts index 6570a02022..942b7bf342 100644 --- a/modules/sdk-coin-ada/test/unit/StakingActivateBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/StakingActivateBuilder.ts @@ -33,7 +33,7 @@ describe('ADA Staking Activate Transaction Builder', async () => { txData.outputs.length.should.equal(1); txData.outputs[0].amount.should.equal((Number(totalInput) - 2000000 - Number(fee)).toString()); - fee.should.equal('174389'); + fee.should.equal('169945'); tx.toBroadcastFormat().should.equal(testData.rawTx.unsignedStakingActiveTx); should.equal(tx.id, testData.rawTx.unsignedStakingActiveTxHash); }); diff --git a/modules/sdk-coin-ada/test/unit/StakingDeactivateBuilder.ts b/modules/sdk-coin-ada/test/unit/StakingDeactivateBuilder.ts index 2d41501247..5909022512 100644 --- a/modules/sdk-coin-ada/test/unit/StakingDeactivateBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/StakingDeactivateBuilder.ts @@ -31,7 +31,7 @@ describe('ADA Staking Deactivate Transaction Builder', async () => { txData.outputs.length.should.equal(1); txData.outputs[0].amount.should.equal((Number(totalInput) + 2000000 - Number(fee)).toString()); - fee.should.equal('171573'); + fee.should.equal('167129'); tx.toBroadcastFormat().should.equal(testData.rawTx.unsignedStakingDeactiveTx); should.equal(tx.id, testData.rawTx.unsignedStakingDeactiveTxHash); }); @@ -49,7 +49,7 @@ describe('ADA Staking Deactivate Transaction Builder', async () => { txData.outputs.length.should.equal(1); const totalInput = '4000000'; txData.outputs[0].amount.should.equal((Number(totalInput) + 2000000 - Number(fee)).toString()); - fee.should.equal('171573'); + fee.should.equal('167129'); }); // xit('should submit a staking deactivate transaction', async () => { diff --git a/modules/sdk-coin-ada/test/unit/ada.ts b/modules/sdk-coin-ada/test/unit/ada.ts index df8b0d5618..930624467d 100644 --- a/modules/sdk-coin-ada/test/unit/ada.ts +++ b/modules/sdk-coin-ada/test/unit/ada.ts @@ -53,7 +53,7 @@ describe('ADA', function () { const transactionExplanation = { displayOrder: ['id', 'outputAmount', 'changeAmount', 'outputs', 'changeOutputs', 'fee', 'type'], - id: '1088141814e014e07d5e6c3ffb6c877a5c6ee2210694570e01bfc9a6ee6eedf5', + id: 'f48f6ea0f75f3f942855cc0edf29e81e1e0724e75f5db8a1575b166fb202176c', outputs: [ { address: @@ -62,13 +62,13 @@ describe('ADA', function () { }, { address: 'addr_test1vr8rakm66rcfv4fcxqykg5lf0yv7lsyk9mvapx369jpvtcgfcuk7f', - amount: '13041641', + amount: '13041729', }, ], - outputAmount: '20864762', + outputAmount: '20864850', changeOutputs: [], changeAmount: '0', - fee: { fee: '167261' }, + fee: { fee: '167173' }, type: 'Transfer', certificates: [], withdrawals: [], @@ -358,7 +358,7 @@ describe('ADA', function () { const params = ovcResponse; const recoveryTxn = await basecoin.createBroadcastableSweepTransaction(params); recoveryTxn.transactions[0].serializedTx.should.equal( - '84a500818258204bd0f991c1532cffe31d4a10db492b43175ec326765b6b29ceee598df2b61f470001818258390087379ebc5533ebe621963c915c3cbc5f08537fcdca4af8f8ae08ed4c87379ebc5533ebe621963c915c3cbc5f08537fcdca4af8f8ae08ed4c1a05f359ff021a00028701031a024972e10480a10081825820bbacb13431b99208e6e8cdbf710147feaf06a39d71565e60b411ce9e4fa3f137584001a4ab8236563f69ff309e5786e8f39c629ed57676c692159cb2e0494c9e663355384c13c749d04c17a80ba2a45cc127df480fc64a43199a772f11acd5b14a0ff5f6' + '84a400818258204bd0f991c1532cffe31d4a10db492b43175ec326765b6b29ceee598df2b61f470001818258390087379ebc5533ebe621963c915c3cbc5f08537fcdca4af8f8ae08ed4c87379ebc5533ebe621963c915c3cbc5f08537fcdca4af8f8ae08ed4c1a05f359ff021a00028701031a024972e1a10081825820bbacb13431b99208e6e8cdbf710147feaf06a39d71565e60b411ce9e4fa3f137584001a4ab8236563f69ff309e5786e8f39c629ed57676c692159cb2e0494c9e663355384c13c749d04c17a80ba2a45cc127df480fc64a43199a772f11acd5b14a0ff5f6' ); recoveryTxn.transactions[0].scanIndex.should.equal(0); recoveryTxn.lastScanIndex.should.equal(0); @@ -368,19 +368,19 @@ describe('ADA', function () { const params = ovcResponse2; const recoveryTxn = await basecoin.createBroadcastableSweepTransaction(params); recoveryTxn.transactions[0].serializedTx.should.equal( - '84a500818258203e62e5ee8b12012c4b949f9777b72165239bb2146ae8b078b4d1c5ca8d3168e300018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7ea0480a10081825820500e0d725a5ba3a306da3503dfe57b8a14068a09b61b36ec068fcf8cf5c391de5840c836ce6d3262d5654706ea06721522d3b75f6d545245047a7be7463629d88b3f4264b995f591df52bdffcf09da1e6ab9e88de3714c6e2ec1961786cf1c586a07f5f6' + '84a400818258203e62e5ee8b12012c4b949f9777b72165239bb2146ae8b078b4d1c5ca8d3168e300018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7eaa10081825820500e0d725a5ba3a306da3503dfe57b8a14068a09b61b36ec068fcf8cf5c391de5840c836ce6d3262d5654706ea06721522d3b75f6d545245047a7be7463629d88b3f4264b995f591df52bdffcf09da1e6ab9e88de3714c6e2ec1961786cf1c586a07f5f6' ); recoveryTxn.transactions[0].scanIndex.should.equal(1); recoveryTxn.transactions[1].serializedTx.should.equal( - '84a5008182582029c10acf0e08f9523325c88243565af6b32274992189c1153903c410bed7c2c700018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7ea0480a1008182582062770b224bd314bc526fbd6a94e9082fb6458c425e6e09bad74004dd897e962358403842544f2ff28be054eb7c7997bc303b1e251eb13a41802c82318e592bb24eaa3197c450e797cc8559f0356cd5cdd1ab5eb80c5173e34e9e1d1737533a89520cf5f6' + '84a4008182582029c10acf0e08f9523325c88243565af6b32274992189c1153903c410bed7c2c700018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7eaa1008182582062770b224bd314bc526fbd6a94e9082fb6458c425e6e09bad74004dd897e962358403842544f2ff28be054eb7c7997bc303b1e251eb13a41802c82318e592bb24eaa3197c450e797cc8559f0356cd5cdd1ab5eb80c5173e34e9e1d1737533a89520cf5f6' ); recoveryTxn.transactions[1].scanIndex.should.equal(2); recoveryTxn.transactions[2].serializedTx.should.equal( - '84a50081825820dd140f133d865e1bb5642e708fe685bf7601d71d0c99511e5d552da7f8bd10ff00018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7ea0480a1008182582053b4bb74aa38add458dafc8153f0aa8266acad59322b877ca9c23c5d3873779d5840e94ce7896957d094c6bafbf2ec10df5ebb0f1d2a27a7e31f2d45c531fb687edd6c4d33f8e9b99c7692b6fac6d8399bd8fd47641baae9bbb69f518d42ad11710af5f6' + '84a40081825820dd140f133d865e1bb5642e708fe685bf7601d71d0c99511e5d552da7f8bd10ff00018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7eaa1008182582053b4bb74aa38add458dafc8153f0aa8266acad59322b877ca9c23c5d3873779d5840e94ce7896957d094c6bafbf2ec10df5ebb0f1d2a27a7e31f2d45c531fb687edd6c4d33f8e9b99c7692b6fac6d8399bd8fd47641baae9bbb69f518d42ad11710af5f6' ); recoveryTxn.transactions[2].scanIndex.should.equal(3); recoveryTxn.transactions[3].serializedTx.should.equal( - '84a5008182582015a1d6db5d3f592aa1cda185b6359ca0e2921c3c51959f64222a6b7d95d3392300018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7ea0480a10081825820600f86ca22d670f0a990ade4e882c05e654343263494735a31517de0819676735840fe199f8e247a4cfabfeb4f9cb574aa35739a0aa98860ee0a85d720c4ab4fecfac7b4504df310b3e4bea04711f60652d4a8cf5eb41817293b8d29977fe695f704f5f6' + '84a4008182582015a1d6db5d3f592aa1cda185b6359ca0e2921c3c51959f64222a6b7d95d3392300018182583900baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd08004baf55ebcf9ada1b8ecb1640880fba54d2817690f12b3a106afd080041a00960f7f021a00028701031a0250f7eaa10081825820600f86ca22d670f0a990ade4e882c05e654343263494735a31517de0819676735840fe199f8e247a4cfabfeb4f9cb574aa35739a0aa98860ee0a85d720c4ab4fecfac7b4504df310b3e4bea04711f60652d4a8cf5eb41817293b8d29977fe695f704f5f6' ); recoveryTxn.transactions[3].scanIndex.should.equal(4); recoveryTxn.lastScanIndex.should.equal(20); @@ -635,7 +635,7 @@ describe('ADA', function () { recoveryDestination: destAddr, }) .should.rejectedWith( - 'Insufficient funds to recover, minimum required is 1 ADA plus fees, got 9834367 fees: 165633' + 'Insufficient funds to recover, minimum required is 1 ADA plus fees, got 9834455 fees: 165545' ); sandBox.assert.calledTwice(basecoin.getDataFromNode); }); diff --git a/modules/sdk-coin-ada/test/unit/stakingClaimRewardsBuilder.ts b/modules/sdk-coin-ada/test/unit/stakingClaimRewardsBuilder.ts index 09c0002a67..56d2af521c 100644 --- a/modules/sdk-coin-ada/test/unit/stakingClaimRewardsBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/stakingClaimRewardsBuilder.ts @@ -31,6 +31,6 @@ describe('ADA Staking Withdraw Transaction Builder', async () => { txData.withdrawals[0].value.should.equal(reward.toString()); txData.outputs.length.should.equal(1); txData.outputs[0].amount.should.equal((Number(totalInput) + reward - Number(fee)).toString()); - fee.should.equal('171749'); + fee.should.equal('167217'); }); }); diff --git a/modules/sdk-coin-ada/test/unit/stakingPledgeBuilder.ts b/modules/sdk-coin-ada/test/unit/stakingPledgeBuilder.ts index 4984738887..8215b14069 100644 --- a/modules/sdk-coin-ada/test/unit/stakingPledgeBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/stakingPledgeBuilder.ts @@ -126,15 +126,18 @@ describe('ADA Staking Pledge Transaction Builder', async () => { txData.witnesses[0].publicKey.should.equal(rawTx.pledgeNodeKeyPubkey); txData.witnesses[0].signature.should.equal(rawTx.pledgeNodeWitnessSignature); - txnBuilder.addSignature({ pub: rawTx.pledgeNodeKeyPubkey }, Buffer.from(rawTx.pledgeNodeWitnessSignature, 'hex')); + txnBuilder.addSignature( + { pub: rawTx.pledgeWalletKeyPubkey }, + Buffer.from(rawTx.pledgeWalletWitnessSignature, 'hex') + ); tx = (await txnBuilder.build()) as Transaction; tx.type.should.equal(TransactionType.StakingPledge); txData = tx.toJson(); txData.witnesses.length.should.equal(2); txData.witnesses[0].publicKey.should.equal(rawTx.pledgeNodeKeyPubkey); txData.witnesses[0].signature.should.equal(rawTx.pledgeNodeWitnessSignature); - txData.witnesses[1].publicKey.should.equal(rawTx.pledgeNodeKeyPubkey); - txData.witnesses[1].signature.should.equal(rawTx.pledgeNodeWitnessSignature); + txData.witnesses[1].publicKey.should.equal(rawTx.pledgeWalletKeyPubkey); + txData.witnesses[1].signature.should.equal(rawTx.pledgeWalletWitnessSignature); }); it('should init from partially signed txn object and preserve the signature', async () => { diff --git a/modules/sdk-coin-ada/test/unit/stakingWithdrawBuilder.ts b/modules/sdk-coin-ada/test/unit/stakingWithdrawBuilder.ts index 9dd56bafec..a7a54b8942 100644 --- a/modules/sdk-coin-ada/test/unit/stakingWithdrawBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/stakingWithdrawBuilder.ts @@ -33,7 +33,7 @@ describe('ADA Staking Withdraw Transaction Builder', async () => { txData.outputs.length.should.equal(1); txData.outputs[0].amount.should.equal((Number(totalInput) + reward - Number(fee)).toString()); - fee.should.equal('171749'); + fee.should.equal('167217'); tx.toBroadcastFormat().should.equal(testData.rawTx.unsignedStakingWithdrawTx); should.equal(tx.id, testData.rawTx.unsignedStakingWithdrawTxHash); }); @@ -51,7 +51,7 @@ describe('ADA Staking Withdraw Transaction Builder', async () => { const totalInput = '4000000'; const reward = 1239239; txData.outputs[0].amount.should.equal((Number(totalInput) + reward - Number(fee)).toString()); - fee.should.equal('171749'); + fee.should.equal('167217'); txData.withdrawals.length.should.equal(1); txData.withdrawals[0].value.should.equal(reward.toString()); }); diff --git a/modules/sdk-coin-ada/test/unit/transactionBuilder.ts b/modules/sdk-coin-ada/test/unit/transactionBuilder.ts index 07b0c0d476..ca4ab53298 100644 --- a/modules/sdk-coin-ada/test/unit/transactionBuilder.ts +++ b/modules/sdk-coin-ada/test/unit/transactionBuilder.ts @@ -33,7 +33,7 @@ describe('ADA Transaction Builder', async () => { txData.outputs[1].address.should.equal(testData.rawTx.outputAddress2.address); const fee = tx.getFee; txData.outputs[1].amount.should.equal((totalInput - outputAmount - Number(fee)).toString()); - fee.should.equal('167261'); + fee.should.equal('167173'); txData.id.should.equal(testData.rawTx.txHash2); const txBroadcast = tx.toBroadcastFormat(); should.equal(txBroadcast, testData.rawTx.unsignedTx2); @@ -60,7 +60,7 @@ describe('ADA Transaction Builder', async () => { txData.outputs[0].address.should.equal(testData.rawTx.outputAddress1.address); const fee = tx.getFee; txData.outputs[0].amount.should.equal((totalInput - outputAmount - Number(fee)).toString()); - fee.should.equal('165633'); + fee.should.equal('165545'); txData.id.should.equal(testData.rawTx.txHash5); const txBroadcast = tx.toBroadcastFormat(); should.equal(txBroadcast, testData.rawTx.unsignedTx5); @@ -133,7 +133,7 @@ describe('ADA Transaction Builder', async () => { txData.outputs[1].amount.should.equal( (totalInput - minAmountForSingleAsset - outputAmount - Number(fee)).toString() ); - fee.should.equal('170341'); + fee.should.equal('170253'); txData.id.should.equal(testData.rawTx.txHash3); const txBroadcast = tx.toBroadcastFormat(); should.equal(txBroadcast, testData.rawTx.unsignedTx3); @@ -202,7 +202,7 @@ describe('ADA Transaction Builder', async () => { txData.outputs[2].amount.should.equal( (totalInput - minAmountForSingleAsset * 2 - outputAmount - Number(fee)).toString() ); - fee.should.equal('175225'); + fee.should.equal('175137'); txData.id.should.equal(testData.rawTx.txHash4); const txBroadcast = tx.toBroadcastFormat(); should.equal(txBroadcast, testData.rawTx.unsignedTx4); @@ -260,7 +260,7 @@ describe('ADA Transaction Builder', async () => { txData.outputs[1].address.should.equal(testData.rawTx.outputAddress2.address); const fee = tx.getFee; txData.outputs[1].amount.should.equal((totalInput - outputAmount - Number(fee)).toString()); - fee.should.equal('167261'); + fee.should.equal('167173'); txData.id.should.equal(testData.rawTx.txHash2); const txBroadcast = tx.toBroadcastFormat(); should.equal(txBroadcast, testData.rawTx.signedTx2); @@ -281,7 +281,7 @@ describe('ADA Transaction Builder', async () => { txBuilder.ttl(800000000); txBuilder.sign({ key: testData.privateKeys.prvKey4 }); const builtTx = (await txBuilder.build()) as Transaction; - builtTx.getFee.should.equal('168493'); + builtTx.getFee.should.equal('168405'); }); it('should not calculate fee and use one passed in', async () => { diff --git a/yarn.lock b/yarn.lock index cbf893fe4e..a3dbaddcf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1645,15 +1645,15 @@ resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== -"@emurgo/cardano-serialization-lib-browser@^11.4.0": - version "11.5.0" - resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-browser/-/cardano-serialization-lib-browser-11.5.0.tgz#f2d15b538add436e0aa8b67a1d00ca654a680006" - integrity sha512-qchOJ9NYDUz10tzs5r5QhP9hK0p+ZOlRiBwPdTAxqAYLw/8emYBkQQLaS8T1DF6EkeudyrgS00ym5Trw1fo4iA== +"@emurgo/cardano-serialization-lib-browser@^12.0.1": + version "12.0.1" + resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-browser/-/cardano-serialization-lib-browser-12.0.1.tgz#4d929082829e9e5db73bf953773dca16fccf339b" + integrity sha512-3Hoi7pzGyTAjtd7CXmUiUG9i+TOv8QMlSU/KgTwPeZkUFfdNT9syt572FCaM4fBeagiR3LRhQeNE5TMUo07VBA== -"@emurgo/cardano-serialization-lib-nodejs@^11.4.0": - version "11.5.0" - resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-nodejs/-/cardano-serialization-lib-nodejs-11.5.0.tgz#0662e2a17d7d1e944f8cdb86396133c8edaec059" - integrity sha512-IlVABlRgo9XaTR1NunwZpWcxnfEv04ba2l1vkUz4S1W7Jt36F4CtffP+jPeqBZGnAe+fnUwo0XjIJC3ZTNToNQ== +"@emurgo/cardano-serialization-lib-nodejs@^12.0.1": + version "12.0.1" + resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-nodejs/-/cardano-serialization-lib-nodejs-12.0.1.tgz#db2344510a8cc0961d0543e16fc7de3d4a9c015a" + integrity sha512-QWvMgBHgoSAGbfAtKIeNV1wpRBzivbboeUjF8cBOGl/TS9OSYmLEVhNacbPoFqT1iqMhVRlAYoyXXTW/RmNC0w== "@es-joy/jsdoccomment@^0.4.4": version "0.4.4" @@ -11897,18 +11897,7 @@ html-minifier-terser@^6.0.2: tapable "^1.1.3" util.promisify "1.0.0" -"html-webpack-plugin-5@npm:html-webpack-plugin@^5": - version "5.6.0" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz#50a8fa6709245608cb00e811eacecb8e0d7b7ea0" - integrity sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw== - dependencies: - "@types/html-minifier-terser" "^6.0.0" - html-minifier-terser "^6.0.2" - lodash "^4.17.21" - pretty-error "^4.0.0" - tapable "^2.0.0" - -html-webpack-plugin@^5.5.0: +"html-webpack-plugin-5@npm:html-webpack-plugin@^5", html-webpack-plugin@^5.5.0: version "5.6.0" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz#50a8fa6709245608cb00e811eacecb8e0d7b7ea0" integrity sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw== @@ -18398,16 +18387,7 @@ string-argv@^0.3.1: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18479,7 +18459,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -18493,13 +18473,6 @@ strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -20328,7 +20301,7 @@ workerpool@6.2.0: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b" integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20346,15 +20319,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"