@dynamic-labs/bitcoin 4.53.2 → 4.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/connectors/BitcoinWalletConnector.d.ts +2 -2
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs +13 -5
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.d.ts +8 -8
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js +13 -5
- package/src/wallet/BitcoinWallet.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.55.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.54.0...v4.55.0) (2026-01-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* finalize psbt in sendBitcoin function ([#10250](https://github.com/dynamic-labs/dynamic-auth/issues/10250)) ([a27bc1b](https://github.com/dynamic-labs/dynamic-auth/commit/a27bc1b16ceb99a00422a62a89c37f055d3831b7))
|
|
8
|
+
* update getWalletsToDelegate to include denied and dismissed wal… ([#10247](https://github.com/dynamic-labs/dynamic-auth/issues/10247)) ([cea9dfc](https://github.com/dynamic-labs/dynamic-auth/commit/cea9dfcce6f05e4dbd1192d6d0ce5ab4a0f2f115))
|
|
9
|
+
|
|
10
|
+
## [4.54.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.53.2...v4.54.0) (2026-01-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add iCloud backup method for wallet backup ([#10221](https://github.com/dynamic-labs/dynamic-auth/issues/10221)) ([36f5b8a](https://github.com/dynamic-labs/dynamic-auth/commit/36f5b8a0df50139fabbc6d6256f396a6d40313f4))
|
|
16
|
+
* add iCloud backup support for wallet key shares ([#10220](https://github.com/dynamic-labs/dynamic-auth/issues/10220)) ([f5f8135](https://github.com/dynamic-labs/dynamic-auth/commit/f5f813593d6ec834fc94f873fd7151b1f3e1a0ca))
|
|
17
|
+
* add legacyWalletId parameter to importPrivateKey ([#10244](https://github.com/dynamic-labs/dynamic-auth/issues/10244)) ([d281dd7](https://github.com/dynamic-labs/dynamic-auth/commit/d281dd7128ac1211e8ca0b72818e109ece7b9837))
|
|
18
|
+
|
|
2
19
|
### [4.53.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.53.1...v4.53.2) (2026-01-16)
|
|
3
20
|
|
|
4
21
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.55.0",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs-wallet/browser-wallet-client": "0.0.
|
|
21
|
+
"@dynamic-labs-wallet/browser-wallet-client": "0.0.248",
|
|
22
22
|
"@bitcoinerlab/secp256k1": "1.1.1",
|
|
23
23
|
"@btckit/types": "0.0.19",
|
|
24
24
|
"@dynamic-labs/sdk-api-core": "0.0.855",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"ecpair": "2.1.0",
|
|
29
29
|
"sats-connect": "4.2.0",
|
|
30
30
|
"jsontokens": "4.0.1",
|
|
31
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
32
|
-
"@dynamic-labs/logger": "4.
|
|
33
|
-
"@dynamic-labs/types": "4.
|
|
34
|
-
"@dynamic-labs/utils": "4.
|
|
35
|
-
"@dynamic-labs/waas": "4.
|
|
36
|
-
"@dynamic-labs/wallet-book": "4.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
31
|
+
"@dynamic-labs/assert-package-version": "4.55.0",
|
|
32
|
+
"@dynamic-labs/logger": "4.55.0",
|
|
33
|
+
"@dynamic-labs/types": "4.55.0",
|
|
34
|
+
"@dynamic-labs/utils": "4.55.0",
|
|
35
|
+
"@dynamic-labs/waas": "4.55.0",
|
|
36
|
+
"@dynamic-labs/wallet-book": "4.55.0",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "4.55.0",
|
|
38
38
|
"eventemitter3": "5.0.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -4,7 +4,7 @@ import { Chain, IBitcoinWalletConnector, WalletConnectorBase, WalletMetadata } f
|
|
|
4
4
|
import { WalletBookSchema, WalletSchema } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { JwtVerifiedCredential, WalletAdditionalAddress } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { IBitcoinSessionCache } from '../BitcoinLocalStorageCache';
|
|
7
|
-
import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinWalletStandardMethods, ConnectedAccountWithAddressesProps, BitcoinSignProtocol } from '../types';
|
|
7
|
+
import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinWalletStandardMethods, ConnectedAccountWithAddressesProps, BitcoinSignProtocol, EmbeddedWalletSignPsbtRequest } from '../types';
|
|
8
8
|
import { BitcoinWallet } from '../wallet';
|
|
9
9
|
export type BitcoinWalletConnectorOpts = {
|
|
10
10
|
walletBook: WalletBookSchema;
|
|
@@ -43,7 +43,7 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
|
|
|
43
43
|
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
44
44
|
buildPsbt(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
45
45
|
getProvider<T>(): T & EventEmitter<string | symbol, any>;
|
|
46
|
-
abstract signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
46
|
+
abstract signPsbt(request: BitcoinSignPsbtRequest | EmbeddedWalletSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
47
47
|
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
48
48
|
setConnectedAccountWithAddresses({ mainAddress, ordinalsAddress, paymentAddress, active, }: ConnectedAccountWithAddressesProps): Promise<void>;
|
|
49
49
|
setupEventListeners(): void;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
7
8
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
9
|
var logger$1 = require('@dynamic-labs/logger');
|
|
9
10
|
var utils = require('@dynamic-labs/utils');
|
|
@@ -14,7 +15,6 @@ var MempoolApiService = require('../../services/MempoolApiService.cjs');
|
|
|
14
15
|
var PsbtBuilderService = require('../../services/PsbtBuilderService.cjs');
|
|
15
16
|
var PsbtParser = require('../../utils/psbtParser/PsbtParser.cjs');
|
|
16
17
|
require('sats-connect');
|
|
17
|
-
require('bitcoinjs-lib');
|
|
18
18
|
require('jsontokens');
|
|
19
19
|
var btcToSatoshis = require('../../utils/btcToSatoshis/btcToSatoshis.cjs');
|
|
20
20
|
|
|
@@ -180,7 +180,7 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
|
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Sends Bitcoin to a recipient address
|
|
183
|
-
* This method combines buildPsbt, signPsbt, and sendRawTransaction into a single flow
|
|
183
|
+
* This method combines buildPsbt, signPsbt, finalize, and sendRawTransaction into a single flow
|
|
184
184
|
* @param transaction - The Bitcoin transaction containing recipient address and amount
|
|
185
185
|
* @returns The transaction ID
|
|
186
186
|
* @throws {DynamicError} If any step in the process fails
|
|
@@ -199,8 +199,14 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
|
|
|
199
199
|
if (!signedPsbtResponse) {
|
|
200
200
|
throw new utils.DynamicError('Failed to sign PSBT');
|
|
201
201
|
}
|
|
202
|
-
// Step 3:
|
|
203
|
-
const
|
|
202
|
+
// Step 3: Finalize the signed PSBT and extract the raw transaction
|
|
203
|
+
const network = this.activeAccountAddress.startsWith('t')
|
|
204
|
+
? bitcoinjsLib.networks.testnet
|
|
205
|
+
: bitcoinjsLib.networks.bitcoin;
|
|
206
|
+
const psbt = bitcoinjsLib.Psbt.fromBase64(signedPsbtResponse.signedPsbt, { network });
|
|
207
|
+
psbt.finalizeAllInputs();
|
|
208
|
+
const finalizedTx = psbt.extractTransaction();
|
|
209
|
+
const signedTransactionHex = finalizedTx.toHex();
|
|
204
210
|
// Step 4: Send the raw transaction
|
|
205
211
|
return this.sendRawTransaction(signedTransactionHex);
|
|
206
212
|
});
|
|
@@ -237,13 +243,14 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
|
|
|
237
243
|
* @param thresholdSignatureScheme - The threshold signature scheme (default: 'TWO_OF_TWO')
|
|
238
244
|
* @param publicAddressCheck - Optional public address to verify against
|
|
239
245
|
* @param addressType - Required address type for Bitcoin ('native_segwit' or 'taproot')
|
|
246
|
+
* @param legacyWalletId - Optional ID of the legacy wallet being upgraded
|
|
240
247
|
* @throws {DynamicError} If addressType is missing or invalid for BTC
|
|
241
248
|
*/
|
|
242
249
|
importPrivateKey(_a) {
|
|
243
250
|
const _super = Object.create(null, {
|
|
244
251
|
importPrivateKey: { get: () => super.importPrivateKey }
|
|
245
252
|
});
|
|
246
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', publicAddressCheck, addressType, }) {
|
|
253
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', publicAddressCheck, addressType, legacyWalletId, }) {
|
|
247
254
|
if (!addressType) {
|
|
248
255
|
throw new utils.DynamicError('addressType is required for BTC importPrivateKey');
|
|
249
256
|
}
|
|
@@ -253,6 +260,7 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
|
|
|
253
260
|
}
|
|
254
261
|
return _super.importPrivateKey.call(this, {
|
|
255
262
|
addressType,
|
|
263
|
+
legacyWalletId,
|
|
256
264
|
privateKey,
|
|
257
265
|
publicAddressCheck,
|
|
258
266
|
thresholdSignatureScheme,
|
|
@@ -35,10 +35,7 @@ declare const DynamicWaasBitcoinConnector_base: (abstract new (...args: any[]) =
|
|
|
35
35
|
setBaseApiUrl(baseApiUrl: string): void;
|
|
36
36
|
setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl?: string | undefined): void;
|
|
37
37
|
setRelayUrl(relayUrl: string): void;
|
|
38
|
-
setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
|
|
39
|
-
* The primary/active verified credential (first from the filtered array)
|
|
40
|
-
* This is used for the active account address
|
|
41
|
-
*/
|
|
38
|
+
setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
|
|
42
39
|
delegateKeyShares({ accountAddress, password, }: {
|
|
43
40
|
accountAddress: string;
|
|
44
41
|
password?: string | undefined;
|
|
@@ -55,11 +52,12 @@ declare const DynamicWaasBitcoinConnector_base: (abstract new (...args: any[]) =
|
|
|
55
52
|
publicKeyHex: string;
|
|
56
53
|
rawPublicKey: string | Uint8Array | undefined;
|
|
57
54
|
}>;
|
|
58
|
-
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, }: {
|
|
55
|
+
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, }: {
|
|
59
56
|
privateKey: string;
|
|
60
57
|
thresholdSignatureScheme?: string | undefined;
|
|
61
58
|
publicAddressCheck?: string | undefined;
|
|
62
|
-
addressType?: string | undefined;
|
|
59
|
+
addressType?: string | undefined;
|
|
60
|
+
legacyWalletId?: string | undefined; /**
|
|
63
61
|
* Override setVerifiedCredentials to filter and set Bitcoin WaaS credentials
|
|
64
62
|
* Filters for credentials with walletName === 'dynamicwaas' and chain === 'bip122'
|
|
65
63
|
* The base class already has verifiedCredentials property, so we just filter and set it
|
|
@@ -205,7 +203,7 @@ export declare class DynamicWaasBitcoinConnector extends DynamicWaasBitcoinConne
|
|
|
205
203
|
sendRawTransaction(rawTransaction: string): Promise<string>;
|
|
206
204
|
/**
|
|
207
205
|
* Sends Bitcoin to a recipient address
|
|
208
|
-
* This method combines buildPsbt, signPsbt, and sendRawTransaction into a single flow
|
|
206
|
+
* This method combines buildPsbt, signPsbt, finalize, and sendRawTransaction into a single flow
|
|
209
207
|
* @param transaction - The Bitcoin transaction containing recipient address and amount
|
|
210
208
|
* @returns The transaction ID
|
|
211
209
|
* @throws {DynamicError} If any step in the process fails
|
|
@@ -234,13 +232,15 @@ export declare class DynamicWaasBitcoinConnector extends DynamicWaasBitcoinConne
|
|
|
234
232
|
* @param thresholdSignatureScheme - The threshold signature scheme (default: 'TWO_OF_TWO')
|
|
235
233
|
* @param publicAddressCheck - Optional public address to verify against
|
|
236
234
|
* @param addressType - Required address type for Bitcoin ('native_segwit' or 'taproot')
|
|
235
|
+
* @param legacyWalletId - Optional ID of the legacy wallet being upgraded
|
|
237
236
|
* @throws {DynamicError} If addressType is missing or invalid for BTC
|
|
238
237
|
*/
|
|
239
|
-
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, }: {
|
|
238
|
+
importPrivateKey({ privateKey, thresholdSignatureScheme, publicAddressCheck, addressType, legacyWalletId, }: {
|
|
240
239
|
privateKey: string;
|
|
241
240
|
thresholdSignatureScheme?: string;
|
|
242
241
|
publicAddressCheck?: string;
|
|
243
242
|
addressType?: string;
|
|
243
|
+
legacyWalletId?: string;
|
|
244
244
|
}): Promise<void>;
|
|
245
245
|
/**
|
|
246
246
|
* Gets the wallet client for a specific account address and sets it as active
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { networks, Psbt } from 'bitcoinjs-lib';
|
|
3
4
|
import { MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
4
5
|
import { Logger } from '@dynamic-labs/logger';
|
|
5
6
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
@@ -10,7 +11,6 @@ import { MempoolApiService } from '../../services/MempoolApiService.js';
|
|
|
10
11
|
import { PsbtBuilderService } from '../../services/PsbtBuilderService.js';
|
|
11
12
|
import { PsbtParser } from '../../utils/psbtParser/PsbtParser.js';
|
|
12
13
|
import 'sats-connect';
|
|
13
|
-
import 'bitcoinjs-lib';
|
|
14
14
|
import 'jsontokens';
|
|
15
15
|
import { btcToSatoshis } from '../../utils/btcToSatoshis/btcToSatoshis.js';
|
|
16
16
|
|
|
@@ -176,7 +176,7 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
|
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Sends Bitcoin to a recipient address
|
|
179
|
-
* This method combines buildPsbt, signPsbt, and sendRawTransaction into a single flow
|
|
179
|
+
* This method combines buildPsbt, signPsbt, finalize, and sendRawTransaction into a single flow
|
|
180
180
|
* @param transaction - The Bitcoin transaction containing recipient address and amount
|
|
181
181
|
* @returns The transaction ID
|
|
182
182
|
* @throws {DynamicError} If any step in the process fails
|
|
@@ -195,8 +195,14 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
|
|
|
195
195
|
if (!signedPsbtResponse) {
|
|
196
196
|
throw new DynamicError('Failed to sign PSBT');
|
|
197
197
|
}
|
|
198
|
-
// Step 3:
|
|
199
|
-
const
|
|
198
|
+
// Step 3: Finalize the signed PSBT and extract the raw transaction
|
|
199
|
+
const network = this.activeAccountAddress.startsWith('t')
|
|
200
|
+
? networks.testnet
|
|
201
|
+
: networks.bitcoin;
|
|
202
|
+
const psbt = Psbt.fromBase64(signedPsbtResponse.signedPsbt, { network });
|
|
203
|
+
psbt.finalizeAllInputs();
|
|
204
|
+
const finalizedTx = psbt.extractTransaction();
|
|
205
|
+
const signedTransactionHex = finalizedTx.toHex();
|
|
200
206
|
// Step 4: Send the raw transaction
|
|
201
207
|
return this.sendRawTransaction(signedTransactionHex);
|
|
202
208
|
});
|
|
@@ -233,13 +239,14 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
|
|
|
233
239
|
* @param thresholdSignatureScheme - The threshold signature scheme (default: 'TWO_OF_TWO')
|
|
234
240
|
* @param publicAddressCheck - Optional public address to verify against
|
|
235
241
|
* @param addressType - Required address type for Bitcoin ('native_segwit' or 'taproot')
|
|
242
|
+
* @param legacyWalletId - Optional ID of the legacy wallet being upgraded
|
|
236
243
|
* @throws {DynamicError} If addressType is missing or invalid for BTC
|
|
237
244
|
*/
|
|
238
245
|
importPrivateKey(_a) {
|
|
239
246
|
const _super = Object.create(null, {
|
|
240
247
|
importPrivateKey: { get: () => super.importPrivateKey }
|
|
241
248
|
});
|
|
242
|
-
return __awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', publicAddressCheck, addressType, }) {
|
|
249
|
+
return __awaiter(this, arguments, void 0, function* ({ privateKey, thresholdSignatureScheme = 'TWO_OF_TWO', publicAddressCheck, addressType, legacyWalletId, }) {
|
|
243
250
|
if (!addressType) {
|
|
244
251
|
throw new DynamicError('addressType is required for BTC importPrivateKey');
|
|
245
252
|
}
|
|
@@ -249,6 +256,7 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
|
|
|
249
256
|
}
|
|
250
257
|
return _super.importPrivateKey.call(this, {
|
|
251
258
|
addressType,
|
|
259
|
+
legacyWalletId,
|
|
252
260
|
privateKey,
|
|
253
261
|
publicAddressCheck,
|
|
254
262
|
thresholdSignatureScheme,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import type { WalletAddressType } from '@dynamic-labs/types';
|
|
3
3
|
import { BitcoinWalletConnector } from '../connectors';
|
|
4
|
-
import { BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } from '../types';
|
|
4
|
+
import { BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction, EmbeddedWalletSignPsbtRequest } from '../types';
|
|
5
5
|
export declare class BitcoinWallet extends Wallet<BitcoinWalletConnector> {
|
|
6
6
|
/**
|
|
7
7
|
* Sends the native balance of the wallet to the given address.
|
|
@@ -41,7 +41,7 @@ export declare class BitcoinWallet extends Wallet<BitcoinWalletConnector> {
|
|
|
41
41
|
* @returns A promise that resolves to an object with the signed PSBT
|
|
42
42
|
* or undefined if no provider is available
|
|
43
43
|
*/
|
|
44
|
-
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
44
|
+
signPsbt(request: BitcoinSignPsbtRequest | EmbeddedWalletSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
45
45
|
/**
|
|
46
46
|
* Sings multiple PSBTs
|
|
47
47
|
* @returns A promise that resolves to an array of signed PSBTs in base64
|