@dynamic-labs/bitcoin 2.2.1 → 2.2.3
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 +18 -1
- package/package.json +4 -4
- package/src/connectors/BitcoinWalletConnector.cjs +12 -1
- package/src/connectors/BitcoinWalletConnector.d.ts +3 -0
- package/src/connectors/BitcoinWalletConnector.js +12 -1
- package/src/connectors/OkxConnector/OkxConnector.cjs +1 -1
- package/src/connectors/OkxConnector/OkxConnector.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.2.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.2...v2.2.3) (2024-06-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* return userWallets connected state async ([#6080](https://github.com/dynamic-labs/DynamicAuth/issues/6080)) ([6ffa444](https://github.com/dynamic-labs/DynamicAuth/commit/6ffa444ad374d1923a07bbc12191455cb3a1d276))
|
|
8
|
+
* ensure multi wallet prompts widget will not overlay the merge accounts UI ([#6087](https://github.com/dynamic-labs/DynamicAuth/issues/6087)) ([582f44f](https://github.com/dynamic-labs/DynamicAuth/commit/582f44f48b4d93917c4b20e9e6b4bbbfe4e4f94f))
|
|
9
|
+
* stop querying okx for accounts while locked ([#6081](https://github.com/dynamic-labs/DynamicAuth/issues/6081)) ([3374e38](https://github.com/dynamic-labs/DynamicAuth/commit/3374e38e2006f795809233de5bc03904d106bd2d))
|
|
10
|
+
* update copy for primary wallet not connected modal ([#6070](https://github.com/dynamic-labs/DynamicAuth/issues/6070)) ([d0466e1](https://github.com/dynamic-labs/DynamicAuth/commit/d0466e19f386adcd0ed83e73f783cfe827e1b94d))
|
|
11
|
+
|
|
12
|
+
### [2.2.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.1...v2.2.2) (2024-06-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* make phantom BTC account change requests idempotent ([#6062](https://github.com/dynamic-labs/DynamicAuth/issues/6062)) ([2308d32](https://github.com/dynamic-labs/DynamicAuth/commit/2308d32d18627f2673c8f4c9b5623a9c731e4752))
|
|
18
|
+
|
|
2
19
|
### [2.2.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0...v2.2.1) (2024-06-17)
|
|
3
20
|
|
|
4
21
|
|
|
@@ -94,7 +111,7 @@
|
|
|
94
111
|
|
|
95
112
|
- React Native - You can now build mobile-first onboarding experiences with the same Dynamic magic but for React Native, get started [here](https://docs.dynamic.xyz/react-native/introduction)
|
|
96
113
|
|
|
97
|
-
- Cookie Authentication - Dynamic can now be configured to set a secure, HttpOnly cookie that can be used for authenticating with Dynamic’s backend. This will contain a minified version of our JWT token.
|
|
114
|
+
- Cookie Authentication - Dynamic can now be configured to set a secure, HttpOnly cookie that can be used for authenticating with Dynamic’s backend. This will contain a minified version of our JWT token.
|
|
98
115
|
|
|
99
116
|
|
|
100
117
|
## Improvements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
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.
|
|
36
|
-
"@dynamic-labs/wallet-book": "2.2.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "2.2.
|
|
35
|
+
"@dynamic-labs/utils": "2.2.3",
|
|
36
|
+
"@dynamic-labs/wallet-book": "2.2.3",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "2.2.3",
|
|
38
38
|
"stream": "0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -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();
|
|
@@ -237,9 +243,14 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
237
243
|
}
|
|
238
244
|
const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
|
|
239
245
|
// don't do anything if the connected accounts haven't changed
|
|
240
|
-
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])) {
|
|
241
249
|
return;
|
|
242
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]);
|
|
243
254
|
handleAccountChange(connectedAccounts);
|
|
244
255
|
});
|
|
245
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();
|
|
@@ -233,9 +239,14 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
233
239
|
}
|
|
234
240
|
const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
|
|
235
241
|
// don't do anything if the connected accounts haven't changed
|
|
236
|
-
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])) {
|
|
237
245
|
return;
|
|
238
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]);
|
|
239
250
|
handleAccountChange(connectedAccounts);
|
|
240
251
|
});
|
|
241
252
|
provider.on('accountsChanged', handleBitcoinAccountChange);
|
|
@@ -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];
|