@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
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var isMobile = require('../../../utils/isMobile.cjs');
|
|
5
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class PhantomEvm extends InjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'PhantomEvm';
|
|
11
|
-
}
|
|
12
|
-
fetchPublicAddress() {
|
|
13
|
-
const _super = Object.create(null, {
|
|
14
|
-
fetchPublicAddress: { get: () => super.fetchPublicAddress }
|
|
15
|
-
});
|
|
16
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
if (this.isInstalledOnBrowser()) {
|
|
18
|
-
return _super.fetchPublicAddress.call(this);
|
|
19
|
-
}
|
|
20
|
-
const url = encodeURIComponent(window.location.toString());
|
|
21
|
-
const ref = encodeURIComponent(window.location.origin);
|
|
22
|
-
// samsung browser only supports native links, not universal links
|
|
23
|
-
if (isMobile.isMobile()) {
|
|
24
|
-
if (isMobile.isSamsungBrowser()) {
|
|
25
|
-
window.location.assign(`phantom://browse/${url}?ref=${ref}`);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
module.exports = PhantomEvm;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { isMobile, isSamsungBrowser } from '../../../utils/isMobile.js';
|
|
3
|
-
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
4
|
-
|
|
5
|
-
class PhantomEvm extends InjectedWalletBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'PhantomEvm';
|
|
9
|
-
}
|
|
10
|
-
fetchPublicAddress() {
|
|
11
|
-
const _super = Object.create(null, {
|
|
12
|
-
fetchPublicAddress: { get: () => super.fetchPublicAddress }
|
|
13
|
-
});
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
if (this.isInstalledOnBrowser()) {
|
|
16
|
-
return _super.fetchPublicAddress.call(this);
|
|
17
|
-
}
|
|
18
|
-
const url = encodeURIComponent(window.location.toString());
|
|
19
|
-
const ref = encodeURIComponent(window.location.origin);
|
|
20
|
-
// samsung browser only supports native links, not universal links
|
|
21
|
-
if (isMobile()) {
|
|
22
|
-
if (isSamsungBrowser()) {
|
|
23
|
-
window.location.assign(`phantom://browse/${url}?ref=${ref}`);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { PhantomEvm as default };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
4
|
-
|
|
5
|
-
class Trust extends InjectedWalletBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Trust';
|
|
9
|
-
this.walletConnectorFallback = true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = Trust;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
4
|
-
|
|
5
|
-
class UnknownInjectedWallet extends InjectedWalletBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'InjectedWallet';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = UnknownInjectedWallet;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
4
|
-
|
|
5
|
-
class Zerion extends InjectedWalletBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Zerion';
|
|
9
|
-
this.walletConnectorFallback = true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = Zerion;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var walletConnect = require('./walletConnect/walletConnect.cjs');
|
|
7
|
-
var walletConnectV2 = require('./walletConnect/walletConnectV2.cjs');
|
|
8
|
-
|
|
9
|
-
const getWalletConnectConnector = (_a) => {
|
|
10
|
-
var { isWalletConnectV2Enabled } = _a, props = tslib.__rest(_a, ["isWalletConnectV2Enabled"]);
|
|
11
|
-
return isWalletConnectV2Enabled
|
|
12
|
-
? new walletConnectV2(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }))
|
|
13
|
-
: new walletConnect(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.getWalletConnectConnector = getWalletConnectConnector;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import WalletConnect from './walletConnect';
|
|
2
|
-
import WalletConnectV2, { WalletConnectorV2Opts } from './walletConnect/walletConnectV2';
|
|
3
|
-
export declare const getWalletConnectConnector: ({ isWalletConnectV2Enabled, ...props }: Omit<WalletConnectorV2Opts, "walletName"> & {
|
|
4
|
-
isWalletConnectV2Enabled: boolean;
|
|
5
|
-
}) => WalletConnectV2 | WalletConnect;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __rest } from 'tslib';
|
|
2
|
-
import WalletConnect from './walletConnect/walletConnect.js';
|
|
3
|
-
import WalletConnectV2 from './walletConnect/walletConnectV2.js';
|
|
4
|
-
|
|
5
|
-
const getWalletConnectConnector = (_a) => {
|
|
6
|
-
var { isWalletConnectV2Enabled } = _a, props = __rest(_a, ["isWalletConnectV2Enabled"]);
|
|
7
|
-
return isWalletConnectV2Enabled
|
|
8
|
-
? new WalletConnectV2(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }))
|
|
9
|
-
: new WalletConnect(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { getWalletConnectConnector };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var WalletConnectProvider = require('@walletconnect/ethereum-provider');
|
|
5
|
-
var ethers = require('ethers');
|
|
6
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
var constants = require('../constants.cjs');
|
|
9
|
-
var EthWalletConnector = require('../ethereum/EthWalletConnector.cjs');
|
|
10
|
-
var walletConnect = require('../clients/walletConnect/walletConnect.cjs');
|
|
11
|
-
var isMobile = require('../../utils/isMobile.cjs');
|
|
12
|
-
var normalizeWalletName = require('../../utils/normalizeWalletName/normalizeWalletName.cjs');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var WalletConnectProvider__default = /*#__PURE__*/_interopDefaultLegacy(WalletConnectProvider);
|
|
17
|
-
|
|
18
|
-
class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
19
|
-
constructor(_a) {
|
|
20
|
-
var { walletName } = _a, props = tslib.__rest(_a, ["walletName"]);
|
|
21
|
-
super(props);
|
|
22
|
-
this.supportedChains = ['EVM', 'ETH'];
|
|
23
|
-
this.connectedChain = 'EVM';
|
|
24
|
-
this.canConnectViaQrCode = true;
|
|
25
|
-
this.isWalletConnect = true;
|
|
26
|
-
this.switchNetworkOnlyFromWallet = false;
|
|
27
|
-
this.name = walletName;
|
|
28
|
-
}
|
|
29
|
-
getClient() {
|
|
30
|
-
if (this.client) {
|
|
31
|
-
return this.client;
|
|
32
|
-
}
|
|
33
|
-
this.client = walletConnect.initClient(normalizeWalletName.normalizeWalletName(this.name), this.clientOptions);
|
|
34
|
-
return this.client;
|
|
35
|
-
}
|
|
36
|
-
supportsNetworkSwitching() {
|
|
37
|
-
if (this.connectedChain === 'EVM') {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const client = this.getClient();
|
|
42
|
-
return Boolean(client === null || client === void 0 ? void 0 : client.chainId);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
setupEventListeners(listeners) {
|
|
46
|
-
walletConnect.setupWalletConnectEventListeners({
|
|
47
|
-
onAccountChange: listeners.onAccountChange,
|
|
48
|
-
onChainChange: listeners.onChainChange,
|
|
49
|
-
onDisconnect: listeners.onDisconnect,
|
|
50
|
-
}, this.getClient());
|
|
51
|
-
}
|
|
52
|
-
teardownEventListeners() {
|
|
53
|
-
walletConnect.teardownWalletConnectEventListeners(this.getClient());
|
|
54
|
-
}
|
|
55
|
-
getWeb3Provider() {
|
|
56
|
-
const client = this.getClient();
|
|
57
|
-
return client
|
|
58
|
-
? new ethers.ethers.providers.Web3Provider(new WalletConnectProvider__default["default"]({
|
|
59
|
-
connector: client,
|
|
60
|
-
infuraId: constants.infuraId,
|
|
61
|
-
rpc: this.evmNetworkRpcMap(),
|
|
62
|
-
}), 'any')
|
|
63
|
-
: undefined;
|
|
64
|
-
}
|
|
65
|
-
fetchPublicAddress(opts) {
|
|
66
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
return walletConnect.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
|
|
68
|
-
var _a;
|
|
69
|
-
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
70
|
-
this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
|
|
71
|
-
} }));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
getDeepLink() {
|
|
75
|
-
var _a;
|
|
76
|
-
const wallet = walletBook.getWalletBookWallet(this.name);
|
|
77
|
-
if (!isMobile.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
return walletConnect.getDeepLink(this.getClient().uri, wallet, {
|
|
81
|
-
removeWCUri: isMobile.isIOS() && normalizeWalletName.normalizeWalletName(this.name) === 'cryptocom',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
signMessage(messageToSign) {
|
|
85
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
return walletConnect.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.name), this.getClient(),
|
|
87
|
-
// don't call getRpcProvider until we really need to
|
|
88
|
-
() => tslib.__awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
endSession() {
|
|
92
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
walletConnect.killWalletConnectSession(this.getClient());
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
providerSwitchNetwork({ network, provider, }) {
|
|
97
|
-
const _super = Object.create(null, {
|
|
98
|
-
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
99
|
-
});
|
|
100
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const client = this.getClient();
|
|
102
|
-
const currentNetworkId = yield this.getNetwork();
|
|
103
|
-
if (currentNetworkId && currentNetworkId === network.chainId) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (this.switchNetworkOnlyFromWallet !== undefined &&
|
|
107
|
-
this.switchNetworkOnlyFromWallet) {
|
|
108
|
-
throw new utils.DynamicError('Network switching is only supported through the wallet');
|
|
109
|
-
}
|
|
110
|
-
if (!this.supportsNetworkSwitching()) {
|
|
111
|
-
throw new utils.DynamicError('Network switching not supported');
|
|
112
|
-
}
|
|
113
|
-
if (!client) {
|
|
114
|
-
throw new utils.DynamicError('Client not found');
|
|
115
|
-
}
|
|
116
|
-
if (isMobile.isMobile()) {
|
|
117
|
-
const deepLink = walletConnect.getDeepLink(client.uri, walletBook.getWalletBookWallet(this.name));
|
|
118
|
-
window.location.href = deepLink;
|
|
119
|
-
}
|
|
120
|
-
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
getConnectedAccounts() {
|
|
124
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const client = this.getClient();
|
|
126
|
-
if (!client.connected)
|
|
127
|
-
return [];
|
|
128
|
-
return client.accounts;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
module.exports = WalletConnect;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import Client from '@walletconnect/client';
|
|
2
|
-
import { ethers } from 'ethers';
|
|
3
|
-
import { Chain, FetchPublicAddressOpts, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { EvmNetwork } from '@dynamic-labs/types';
|
|
5
|
-
import { EthWalletConnector, EthWalletConnectorOpts } from '../ethereum/EthWalletConnector';
|
|
6
|
-
export type WalletConnectOpts = EthWalletConnectorOpts & {
|
|
7
|
-
walletName: string;
|
|
8
|
-
};
|
|
9
|
-
declare class WalletConnect extends EthWalletConnector {
|
|
10
|
-
supportedChains: Chain[];
|
|
11
|
-
connectedChain: Chain;
|
|
12
|
-
name: string;
|
|
13
|
-
canConnectViaQrCode: boolean;
|
|
14
|
-
isWalletConnect: boolean;
|
|
15
|
-
switchNetworkOnlyFromWallet: boolean;
|
|
16
|
-
client?: Client;
|
|
17
|
-
clientOptions?: any;
|
|
18
|
-
constructor({ walletName, ...props }: WalletConnectOpts);
|
|
19
|
-
getClient(): Client;
|
|
20
|
-
supportsNetworkSwitching(): boolean;
|
|
21
|
-
setupEventListeners(listeners: WalletEventListeners): void;
|
|
22
|
-
teardownEventListeners(): void;
|
|
23
|
-
getWeb3Provider(): ethers.providers.Web3Provider | undefined;
|
|
24
|
-
fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
|
|
25
|
-
getDeepLink(): string | undefined;
|
|
26
|
-
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
27
|
-
endSession(): Promise<void>;
|
|
28
|
-
providerSwitchNetwork({ network, provider, }: {
|
|
29
|
-
network: EvmNetwork;
|
|
30
|
-
provider: ethers.providers.Web3Provider;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
33
|
-
}
|
|
34
|
-
export default WalletConnect;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { __rest, __awaiter } from 'tslib';
|
|
2
|
-
import WalletConnectProvider from '@walletconnect/ethereum-provider';
|
|
3
|
-
import { ethers } from 'ethers';
|
|
4
|
-
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
-
import { infuraId } from '../constants.js';
|
|
7
|
-
import { EthWalletConnector } from '../ethereum/EthWalletConnector.js';
|
|
8
|
-
import { initClient, setupWalletConnectEventListeners, teardownWalletConnectEventListeners, fetchWalletConnectEVMPublicAddress, getDeepLink, signWalletConnectPersonalMessage, killWalletConnectSession } from '../clients/walletConnect/walletConnect.js';
|
|
9
|
-
import { isMobile, isIOS } from '../../utils/isMobile.js';
|
|
10
|
-
import { normalizeWalletName } from '../../utils/normalizeWalletName/normalizeWalletName.js';
|
|
11
|
-
|
|
12
|
-
class WalletConnect extends EthWalletConnector {
|
|
13
|
-
constructor(_a) {
|
|
14
|
-
var { walletName } = _a, props = __rest(_a, ["walletName"]);
|
|
15
|
-
super(props);
|
|
16
|
-
this.supportedChains = ['EVM', 'ETH'];
|
|
17
|
-
this.connectedChain = 'EVM';
|
|
18
|
-
this.canConnectViaQrCode = true;
|
|
19
|
-
this.isWalletConnect = true;
|
|
20
|
-
this.switchNetworkOnlyFromWallet = false;
|
|
21
|
-
this.name = walletName;
|
|
22
|
-
}
|
|
23
|
-
getClient() {
|
|
24
|
-
if (this.client) {
|
|
25
|
-
return this.client;
|
|
26
|
-
}
|
|
27
|
-
this.client = initClient(normalizeWalletName(this.name), this.clientOptions);
|
|
28
|
-
return this.client;
|
|
29
|
-
}
|
|
30
|
-
supportsNetworkSwitching() {
|
|
31
|
-
if (this.connectedChain === 'EVM') {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const client = this.getClient();
|
|
36
|
-
return Boolean(client === null || client === void 0 ? void 0 : client.chainId);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
setupEventListeners(listeners) {
|
|
40
|
-
setupWalletConnectEventListeners({
|
|
41
|
-
onAccountChange: listeners.onAccountChange,
|
|
42
|
-
onChainChange: listeners.onChainChange,
|
|
43
|
-
onDisconnect: listeners.onDisconnect,
|
|
44
|
-
}, this.getClient());
|
|
45
|
-
}
|
|
46
|
-
teardownEventListeners() {
|
|
47
|
-
teardownWalletConnectEventListeners(this.getClient());
|
|
48
|
-
}
|
|
49
|
-
getWeb3Provider() {
|
|
50
|
-
const client = this.getClient();
|
|
51
|
-
return client
|
|
52
|
-
? new ethers.providers.Web3Provider(new WalletConnectProvider({
|
|
53
|
-
connector: client,
|
|
54
|
-
infuraId,
|
|
55
|
-
rpc: this.evmNetworkRpcMap(),
|
|
56
|
-
}), 'any')
|
|
57
|
-
: undefined;
|
|
58
|
-
}
|
|
59
|
-
fetchPublicAddress(opts) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return fetchWalletConnectEVMPublicAddress(getWalletBookWallet(this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
|
|
62
|
-
var _a;
|
|
63
|
-
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
64
|
-
this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
|
|
65
|
-
} }));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
getDeepLink() {
|
|
69
|
-
var _a;
|
|
70
|
-
const wallet = getWalletBookWallet(this.name);
|
|
71
|
-
if (!isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
return getDeepLink(this.getClient().uri, wallet, {
|
|
75
|
-
removeWCUri: isIOS() && normalizeWalletName(this.name) === 'cryptocom',
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
signMessage(messageToSign) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
return signWalletConnectPersonalMessage(messageToSign, getWalletBookWallet(this.name), this.getClient(),
|
|
81
|
-
// don't call getRpcProvider until we really need to
|
|
82
|
-
() => __awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
endSession() {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
killWalletConnectSession(this.getClient());
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
providerSwitchNetwork({ network, provider, }) {
|
|
91
|
-
const _super = Object.create(null, {
|
|
92
|
-
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
93
|
-
});
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const client = this.getClient();
|
|
96
|
-
const currentNetworkId = yield this.getNetwork();
|
|
97
|
-
if (currentNetworkId && currentNetworkId === network.chainId) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (this.switchNetworkOnlyFromWallet !== undefined &&
|
|
101
|
-
this.switchNetworkOnlyFromWallet) {
|
|
102
|
-
throw new DynamicError('Network switching is only supported through the wallet');
|
|
103
|
-
}
|
|
104
|
-
if (!this.supportsNetworkSwitching()) {
|
|
105
|
-
throw new DynamicError('Network switching not supported');
|
|
106
|
-
}
|
|
107
|
-
if (!client) {
|
|
108
|
-
throw new DynamicError('Client not found');
|
|
109
|
-
}
|
|
110
|
-
if (isMobile()) {
|
|
111
|
-
const deepLink = getDeepLink(client.uri, getWalletBookWallet(this.name));
|
|
112
|
-
window.location.href = deepLink;
|
|
113
|
-
}
|
|
114
|
-
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
getConnectedAccounts() {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const client = this.getClient();
|
|
120
|
-
if (!client.connected)
|
|
121
|
-
return [];
|
|
122
|
-
return client.accounts;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { WalletConnect as default };
|