@dynamic-labs/bitcoin 4.0.0-alpha.4 → 4.0.0-alpha.40
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 +349 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +9 -15
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +65 -15
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.d.ts +8 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +67 -17
- package/src/connectors/BitcoinWalletConnector.cjs +11 -5
- package/src/connectors/BitcoinWalletConnector.d.ts +3 -2
- package/src/connectors/BitcoinWalletConnector.js +13 -7
- package/src/connectors/{BitcoinSatsConnectLegacyConnector/BitcoinSatsConnectLegacyConnector.cjs → MagicEdenConnector/MagicEdenConnector.cjs} +21 -57
- package/src/connectors/{BitcoinSatsConnectLegacyConnector/BitcoinSatsConnectLegacyConnector.d.ts → MagicEdenConnector/MagicEdenConnector.d.ts} +8 -1
- package/src/connectors/{BitcoinSatsConnectLegacyConnector/BitcoinSatsConnectLegacyConnector.js → MagicEdenConnector/MagicEdenConnector.js} +23 -59
- package/src/connectors/MagicEdenConnector/index.d.ts +1 -0
- package/src/connectors/OkxConnector/OkxConnector.cjs +3 -6
- package/src/connectors/OkxConnector/OkxConnector.d.ts +0 -1
- package/src/connectors/OkxConnector/OkxConnector.js +3 -6
- package/src/connectors/OylConnector/OylConnector.cjs +68 -0
- package/src/connectors/OylConnector/OylConnector.d.ts +10 -0
- package/src/connectors/OylConnector/OylConnector.js +64 -0
- package/src/connectors/OylConnector/index.d.ts +1 -0
- package/src/connectors/PhantomConnector/PhantomConnector.cjs +1 -7
- package/src/connectors/PhantomConnector/PhantomConnector.d.ts +1 -2
- package/src/connectors/PhantomConnector/PhantomConnector.js +1 -7
- package/src/connectors/index.d.ts +2 -2
- package/src/const.cjs +0 -2
- package/src/const.js +1 -2
- package/src/index.cjs +11 -9
- package/src/index.d.ts +2 -2
- package/src/index.js +11 -8
- package/src/utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs +7 -17
- package/src/utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.d.ts +1 -1
- package/src/utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js +7 -17
- package/src/utils/index.d.ts +0 -1
- package/src/connectors/BitcoinSatsConnectLegacyConnector/index.d.ts +0 -1
- package/src/connectors/UnknownInjected/UnknownInjected.cjs +0 -43
- package/src/connectors/UnknownInjected/UnknownInjected.d.ts +0 -11
- package/src/connectors/UnknownInjected/UnknownInjected.js +0 -39
- package/src/connectors/UnknownInjected/index.d.ts +0 -1
- package/src/utils/supportsSatsConnect.cjs +0 -32
- package/src/utils/supportsSatsConnect.d.ts +0 -2
- package/src/utils/supportsSatsConnect.js +0 -28
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { Psbt } from 'bitcoinjs-lib';
|
|
4
|
+
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
5
|
+
import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
6
|
+
|
|
7
|
+
class OylConnector extends BitcoinWalletConnector {
|
|
8
|
+
constructor(opts) {
|
|
9
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'oylwallet' }));
|
|
10
|
+
this.name = 'Oyl Wallet';
|
|
11
|
+
this.overrideKey = 'oylwallet';
|
|
12
|
+
}
|
|
13
|
+
getAddress() {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
var _a;
|
|
16
|
+
const provider = this.getProvider();
|
|
17
|
+
if (!provider) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const addresses = yield provider.getAddresses();
|
|
21
|
+
const ordinalsAddress = addresses.taproot;
|
|
22
|
+
const paymentAddress = addresses.nativeSegwit;
|
|
23
|
+
const mainAddress = (_a = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _a !== void 0 ? _a : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
24
|
+
yield this.setConnectedAccountWithAddresses({
|
|
25
|
+
active: true,
|
|
26
|
+
mainAddress,
|
|
27
|
+
ordinalsAddress,
|
|
28
|
+
paymentAddress,
|
|
29
|
+
});
|
|
30
|
+
return mainAddress;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
signMessage(messageToSign, withAddress) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const provider = this.getProvider();
|
|
36
|
+
if (!provider) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const { signature } = yield provider.signMessage({
|
|
40
|
+
address: withAddress,
|
|
41
|
+
message: messageToSign,
|
|
42
|
+
});
|
|
43
|
+
return signature;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
signPsbt(request) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const provider = this.getProvider();
|
|
49
|
+
if (!provider) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const psbtFromBase64 = Psbt.fromBase64(request.unsignedPsbtBase64);
|
|
53
|
+
const options = createPsbtOptions(psbtFromBase64, request);
|
|
54
|
+
const { psbt: signedPsbtHex } = yield provider.signPsbt({
|
|
55
|
+
broadcast: false,
|
|
56
|
+
finalize: options.autoFinalized,
|
|
57
|
+
psbt: psbtFromBase64.toHex(),
|
|
58
|
+
});
|
|
59
|
+
return { signedPsbt: Psbt.fromHex(signedPsbtHex).toBase64() };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { OylConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OylConnector } from './OylConnector';
|
|
@@ -5,10 +5,10 @@ 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');
|
|
9
8
|
var utils = require('@dynamic-labs/utils');
|
|
10
9
|
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
11
10
|
var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('sats-connect');
|
|
13
13
|
var sighashNumberToString = require('../../utils/psbt/sighashNumberToString.cjs');
|
|
14
14
|
var base64 = require('../../utils/base64.cjs');
|
|
@@ -88,12 +88,6 @@ class PhantomConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
sendBitcoin(transaction) {
|
|
92
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
walletConnectorCore.logger.debug('sendBitcoin - function not implemented', transaction);
|
|
94
|
-
return undefined;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
91
|
signPsbt(request) {
|
|
98
92
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
99
93
|
var _a, _b, _c, _d, _e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
|
|
2
2
|
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
3
3
|
export declare class PhantomConnector extends BitcoinWalletConnector {
|
|
4
4
|
name: string;
|
|
@@ -6,6 +6,5 @@ export declare class PhantomConnector extends BitcoinWalletConnector {
|
|
|
6
6
|
private connectWithInstalledExtension;
|
|
7
7
|
getAddress(): Promise<string | undefined>;
|
|
8
8
|
signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
|
|
9
|
-
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
10
9
|
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
11
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
5
4
|
import { isMobile, handleMobileWalletRedirect } from '@dynamic-labs/utils';
|
|
6
5
|
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
7
6
|
import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'sats-connect';
|
|
9
9
|
import { sighashNumberToString } from '../../utils/psbt/sighashNumberToString.js';
|
|
10
10
|
import { decodeBase64, encodeBase64 } from '../../utils/base64.js';
|
|
@@ -84,12 +84,6 @@ class PhantomConnector extends BitcoinWalletConnector {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
sendBitcoin(transaction) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
logger.debug('sendBitcoin - function not implemented', transaction);
|
|
90
|
-
return undefined;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
87
|
signPsbt(request) {
|
|
94
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
89
|
var _a, _b, _c, _d, _e;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './BitcoinWalletConnector';
|
|
2
2
|
export * from './BitcoinBtcKitConnector';
|
|
3
3
|
export * from './BitcoinSatsConnectConnector';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './MagicEdenConnector';
|
|
5
5
|
export * from './PhantomConnector';
|
|
6
6
|
export * from './OkxConnector';
|
|
7
|
+
export * from './OylConnector';
|
|
7
8
|
export * from './UnisatConnector';
|
|
8
|
-
export * from './UnknownInjected';
|
|
9
9
|
export * from './FallbackBitcoinConnector';
|
package/src/const.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
const XVERSE_KEY = 'xverse';
|
|
7
6
|
const SATSCONNECT_FEATURE = 'sats-connect:';
|
|
8
7
|
const BTCKIT_INTERFACE = 'btckit';
|
|
9
8
|
const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
|
|
@@ -17,4 +16,3 @@ exports.HTTP_STATUS_TOO_MANY_REQUESTS = HTTP_STATUS_TOO_MANY_REQUESTS;
|
|
|
17
16
|
exports.MEMPOOL_API_URL = MEMPOOL_API_URL;
|
|
18
17
|
exports.MEMPOOL_API_URL_TESTNET = MEMPOOL_API_URL_TESTNET;
|
|
19
18
|
exports.SATSCONNECT_FEATURE = SATSCONNECT_FEATURE;
|
|
20
|
-
exports.XVERSE_KEY = XVERSE_KEY;
|
package/src/const.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
const XVERSE_KEY = 'xverse';
|
|
3
2
|
const SATSCONNECT_FEATURE = 'sats-connect:';
|
|
4
3
|
const BTCKIT_INTERFACE = 'btckit';
|
|
5
4
|
const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
|
|
@@ -7,4 +6,4 @@ const HTTP_STATUS_NOT_FOUND = 404;
|
|
|
7
6
|
const MEMPOOL_API_URL = 'https://mempool.space/api';
|
|
8
7
|
const MEMPOOL_API_URL_TESTNET = 'https://mempool.space/testnet/api';
|
|
9
8
|
|
|
10
|
-
export { BTCKIT_INTERFACE, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_TOO_MANY_REQUESTS, MEMPOOL_API_URL, MEMPOOL_API_URL_TESTNET, SATSCONNECT_FEATURE
|
|
9
|
+
export { BTCKIT_INTERFACE, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_TOO_MANY_REQUESTS, MEMPOOL_API_URL, MEMPOOL_API_URL_TESTNET, SATSCONNECT_FEATURE };
|
package/src/index.cjs
CHANGED
|
@@ -3,33 +3,36 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var assertPackageVersion = require('@dynamic-labs/assert-package-version');
|
|
7
|
+
var _package = require('../package.cjs');
|
|
6
8
|
var BitcoinWalletConnector = require('./connectors/BitcoinWalletConnector.cjs');
|
|
7
9
|
require('../_virtual/_tslib.cjs');
|
|
8
10
|
require('sats-connect');
|
|
9
11
|
require('bitcoinjs-lib');
|
|
10
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
13
|
require('@dynamic-labs/utils');
|
|
12
|
-
require('
|
|
13
|
-
var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
|
|
14
|
-
var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
|
|
15
|
-
var hasSatsConnectFeature = require('./utils/hasSatsConnectFeature.cjs');
|
|
16
|
-
var supportsSatsConnect = require('./utils/supportsSatsConnect.cjs');
|
|
17
|
-
var getMempoolApiUrl = require('./utils/getMempoolApiUrl.cjs');
|
|
14
|
+
var MagicEdenConnector = require('./connectors/MagicEdenConnector/MagicEdenConnector.cjs');
|
|
18
15
|
var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.cjs');
|
|
19
16
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
17
|
+
var OylConnector = require('./connectors/OylConnector/OylConnector.cjs');
|
|
20
18
|
var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
|
|
21
|
-
var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
|
|
22
19
|
var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
|
|
20
|
+
var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
|
|
21
|
+
var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
|
|
22
|
+
var hasSatsConnectFeature = require('./utils/hasSatsConnectFeature.cjs');
|
|
23
|
+
var getMempoolApiUrl = require('./utils/getMempoolApiUrl.cjs');
|
|
23
24
|
var BitcoinWallet = require('./wallet/BitcoinWallet.cjs');
|
|
24
25
|
var isBitcoinWallet = require('./wallet/isBitcoinWallet/isBitcoinWallet.cjs');
|
|
25
26
|
|
|
27
|
+
assertPackageVersion.assertPackageVersion('@dynamic-labs/bitcoin', _package.version);
|
|
26
28
|
const BitcoinWalletConnectors = (props) => [
|
|
27
29
|
...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
|
|
28
30
|
...fetchBtcKitConnectors.fetchBtcKitConnectors(props),
|
|
31
|
+
MagicEdenConnector.MagicEdenConnector,
|
|
29
32
|
PhantomConnector.PhantomConnector,
|
|
30
33
|
OkxConnector.OkxConnector,
|
|
34
|
+
OylConnector.OylConnector,
|
|
31
35
|
UnisatConnector.UnisatConnector,
|
|
32
|
-
UnknownInjected.UnknownInjectedConnector,
|
|
33
36
|
FallbackBitcoinConnector.FallbackBitcoinConnector,
|
|
34
37
|
];
|
|
35
38
|
|
|
@@ -37,7 +40,6 @@ exports.BitcoinWalletConnector = BitcoinWalletConnector.BitcoinWalletConnector;
|
|
|
37
40
|
exports.fetchBtcKitConnectors = fetchBtcKitConnectors.fetchBtcKitConnectors;
|
|
38
41
|
exports.fetchSatsConnectConnectors = fetchSatsConnectConnectors.fetchSatsConnectConnectors;
|
|
39
42
|
exports.hasSatsConnectFeature = hasSatsConnectFeature.hasSatsConnectFeature;
|
|
40
|
-
exports.supportsSatsConnect = supportsSatsConnect.supportsSatsConnect;
|
|
41
43
|
exports.getMempoolApiUrl = getMempoolApiUrl.getMempoolApiUrl;
|
|
42
44
|
exports.BitcoinWallet = BitcoinWallet.BitcoinWallet;
|
|
43
45
|
exports.isBitcoinWallet = isBitcoinWallet.isBitcoinWallet;
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OkxConnector,
|
|
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';
|
|
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
|
|
6
|
+
export declare const BitcoinWalletConnectors: (props: any) => (import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor | typeof PhantomConnector | typeof OkxConnector | typeof OylConnector)[];
|
package/src/index.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
|
|
3
|
+
import { version } from '../package.js';
|
|
2
4
|
export { BitcoinWalletConnector } from './connectors/BitcoinWalletConnector.js';
|
|
3
5
|
import '../_virtual/_tslib.js';
|
|
4
6
|
import 'sats-connect';
|
|
5
7
|
import 'bitcoinjs-lib';
|
|
6
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
9
|
import '@dynamic-labs/utils';
|
|
8
|
-
import '
|
|
10
|
+
import { MagicEdenConnector } from './connectors/MagicEdenConnector/MagicEdenConnector.js';
|
|
11
|
+
import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
|
|
12
|
+
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
13
|
+
import { OylConnector } from './connectors/OylConnector/OylConnector.js';
|
|
14
|
+
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
15
|
+
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
9
16
|
import { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
10
17
|
export { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
11
18
|
import { fetchSatsConnectConnectors } from './utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js';
|
|
12
19
|
export { fetchSatsConnectConnectors } from './utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js';
|
|
13
20
|
export { hasSatsConnectFeature } from './utils/hasSatsConnectFeature.js';
|
|
14
|
-
export { supportsSatsConnect } from './utils/supportsSatsConnect.js';
|
|
15
21
|
export { getMempoolApiUrl } from './utils/getMempoolApiUrl.js';
|
|
16
|
-
import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
|
|
17
|
-
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
18
|
-
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
19
|
-
import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
|
|
20
|
-
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
21
22
|
export { BitcoinWallet } from './wallet/BitcoinWallet.js';
|
|
22
23
|
export { isBitcoinWallet } from './wallet/isBitcoinWallet/isBitcoinWallet.js';
|
|
23
24
|
|
|
25
|
+
assertPackageVersion('@dynamic-labs/bitcoin', version);
|
|
24
26
|
const BitcoinWalletConnectors = (props) => [
|
|
25
27
|
...fetchSatsConnectConnectors(props),
|
|
26
28
|
...fetchBtcKitConnectors(props),
|
|
29
|
+
MagicEdenConnector,
|
|
27
30
|
PhantomConnector,
|
|
28
31
|
OkxConnector,
|
|
32
|
+
OylConnector,
|
|
29
33
|
UnisatConnector,
|
|
30
|
-
UnknownInjectedConnector,
|
|
31
34
|
FallbackBitcoinConnector,
|
|
32
35
|
];
|
|
33
36
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
const { shortName, injectedConfig } = wallet;
|
|
32
|
+
const { shortName } = wallet;
|
|
33
33
|
const name = shortName || wallet.name;
|
|
34
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
28
|
-
const { shortName, injectedConfig } = wallet;
|
|
28
|
+
const { shortName } = wallet;
|
|
29
29
|
const name = shortName || wallet.name;
|
|
30
|
-
|
|
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;
|
package/src/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './fetchBtcKitConnectors';
|
|
2
2
|
export * from './fetchSatsConnectConnectors';
|
|
3
3
|
export { hasSatsConnectFeature } from './hasSatsConnectFeature';
|
|
4
|
-
export { supportsSatsConnect } from './supportsSatsConnect';
|
|
5
4
|
export { getMempoolApiUrl } from './getMempoolApiUrl';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BitcoinSatsConnectLegacyConnector } from './BitcoinSatsConnectLegacyConnector';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
-
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
8
|
-
|
|
9
|
-
class UnknownInjectedConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
10
|
-
constructor(opts) {
|
|
11
|
-
super(Object.assign(Object.assign({}, opts), { overrideKey: 'unknown' }));
|
|
12
|
-
this.name = 'Unknown';
|
|
13
|
-
this.overrideKey = 'unknown';
|
|
14
|
-
}
|
|
15
|
-
getAddress() {
|
|
16
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
return;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
signPsbt(
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
_request) {
|
|
23
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
signPsbts(
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
-
_requests) {
|
|
30
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
sendBitcoin(
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
-
_transaction) {
|
|
37
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
return;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
exports.UnknownInjectedConnector = UnknownInjectedConnector;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } from '../../types';
|
|
2
|
-
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
3
|
-
export declare class UnknownInjectedConnector extends BitcoinWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
overrideKey: string;
|
|
6
|
-
constructor(opts: BitcoinWalletConnectorOpts);
|
|
7
|
-
getAddress(): Promise<string | undefined>;
|
|
8
|
-
signPsbt(_request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
9
|
-
signPsbts(_requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
10
|
-
sendBitcoin(_transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
11
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
-
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
4
|
-
|
|
5
|
-
class UnknownInjectedConnector extends BitcoinWalletConnector {
|
|
6
|
-
constructor(opts) {
|
|
7
|
-
super(Object.assign(Object.assign({}, opts), { overrideKey: 'unknown' }));
|
|
8
|
-
this.name = 'Unknown';
|
|
9
|
-
this.overrideKey = 'unknown';
|
|
10
|
-
}
|
|
11
|
-
getAddress() {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
return;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
signPsbt(
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
|
-
_request) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
signPsbts(
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
_requests) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
return;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
sendBitcoin(
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
_transaction) {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
return;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { UnknownInjectedConnector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { UnknownInjectedConnector } from './UnknownInjected';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
var _const = require('../const.cjs');
|
|
8
|
-
require('@dynamic-labs/utils');
|
|
9
|
-
require('../../_virtual/_tslib.cjs');
|
|
10
|
-
require('sats-connect');
|
|
11
|
-
require('bitcoinjs-lib');
|
|
12
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
-
require('@dynamic-labs/sdk-api-core');
|
|
14
|
-
require('@wallet-standard/app');
|
|
15
|
-
var hasSatsConnectFeature = require('./hasSatsConnectFeature.cjs');
|
|
16
|
-
|
|
17
|
-
const supportsSatsConnect = (connector) => {
|
|
18
|
-
var _a, _b, _c, _d;
|
|
19
|
-
if (connector.key === _const.XVERSE_KEY) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
// Grabbing the wallet standard from the fallback wallet
|
|
23
|
-
// due to wallet standard not being available on mobile
|
|
24
|
-
const fallbackWalletWalletStandard = (_c = (_b = (_a = walletBook.findWalletBookWallet(connector.walletBook, connector.key)) === null || _a === void 0 ? void 0 : _a.injectedConfig) === null || _b === void 0 ? void 0 : _b.find((config) => config.chain === 'btc')) === null || _c === void 0 ? void 0 : _c.walletStandard;
|
|
25
|
-
if ((connector.wallet && hasSatsConnectFeature.hasSatsConnectFeature(connector.wallet.features)) ||
|
|
26
|
-
((_d = fallbackWalletWalletStandard === null || fallbackWalletWalletStandard === void 0 ? void 0 : fallbackWalletWalletStandard.features) === null || _d === void 0 ? void 0 : _d.includes(_const.SATSCONNECT_FEATURE))) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
exports.supportsSatsConnect = supportsSatsConnect;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
-
import { XVERSE_KEY, SATSCONNECT_FEATURE } from '../const.js';
|
|
4
|
-
import '@dynamic-labs/utils';
|
|
5
|
-
import '../../_virtual/_tslib.js';
|
|
6
|
-
import 'sats-connect';
|
|
7
|
-
import 'bitcoinjs-lib';
|
|
8
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
-
import '@dynamic-labs/sdk-api-core';
|
|
10
|
-
import '@wallet-standard/app';
|
|
11
|
-
import { hasSatsConnectFeature } from './hasSatsConnectFeature.js';
|
|
12
|
-
|
|
13
|
-
const supportsSatsConnect = (connector) => {
|
|
14
|
-
var _a, _b, _c, _d;
|
|
15
|
-
if (connector.key === XVERSE_KEY) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
// Grabbing the wallet standard from the fallback wallet
|
|
19
|
-
// due to wallet standard not being available on mobile
|
|
20
|
-
const fallbackWalletWalletStandard = (_c = (_b = (_a = findWalletBookWallet(connector.walletBook, connector.key)) === null || _a === void 0 ? void 0 : _a.injectedConfig) === null || _b === void 0 ? void 0 : _b.find((config) => config.chain === 'btc')) === null || _c === void 0 ? void 0 : _c.walletStandard;
|
|
21
|
-
if ((connector.wallet && hasSatsConnectFeature(connector.wallet.features)) ||
|
|
22
|
-
((_d = fallbackWalletWalletStandard === null || fallbackWalletWalletStandard === void 0 ? void 0 : fallbackWalletWalletStandard.features) === null || _d === void 0 ? void 0 : _d.includes(SATSCONNECT_FEATURE))) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { supportsSatsConnect };
|