Skip to content

Commit a4d66ae

Browse files
chore(root): merge conflicts
TICKET: WP-0000
2 parents f51fabc + 8b12dee commit a4d66ae

File tree

146 files changed

+5591
-2194
lines changed

Some content is hidden

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

146 files changed

+5591
-2194
lines changed

examples/ts/btc/lightning/list-invoices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function main(): Promise<void> {
5858
status,
5959
limit: limit ? BigInt(limit) : undefined,
6060
};
61-
const invoices = await lightning.listInvoices(query);
61+
const { invoices } = await lightning.listInvoices(query);
6262

6363
// Display invoice summary
6464
console.log(`\nFound ${invoices.length} invoices:`);

examples/ts/btc/lightning/list-payments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function main(): Promise<void> {
5454
}
5555

5656
// List payments with the provided filters
57-
const payments = await lightning.listPayments(queryParams);
57+
const { payments } = await lightning.listPayments(queryParams);
5858

5959
// Display payment summary
6060
console.log(`\nFound ${payments.length} payments:`);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* List address of an NFT on a wallet.
3+
*
4+
* Copyright 2025, BitGo, Inc. All Rights Reserved.
5+
*/
6+
import { BitGoAPI } from '@bitgo/sdk-api';
7+
import { Tapt } from '@bitgo/sdk-coin-apt';
8+
require('dotenv').config({ path: '../../../.env' });
9+
10+
const bitgo = new BitGoAPI({
11+
accessToken: process.env.TESTNET_ACCESS_TOKEN,
12+
env: 'test',
13+
});
14+
15+
const coin = 'tapt';
16+
bitgo.register(coin, Tapt.createInstance);
17+
18+
const walletId = '';
19+
20+
async function main() {
21+
const wallet = await bitgo.coin(coin).wallets().get({ id: walletId });
22+
const addresses = await wallet.addressesByBalance({
23+
nftCollectionId: '',
24+
nftId: '',
25+
});
26+
console.log(JSON.stringify(addresses.addresses));
27+
}
28+
29+
main().catch((e) => console.error(e));

examples/ts/nft/nft-consolidation-send.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ async function main() {
3232

3333
const sendConsolidations = await wallet.sendAccountConsolidations({
3434
walletPassphrase,
35-
consolidateAddresses: [''],
3635
nftCollectionId: '',
3736
nftId: '',
3837
});

modules/abstract-cosmos/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
},
4040
"dependencies": {
4141
"@bitgo/sdk-core": "^35.0.1",
42+
"@bitgo/sdk-lib-mpc": "^10.3.0",
4243
"@bitgo/secp256k1": "^1.3.3",
4344
"@bitgo/statics": "^54.0.1",
4445
"@cosmjs/amino": "^0.29.5",

modules/abstract-cosmos/src/cosmosCoin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
AuditDecryptedKeyParams,
23
BaseCoin,
34
BaseTransaction,
45
BitGoBase,
@@ -43,6 +44,7 @@ import {
4344
} from './lib';
4445
import { ROOT_PATH } from './lib/constants';
4546
import utils from './lib/utils';
47+
import { auditEcdsaPrivateKey } from '@bitgo/sdk-lib-mpc';
4648

4749
/**
4850
* Cosmos accounts support memo Id based addresses
@@ -665,4 +667,13 @@ export class CosmosCoin<CustomMessage = never> extends BaseCoin {
665667
getKeyPair(publicKey: string): CosmosKeyPair {
666668
throw new Error('Method not implemented');
667669
}
670+
671+
/** @inheritDoc **/
672+
auditDecryptedKey({ multiSigType, publicKey, prv }: AuditDecryptedKeyParams) {
673+
if (multiSigType !== 'tss') {
674+
throw new Error('Unsupported multiSigType');
675+
} else {
676+
auditEcdsaPrivateKey(prv as string, publicKey as string);
677+
}
678+
}
668679
}

