@dynamic-labs/bitcoin 4.0.0-alpha.13 → 4.0.0-alpha.15

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,8 @@
1
1
 
2
+ ## [4.0.0-alpha.15](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.14...v4.0.0-alpha.15) (2024-10-19)
3
+
4
+ ## [4.0.0-alpha.14](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.13...v4.0.0-alpha.14) (2024-10-18)
5
+
2
6
  ## [4.0.0-alpha.13](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.12...v4.0.0-alpha.13) (2024-10-18)
3
7
 
4
8
 
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.13";
6
+ var version = "4.0.0-alpha.15";
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.13";
2
+ var version = "4.0.0-alpha.15";
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.13",
3
+ "version": "4.0.0-alpha.15",
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,16 +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.547",
22
+ "@dynamic-labs/sdk-api-core": "0.0.549",
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
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.13",
28
- "@dynamic-labs/types": "4.0.0-alpha.13",
29
- "@dynamic-labs/utils": "4.0.0-alpha.13",
30
- "@dynamic-labs/wallet-book": "4.0.0-alpha.13",
31
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.13",
27
+ "jsontokens": "4.0.1",
28
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.15",
29
+ "@dynamic-labs/types": "4.0.0-alpha.15",
30
+ "@dynamic-labs/utils": "4.0.0-alpha.15",
31
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.15",
32
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.15",
32
33
  "eventemitter3": "5.0.1"
33
34
  },
34
35
  "peerDependencies": {}
@@ -52,22 +52,30 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
52
52
  return mainAddress;
53
53
  });
54
54
  }
