@dynamic-labs/ethereum 1.1.0-alpha.0 → 1.1.0-alpha.10
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 +106 -0
- package/package.json +9 -9
- package/src/EthWalletConnector.cjs +7 -0
- package/src/EthWalletConnector.js +7 -0
- package/src/coinbase/client/client.cjs +2 -8
- package/src/coinbase/client/client.js +2 -8
- package/src/coinbase/coinbase.cjs +27 -8
- package/src/coinbase/coinbase.d.ts +2 -0
- package/src/coinbase/coinbase.js +27 -8
- package/src/ethProviderHelper.cjs +1 -4
- package/src/ethProviderHelper.d.ts +4 -0
- package/src/ethProviderHelper.js +1 -4
- package/src/index.cjs +4 -26
- package/src/index.d.ts +0 -1
- package/src/index.js +4 -16
- package/src/injected/ExodusEvm.cjs +7 -4
- package/src/injected/ExodusEvm.d.ts +4 -2
- package/src/injected/ExodusEvm.js +7 -4
- package/src/injected/PhantomEvm.cjs +10 -13
- package/src/injected/PhantomEvm.d.ts +4 -2
- package/src/injected/PhantomEvm.js +11 -14
- package/src/injected/fetchInjectedWalletConnectors.cjs +13 -2
- package/src/injected/fetchInjectedWalletConnectors.d.ts +1 -0
- package/src/injected/fetchInjectedWalletConnectors.js +13 -3
- package/src/injected/index.d.ts +1 -11
- package/src/walletConnect/client/client.cjs +2 -2
- package/src/walletConnect/client/client.d.ts +1 -1
- package/src/walletConnect/client/client.js +2 -2
- package/src/walletConnect/walletConnect.cjs +1 -1
- package/src/walletConnect/walletConnect.js +2 -2
- package/src/injected/BloctoInjected.cjs +0 -14
- package/src/injected/BloctoInjected.d.ts +0 -4
- package/src/injected/BloctoInjected.js +0 -10
- package/src/injected/BraveEvm.cjs +0 -14
- package/src/injected/BraveEvm.d.ts +0 -4
- package/src/injected/BraveEvm.js +0 -10
- package/src/injected/Dawn.cjs +0 -14
- package/src/injected/Dawn.d.ts +0 -4
- package/src/injected/Dawn.js +0 -10
- package/src/injected/Frame.cjs +0 -14
- package/src/injected/Frame.d.ts +0 -4
- package/src/injected/Frame.js +0 -10
- package/src/injected/GameStop.cjs +0 -14
- package/src/injected/GameStop.d.ts +0 -4
- package/src/injected/GameStop.js +0 -10
- package/src/injected/LegacyInjectedWalletBase.cjs +0 -83
- package/src/injected/LegacyInjectedWalletBase.d.ts +0 -24
- package/src/injected/LegacyInjectedWalletBase.js +0 -81
- package/src/injected/Opera.cjs +0 -14
- package/src/injected/Opera.d.ts +0 -4
- package/src/injected/Opera.js +0 -10
- package/src/injected/Rabby.cjs +0 -15
- package/src/injected/Rabby.d.ts +0 -5
- package/src/injected/Rabby.js +0 -11
- package/src/injected/Superb.cjs +0 -14
- package/src/injected/Superb.d.ts +0 -4
- package/src/injected/Superb.js +0 -10
- package/src/injected/Trust.cjs +0 -15
- package/src/injected/Trust.d.ts +0 -5
- package/src/injected/Trust.js +0 -11
- package/src/injected/Zerion.cjs +0 -15
- package/src/injected/Zerion.d.ts +0 -5
- package/src/injected/Zerion.js +0 -11
- package/src/injected/legacyInjectedWallets.cjs +0 -48
- package/src/injected/legacyInjectedWallets.d.ts +0 -3
- package/src/injected/legacyInjectedWallets.js +0 -43
- package/src/legacyEthProviderHelper.cjs +0 -187
- package/src/legacyEthProviderHelper.d.ts +0 -34
- package/src/legacyEthProviderHelper.js +0 -183
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
-
import { isMobile,
|
|
3
|
-
import
|
|
2
|
+
import { isMobile, handleMobileWalletRedirect } from '@dynamic-labs/utils';
|
|
3
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
|
+
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
4
5
|
|
|
5
|
-
class PhantomEvm extends
|
|
6
|
-
constructor() {
|
|
7
|
-
super(
|
|
6
|
+
class PhantomEvm extends InjectedWalletBase {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
8
9
|
this.name = 'PhantomEvm';
|
|
10
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
9
11
|
}
|
|
10
12
|
fetchPublicAddress() {
|
|
11
13
|
const _super = Object.create(null, {
|
|
@@ -15,16 +17,11 @@ class PhantomEvm extends LegacyInjectedWalletBase {
|
|
|
15
17
|
if (this.isInstalledOnBrowser()) {
|
|
16
18
|
return _super.fetchPublicAddress.call(this);
|
|
17
19
|
}
|
|
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
20
|
if (isMobile()) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
|
|
27
|
-
}
|
|
21
|
+
handleMobileWalletRedirect({
|
|
22
|
+
nativeLink: 'phantom://browse',
|
|
23
|
+
universalLink: 'https://phantom.app/ul/browse',
|
|
24
|
+
});
|
|
28
25
|
}
|
|
29
26
|
return undefined;
|
|
30
27
|
});
|
|
@@ -3,15 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
|
-
var
|
|
6
|
+
var PhantomEvm = require('./PhantomEvm.cjs');
|
|
7
|
+
var ExodusEvm = require('./ExodusEvm.cjs');
|
|
7
8
|
|
|
9
|
+
const injectedWalletOverrides = [
|
|
10
|
+
PhantomEvm.PhantomEvm,
|
|
11
|
+
ExodusEvm.ExodusEvm,
|
|
12
|
+
];
|
|
13
|
+
const filteredInjectedWalletKeysOverrides = [
|
|
14
|
+
'phantomevm',
|
|
15
|
+
'coinbase',
|
|
16
|
+
'exodusevm',
|
|
17
|
+
];
|
|
8
18
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
9
19
|
var _a;
|
|
10
20
|
return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
11
21
|
.filter(([key, wallet]) => {
|
|
12
22
|
var _a;
|
|
13
23
|
return ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'evm')) &&
|
|
14
|
-
!
|
|
24
|
+
!filteredInjectedWalletKeysOverrides.includes(key);
|
|
15
25
|
})
|
|
16
26
|
.map(([key, wallet]) => {
|
|
17
27
|
const { shortName } = wallet;
|
|
@@ -31,3 +41,4 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
31
41
|
};
|
|
32
42
|
|
|
33
43
|
exports.fetchInjectedWalletConnector = fetchInjectedWalletConnector;
|
|
44
|
+
exports.injectedWalletOverrides = injectedWalletOverrides;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
3
|
+
export declare const injectedWalletOverrides: WalletConnectorConstructor[];
|
|
3
4
|
export declare const fetchInjectedWalletConnector: ({ walletBook, }: {
|
|
4
5
|
isWalletConnectV2Enabled: boolean;
|
|
5
6
|
walletBook: WalletBookSchema;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
2
|
-
import {
|
|
2
|
+
import { PhantomEvm } from './PhantomEvm.js';
|
|
3
|
+
import { ExodusEvm } from './ExodusEvm.js';
|
|
3
4
|
|
|
5
|
+
const injectedWalletOverrides = [
|
|
6
|
+
PhantomEvm,
|
|
7
|
+
ExodusEvm,
|
|
8
|
+
];
|
|
9
|
+
const filteredInjectedWalletKeysOverrides = [
|
|
10
|
+
'phantomevm',
|
|
11
|
+
'coinbase',
|
|
12
|
+
'exodusevm',
|
|
13
|
+
];
|
|
4
14
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
5
15
|
var _a;
|
|
6
16
|
return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
7
17
|
.filter(([key, wallet]) => {
|
|
8
18
|
var _a;
|
|
9
19
|
return ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'evm')) &&
|
|
10
|
-
!
|
|
20
|
+
!filteredInjectedWalletKeysOverrides.includes(key);
|
|
11
21
|
})
|
|
12
22
|
.map(([key, wallet]) => {
|
|
13
23
|
const { shortName } = wallet;
|
|
@@ -26,4 +36,4 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
26
36
|
});
|
|
27
37
|
};
|
|
28
38
|
|
|
29
|
-
export { fetchInjectedWalletConnector };
|
|
39
|
+
export { fetchInjectedWalletConnector, injectedWalletOverrides };
|
package/src/injected/index.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export * from './BloctoInjected';
|
|
2
|
-
export * from './BraveEvm';
|
|
3
|
-
export * from './Dawn';
|
|
4
|
-
export * from './ExodusEvm';
|
|
5
|
-
export * from './Frame';
|
|
6
|
-
export * from './GameStop';
|
|
7
|
-
export * from './Opera';
|
|
8
1
|
export * from './PhantomEvm';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './Zerion';
|
|
11
|
-
export * from './Rabby';
|
|
2
|
+
export * from './ExodusEvm';
|
|
12
3
|
export * from './fetchInjectedWalletConnectors';
|
|
13
|
-
export * from './legacyInjectedWallets';
|
|
@@ -12,8 +12,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
|
|
13
13
|
var Client__default = /*#__PURE__*/_interopDefaultLegacy(Client);
|
|
14
14
|
|
|
15
|
-
const initClient = (
|
|
16
|
-
const storageId = `walletconnect-${
|
|
15
|
+
const initClient = (key, bridge, settings) => {
|
|
16
|
+
const storageId = `walletconnect-${key}`;
|
|
17
17
|
const session = localStorage.getItem(storageId);
|
|
18
18
|
const clientArgs = session
|
|
19
19
|
? { session: JSON.parse(session), storageId }
|
|
@@ -2,7 +2,7 @@ import Client from '@walletconnect/client';
|
|
|
2
2
|
import { PublicClient } from 'viem';
|
|
3
3
|
import { FetchPublicAddressOpts, PayloadParams, DeepLinkVariant, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
5
|
-
export declare const initClient: (
|
|
5
|
+
export declare const initClient: (key: string, bridge: string, settings?: any) => Client;
|
|
6
6
|
/**
|
|
7
7
|
* Attach event handlers to WalletConnect events.
|
|
8
8
|
*/
|
|
@@ -4,8 +4,8 @@ import { hashMessage } from 'viem';
|
|
|
4
4
|
import { isSameAddress, logger, performPlatformSpecificConnectionMethod, getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { isMobile } from '@dynamic-labs/utils';
|
|
6
6
|
|
|
7
|
-
const initClient = (
|
|
8
|
-
const storageId = `walletconnect-${
|
|
7
|
+
const initClient = (key, bridge, settings) => {
|
|
8
|
+
const storageId = `walletconnect-${key}`;
|
|
9
9
|
const session = localStorage.getItem(storageId);
|
|
10
10
|
const clientArgs = session
|
|
11
11
|
? { session: JSON.parse(session), storageId }
|
|
@@ -36,7 +36,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
36
36
|
if (this.client) {
|
|
37
37
|
return this.client;
|
|
38
38
|
}
|
|
39
|
-
this.client = client.initClient(
|
|
39
|
+
this.client = client.initClient(this.key, this.bridge, this.clientOptions);
|
|
40
40
|
return this.client;
|
|
41
41
|
}
|
|
42
42
|
supportsNetworkSwitching() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest, __awaiter } from '../../_virtual/_tslib.js';
|
|
2
2
|
import WalletConnectProvider from '@walletconnect/ethereum-provider';
|
|
3
3
|
import { createWalletClient, custom } from 'viem';
|
|
4
|
-
import {
|
|
4
|
+
import { getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import { isMobile, DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
@@ -28,7 +28,7 @@ class WalletConnect extends EthWalletConnector {
|
|
|
28
28
|
if (this.client) {
|
|
29
29
|
return this.client;
|
|
30
30
|
}
|
|
31
|
-
this.client = initClient(
|
|
31
|
+
this.client = initClient(this.key, this.bridge, this.clientOptions);
|
|
32
32
|
return this.client;
|
|
33
33
|
}
|
|
34
34
|
supportsNetworkSwitching() {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class BloctoInjected extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'bloctoInjected';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.BloctoInjected = BloctoInjected;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class BraveEvm extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'BraveEvm';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.BraveEvm = BraveEvm;
|
package/src/injected/BraveEvm.js
DELETED
package/src/injected/Dawn.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class Dawn extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Dawn';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.Dawn = Dawn;
|
package/src/injected/Dawn.d.ts
DELETED
package/src/injected/Dawn.js
DELETED
package/src/injected/Frame.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class Frame extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Frame';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.Frame = Frame;
|
package/src/injected/Frame.d.ts
DELETED
package/src/injected/Frame.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class GameStop extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'GameStop';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.GameStop = GameStop;
|
package/src/injected/GameStop.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
4
|
-
var viem = require('viem');
|
|
5
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
6
|
-
var legacyEthProviderHelper = require('../legacyEthProviderHelper.cjs');
|
|
7
|
-
var EthWalletConnector = require('../EthWalletConnector.cjs');
|
|
8
|
-
var walletConnectV2 = require('../walletConnect/walletConnectV2.cjs');
|
|
9
|
-
var walletConnect = require('../walletConnect/walletConnect.cjs');
|
|
10
|
-
|
|
11
|
-
class LegacyInjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.supportedChains = ['ETH', 'EVM'];
|
|
15
|
-
this.connectedChain = 'EVM';
|
|
16
|
-
this.walletConnectorFallback = false;
|
|
17
|
-
}
|
|
18
|
-
getMobileOrInstalledWallet() {
|
|
19
|
-
var _a, _b, _c;
|
|
20
|
-
if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
|
|
21
|
-
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
22
|
-
if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
|
|
23
|
-
((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
|
|
24
|
-
return new walletConnectV2.WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
setupEventListeners() {
|
|
33
|
-
const provider = legacyEthProviderHelper.LegacyEthProviderHelper.findProvider(this.name);
|
|
34
|
-
if (!provider) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const publicClient = viem.createPublicClient({ transport: viem.custom(provider) });
|
|
38
|
-
const { tearDownEventListeners } = legacyEthProviderHelper.LegacyEthProviderHelper._setupEventListeners(this.name, this, publicClient);
|
|
39
|
-
this.teardownEventListeners = tearDownEventListeners;
|
|
40
|
-
}
|
|
41
|
-
getWalletClient() {
|
|
42
|
-
return legacyEthProviderHelper.LegacyEthProviderHelper.findWalletClient(this.name);
|
|
43
|
-
}
|
|
44
|
-
isInstalledOnBrowser() {
|
|
45
|
-
return legacyEthProviderHelper.LegacyEthProviderHelper.isInstalledHelper(this.name);
|
|
46
|
-
}
|
|
47
|
-
connect() {
|
|
48
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
yield this.fetchPublicAddress();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
fetchPublicAddress() {
|
|
53
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
return legacyEthProviderHelper.LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
signMessage(messageToSign) {
|
|
58
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return legacyEthProviderHelper.LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
proveOwnership(messageToSign) {
|
|
63
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return this.signMessage(messageToSign);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
endSession() {
|
|
68
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
// nothing to do on browser-based metamask
|
|
70
|
-
return;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
providerSwitchNetwork({ network, provider, }) {
|
|
74
|
-
const _super = Object.create(null, {
|
|
75
|
-
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
76
|
-
});
|
|
77
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
module.exports = LegacyInjectedWalletBase;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { WalletClient } from 'viem';
|
|
2
|
-
import { Chain } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import { EvmNetwork } from '@dynamic-labs/types';
|
|
4
|
-
import { EthWalletConnector } from '../EthWalletConnector';
|
|
5
|
-
declare abstract class LegacyInjectedWalletBase extends EthWalletConnector {
|
|
6
|
-
supportedChains: Chain[];
|
|
7
|
-
connectedChain: Chain;
|
|
8
|
-
publicAddress: string | undefined;
|
|
9
|
-
walletConnectorFallback: boolean;
|
|
10
|
-
getMobileOrInstalledWallet(): LegacyInjectedWalletBase;
|
|
11
|
-
setupEventListeners(): void;
|
|
12
|
-
getWalletClient(): WalletClient | undefined;
|
|
13
|
-
isInstalledOnBrowser(): boolean;
|
|
14
|
-
connect(): Promise<void>;
|
|
15
|
-
fetchPublicAddress(): Promise<string | undefined>;
|
|
16
|
-
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
17
|
-
proveOwnership(messageToSign: string): Promise<string | undefined>;
|
|
18
|
-
endSession(): Promise<void>;
|
|
19
|
-
providerSwitchNetwork({ network, provider, }: {
|
|
20
|
-
network: EvmNetwork;
|
|
21
|
-
provider: WalletClient;
|
|
22
|
-
}): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export default LegacyInjectedWalletBase;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
-
import { createPublicClient, custom } from 'viem';
|
|
3
|
-
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
4
|
-
import { LegacyEthProviderHelper } from '../legacyEthProviderHelper.js';
|
|
5
|
-
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
6
|
-
import { WalletConnectV2 } from '../walletConnect/walletConnectV2.js';
|
|
7
|
-
import { WalletConnect } from '../walletConnect/walletConnect.js';
|
|
8
|
-
|
|
9
|
-
class LegacyInjectedWalletBase extends EthWalletConnector {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.supportedChains = ['ETH', 'EVM'];
|
|
13
|
-
this.connectedChain = 'EVM';
|
|
14
|
-
this.walletConnectorFallback = false;
|
|
15
|
-
}
|
|
16
|
-
getMobileOrInstalledWallet() {
|
|
17
|
-
var _a, _b, _c;
|
|
18
|
-
if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
|
|
19
|
-
const wallet = getWalletBookWallet(this.walletBook, this.key);
|
|
20
|
-
if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
|
|
21
|
-
((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
|
|
22
|
-
return new WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
setupEventListeners() {
|
|
31
|
-
const provider = LegacyEthProviderHelper.findProvider(this.name);
|
|
32
|
-
if (!provider) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const publicClient = createPublicClient({ transport: custom(provider) });
|
|
36
|
-
const { tearDownEventListeners } = LegacyEthProviderHelper._setupEventListeners(this.name, this, publicClient);
|
|
37
|
-
this.teardownEventListeners = tearDownEventListeners;
|
|
38
|
-
}
|
|
39
|
-
getWalletClient() {
|
|
40
|
-
return LegacyEthProviderHelper.findWalletClient(this.name);
|
|
41
|
-
}
|
|
42
|
-
isInstalledOnBrowser() {
|
|
43
|
-
return LegacyEthProviderHelper.isInstalledHelper(this.name);
|
|
44
|
-
}
|
|
45
|
-
connect() {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
yield this.fetchPublicAddress();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
fetchPublicAddress() {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
return LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
signMessage(messageToSign) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
proveOwnership(messageToSign) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return this.signMessage(messageToSign);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
endSession() {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
// nothing to do on browser-based metamask
|
|
68
|
-
return;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
providerSwitchNetwork({ network, provider, }) {
|
|
72
|
-
const _super = Object.create(null, {
|
|
73
|
-
providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
|
|
74
|
-
});
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { LegacyInjectedWalletBase as default };
|
package/src/injected/Opera.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class Opera extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Opera';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.Opera = Opera;
|
package/src/injected/Opera.d.ts
DELETED
package/src/injected/Opera.js
DELETED
package/src/injected/Rabby.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class Rabby extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Rabby';
|
|
11
|
-
this.walletConnectorFallback = true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports.Rabby = Rabby;
|
package/src/injected/Rabby.d.ts
DELETED
package/src/injected/Rabby.js
DELETED
package/src/injected/Superb.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
|
|
6
|
-
|
|
7
|
-
class Superb extends LegacyInjectedWalletBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Superb';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.Superb = Superb;
|
package/src/injected/Superb.d.ts
DELETED