@dynamic-labs/bitcoin 4.54.0 → 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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/connectors/BitcoinWalletConnector.d.ts +2 -2
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs +10 -4
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.d.ts +7 -6
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js +10 -4
- package/src/wallet/BitcoinWallet.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
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
|
+
|
|
2
10
|
## [4.54.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.53.2...v4.54.0) (2026-01-16)
|
|
3
11
|
|
|
4
12
|
|
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",
|
|
@@ -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
|
});
|
|
@@ -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;
|
|
@@ -60,7 +57,11 @@ declare const DynamicWaasBitcoinConnector_base: (abstract new (...args: any[]) =
|
|
|
60
57
|
thresholdSignatureScheme?: string | undefined;
|
|
61
58
|
publicAddressCheck?: string | undefined;
|
|
62
59
|
addressType?: string | undefined;
|
|
63
|
-
legacyWalletId?: string | undefined;
|
|
60
|
+
legacyWalletId?: string | undefined; /**
|
|
61
|
+
* Override setVerifiedCredentials to filter and set Bitcoin WaaS credentials
|
|
62
|
+
* Filters for credentials with walletName === 'dynamicwaas' and chain === 'bip122'
|
|
63
|
+
* The base class already has verifiedCredentials property, so we just filter and set it
|
|
64
|
+
*/
|
|
64
65
|
}): Promise<void>;
|
|
65
66
|
exportPrivateKey({ accountAddress, displayContainer, password, }?: {
|
|
66
67
|
accountAddress?: string | undefined;
|
|
@@ -202,7 +203,7 @@ export declare class DynamicWaasBitcoinConnector extends DynamicWaasBitcoinConne
|
|
|
202
203
|
sendRawTransaction(rawTransaction: string): Promise<string>;
|
|
203
204
|
/**
|
|
204
205
|
* Sends Bitcoin to a recipient address
|
|
205
|
-
* This method combines buildPsbt, signPsbt, and sendRawTransaction into a single flow
|
|
206
|
+
* This method combines buildPsbt, signPsbt, finalize, and sendRawTransaction into a single flow
|
|
206
207
|
* @param transaction - The Bitcoin transaction containing recipient address and amount
|
|
207
208
|
* @returns The transaction ID
|
|
208
209
|
* @throws {DynamicError} If any step in the process fails
|
|
@@ -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
|
});
|
|
@@ -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
|