@dynamic-labs/ethereum 0.19.0-alpha.2 → 0.19.0-alpha.21
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 +293 -0
- package/package.json +13 -10
- package/src/EthWalletConnector.cjs +189 -193
- package/src/EthWalletConnector.d.ts +298 -41
- package/src/EthWalletConnector.js +190 -194
- package/src/coinbase/client/client.cjs +76 -0
- package/src/coinbase/client/client.d.ts +6 -0
- package/src/coinbase/client/client.js +69 -0
- package/src/coinbase/client/index.d.ts +2 -0
- package/src/coinbase/client/types.d.ts +14 -0
- package/src/coinbase/coinbase.cjs +71 -0
- package/src/coinbase/coinbase.d.ts +535 -0
- package/src/coinbase/coinbase.js +67 -0
- package/src/coinbase/index.d.ts +3 -0
- package/src/constants.d.ts +1 -1
- package/src/ethProviderHelper.cjs +132 -209
- package/src/ethProviderHelper.d.ts +28 -36
- package/src/ethProviderHelper.js +133 -210
- package/src/index.cjs +30 -26
- package/src/index.d.ts +9 -8
- package/src/index.js +25 -20
- package/src/injected/BloctoInjected.cjs +6 -6
- package/src/injected/BloctoInjected.d.ts +4 -4
- package/src/injected/BloctoInjected.js +6 -6
- package/src/injected/BraveEvm.cjs +6 -6
- package/src/injected/BraveEvm.d.ts +4 -4
- package/src/injected/BraveEvm.js +6 -6
- package/src/injected/Dawn.cjs +6 -6
- package/src/injected/Dawn.d.ts +4 -4
- package/src/injected/Dawn.js +6 -6
- package/src/injected/ExodusEvm.cjs +8 -8
- package/src/injected/ExodusEvm.d.ts +5 -5
- package/src/injected/ExodusEvm.js +7 -7
- package/src/injected/Frame.cjs +6 -6
- package/src/injected/Frame.d.ts +4 -4
- package/src/injected/Frame.js +6 -6
- package/src/injected/GameStop.cjs +6 -6
- package/src/injected/GameStop.d.ts +4 -4
- package/src/injected/GameStop.js +6 -6
- package/src/injected/InjectedWalletBase.cjs +86 -65
- package/src/injected/InjectedWalletBase.d.ts +29 -24
- package/src/injected/InjectedWalletBase.js +86 -65
- package/src/injected/LegacyInjectedWalletBase.cjs +83 -0
- package/src/injected/LegacyInjectedWalletBase.d.ts +24 -0
- package/src/injected/LegacyInjectedWalletBase.js +81 -0
- package/src/injected/Opera.cjs +6 -6
- package/src/injected/Opera.d.ts +4 -4
- package/src/injected/Opera.js +6 -6
- package/src/injected/PhantomEvm.cjs +28 -28
- package/src/injected/PhantomEvm.d.ts +5 -5
- package/src/injected/PhantomEvm.js +28 -28
- package/src/injected/Rabby.cjs +8 -8
- package/src/injected/Rabby.d.ts +5 -5
- package/src/injected/Rabby.js +7 -7
- package/src/injected/Superb.cjs +6 -6
- package/src/injected/Superb.d.ts +4 -4
- package/src/injected/Superb.js +6 -6
- package/src/injected/Trust.cjs +8 -8
- package/src/injected/Trust.d.ts +5 -5
- package/src/injected/Trust.js +7 -7
- package/src/injected/Zerion.cjs +8 -8
- package/src/injected/Zerion.d.ts +5 -5
- package/src/injected/Zerion.js +7 -7
- package/src/injected/fetchInjectedWalletConnectors.cjs +33 -0
- package/src/injected/fetchInjectedWalletConnectors.d.ts +6 -0
- package/src/injected/fetchInjectedWalletConnectors.js +29 -0
- package/src/injected/index.d.ts +13 -16
- package/src/injected/legacyInjectedWallets.cjs +48 -0
- package/src/injected/legacyInjectedWallets.d.ts +3 -0
- package/src/injected/legacyInjectedWallets.js +43 -0
- package/src/legacyEthProviderHelper.cjs +187 -0
- package/src/legacyEthProviderHelper.d.ts +34 -0
- package/src/legacyEthProviderHelper.js +183 -0
- package/src/polyfills.cjs +11 -11
- package/src/polyfills.d.ts +1 -1
- package/src/polyfills.js +11 -11
- package/src/types.d.ts +37 -24
- package/src/utils/eventListenerHandlers.cjs +34 -0
- package/src/utils/eventListenerHandlers.d.ts +8 -0
- package/src/utils/eventListenerHandlers.js +30 -0
- package/src/utils/findEvmNetwork.cjs +13 -13
- package/src/utils/findEvmNetwork.d.ts +6 -6
- package/src/utils/findEvmNetwork.js +13 -13
- package/src/utils/isString.d.ts +1 -1
- package/src/utils/isUnsupportedProviderError/index.d.ts +1 -1
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +6 -6
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +6 -6
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +6 -6
- package/src/utils/last.d.ts +1 -1
- package/src/utils/parseIntSafe.cjs +13 -13
- package/src/utils/parseIntSafe.d.ts +1 -1
- package/src/utils/parseIntSafe.js +13 -13
- package/src/walletConnect/client/client.cjs +179 -176
- package/src/walletConnect/client/client.d.ts +17 -17
- package/src/walletConnect/client/client.js +179 -176
- package/src/walletConnect/client/index.d.ts +1 -1
- package/src/walletConnect/client/types.d.ts +4 -4
- package/src/walletConnect/fetchWalletConnectWallets.cjs +37 -52
- package/src/walletConnect/fetchWalletConnectWallets.d.ts +9 -10
- package/src/walletConnect/fetchWalletConnectWallets.js +38 -52
- package/src/walletConnect/index.d.ts +3 -3
- package/src/walletConnect/walletConnect.cjs +131 -130
- package/src/walletConnect/walletConnect.d.ts +52 -50
- package/src/walletConnect/walletConnect.js +131 -130
- package/src/walletConnect/walletConnectV2.cjs +419 -374
- package/src/walletConnect/walletConnectV2.d.ts +326 -61
- package/src/walletConnect/walletConnectV2.js +420 -375
- package/src/injected/MetaMask.cjs +0 -15
- package/src/injected/MetaMask.d.ts +0 -5
- package/src/injected/MetaMask.js +0 -11
- package/src/injected/OKX.cjs +0 -15
- package/src/injected/OKX.d.ts +0 -5
- package/src/injected/OKX.js +0 -11
- package/src/injected/UnknownInjectedWallet.cjs +0 -14
- package/src/injected/UnknownInjectedWallet.d.ts +0 -4
- package/src/injected/UnknownInjectedWallet.js +0 -10
- package/src/injected/index.cjs +0 -53
- package/src/injected/index.js +0 -49
|
@@ -1,57 +1,43 @@
|
|
|
1
1
|
import { WalletConnectV2 } from './walletConnectV2.js';
|
|
2
2
|
import { WalletConnect } from './walletConnect.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
|
|
46
|
-
? class extends WalletConnectV2 {
|
|
47
|
-
constructor(props) {
|
|
48
|
-
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
: class extends WalletConnect {
|
|
52
|
-
constructor(props) {
|
|
53
|
-
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
54
|
-
}
|
|
4
|
+
const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
|
|
5
|
+
var _a;
|
|
6
|
+
return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
7
|
+
.filter((wallet) => wallet.walletConnect && !wallet.filterFromWalletConnect)
|
|
8
|
+
.map((wallet) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const { shortName } = wallet;
|
|
11
|
+
const name = shortName || wallet.name;
|
|
12
|
+
// justification: we filtered out null/undefined above
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
|
+
if (isWalletConnectV2Enabled &&
|
|
15
|
+
((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
|
|
16
|
+
return class extends WalletConnectV2 {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(Object.assign(Object.assign({}, props), { walletName: name }));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return class extends WalletConnect {
|
|
24
|
+
constructor(props) {
|
|
25
|
+
super(Object.assign(Object.assign({}, props), { walletName: name }));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
|
|
32
|
+
? class extends WalletConnectV2 {
|
|
33
|
+
constructor(props) {
|
|
34
|
+
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
: class extends WalletConnect {
|
|
38
|
+
constructor(props) {
|
|
39
|
+
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
40
|
+
}
|
|
55
41
|
};
|
|
56
42
|
|
|
57
|
-
export { fetchWalletConnectWallets,
|
|
43
|
+
export { fetchWalletConnectWallets, getWalletConnectConnector };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { WalletConnectV2, type WalletConnectorV2Opts } from './walletConnectV2';
|
|
2
|
-
export { WalletConnect } from './walletConnect';
|
|
3
|
-
export { fetchWalletConnectWallets } from './fetchWalletConnectWallets';
|
|
1
|
+
export { WalletConnectV2, type WalletConnectorV2Opts } from './walletConnectV2';
|
|
2
|
+
export { WalletConnect } from './walletConnect';
|
|
3
|
+
export { fetchWalletConnectWallets } from './fetchWalletConnectWallets';
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
6
|
var WalletConnectProvider = require('@walletconnect/ethereum-provider');
|
|
7
|
-
var
|
|
7
|
+
var viem = require('viem');
|
|
8
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
9
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
10
|
var utils = require('@dynamic-labs/utils');
|
|
@@ -16,135 +16,136 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
|
|
17
17
|
var WalletConnectProvider__default = /*#__PURE__*/_interopDefaultLegacy(WalletConnectProvider);
|
|
18
18
|
|
|
19
|
-
class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
20
|
-
constructor(_a) {
|
|
21
|
-
var { walletConnectV1Bridge, walletName } = _a, props = _tslib.__rest(_a, ["walletConnectV1Bridge", "walletName"]);
|
|
22
|
-
super(props);
|
|
23
|
-
this.supportedChains = ['EVM', 'ETH'];
|
|
24
|
-
this.connectedChain = 'EVM';
|
|
25
|
-
this.bridge = 'https://bridge.walletconnect.org';
|
|
26
|
-
this.canConnectViaQrCode = true;
|
|
27
|
-
this.isWalletConnect = true;
|
|
28
|
-
this.switchNetworkOnlyFromWallet = false;
|
|
29
|
-
this.name = walletName;
|
|
30
|
-
if (walletConnectV1Bridge) {
|
|
31
|
-
this.bridge = walletConnectV1Bridge;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
client
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
uri: this.getClient().uri,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
signMessage(messageToSign) {
|
|
92
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.
|
|
94
|
-
// don't call
|
|
95
|
-
() => _tslib.__awaiter(this, void 0, void 0, function* () { return this.
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
endSession() {
|
|
99
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
client.killWalletConnectSession(this.getClient());
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
providerSwitchNetwork({ network, provider, }) {
|
|
104
|
-
const _super = Object.create(null, {
|
|
105
|
-
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
106
|
-
});
|
|
107
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const client = this.getClient();
|
|
109
|
-
const currentNetworkId = yield this.getNetwork();
|
|
110
|
-
if (currentNetworkId && currentNetworkId === network.chainId) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (this.switchNetworkOnlyFromWallet !== undefined &&
|
|
114
|
-
this.switchNetworkOnlyFromWallet) {
|
|
115
|
-
throw new utils.DynamicError('Network switching is only supported through the wallet');
|
|
116
|
-
}
|
|
117
|
-
if (!this.supportsNetworkSwitching()) {
|
|
118
|
-
throw new utils.DynamicError('Network switching not supported');
|
|
119
|
-
}
|
|
120
|
-
if (!client) {
|
|
121
|
-
throw new utils.DynamicError('Client not found');
|
|
122
|
-
}
|
|
123
|
-
if (utils.isMobile()) {
|
|
124
|
-
const deepLink = walletConnectorCore.getDeepLink({
|
|
125
|
-
metadata: walletBook.getWalletBookWallet(this.walletBook, this.
|
|
126
|
-
mode: 'regular',
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
19
|
+
class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
20
|
+
constructor(_a) {
|
|
21
|
+
var { walletConnectV1Bridge, walletName } = _a, props = _tslib.__rest(_a, ["walletConnectV1Bridge", "walletName"]);
|
|
22
|
+
super(props);
|
|
23
|
+
this.supportedChains = ['EVM', 'ETH'];
|
|
24
|
+
this.connectedChain = 'EVM';
|
|
25
|
+
this.bridge = 'https://bridge.walletconnect.org';
|
|
26
|
+
this.canConnectViaQrCode = true;
|
|
27
|
+
this.isWalletConnect = true;
|
|
28
|
+
this.switchNetworkOnlyFromWallet = false;
|
|
29
|
+
this.name = walletName;
|
|
30
|
+
if (walletConnectV1Bridge) {
|
|
31
|
+
this.bridge = walletConnectV1Bridge;
|
|
32
|
+
}
|
|
33
|
+
this.deepLinkPreference = props.deepLinkPreference || 'native';
|
|
34
|
+
}
|
|
35
|
+
getClient() {
|
|
36
|
+
if (this.client) {
|
|
37
|
+
return this.client;
|
|
38
|
+
}
|
|
39
|
+
this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.bridge, this.clientOptions);
|
|
40
|
+
return this.client;
|
|
41
|
+
}
|
|
42
|
+
supportsNetworkSwitching() {
|
|
43
|
+
if (this.connectedChain === 'EVM') {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const client = this.getClient();
|
|
48
|
+
return Boolean(client === null || client === void 0 ? void 0 : client.chainId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
setupEventListeners() {
|
|
52
|
+
client.setupWalletConnectEventListeners(this, this.getClient());
|
|
53
|
+
}
|
|
54
|
+
teardownEventListeners() {
|
|
55
|
+
client.teardownWalletConnectEventListeners(this.getClient());
|
|
56
|
+
}
|
|
57
|
+
getWalletClient() {
|
|
58
|
+
const client = this.getClient();
|
|
59
|
+
return client
|
|
60
|
+
? viem.createWalletClient({
|
|
61
|
+
transport: viem.custom(new WalletConnectProvider__default["default"]({
|
|
62
|
+
connector: client,
|
|
63
|
+
infuraId: constants.INFURA_ID,
|
|
64
|
+
rpc: this.evmNetworkRpcMap(),
|
|
65
|
+
})),
|
|
66
|
+
})
|
|
67
|
+
: undefined;
|
|
68
|
+
}
|
|
69
|
+
fetchPublicAddress(opts) {
|
|
70
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference, Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
74
|
+
this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
|
|
75
|
+
} }));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
getDeepLink() {
|
|
79
|
+
var _a;
|
|
80
|
+
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
81
|
+
if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return walletConnectorCore.getDeepLink({
|
|
85
|
+
metadata: wallet,
|
|
86
|
+
mode: 'regular',
|
|
87
|
+
preference: this.deepLinkPreference,
|
|
88
|
+
uri: this.getClient().uri,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
signMessage(messageToSign) {
|
|
92
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference,
|
|
94
|
+
// don't call getPublicClient until we really need to
|
|
95
|
+
() => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getPublicClient(); }));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
endSession() {
|
|
99
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
client.killWalletConnectSession(this.getClient());
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
providerSwitchNetwork({ network, provider, }) {
|
|
104
|
+
const _super = Object.create(null, {
|
|
105
|
+
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
106
|
+
});
|
|
107
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const client = this.getClient();
|
|
109
|
+
const currentNetworkId = yield this.getNetwork();
|
|
110
|
+
if (currentNetworkId && currentNetworkId === network.chainId) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (this.switchNetworkOnlyFromWallet !== undefined &&
|
|
114
|
+
this.switchNetworkOnlyFromWallet) {
|
|
115
|
+
throw new utils.DynamicError('Network switching is only supported through the wallet');
|
|
116
|
+
}
|
|
117
|
+
if (!this.supportsNetworkSwitching()) {
|
|
118
|
+
throw new utils.DynamicError('Network switching not supported');
|
|
119
|
+
}
|
|
120
|
+
if (!client) {
|
|
121
|
+
throw new utils.DynamicError('Client not found');
|
|
122
|
+
}
|
|
123
|
+
if (utils.isMobile()) {
|
|
124
|
+
const deepLink = walletConnectorCore.getDeepLink({
|
|
125
|
+
metadata: walletBook.getWalletBookWallet(this.walletBook, this.key),
|
|
126
|
+
mode: 'regular',
|
|
127
|
+
preference: this.deepLinkPreference,
|
|
128
|
+
uri: client.uri,
|
|
129
|
+
});
|
|
130
|
+
window.location.href = deepLink;
|
|
131
|
+
}
|
|
132
|
+
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
getConnectedAccounts() {
|
|
136
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const client = this.getClient();
|
|
138
|
+
if (!client.connected)
|
|
139
|
+
return [];
|
|
140
|
+
return client.accounts;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getSession() {
|
|
144
|
+
var _a;
|
|
145
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return (_a = this.client) === null || _a === void 0 ? void 0 : _a.session;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
exports.WalletConnect = WalletConnect;
|
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import Client from '@walletconnect/client';
|
|
2
|
-
import {
|
|
3
|
-
import { Chain, FetchPublicAddressOpts,
|
|
4
|
-
import { EvmNetwork } from '@dynamic-labs/types';
|
|
5
|
-
import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
6
|
-
type ConnectorSession = {
|
|
7
|
-
connected: boolean;
|
|
8
|
-
accounts: string[];
|
|
9
|
-
chainId: number;
|
|
10
|
-
bridge: string;
|
|
11
|
-
key: string;
|
|
12
|
-
clientId: string;
|
|
13
|
-
clientMeta: any;
|
|
14
|
-
peerId: string;
|
|
15
|
-
peerMeta: any;
|
|
16
|
-
handshakeId: number;
|
|
17
|
-
handshakeTopic: string;
|
|
18
|
-
};
|
|
19
|
-
export type WalletConnectOpts = EthWalletConnectorOpts & {
|
|
20
|
-
walletConnectV1Bridge: string;
|
|
21
|
-
walletName: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import Client from '@walletconnect/client';
|
|
2
|
+
import { Hex, WalletClient } from 'viem';
|
|
3
|
+
import { Chain, FetchPublicAddressOpts, DeepLinkVariant } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { EvmNetwork } from '@dynamic-labs/types';
|
|
5
|
+
import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
6
|
+
type ConnectorSession = {
|
|
7
|
+
connected: boolean;
|
|
8
|
+
accounts: string[];
|
|
9
|
+
chainId: number;
|
|
10
|
+
bridge: string;
|
|
11
|
+
key: string;
|
|
12
|
+
clientId: string;
|
|
13
|
+
clientMeta: any;
|
|
14
|
+
peerId: string;
|
|
15
|
+
peerMeta: any;
|
|
16
|
+
handshakeId: number;
|
|
17
|
+
handshakeTopic: string;
|
|
18
|
+
};
|
|
19
|
+
export type WalletConnectOpts = EthWalletConnectorOpts & {
|
|
20
|
+
walletConnectV1Bridge: string;
|
|
21
|
+
walletName: string;
|
|
22
|
+
deepLinkPreference?: DeepLinkVariant;
|
|
23
|
+
};
|
|
24
|
+
export declare class WalletConnect extends EthWalletConnector {
|
|
25
|
+
supportedChains: Chain[];
|
|
26
|
+
connectedChain: Chain;
|
|
27
|
+
name: string;
|
|
28
|
+
bridge: string;
|
|
29
|
+
canConnectViaQrCode: boolean;
|
|
30
|
+
isWalletConnect: boolean;
|
|
31
|
+
switchNetworkOnlyFromWallet: boolean;
|
|
32
|
+
private deepLinkPreference;
|
|
33
|
+
client?: Client;
|
|
34
|
+
clientOptions?: any;
|
|
35
|
+
constructor({ walletConnectV1Bridge, walletName, ...props }: WalletConnectOpts);
|
|
36
|
+
getClient(): Client;
|
|
37
|
+
supportsNetworkSwitching(): boolean;
|
|
38
|
+
setupEventListeners(): void;
|
|
39
|
+
teardownEventListeners(): void;
|
|
40
|
+
getWalletClient(): WalletClient | undefined;
|
|
41
|
+
fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
|
|
42
|
+
getDeepLink(): string | undefined;
|
|
43
|
+
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
44
|
+
endSession(): Promise<void>;
|
|
45
|
+
providerSwitchNetwork({ network, provider, }: {
|
|
46
|
+
network: EvmNetwork;
|
|
47
|
+
provider: WalletClient;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
getConnectedAccounts(): Promise<Hex[]>;
|
|
50
|
+
getSession(): Promise<ConnectorSession | undefined>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|