@dynamic-labs/bitcoin 4.0.0-alpha.47 → 4.0.0-alpha.49

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +7 -7
  5. package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +5 -2
  6. package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.d.ts +5 -2
  7. package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +5 -2
  8. package/src/connectors/BitcoinWalletConnector.cjs +18 -1
  9. package/src/connectors/BitcoinWalletConnector.d.ts +5 -1
  10. package/src/connectors/BitcoinWalletConnector.js +18 -1
  11. package/src/connectors/MagicEdenConnector/MagicEdenConnector.cjs +5 -2
  12. package/src/connectors/MagicEdenConnector/MagicEdenConnector.d.ts +5 -2
  13. package/src/connectors/MagicEdenConnector/MagicEdenConnector.js +5 -2
  14. package/src/connectors/OkxConnector/OkxConnector.cjs +12 -2
  15. package/src/connectors/OkxConnector/OkxConnector.d.ts +5 -2
  16. package/src/connectors/OkxConnector/OkxConnector.js +12 -2
  17. package/src/connectors/OneKeyConnector/OneKeyConnector.cjs +11 -2
  18. package/src/connectors/OneKeyConnector/OneKeyConnector.d.ts +5 -2
  19. package/src/connectors/OneKeyConnector/OneKeyConnector.js +11 -2
  20. package/src/connectors/OylConnector/OylConnector.cjs +5 -2
  21. package/src/connectors/OylConnector/OylConnector.d.ts +5 -2
  22. package/src/connectors/OylConnector/OylConnector.js +5 -2
  23. package/src/connectors/PhantomConnector/PhantomConnector.cjs +4 -3
  24. package/src/connectors/PhantomConnector/PhantomConnector.d.ts +5 -2
  25. package/src/connectors/PhantomConnector/PhantomConnector.js +4 -3
  26. package/src/connectors/UnisatConnector/UnisatConnector.cjs +9 -2
  27. package/src/connectors/UnisatConnector/UnisatConnector.d.ts +5 -2
  28. package/src/connectors/UnisatConnector/UnisatConnector.js +9 -2
  29. package/src/index.d.ts +3 -3
  30. package/src/types.d.ts +1 -0
  31. package/src/utils/getAddressByType/getAddressByType.cjs +11 -0
  32. package/src/utils/getAddressByType/getAddressByType.d.ts +3 -0
  33. package/src/utils/getAddressByType/getAddressByType.js +7 -0
  34. package/src/utils/getAddressByType/index.d.ts +1 -0
  35. package/src/utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.cjs +17 -0
  36. package/src/utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.d.ts +3 -0
  37. package/src/utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.js +13 -0
  38. package/src/utils/getSatsConnectSigningProtocol/index.d.ts +1 -0
  39. package/src/wallet/BitcoinWallet.cjs +12 -5
  40. package/src/wallet/BitcoinWallet.d.ts +8 -3
  41. package/src/wallet/BitcoinWallet.js +12 -5
package/CHANGELOG.md CHANGED
@@ -1,4 +1,40 @@
1
1
 
