@dynamic-labs/bitcoin 2.2.0-alpha.4 → 2.2.0
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 +46 -12
- package/package.json +4 -4
- package/src/bitcoinProviderHelper.d.ts +4 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +14 -3
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +14 -3
- package/src/connectors/BitcoinWalletConnector.cjs +6 -4
- package/src/connectors/BitcoinWalletConnector.d.ts +2 -1
- package/src/connectors/BitcoinWalletConnector.js +6 -4
- 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/index.d.ts +1 -0
- package/src/index.cjs +3 -0
- package/src/index.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,78 @@
|
|
|
1
1
|
|
|
2
|
-
## [2.2.0
|
|
2
|
+
## [2.2.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.5...v2.2.0) (2024-06-16)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add useSwitchNetwork ([#6027](https://github.com/dynamic-labs/DynamicAuth/issues/6027)) ([671310a](https://github.com/dynamic-labs/DynamicAuth/commit/671310a98aaeca12e02443c824d5d7cad2cdc769))
|
|
8
|
+
* add walletAdded to useDynamicEvents ([#6026](https://github.com/dynamic-labs/DynamicAuth/issues/6026)) ([8b784b7](https://github.com/dynamic-labs/DynamicAuth/commit/8b784b702e242ca279aafae657a076a51d397627))
|
|
9
|
+
* expose selectedTabState and deprecate setDefaultSelectedTab ([#6028](https://github.com/dynamic-labs/DynamicAuth/issues/6028)) ([eb71787](https://github.com/dynamic-labs/DynamicAuth/commit/eb717877cb6604504d10802a3aecc6055f95caa0))
|
|
10
|
+
|
|
11
|
+
### [2.1.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.4...v2.1.5) (2024-06-16)
|
|
12
|
+
|
|
13
|
+
* Improve handling of unknown wallets, css fixes and copy updates in multi wallet experience
|
|
14
|
+
|
|
15
|
+
### [2.1.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.3...v2.1.4) (2024-06-14)
|
|
3
16
|
|
|
4
17
|
|
|
5
18
|
### Bug Fixes
|
|
6
19
|
|
|
7
|
-
*
|
|
8
|
-
*
|
|
20
|
+
* close sign modal when signing in with a wallet when embedded wallet is enabled ([#6012](https://github.com/dynamic-labs/DynamicAuth/issues/6012)) ([d473cc8](https://github.com/dynamic-labs/DynamicAuth/commit/d473cc83ac378b7bc43e2546020c02a297d4595b))
|
|
21
|
+
* display custom network name in network picker even if it doesn't have a valid icon ([#6020](https://github.com/dynamic-labs/DynamicAuth/issues/6020)) ([5e1539e](https://github.com/dynamic-labs/DynamicAuth/commit/5e1539e1e6920fb1fdbf96c938f40e785b3ee680))
|
|
9
22
|
|
|
10
|
-
|
|
23
|
+
### [2.1.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2...v2.1.3) (2024-06-14)
|
|
11
24
|
|
|
12
25
|
|
|
13
26
|
### Features
|
|
14
27
|
|
|
15
|
-
*
|
|
28
|
+
* add in-app browser navigation support for sats-connect ([#5990](https://github.com/dynamic-labs/DynamicAuth/issues/5990)) ([7ea15b9](https://github.com/dynamic-labs/DynamicAuth/commit/7ea15b93d1864164acb82c1e73aae7f9130e1d44))
|
|
16
29
|
|
|
17
30
|
|
|
18
31
|
### Bug Fixes
|
|
19
32
|
|
|
20
|
-
*
|
|
33
|
+
* cache getGenesisHash call to prevent over calling ([#5966](https://github.com/dynamic-labs/DynamicAuth/issues/5966)) ([#5970](https://github.com/dynamic-labs/DynamicAuth/issues/5970)) ([b624b2e](https://github.com/dynamic-labs/DynamicAuth/commit/b624b2ea5b398bf464d3098e7d81d83c7b5bf659))
|
|
34
|
+
* improvements to embedded solana wallet ([#6001](https://github.com/dynamic-labs/DynamicAuth/issues/6001)) ([a6437c9](https://github.com/dynamic-labs/DynamicAuth/commit/a6437c93e1946bca609d3d99d282123275022376)) ([#5815](https://github.com/dynamic-labs/DynamicAuth/issues/5815)) ([#5978](https://github.com/dynamic-labs/DynamicAuth/issues/5978)) ([dd92973](https://github.com/dynamic-labs/DynamicAuth/commit/dd9297365f0ccbee1217325328e173ae7ee9a922))
|
|
35
|
+
* show linked wallets with unavailable providers in user wallets list ([#6005](https://github.com/dynamic-labs/DynamicAuth/issues/6005)) ([79796d1](https://github.com/dynamic-labs/DynamicAuth/commit/79796d1b73670265ca9897314252b620afaa2e8a))
|
|
36
|
+
* close switch network modal after switching to a supported network ([#5987](https://github.com/dynamic-labs/DynamicAuth/issues/5987)) ([a7e762e](https://github.com/dynamic-labs/DynamicAuth/commit/a7e762ef63a72492d0c083a344111589a6fbc455))
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
### [2.1.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2-alpha.1...v2.1.2) (2024-06-10)
|
|
23
39
|
|
|
24
40
|
|
|
25
41
|
### Features
|
|
26
42
|
|
|
27
|
-
*
|
|
43
|
+
* hide wallets from wallet list that can't have multiple accounts linked ([#5935](https://github.com/dynamic-labs/DynamicAuth/issues/5935)) ([20f9b15](https://github.com/dynamic-labs/DynamicAuth/commit/20f9b15b145cbc57519155691b3640149eec3689))
|
|
28
44
|
|
|
29
45
|
|
|
30
46
|
### Bug Fixes
|
|
31
47
|
|
|
32
|
-
*
|
|
48
|
+
* ensure sign message will not show 2 times ([#5938](https://github.com/dynamic-labs/DynamicAuth/issues/5938)) ([#5941](https://github.com/dynamic-labs/DynamicAuth/issues/5941)) ([2c5a156](https://github.com/dynamic-labs/DynamicAuth/commit/2c5a156ead565bd25067b3bc2b23cbc704f9b314))
|
|
49
|
+
* improve logic related to embedded wallets and emailVerifcation ([#5947](https://github.com/dynamic-labs/DynamicAuth/issues/5947)) ([b885a14](https://github.com/dynamic-labs/DynamicAuth/commit/b885a14dcf200f05233e4ab42b8b518d877d291a))
|
|
50
|
+
* init coinbase provider adhoc ([#5907](https://github.com/dynamic-labs/DynamicAuth/issues/5907)) ([#5933](https://github.com/dynamic-labs/DynamicAuth/issues/5933)) ([2fa1f52](https://github.com/dynamic-labs/DynamicAuth/commit/2fa1f528b27113ee108252ee874ee7f5ead88329))
|
|
51
|
+
* remove force consent and account selection even for returning google users ([#5912](https://github.com/dynamic-labs/DynamicAuth/issues/5912)) ([26a07f2](https://github.com/dynamic-labs/DynamicAuth/commit/26a07f29bdb8bf32a080396906a21d8b084c202f))
|
|
52
|
+
* resolve the default phone country based on enabled countries ([#5](https://github.com/dynamic-labs/DynamicAuth/issues/5)… ([#5916](https://github.com/dynamic-labs/DynamicAuth/issues/5916)) ([8f27c00](https://github.com/dynamic-labs/DynamicAuth/commit/8f27c0082edb77b964b8402cfa75c6a896b061d3)), closes [#5910](https://github.com/dynamic-labs/DynamicAuth/issues/5910)
|
|
53
|
+
* versioned tx needs address lookup table ([#5909](https://github.com/dynamic-labs/DynamicAuth/issues/5909)) ([#5919](https://github.com/dynamic-labs/DynamicAuth/issues/5919)) ([22e3ca2](https://github.com/dynamic-labs/DynamicAuth/commit/22e3ca2d0b27d15efb50e3092a7bc3a0c0d255a5))
|
|
54
|
+
|
|
55
|
+
### [2.1.2-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.2-alpha.0...v2.1.2-alpha.1) (2024-06-07)
|
|
33
56
|
|
|
34
|
-
## [2.2.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.0...v2.2.0-alpha.1) (2024-06-04)
|
|
35
57
|
|
|
36
|
-
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* find phantom solana provider when opening dapp on new tab ([#5902](https://github.com/dynamic-labs/DynamicAuth/issues/5902)) ([99daf87](https://github.com/dynamic-labs/DynamicAuth/commit/99daf87f17caed870a76e4f89a257a14da37c7ab)), closes [#5895](https://github.com/dynamic-labs/DynamicAuth/issues/5895) [#5896](https://github.com/dynamic-labs/DynamicAuth/issues/5896) [#5897](https://github.com/dynamic-labs/DynamicAuth/issues/5897)
|
|
61
|
+
|
|
62
|
+
### [2.1.2-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.1...v2.1.2-alpha.0) (2024-06-07)
|
|
37
63
|
|
|
38
64
|
|
|
39
65
|
### Features
|
|
40
66
|
|
|
41
|
-
*
|
|
67
|
+
* display enabled countries in phone number field ([#5825](https://github.com/dynamic-labs/DynamicAuth/issues/5825)) ([#5868](https://github.com/dynamic-labs/DynamicAuth/issues/5868)) ([640a4a7](https://github.com/dynamic-labs/DynamicAuth/commit/640a4a77c994390ceed759faf186717b38f393a4))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* btc getBalance should use ordinal address if payment not available ([#5883](https://github.com/dynamic-labs/DynamicAuth/issues/5883)) ([bc5ac55](https://github.com/dynamic-labs/DynamicAuth/commit/bc5ac5589e90193d41282d23ce037db360dd23e6))
|
|
73
|
+
* phone number in kyc step ([#5875](https://github.com/dynamic-labs/DynamicAuth/issues/5875)) ([#5879](https://github.com/dynamic-labs/DynamicAuth/issues/5879)) ([3d8a5be](https://github.com/dynamic-labs/DynamicAuth/commit/3d8a5bef35d4a13a1068aaf80d2c39e795b097cd))
|
|
74
|
+
|
|
75
|
+
### [2.1.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0...v2.1.1) (2024-06-04)
|
|
42
76
|
|
|
43
77
|
## [2.1.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.32...v2.1.0) (2024-06-04)
|
|
44
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "2.2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -32,9 +32,9 @@
|
|
|
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": "2.2.0
|
|
36
|
-
"@dynamic-labs/wallet-book": "2.2.0
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "2.2.0
|
|
35
|
+
"@dynamic-labs/utils": "2.2.0",
|
|
36
|
+
"@dynamic-labs/wallet-book": "2.2.0",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "2.2.0",
|
|
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;
|
|
@@ -7,8 +7,9 @@ var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
8
8
|
var satsConnect = require('sats-connect');
|
|
9
9
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
var utils = require('@dynamic-labs/utils');
|
|
11
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
12
|
var _const = require('../../const.cjs');
|
|
11
|
-
require('@dynamic-labs/utils');
|
|
12
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
14
15
|
var validatePsbt = require('../../utils/psbt/validator/validatePsbt.cjs');
|
|
@@ -27,7 +28,7 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
27
28
|
}
|
|
28
29
|
getAddress() {
|
|
29
30
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var _a;
|
|
31
|
+
var _a, _b;
|
|
31
32
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
32
33
|
// but it's already the default provider for sats-connect, so it's ok
|
|
33
34
|
// for getProvider in getAddress to return undefined
|
|
@@ -36,11 +37,21 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
36
37
|
if (!supportsSatsConnect.supportsSatsConnect(this)) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
40
|
+
const wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
41
|
+
const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
42
|
+
if (utils.isMobile() && !this.isInstalledOnBrowser() && inAppBrowserUrl) {
|
|
43
|
+
const inAppBrowserTemplate = utils.template(inAppBrowserUrl);
|
|
44
|
+
const deepLink = inAppBrowserTemplate({
|
|
45
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
46
|
+
});
|
|
47
|
+
window.location.href = deepLink;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
39
50
|
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
40
51
|
if (cachedActiveAccount) {
|
|
41
52
|
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Ordinals);
|
|
42
53
|
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Payment);
|
|
43
|
-
return (
|
|
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;
|
|
44
55
|
}
|
|
45
56
|
return new Promise((resolve, reject) => {
|
|
46
57
|
satsConnect.getAddress({
|
|
@@ -3,8 +3,9 @@ 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
5
|
import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import { isMobile, template } from '@dynamic-labs/utils';
|
|
7
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
6
8
|
import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
7
|
-
import '@dynamic-labs/utils';
|
|
8
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
10
11
|
import { validatePsbt } from '../../utils/psbt/validator/validatePsbt.js';
|
|
@@ -23,7 +24,7 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
23
24
|
}
|
|
24
25
|
getAddress() {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var _a;
|
|
27
|
+
var _a, _b;
|
|
27
28
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
28
29
|
// but it's already the default provider for sats-connect, so it's ok
|
|
29
30
|
// for getProvider in getAddress to return undefined
|
|
@@ -32,11 +33,21 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
32
33
|
if (!supportsSatsConnect(this)) {
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
36
|
+
const wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
37
|
+
const inAppBrowserUrl = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
38
|
+
if (isMobile() && !this.isInstalledOnBrowser() && inAppBrowserUrl) {
|
|
39
|
+
const inAppBrowserTemplate = template(inAppBrowserUrl);
|
|
40
|
+
const deepLink = inAppBrowserTemplate({
|
|
41
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
42
|
+
});
|
|
43
|
+
window.location.href = deepLink;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
35
46
|
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
36
47
|
if (cachedActiveAccount) {
|
|
37
48
|
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Ordinals);
|
|
38
49
|
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Payment);
|
|
39
|
-
return (
|
|
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;
|
|
40
51
|
}
|
|
41
52
|
return new Promise((resolve, reject) => {
|
|
42
53
|
getAddress({
|
|
@@ -33,6 +33,11 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
33
33
|
}
|
|
34
34
|
this.cache = new BitcoinLocalStorageCache.BitcoinLocalStorageCache(this.overrideKey);
|
|
35
35
|
}
|
|
36
|
+
clearConnectedAccounts() {
|
|
37
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
yield this.cache.clearConnectedAcccounts();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
36
41
|
canConnectWithHardwareWallet() {
|
|
37
42
|
const wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
38
43
|
if (!wallet || !wallet.hardwareWallets)
|
|
@@ -48,10 +53,7 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
48
53
|
}
|
|
49
54
|
endSession() {
|
|
50
55
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
yield
|
|
52
|
-
this.cache.clearConnectedAcccounts(),
|
|
53
|
-
this.cache.clearLastBalance(),
|
|
54
|
-
]);
|
|
56
|
+
yield this.cache.clearLastBalance();
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
getBalance() {
|
|
@@ -24,12 +24,13 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
|
|
|
24
24
|
isHardwareWalletEnabled: boolean;
|
|
25
25
|
verifiedCredentials: JwtVerifiedCredential[];
|
|
26
26
|
constructor(opts: BitcoinWalletConnectorOpts);
|
|
27
|
+
clearConnectedAccounts(): Promise<void>;
|
|
27
28
|
canConnectWithHardwareWallet(): boolean;
|
|
28
29
|
isInstalledOnBrowser(): boolean;
|
|
29
30
|
getDeepLink(): string | undefined;
|
|
30
31
|
endSession(): Promise<void>;
|
|
31
32
|
getBalance(): Promise<string | undefined>;
|
|
32
|
-
|
|
33
|
+
getConnectedAccountsFromCache(): Promise<string[]>;
|
|
33
34
|
getConnectedAccounts(): Promise<string[]>;
|
|
34
35
|
getAdditionalAddresses(mainAddress?: string): Promise<WalletAdditionalAddress[]>;
|
|
35
36
|
setAdditionalAddresses(mainAddress: string, additionalAddresses: WalletAdditionalAddress[]): Promise<void>;
|
|
@@ -29,6 +29,11 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
29
29
|
}
|
|
30
30
|
this.cache = new BitcoinLocalStorageCache(this.overrideKey);
|
|
31
31
|
}
|
|
32
|
+
clearConnectedAccounts() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
yield this.cache.clearConnectedAcccounts();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
32
37
|
canConnectWithHardwareWallet() {
|
|
33
38
|
const wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
34
39
|
if (!wallet || !wallet.hardwareWallets)
|
|
@@ -44,10 +49,7 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
44
49
|
}
|
|
45
50
|
endSession() {
|
|
46
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
yield
|
|
48
|
-
this.cache.clearConnectedAcccounts(),
|
|
49
|
-
this.cache.clearLastBalance(),
|
|
50
|
-
]);
|
|
52
|
+
yield this.cache.clearLastBalance();
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
getBalance() {
|
|
@@ -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';
|
package/src/index.cjs
CHANGED
|
@@ -10,6 +10,7 @@ require('bitcoinjs-lib');
|
|
|
10
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
11
|
require('@dynamic-labs/utils');
|
|
12
12
|
require('@dynamic-labs/sdk-api-core');
|
|
13
|
+
require('@dynamic-labs/wallet-book');
|
|
13
14
|
var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
|
|
14
15
|
var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
|
|
15
16
|
var hasSatsConnectFeature = require('./utils/hasSatsConnectFeature.cjs');
|
|
@@ -19,6 +20,7 @@ var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.c
|
|
|
19
20
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
20
21
|
var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
|
|
21
22
|
var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
|
|
23
|
+
var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
|
|
22
24
|
|
|
23
25
|
const BitcoinWalletConnectors = (props) => [
|
|
24
26
|
...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
|
|
@@ -27,6 +29,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
27
29
|
OkxConnector.OkxConnector,
|
|
28
30
|
UnisatConnector.UnisatConnector,
|
|
29
31
|
UnknownInjected.UnknownInjectedConnector,
|
|
32
|
+
FallbackBitcoinConnector.FallbackBitcoinConnector,
|
|
30
33
|
];
|
|
31
34
|
|
|
32
35
|
exports.BitcoinWalletConnector = BitcoinWalletConnector.BitcoinWalletConnector;
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import 'bitcoinjs-lib';
|
|
|
6
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import '@dynamic-labs/utils';
|
|
8
8
|
import '@dynamic-labs/sdk-api-core';
|
|
9
|
+
import '@dynamic-labs/wallet-book';
|
|
9
10
|
import { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
10
11
|
export { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
11
12
|
import { fetchSatsConnectConnectors } from './utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js';
|
|
@@ -17,6 +18,7 @@ import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector
|
|
|
17
18
|
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
18
19
|
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
19
20
|
import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
|
|
21
|
+
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
20
22
|
|
|
21
23
|
const BitcoinWalletConnectors = (props) => [
|
|
22
24
|
...fetchSatsConnectConnectors(props),
|
|
@@ -25,6 +27,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
25
27
|
OkxConnector,
|
|
26
28
|
UnisatConnector,
|
|
27
29
|
UnknownInjectedConnector,
|
|
30
|
+
FallbackBitcoinConnector,
|
|
28
31
|
];
|
|
29
32
|
|
|
30
33
|
export { BitcoinWalletConnectors };
|