modules/abstract-eth/src/abstractEthLikeCoin.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
* @prettier
33
*/
44
import type * as EthLikeCommon from '@ethereumjs/common';
5-
import { CoinFamily, BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
5+
import { CoinFamily, BaseCoin as StaticsBaseCoin, EthereumNetwork } from '@bitgo/statics';
66
import { bip32 } from '@bitgo/secp256k1';
77
import { randomBytes } from 'crypto';
88
import {
9+
AuditDecryptedKeyParams,
910
BaseCoin,
11+
bitcoin,
1012
BitGoBase,
1113
FullySignedTransaction,
1214
HalfSignedAccountTransaction,
15+
isValidPrv,
16+
isValidXprv,
1317
KeyPair,
1418
MethodNotImplementedError,
1519
ParsedTransaction,
@@ -25,6 +29,7 @@ import BigNumber from 'bignumber.js';
2529

2630
import { isValidEthAddress, KeyPair as EthKeyPair, TransactionBuilder } from './lib';
2731
import { VerifyEthAddressOptions } from './abstractEthLikeNewCoins';
32+
import { auditEcdsaPrivateKey } from '@bitgo/sdk-lib-mpc';
2833

2934
export interface EthSignTransactionOptions extends SignTransactionOptions {
3035
txPrebuild: TransactionPrebuild;
@@ -107,6 +112,10 @@ export abstract class AbstractEthLikeCoin extends BaseCoin {
107112
return Math.pow(10, this._staticsCoin.decimalPlaces);
108113
}
109114

115+
getChainId(): number {
116+
return (this._staticsCoin.network as EthereumNetwork).chainId;
117+
}
118+
110119
/** @inheritDoc */
111120
isEVM(): boolean {
112121
return true;
@@ -226,4 +235,21 @@ export abstract class AbstractEthLikeCoin extends BaseCoin {
226235
* @return a new transaction builder
227236
*/
228237
protected abstract getTransactionBuilder(common?: EthLikeCommon.default): TransactionBuilder;
238+
239+
/** @inheritDoc */
240+
auditDecryptedKey({ multiSigType, publicKey, prv }: AuditDecryptedKeyParams): void {
241+
if (multiSigType === 'tss') {
242+
auditEcdsaPrivateKey(prv as string, publicKey as string);
243+
} else {
244+
if (!isValidPrv(prv) && !isValidXprv(prv)) {
245+
throw new Error('Invalid private key');
246+
}
247+
if (publicKey) {
248+
const genPubKey = bitcoin.HDNode.fromBase58(prv).neutered().toBase58();
249+
if (genPubKey !== publicKey) {
250+
throw new Error('Incorrect xpub');
251+
}
252+
}
253+
}
254+
}
229255
}

modules/abstract-eth/src/abstractEthLikeNewCoins.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
533533
*/
534534
async queryAddressBalance(address: string): Promise<any> {
535535
const result = await this.recoveryBlockchainExplorerQuery({
536+
chainid: this.getChainId().toString(),
536537
module: 'account',
537538
action: 'balance',
538539
address: address,
@@ -634,6 +635,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
634635
const sequenceIdArgs = optionalDeps.ethAbi.rawEncode([], []);
635636
const sequenceIdData = Buffer.concat([sequenceIdMethodSignature, sequenceIdArgs]).toString('hex');
636637
const result = await this.recoveryBlockchainExplorerQuery({
638+
chainid: this.getChainId().toString(),
637639
module: 'proxy',
638640
action: 'eth_call',
639641
to: address,
@@ -842,6 +844,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
842844
let nonce = 0;
843845

844846
const result = await this.recoveryBlockchainExplorerQuery({
847+
chainid: this.getChainId().toString(),
845848
module: 'account',
846849
action: 'txlist',
847850
address,
@@ -1631,6 +1634,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
16311634
}
16321635

16331636
const result = await this.recoveryBlockchainExplorerQuery({
1637+
chainid: this.getChainId().toString(),
16341638
module: 'account',
16351639
action: 'tokenbalance',
16361640
contractaddress: tokenContractAddress,
@@ -2775,6 +2779,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
27752779
async getGasPriceFromExternalAPI(wrongChainCoin: string): Promise<BN> {
27762780
try {
27772781
const res = await this.recoveryBlockchainExplorerQuery({
2782+
chainid: this.getChainId().toString(),
27782783
module: 'proxy',
27792784
action: 'eth_gasPrice',
27802785
});
@@ -2796,6 +2801,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
27962801
async getGasLimitFromExternalAPI(intendedChain: string, from: string, to: string, data: string): Promise<BN> {
27972802
try {
27982803
const res = await this.recoveryBlockchainExplorerQuery({
2804+
chainid: this.getChainId().toString(),
27992805
module: 'proxy',
28002806
action: 'eth_estimateGas',
28012807
from,

modules/abstract-eth/src/ethLikeToken.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export class EthLikeToken extends AbstractEthLikeNewCoins {
258258
let backupKeyNonce = 0;
259259

260260
const result = await this.recoveryBlockchainExplorerQuery({
261+
chainid: this.getChainId().toString(),
261262
module: 'account',
262263
action: 'txlist',
263264
address: backupKeyAddress,

modules/abstract-lightning/src/abstractLightningCoin.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
AuditDecryptedKeyParams,
23
BaseCoin,
34
BitGoBase,
45
KeyPair,
@@ -61,4 +62,10 @@ export abstract class AbstractLightningCoin extends BaseCoin {
6162
signTransaction(params: SignTransactionOptions): Promise<SignedTransaction> {
6263
throw new Error('Method not implemented.');
6364
}
65+
66+
/** @inheritDoc */
67+
auditDecryptedKey(params: AuditDecryptedKeyParams) {
68+
/** https://bitgoinc.atlassian.net/browse/BTC-2149 */
69+
throw new Error('Method not implemented.');
70+
}
6471
}

0 commit comments

Comments
 (0)