@dynamic-labs/bitcoin 3.0.0-alpha.5 → 3.0.0-alpha.7
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 +40 -0
- package/package.json +5 -5
- package/src/bitcoinProviderHelper.d.ts +4 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +4 -12
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +4 -12
- package/src/connectors/BitcoinWalletConnector.cjs +16 -2
- package/src/connectors/BitcoinWalletConnector.d.ts +3 -0
- package/src/connectors/BitcoinWalletConnector.js +16 -2
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs +38 -0
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.d.ts +12 -0
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js +34 -0
- package/src/connectors/FallbackBitcoinConnector/index.d.ts +1 -0
- package/src/connectors/OkxConnector/OkxConnector.cjs +1 -1
- package/src/connectors/OkxConnector/OkxConnector.js +1 -1
- package/src/connectors/index.d.ts +1 -0
- package/src/index.cjs +2 -1
- package/src/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.6...v3.0.0-alpha.7) (2024-06-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* add selectedTabIndex and helpers (#6040)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add selectedTabIndex and helpers ([#6040](https://github.com/dynamic-labs/DynamicAuth/issues/6040)) ([ae20b80](https://github.com/dynamic-labs/DynamicAuth/commit/ae20b8081376dce97b18fa69c81c9ab73c1ff317))
|
|
12
|
+
* add useRefreshUser to trigger a user state refresh ([#6079](https://github.com/dynamic-labs/DynamicAuth/issues/6079)) ([1236d35](https://github.com/dynamic-labs/DynamicAuth/commit/1236d35fe9fab44ed2114ad9f3c8c6dca7ec27be))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* always return userWallets when available ([#6080](https://github.com/dynamic-labs/DynamicAuth/issues/6080)) ([#6083](https://github.com/dynamic-labs/DynamicAuth/issues/6083)) ([11992d2](https://github.com/dynamic-labs/DynamicAuth/commit/11992d2af5a401ba4ff1dc6904e2a9f8ef5904ca))
|
|
18
|
+
* less solana rpc calls and improve fee fetching ([#6019](https://github.com/dynamic-labs/DynamicAuth/issues/6019)) ([e2609db](https://github.com/dynamic-labs/DynamicAuth/commit/e2609db962c7708ff5b127cb23260a25bc5032e3))
|
|
19
|
+
* make account change idemopotent ([#6061](https://github.com/dynamic-labs/DynamicAuth/issues/6061)) ([8c87513](https://github.com/dynamic-labs/DynamicAuth/commit/8c8751390ea14888c4889679895e2f06d75717b9))
|
|
20
|
+
* only run multi wallet prompt when user profile or auth flow are open ([#6073](https://github.com/dynamic-labs/DynamicAuth/issues/6073)) ([d48ca10](https://github.com/dynamic-labs/DynamicAuth/commit/d48ca105359018457a78588fd8d9aa8a91583a02))
|
|
21
|
+
* recompute multiwallet state after merging accounts ([#6078](https://github.com/dynamic-labs/DynamicAuth/issues/6078)) ([e08a274](https://github.com/dynamic-labs/DynamicAuth/commit/e08a274c4d848f2a8360be7106cfbfa00b9a8f9b))
|
|
22
|
+
* stop querying okx for accounts while locked ([#6081](https://github.com/dynamic-labs/DynamicAuth/issues/6081)) ([#6084](https://github.com/dynamic-labs/DynamicAuth/issues/6084)) ([34365ac](https://github.com/dynamic-labs/DynamicAuth/commit/34365ac1981fe020b03e666c24535a247645d2ad))
|
|
23
|
+
* update copy for primary wallet not connected modal ([#6069](https://github.com/dynamic-labs/DynamicAuth/issues/6069)) ([4a3f43c](https://github.com/dynamic-labs/DynamicAuth/commit/4a3f43ce5585983f7fea0c5b97e812c0ade80e2c))
|
|
24
|
+
|
|
25
|
+
## [3.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2024-06-18)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* implement useExternalAuth hook to signin using external jwt auth ([#6039](https://github.com/dynamic-labs/DynamicAuth/issues/6039)) ([ba90908](https://github.com/dynamic-labs/DynamicAuth/commit/ba90908509ec21f708a4a0782a7f94861fc3b484))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* allow sign-in with different ME BTC wallet after initial connection ([a527b46](https://github.com/dynamic-labs/DynamicAuth/commit/a527b464f321b4fc27730f57c3812e996b5ed878))
|
|
36
|
+
* close sign modal when signing in with a wallet when embedded wallet is enabled ([#6013](https://github.com/dynamic-labs/DynamicAuth/issues/6013)) ([0f4f3c8](https://github.com/dynamic-labs/DynamicAuth/commit/0f4f3c83db162f7a1794a3549b60bbad6b03e2c0))
|
|
37
|
+
* custom network without a valid icon should still display its name in network picker ([#6018](https://github.com/dynamic-labs/DynamicAuth/issues/6018)) ([0b10df6](https://github.com/dynamic-labs/DynamicAuth/commit/0b10df68950bfc9b8492443158a6bb030dc1122c))
|
|
38
|
+
* e2e: remove page pause ([#6045](https://github.com/dynamic-labs/DynamicAuth/issues/6045)) ([55bba00](https://github.com/dynamic-labs/DynamicAuth/commit/55bba0034255055d6ae266b1296542f47ed48e2b))
|
|
39
|
+
* more fixes for connect starknet button ([#6046](https://github.com/dynamic-labs/DynamicAuth/issues/6046)) ([0fb570a](https://github.com/dynamic-labs/DynamicAuth/commit/0fb570a44e65f8dd6d4d2bf5edb2ee54985ec9d4))
|
|
40
|
+
* set verified credentials on embedded wallet creation ([#6044](https://github.com/dynamic-labs/DynamicAuth/issues/6044)) ([b52a96d](https://github.com/dynamic-labs/DynamicAuth/commit/b52a96d321e7efdb30dce9cdb3f6f176c24ceb81))
|
|
41
|
+
|
|
2
42
|
## [3.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-06-14)
|
|
3
43
|
|
|
4
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@btckit/types": "0.0.19",
|
|
30
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
30
|
+
"@dynamic-labs/sdk-api-core": "0.0.470",
|
|
31
31
|
"@wallet-standard/app": "1.0.1",
|
|
32
32
|
"@wallet-standard/base": "1.0.1",
|
|
33
33
|
"bitcoinjs-lib": "6.1.5",
|
|
34
34
|
"sats-connect": "2.0.0",
|
|
35
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
35
|
+
"@dynamic-labs/utils": "3.0.0-alpha.7",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.7",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.7",
|
|
38
38
|
"stream": "0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -15,6 +15,10 @@ export declare class BitcoinProviderHelper {
|
|
|
15
15
|
features: string[];
|
|
16
16
|
name: string;
|
|
17
17
|
} | undefined;
|
|
18
|
+
walletStandardLocators?: {
|
|
19
|
+
name: string;
|
|
20
|
+
locator: string;
|
|
21
|
+
}[] | undefined;
|
|
18
22
|
windowLocations?: string[] | undefined;
|
|
19
23
|
} | undefined;
|
|
20
24
|
getProvider(): any;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
8
8
|
var satsConnect = require('sats-connect');
|
|
9
|
-
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
9
|
var utils = require('@dynamic-labs/utils');
|
|
11
10
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
12
11
|
var _const = require('../../const.cjs');
|
|
@@ -21,14 +20,13 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
21
20
|
constructor(opts) {
|
|
22
21
|
super(opts);
|
|
23
22
|
this.currentNetwork = satsConnect.BitcoinNetworkType.Mainnet;
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
this.canFetchConnectedAccounts = this.key !== 'xverse';
|
|
23
|
+
// satsconnect wallets don't support fetching connected accounts without prompting
|
|
24
|
+
// for a connection, so we handle getConnectedAccounts differently.
|
|
25
|
+
this.canFetchConnectedAccounts = false;
|
|
28
26
|
}
|
|
29
27
|
getAddress() {
|
|
30
28
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a
|
|
29
|
+
var _a;
|
|
32
30
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
33
31
|
// but it's already the default provider for sats-connect, so it's ok
|
|
34
32
|
// for getProvider in getAddress to return undefined
|
|
@@ -47,12 +45,6 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
47
45
|
window.location.href = deepLink;
|
|
48
46
|
return;
|
|
49
47
|
}
|
|
50
|
-
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
51
|
-
if (cachedActiveAccount) {
|
|
52
|
-
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Ordinals);
|
|
53
|
-
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Payment);
|
|
54
|
-
return (_b = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _b !== void 0 ? _b : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
55
|
-
}
|
|
56
48
|
return new Promise((resolve, reject) => {
|
|
57
49
|
satsConnect.getAddress({
|
|
58
50
|
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { Psbt } from 'bitcoinjs-lib';
|
|
4
4
|
import { BitcoinNetworkType, getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransaction } from 'sats-connect';
|
|
5
|
-
import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
|
|
6
5
|
import { isMobile, template } from '@dynamic-labs/utils';
|
|
7
6
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
8
7
|
import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
@@ -17,14 +16,13 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
17
16
|
constructor(opts) {
|
|
18
17
|
super(opts);
|
|
19
18
|
this.currentNetwork = BitcoinNetworkType.Mainnet;
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
this.canFetchConnectedAccounts = this.key !== 'xverse';
|
|
19
|
+
// satsconnect wallets don't support fetching connected accounts without prompting
|
|
20
|
+
// for a connection, so we handle getConnectedAccounts differently.
|
|
21
|
+
this.canFetchConnectedAccounts = false;
|
|
24
22
|
}
|
|
25
23
|
getAddress() {
|
|
26
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a
|
|
25
|
+
var _a;
|
|
28
26
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
29
27
|
// but it's already the default provider for sats-connect, so it's ok
|
|
30
28
|
// for getProvider in getAddress to return undefined
|
|
@@ -43,12 +41,6 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
43
41
|
window.location.href = deepLink;
|
|
44
42
|
return;
|
|
45
43
|
}
|
|
46
|
-
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
47
|
-
if (cachedActiveAccount) {
|
|
48
|
-
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Ordinals);
|
|
49
|
-
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Payment);
|
|
50
|
-
return (_b = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _b !== void 0 ? _b : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
51
|
-
}
|
|
52
44
|
return new Promise((resolve, reject) => {
|
|
53
45
|
getAddress({
|
|
54
46
|
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -33,6 +33,12 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
33
33
|
}
|
|
34
34
|
this.cache = new BitcoinLocalStorageCache.BitcoinLocalStorageCache(this.overrideKey);
|
|
35
35
|
}
|
|
36
|
+
isSameAccountChangeRequest(to) {
|
|
37
|
+
return this.lastAccountChange === to;
|
|
38
|
+
}
|
|
39
|
+
setLastAccountChangeRequest(to) {
|
|
40
|
+
this.lastAccountChange = to;
|
|
41
|
+
}
|
|
36
42
|
clearConnectedAccounts() {
|
|
37
43
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
44
|
yield this.cache.clearConnectedAcccounts();
|
|
@@ -53,7 +59,10 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
53
59
|
}
|
|
54
60
|
endSession() {
|
|
55
61
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
yield
|
|
62
|
+
yield Promise.all([
|
|
63
|
+
this.cache.clearConnectedAcccounts(),
|
|
64
|
+
this.cache.clearLastBalance(),
|
|
65
|
+
]);
|
|
57
66
|
});
|
|
58
67
|
}
|
|
59
68
|
getBalance() {
|
|
@@ -234,9 +243,14 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
234
243
|
}
|
|
235
244
|
const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
|
|
236
245
|
// don't do anything if the connected accounts haven't changed
|
|
237
|
-
if
|
|
246
|
+
// or if the account change request is the same as previous request
|
|
247
|
+
if (currentConnectedAccounts[0] === connectedAccounts[0] ||
|
|
248
|
+
this.isSameAccountChangeRequest(connectedAccounts[0])) {
|
|
238
249
|
return;
|
|
239
250
|
}
|
|
251
|
+
// set the last account change request with the from and to addresses
|
|
252
|
+
// to ensure that the requests are not duplicated
|
|
253
|
+
this.setLastAccountChangeRequest(connectedAccounts[0]);
|
|
240
254
|
handleAccountChange(connectedAccounts);
|
|
241
255
|
});
|
|
242
256
|
provider.on('accountsChanged', handleBitcoinAccountChange);
|
|
@@ -23,7 +23,10 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
|
|
|
23
23
|
canFetchConnectedAccounts: boolean;
|
|
24
24
|
isHardwareWalletEnabled: boolean;
|
|
25
25
|
verifiedCredentials: JwtVerifiedCredential[];
|
|
26
|
+
private lastAccountChange;
|
|
26
27
|
constructor(opts: BitcoinWalletConnectorOpts);
|
|
28
|
+
private isSameAccountChangeRequest;
|
|
29
|
+
private setLastAccountChangeRequest;
|
|
27
30
|
clearConnectedAccounts(): Promise<void>;
|
|
28
31
|
canConnectWithHardwareWallet(): boolean;
|
|
29
32
|
isInstalledOnBrowser(): boolean;
|
|
@@ -29,6 +29,12 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
29
29
|
}
|
|
30
30
|
this.cache = new BitcoinLocalStorageCache(this.overrideKey);
|
|
31
31
|
}
|
|
32
|
+
isSameAccountChangeRequest(to) {
|
|
33
|
+
return this.lastAccountChange === to;
|
|
34
|
+
}
|
|
35
|
+
setLastAccountChangeRequest(to) {
|
|
36
|
+
this.lastAccountChange = to;
|
|
37
|
+
}
|
|
32
38
|
clearConnectedAccounts() {
|
|
33
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
40
|
yield this.cache.clearConnectedAcccounts();
|
|
@@ -49,7 +55,10 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
49
55
|
}
|
|
50
56
|
endSession() {
|
|
51
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
yield
|
|
58
|
+
yield Promise.all([
|
|
59
|
+
this.cache.clearConnectedAcccounts(),
|
|
60
|
+
this.cache.clearLastBalance(),
|
|
61
|
+
]);
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
getBalance() {
|
|
@@ -230,9 +239,14 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
230
239
|
}
|
|
231
240
|
const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
|
|
232
241
|
// don't do anything if the connected accounts haven't changed
|
|
233
|
-
if
|
|
242
|
+
// or if the account change request is the same as previous request
|
|
243
|
+
if (currentConnectedAccounts[0] === connectedAccounts[0] ||
|
|
244
|
+
this.isSameAccountChangeRequest(connectedAccounts[0])) {
|
|
234
245
|
return;
|
|
235
246
|
}
|
|
247
|
+
// set the last account change request with the from and to addresses
|
|
248
|
+
// to ensure that the requests are not duplicated
|
|
249
|
+
this.setLastAccountChangeRequest(connectedAccounts[0]);
|
|
236
250
|
handleAccountChange(connectedAccounts);
|
|
237
251
|
});
|
|
238
252
|
provider.on('accountsChanged', handleBitcoinAccountChange);
|
|
@@ -0,0 +1,38 @@
|
|
|
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 FallbackBitcoinConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'fallbackconnector' }));
|
|
12
|
+
this.name = 'Fallback Connector';
|
|
13
|
+
this.overrideKey = 'fallbackconnector';
|
|
14
|
+
this.isAvailable = false;
|
|
15
|
+
this.canFetchConnectedAccounts = false;
|
|
16
|
+
}
|
|
17
|
+
getAddress() {
|
|
18
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
signPsbt(
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
_request) {
|
|
25
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
sendBitcoin(
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
+
_transaction) {
|
|
32
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.FallbackBitcoinConnector = FallbackBitcoinConnector;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } from '../../types';
|
|
2
|
+
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
3
|
+
export declare class FallbackBitcoinConnector extends BitcoinWalletConnector {
|
|
4
|
+
name: string;
|
|
5
|
+
overrideKey: string;
|
|
6
|
+
isAvailable: boolean;
|
|
7
|
+
canFetchConnectedAccounts: boolean;
|
|
8
|
+
constructor(opts: BitcoinWalletConnectorOpts);
|
|
9
|
+
getAddress(): Promise<string | undefined>;
|
|
10
|
+
signPsbt(_request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
11
|
+
sendBitcoin(_transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
4
|
+
|
|
5
|
+
class FallbackBitcoinConnector extends BitcoinWalletConnector {
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'fallbackconnector' }));
|
|
8
|
+
this.name = 'Fallback Connector';
|
|
9
|
+
this.overrideKey = 'fallbackconnector';
|
|
10
|
+
this.isAvailable = false;
|
|
11
|
+
this.canFetchConnectedAccounts = false;
|
|
12
|
+
}
|
|
13
|
+
getAddress() {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
signPsbt(
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
_request) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
sendBitcoin(
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
+
_transaction) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { FallbackBitcoinConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FallbackBitcoinConnector } from './FallbackBitcoinConnector';
|
|
@@ -13,7 +13,7 @@ class OkxConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
|
13
13
|
constructor(opts) {
|
|
14
14
|
super(Object.assign(Object.assign({}, opts), { overrideKey: 'okxwalletbtc' }));
|
|
15
15
|
this.name = 'OKX Wallet';
|
|
16
|
-
this.canFetchConnectedAccounts =
|
|
16
|
+
this.canFetchConnectedAccounts = false;
|
|
17
17
|
}
|
|
18
18
|
get walletBookWallet() {
|
|
19
19
|
return this.walletBook.wallets[this.key];
|
|
@@ -9,7 +9,7 @@ class OkxConnector extends BitcoinWalletConnector {
|
|
|
9
9
|
constructor(opts) {
|
|
10
10
|
super(Object.assign(Object.assign({}, opts), { overrideKey: 'okxwalletbtc' }));
|
|
11
11
|
this.name = 'OKX Wallet';
|
|
12
|
-
this.canFetchConnectedAccounts =
|
|
12
|
+
this.canFetchConnectedAccounts = false;
|
|
13
13
|
}
|
|
14
14
|
get walletBookWallet() {
|
|
15
15
|
return this.walletBook.wallets[this.key];
|
package/src/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ require('sats-connect');
|
|
|
9
9
|
require('bitcoinjs-lib');
|
|
10
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
11
|
require('@dynamic-labs/utils');
|
|
12
|
-
require('@dynamic-labs/sdk-api-core');
|
|
13
12
|
require('@dynamic-labs/wallet-book');
|
|
14
13
|
var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
|
|
15
14
|
var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
|
|
@@ -20,6 +19,7 @@ var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.c
|
|
|
20
19
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
21
20
|
var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
|
|
22
21
|
var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
|
|
22
|
+
var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
|
|
23
23
|
|
|
24
24
|
const BitcoinWalletConnectors = (props) => [
|
|
25
25
|
...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
|
|
@@ -28,6 +28,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
28
28
|
OkxConnector.OkxConnector,
|
|
29
29
|
UnisatConnector.UnisatConnector,
|
|
30
30
|
UnknownInjected.UnknownInjectedConnector,
|
|
31
|
+
FallbackBitcoinConnector.FallbackBitcoinConnector,
|
|
31
32
|
];
|
|
32
33
|
|
|
33
34
|
exports.BitcoinWalletConnector = BitcoinWalletConnector.BitcoinWalletConnector;
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import 'sats-connect';
|
|
|
5
5
|
import 'bitcoinjs-lib';
|
|
6
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import '@dynamic-labs/utils';
|
|
8
|
-
import '@dynamic-labs/sdk-api-core';
|
|
9
8
|
import '@dynamic-labs/wallet-book';
|
|
10
9
|
import { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
11
10
|
export { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
@@ -18,6 +17,7 @@ import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector
|
|
|
18
17
|
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
19
18
|
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
20
19
|
import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
|
|
20
|
+
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
21
21
|
|
|
22
22
|
const BitcoinWalletConnectors = (props) => [
|
|
23
23
|
...fetchSatsConnectConnectors(props),
|
|
@@ -26,6 +26,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
26
26
|
OkxConnector,
|
|
27
27
|
UnisatConnector,
|
|
28
28
|
UnknownInjectedConnector,
|
|
29
|
+
FallbackBitcoinConnector,
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
export { BitcoinWalletConnectors };
|