@dynamic-labs/bitcoin 3.0.0-alpha.31 → 3.0.0-alpha.33
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,19 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.33](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.32...v3.0.0-alpha.33) (2024-08-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add async handler for mfa enrollment and completion ([#6481](https://github.com/dynamic-labs/DynamicAuth/issues/6481)) ([63ce10d](https://github.com/dynamic-labs/DynamicAuth/commit/63ce10dd9f9aa58f43411455d6bbeb2f440ddcac))
|
|
8
|
+
|
|
9
|
+
## [3.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.31...v3.0.0-alpha.32) (2024-07-30)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* react native flicker when redirecting back from farcaster ([#6338](https://github.com/dynamic-labs/DynamicAuth/issues/6338)) ([6ab8464](https://github.com/dynamic-labs/DynamicAuth/commit/6ab846476f7961564445223dd12a552ed4c0f0c8))
|
|
15
|
+
* stop unnecessary phantom btc popup when disconnecting - Revert ([#6439](https://github.com/dynamic-labs/DynamicAuth/issues/6439)) ([79ba97d](https://github.com/dynamic-labs/DynamicAuth/commit/79ba97d82c4eb89f0118a925e4dc899853e04550)), closes [#6188](https://github.com/dynamic-labs/DynamicAuth/issues/6188)
|
|
16
|
+
|
|
2
17
|
## [3.0.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.30...v3.0.0-alpha.31) (2024-07-27)
|
|
3
18
|
|
|
4
19
|
## [3.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.29...v3.0.0-alpha.30) (2024-07-27)
|
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.33",
|
|
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.506",
|
|
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.33",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.33",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.33",
|
|
38
38
|
"stream": "0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -110,7 +110,31 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
110
110
|
}
|
|
111
111
|
getConnectedAccounts() {
|
|
112
112
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
|
|
113
|
+
// some wallets like xverse don't support fetching connected accounts
|
|
114
|
+
// without prompting for a connection
|
|
115
|
+
// to avoid this behavior, we cache the connected accounts
|
|
116
|
+
if (!this.canFetchConnectedAccounts) {
|
|
117
|
+
return this.getConnectedAccountsFromCache();
|
|
118
|
+
}
|
|
119
|
+
// if we decide that is ok to prompt for a connection when fetching connected accounts
|
|
120
|
+
// we shouldn't prompt every time we call this method (which is a lot of times)
|
|
121
|
+
// so we just store in a promise and return the same promise every time
|
|
122
|
+
if (!this.getAddressPromise) {
|
|
123
|
+
this.getAddressPromise = this.getAddress();
|
|
124
|
+
}
|
|
125
|
+
let connectedAccount;
|
|
126
|
+
try {
|
|
127
|
+
connectedAccount = yield this.getAddressPromise;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
walletConnectorCore.logger.error(`${this.key} getConnectedAccounts - error fetching connected account`);
|
|
131
|
+
//don't throw error just return empty array after clearing the promise
|
|
132
|
+
}
|
|
133
|
+
this.getAddressPromise = undefined;
|
|
134
|
+
if (!connectedAccount) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
return [connectedAccount];
|
|
114
138
|
});
|
|
115
139
|
}
|
|
116
140
|
getAdditionalAddresses(mainAddress) {
|
|
@@ -193,14 +217,7 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
193
217
|
return;
|
|
194
218
|
}
|
|
195
219
|
const { handleAccountChange, handleChainChange, handleDisconnect } = walletConnectorCore.eventListenerHandlers(this);
|
|
196
|
-
const handleBitcoinDisconnect = (error) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
this.cache.clearConnectedAcccounts();
|
|
198
|
-
handleDisconnect(error);
|
|
199
|
-
});
|
|
200
220
|
const handleBitcoinAccountChange = (accounts) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
if (accounts.length === 0) {
|
|
202
|
-
this.cache.clearConnectedAcccounts();
|
|
203
|
-
}
|
|
204
221
|
let connectedAccounts = accounts;
|
|
205
222
|
let ordinalsAccount, paymentAccount;
|
|
206
223
|
// if accounts is an array of objects, we need to parse them to return only addresses
|
|
@@ -233,7 +250,7 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
233
250
|
});
|
|
234
251
|
provider.on('accountsChanged', handleBitcoinAccountChange);
|
|
235
252
|
provider.on('networkChanged', handleChainChange);
|
|
236
|
-
provider.on('disconnect',
|
|
253
|
+
provider.on('disconnect', handleDisconnect);
|
|
237
254
|
const tearDownEventListeners = () => {
|
|
238
255
|
const provider = this.getProvider();
|
|
239
256
|
if (!(provider === null || provider === void 0 ? void 0 : provider.removeListener)) {
|
|
@@ -241,7 +258,7 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
241
258
|
}
|
|
242
259
|
provider.removeListener('accountsChanged', handleBitcoinAccountChange);
|
|
243
260
|
provider.removeListener('networkChanged', handleChainChange);
|
|
244
|
-
provider.removeListener('disconnect',
|
|
261
|
+
provider.removeListener('disconnect', handleDisconnect);
|
|
245
262
|
};
|
|
246
263
|
this.teardownEventListeners = tearDownEventListeners;
|
|
247
264
|
}
|
|
@@ -106,7 +106,31 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
106
106
|
}
|
|
107
107
|
getConnectedAccounts() {
|
|
108
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
|
|
109
|
+
// some wallets like xverse don't support fetching connected accounts
|
|
110
|
+
// without prompting for a connection
|
|
111
|
+
// to avoid this behavior, we cache the connected accounts
|
|
112
|
+
if (!this.canFetchConnectedAccounts) {
|
|
113
|
+
return this.getConnectedAccountsFromCache();
|
|
114
|
+
}
|
|
115
|
+
// if we decide that is ok to prompt for a connection when fetching connected accounts
|
|
116
|
+
// we shouldn't prompt every time we call this method (which is a lot of times)
|
|
117
|
+
// so we just store in a promise and return the same promise every time
|
|
118
|
+
if (!this.getAddressPromise) {
|
|
119
|
+
this.getAddressPromise = this.getAddress();
|
|
120
|
+
}
|
|
121
|
+
let connectedAccount;
|
|
122
|
+
try {
|
|
123
|
+
connectedAccount = yield this.getAddressPromise;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
logger.error(`${this.key} getConnectedAccounts - error fetching connected account`);
|
|
127
|
+
//don't throw error just return empty array after clearing the promise
|
|
128
|
+
}
|
|
129
|
+
this.getAddressPromise = undefined;
|
|
130
|
+
if (!connectedAccount) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
return [connectedAccount];
|
|
110
134
|
});
|
|
111
135
|
}
|
|
112
136
|
getAdditionalAddresses(mainAddress) {
|
|
@@ -189,14 +213,7 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
189
213
|
return;
|
|
190
214
|
}
|
|
191
215
|
const { handleAccountChange, handleChainChange, handleDisconnect } = eventListenerHandlers(this);
|
|
192
|
-
const handleBitcoinDisconnect = (error) => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
this.cache.clearConnectedAcccounts();
|
|
194
|
-
handleDisconnect(error);
|
|
195
|
-
});
|
|
196
216
|
const handleBitcoinAccountChange = (accounts) => __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
if (accounts.length === 0) {
|
|
198
|
-
this.cache.clearConnectedAcccounts();
|
|
199
|
-
}
|
|
200
217
|
let connectedAccounts = accounts;
|
|
201
218
|
let ordinalsAccount, paymentAccount;
|
|
202
219
|
// if accounts is an array of objects, we need to parse them to return only addresses
|
|
@@ -229,7 +246,7 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
229
246
|
});
|
|
230
247
|
provider.on('accountsChanged', handleBitcoinAccountChange);
|
|
231
248
|
provider.on('networkChanged', handleChainChange);
|
|
232
|
-
provider.on('disconnect',
|
|
249
|
+
provider.on('disconnect', handleDisconnect);
|
|
233
250
|
const tearDownEventListeners = () => {
|
|
234
251
|
const provider = this.getProvider();
|
|
235
252
|
if (!(provider === null || provider === void 0 ? void 0 : provider.removeListener)) {
|
|
@@ -237,7 +254,7 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
237
254
|
}
|
|
238
255
|
provider.removeListener('accountsChanged', handleBitcoinAccountChange);
|
|
239
256
|
provider.removeListener('networkChanged', handleChainChange);
|
|
240
|
-
provider.removeListener('disconnect',
|
|
257
|
+
provider.removeListener('disconnect', handleDisconnect);
|
|
241
258
|
};
|
|
242
259
|
this.teardownEventListeners = tearDownEventListeners;
|
|
243
260
|
}
|