Skip to content

Commit 1a8f17c

Browse files
Merge branch 'master' into WP-7080-address-verification-icp
2 parents 21f3b21 + 77e100a commit 1a8f17c

File tree

300 files changed

+9264
-3567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+9264
-3567
lines changed

modules/abstract-cosmos/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [11.15.17](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-05)
7+
8+
**Note:** Version bump only for package @bitgo/abstract-cosmos
9+
10+
11+
12+
13+
14+
## [11.15.16](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-04)
15+
16+
**Note:** Version bump only for package @bitgo/abstract-cosmos
17+
18+
19+
20+
21+
622
## [11.15.15](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-11-26)
723

824
**Note:** Version bump only for package @bitgo/abstract-cosmos

modules/abstract-cosmos/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitgo/abstract-cosmos",
3-
"version": "11.15.15",
3+
"version": "11.15.17",
44
"description": "BitGo SDK coin library for COSMOS base implementation",
55
"main": "./dist/src/index.js",
66
"types": "./dist/src/index.d.ts",
@@ -38,10 +38,10 @@
3838
]
3939
},
4040
"dependencies": {
41-
"@bitgo/sdk-core": "^36.22.0",
41+
"@bitgo/sdk-core": "^36.23.1",
4242
"@bitgo/sdk-lib-mpc": "^10.8.1",
4343
"@bitgo/secp256k1": "^1.7.0",
44-
"@bitgo/statics": "^58.15.0",
44+
"@bitgo/statics": "^58.16.1",
4545
"@cosmjs/amino": "^0.29.5",
4646
"@cosmjs/crypto": "^0.30.1",
4747
"@cosmjs/encoding": "^0.29.5",

modules/abstract-eth/CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [24.19.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-05)
7+
8+
**Note:** Version bump only for package @bitgo/abstract-eth
9+
10+
11+
12+
13+
14+
# [24.19.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-04)
15+
16+
17+
### Bug Fixes
18+
19+
* **abstract-eth:** fix TSS consolidation verification for ETH wallets ([45f4f53](https://github.com/BitGo/BitGoJS/commit/45f4f530e836de35fda1c3201a113b786628de13))
20+
21+
22+
### Features
23+
24+
* add tx explanation for TxIntentMismatch errors ([feed271](https://github.com/BitGo/BitGoJS/commit/feed271ec7ae1ae099adf3eb100a532b12d03228))
25+
26+
27+
28+
29+
630
# [24.18.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-11-26)
731

832

modules/abstract-eth/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitgo/abstract-eth",
3-
"version": "24.18.0",
3+
"version": "24.19.1",
44
"description": "BitGo SDK coin library for ETH base implementation",
55
"main": "./dist/src/index.js",
66
"types": "./dist/src/index.d.ts",
@@ -40,10 +40,10 @@
4040
]
4141
},
4242
"dependencies": {
43-
"@bitgo/sdk-core": "^36.22.0",
43+
"@bitgo/sdk-core": "^36.23.1",
4444
"@bitgo/sdk-lib-mpc": "^10.8.1",
4545
"@bitgo/secp256k1": "^1.7.0",
46-
"@bitgo/statics": "^58.15.0",
46+
"@bitgo/statics": "^58.16.1",
4747
"@ethereumjs/common": "^2.6.5",
4848
"@ethereumjs/rlp": "^4.0.0",
4949
"@ethereumjs/tx": "^3.3.0",
@@ -60,8 +60,8 @@
6060
"superagent": "^9.0.1"
6161
},
6262
"devDependencies": {
63-
"@bitgo/sdk-api": "^1.71.7",
64-
"@bitgo/sdk-test": "^9.1.15",
63+
"@bitgo/sdk-api": "^1.71.9",
64+
"@bitgo/sdk-test": "^9.1.17",
6565
"@types/keccak": "^3.0.5"
6666
},
6767
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c",

modules/abstract-eth/src/abstractEthLikeNewCoins.ts

Lines changed: 102 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,34 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
30313031
return txPrebuild.coin === nativeCoin;
30323032
}
30333033

3034+
/**
3035+
* Generate transaction explanation for error reporting
3036+
* @param txPrebuild - Transaction prebuild containing txHex and fee info
3037+
* @returns Stringified JSON explanation
3038+
*/
3039+
private async getTxExplanation(txPrebuild?: TransactionPrebuild): Promise<string | undefined> {
3040+
if (!txPrebuild?.txHex || !txPrebuild?.gasPrice) {
3041+
return undefined;
3042+
}
3043+
3044+
try {
3045+
const explanation = await this.explainTransaction({
3046+
txHex: txPrebuild.txHex,
3047+
feeInfo: {
3048+
fee: txPrebuild.gasPrice.toString(),
3049+
},
3050+
});
3051+
return JSON.stringify(explanation, null, 2);
3052+
} catch (e) {
3053+
const errorDetails = {
3054+
error: 'Failed to parse transaction explanation',
3055+
txHex: txPrebuild.txHex,
3056+
details: e instanceof Error ? e.message : String(e),
3057+
};
3058+
return JSON.stringify(errorDetails, null, 2);
3059+
}
3060+
}
3061+
30343062
/**
30353063
* Verify if a tss transaction is valid
30363064
*
@@ -3045,15 +3073,25 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
30453073
const { txParams, txPrebuild, wallet } = params;
30463074

30473075
// Helper to throw TxIntentMismatchRecipientError with recipient details
3048-
const throwRecipientMismatch = (message: string, mismatchedRecipients: Recipient[]): never => {
3049-
throw new TxIntentMismatchRecipientError(message, undefined, [txParams], txPrebuild?.txHex, mismatchedRecipients);
3076+
const throwRecipientMismatch = async (message: string, mismatchedRecipients: Recipient[]): Promise<never> => {
3077+
const txExplanation = await this.getTxExplanation(txPrebuild);
3078+
throw new TxIntentMismatchRecipientError(
3079+
message,
3080+
undefined,
3081+
[txParams],
3082+
txPrebuild?.txHex,
3083+
mismatchedRecipients,
3084+
txExplanation
3085+
);
30503086
};
30513087

30523088
if (
30533089
!txParams?.recipients &&
30543090
!(
30553091
txParams.prebuildTx?.consolidateId ||
3056-
(txParams.type && ['acceleration', 'fillNonce', 'transferToken', 'tokenApproval'].includes(txParams.type))
3092+
txPrebuild?.consolidateId ||
3093+
(txParams.type &&
3094+
['acceleration', 'fillNonce', 'transferToken', 'tokenApproval', 'consolidate'].includes(txParams.type))
30573095
)
30583096
) {
30593097
throw new Error('missing txParams');
@@ -3077,12 +3115,13 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
30773115
const txJson = tx.toJson();
30783116
if (txJson.data === '0x') {
30793117
if (expectedAmount !== txJson.value) {
3080-
throwRecipientMismatch('the transaction amount in txPrebuild does not match the value given by client', [
3081-
{ address: txJson.to, amount: txJson.value },
3082-
]);
3118+
await throwRecipientMismatch(
3119+
'the transaction amount in txPrebuild does not match the value given by client',
3120+
[{ address: txJson.to, amount: txJson.value }]
3121+
);
30833122
}
30843123
if (expectedDestination.toLowerCase() !== txJson.to.toLowerCase()) {
3085-
throwRecipientMismatch('destination address does not match with the recipient address', [
3124+
await throwRecipientMismatch('destination address does not match with the recipient address', [
30863125
{ address: txJson.to, amount: txJson.value },
30873126
]);
30883127
}
@@ -3112,20 +3151,50 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
31123151
}
31133152

31143153
if (expectedTokenAmount !== amount.toString()) {
3115-
throwRecipientMismatch('the transaction amount in txPrebuild does not match the value given by client', [
3116-
{ address: addHexPrefix(recipientAddress.toString()), amount: amount.toString() },
3117-
]);
3154+
await throwRecipientMismatch(
3155+
'the transaction amount in txPrebuild does not match the value given by client',
3156+
[{ address: addHexPrefix(recipientAddress.toString()), amount: amount.toString() }]
3157+
);
31183158
}
31193159

31203160
if (expectedRecipientAddress !== addHexPrefix(recipientAddress.toString()).toLowerCase()) {
3121-
throwRecipientMismatch('destination address does not match with the recipient address', [
3161+
await throwRecipientMismatch('destination address does not match with the recipient address', [
31223162
{ address: addHexPrefix(recipientAddress.toString()), amount: amount.toString() },
31233163
]);
31243164
}
31253165
}
31263166
}
31273167
}
31283168

3169+
// Verify consolidation transactions send to base address
3170+
if (params.verification?.consolidationToBaseAddress) {
3171+
const coinSpecific = wallet.coinSpecific();
3172+
if (!coinSpecific || !coinSpecific.baseAddress) {
3173+
throw new Error('Unable to determine base address for consolidation');
3174+
}
3175+
const baseAddress = coinSpecific.baseAddress;
3176+
3177+
if (!txPrebuild.txHex) {
3178+
throw new Error('missing txHex in txPrebuild');
3179+
}
3180+
3181+
const txBuilder = this.getTransactionBuilder();
3182+
txBuilder.from(txPrebuild.txHex);
3183+
const tx = await txBuilder.build();
3184+
const txJson = tx.toJson();
3185+
3186+
// Verify the transaction recipient matches the base address
3187+
if (!txJson.to) {
3188+
throw new Error('Consolidation transaction is missing recipient address');
3189+
}
3190+
3191+
if (txJson.to.toLowerCase() !== baseAddress.toLowerCase()) {
3192+
await throwRecipientMismatch('Consolidation transaction recipient does not match wallet base address', [
3193+
{ address: txJson.to, amount: txJson.value },
3194+
]);
3195+
}
3196+
}
3197+
31293198
return true;
31303199
}
31313200

@@ -3149,8 +3218,16 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
31493218
}
31503219

31513220
// Helper to throw TxIntentMismatchRecipientError with recipient details
3152-
const throwRecipientMismatch = (message: string, mismatchedRecipients: Recipient[]): never => {
3153-
throw new TxIntentMismatchRecipientError(message, undefined, [txParams], txPrebuild?.txHex, mismatchedRecipients);
3221+
const throwRecipientMismatch = async (message: string, mismatchedRecipients: Recipient[]): Promise<never> => {
3222+
const txExplanation = await this.getTxExplanation(txPrebuild);
3223+
throw new TxIntentMismatchRecipientError(
3224+
message,
3225+
undefined,
3226+
[txParams],
3227+
txPrebuild?.txHex,
3228+
mismatchedRecipients,
3229+
txExplanation
3230+
);
31543231
};
31553232

31563233
if (!txParams?.recipients || !txPrebuild?.recipients || !wallet) {
@@ -3180,7 +3257,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
31803257
const expectedHopAddress = optionalDeps.ethUtil.stripHexPrefix(decodedHopTx.getSenderAddress().toString());
31813258
const actualHopAddress = optionalDeps.ethUtil.stripHexPrefix(txPrebuild.recipients[0].address);
31823259
if (expectedHopAddress.toLowerCase() !== actualHopAddress.toLowerCase()) {
3183-
throwRecipientMismatch('recipient address of txPrebuild does not match hop address', [
3260+
await throwRecipientMismatch('recipient address of txPrebuild does not match hop address', [
31843261
{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() },
31853262
]);
31863263
}
@@ -3200,17 +3277,18 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
32003277
if (txParams.tokenName) {
32013278
const expectedTotalAmount = new BigNumber(0);
32023279
if (!expectedTotalAmount.isEqualTo(txPrebuild.recipients[0].amount)) {
3203-
throwRecipientMismatch('batch token transaction amount in txPrebuild should be zero for token transfers', [
3204-
{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() },
3205-
]);
3280+
await throwRecipientMismatch(
3281+
'batch token transaction amount in txPrebuild should be zero for token transfers',
3282+
[{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() }]
3283+
);
32063284
}
32073285
} else {
32083286
let expectedTotalAmount = new BigNumber(0);
32093287
for (let i = 0; i < recipients.length; i++) {
32103288
expectedTotalAmount = expectedTotalAmount.plus(recipients[i].amount);
32113289
}
32123290
if (!expectedTotalAmount.isEqualTo(txPrebuild.recipients[0].amount)) {
3213-
throwRecipientMismatch(
3291+
await throwRecipientMismatch(
32143292
'batch transaction amount in txPrebuild received from BitGo servers does not match txParams supplied by client',
32153293
[{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() }]
32163294
);
@@ -3223,7 +3301,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
32233301
!batcherContractAddress ||
32243302
batcherContractAddress.toLowerCase() !== txPrebuild.recipients[0].address.toLowerCase()
32253303
) {
3226-
throwRecipientMismatch('recipient address of txPrebuild does not match batcher address', [
3304+
await throwRecipientMismatch('recipient address of txPrebuild does not match batcher address', [
32273305
{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() },
32283306
]);
32293307
}
@@ -3234,25 +3312,27 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
32343312
}
32353313
const expectedAmount = new BigNumber(recipients[0].amount);
32363314
if (!expectedAmount.isEqualTo(txPrebuild.recipients[0].amount)) {
3237-
throwRecipientMismatch(
3315+
await throwRecipientMismatch(
32383316
'normal transaction amount in txPrebuild received from BitGo servers does not match txParams supplied by client',
32393317
[{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() }]
32403318
);
32413319
}
32423320
if (this.isETHAddress(recipients[0].address) && recipients[0].address !== txPrebuild.recipients[0].address) {
3243-
throwRecipientMismatch(
3321+
await throwRecipientMismatch(
32443322
'destination address in normal txPrebuild does not match that in txParams supplied by client',
32453323
[{ address: txPrebuild.recipients[0].address, amount: txPrebuild.recipients[0].amount.toString() }]
32463324
);
32473325
}
32483326
}
32493327
// Check coin is correct for all transaction types
32503328
if (!this.verifyCoin(txPrebuild)) {
3329+
const txExplanation = await this.getTxExplanation(txPrebuild);
32513330
throw new TxIntentMismatchError(
32523331
'coin in txPrebuild did not match that in txParams supplied by client',
32533332
undefined,
32543333
[txParams],
3255-
txPrebuild?.txHex
3334+
txPrebuild?.txHex,
3335+
txExplanation
32563336
);
32573337
}
32583338
return true;

modules/abstract-lightning/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [7.5.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-05)
7+
8+
**Note:** Version bump only for package @bitgo/abstract-lightning
9+
10+
11+
12+
13+
14+
## [7.5.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-12-04)
15+
16+
**Note:** Version bump only for package @bitgo/abstract-lightning
17+
18+
19+
20+
21+
622
## [7.5.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/[email protected]...@bitgo/[email protected]) (2025-11-26)
723

824
**Note:** Version bump only for package @bitgo/abstract-lightning

modules/abstract-lightning/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitgo/abstract-lightning",
3-
"version": "7.5.1",
3+
"version": "7.5.3",
44
"description": "BitGo SDK coin library for base Lightning Network coin implementation",
55
"main": "./dist/src/index.js",
66
"types": "./dist/src/index.d.ts",
@@ -40,9 +40,9 @@
4040
},
4141
"dependencies": {
4242
"@bitgo/public-types": "5.43.1",
43-
"@bitgo/sdk-core": "^36.22.0",
44-
"@bitgo/statics": "^58.15.0",
45-
"@bitgo/utxo-lib": "^11.16.1",
43+
"@bitgo/sdk-core": "^36.23.1",
44+
"@bitgo/statics": "^58.16.1",
45+
"@bitgo/utxo-lib": "^11.18.0",
4646
"bip174": "npm:@bitgo-forks/[email protected]",
4747
"bs58check": "^2.1.2",
4848
"fp-ts": "^2.12.2",

0 commit comments

Comments
 (0)