@dynamic-labs/multi-wallet 0.16.18 → 0.16.20
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 +14 -0
- package/package.json +3 -3
- package/src/wallets/flow/flow-provider.cjs +1 -28
- package/src/wallets/flow/flow-provider.d.ts +0 -5
- package/src/wallets/flow/flow-provider.js +2 -28
- package/src/wallets/getMobileOrInjectedWallet.cjs +15 -10
- package/src/wallets/getMobileOrInjectedWallet.js +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.16.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.19...v0.16.20) (2023-06-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* flow connection status improvements ([#2212](https://github.com/dynamic-labs/DynamicAuth/issues/2212)) ([#2218](https://github.com/dynamic-labs/DynamicAuth/issues/2218)) ([8c3f9b3](https://github.com/dynamic-labs/DynamicAuth/commit/8c3f9b34b673d252cd696d271e8ee5a0457b2213))
|
|
8
|
+
|
|
9
|
+
### [0.16.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.18...v0.16.19) (2023-06-01)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* use wcv2 only if wallet supports it ([#2204](https://github.com/dynamic-labs/DynamicAuth/issues/2204)) ([f314d29](https://github.com/dynamic-labs/DynamicAuth/commit/f314d2940611fb130c43cb15526efe83e995d0ad))
|
|
15
|
+
|
|
2
16
|
### [0.16.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.17...v0.16.18) (2023-05-31)
|
|
3
17
|
|
|
4
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/multi-wallet",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"magic-sdk": "^16.0.1",
|
|
29
29
|
"@keplr-wallet/provider": "0.11.56",
|
|
30
30
|
"@keplr-wallet/types": "^0.11.51",
|
|
31
|
-
"@dynamic-labs/logger": "0.16.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "0.16.
|
|
31
|
+
"@dynamic-labs/logger": "0.16.20",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "0.16.20"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@walletconnect/types": "^2.2.1"
|
|
@@ -7,31 +7,6 @@ var fcl = require('@onflow/fcl');
|
|
|
7
7
|
var errors = require('../../errors.cjs');
|
|
8
8
|
var logger = require('../../utils/logger.cjs');
|
|
9
9
|
|
|
10
|
-
const get = (key) => {
|
|
11
|
-
if (typeof window === 'undefined') {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
const value = window.localStorage.getItem(key);
|
|
15
|
-
try {
|
|
16
|
-
if (value) {
|
|
17
|
-
return JSON.parse(value);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
logger.logger.error(e);
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
};
|
|
25
|
-
const set = (key, value) => {
|
|
26
|
-
if (typeof window !== 'undefined') {
|
|
27
|
-
window.localStorage.setItem(key, JSON.stringify(value));
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const LOCAL_STORAGE = {
|
|
31
|
-
can: true,
|
|
32
|
-
get: (key) => tslib.__awaiter(void 0, void 0, void 0, function* () { return get(key); }),
|
|
33
|
-
put: (key, value) => tslib.__awaiter(void 0, void 0, void 0, function* () { return set(key, value); }),
|
|
34
|
-
};
|
|
35
10
|
class FlowProvider {
|
|
36
11
|
constructor({ appName, appLogoUrl, }) {
|
|
37
12
|
this.appName = appName;
|
|
@@ -69,8 +44,7 @@ class FlowProvider {
|
|
|
69
44
|
.put('app.detail.title', this.appName)
|
|
70
45
|
.put('app.detail.icon', this.appLogoUrl)
|
|
71
46
|
.put('accessNode.api', 'https://rest-mainnet.onflow.org')
|
|
72
|
-
.put('flow.network', 'mainnet')
|
|
73
|
-
.put('fcl.storage', LOCAL_STORAGE);
|
|
47
|
+
.put('flow.network', 'mainnet');
|
|
74
48
|
}
|
|
75
49
|
getDeepLink() {
|
|
76
50
|
return undefined;
|
|
@@ -186,4 +160,3 @@ class FlowProvider {
|
|
|
186
160
|
}
|
|
187
161
|
|
|
188
162
|
exports.FlowProvider = FlowProvider;
|
|
189
|
-
exports.LOCAL_STORAGE = LOCAL_STORAGE;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
export declare const LOCAL_STORAGE: {
|
|
3
|
-
can: boolean;
|
|
4
|
-
get: (key: string) => Promise<any>;
|
|
5
|
-
put: (key: string, value: any) => Promise<void>;
|
|
6
|
-
};
|
|
7
2
|
export declare class FlowProvider {
|
|
8
3
|
protected appName?: string;
|
|
9
4
|
protected appLogoUrl?: string;
|
|
@@ -3,31 +3,6 @@ import { currentUser, config, send, script, decode } from '@onflow/fcl';
|
|
|
3
3
|
import { DynamicError } from '../../errors.js';
|
|
4
4
|
import { logger } from '../../utils/logger.js';
|
|
5
5
|
|
|
6
|
-
const get = (key) => {
|
|
7
|
-
if (typeof window === 'undefined') {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
const value = window.localStorage.getItem(key);
|
|
11
|
-
try {
|
|
12
|
-
if (value) {
|
|
13
|
-
return JSON.parse(value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
logger.error(e);
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
};
|
|
21
|
-
const set = (key, value) => {
|
|
22
|
-
if (typeof window !== 'undefined') {
|
|
23
|
-
window.localStorage.setItem(key, JSON.stringify(value));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const LOCAL_STORAGE = {
|
|
27
|
-
can: true,
|
|
28
|
-
get: (key) => __awaiter(void 0, void 0, void 0, function* () { return get(key); }),
|
|
29
|
-
put: (key, value) => __awaiter(void 0, void 0, void 0, function* () { return set(key, value); }),
|
|
30
|
-
};
|
|
31
6
|
class FlowProvider {
|
|
32
7
|
constructor({ appName, appLogoUrl, }) {
|
|
33
8
|
this.appName = appName;
|
|
@@ -65,8 +40,7 @@ class FlowProvider {
|
|
|
65
40
|
.put('app.detail.title', this.appName)
|
|
66
41
|
.put('app.detail.icon', this.appLogoUrl)
|
|
67
42
|
.put('accessNode.api', 'https://rest-mainnet.onflow.org')
|
|
68
|
-
.put('flow.network', 'mainnet')
|
|
69
|
-
.put('fcl.storage', LOCAL_STORAGE);
|
|
43
|
+
.put('flow.network', 'mainnet');
|
|
70
44
|
}
|
|
71
45
|
getDeepLink() {
|
|
72
46
|
return undefined;
|
|
@@ -181,4 +155,4 @@ class FlowProvider {
|
|
|
181
155
|
}
|
|
182
156
|
}
|
|
183
157
|
|
|
184
|
-
export { FlowProvider
|
|
158
|
+
export { FlowProvider };
|
|
@@ -2,24 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
5
6
|
var walletConnect = require('./walletConnect/walletConnect.cjs');
|
|
6
7
|
var walletConnectV2 = require('./walletConnect/walletConnectV2.cjs');
|
|
7
8
|
|
|
8
9
|
const getMobileOrInjectedWallet = ({ evmNetworks, injectedWallet, isWalletConnectV2 = false, walletConnectName, }) => {
|
|
10
|
+
var _a, _b;
|
|
9
11
|
if (injectedWallet.isInstalledOnBrowser()) {
|
|
10
12
|
return injectedWallet;
|
|
11
13
|
}
|
|
12
|
-
else if (isWalletConnectV2) {
|
|
13
|
-
return new walletConnectV2["default"]({
|
|
14
|
-
evmNetworks,
|
|
15
|
-
walletName: walletConnectName,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
14
|
else {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const wallet = walletBook.getWalletBookWallet(walletConnectName);
|
|
16
|
+
if (isWalletConnectV2 && ((_b = (_a = wallet.walletConnect) === null || _a === void 0 ? void 0 : _a.sdks) === null || _b === void 0 ? void 0 : _b.includes('sign_v2'))) {
|
|
17
|
+
return new walletConnectV2["default"]({
|
|
18
|
+
evmNetworks,
|
|
19
|
+
walletName: walletConnectName,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return new walletConnect({
|
|
24
|
+
evmNetworks,
|
|
25
|
+
walletName: walletConnectName,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
};
|
|
25
30
|
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
+
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
1
2
|
import WalletConnect from './walletConnect/walletConnect.js';
|
|
2
3
|
import WalletConnectV2 from './walletConnect/walletConnectV2.js';
|
|
3
4
|
|
|
4
5
|
const getMobileOrInjectedWallet = ({ evmNetworks, injectedWallet, isWalletConnectV2 = false, walletConnectName, }) => {
|
|
6
|
+
var _a, _b;
|
|
5
7
|
if (injectedWallet.isInstalledOnBrowser()) {
|
|
6
8
|
return injectedWallet;
|
|
7
9
|
}
|
|
8
|
-
else if (isWalletConnectV2) {
|
|
9
|
-
return new WalletConnectV2({
|
|
10
|
-
evmNetworks,
|
|
11
|
-
walletName: walletConnectName,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
10
|
else {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const wallet = getWalletBookWallet(walletConnectName);
|
|
12
|
+
if (isWalletConnectV2 && ((_b = (_a = wallet.walletConnect) === null || _a === void 0 ? void 0 : _a.sdks) === null || _b === void 0 ? void 0 : _b.includes('sign_v2'))) {
|
|
13
|
+
return new WalletConnectV2({
|
|
14
|
+
evmNetworks,
|
|
15
|
+
walletName: walletConnectName,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return new WalletConnect({
|
|
20
|
+
evmNetworks,
|
|
21
|
+
walletName: walletConnectName,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
};
|
|
21
26
|
|