@dynamic-labs/bitcoin 5.4.1 → 5.5.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 CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [5.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.1...v5.5.0) (2026-08-31)
3
+
4
+
5
+ ### Features
6
+
7
+ * **waas-evm:** route embedded EVM sends through gas sponsorship when enabled ([#12306](https://github.com/dynamic-labs/dynamic-auth/issues/12306)) ([6046ff3](https://github.com/dynamic-labs/dynamic-auth/commit/6046ff362d8de9402793bdaa7319fda645ff4c04))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **bitcoin:** resolve the active BTC wallet and network correctly across the widget ([#12308](https://github.com/dynamic-labs/dynamic-auth/issues/12308)) ([13e9eae](https://github.com/dynamic-labs/dynamic-auth/commit/13e9eaec19b3925db507c878988cfd82da5a6de6))
13
+ * **btc:** unbreak BTC transaction confirmation, testnet balances and taproot testnet switching ([#12305](https://github.com/dynamic-labs/dynamic-auth/issues/12305)) ([5fd999c](https://github.com/dynamic-labs/dynamic-auth/commit/5fd999c4c819d3a74e967c0cfa77c5877a74906b))
14
+ * **react-native-extension:** stop leaking expo-secure-store into consumer autolinking ([#12296](https://github.com/dynamic-labs/dynamic-auth/issues/12296)) ([1e0396a](https://github.com/dynamic-labs/dynamic-auth/commit/1e0396ab00c79aa0b2f45b6d7b1d339c1dac1203)), closes [#12254](https://github.com/dynamic-labs/dynamic-auth/issues/12254)
15
+ * **screening:** wire connected-wallet screening into the Send Balance UI (DYNT-1663) ([#12303](https://github.com/dynamic-labs/dynamic-auth/issues/12303)) ([5d26ff3](https://github.com/dynamic-labs/dynamic-auth/commit/5d26ff375118302522c39bd2f1fa9e04f7378eaf))
16
+
2
17
  ### [5.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.0...v5.4.1) (2026-08-26)
3
18
 
4
19
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "5.4.1";
6
+ var version = "5.5.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "5.4.1";
2
+ var version = "5.5.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/bitcoin",
3
- "version": "5.4.1",
3
+ "version": "5.5.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",
@@ -29,13 +29,13 @@
29
29
  "ecpair": "2.1.0",
30
30
  "sats-connect": "4.2.1",
31
31
  "jsontokens": "4.0.1",
32
- "@dynamic-labs/assert-package-version": "5.4.1",
33
- "@dynamic-labs/logger": "5.4.1",
34
- "@dynamic-labs/types": "5.4.1",
35
- "@dynamic-labs/utils": "5.4.1",
36
- "@dynamic-labs/waas": "5.4.1",
37
- "@dynamic-labs/wallet-book": "5.4.1",
38
- "@dynamic-labs/wallet-connector-core": "5.4.1",
32
+ "@dynamic-labs/assert-package-version": "5.5.0",
33
+ "@dynamic-labs/logger": "5.5.0",
34
+ "@dynamic-labs/types": "5.5.0",
35
+ "@dynamic-labs/utils": "5.5.0",
36
+ "@dynamic-labs/waas": "5.5.0",
37
+ "@dynamic-labs/wallet-book": "5.5.0",
38
+ "@dynamic-labs/wallet-connector-core": "5.5.0",
39
39
  "eventemitter3": "5.0.1"
40
40
  },
41
41
  "peerDependencies": {}
@@ -286,13 +286,15 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
286
286
  * address (wallets created before per-network registration).
287
287
  */
288
288
  getPaymentAddressForNetwork(network) {
289
- var _a, _b;
289
+ var _a, _b, _c;
290
290
  // Resolved against the wallet that is currently active. Reading
291
291
  // `verifiedCredential` alone would switch the network on the user's first
292
292
  // wallet, handing back an address that belongs to a different wallet.
293
293
  const credential = (_a = this.findCredentialForActiveAddress()) !== null && _a !== void 0 ? _a : this.verifiedCredential;
294
- const tagged = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.find((addr) => addr.type === 'payment' &&
295
- addr.network === network);
294
+ // Taproot wallets are minted with `ordinals` rows only, so a `payment`
295
+ // row is preferred but cannot be required or they lose testnet entirely.
296
+ const forNetwork = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.filter((addr) => addr.network === network);
297
+ const tagged = (_c = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((addr) => addr.type === 'payment')) !== null && _c !== void 0 ? _c : forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((addr) => addr.type === 'ordinals');
296
298
  if (tagged === null || tagged === void 0 ? void 0 : tagged.address) {
297
299
  return tagged.address;
298
300
  }
@@ -551,6 +553,34 @@ class DynamicWaasBitcoinConnector extends waas.withDynamicWaas(BitcoinWalletConn
551
553
  }
552
554
  return this.getWaasWalletClient();
553
555
  }
556
+ /**
557
+ * Rebinds the connector when the user switches primary wallet. One connector
558
+ * instance is shared by every BTC wallet, so without this the connector stays
559
+ * on whichever address it was first seeded with and every address-derived
560
+ * read — displayed address, deposit address, balance — reports that wallet.
561
+ *
562
+ * Guarded by isSameWalletAddress so switching to a wallet that is already
563
+ * active on a non-mainnet encoding does not reset it to the primary address.
564
+ */
565
+ afterWalletSelectHook(walletAddress) {
566
+ if (!this.isSameWalletAddress(walletAddress)) {
567
+ this.setActiveAccountAddress(this.resolveAddressForActiveNetwork(walletAddress));
568
+ }
569
+ }
570
+ /**
571
+ * Selecting a wallet hands us its primary (mainnet) address, so binding it
572
+ * verbatim would silently drop a switchNetwork the user already made. Map it
573
+ * onto the network that is currently active instead. Falls back to the given
574
+ * address when the wallet has no row for that network.
575
+ */
576
+ resolveAddressForActiveNetwork(walletAddress) {
577
+ var _a, _b, _c, _d, _e, _f;
578
+ const network = this.activeNetworkId === BITCOIN_TESTNET_NETWORK_ID
579
+ ? 'testnet'
580
+ : 'mainnet';
581
+ const forNetwork = ((_b = (_a = this.findCredentialForAddress(walletAddress)) === null || _a === void 0 ? void 0 : _a.walletAdditionalAddresses) !== null && _b !== void 0 ? _b : []).filter((addr) => addr.network === network);
582
+ return ((_f = (_d = (_c = forNetwork.find((addr) => addr.type === 'payment')) === null || _c === void 0 ? void 0 : _c.address) !== null && _d !== void 0 ? _d : (_e = forNetwork.find((addr) => addr.type === 'ordinals')) === null || _e === void 0 ? void 0 : _e.address) !== null && _f !== void 0 ? _f : walletAddress);
583
+ }
554
584
  /**
555
585
  * Gets the currently active account address
556
586
  * @returns The active account address or undefined if not set
@@ -435,6 +435,23 @@ export declare class DynamicWaasBitcoinConnector extends DynamicWaasBitcoinConne
435
435
  getWalletClientByAddress({ accountAddress }: {
436
436
  accountAddress: string;
437
437
  }): Promise<import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient>;
438
+ /**
439
+ * Rebinds the connector when the user switches primary wallet. One connector
440
+ * instance is shared by every BTC wallet, so without this the connector stays
441
+ * on whichever address it was first seeded with and every address-derived
442
+ * read — displayed address, deposit address, balance — reports that wallet.
443
+ *
444
+ * Guarded by isSameWalletAddress so switching to a wallet that is already
445
+ * active on a non-mainnet encoding does not reset it to the primary address.
446
+ */
447
+ afterWalletSelectHook(walletAddress: string): void;
448
+ /**
449
+ * Selecting a wallet hands us its primary (mainnet) address, so binding it
450
+ * verbatim would silently drop a switchNetwork the user already made. Map it
451
+ * onto the network that is currently active instead. Falls back to the given
452
+ * address when the wallet has no row for that network.
453
+ */
454
+ private resolveAddressForActiveNetwork;
438
455
  /**
439
456
  * Gets the currently active account address
440
457
  * @returns The active account address or undefined if not set
@@ -282,13 +282,15 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
282
282
  * address (wallets created before per-network registration).
283
283
  */
284
284
  getPaymentAddressForNetwork(network) {
285
- var _a, _b;
285
+ var _a, _b, _c;
286
286
  // Resolved against the wallet that is currently active. Reading
287
287
  // `verifiedCredential` alone would switch the network on the user's first
288
288
  // wallet, handing back an address that belongs to a different wallet.
289
289
  const credential = (_a = this.findCredentialForActiveAddress()) !== null && _a !== void 0 ? _a : this.verifiedCredential;
290
- const tagged = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.find((addr) => addr.type === 'payment' &&
291
- addr.network === network);
290
+ // Taproot wallets are minted with `ordinals` rows only, so a `payment`
291
+ // row is preferred but cannot be required or they lose testnet entirely.
292
+ const forNetwork = (_b = credential === null || credential === void 0 ? void 0 : credential.walletAdditionalAddresses) === null || _b === void 0 ? void 0 : _b.filter((addr) => addr.network === network);
293
+ const tagged = (_c = forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((addr) => addr.type === 'payment')) !== null && _c !== void 0 ? _c : forNetwork === null || forNetwork === void 0 ? void 0 : forNetwork.find((addr) => addr.type === 'ordinals');
292
294
  if (tagged === null || tagged === void 0 ? void 0 : tagged.address) {
293
295
  return tagged.address;
294
296
  }
@@ -547,6 +549,34 @@ class DynamicWaasBitcoinConnector extends withDynamicWaas(BitcoinWalletConnector
547
549
  }
548
550
  return this.getWaasWalletClient();
549
551
  }
552
+ /**
553
+ * Rebinds the connector when the user switches primary wallet. One connector
554
+ * instance is shared by every BTC wallet, so without this the connector stays
555
+ * on whichever address it was first seeded with and every address-derived
556
+ * read — displayed address, deposit address, balance — reports that wallet.
557
+ *
558
+ * Guarded by isSameWalletAddress so switching to a wallet that is already
559
+ * active on a non-mainnet encoding does not reset it to the primary address.
560
+ */
561
+ afterWalletSelectHook(walletAddress) {
562
+ if (!this.isSameWalletAddress(walletAddress)) {
563
+ this.setActiveAccountAddress(this.resolveAddressForActiveNetwork(walletAddress));
564
+ }
565
+ }
566
+ /**
567
+ * Selecting a wallet hands us its primary (mainnet) address, so binding it
568
+ * verbatim would silently drop a switchNetwork the user already made. Map it
569
+ * onto the network that is currently active instead. Falls back to the given
570
+ * address when the wallet has no row for that network.
571
+ */
572
+ resolveAddressForActiveNetwork(walletAddress) {
573
+ var _a, _b, _c, _d, _e, _f;
574
+ const network = this.activeNetworkId === BITCOIN_TESTNET_NETWORK_ID
575
+ ? 'testnet'
576
+ : 'mainnet';
577
+ const forNetwork = ((_b = (_a = this.findCredentialForAddress(walletAddress)) === null || _a === void 0 ? void 0 : _a.walletAdditionalAddresses) !== null && _b !== void 0 ? _b : []).filter((addr) => addr.network === network);
578
+ return ((_f = (_d = (_c = forNetwork.find((addr) => addr.type === 'payment')) === null || _c === void 0 ? void 0 : _c.address) !== null && _d !== void 0 ? _d : (_e = forNetwork.find((addr) => addr.type === 'ordinals')) === null || _e === void 0 ? void 0 : _e.address) !== null && _f !== void 0 ? _f : walletAddress);
579
+ }
550
580
  /**
551
581
  * Gets the currently active account address
552
582
  * @returns The active account address or undefined if not set