@dynamic-labs/multi-wallet 0.17.0-RC.8 → 0.17.0-RC.9
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 +15 -0
- package/package.json +7 -12
- package/src/index.cjs +0 -44
- package/src/index.d.ts +0 -11
- package/src/index.js +1 -16
- package/src/multi-wallet.cjs +16 -64
- package/src/multi-wallet.d.ts +0 -1
- package/src/multi-wallet.js +12 -59
- package/src/types.d.ts +0 -2
- package/src/utils/message.cjs +1 -2
- package/src/utils/message.js +1 -2
- package/src/wallets/constants.cjs +0 -2
- package/src/wallets/constants.js +1 -2
- package/src/wallets/cosmos/KeplrWalletConnect.cjs +4 -6
- package/src/wallets/cosmos/KeplrWalletConnect.d.ts +4 -1
- package/src/wallets/cosmos/KeplrWalletConnect.js +2 -4
- package/src/wallets/cosmos/KeplrWalletConnector.d.ts +1 -2
- package/src/wallets/cosmos/wcClient.lib.cjs +45 -4
- package/src/wallets/cosmos/wcClient.lib.js +42 -3
- package/src/wallets/flow/lilico.cjs +2 -2
- package/src/wallets/flow/lilico.js +1 -1
- package/src/wallets/solana/phantom.cjs +3 -3
- package/src/wallets/solana/phantom.js +1 -1
- package/src/wallets/solana/solProviderHelper.cjs +3 -4
- package/src/wallets/solana/solProviderHelper.d.ts +3 -3
- package/src/wallets/solana/solProviderHelper.js +1 -2
- package/src/wallets/starknet/braavos.cjs +2 -2
- package/src/wallets/starknet/braavos.js +1 -1
- package/src/wallets/window.d.ts +10 -22
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
- package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
- package/src/utils/encoding.cjs +0 -18
- package/src/utils/encoding.d.ts +0 -4
- package/src/utils/encoding.js +0 -12
- package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
- package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
- package/src/utils/getChainInfo/getChainInfo.js +0 -55
- package/src/utils/getChainInfo/index.d.ts +0 -1
- package/src/utils/getWalletConnectorByName.cjs +0 -19
- package/src/utils/getWalletConnectorByName.d.ts +0 -2
- package/src/utils/getWalletConnectorByName.js +0 -15
- package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
- package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
- package/src/utils/isFunction/index.d.ts +0 -1
- package/src/utils/isFunction/isFunction.cjs +0 -8
- package/src/utils/isFunction/isFunction.d.ts +0 -1
- package/src/utils/isFunction/isFunction.js +0 -4
- package/src/utils/isMobile.cjs +0 -54
- package/src/utils/isMobile.d.ts +0 -13
- package/src/utils/isMobile.js +0 -46
- package/src/utils/isSameAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
- package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.js +0 -5
- package/src/utils/isSameAddress/utils/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
- package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
- package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
- package/src/utils/normalizeWalletName/index.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
- package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
- package/src/utils/shouldLowercaseAddress.cjs +0 -11
- package/src/utils/shouldLowercaseAddress.d.ts +0 -1
- package/src/utils/shouldLowercaseAddress.js +0 -7
- package/src/utils/walletConnect.cjs +0 -33
- package/src/utils/walletConnect.d.ts +0 -4
- package/src/utils/walletConnect.js +0 -29
- package/src/wallets/ProviderLookup.cjs +0 -18
- package/src/wallets/ProviderLookup.d.ts +0 -4
- package/src/wallets/ProviderLookup.js +0 -14
- package/src/wallets/clients/coinbase/coinbase.cjs +0 -73
- package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
- package/src/wallets/clients/coinbase/coinbase.js +0 -66
- package/src/wallets/clients/coinbase/index.d.ts +0 -2
- package/src/wallets/clients/coinbase/types.d.ts +0 -14
- package/src/wallets/clients/walletConnect/index.d.ts +0 -1
- package/src/wallets/clients/walletConnect/types.d.ts +0 -4
- package/src/wallets/clients/walletConnect/walletConnect.cjs +0 -229
- package/src/wallets/clients/walletConnect/walletConnect.d.ts +0 -21
- package/src/wallets/clients/walletConnect/walletConnect.js +0 -213
- package/src/wallets/ethereum/BloctoEvm.cjs +0 -109
- package/src/wallets/ethereum/BloctoEvm.d.ts +0 -20
- package/src/wallets/ethereum/BloctoEvm.js +0 -103
- package/src/wallets/ethereum/EthWalletConnector.cjs +0 -206
- package/src/wallets/ethereum/EthWalletConnector.d.ts +0 -39
- package/src/wallets/ethereum/EthWalletConnector.js +0 -202
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -61
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -57
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -78
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -31
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -74
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -61
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -57
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -179
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -54
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -175
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
- package/src/wallets/ethereum/coinbase.cjs +0 -63
- package/src/wallets/ethereum/coinbase.d.ts +0 -22
- package/src/wallets/ethereum/coinbase.js +0 -61
- package/src/wallets/ethereum/ethProviderHelper.cjs +0 -199
- package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -33
- package/src/wallets/ethereum/ethProviderHelper.js +0 -195
- package/src/wallets/ethereum/evm-network.cjs +0 -20
- package/src/wallets/ethereum/evm-network.d.ts +0 -6
- package/src/wallets/ethereum/evm-network.js +0 -16
- package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -12
- package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -5
- package/src/wallets/ethereum/injected/BloctoInjected.js +0 -10
- package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -12
- package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -5
- package/src/wallets/ethereum/injected/BraveEvm.js +0 -10
- package/src/wallets/ethereum/injected/Dawn.cjs +0 -12
- package/src/wallets/ethereum/injected/Dawn.d.ts +0 -5
- package/src/wallets/ethereum/injected/Dawn.js +0 -10
- package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -12
- package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -5
- package/src/wallets/ethereum/injected/ExodusEvm.js +0 -10
- package/src/wallets/ethereum/injected/Frame.cjs +0 -12
- package/src/wallets/ethereum/injected/Frame.d.ts +0 -5
- package/src/wallets/ethereum/injected/Frame.js +0 -10
- package/src/wallets/ethereum/injected/GameStop.cjs +0 -12
- package/src/wallets/ethereum/injected/GameStop.d.ts +0 -5
- package/src/wallets/ethereum/injected/GameStop.js +0 -10
- package/src/wallets/ethereum/injected/InjectedWalletBase.cjs +0 -74
- package/src/wallets/ethereum/injected/InjectedWalletBase.d.ts +0 -24
- package/src/wallets/ethereum/injected/InjectedWalletBase.js +0 -72
- package/src/wallets/ethereum/injected/MetaMask.cjs +0 -13
- package/src/wallets/ethereum/injected/MetaMask.d.ts +0 -6
- package/src/wallets/ethereum/injected/MetaMask.js +0 -11
- package/src/wallets/ethereum/injected/Opera.cjs +0 -12
- package/src/wallets/ethereum/injected/Opera.d.ts +0 -5
- package/src/wallets/ethereum/injected/Opera.js +0 -10
- package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -36
- package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -6
- package/src/wallets/ethereum/injected/PhantomEvm.js +0 -34
- package/src/wallets/ethereum/injected/Trust.cjs +0 -13
- package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
- package/src/wallets/ethereum/injected/Trust.js +0 -11
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -12
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -5
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -10
- package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
- package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
- package/src/wallets/ethereum/injected/Zerion.js +0 -11
- package/src/wallets/getWalletConnectConnector.cjs +0 -16
- package/src/wallets/getWalletConnectConnector.d.ts +0 -5
- package/src/wallets/getWalletConnectConnector.js +0 -12
- package/src/wallets/walletConnect/index.d.ts +0 -2
- package/src/wallets/walletConnect/walletConnect.cjs +0 -133
- package/src/wallets/walletConnect/walletConnect.d.ts +0 -34
- package/src/wallets/walletConnect/walletConnect.js +0 -127
- package/src/wallets/walletConnect/walletConnectV2.cjs +0 -268
- package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -38
- package/src/wallets/walletConnect/walletConnectV2.js +0 -262
- package/src/wallets/walletConnect/zerion.d.ts +0 -6
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var Client = require('@walletconnect/client');
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
-
var
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -32,10 +32,49 @@ const killWalletConnectSession = (client) => tslib.__awaiter(void 0, void 0, voi
|
|
|
32
32
|
walletConnectorCore.logger.debug(e);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* Attach event handlers to WalletConnect events.
|
|
37
|
+
*/
|
|
38
|
+
const setupWalletConnectEventListeners = (opts, client) => {
|
|
39
|
+
if (!client) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let prevAccount;
|
|
43
|
+
let prevChain;
|
|
44
|
+
if (client.connected) {
|
|
45
|
+
// eslint-disable-next-line prefer-destructuring
|
|
46
|
+
prevAccount = client.accounts[0];
|
|
47
|
+
prevChain = client.chainId;
|
|
48
|
+
}
|
|
49
|
+
client.on('disconnect', () => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
yield ((_a = opts.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(opts));
|
|
52
|
+
}));
|
|
53
|
+
client.on('session_update', (_, payload) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
var _b, _c;
|
|
55
|
+
// eslint-disable-next-line prefer-destructuring
|
|
56
|
+
const { accounts, chainId } = payload.params[0];
|
|
57
|
+
const didAccountChange = !walletConnectorCore.isSameAddress(prevAccount || '', accounts[0], 'eip155');
|
|
58
|
+
const didChainChange = prevChain !== chainId;
|
|
59
|
+
// eslint-disable-next-line prefer-destructuring
|
|
60
|
+
prevAccount = accounts[0];
|
|
61
|
+
prevChain = chainId;
|
|
62
|
+
if (didAccountChange) {
|
|
63
|
+
yield ((_b = opts.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(opts, accounts));
|
|
64
|
+
}
|
|
65
|
+
if (didChainChange) {
|
|
66
|
+
yield ((_c = opts.onChainChange) === null || _c === void 0 ? void 0 : _c.call(opts, String(chainId)));
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
const teardownWalletConnectEventListeners = (client) => {
|
|
71
|
+
client.off('disconnect');
|
|
72
|
+
client.off('session_update');
|
|
73
|
+
};
|
|
35
74
|
const useDeepLink = (metadata, wcClient, opts) => {
|
|
36
75
|
var _a, _b, _c;
|
|
37
76
|
const deepLink = getDeepLink(wcClient.uri, metadata);
|
|
38
|
-
if (
|
|
77
|
+
if (utils.isMobile()) {
|
|
39
78
|
window.location.href = deepLink;
|
|
40
79
|
}
|
|
41
80
|
else {
|
|
@@ -47,7 +86,7 @@ const useDeepLink = (metadata, wcClient, opts) => {
|
|
|
47
86
|
};
|
|
48
87
|
const getDeepLink = (uri, metadata, { removeWCUri = false, } = {}) => {
|
|
49
88
|
var _a, _b, _c, _d;
|
|
50
|
-
if (!
|
|
89
|
+
if (!utils.isMobile()) {
|
|
51
90
|
const origin = ((_a = metadata.desktop) === null || _a === void 0 ? void 0 : _a.universal) || ((_b = metadata.desktop) === null || _b === void 0 ? void 0 : _b.native);
|
|
52
91
|
if (removeWCUri)
|
|
53
92
|
return origin || '';
|
|
@@ -55,7 +94,7 @@ const getDeepLink = (uri, metadata, { removeWCUri = false, } = {}) => {
|
|
|
55
94
|
}
|
|
56
95
|
// deeplinks for ios require special treatment
|
|
57
96
|
// see: https://docs.walletconnect.com/mobile-linking#for-ios
|
|
58
|
-
else if (
|
|
97
|
+
else if (utils.isIOS()) {
|
|
59
98
|
const origin = ((_c = metadata.mobile) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata.mobile) === null || _d === void 0 ? void 0 : _d.native);
|
|
60
99
|
if (removeWCUri)
|
|
61
100
|
return origin || '';
|
|
@@ -97,4 +136,6 @@ exports.fetchWalletConnectCosmosPublicAddress = fetchWalletConnectCosmosPublicAd
|
|
|
97
136
|
exports.getDeepLink = getDeepLink;
|
|
98
137
|
exports.initClient = initClient;
|
|
99
138
|
exports.killWalletConnectSession = killWalletConnectSession;
|
|
139
|
+
exports.setupWalletConnectEventListeners = setupWalletConnectEventListeners;
|
|
140
|
+
exports.teardownWalletConnectEventListeners = teardownWalletConnectEventListeners;
|
|
100
141
|
exports.useDeepLink = useDeepLink;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import Client from '@walletconnect/client';
|
|
3
|
-
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { isMobile, isIOS } from '
|
|
3
|
+
import { logger, isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { isMobile, isIOS } from '@dynamic-labs/utils';
|
|
5
5
|
|
|
6
6
|
const initClient = (name, settings) => {
|
|
7
7
|
const storageId = `walletconnect-${name}`;
|
|
@@ -24,6 +24,45 @@ const killWalletConnectSession = (client) => __awaiter(void 0, void 0, void 0, f
|
|
|
24
24
|
logger.debug(e);
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
/**
|
|
28
|
+
* Attach event handlers to WalletConnect events.
|
|
29
|
+
*/
|
|
30
|
+
const setupWalletConnectEventListeners = (opts, client) => {
|
|
31
|
+
if (!client) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let prevAccount;
|
|
35
|
+
let prevChain;
|
|
36
|
+
if (client.connected) {
|
|
37
|
+
// eslint-disable-next-line prefer-destructuring
|
|
38
|
+
prevAccount = client.accounts[0];
|
|
39
|
+
prevChain = client.chainId;
|
|
40
|
+
}
|
|
41
|
+
client.on('disconnect', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
var _a;
|
|
43
|
+
yield ((_a = opts.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(opts));
|
|
44
|
+
}));
|
|
45
|
+
client.on('session_update', (_, payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
var _b, _c;
|
|
47
|
+
// eslint-disable-next-line prefer-destructuring
|
|
48
|
+
const { accounts, chainId } = payload.params[0];
|
|
49
|
+
const didAccountChange = !isSameAddress(prevAccount || '', accounts[0], 'eip155');
|
|
50
|
+
const didChainChange = prevChain !== chainId;
|
|
51
|
+
// eslint-disable-next-line prefer-destructuring
|
|
52
|
+
prevAccount = accounts[0];
|
|
53
|
+
prevChain = chainId;
|
|
54
|
+
if (didAccountChange) {
|
|
55
|
+
yield ((_b = opts.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(opts, accounts));
|
|
56
|
+
}
|
|
57
|
+
if (didChainChange) {
|
|
58
|
+
yield ((_c = opts.onChainChange) === null || _c === void 0 ? void 0 : _c.call(opts, String(chainId)));
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
const teardownWalletConnectEventListeners = (client) => {
|
|
63
|
+
client.off('disconnect');
|
|
64
|
+
client.off('session_update');
|
|
65
|
+
};
|
|
27
66
|
const useDeepLink = (metadata, wcClient, opts) => {
|
|
28
67
|
var _a, _b, _c;
|
|
29
68
|
const deepLink = getDeepLink(wcClient.uri, metadata);
|
|
@@ -84,4 +123,4 @@ const fetchWalletConnectCosmosPublicAddress = (metadata, wcClient, provider, opt
|
|
|
84
123
|
return key.bech32Address;
|
|
85
124
|
});
|
|
86
125
|
|
|
87
|
-
export { createSession, fetchWalletConnectCosmosPublicAddress, getDeepLink, initClient, killWalletConnectSession, useDeepLink };
|
|
126
|
+
export { createSession, fetchWalletConnectCosmosPublicAddress, getDeepLink, initClient, killWalletConnectSession, setupWalletConnectEventListeners, teardownWalletConnectEventListeners, useDeepLink };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var fcl = require('@onflow/fcl');
|
|
5
|
-
var
|
|
5
|
+
var utils = require('@dynamic-labs/utils');
|
|
6
6
|
var FlowWalletConnector = require('./FlowWalletConnector.cjs');
|
|
7
7
|
|
|
8
8
|
class Lilico extends FlowWalletConnector.FlowWalletConnector {
|
|
@@ -27,7 +27,7 @@ class Lilico extends FlowWalletConnector.FlowWalletConnector {
|
|
|
27
27
|
}
|
|
28
28
|
signDelay() {
|
|
29
29
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
if (
|
|
30
|
+
if (utils.isMobile()) {
|
|
31
31
|
return Promise.resolve();
|
|
32
32
|
}
|
|
33
33
|
return new Promise((resolve) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { config } from '@onflow/fcl';
|
|
3
|
-
import { isMobile } from '
|
|
3
|
+
import { isMobile } from '@dynamic-labs/utils';
|
|
4
4
|
import { FlowWalletConnector } from './FlowWalletConnector.js';
|
|
5
5
|
|
|
6
6
|
class Lilico extends FlowWalletConnector {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
|
-
var
|
|
4
|
+
var utils = require('@dynamic-labs/utils');
|
|
5
5
|
var solWalletConnector = require('./solWalletConnector.cjs');
|
|
6
6
|
var solProviderHelper = require('./solProviderHelper.cjs');
|
|
7
7
|
|
|
@@ -44,8 +44,8 @@ class Phantom extends solWalletConnector.SolWalletConnector {
|
|
|
44
44
|
const url = encodeURIComponent(window.location.toString());
|
|
45
45
|
const ref = encodeURIComponent(window.location.origin);
|
|
46
46
|
// samsung browser only supports native links, not universal links
|
|
47
|
-
if (
|
|
48
|
-
if (
|
|
47
|
+
if (utils.isMobile()) {
|
|
48
|
+
if (utils.isSamsungBrowser()) {
|
|
49
49
|
window.location.assign(`phantom://browse/${url}?ref=${ref}`);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import { isMobile, isSamsungBrowser } from '
|
|
2
|
+
import { isMobile, isSamsungBrowser } from '@dynamic-labs/utils';
|
|
3
3
|
import { SolWalletConnector } from './solWalletConnector.js';
|
|
4
4
|
import { SolProviderHelper } from './solProviderHelper.js';
|
|
5
5
|
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
7
|
var convertors = require('../../utils/convertors.cjs');
|
|
7
|
-
var ProviderLookup = require('../ProviderLookup.cjs');
|
|
8
|
-
var normalizeWalletName = require('../../utils/normalizeWalletName/normalizeWalletName.cjs');
|
|
9
8
|
|
|
10
9
|
var _a;
|
|
11
10
|
class SolProviderHelper {
|
|
12
11
|
static installedProviderLookup(providerFlags) {
|
|
13
|
-
return
|
|
12
|
+
return walletConnectorCore.ProviderLookup(this.allInstalledProviders(), providerFlags);
|
|
14
13
|
}
|
|
15
14
|
static allInstalledProviders() {
|
|
16
15
|
return this.findSolanaProviders(window.solana).concat(this.findSolanaProviders(window.solflare), this.findSolanaProviders(window.glowSolana));
|
|
@@ -32,7 +31,7 @@ class SolProviderHelper {
|
|
|
32
31
|
}
|
|
33
32
|
static findProvider(walletName) {
|
|
34
33
|
var _b, _c;
|
|
35
|
-
return (_c = (_b = this.providers)[
|
|
34
|
+
return (_c = (_b = this.providers)[walletConnectorCore.normalizeWalletName(walletName)]) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
36
35
|
}
|
|
37
36
|
static fetchPublicAddressWithName(name) {
|
|
38
37
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import { ISolana,
|
|
1
|
+
import { ProviderCondition, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { ISolana, SolProviderFlag } from '../window';
|
|
3
3
|
export interface SignedMessage {
|
|
4
4
|
signature: Uint8Array;
|
|
5
5
|
}
|
|
@@ -14,7 +14,7 @@ export declare class SolProviderHelper {
|
|
|
14
14
|
static providers: {
|
|
15
15
|
[wallet: string]: Provider;
|
|
16
16
|
};
|
|
17
|
-
static installedProviderLookup(providerFlags: Array<ProviderCondition
|
|
17
|
+
static installedProviderLookup(providerFlags: Array<ProviderCondition<SolProviderFlag>>): ISolana | undefined;
|
|
18
18
|
static allInstalledProviders(): ISolana[];
|
|
19
19
|
static findSolanaProviders(solana?: ISolana): ISolana[];
|
|
20
20
|
static isInstalledHelper(walletName: string): boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
+
import { ProviderLookup, normalizeWalletName } from '@dynamic-labs/wallet-connector-core';
|
|
2
3
|
import { bufferToBase64 } from '../../utils/convertors.js';
|
|
3
|
-
import { ProviderLookup } from '../ProviderLookup.js';
|
|
4
|
-
import { normalizeWalletName } from '../../utils/normalizeWalletName/normalizeWalletName.js';
|
|
5
4
|
|
|
6
5
|
var _a;
|
|
7
6
|
class SolProviderHelper {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
|
-
var
|
|
4
|
+
var utils = require('@dynamic-labs/utils');
|
|
5
5
|
var starknetWalletConnector = require('./starknetWalletConnector.cjs');
|
|
6
6
|
|
|
7
7
|
class Braavos extends starknetWalletConnector {
|
|
@@ -22,7 +22,7 @@ class Braavos extends starknetWalletConnector {
|
|
|
22
22
|
*/
|
|
23
23
|
const url = window.location.toString().replace(/http(s)?:\/\//, '');
|
|
24
24
|
const targetUrl = `starknet://dapp/${url}`;
|
|
25
|
-
if (
|
|
25
|
+
if (utils.isMobile()) {
|
|
26
26
|
window.location.assign(targetUrl);
|
|
27
27
|
}
|
|
28
28
|
return Promise.resolve(undefined);
|
package/src/wallets/window.d.ts
CHANGED
|
@@ -23,12 +23,8 @@ export interface IProvider {
|
|
|
23
23
|
isTrustWallet?: boolean;
|
|
24
24
|
isZerion?: boolean;
|
|
25
25
|
}
|
|
26
|
-
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion';
|
|
27
|
-
export type
|
|
28
|
-
flag: ProviderFlag | SolProviderFlag;
|
|
29
|
-
value: boolean;
|
|
30
|
-
};
|
|
31
|
-
export type SolProviderFlag = 'isBraveWallet' | 'isGlow' | 'isPhantom' | 'isSolflare';
|
|
26
|
+
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom';
|
|
27
|
+
export type SolProviderFlag = 'isBraveWallet' | 'isGlow' | 'isPhantom' | 'isSolflare' | 'isExodus';
|
|
32
28
|
export interface IWindow {
|
|
33
29
|
Slope: {
|
|
34
30
|
new (): ISolana;
|
|
@@ -47,20 +43,14 @@ export interface IWindow {
|
|
|
47
43
|
starknet_braavos: IStarknetWindowObject;
|
|
48
44
|
zerionWallet: IEthereum;
|
|
49
45
|
}
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
isDawn: boolean;
|
|
54
|
-
isMetaMask: boolean;
|
|
55
|
-
isOpera: boolean;
|
|
56
|
-
isPhantom: boolean;
|
|
57
|
-
isTrustWallet: boolean;
|
|
58
|
-
isZerion: boolean;
|
|
46
|
+
export type IEthereum = {
|
|
47
|
+
[key in ProviderFlag]: boolean;
|
|
48
|
+
} & {
|
|
59
49
|
providers: object[];
|
|
60
50
|
request: <T extends string>(params: {
|
|
61
51
|
method: T;
|
|
62
52
|
} | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
|
|
63
|
-
}
|
|
53
|
+
};
|
|
64
54
|
type PublicKey = {
|
|
65
55
|
toString: () => string;
|
|
66
56
|
};
|
|
@@ -68,15 +58,13 @@ export type ConnectionResult = {
|
|
|
68
58
|
address?: string;
|
|
69
59
|
publicKey?: PublicKey;
|
|
70
60
|
} | undefined;
|
|
71
|
-
export
|
|
61
|
+
export type ISolana = {
|
|
62
|
+
[key in SolProviderFlag]: boolean;
|
|
63
|
+
} & {
|
|
72
64
|
connect: (args?: {
|
|
73
65
|
onlyIfTrusted: boolean;
|
|
74
66
|
}) => Promise<ConnectionResult>;
|
|
75
67
|
disconnect: () => Promise<void | object>;
|
|
76
|
-
isBraveWallet: boolean;
|
|
77
|
-
isGlow: boolean;
|
|
78
|
-
isPhantom: boolean;
|
|
79
|
-
isSolflare: boolean;
|
|
80
68
|
on: (eventMessage: string, callback?: (publickey: string) => void) => Promise<void | object>;
|
|
81
69
|
providers: object[];
|
|
82
70
|
publicKey: PublicKey;
|
|
@@ -84,7 +72,7 @@ export interface ISolana {
|
|
|
84
72
|
removeListener: (eventMessage: string, callback?: (publickey: string) => void) => Promise<void | object>;
|
|
85
73
|
signMessage: (message: Uint8Array, encoding?: string) => Promise<void | object>;
|
|
86
74
|
signTransaction: (transaction: Transaction) => Promise<Transaction>;
|
|
87
|
-
}
|
|
75
|
+
};
|
|
88
76
|
export interface IFclProvider {
|
|
89
77
|
id: string;
|
|
90
78
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var isFunction = require('../isFunction/isFunction.cjs');
|
|
7
|
-
|
|
8
|
-
const applyJsonRpcSignerGates = (jsonRpcSigner, walletUiUtils, provider) => {
|
|
9
|
-
const originalSignMessage = jsonRpcSigner.signMessage;
|
|
10
|
-
const originalSendUncheckedTransaction = jsonRpcSigner.sendUncheckedTransaction;
|
|
11
|
-
if (isFunction.isFunction(originalSignMessage)) {
|
|
12
|
-
Object.assign(jsonRpcSigner, {
|
|
13
|
-
signMessage: (message) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return walletUiUtils.signMessage({
|
|
15
|
-
handler: originalSignMessage.bind(jsonRpcSigner),
|
|
16
|
-
message,
|
|
17
|
-
});
|
|
18
|
-
}),
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (isFunction.isFunction(originalSendUncheckedTransaction)) {
|
|
22
|
-
Object.assign(jsonRpcSigner, {
|
|
23
|
-
sendUncheckedTransaction: (transaction) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
return walletUiUtils.sendTransaction({
|
|
25
|
-
handler: originalSendUncheckedTransaction.bind(jsonRpcSigner),
|
|
26
|
-
provider,
|
|
27
|
-
transaction,
|
|
28
|
-
});
|
|
29
|
-
}),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const assignConfirmationScreenToIntermediaryMethods = (parent, walletUiUtils, provider) => {
|
|
34
|
-
const methods = ['getSigner', 'getUncheckedSigner', 'connectUnchecked'];
|
|
35
|
-
methods.forEach((methodName) => {
|
|
36
|
-
const method = parent[methodName];
|
|
37
|
-
if (!isFunction.isFunction(method)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
Object.assign(parent, {
|
|
41
|
-
[methodName]: (...args) => {
|
|
42
|
-
const result = method.bind(parent)(...args);
|
|
43
|
-
if (typeof result === 'object' && result !== null) {
|
|
44
|
-
assignConfirmationScreenToIntermediaryMethods(result, walletUiUtils, provider);
|
|
45
|
-
applyJsonRpcSignerGates(result, walletUiUtils, provider);
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
const assignConfirmationScreenToProvider = (provider, walletUiUtils) => assignConfirmationScreenToIntermediaryMethods(provider, walletUiUtils, provider);
|
|
53
|
-
|
|
54
|
-
exports.assignConfirmationScreenToProvider = assignConfirmationScreenToProvider;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { isFunction } from '../isFunction/isFunction.js';
|
|
3
|
-
|
|
4
|
-
const applyJsonRpcSignerGates = (jsonRpcSigner, walletUiUtils, provider) => {
|
|
5
|
-
const originalSignMessage = jsonRpcSigner.signMessage;
|
|
6
|
-
const originalSendUncheckedTransaction = jsonRpcSigner.sendUncheckedTransaction;
|
|
7
|
-
if (isFunction(originalSignMessage)) {
|
|
8
|
-
Object.assign(jsonRpcSigner, {
|
|
9
|
-
signMessage: (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
-
return walletUiUtils.signMessage({
|
|
11
|
-
handler: originalSignMessage.bind(jsonRpcSigner),
|
|
12
|
-
message,
|
|
13
|
-
});
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
if (isFunction(originalSendUncheckedTransaction)) {
|
|
18
|
-
Object.assign(jsonRpcSigner, {
|
|
19
|
-
sendUncheckedTransaction: (transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
return walletUiUtils.sendTransaction({
|
|
21
|
-
handler: originalSendUncheckedTransaction.bind(jsonRpcSigner),
|
|
22
|
-
provider,
|
|
23
|
-
transaction,
|
|
24
|
-
});
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const assignConfirmationScreenToIntermediaryMethods = (parent, walletUiUtils, provider) => {
|
|
30
|
-
const methods = ['getSigner', 'getUncheckedSigner', 'connectUnchecked'];
|
|
31
|
-
methods.forEach((methodName) => {
|
|
32
|
-
const method = parent[methodName];
|
|
33
|
-
if (!isFunction(method)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
Object.assign(parent, {
|
|
37
|
-
[methodName]: (...args) => {
|
|
38
|
-
const result = method.bind(parent)(...args);
|
|
39
|
-
if (typeof result === 'object' && result !== null) {
|
|
40
|
-
assignConfirmationScreenToIntermediaryMethods(result, walletUiUtils, provider);
|
|
41
|
-
applyJsonRpcSignerGates(result, walletUiUtils, provider);
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
const assignConfirmationScreenToProvider = (provider, walletUiUtils) => assignConfirmationScreenToIntermediaryMethods(provider, walletUiUtils, provider);
|
|
49
|
-
|
|
50
|
-
export { assignConfirmationScreenToProvider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { assignConfirmationScreenToProvider } from './assignConfirmationScreenToProvider';
|
package/src/utils/encoding.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
// taken from https://github.com/WalletConnect/walletconnect-utils/blob/master/misc/encoding/src/index.ts
|
|
6
|
-
const ENC_HEX = 'hex';
|
|
7
|
-
const ENC_UTF8 = 'utf8';
|
|
8
|
-
const utf8ToBuffer = (utf8) => Buffer.from(utf8, ENC_UTF8);
|
|
9
|
-
const addHexPrefix = (hex) => hex.startsWith('0x') ? hex : `0x${hex}`;
|
|
10
|
-
const bufferToHex = (buf, prefixed = false) => {
|
|
11
|
-
const hex = buf.toString(ENC_HEX);
|
|
12
|
-
return prefixed ? addHexPrefix(hex) : hex;
|
|
13
|
-
};
|
|
14
|
-
const utf8ToHex = (utf8, prefixed = false) => bufferToHex(utf8ToBuffer(utf8), prefixed);
|
|
15
|
-
|
|
16
|
-
exports.addHexPrefix = addHexPrefix;
|
|
17
|
-
exports.bufferToHex = bufferToHex;
|
|
18
|
-
exports.utf8ToHex = utf8ToHex;
|
package/src/utils/encoding.d.ts
DELETED
package/src/utils/encoding.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// taken from https://github.com/WalletConnect/walletconnect-utils/blob/master/misc/encoding/src/index.ts
|
|
2
|
-
const ENC_HEX = 'hex';
|
|
3
|
-
const ENC_UTF8 = 'utf8';
|
|
4
|
-
const utf8ToBuffer = (utf8) => Buffer.from(utf8, ENC_UTF8);
|
|
5
|
-
const addHexPrefix = (hex) => hex.startsWith('0x') ? hex : `0x${hex}`;
|
|
6
|
-
const bufferToHex = (buf, prefixed = false) => {
|
|
7
|
-
const hex = buf.toString(ENC_HEX);
|
|
8
|
-
return prefixed ? addHexPrefix(hex) : hex;
|
|
9
|
-
};
|
|
10
|
-
const utf8ToHex = (utf8, prefixed = false) => bufferToHex(utf8ToBuffer(utf8), prefixed);
|
|
11
|
-
|
|
12
|
-
export { addHexPrefix, bufferToHex, utf8ToHex };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const chainsInfo = [
|
|
6
|
-
{
|
|
7
|
-
blockchainName: 'Algorand',
|
|
8
|
-
displayName: 'Algorand',
|
|
9
|
-
name: 'algorand',
|
|
10
|
-
symbol: 'ALGO',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
blockchainName: 'Ethereum',
|
|
14
|
-
displayName: 'EVM',
|
|
15
|
-
name: 'evm',
|
|
16
|
-
symbol: 'ETH',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
blockchainName: 'Flow',
|
|
20
|
-
displayName: 'Flow',
|
|
21
|
-
name: 'flow',
|
|
22
|
-
symbol: 'FLOW',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
blockchainName: 'Solana',
|
|
26
|
-
displayName: 'Solana',
|
|
27
|
-
name: 'solana',
|
|
28
|
-
symbol: 'SOL',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
blockchainName: 'Starknet',
|
|
32
|
-
displayName: 'Starknet',
|
|
33
|
-
name: 'starknet',
|
|
34
|
-
symbol: 'STARK',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
blockchainName: 'Cosmos',
|
|
38
|
-
displayName: 'Cosmos',
|
|
39
|
-
name: 'cosmos',
|
|
40
|
-
symbol: 'COSMOS',
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
const chainOverrides = {
|
|
44
|
-
eip155: 'evm',
|
|
45
|
-
eth: 'evm',
|
|
46
|
-
};
|
|
47
|
-
const getChainInfo = (chain) => {
|
|
48
|
-
var _a;
|
|
49
|
-
const lowerCasedChain = chain.toLowerCase();
|
|
50
|
-
const normalizedChain = (_a = chainOverrides[lowerCasedChain]) !== null && _a !== void 0 ? _a : lowerCasedChain;
|
|
51
|
-
const chainInfo = chainsInfo.find((info) => info.name === normalizedChain ||
|
|
52
|
-
info.symbol.toLocaleLowerCase() === normalizedChain);
|
|
53
|
-
if (!chainInfo) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
return chainInfo;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
exports.getChainInfo = getChainInfo;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const chainsInfo = [
|
|
2
|
-
{
|
|
3
|
-
blockchainName: 'Algorand',
|
|
4
|
-
displayName: 'Algorand',
|
|
5
|
-
name: 'algorand',
|
|
6
|
-
symbol: 'ALGO',
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
blockchainName: 'Ethereum',
|
|
10
|
-
displayName: 'EVM',
|
|
11
|
-
name: 'evm',
|
|
12
|
-
symbol: 'ETH',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
blockchainName: 'Flow',
|
|
16
|
-
displayName: 'Flow',
|
|
17
|
-
name: 'flow',
|
|
18
|
-
symbol: 'FLOW',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
blockchainName: 'Solana',
|
|
22
|
-
displayName: 'Solana',
|
|
23
|
-
name: 'solana',
|
|
24
|
-
symbol: 'SOL',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
blockchainName: 'Starknet',
|
|
28
|
-
displayName: 'Starknet',
|
|
29
|
-
name: 'starknet',
|
|
30
|
-
symbol: 'STARK',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
blockchainName: 'Cosmos',
|
|
34
|
-
displayName: 'Cosmos',
|
|
35
|
-
name: 'cosmos',
|
|
36
|
-
symbol: 'COSMOS',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
const chainOverrides = {
|
|
40
|
-
eip155: 'evm',
|
|
41
|
-
eth: 'evm',
|
|
42
|
-
};
|
|
43
|
-
const getChainInfo = (chain) => {
|
|
44
|
-
var _a;
|
|
45
|
-
const lowerCasedChain = chain.toLowerCase();
|
|
46
|
-
const normalizedChain = (_a = chainOverrides[lowerCasedChain]) !== null && _a !== void 0 ? _a : lowerCasedChain;
|
|
47
|
-
const chainInfo = chainsInfo.find((info) => info.name === normalizedChain ||
|
|
48
|
-
info.symbol.toLocaleLowerCase() === normalizedChain);
|
|
49
|
-
if (!chainInfo) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
return chainInfo;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export { getChainInfo };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getChainInfo } from './getChainInfo';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var normalizeWalletName = require('./normalizeWalletName/normalizeWalletName.cjs');
|
|
6
|
-
|
|
7
|
-
const filterWalletsByName = (wallets, names) => names
|
|
8
|
-
.flatMap((name) => wallets.find((w) => walletHasName(w, name)))
|
|
9
|
-
.filter(isWalletConnector);
|
|
10
|
-
const walletHasName = (wallet, name) => normalizeWalletName.normalizeWalletName(wallet.name) === name;
|
|
11
|
-
const isWalletConnector = (item) => Boolean(item);
|
|
12
|
-
const getWalletConnectorByName = (wallets, name) => {
|
|
13
|
-
const normalizedWalletname = normalizeWalletName.normalizeWalletName(name);
|
|
14
|
-
return filterWalletsByName(wallets, [normalizedWalletname]).length > 0
|
|
15
|
-
? filterWalletsByName(wallets, [normalizedWalletname])[0]
|
|
16
|
-
: null;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.getWalletConnectorByName = getWalletConnectorByName;
|