55
+ /**
56
+ * If is inAppBrowser experience, redirects to the inAppBrowser template.
57
+ * Returns true if redirection was triggered.
58
+ */
59
+ handleInAppBrowserGetAddress() {
60
+ var _a;
61
+ const wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
62
+ const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
63
+ if (!utils.isMobile() ||
64
+ this.isInstalledOnBrowser() ||
65
+ !inAppBrowserUrl ||
66
+ this.mobileExperience !== 'in-app-browser')
67
+ return false;
68
+ const inAppBrowserTemplate = utils.template(inAppBrowserUrl);
69
+ const deepLink = inAppBrowserTemplate({
70
+ encodedDappURI: encodeURIComponent(window.location.toString()),
71
+ });
72
+ window.location.href = deepLink;
73
+ return true;
74
+ }
55
75
  getAddress() {
56
76
  return _tslib.__awaiter(this, void 0, void 0, function* () {
57
- var _a;
58
- const wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
59
- const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
60
- if (utils.isMobile() &&
61
- !this.isInstalledOnBrowser() &&
62
- inAppBrowserUrl &&
63
- this.mobileExperience === 'in-app-browser') {
64
- const inAppBrowserTemplate = utils.template(inAppBrowserUrl);
65
- const deepLink = inAppBrowserTemplate({
66
- encodedDappURI: encodeURIComponent(window.location.toString()),
67
- });
68
- window.location.href = deepLink;
77
+ if (this.handleInAppBrowserGetAddress())
69
78
  return;
70
- }
71
79
  try {
72
80
  // requesting permissions on initial connect will avoid connection prompt for other requests
73
81
  const permissionResponse = yield satsConnect.request('wallet_requestPermissions', undefined);
@@ -8,6 +8,11 @@ export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletC
8
8
  constructor(opts: BitcoinWalletConnectorOpts);
9
9
  private getGenericUserCancelledError;
10
10
  private getAddresses;
11
+ /**
12
+ * If is inAppBrowser experience, redirects to the inAppBrowser template.
13
+ * Returns true if redirection was triggered.
14
+ */
15
+ protected handleInAppBrowserGetAddress(): boolean;
11
16
  getAddress(): Promise<string | undefined>;
12
17
  signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
13
18
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
@@ -48,22 +48,30 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
48
48
  return mainAddress;
49
49
  });
50
50
  }
51
+ /**
52
+ * If is inAppBrowser experience, redirects to the inAppBrowser template.
53
+ * Returns true if redirection was triggered.
54
+ */
55
+ handleInAppBrowserGetAddress() {
56
+ var _a;
57
+ const wallet = findWalletBookWallet(this.walletBook, this.key);
58
+ const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
59
+ if (!isMobile() ||
60
+ this.isInstalledOnBrowser() ||
61
+ !inAppBrowserUrl ||
62
+ this.mobileExperience !== 'in-app-browser')
63
+ return false;
64
+ const inAppBrowserTemplate = template(inAppBrowserUrl);
65
+ const deepLink = inAppBrowserTemplate({
66
+ encodedDappURI: encodeURIComponent(window.location.toString()),
67
+ });
68
+ window.location.href = deepLink;
69
+ return true;
70
+ }
51
71
  getAddress() {
52
72
  return __awaiter(this, void 0, void 0, function* () {
53
- var _a;
54
- const wallet = findWalletBookWallet(this.walletBook, this.key);
55
- const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
56
- if (isMobile() &&
57
- !this.isInstalledOnBrowser() &&
58
- inAppBrowserUrl &&
59
- this.mobileExperience === 'in-app-browser') {
60
- const inAppBrowserTemplate = template(inAppBrowserUrl);
61
- const deepLink = inAppBrowserTemplate({
62
- encodedDappURI: encodeURIComponent(window.location.toString()),
63
- });
64
- window.location.href = deepLink;
73
+ if (this.handleInAppBrowserGetAddress())
65
74
  return;
66
- }
67
75
  try {
68
76
  // requesting permissions on initial connect will avoid connection prompt for other requests
69
77
  const permissionResponse = yield request('wallet_requestPermissions', undefined);
@@ -4,46 +4,29 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var jsontokens = require('jsontokens');
7
8
  var satsConnect = require('sats-connect');
8
9
  var utils = require('@dynamic-labs/utils');
9
- var walletBook = require('@dynamic-labs/wallet-book');
10
10
  var _const = require('../../const.cjs');
11
11
  require('bitcoinjs-lib');
12
12
  require('@dynamic-labs/wallet-connector-core');
13
+ require('@dynamic-labs/wallet-book');
13
14
  require('@dynamic-labs/sdk-api-core');
14
15
  require('@wallet-standard/app');
15
16
  var BitcoinSatsConnectConnector = require('../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
16
17
  var supportsSatsConnect = require('../../utils/supportsSatsConnect.cjs');
17
18
 
18
- class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
19
- constructor() {
20
- super(...arguments);
19
+ class MagicEdenConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
20
+ constructor(opts) {
21
+ super(Object.assign(Object.assign({}, opts), { overrideKey: 'magicedenbtc' }));
22
+ this.name = 'Magic Eden';
23
+ this.overrideKey = 'magicedenbtc';
21
24
  this.isLegacy = true;
22
25
  }
23
26
  getAddress() {
24
27
  return _tslib.__awaiter(this, void 0, void 0, function* () {
25
- var _a;
26
- // xverse doesn't support wallet standard, so we won't have a wallet object,
27
- // but it's already the default provider for sats-connect, so it's ok
28
- // for getProvider in getAddress to return undefined
29
- // if we're not using xverse, we need to check if there is a wallet and
30
- // that it has the satsconnect feature to return the correct provider to use
31
- if (!supportsSatsConnect.supportsSatsConnect(this)) {
28
+ if (this.handleInAppBrowserGetAddress())
32
29
  return;
33
- }
34
- const wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
35
- const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
36
- if (utils.isMobile() &&
37
- !this.isInstalledOnBrowser() &&
38
- inAppBrowserUrl &&
39
- this.mobileExperience === 'in-app-browser') {
40
- const inAppBrowserTemplate = utils.template(inAppBrowserUrl);
41
- const deepLink = inAppBrowserTemplate({
42
- encodedDappURI: encodeURIComponent(window.location.toString()),
43
- });
44
- window.location.href = deepLink;
45
- return;
46
- }
47
30
  return new Promise((resolve, reject) => {
48
31
  satsConnect.getAddress({
49
32
  getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -185,32 +168,22 @@ class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector.Bitc
185
168
  });
186
169
  });
187
170
  }
171
+ /**
172
+ * Uses the custom Magic Eden signTransactions feature to sign multiple transactions
173
+ */
188
174
  signTransactions(transactions) {
189
175
  return _tslib.__awaiter(this, void 0, void 0, function* () {
190
- const { message, psbts, network } = transactions;
191
- return new Promise((resolve, reject) => {
192
- satsConnect.signMultipleTransactions({
193
- getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
194
- var _a, _b;
195
- return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[_const.SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
196
- }),
197
- onCancel: () => {
198
- const error = new Error();
199
- error.code = '-32000'; // error code for user cancelled
200
- reject(error);
201
- },
202
- onFinish: (response) => {
203
- resolve(response);
204
- },
205
- payload: {
206
- message: message || 'Sign Transaction',
207
- network,
208
- psbts,
209
- },
210
- });
211
- });
176
+ var _a;
177
+ (_a = transactions.message) !== null && _a !== void 0 ? _a : (transactions.message = 'Sign Transaction');
178
+ const request = jsontokens.createUnsecuredToken(transactions);
179
+ // Magic Eden has implemented their own signTransactions feature, and have requested us
180
+ // to ensure we use it rather than the general Sats Connect API for this method
181
+ const provider = this.getProvider();
182
+ if (!provider)
183
+ throw new utils.DynamicError('signTransactions failed: Magic Eden provider not found');
184
+ return provider.signMultipleTransactions(request);
212
185
  });
213
186
  }
214
187
  }
215
188
 
216
- exports.BitcoinSatsConnectLegacyConnector = BitcoinSatsConnectLegacyConnector;
189
+ exports.MagicEdenConnector = MagicEdenConnector;
@@ -1,11 +1,18 @@
1
1
  import { SignMultipleTransactionsPayload, SignTransactionResponse } from 'sats-connect';
2
2
  import { BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
3
3
  import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector';
4
- export declare abstract class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector {
4
+ import { BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
5
+ export declare class MagicEdenConnector extends BitcoinSatsConnectConnector {
6
+ name: string;
7
+ overrideKey: string;
5
8
  isLegacy: boolean;
9
+ constructor(opts: BitcoinWalletConnectorOpts);
6
10
  getAddress(): Promise<string | undefined>;
7
11
  signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
8
12
  sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
9
13
  signTransaction(params: SatsConnectSignTransactionInput): Promise<SignTransactionResponse | undefined>;
14
+ /**
15
+ * Uses the custom Magic Eden signTransactions feature to sign multiple transactions
16
+ */
10
17
  signTransactions(transactions: SignMultipleTransactionsPayload): Promise<SignTransactionResponse[] | undefined>;
11
18
  }
@@ -1,45 +1,28 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
- import { getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransaction, signMultipleTransactions } from 'sats-connect';
4
- import { isMobile, template } from '@dynamic-labs/utils';
5
- import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
3
+ import { createUnsecuredToken } from 'jsontokens';
4
+ import { getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransaction } from 'sats-connect';
5
+ import { DynamicError } from '@dynamic-labs/utils';
6
6
  import { SATSCONNECT_FEATURE } from '../../const.js';
7
7
  import 'bitcoinjs-lib';
8
8
  import '@dynamic-labs/wallet-connector-core';
9
+ import '@dynamic-labs/wallet-book';
9
10
  import '@dynamic-labs/sdk-api-core';
10
11
  import '@wallet-standard/app';
11
12
  import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
12
13
  import { supportsSatsConnect } from '../../utils/supportsSatsConnect.js';
13
14
 
14
- class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector {
15
- constructor() {
16
- super(...arguments);
15
+ class MagicEdenConnector extends BitcoinSatsConnectConnector {
16
+ constructor(opts) {
17
+ super(Object.assign(Object.assign({}, opts), { overrideKey: 'magicedenbtc' }));
18
+ this.name = 'Magic Eden';
19
+ this.overrideKey = 'magicedenbtc';
17
20
  this.isLegacy = true;
18
21
  }
19
22
  getAddress() {
20
23
  return __awaiter(this, void 0, void 0, function* () {
21
- var _a;
22
- // xverse doesn't support wallet standard, so we won't have a wallet object,
23
- // but it's already the default provider for sats-connect, so it's ok
24
- // for getProvider in getAddress to return undefined
25
- // if we're not using xverse, we need to check if there is a wallet and
26
- // that it has the satsconnect feature to return the correct provider to use
27
- if (!supportsSatsConnect(this)) {
24
+ if (this.handleInAppBrowserGetAddress())
28
25
  return;
29
- }
30
- const wallet = findWalletBookWallet(this.walletBook, this.key);
31
- const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
32
- if (isMobile() &&
33
- !this.isInstalledOnBrowser() &&
34
- inAppBrowserUrl &&
35
- this.mobileExperience === 'in-app-browser') {
36
- const inAppBrowserTemplate = template(inAppBrowserUrl);
37
- const deepLink = inAppBrowserTemplate({
38
- encodedDappURI: encodeURIComponent(window.location.toString()),
39
- });
40
- window.location.href = deepLink;
41
- return;
42
- }
43
26
  return new Promise((resolve, reject) => {
44
27
  getAddress({
45
28
  getProvider: () => __awaiter(this, void 0, void 0, function* () {
@@ -181,32 +164,22 @@ class BitcoinSatsConnectLegacyConnector extends BitcoinSatsConnectConnector {
181
164
  });
182
165
  });
183
166
  }
167
+ /**
168
+ * Uses the custom Magic Eden signTransactions feature to sign multiple transactions
169
+ */
184
170
  signTransactions(transactions) {
185
171
  return __awaiter(this, void 0, void 0, function* () {
186
- const { message, psbts, network } = transactions;
187
- return new Promise((resolve, reject) => {
188
- signMultipleTransactions({
189
- getProvider: () => __awaiter(this, void 0, void 0, function* () {
190
- var _a, _b;
191
- return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
192
- }),
193
- onCancel: () => {
194
- const error = new Error();
195
- error.code = '-32000'; // error code for user cancelled
196
- reject(error);
197
- },
198
- onFinish: (response) => {
199
- resolve(response);
200
- },
201
- payload: {
202
- message: message || 'Sign Transaction',
203
- network,
204
- psbts,
205
- },
206
- });
207
- });
172
+ var _a;
173
+ (_a = transactions.message) !== null && _a !== void 0 ? _a : (transactions.message = 'Sign Transaction');
174
+ const request = createUnsecuredToken(transactions);
175
+ // Magic Eden has implemented their own signTransactions feature, and have requested us
176
+ // to ensure we use it rather than the general Sats Connect API for this method
177
+ const provider = this.getProvider();
178
+ if (!provider)
179
+ throw new DynamicError('signTransactions failed: Magic Eden provider not found');
180
+ return provider.signMultipleTransactions(request);
208
181
  });
209
182
  }
210
183
  }
211
184
 
212
- export { BitcoinSatsConnectLegacyConnector };
185
+ export { MagicEdenConnector };
@@ -0,0 +1 @@
1
+ export { MagicEdenConnector } from './MagicEdenConnector';
@@ -1,7 +1,7 @@
1
1
  export * from './BitcoinWalletConnector';
2
2
  export * from './BitcoinBtcKitConnector';
3
3
  export * from './BitcoinSatsConnectConnector';
4
- export * from './BitcoinSatsConnectLegacyConnector';
4
+ export * from './MagicEdenConnector';
5
5
  export * from './PhantomConnector';
6
6
  export * from './OkxConnector';
7
7
  export * from './OylConnector';
package/src/index.cjs CHANGED
@@ -12,17 +12,18 @@ require('bitcoinjs-lib');
12
12
  require('@dynamic-labs/wallet-connector-core');
13
13
  require('@dynamic-labs/utils');
14
14
  require('@dynamic-labs/wallet-book');
15
- var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
16
- var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
17
- var hasSatsConnectFeature = require('./utils/hasSatsConnectFeature.cjs');
18
- var supportsSatsConnect = require('./utils/supportsSatsConnect.cjs');
19
- var getMempoolApiUrl = require('./utils/getMempoolApiUrl.cjs');
15
+ var MagicEdenConnector = require('./connectors/MagicEdenConnector/MagicEdenConnector.cjs');
20
16
  var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.cjs');
21
17
  var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
22
18
  var OylConnector = require('./connectors/OylConnector/OylConnector.cjs');
23
19
  var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
24
20
  var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
25
21
  var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
22
+ var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
23
+ var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
24
+ var hasSatsConnectFeature = require('./utils/hasSatsConnectFeature.cjs');
25
+ var supportsSatsConnect = require('./utils/supportsSatsConnect.cjs');
26
+ var getMempoolApiUrl = require('./utils/getMempoolApiUrl.cjs');
26
27
  var BitcoinWallet = require('./wallet/BitcoinWallet.cjs');
27
28
  var isBitcoinWallet = require('./wallet/isBitcoinWallet/isBitcoinWallet.cjs');
28
29
 
@@ -30,6 +31,7 @@ assertPackageVersion.assertPackageVersion('@dynamic-labs/bitcoin', _package.vers
30
31
  const BitcoinWalletConnectors = (props) => [
31
32
  ...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
32
33
  ...fetchBtcKitConnectors.fetchBtcKitConnectors(props),
34
+ MagicEdenConnector.MagicEdenConnector,
33
35
  PhantomConnector.PhantomConnector,
34
36
  OkxConnector.OkxConnector,
35
37
  OylConnector.OylConnector,
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OkxConnector, PhantomConnector, OylConnector } from './connectors';
1
+ import { OkxConnector, OylConnector, PhantomConnector } from './connectors';
2
2
  export { BitcoinWalletConnector } from './connectors';
3
3
  export type { BitcoinTransaction } from './types';
4
4
  export * from './utils';
package/src/index.js CHANGED
@@ -8,6 +8,13 @@ import 'bitcoinjs-lib';
8
8
  import '@dynamic-labs/wallet-connector-core';
9
9
  import '@dynamic-labs/utils';
10
10
  import '@dynamic-labs/wallet-book';
11
+ import { MagicEdenConnector } from './connectors/MagicEdenConnector/MagicEdenConnector.js';
12
+ import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
13
+ import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
14
+ import { OylConnector } from './connectors/OylConnector/OylConnector.js';
15
+ import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
16
+ import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
17
+ import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
11
18
  import { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
12
19
  export { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
13
20
  import { fetchSatsConnectConnectors } from './utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js';
@@ -15,12 +22,6 @@ export { fetchSatsConnectConnectors } from './utils/fetchSatsConnectConnectors/f
15
22
  export { hasSatsConnectFeature } from './utils/hasSatsConnectFeature.js';
16
23
  export { supportsSatsConnect } from './utils/supportsSatsConnect.js';
17
24
  export { getMempoolApiUrl } from './utils/getMempoolApiUrl.js';
18
- import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
19
- import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
20
- import { OylConnector } from './connectors/OylConnector/OylConnector.js';
21
- import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
22
- import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
23
- import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
24
25
  export { BitcoinWallet } from './wallet/BitcoinWallet.js';
25
26
  export { isBitcoinWallet } from './wallet/isBitcoinWallet/isBitcoinWallet.js';
26
27
 
@@ -28,6 +29,7 @@ assertPackageVersion('@dynamic-labs/bitcoin', version);
28
29
  const BitcoinWalletConnectors = (props) => [
29
30
  ...fetchSatsConnectConnectors(props),
30
31
  ...fetchBtcKitConnectors(props),
32
+ MagicEdenConnector,
31
33
  PhantomConnector,
32
34
  OkxConnector,
33
35
  OylConnector,
@@ -3,7 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _const = require('../../const.cjs');
7
6
  require('../../../_virtual/_tslib.cjs');
8
7
  require('sats-connect');
9
8
  require('@dynamic-labs/wallet-connector-core');
@@ -11,9 +10,10 @@ require('@dynamic-labs/wallet-book');
11
10
  require('@dynamic-labs/utils');
12
11
  require('@dynamic-labs/sdk-api-core');
13
12
  require('@wallet-standard/app');
13
+ var _const = require('../../const.cjs');
14
14
  require('bitcoinjs-lib');
15
15
  var BitcoinSatsConnectConnector = require('../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
16
- var BitcoinSatsConnectLegacyConnector = require('../../connectors/BitcoinSatsConnectLegacyConnector/BitcoinSatsConnectLegacyConnector.cjs');
16
+ require('jsontokens');
17
17
 
18
18
  const fetchSatsConnectConnectors = ({ walletBook, }) => {
19
19
  var _a;
@@ -22,26 +22,16 @@ const fetchSatsConnectConnectors = ({ walletBook, }) => {
22
22
  .filter(([_, wallet]) => {
23
23
  var _a;
24
24
  return (_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => {
25
- var _a;
25
+ var _a, _b;
26
26
  return config.chain === 'btc' &&
27
- Boolean((_a = config.walletStandard) === null || _a === void 0 ? void 0 : _a.features.includes(_const.SATSCONNECT_FEATURE));
27
+ ((_a = config.walletStandard) === null || _a === void 0 ? void 0 : _a.features.includes(_const.SATSCONNECT_FEATURE)) &&
28
+ ((_b = config.walletStandard) === null || _b === void 0 ? void 0 : _b.providerId);
28
29
  });
29
30
  })
30
31
  .map(([key, wallet]) => {
31
- var _a;
32
- const { shortName, injectedConfig } = wallet;
32
+ const { shortName } = wallet;
33
33
  const name = shortName || wallet.name;
34
- // if has providerId, use the new connector (xverse)
35
- if ((_a = injectedConfig === null || injectedConfig === void 0 ? void 0 : injectedConfig[0].walletStandard) === null || _a === void 0 ? void 0 : _a.providerId) {
36
- return class extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
37
- constructor(props) {
38
- super(Object.assign(Object.assign({}, props), { overrideKey: key, walletData: wallet }));
39
- this.name = name;
40
- }
41
- };
42
- }
43
- // id doesn't have providerId, use the legacy connector (magiceden)
44
- return class extends BitcoinSatsConnectLegacyConnector.BitcoinSatsConnectLegacyConnector {
34
+ return class extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
45
35
  constructor(props) {
46
36
  super(Object.assign(Object.assign({}, props), { overrideKey: key, walletData: wallet }));
47
37
  this.name = name;
@@ -1,5 +1,5 @@
1
- import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
1
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
2
+ import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
3
3
  export declare const fetchSatsConnectConnectors: ({ walletBook, }: {
4
4
  walletBook: WalletBookSchema;
5
5
  }) => WalletConnectorConstructor[];
@@ -1,5 +1,4 @@
1
1
  'use client'
2
- import { SATSCONNECT_FEATURE } from '../../const.js';
3
2
  import '../../../_virtual/_tslib.js';
4
3
  import 'sats-connect';
5
4
  import '@dynamic-labs/wallet-connector-core';
@@ -7,9 +6,10 @@ import '@dynamic-labs/wallet-book';
7
6
  import '@dynamic-labs/utils';
8
7
  import '@dynamic-labs/sdk-api-core';
9
8
  import '@wallet-standard/app';
9
+ import { SATSCONNECT_FEATURE } from '../../const.js';
10
10
  import 'bitcoinjs-lib';
11
11
  import { BitcoinSatsConnectConnector } from '../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
12
- import { BitcoinSatsConnectLegacyConnector } from '../../connectors/BitcoinSatsConnectLegacyConnector/BitcoinSatsConnectLegacyConnector.js';
12
+ import 'jsontokens';
13
13
 
14
14
  const fetchSatsConnectConnectors = ({ walletBook, }) => {
15
15
  var _a;
@@ -18,26 +18,16 @@ const fetchSatsConnectConnectors = ({ walletBook, }) => {
18
18
  .filter(([_, wallet]) => {
19
19
  var _a;
20
20
  return (_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => {
21
- var _a;
21
+ var _a, _b;
22
22
  return config.chain === 'btc' &&
23
- Boolean((_a = config.walletStandard) === null || _a === void 0 ? void 0 : _a.features.includes(SATSCONNECT_FEATURE));
23
+ ((_a = config.walletStandard) === null || _a === void 0 ? void 0 : _a.features.includes(SATSCONNECT_FEATURE)) &&
24
+ ((_b = config.walletStandard) === null || _b === void 0 ? void 0 : _b.providerId);
24
25
  });
25
26
  })
26
27
  .map(([key, wallet]) => {
27
- var _a;
28
- const { shortName, injectedConfig } = wallet;
28
+ const { shortName } = wallet;
29
29
  const name = shortName || wallet.name;
30
- // if has providerId, use the new connector (xverse)
31
- if ((_a = injectedConfig === null || injectedConfig === void 0 ? void 0 : injectedConfig[0].walletStandard) === null || _a === void 0 ? void 0 : _a.providerId) {
32
- return class extends BitcoinSatsConnectConnector {
33
- constructor(props) {
34
- super(Object.assign(Object.assign({}, props), { overrideKey: key, walletData: wallet }));
35
- this.name = name;
36
- }
37
- };
38
- }
39
- // id doesn't have providerId, use the legacy connector (magiceden)
40
- return class extends BitcoinSatsConnectLegacyConnector {
30
+ return class extends BitcoinSatsConnectConnector {
41
31
  constructor(props) {
42
32
  super(Object.assign(Object.assign({}, props), { overrideKey: key, walletData: wallet }));
43
33
  this.name = name;
@@ -12,6 +12,7 @@ require('bitcoinjs-lib');
12
12
  require('@dynamic-labs/wallet-connector-core');
13
13
  require('@dynamic-labs/sdk-api-core');
14
14
  require('@wallet-standard/app');
15
+ require('jsontokens');
15
16
  var hasSatsConnectFeature = require('./hasSatsConnectFeature.cjs');
16
17
 
17
18
  const supportsSatsConnect = (connector) => {
@@ -8,6 +8,7 @@ import 'bitcoinjs-lib';
8
8
  import '@dynamic-labs/wallet-connector-core';
9
9
  import '@dynamic-labs/sdk-api-core';
10
10
  import '@wallet-standard/app';
11
+ import 'jsontokens';
11
12
  import { hasSatsConnectFeature } from './hasSatsConnectFeature.js';
12
13
 
13
14
  const supportsSatsConnect = (connector) => {
@@ -1 +0,0 @@
1
- export { BitcoinSatsConnectLegacyConnector } from './BitcoinSatsConnectLegacyConnector';