2
+ ## [4.0.0-alpha.49](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.48...v4.0.0-alpha.49) (2024-12-27)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * change openFunding to openExternalFunding (#7684)
8
+
9
+ ### Features
10
+
11
+ * aa blockaid simulations ([#7583](https://github.com/dynamic-labs/dynamic-auth/issues/7583)) ([6436220](https://github.com/dynamic-labs/dynamic-auth/commit/64362204d2c96291a37bf281d62531d6f2384fdf))
12
+ * add ethereum createConnector function ([#7607](https://github.com/dynamic-labs/dynamic-auth/issues/7607)) ([f306537](https://github.com/dynamic-labs/dynamic-auth/commit/f3065372f3c5dfc8bf26173dc722576e614af5e1))
13
+ * add fundWithExternalWallet method to useFunding ([#7688](https://github.com/dynamic-labs/dynamic-auth/issues/7688)) ([d48b1d2](https://github.com/dynamic-labs/dynamic-auth/commit/d48b1d2568ba928b322a4d81b6386e775ae4aa98))
14
+ * change openFunding to openExternalFunding ([#7684](https://github.com/dynamic-labs/dynamic-auth/issues/7684)) ([8efb9cb](https://github.com/dynamic-labs/dynamic-auth/commit/8efb9cb9ca3d7e2273c14e18f7be5892e50b8e12))
15
+ * connect global wallet in ethereum ([#7619](https://github.com/dynamic-labs/dynamic-auth/issues/7619)) ([fdb7f00](https://github.com/dynamic-labs/dynamic-auth/commit/fdb7f00c33f7da3ac95ae13ac674caa64b453cae))
16
+ * create wallet groups dynamically based on wallet options ([#7662](https://github.com/dynamic-labs/dynamic-auth/issues/7662)) ([981affc](https://github.com/dynamic-labs/dynamic-auth/commit/981affce5518f6532d960fe4e879e9cf40a66ce7))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **ethereum:** normalize user reject error from injected wallets ([#7702](https://github.com/dynamic-labs/dynamic-auth/issues/7702)) ([ce456a8](https://github.com/dynamic-labs/dynamic-auth/commit/ce456a8592197b07857baf32bb1b38867ffb37fe))
22
+ * fetch nonce when authenticating a user that connected in connect-only mode ([#7689](https://github.com/dynamic-labs/dynamic-auth/issues/7689)) ([f048bb9](https://github.com/dynamic-labs/dynamic-auth/commit/f048bb96b6cb5ae603966b2813f900a082cd158f))
23
+ * filter out wallets for the current network when using external wallet funding ([#7694](https://github.com/dynamic-labs/dynamic-auth/issues/7694)) ([65db665](https://github.com/dynamic-labs/dynamic-auth/commit/65db6652a934561e7d07379a65d2baa8f7813d8e))
24
+ * remove toaccount from signmessage and signtypeddata for zerodev ([#7650](https://github.com/dynamic-labs/dynamic-auth/issues/7650)) ([626e849](https://github.com/dynamic-labs/dynamic-auth/commit/626e849a4af3af51d60b42dd2787edb05126744b))
25
+ * save nonce to storage ([#7698](https://github.com/dynamic-labs/dynamic-auth/issues/7698)) ([93dc65b](https://github.com/dynamic-labs/dynamic-auth/commit/93dc65b7f78040367b85420c1374f3cafbfb598b))
26
+ * **sdk-react-core:** add timeout when getting connected accounts ([#7697](https://github.com/dynamic-labs/dynamic-auth/issues/7697)) ([9a4bd7c](https://github.com/dynamic-labs/dynamic-auth/commit/9a4bd7c02795205ec98d8d71aba75b51b9bbee7c))
27
+ * update auth token from new source ([#7666](https://github.com/dynamic-labs/dynamic-auth/issues/7666)) ([61798de](https://github.com/dynamic-labs/dynamic-auth/commit/61798de26d759db9064f5f84118540346a44ab50))
28
+ * update extension update_url endpoint ([#7655](https://github.com/dynamic-labs/dynamic-auth/issues/7655)) ([46cff3a](https://github.com/dynamic-labs/dynamic-auth/commit/46cff3a80c9efee659a764df47f927ed5a117079))
29
+ * zerodev confirmation UI closes properly ([#7664](https://github.com/dynamic-labs/dynamic-auth/issues/7664)) ([a78aded](https://github.com/dynamic-labs/dynamic-auth/commit/a78adedc054d09134198d22812aa5cab7bbff548))
30
+
31
+ ## [4.0.0-alpha.48](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.47...v4.0.0-alpha.48) (2024-12-17)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * Temp disable refreshing blockhash for solana transactions ([#7638](https://github.com/dynamic-labs/dynamic-auth/issues/7638)) ([fd457bf](https://github.com/dynamic-labs/dynamic-auth/commit/fd457bf0579ad35ba17fc2c7aa18a9feb49d8c7b))
37
+
2
38
  ## [4.0.0-alpha.47](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.46...v4.0.0-alpha.47) (2024-12-17)
3
39
 
4
40
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.47";
6
+ var version = "4.0.0-alpha.49";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.47";
2
+ var version = "4.0.0-alpha.49";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/bitcoin",
3
- "version": "4.0.0-alpha.47",
3
+ "version": "4.0.0-alpha.49",
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
  "@btckit/types": "0.0.19",
22
- "@dynamic-labs/sdk-api-core": "0.0.576",
22
+ "@dynamic-labs/sdk-api-core": "0.0.578",
23
23
  "@wallet-standard/app": "1.0.1",
24
24
  "@wallet-standard/base": "1.0.1",
25
25
  "bitcoinjs-lib": "6.1.5",
26
26
  "sats-connect": "2.8.0",
27
27
  "jsontokens": "4.0.1",
28
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.47",
29
- "@dynamic-labs/types": "4.0.0-alpha.47",
30
- "@dynamic-labs/utils": "4.0.0-alpha.47",
31
- "@dynamic-labs/wallet-book": "4.0.0-alpha.47",
32
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.47",
28
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.49",
29
+ "@dynamic-labs/types": "4.0.0-alpha.49",
30
+ "@dynamic-labs/utils": "4.0.0-alpha.49",
31
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.49",
32
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.49",
33
33
  "eventemitter3": "5.0.1"
34
34
  },
35
35
  "peerDependencies": {}
@@ -12,6 +12,7 @@ var bitcoinNetworkTypeToNetworks = require('../../utils/psbt/bitcoinNetworkTypeT
12
12
  var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
13
13
  var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
14
14
  var _const = require('../../const.cjs');
15
+ var getSatsConnectSigningProtocol = require('../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.cjs');
15
16
 
16
17
  class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
17
18
  constructor(opts) {
@@ -89,12 +90,14 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
89
90
  }
90
91
  });
91
92
  }
92
- signMessage(messageToSign, withAddress) {
93
+ signMessage(messageToSign, options) {
93
94
  return _tslib.__awaiter(this, void 0, void 0, function* () {
95
+ const { address, protocol } = options;
94
96
  try {
95
97
  const response = yield satsConnect.request('signMessage', {
96
- address: withAddress,
98
+ address,
97
99
  message: messageToSign,
100
+ protocol: getSatsConnectSigningProtocol.getSatsConnectSigningProtocol(protocol),
98
101
  });
99
102
  if (response.status !== 'success') {
100
103
  throw response.error;
@@ -1,5 +1,5 @@
1
1
  import { BitcoinNetworkType, SignMultipleTransactionsPayload, SignTransactionResponse } from 'sats-connect';
2
- import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
2
+ import { BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
3
3
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
4
4
  export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
5
5
  isLegacy: boolean;
@@ -14,7 +14,10 @@ export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletC
14
14
  */
15
15
  protected handleInAppBrowserGetAddress(): boolean;
16
16
  getAddress(): Promise<string | undefined>;
17
- signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
17
+ signMessage(messageToSign: string, options: {
18
+ address: string;
19
+ protocol?: BitcoinSignProtocol;
20
+ }): Promise<string | undefined>;
18
21
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
19
22
  signTransaction(params: SatsConnectSignTransactionInput): Promise<SignTransactionResponse | undefined>;
20
23
  signTransactions(transactions: SignMultipleTransactionsPayload): Promise<SignTransactionResponse[] | undefined>;
@@ -8,6 +8,7 @@ import { convertNetworkTypeForPsbt } from '../../utils/psbt/bitcoinNetworkTypeTo
8
8
  import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
9
9
  import { createSignPsbtOptionsForSatsConnect } from '../../utils/psbt/createSignPsbtOptions.js';
10
10
  import { SATSCONNECT_FEATURE } from '../../const.js';
11
+ import { getSatsConnectSigningProtocol } from '../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.js';
11
12
 
12
13
  class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
13
14
  constructor(opts) {
@@ -85,12 +86,14 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
85
86
  }
86
87
  });
87
88
  }
88
- signMessage(messageToSign, withAddress) {
89
+ signMessage(messageToSign, options) {
89
90
  return __awaiter(this, void 0, void 0, function* () {
91
+ const { address, protocol } = options;
90
92
  try {
91
93
  const response = yield request('signMessage', {
92
- address: withAddress,
94
+ address,
93
95
  message: messageToSign,
96
+ protocol: getSatsConnectSigningProtocol(protocol),
94
97
  });
95
98
  if (response.status !== 'success') {
96
99
  throw response.error;
@@ -289,9 +289,26 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
289
289
  isLedgerAddress(address) {
290
290
  return utils.isLedgerAddressViaVerifiedCredentials(address, this.verifiedCredentials);
291
291
  }
292
+ // Each wallet has a different supported protocol
293
+ // So we should override this method in each connector
294
+ // and define how to handle the protocol
295
+ signMessage(messageToSign, options) {
296
+ const _super = Object.create(null, {
297
+ signMessage: { get: () => super.signMessage }
298
+ });
299
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
300
+ if (options) {
301
+ walletConnectorCore.logger.debug('[BitcoinWalletConnector] signMessage - Not possible to specify address and/or protocol to sign with', {
302
+ address: options.address,
303
+ protocol: options.protocol,
304
+ });
305
+ }
306
+ return _super.signMessage.call(this, messageToSign);
307
+ });
308
+ }
292
309
  proveOwnership(address, messageToSign) {
293
310
  return _tslib.__awaiter(this, void 0, void 0, function* () {
294
- return this.signMessage(messageToSign, address);
311
+ return this.signMessage(messageToSign, { address });
295
312
  });
296
313
  }
297
314
  }
@@ -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 } from '../types';
7
+ import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinWalletStandardMethods, ConnectedAccountWithAddressesProps, BitcoinSignProtocol } from '../types';
8
8
  import { BitcoinWallet } from '../wallet';
9
9
  export type BitcoinWalletConnectorOpts = {
10
10
  walletBook: WalletBookSchema;
@@ -47,5 +47,9 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
47
47
  setupEventListeners(): void;
48
48
  setVerifiedCredentials(verifiedCredentials: JwtVerifiedCredential[]): void;
49
49
  isLedgerAddress(address: string): boolean;
50
+ signMessage(messageToSign: string, options?: {
51
+ address?: string;
52
+ protocol?: BitcoinSignProtocol;
53
+ }): Promise<string | undefined>;
50
54
  proveOwnership(address: string, messageToSign: string): Promise<string | undefined>;
51
55
  }
@@ -285,9 +285,26 @@ class BitcoinWalletConnector extends WalletConnectorBase {
285
285
  isLedgerAddress(address) {
286
286
  return isLedgerAddressViaVerifiedCredentials(address, this.verifiedCredentials);
287
287
  }
288
+ // Each wallet has a different supported protocol
289
+ // So we should override this method in each connector
290
+ // and define how to handle the protocol
291
+ signMessage(messageToSign, options) {
292
+ const _super = Object.create(null, {
293
+ signMessage: { get: () => super.signMessage }
294
+ });
295
+ return __awaiter(this, void 0, void 0, function* () {
296
+ if (options) {
297
+ logger.debug('[BitcoinWalletConnector] signMessage - Not possible to specify address and/or protocol to sign with', {
298
+ address: options.address,
299
+ protocol: options.protocol,
300
+ });
301
+ }
302
+ return _super.signMessage.call(this, messageToSign);
303
+ });
304
+ }
288
305
  proveOwnership(address, messageToSign) {
289
306
  return __awaiter(this, void 0, void 0, function* () {
290
- return this.signMessage(messageToSign, address);
307
+ return this.signMessage(messageToSign, { address });
291
308
  });
292
309
  }
293
310
  }
@@ -9,6 +9,7 @@ var satsConnect = require('sats-connect');
9
9
  var utils = require('@dynamic-labs/utils');
10
10
  var _const = require('../../const.cjs');
11
11
  var BitcoinSatsConnectConnector = require('../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
12
+ var getSatsConnectSigningProtocol = require('../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.cjs');
12
13
 
13
14
  class MagicEdenConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
14
15
  constructor(opts) {
@@ -57,8 +58,9 @@ class MagicEdenConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectC
57
58
  });
58
59
  });
59
60
  }
60
- signMessage(messageToSign, withAddress) {
61
+ signMessage(messageToSign, options) {
61
62
  return _tslib.__awaiter(this, void 0, void 0, function* () {
63
+ const { address, protocol } = options;
62
64
  return new Promise((resolve, reject) => {
63
65
  satsConnect.signMessage({
64
66
  getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -81,11 +83,12 @@ class MagicEdenConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectC
81
83
  resolve(response);
82
84
  }),
83
85
  payload: {
84
- address: withAddress,
86
+ address,
85
87
  message: messageToSign,
86
88
  network: {
87
89
  type: this.currentNetwork,
88
90
  },
91
+ protocol: getSatsConnectSigningProtocol.getSatsConnectSigningProtocol(protocol),
89
92
  },
90
93
  });
91
94
  });
@@ -1,5 +1,5 @@
1
1
  import { SignMultipleTransactionsPayload, SignTransactionResponse } from 'sats-connect';
2
- import { BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
2
+ import { BitcoinSignProtocol, BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
3
3
  import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector';
4
4
  import { BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
5
5
  export declare class MagicEdenConnector extends BitcoinSatsConnectConnector {
@@ -8,7 +8,10 @@ export declare class MagicEdenConnector extends BitcoinSatsConnectConnector {
8
8
  isLegacy: boolean;
9
9
  constructor(opts: BitcoinWalletConnectorOpts);
10
10
  getAddress(): Promise<string | undefined>;
11
- signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
11
+ signMessage(messageToSign: string, options: {
12
+ address: string;
13
+ protocol?: BitcoinSignProtocol;
14
+ }): Promise<string | undefined>;
12
15
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
13
16
  signTransaction(params: SatsConnectSignTransactionInput): Promise<SignTransactionResponse | undefined>;
14
17
  /**
@@ -5,6 +5,7 @@ import { getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransa
5
5
  import { DynamicError } from '@dynamic-labs/utils';
6
6
  import { SATSCONNECT_FEATURE } from '../../const.js';
7
7
  import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
8
+ import { getSatsConnectSigningProtocol } from '../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.js';
8
9
 
9
10
  class MagicEdenConnector extends BitcoinSatsConnectConnector {
10
11
  constructor(opts) {
@@ -53,8 +54,9 @@ class MagicEdenConnector extends BitcoinSatsConnectConnector {
53
54
  });
54
55
  });
55
56
  }
56
- signMessage(messageToSign, withAddress) {
57
+ signMessage(messageToSign, options) {
57
58
  return __awaiter(this, void 0, void 0, function* () {
59
+ const { address, protocol } = options;
58
60
  return new Promise((resolve, reject) => {
59
61
  signMessage({
60
62
  getProvider: () => __awaiter(this, void 0, void 0, function* () {
@@ -77,11 +79,12 @@ class MagicEdenConnector extends BitcoinSatsConnectConnector {
77
79
  resolve(response);
78
80
  }),
79
81
  payload: {
80
- address: withAddress,
82
+ address,
81
83
  message: messageToSign,
82
84
  network: {
83
85
  type: this.currentNetwork,
84
86
  },
87
+ protocol: getSatsConnectSigningProtocol(protocol),
85
88
  },
86
89
  });
87
90
  });
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../_virtual/_tslib.cjs');
7
7
  var bitcoinjsLib = require('bitcoinjs-lib');
8
8
  var utils = require('@dynamic-labs/utils');
9
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
10
  var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
10
11
  var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
11
12
 
@@ -45,13 +46,22 @@ class OkxConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
45
46
  return address;
46
47
  });
47
48
  }
48
- signMessage(messageToSign) {
49
+ signMessage(messageToSign, options) {
49
50
  return _tslib.__awaiter(this, void 0, void 0, function* () {
51
+ var _a;
50
52
  const provider = this.getProvider();
51
53
  if (!provider) {
52
54
  return;
53
55
  }
54
- return provider.signMessage(messageToSign, 'bip322-simple');
56
+ // default to bip322-simple
57
+ const protocol = (_a = options === null || options === void 0 ? void 0 : options.protocol) !== null && _a !== void 0 ? _a : 'bip322-simple';
58
+ if (options === null || options === void 0 ? void 0 : options.address) {
59
+ walletConnectorCore.logger.debug('[OkxConnector] signMessage - Not possible to specify address to sign with', {
60
+ address: options.address,
61
+ protocol,
62
+ });
63
+ }
64
+ return provider.signMessage(messageToSign, protocol);
55
65
  });
56
66
  }
57
67
  sendBitcoin(transaction) {
@@ -1,10 +1,13 @@
1
1
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
2
- import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
2
+ import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinSignProtocol } from '../../types';
3
3
  export declare class OkxConnector extends BitcoinWalletConnector {
4
4
  name: string;
5
5
  constructor(opts: BitcoinWalletConnectorOpts);
6
6
  getAddress(): Promise<string | undefined>;
7
- signMessage(messageToSign: string): Promise<string | undefined>;
7
+ signMessage(messageToSign: string, options?: {
8
+ address?: string;
9
+ protocol?: BitcoinSignProtocol;
10
+ }): Promise<string | undefined>;
8
11
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
9
12
  signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
10
13
  signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
@@ -2,6 +2,7 @@
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { Psbt } from 'bitcoinjs-lib';
4
4
  import { isMobile, template } from '@dynamic-labs/utils';
5
+ import { logger } from '@dynamic-labs/wallet-connector-core';
5
6
  import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
6
7
  import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
7
8
 
@@ -41,13 +42,22 @@ class OkxConnector extends BitcoinWalletConnector {
41
42
  return address;
42
43
  });
43
44
  }
44
- signMessage(messageToSign) {
45
+ signMessage(messageToSign, options) {
45
46
  return __awaiter(this, void 0, void 0, function* () {
47
+ var _a;
46
48
  const provider = this.getProvider();
47
49
  if (!provider) {
48
50
  return;
49
51
  }
50
- return provider.signMessage(messageToSign, 'bip322-simple');
52
+ // default to bip322-simple
53
+ const protocol = (_a = options === null || options === void 0 ? void 0 : options.protocol) !== null && _a !== void 0 ? _a : 'bip322-simple';
54
+ if (options === null || options === void 0 ? void 0 : options.address) {
55
+ logger.debug('[OkxConnector] signMessage - Not possible to specify address to sign with', {
56
+ address: options.address,
57
+ protocol,
58
+ });
59
+ }
60
+ return provider.signMessage(messageToSign, protocol);
51
61
  });
52
62
  }
53
63
  sendBitcoin(transaction) {
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../_virtual/_tslib.cjs');
7
7
  var bitcoinjsLib = require('bitcoinjs-lib');
8
8
  var utils = require('@dynamic-labs/utils');
9
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
10
  var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
10
11
  var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
11
12
 
@@ -54,13 +55,21 @@ class OneKeyConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
54
55
  return provider.getAccounts();
55
56
  });
56
57
  }
57
- signMessage(messageToSign) {
58
+ signMessage(messageToSign, options) {
58
59
  return _tslib.__awaiter(this, void 0, void 0, function* () {
60
+ var _a;
59
61
  const provider = this.getProvider();
60
62
  if (!provider) {
61
63
  return;
62
64
  }
63
- return provider.signMessage(messageToSign, 'ecdsa');
65
+ // default to ecdsa
66
+ const protocol = (_a = options === null || options === void 0 ? void 0 : options.protocol) !== null && _a !== void 0 ? _a : 'ecdsa';
67
+ if (options === null || options === void 0 ? void 0 : options.address) {
68
+ walletConnectorCore.logger.debug('[OneKeyConnector] signMessage - Not possible to specify address to sign with', {
69
+ address: options.address,
70
+ });
71
+ }
72
+ return provider.signMessage(messageToSign, protocol);
64
73
  });
65
74
  }
66
75
  sendBitcoin(transaction) {
@@ -1,11 +1,14 @@
1
1
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
2
- import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
2
+ import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinSignProtocol } from '../../types';
3
3
  export declare class OneKeyConnector extends BitcoinWalletConnector {
4
4
  name: string;
5
5
  constructor(opts: BitcoinWalletConnectorOpts);
6
6
  getAddress(): Promise<string | undefined>;
7
7
  getConnectedAccounts(): Promise<string[]>;
8
- signMessage(messageToSign: string): Promise<string | undefined>;
8
+ signMessage(messageToSign: string, options?: {
9
+ address?: string;
10
+ protocol?: BitcoinSignProtocol;
11
+ }): Promise<string | undefined>;
9
12
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
10
13
  signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
11
14
  signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
@@ -2,6 +2,7 @@
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { Psbt } from 'bitcoinjs-lib';
4
4
  import { isMobile, template } from '@dynamic-labs/utils';
5
+ import { logger } from '@dynamic-labs/wallet-connector-core';
5
6
  import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
6
7
  import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
7
8
 
@@ -50,13 +51,21 @@ class OneKeyConnector extends BitcoinWalletConnector {
50
51
  return provider.getAccounts();
51
52
  });
52
53
  }
53
- signMessage(messageToSign) {
54
+ signMessage(messageToSign, options) {
54
55
  return __awaiter(this, void 0, void 0, function* () {
56
+ var _a;
55
57
  const provider = this.getProvider();
56
58
  if (!provider) {
57
59
  return;
58
60
  }
59
- return provider.signMessage(messageToSign, 'ecdsa');
61
+ // default to ecdsa
62
+ const protocol = (_a = options === null || options === void 0 ? void 0 : options.protocol) !== null && _a !== void 0 ? _a : 'ecdsa';
63
+ if (options === null || options === void 0 ? void 0 : options.address) {
64
+ logger.debug('[OneKeyConnector] signMessage - Not possible to specify address to sign with', {
65
+ address: options.address,
66
+ });
67
+ }
68
+ return provider.signMessage(messageToSign, protocol);
60
69
  });
61
70
  }
62
71
  sendBitcoin(transaction) {
@@ -34,15 +34,18 @@ class OylConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
34
34
  return mainAddress;
35
35
  });
36
36
  }
37
- signMessage(messageToSign, withAddress) {
37
+ signMessage(messageToSign, options) {
38
38
  return _tslib.__awaiter(this, void 0, void 0, function* () {
39
+ const { address, protocol } = options;
39
40
  const provider = this.getProvider();
40
41
  if (!provider) {
41
42
  return;
42
43
  }
43
44
  const { signature } = yield provider.signMessage({
44
- address: withAddress,
45
+ address,
45
46
  message: messageToSign,
47
+ // Oyl Wallet calls it just bip322 instead of bip322-simple
48
+ protocol: protocol === 'bip322-simple' ? 'bip322' : protocol,
46
49
  });
47
50
  return signature;
48
51
  });
@@ -1,10 +1,13 @@
1
1
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
2
- import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
2
+ import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinSignProtocol } from '../../types';
3
3
  export declare class OylConnector extends BitcoinWalletConnector {
4
4
  name: string;
5
5
  overrideKey: string;
6
6
  constructor(opts: BitcoinWalletConnectorOpts);
7
7
  getAddress(): Promise<string | undefined>;
8
- signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
8
+ signMessage(messageToSign: string, options: {
9
+ address: string;
10
+ protocol?: BitcoinSignProtocol;
11
+ }): Promise<string | undefined>;
9
12
  signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
10
13
  }
@@ -30,15 +30,18 @@ class OylConnector extends BitcoinWalletConnector {
30
30
  return mainAddress;
31
31
  });
32
32
  }
33
- signMessage(messageToSign, withAddress) {
33
+ signMessage(messageToSign, options) {
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
+ const { address, protocol } = options;
35
36
  const provider = this.getProvider();
36
37
  if (!provider) {
37
38
  return;
38
39
  }
39
40
  const { signature } = yield provider.signMessage({
40
- address: withAddress,
41
+ address,
41
42
  message: messageToSign,
43
+ // Oyl Wallet calls it just bip322 instead of bip322-simple
44
+ protocol: protocol === 'bip322-simple' ? 'bip322' : protocol,
42
45
  });
43
46
  return signature;
44
47
  });
@@ -67,13 +67,14 @@ class PhantomConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
67
67
  return undefined;
68
68
  });
69
69
  }
70
- signMessage(messageToSign, withAddress) {
70
+ signMessage(messageToSign, options) {
71
71
  return _tslib.__awaiter(this, void 0, void 0, function* () {
72
72
  var _a;
73
+ const { address } = options;
73
74
  if ((_a = this.walletMethods) === null || _a === void 0 ? void 0 : _a.signMessage) {
74
75
  const [result] = yield this.walletMethods.signMessage({
75
76
  // we need to sign with the ordinals account
76
- account: { address: withAddress },
77
+ account: { address },
77
78
  message: new TextEncoder().encode(messageToSign),
78
79
  });
79
80
  return Buffer.from(result.signature).toString('base64');
@@ -83,7 +84,7 @@ class PhantomConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
83
84
  if (!provider) {
84
85
  return;
85
86
  }
86
- const result = yield provider.signMessage(withAddress, new TextEncoder().encode(messageToSign));
87
+ const result = yield provider.signMessage(address, new TextEncoder().encode(messageToSign));
87
88
  return Buffer.from(result.signature).toString('base64');
88
89
  }
89
90
  });
@@ -1,10 +1,13 @@
1
- import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
1
+ import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinSignProtocol } from '../../types';
2
2
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
3
3
  export declare class PhantomConnector extends BitcoinWalletConnector {
4
4
  name: string;
5
5
  constructor(opts: BitcoinWalletConnectorOpts);
6
6
  private connectWithInstalledExtension;
7
7
  getAddress(): Promise<string | undefined>;
8
- signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
8
+ signMessage(messageToSign: string, options: {
9
+ address: string;
10
+ protocol?: BitcoinSignProtocol;
11
+ }): Promise<string | undefined>;
9
12
  signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
10
13
  }
@@ -63,13 +63,14 @@ class PhantomConnector extends BitcoinWalletConnector {
63
63
  return undefined;
64
64
  });
65
65
  }
66
- signMessage(messageToSign, withAddress) {
66
+ signMessage(messageToSign, options) {
67
67
  return __awaiter(this, void 0, void 0, function* () {
68
68
  var _a;
69
+ const { address } = options;
69
70
  if ((_a = this.walletMethods) === null || _a === void 0 ? void 0 : _a.signMessage) {
70
71
  const [result] = yield this.walletMethods.signMessage({
71
72
  // we need to sign with the ordinals account
72
- account: { address: withAddress },
73
+ account: { address },
73
74
  message: new TextEncoder().encode(messageToSign),
74
75
  });
75
76
  return Buffer.from(result.signature).toString('base64');
@@ -79,7 +80,7 @@ class PhantomConnector extends BitcoinWalletConnector {
79
80
  if (!provider) {
80
81
  return;
81
82
  }
82
- const result = yield provider.signMessage(withAddress, new TextEncoder().encode(messageToSign));
83
+ const result = yield provider.signMessage(address, new TextEncoder().encode(messageToSign));
83
84
  return Buffer.from(result.signature).toString('base64');
84
85
  }
85
86
  });
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../_virtual/_tslib.cjs');
7
7
  var bitcoinjsLib = require('bitcoinjs-lib');
8
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
9
  var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
9
10
  var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
10
11
 
@@ -34,13 +35,19 @@ class UnisatConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
34
35
  return address;
35
36
  });
36
37
  }
37
- signMessage(messageToSign) {
38
+ signMessage(messageToSign, options) {
38
39
  return _tslib.__awaiter(this, void 0, void 0, function* () {
39
40
  const provider = this.getProvider();
40
41
  if (!provider) {
41
42
  return;
42
43
  }
43
- return provider.signMessage(messageToSign, 'bip322-simple');
44
+ if (options === null || options === void 0 ? void 0 : options.address) {
45
+ walletConnectorCore.logger.debug('[UnisatConnector] signMessage - Not possible to specify address to sign with', {
46
+ address: options.address,
47
+ protocol: options.protocol,
48
+ });
49
+ }
50
+ return provider.signMessage(messageToSign, options === null || options === void 0 ? void 0 : options.protocol);
44
51
  });
45
52
  }
46
53
  sendBitcoin(transaction) {
@@ -1,11 +1,14 @@
1
1
  import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
2
- import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
2
+ import { BitcoinTransaction, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinSignProtocol } from '../../types';
3
3
  export declare class UnisatConnector extends BitcoinWalletConnector {
4
4
  name: string;
5
5
  overrideKey: string;
6
6
  constructor(opts: BitcoinWalletConnectorOpts);
7
7
  getAddress(): Promise<string | undefined>;
8
- signMessage(messageToSign: string): Promise<string | undefined>;
8
+ signMessage(messageToSign: string, options?: {
9
+ address?: string;
10
+ protocol?: BitcoinSignProtocol;
11
+ }): Promise<string | undefined>;
9
12
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
10
13
  signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
11
14
  signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { Psbt } from 'bitcoinjs-lib';
4
+ import { logger } from '@dynamic-labs/wallet-connector-core';
4
5
  import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
5
6
  import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
6
7
 
@@ -30,13 +31,19 @@ class UnisatConnector extends BitcoinWalletConnector {
30
31
  return address;
31
32
  });
32
33
  }
33
- signMessage(messageToSign) {
34
+ signMessage(messageToSign, options) {
34
35
  return __awaiter(this, void 0, void 0, function* () {
35
36
  const provider = this.getProvider();
36
37
  if (!provider) {
37
38
  return;
38
39
  }
39
- return provider.signMessage(messageToSign, 'bip322-simple');
40
+ if (options === null || options === void 0 ? void 0 : options.address) {
41
+ logger.debug('[UnisatConnector] signMessage - Not possible to specify address to sign with', {
42
+ address: options.address,
43
+ protocol: options.protocol,
44
+ });
45
+ }
46
+ return provider.signMessage(messageToSign, options === null || options === void 0 ? void 0 : options.protocol);
40
47
  });
41
48
  }
42
49
  sendBitcoin(transaction) {
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { OkxConnector, OylConnector, PhantomConnector } from './connectors';
1
+ import { OkxConnector } from './connectors';
2
2
  export { BitcoinWalletConnector } from './connectors';
3
- export type { BitcoinTransaction } from './types';
3
+ export type { BitcoinTransaction, BitcoinSignProtocol } from './types';
4
4
  export * from './utils';
5
5
  export * from './wallet';
6
- export declare const BitcoinWalletConnectors: (props: any) => (import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor | typeof PhantomConnector | typeof OkxConnector | typeof OylConnector)[];
6
+ export declare const BitcoinWalletConnectors: (props: any) => (import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor | typeof OkxConnector)[];
package/src/types.d.ts CHANGED
@@ -128,3 +128,4 @@ export type BitcoinWalletStandardMethods = {
128
128
  signTransaction?: BitcoinSignTransactionMethod;
129
129
  signAndSendTransaction?: BitcoinSignAndSendTransactionMethod;
130
130
  };
131
+ export type BitcoinSignProtocol = 'ecdsa' | 'bip322-simple';
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const getAddressByType = (wallet, addressType) => {
7
+ var _a;
8
+ return ((_a = wallet.additionalAddresses.find((addr) => addr.type === addressType)) === null || _a === void 0 ? void 0 : _a.address) || wallet.address;
9
+ };
10
+
11
+ exports.getAddressByType = getAddressByType;
@@ -0,0 +1,3 @@
1
+ import { WalletAddressType } from '@dynamic-labs/types';
2
+ import { BitcoinWallet } from '../../wallet/BitcoinWallet';
3
+ export declare const getAddressByType: (wallet: BitcoinWallet, addressType: WalletAddressType) => string;
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ const getAddressByType = (wallet, addressType) => {
3
+ var _a;
4
+ return ((_a = wallet.additionalAddresses.find((addr) => addr.type === addressType)) === null || _a === void 0 ? void 0 : _a.address) || wallet.address;
5
+ };
6
+
7
+ export { getAddressByType };
@@ -0,0 +1 @@
1
+ export { getAddressByType } from './getAddressByType';
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var satsConnect = require('sats-connect');
7
+
8
+ const getSatsConnectSigningProtocol = (protocol) => {
9
+ if (!protocol) {
10
+ return undefined;
11
+ }
12
+ return protocol === 'ecdsa'
13
+ ? satsConnect.MessageSigningProtocols.ECDSA
14
+ : satsConnect.MessageSigningProtocols.BIP322;
15
+ };
16
+
17
+ exports.getSatsConnectSigningProtocol = getSatsConnectSigningProtocol;
@@ -0,0 +1,3 @@
1
+ import { MessageSigningProtocols } from 'sats-connect';
2
+ import { BitcoinSignProtocol } from '../../types';
3
+ export declare const getSatsConnectSigningProtocol: (protocol: BitcoinSignProtocol | undefined) => MessageSigningProtocols | undefined;
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ import { MessageSigningProtocols } from 'sats-connect';
3
+
4
+ const getSatsConnectSigningProtocol = (protocol) => {
5
+ if (!protocol) {
6
+ return undefined;
7
+ }
8
+ return protocol === 'ecdsa'
9
+ ? MessageSigningProtocols.ECDSA
10
+ : MessageSigningProtocols.BIP322;
11
+ };
12
+
13
+ export { getSatsConnectSigningProtocol };
@@ -0,0 +1 @@
1
+ export * from './getSatsConnectSigningProtocol';
@@ -5,6 +5,7 @@ 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 getAddressByType = require('../utils/getAddressByType/getAddressByType.cjs');
8
9
 
9
10
  class BitcoinWallet extends walletConnectorCore.Wallet {
10
11
  /**
@@ -44,16 +45,22 @@ class BitcoinWallet extends walletConnectorCore.Wallet {
44
45
  /**
45
46
  * Signs a message using a specific address type (payment or ordinals).
46
47
  * @param messageToSign - The message to sign.
47
- * @param addressType - The type of address to sign the message with (payment or ordinals).
48
+ * @param options - Optional configuration for signing
49
+ * @param options.addressType - The type of address to sign with (e.g. 'payment' or 'ordinals')
50
+ * @param options.protocol - The signing protocol to use (e.g. 'ecdsa' or 'bip322-simple')
48
51
  * @returns A promise that resolves to the signature of the message as a string,
49
52
  * or undefined if the message cannot be signed.
50
53
  */
51
- signMessageWithAddress(messageToSign, addressType) {
54
+ signMessage(messageToSign, options) {
52
55
  return _tslib.__awaiter(this, void 0, void 0, function* () {
53
- var _a;
54
56
  yield this.sync();
55
- const address = ((_a = this.additionalAddresses.find((addr) => addr.type === addressType)) === null || _a === void 0 ? void 0 : _a.address) || this.address;
56
- return this._connector.signMessage(messageToSign, address);
57
+ const address = (options === null || options === void 0 ? void 0 : options.addressType)
58
+ ? getAddressByType.getAddressByType(this, options.addressType)
59
+ : this.address;
60
+ return this._connector.signMessage(messageToSign, {
61
+ address,
62
+ protocol: options === null || options === void 0 ? void 0 : options.protocol,
63
+ });
57
64
  });
58
65
  }
59
66
  /**
@@ -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 { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } from '../types';
4
+ import { BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } 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.
@@ -26,11 +26,16 @@ export declare class BitcoinWallet extends Wallet<BitcoinWalletConnector> {
26
26
  /**
27
27
  * Signs a message using a specific address type (payment or ordinals).
28
28
  * @param messageToSign - The message to sign.
29
- * @param addressType - The type of address to sign the message with (payment or ordinals).
29
+ * @param options - Optional configuration for signing
30
+ * @param options.addressType - The type of address to sign with (e.g. 'payment' or 'ordinals')
31
+ * @param options.protocol - The signing protocol to use (e.g. 'ecdsa' or 'bip322-simple')
30
32
  * @returns A promise that resolves to the signature of the message as a string,
31
33
  * or undefined if the message cannot be signed.
32
34
  */
33
- signMessageWithAddress(messageToSign: string, addressType: WalletAddressType): Promise<string | undefined>;
35
+ signMessage(messageToSign: string, options?: {
36
+ addressType?: WalletAddressType;
37
+ protocol?: BitcoinSignProtocol;
38
+ }): Promise<string | undefined>;
34
39
  /**
35
40
  * Sings a PSBT
36
41
  * @returns A promise that resolves to an object with the signed PSBT
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
3
  import { Wallet } from '@dynamic-labs/wallet-connector-core';
4
+ import { getAddressByType } from '../utils/getAddressByType/getAddressByType.js';
4
5
 
5
6
  class BitcoinWallet extends Wallet {
6
7
  /**
@@ -40,16 +41,22 @@ class BitcoinWallet extends Wallet {
40
41
  /**
41
42
  * Signs a message using a specific address type (payment or ordinals).
42
43
  * @param messageToSign - The message to sign.
43
- * @param addressType - The type of address to sign the message with (payment or ordinals).
44
+ * @param options - Optional configuration for signing
45
+ * @param options.addressType - The type of address to sign with (e.g. 'payment' or 'ordinals')
46
+ * @param options.protocol - The signing protocol to use (e.g. 'ecdsa' or 'bip322-simple')
44
47
  * @returns A promise that resolves to the signature of the message as a string,
45
48
  * or undefined if the message cannot be signed.
46
49
  */
47
- signMessageWithAddress(messageToSign, addressType) {
50
+ signMessage(messageToSign, options) {
48
51
  return __awaiter(this, void 0, void 0, function* () {
49
- var _a;
50
52
  yield this.sync();
51
- const address = ((_a = this.additionalAddresses.find((addr) => addr.type === addressType)) === null || _a === void 0 ? void 0 : _a.address) || this.address;
52
- return this._connector.signMessage(messageToSign, address);
53
+ const address = (options === null || options === void 0 ? void 0 : options.addressType)
54
+ ? getAddressByType(this, options.addressType)
55
+ : this.address;
56
+ return this._connector.signMessage(messageToSign, {
57
+ address,
58
+ protocol: options === null || options === void 0 ? void 0 : options.protocol,
59
+ });
53
60
  });
54
61
  }
55
62
  /**