@dynamic-labs/bitcoin 5.2.0 → 5.3.1

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,25 @@
1
1
 
2
+ ### [5.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.3.0...v5.3.1) (2026-08-14)
3
+
4
+ ## [5.3.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.2.0...v5.3.0) (2026-08-12)
5
+
6
+
7
+ ### Features
8
+
9
+ * **screening:** add transaction-screening service, types, and connector wiring (DYNT-1663) ([#12160](https://github.com/dynamic-labs/dynamic-auth/issues/12160)) ([d8df6a1](https://github.com/dynamic-labs/dynamic-auth/commit/d8df6a1fccbb6370c140454d9297eabd97699e35)), closes [#12172](https://github.com/dynamic-labs/dynamic-auth/issues/12172) [#12167](https://github.com/dynamic-labs/dynamic-auth/issues/12167) [#12168](https://github.com/dynamic-labs/dynamic-auth/issues/12168) [#12169](https://github.com/dynamic-labs/dynamic-auth/issues/12169)
10
+ * **screening:** screen Bitcoin connected-wallet transactions (DYNT-1663) ([#12169](https://github.com/dynamic-labs/dynamic-auth/issues/12169)) ([f34d1c3](https://github.com/dynamic-labs/dynamic-auth/commit/f34d1c31fe10d0cb02b4f7462dd4900d0256604a))
11
+ * **screening:** screen EVM connected-wallet sends (DYNT-1663) ([#12167](https://github.com/dynamic-labs/dynamic-auth/issues/12167)) ([1b72b24](https://github.com/dynamic-labs/dynamic-auth/commit/1b72b24393a49153d74ce715a44d262e8e48ddc7))
12
+ * **screening:** screen Solana connected-wallet transactions (DYNT-1663) ([#12168](https://github.com/dynamic-labs/dynamic-auth/issues/12168)) ([000eb18](https://github.com/dynamic-labs/dynamic-auth/commit/000eb180aca8349804953ff7738c0ba984a2fa21))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add PhoneNumberAlreadyLinkedError and map duplicate-phone backend code ([#12145](https://github.com/dynamic-labs/dynamic-auth/issues/12145)) ([9d13b5f](https://github.com/dynamic-labs/dynamic-auth/commit/9d13b5f8b22716b4c9ce206ee870aab5bd745b8b))
18
+ * **react-native-extension:** throw clear error when react-native-keychain native module is missing ([#12197](https://github.com/dynamic-labs/dynamic-auth/issues/12197)) ([b9983e1](https://github.com/dynamic-labs/dynamic-auth/commit/b9983e1f1aefa9a9bbdc1435f706a05e64f34f1c))
19
+ * security updates ([#12187](https://github.com/dynamic-labs/dynamic-auth/issues/12187)) ([d3a31e2](https://github.com/dynamic-labs/dynamic-auth/commit/d3a31e23533b6b7739851a3b747d62ba13d318b2))
20
+ * security updates ([#12208](https://github.com/dynamic-labs/dynamic-auth/issues/12208)) ([9e9472a](https://github.com/dynamic-labs/dynamic-auth/commit/9e9472acfbe01f7ac9e160829cc10e53c65f91e7))
21
+ * **sdk-react-core:** avoid spurious WaaS client rebuild on transient user sessionId churn ([#12182](https://github.com/dynamic-labs/dynamic-auth/issues/12182)) ([480b2ec](https://github.com/dynamic-labs/dynamic-auth/commit/480b2ecc87486a852e75e8814a76fb59ffe40c5d))
22
+
2
23
  ## [5.2.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.1.0...v5.2.0) (2026-08-06)
3
24
 
4
25
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "5.2.0";
6
+ var version = "5.3.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "5.2.0";
2
+ var version = "5.3.1";
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.2.0",
3
+ "version": "5.3.1",
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",
@@ -22,20 +22,20 @@
22
22
  "@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
23
23
  "@bitcoinerlab/secp256k1": "1.1.1",
24
24
  "@btckit/types": "0.0.19",
25
- "@dynamic-labs/sdk-api-core": "0.0.1093",
25
+ "@dynamic-labs/sdk-api-core": "0.0.1118",
26
26
  "@wallet-standard/app": "1.0.1",
27
27
  "@wallet-standard/base": "1.0.1",
28
28
  "bitcoinjs-lib": "6.1.5",
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.2.0",
33
- "@dynamic-labs/logger": "5.2.0",
34
- "@dynamic-labs/types": "5.2.0",
35
- "@dynamic-labs/utils": "5.2.0",
36
- "@dynamic-labs/waas": "5.2.0",
37
- "@dynamic-labs/wallet-book": "5.2.0",
38
- "@dynamic-labs/wallet-connector-core": "5.2.0",
32
+ "@dynamic-labs/assert-package-version": "5.3.1",
33
+ "@dynamic-labs/logger": "5.3.1",
34
+ "@dynamic-labs/types": "5.3.1",
35
+ "@dynamic-labs/utils": "5.3.1",
36
+ "@dynamic-labs/waas": "5.3.1",
37
+ "@dynamic-labs/wallet-book": "5.3.1",
38
+ "@dynamic-labs/wallet-connector-core": "5.3.1",
39
39
  "eventemitter3": "5.0.1"
40
40
  },
41
41
  "peerDependencies": {}
package/src/index.cjs CHANGED
@@ -30,6 +30,7 @@ var createSignPsbtOptions = require('./utils/psbt/createSignPsbtOptions.cjs');
30
30
  var satoshisToBtc = require('./utils/satoshisToBtc/satoshisToBtc.cjs');
31
31
  var btcToSatoshis = require('./utils/btcToSatoshis/btcToSatoshis.cjs');
32
32
  var getBitcoinNetwork = require('./utils/getBitcoinNetwork/getBitcoinNetwork.cjs');
33
+ var getBitcoinChainId = require('./utils/getBitcoinChainId/getBitcoinChainId.cjs');
33
34
  var PsbtParser = require('./utils/psbtParser/PsbtParser.cjs');
34
35
  var BitcoinWallet = require('./wallet/BitcoinWallet.cjs');
35
36
  var isBitcoinWallet = require('./wallet/isBitcoinWallet/isBitcoinWallet.cjs');
@@ -65,6 +66,9 @@ exports.createPsbtOptions = createSignPsbtOptions.createPsbtOptions;
65
66
  exports.satoshisToBtc = satoshisToBtc.satoshisToBtc;
66
67
  exports.btcToSatoshis = btcToSatoshis.btcToSatoshis;
67
68
  exports.getBitcoinNetwork = getBitcoinNetwork.getBitcoinNetwork;
69
+ exports.BITCOIN_MAINNET_CHAIN_ID = getBitcoinChainId.BITCOIN_MAINNET_CHAIN_ID;
70
+ exports.BITCOIN_TESTNET_CHAIN_ID = getBitcoinChainId.BITCOIN_TESTNET_CHAIN_ID;
71
+ exports.getBitcoinChainId = getBitcoinChainId.getBitcoinChainId;
68
72
  exports.PsbtParser = PsbtParser.PsbtParser;
69
73
  exports.BitcoinWallet = BitcoinWallet.BitcoinWallet;
70
74
  exports.isBitcoinWallet = isBitcoinWallet.isBitcoinWallet;
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ export { createPsbtOptions } from './utils/psbt/createSignPsbtOptions.js';
30
30
  export { satoshisToBtc } from './utils/satoshisToBtc/satoshisToBtc.js';
31
31
  export { btcToSatoshis } from './utils/btcToSatoshis/btcToSatoshis.js';
32
32
  export { getBitcoinNetwork } from './utils/getBitcoinNetwork/getBitcoinNetwork.js';
33
+ export { BITCOIN_MAINNET_CHAIN_ID, BITCOIN_TESTNET_CHAIN_ID, getBitcoinChainId } from './utils/getBitcoinChainId/getBitcoinChainId.js';
33
34
  export { PsbtParser } from './utils/psbtParser/PsbtParser.js';
34
35
  export { BitcoinWallet } from './wallet/BitcoinWallet.js';
35
36
  export { isBitcoinWallet } from './wallet/isBitcoinWallet/isBitcoinWallet.js';
@@ -14,6 +14,7 @@ require('@dynamic-labs/sdk-api-core');
14
14
  require('@wallet-standard/app');
15
15
  var getMempoolApiUrl = require('../utils/getMempoolApiUrl.cjs');
16
16
  var _const = require('../const.cjs');
17
+ require('@dynamic-labs/types');
17
18
  require('jsontokens');
18
19
  require('../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs');
19
20
 
@@ -10,6 +10,7 @@ import '@dynamic-labs/sdk-api-core';
10
10
  import '@wallet-standard/app';
11
11
  import { getMempoolApiUrl } from '../utils/getMempoolApiUrl.js';
12
12
  import { VSIZE_OVERHEAD, VSIZE_INPUT_P2WPKH, VSIZE_OUTPUT_P2WPKH, MIN_RELAY_FEE, DEFAULT_FEE_ESTIMATE } from '../const.js';
13
+ import '@dynamic-labs/types';
13
14
  import 'jsontokens';
14
15
  import '../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js';
15
16
 
@@ -11,6 +11,7 @@ require('@dynamic-labs/wallet-book');
11
11
  require('@dynamic-labs/utils');
12
12
  require('@dynamic-labs/sdk-api-core');
13
13
  var _const = require('../../const.cjs');
14
+ require('@dynamic-labs/types');
14
15
  require('bitcoinjs-lib');
15
16
  var BitcoinSatsConnectConnector = require('../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
16
17
  require('jsontokens');
@@ -7,6 +7,7 @@ import '@dynamic-labs/wallet-book';
7
7
  import '@dynamic-labs/utils';
8
8
  import '@dynamic-labs/sdk-api-core';
9
9
  import { SATSCONNECT_FEATURE } from '../../const.js';
10
+ import '@dynamic-labs/types';
10
11
  import 'bitcoinjs-lib';
11
12
  import { BitcoinSatsConnectConnector } from '../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
12
13
  import 'jsontokens';
@@ -0,0 +1,23 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var bitcoinjsLib = require('bitcoinjs-lib');
7
+ var getBitcoinNetwork = require('../getBitcoinNetwork/getBitcoinNetwork.cjs');
8
+
9
+ // Bitcoin network identifiers from the signing contract (1=mainnet, 2=testnet)
10
+ const BITCOIN_MAINNET_CHAIN_ID = '1';
11
+ const BITCOIN_TESTNET_CHAIN_ID = '2';
12
+ /**
13
+ * Maps a Bitcoin address to the network identifier used by the transaction
14
+ * screening contract. Regtest counts as testnet here: there is no separate
15
+ * identifier for it in the signing contract, and it isn't mainnet.
16
+ */
17
+ const getBitcoinChainId = (accountAddress) => getBitcoinNetwork.getBitcoinNetwork(accountAddress) === bitcoinjsLib.networks.bitcoin
18
+ ? BITCOIN_MAINNET_CHAIN_ID
19
+ : BITCOIN_TESTNET_CHAIN_ID;
20
+
21
+ exports.BITCOIN_MAINNET_CHAIN_ID = BITCOIN_MAINNET_CHAIN_ID;
22
+ exports.BITCOIN_TESTNET_CHAIN_ID = BITCOIN_TESTNET_CHAIN_ID;
23
+ exports.getBitcoinChainId = getBitcoinChainId;
@@ -0,0 +1,8 @@
1
+ export declare const BITCOIN_MAINNET_CHAIN_ID = "1";
2
+ export declare const BITCOIN_TESTNET_CHAIN_ID = "2";
3
+ /**
4
+ * Maps a Bitcoin address to the network identifier used by the transaction
5
+ * screening contract. Regtest counts as testnet here: there is no separate
6
+ * identifier for it in the signing contract, and it isn't mainnet.
7
+ */
8
+ export declare const getBitcoinChainId: (accountAddress: string) => string;
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ import { networks } from 'bitcoinjs-lib';
3
+ import { getBitcoinNetwork } from '../getBitcoinNetwork/getBitcoinNetwork.js';
4
+
5
+ // Bitcoin network identifiers from the signing contract (1=mainnet, 2=testnet)
6
+ const BITCOIN_MAINNET_CHAIN_ID = '1';
7
+ const BITCOIN_TESTNET_CHAIN_ID = '2';
8
+ /**
9
+ * Maps a Bitcoin address to the network identifier used by the transaction
10
+ * screening contract. Regtest counts as testnet here: there is no separate
11
+ * identifier for it in the signing contract, and it isn't mainnet.
12
+ */
13
+ const getBitcoinChainId = (accountAddress) => getBitcoinNetwork(accountAddress) === networks.bitcoin
14
+ ? BITCOIN_MAINNET_CHAIN_ID
15
+ : BITCOIN_TESTNET_CHAIN_ID;
16
+
17
+ export { BITCOIN_MAINNET_CHAIN_ID, BITCOIN_TESTNET_CHAIN_ID, getBitcoinChainId };
@@ -0,0 +1 @@
1
+ export { BITCOIN_MAINNET_CHAIN_ID, BITCOIN_TESTNET_CHAIN_ID, getBitcoinChainId, } from './getBitcoinChainId';
@@ -5,11 +5,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var bitcoinjsLib = require('bitcoinjs-lib');
7
7
 
8
+ // Resolved per call rather than as a module-scope map: building the map at
9
+ // import time reads `networks` the moment any module in the import graph is
10
+ // loaded, which crashes every spec that partially mocks bitcoinjs-lib.
11
+ const networkForBech32Prefix = (prefix) => {
12
+ if (prefix === bitcoinjsLib.networks.bitcoin.bech32)
13
+ return bitcoinjsLib.networks.bitcoin;
14
+ if (prefix === bitcoinjsLib.networks.regtest.bech32)
15
+ return bitcoinjsLib.networks.regtest;
16
+ if (prefix === bitcoinjsLib.networks.testnet.bech32)
17
+ return bitcoinjsLib.networks.testnet;
18
+ return undefined;
19
+ };
8
20
  /**
9
- * Gets the Bitcoin network based on address prefix
21
+ * Gets the Bitcoin network by decoding the address (bech32 human-readable
22
+ * part, or base58 version byte) rather than checking a single leading
23
+ * character, which misreads legacy testnet (m/n/2...) and regtest (bcrt1...)
24
+ * addresses as mainnet. Base58 can't distinguish testnet from regtest (they
25
+ * share version bytes), so a base58 testnet-versioned address resolves to
26
+ * networks.testnet. Anything undecodable defaults to mainnet.
10
27
  * @param accountAddress - The Bitcoin address
11
- * @returns The Bitcoin network (mainnet or testnet)
28
+ * @returns The Bitcoin network (mainnet, testnet, or regtest)
12
29
  */
13
- const getBitcoinNetwork = (accountAddress) => accountAddress.startsWith('t') ? bitcoinjsLib.networks.testnet : bitcoinjsLib.networks.bitcoin;
30
+ const getBitcoinNetwork = (accountAddress) => {
31
+ var _a;
32
+ try {
33
+ return ((_a = networkForBech32Prefix(bitcoinjsLib.address.fromBech32(accountAddress).prefix)) !== null && _a !== void 0 ? _a : bitcoinjsLib.networks.bitcoin);
34
+ }
35
+ catch (_b) {
36
+ // Not bech32; fall through to base58.
37
+ }
38
+ try {
39
+ const { version } = bitcoinjsLib.address.fromBase58Check(accountAddress);
40
+ return version === bitcoinjsLib.networks.testnet.pubKeyHash ||
41
+ version === bitcoinjsLib.networks.testnet.scriptHash
42
+ ? bitcoinjsLib.networks.testnet
43
+ : bitcoinjsLib.networks.bitcoin;
44
+ }
45
+ catch (_c) {
46
+ return bitcoinjsLib.networks.bitcoin;
47
+ }
48
+ };
14
49
 
15
50
  exports.getBitcoinNetwork = getBitcoinNetwork;
@@ -1,7 +1,12 @@
1
1
  import { type Network } from 'bitcoinjs-lib';
2
2
  /**
3
- * Gets the Bitcoin network based on address prefix
3
+ * Gets the Bitcoin network by decoding the address (bech32 human-readable
4
+ * part, or base58 version byte) rather than checking a single leading
5
+ * character, which misreads legacy testnet (m/n/2...) and regtest (bcrt1...)
6
+ * addresses as mainnet. Base58 can't distinguish testnet from regtest (they
7
+ * share version bytes), so a base58 testnet-versioned address resolves to
8
+ * networks.testnet. Anything undecodable defaults to mainnet.
4
9
  * @param accountAddress - The Bitcoin address
5
- * @returns The Bitcoin network (mainnet or testnet)
10
+ * @returns The Bitcoin network (mainnet, testnet, or regtest)
6
11
  */
7
12
  export declare const getBitcoinNetwork: (accountAddress: string) => Network;
@@ -1,11 +1,46 @@
1
1
  'use client'
2
- import { networks } from 'bitcoinjs-lib';
2
+ import { address, networks } from 'bitcoinjs-lib';
3
3
 
4
+ // Resolved per call rather than as a module-scope map: building the map at
5
+ // import time reads `networks` the moment any module in the import graph is
6
+ // loaded, which crashes every spec that partially mocks bitcoinjs-lib.
7
+ const networkForBech32Prefix = (prefix) => {
8
+ if (prefix === networks.bitcoin.bech32)
9
+ return networks.bitcoin;
10
+ if (prefix === networks.regtest.bech32)
11
+ return networks.regtest;
12
+ if (prefix === networks.testnet.bech32)
13
+ return networks.testnet;
14
+ return undefined;
15
+ };
4
16
  /**
5
- * Gets the Bitcoin network based on address prefix
17
+ * Gets the Bitcoin network by decoding the address (bech32 human-readable
18
+ * part, or base58 version byte) rather than checking a single leading
19
+ * character, which misreads legacy testnet (m/n/2...) and regtest (bcrt1...)
20
+ * addresses as mainnet. Base58 can't distinguish testnet from regtest (they
21
+ * share version bytes), so a base58 testnet-versioned address resolves to
22
+ * networks.testnet. Anything undecodable defaults to mainnet.
6
23
  * @param accountAddress - The Bitcoin address
7
- * @returns The Bitcoin network (mainnet or testnet)
24
+ * @returns The Bitcoin network (mainnet, testnet, or regtest)
8
25
  */
9
- const getBitcoinNetwork = (accountAddress) => accountAddress.startsWith('t') ? networks.testnet : networks.bitcoin;
26
+ const getBitcoinNetwork = (accountAddress) => {
27
+ var _a;
28
+ try {
29
+ return ((_a = networkForBech32Prefix(address.fromBech32(accountAddress).prefix)) !== null && _a !== void 0 ? _a : networks.bitcoin);
30
+ }
31
+ catch (_b) {
32
+ // Not bech32; fall through to base58.
33
+ }
34
+ try {
35
+ const { version } = address.fromBase58Check(accountAddress);
36
+ return version === networks.testnet.pubKeyHash ||
37
+ version === networks.testnet.scriptHash
38
+ ? networks.testnet
39
+ : networks.bitcoin;
40
+ }
41
+ catch (_c) {
42
+ return networks.bitcoin;
43
+ }
44
+ };
10
45
 
11
46
  export { getBitcoinNetwork };
@@ -6,4 +6,5 @@ export { createPsbtOptions } from './psbt/createSignPsbtOptions';
6
6
  export { satoshisToBtc } from './satoshisToBtc';
7
7
  export { btcToSatoshis } from './btcToSatoshis';
8
8
  export { getBitcoinNetwork } from './getBitcoinNetwork';
9
+ export { BITCOIN_MAINNET_CHAIN_ID, BITCOIN_TESTNET_CHAIN_ID, getBitcoinChainId, } from './getBitcoinChainId';
9
10
  export { PsbtParser } from './psbtParser';
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../_virtual/_tslib.cjs');
7
7
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
+ var types = require('@dynamic-labs/types');
8
9
  var getAddressByType = require('../utils/getAddressByType/getAddressByType.cjs');
10
+ var getBitcoinChainId = require('../utils/getBitcoinChainId/getBitcoinChainId.cjs');
9
11
 
10
12
  class BitcoinWallet extends walletConnectorCore.Wallet {
11
13
  /**
@@ -39,6 +41,11 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
39
41
  sendBitcoin(transaction) {
40
42
  return _tslib.__awaiter(this, void 0, void 0, function* () {
41
43
  yield this.sync();
44
+ if (this._connector.transactionScreening) {
45
+ yield this.screenBeforeSigning({
46
+ recipientAddress: transaction.recipientAddress,
47
+ });
48
+ }
42
49
  return this._connector.sendBitcoin(transaction);
43
50
  });
44
51
  }
@@ -51,6 +58,11 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
51
58
  sendBitcoinWithConfirmation(transaction) {
52
59
  return _tslib.__awaiter(this, void 0, void 0, function* () {
53
60
  yield this.sync();
61
+ if (this._connector.transactionScreening) {
62
+ yield this.screenBeforeSigning({
63
+ recipientAddress: transaction.recipientAddress,
64
+ });
65
+ }
54
66
  if (this._connector.sendBitcoinWithConfirmation) {
55
67
  return this._connector.sendBitcoinWithConfirmation(transaction);
56
68
  }
@@ -86,6 +98,9 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
86
98
  signPsbt(request) {
87
99
  return _tslib.__awaiter(this, void 0, void 0, function* () {
88
100
  yield this.sync();
101
+ if (this._connector.transactionScreening) {
102
+ yield this.screenBeforeSigning({ psbt: request.unsignedPsbtBase64 });
103
+ }
89
104
  return this._connector.signPsbt(request);
90
105
  });
91
106
  }
@@ -97,6 +112,9 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
97
112
  signPsbts(requests) {
98
113
  return _tslib.__awaiter(this, void 0, void 0, function* () {
99
114
  yield this.sync();
115
+ if (this._connector.transactionScreening) {
116
+ yield Promise.all(requests.map((request) => this.screenBeforeSigning({ psbt: request.unsignedPsbtBase64 })));
117
+ }
100
118
  return this._connector.signPsbts(requests);
101
119
  });
102
120
  }
@@ -111,6 +129,22 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
111
129
  return this._connector.buildPsbt(transaction);
112
130
  });
113
131
  }
132
+ /**
133
+ * Screens the transaction's destinations before the wallet is prompted to
134
+ * sign. Rejects only on an explicit block (best-effort, fail-open).
135
+ */
136
+ screenBeforeSigning(btcTransaction) {
137
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
138
+ var _a;
139
+ const chainId = getBitcoinChainId.getBitcoinChainId(this.address);
140
+ yield ((_a = this._connector.transactionScreening) === null || _a === void 0 ? void 0 : _a.screenTransaction({
141
+ chain: types.TransactionScreeningChain.BTC,
142
+ chainId,
143
+ context: { btcTransaction: Object.assign({ chainId }, btcTransaction) },
144
+ senderAddress: this.address,
145
+ }));
146
+ });
147
+ }
114
148
  }
115
149
 
116
150
  exports.BitcoinWallet = BitcoinWallet;
@@ -1,5 +1,5 @@
1
1
  import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
- import type { WalletAddressType } from '@dynamic-labs/types';
2
+ import { type WalletAddressType } from '@dynamic-labs/types';
3
3
  import { BitcoinWalletConnector } from '../connectors';
4
4
  import { BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction, EmbeddedWalletSignPsbtRequest } from '../types';
5
5
  export declare class BitcoinWallet extends Wallet<BitcoinWalletConnector> {
@@ -61,4 +61,9 @@ export declare class BitcoinWallet extends Wallet<BitcoinWalletConnector> {
61
61
  * @returns A promise that resolves to a PSBT in Base64 format, or undefined if not supported
62
62
  */
63
63
  buildPsbt(transaction: BitcoinTransaction): Promise<string | undefined>;
64
+ /**
65
+ * Screens the transaction's destinations before the wallet is prompted to
66
+ * sign. Rejects only on an explicit block (best-effort, fail-open).
67
+ */
68
+ private screenBeforeSigning;
64
69
  }
@@ -1,7 +1,9 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
3
  import { Wallet } from '@dynamic-labs/wallet-connector-core';
4
+ import { TransactionScreeningChain } from '@dynamic-labs/types';
4
5
  import { getAddressByType } from '../utils/getAddressByType/getAddressByType.js';
6
+ import { getBitcoinChainId } from '../utils/getBitcoinChainId/getBitcoinChainId.js';
5
7
 
6
8
  class BitcoinWallet extends Wallet {
7
9
  /**
@@ -35,6 +37,11 @@ class BitcoinWallet extends Wallet {
35
37
  sendBitcoin(transaction) {
36
38
  return __awaiter(this, void 0, void 0, function* () {
37
39
  yield this.sync();
40
+ if (this._connector.transactionScreening) {
41
+ yield this.screenBeforeSigning({
42
+ recipientAddress: transaction.recipientAddress,
43
+ });
44
+ }
38
45
  return this._connector.sendBitcoin(transaction);
39
46
  });
40
47
  }
@@ -47,6 +54,11 @@ class BitcoinWallet extends Wallet {
47
54
  sendBitcoinWithConfirmation(transaction) {
48
55
  return __awaiter(this, void 0, void 0, function* () {
49
56
  yield this.sync();
57
+ if (this._connector.transactionScreening) {
58
+ yield this.screenBeforeSigning({
59
+ recipientAddress: transaction.recipientAddress,
60
+ });
61
+ }
50
62
  if (this._connector.sendBitcoinWithConfirmation) {
51
63
  return this._connector.sendBitcoinWithConfirmation(transaction);
52
64
  }
@@ -82,6 +94,9 @@ class BitcoinWallet extends Wallet {
82
94
  signPsbt(request) {
83
95
  return __awaiter(this, void 0, void 0, function* () {
84
96
  yield this.sync();
97
+ if (this._connector.transactionScreening) {
98
+ yield this.screenBeforeSigning({ psbt: request.unsignedPsbtBase64 });
99
+ }
85
100
  return this._connector.signPsbt(request);
86
101
  });
87
102
  }
@@ -93,6 +108,9 @@ class BitcoinWallet extends Wallet {
93
108
  signPsbts(requests) {
94
109
  return __awaiter(this, void 0, void 0, function* () {
95
110
  yield this.sync();
111
+ if (this._connector.transactionScreening) {
112
+ yield Promise.all(requests.map((request) => this.screenBeforeSigning({ psbt: request.unsignedPsbtBase64 })));
113
+ }
96
114
  return this._connector.signPsbts(requests);
97
115
  });
98
116
  }
@@ -107,6 +125,22 @@ class BitcoinWallet extends Wallet {
107
125
  return this._connector.buildPsbt(transaction);
108
126
  });
109
127
  }
128
+ /**
129
+ * Screens the transaction's destinations before the wallet is prompted to
130
+ * sign. Rejects only on an explicit block (best-effort, fail-open).
131
+ */
132
+ screenBeforeSigning(btcTransaction) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ var _a;
135
+ const chainId = getBitcoinChainId(this.address);
136
+ yield ((_a = this._connector.transactionScreening) === null || _a === void 0 ? void 0 : _a.screenTransaction({
137
+ chain: TransactionScreeningChain.BTC,
138
+ chainId,
139
+ context: { btcTransaction: Object.assign({ chainId }, btcTransaction) },
140
+ senderAddress: this.address,
141
+ }));
142
+ });
143
+ }
110
144
  }
111
145
 
112
146
  export { BitcoinWallet };