@dynamic-labs/embedded-wallet-bitcoin 4.18.7 → 4.18.8
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/TurnkeyBitcoinWalletConnector/TurnkeyBitcoinWalletConnector.cjs +6 -7
- package/src/lib/TurnkeyBitcoinWalletConnector/TurnkeyBitcoinWalletConnector.d.ts +3 -4
- package/src/lib/TurnkeyBitcoinWalletConnector/TurnkeyBitcoinWalletConnector.js +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.18.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.7...v4.18.8) (2025-05-22)
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* allow closing widget right after login ([#8760](https://github.com/dynamic-labs/dynamic-auth/issues/8760)) ([a9afff0](https://github.com/dynamic-labs/dynamic-auth/commit/a9afff0ab2a685853b39aed88e10bf1e700e4c8c))
|
|
7
|
+
* user wallets turning empty when linking new wallets ([#8775](https://github.com/dynamic-labs/dynamic-auth/issues/8775)) ([04215f5](https://github.com/dynamic-labs/dynamic-auth/commit/04215f5307e16ec4e1a7ff235a0d7df2340c3447))
|
|
8
|
+
|
|
2
9
|
### [4.18.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.6...v4.18.7) (2025-05-21)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/embedded-wallet-bitcoin",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.8",
|
|
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",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@bitcoinerlab/secp256k1": "1.1.1",
|
|
22
|
-
"@dynamic-labs/bitcoin": "4.18.
|
|
22
|
+
"@dynamic-labs/bitcoin": "4.18.8",
|
|
23
23
|
"@dynamic-labs/sdk-api-core": "0.0.672",
|
|
24
|
-
"@dynamic-labs/types": "4.18.
|
|
25
|
-
"@dynamic-labs/utils": "4.18.
|
|
24
|
+
"@dynamic-labs/types": "4.18.8",
|
|
25
|
+
"@dynamic-labs/utils": "4.18.8",
|
|
26
26
|
"@turnkey/http": "2.15.0",
|
|
27
27
|
"bitcoinjs-lib": "6.1.5",
|
|
28
28
|
"ecpair": "2.1.0",
|
|
29
|
-
"@dynamic-labs/assert-package-version": "4.18.
|
|
30
|
-
"@dynamic-labs/embedded-wallet": "4.18.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.18.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.18.
|
|
29
|
+
"@dynamic-labs/assert-package-version": "4.18.8",
|
|
30
|
+
"@dynamic-labs/embedded-wallet": "4.18.8",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.18.8",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.18.8"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {}
|
|
35
35
|
}
|
|
@@ -150,7 +150,7 @@ class TurnkeyBitcoinWalletConnector extends embeddedWallet.TurnkeyWalletConnecto
|
|
|
150
150
|
throw new Error('Failed to get public key');
|
|
151
151
|
}
|
|
152
152
|
const ECPair = ecpair.ECPairFactory(ecc__default["default"]);
|
|
153
|
-
const
|
|
153
|
+
const publicKeyCompressedBuffer = Buffer.from(publicKeyCompressed, 'hex');
|
|
154
154
|
const network = yield this.getBitcoinNetwork(accountAddress);
|
|
155
155
|
const psbt = new bitcoinjsLib.Psbt({ network });
|
|
156
156
|
const utxos = yield this.getUTXOs(accountAddress);
|
|
@@ -165,10 +165,10 @@ class TurnkeyBitcoinWalletConnector extends embeddedWallet.TurnkeyWalletConnecto
|
|
|
165
165
|
for (const utxo of utxos) {
|
|
166
166
|
if (accountAddress.startsWith('tb1p') ||
|
|
167
167
|
accountAddress.startsWith('bc1p')) {
|
|
168
|
-
const xOnlyPublicKey =
|
|
168
|
+
const xOnlyPublicKey = Buffer.from(publicKeyCompressed, 'hex');
|
|
169
169
|
const outputScript = bitcoinjsLib.payments.p2tr({
|
|
170
170
|
internalPubkey: xOnlyPublicKey,
|
|
171
|
-
network
|
|
171
|
+
network,
|
|
172
172
|
}).output;
|
|
173
173
|
if (!outputScript) {
|
|
174
174
|
throw new Error('Failed to create output script');
|
|
@@ -185,6 +185,9 @@ class TurnkeyBitcoinWalletConnector extends embeddedWallet.TurnkeyWalletConnecto
|
|
|
185
185
|
}
|
|
186
186
|
else {
|
|
187
187
|
// P2WPKH (SegWit)
|
|
188
|
+
const pair = ECPair.fromPublicKey(publicKeyCompressedBuffer, {
|
|
189
|
+
compressed: true,
|
|
190
|
+
});
|
|
188
191
|
const witnessUtxo = bitcoinjsLib.payments.p2wpkh({
|
|
189
192
|
network,
|
|
190
193
|
pubkey: pair.publicKey,
|
|
@@ -276,10 +279,6 @@ class TurnkeyBitcoinWalletConnector extends embeddedWallet.TurnkeyWalletConnecto
|
|
|
276
279
|
return signedPsbts.map((response) => response.signedPsbt || '');
|
|
277
280
|
});
|
|
278
281
|
}
|
|
279
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
280
|
-
createUiTransaction(from) {
|
|
281
|
-
throw new Error('Method not implemented.');
|
|
282
|
-
}
|
|
283
282
|
canConnectWithHardwareWallet() {
|
|
284
283
|
return false;
|
|
285
284
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { networks } from 'bitcoinjs-lib';
|
|
2
2
|
import { BitcoinTransaction, BitcoinWallet, BitcoinSignProtocol, BitcoinWalletStandardMethods } from '@dynamic-labs/bitcoin';
|
|
3
|
-
import { GenericNetwork,
|
|
4
|
-
import { Chain,
|
|
3
|
+
import { GenericNetwork, WalletUiUtils } from '@dynamic-labs/types';
|
|
4
|
+
import { Chain, InternalWalletConnector, IBitcoinWalletConnector, Wallet, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import { TurnkeyWalletConnectorBase, TurnkeyWalletConnectorNameAndKey } from '@dynamic-labs/embedded-wallet';
|
|
@@ -11,7 +11,7 @@ export type TurnkeyBitcoinConnectorProps = {
|
|
|
11
11
|
bitcoinNetworks: GenericNetwork[];
|
|
12
12
|
appName?: string;
|
|
13
13
|
};
|
|
14
|
-
export declare class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase implements
|
|
14
|
+
export declare class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase implements IBitcoinWalletConnector {
|
|
15
15
|
ChainWallet: typeof BitcoinWallet;
|
|
16
16
|
connectedChain: Chain;
|
|
17
17
|
supportedChains: Chain[];
|
|
@@ -34,7 +34,6 @@ export declare class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnecto
|
|
|
34
34
|
sendBitcoin({ recipientAddress, amount, }: BitcoinTransaction): Promise<string | undefined>;
|
|
35
35
|
signPsbt({ allowedSighash, unsignedPsbtBase64, signature, }: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse>;
|
|
36
36
|
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
37
|
-
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
38
37
|
canConnectWithHardwareWallet(): boolean;
|
|
39
38
|
isInstalledOnBrowser(): boolean;
|
|
40
39
|
private apiGetBalance;
|
|
@@ -142,7 +142,7 @@ class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
142
142
|
throw new Error('Failed to get public key');
|
|
143
143
|
}
|
|
144
144
|
const ECPair = ECPairFactory(ecc);
|
|
145
|
-
const
|
|
145
|
+
const publicKeyCompressedBuffer = Buffer.from(publicKeyCompressed, 'hex');
|
|
146
146
|
const network = yield this.getBitcoinNetwork(accountAddress);
|
|
147
147
|
const psbt = new Psbt({ network });
|
|
148
148
|
const utxos = yield this.getUTXOs(accountAddress);
|
|
@@ -157,10 +157,10 @@ class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
157
157
|
for (const utxo of utxos) {
|
|
158
158
|
if (accountAddress.startsWith('tb1p') ||
|
|
159
159
|
accountAddress.startsWith('bc1p')) {
|
|
160
|
-
const xOnlyPublicKey =
|
|
160
|
+
const xOnlyPublicKey = Buffer.from(publicKeyCompressed, 'hex');
|
|
161
161
|
const outputScript = payments.p2tr({
|
|
162
162
|
internalPubkey: xOnlyPublicKey,
|
|
163
|
-
network
|
|
163
|
+
network,
|
|
164
164
|
}).output;
|
|
165
165
|
if (!outputScript) {
|
|
166
166
|
throw new Error('Failed to create output script');
|
|
@@ -177,6 +177,9 @@ class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
179
|
// P2WPKH (SegWit)
|
|
180
|
+
const pair = ECPair.fromPublicKey(publicKeyCompressedBuffer, {
|
|
181
|
+
compressed: true,
|
|
182
|
+
});
|
|
180
183
|
const witnessUtxo = payments.p2wpkh({
|
|
181
184
|
network,
|
|
182
185
|
pubkey: pair.publicKey,
|
|
@@ -268,10 +271,6 @@ class TurnkeyBitcoinWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
268
271
|
return signedPsbts.map((response) => response.signedPsbt || '');
|
|
269
272
|
});
|
|
270
273
|
}
|
|
271
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
272
|
-
createUiTransaction(from) {
|
|
273
|
-
throw new Error('Method not implemented.');
|
|
274
|
-
}
|
|
275
274
|
canConnectWithHardwareWallet() {
|
|
276
275
|
return false;
|
|
277
276
|
}
|