@dynamic-labs/ethereum 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +394 -0
- package/package.json +11 -12
- package/src/EthWalletConnector.cjs +1 -20
- package/src/EthWalletConnector.d.ts +9 -10
- package/src/EthWalletConnector.js +3 -22
- package/src/coinbase/client/client.cjs +14 -14
- package/src/coinbase/client/client.d.ts +5 -4
- package/src/coinbase/client/client.js +13 -13
- package/src/coinbase/client/types.d.ts +6 -3
- package/src/coinbase/coinbase.cjs +30 -14
- package/src/coinbase/coinbase.d.ts +20 -18
- package/src/coinbase/coinbase.js +31 -15
- package/src/ethProviderHelper.cjs +10 -5
- package/src/ethProviderHelper.d.ts +4 -3
- package/src/ethProviderHelper.js +10 -5
- package/src/index.cjs +7 -13
- package/src/index.d.ts +1 -0
- package/src/index.js +7 -13
- package/src/injected/ExodusEvm.cjs +1 -0
- package/src/injected/ExodusEvm.d.ts +1 -0
- package/src/injected/ExodusEvm.js +1 -0
- package/src/injected/InjectedWalletBase.cjs +27 -18
- package/src/injected/InjectedWalletBase.d.ts +2 -2
- package/src/injected/InjectedWalletBase.js +27 -18
- package/src/injected/PhantomEvm.cjs +4 -3
- package/src/injected/PhantomEvm.d.ts +2 -1
- package/src/injected/PhantomEvm.js +4 -3
- package/src/injected/Zerion.cjs +38 -0
- package/src/injected/Zerion.d.ts +10 -0
- package/src/injected/Zerion.js +34 -0
- package/src/injected/fetchInjectedWalletConnectors.cjs +25 -0
- package/src/injected/fetchInjectedWalletConnectors.d.ts +0 -1
- package/src/injected/fetchInjectedWalletConnectors.js +25 -0
- package/src/walletConnect/fetchWalletConnectWallets.cjs +14 -33
- package/src/walletConnect/fetchWalletConnectWallets.d.ts +2 -5
- package/src/walletConnect/fetchWalletConnectWallets.js +14 -33
- package/src/walletConnect/index.d.ts +0 -1
- package/src/walletConnect/walletConnect.cjs +450 -78
- package/src/walletConnect/walletConnect.d.ts +315 -31
- package/src/walletConnect/walletConnect.js +451 -80
- package/src/walletConnect/client/client.cjs +0 -201
- package/src/walletConnect/client/client.d.ts +0 -17
- package/src/walletConnect/client/client.js +0 -187
- package/src/walletConnect/client/index.d.ts +0 -1
- package/src/walletConnect/client/types.d.ts +0 -4
- package/src/walletConnect/walletConnectV2.cjs +0 -475
- package/src/walletConnect/walletConnectV2.d.ts +0 -333
- package/src/walletConnect/walletConnectV2.js +0 -466
package/src/index.cjs
CHANGED
|
@@ -7,27 +7,21 @@ var turnkey = require('@dynamic-labs/turnkey');
|
|
|
7
7
|
var PhantomEvm = require('./injected/PhantomEvm.cjs');
|
|
8
8
|
var ExodusEvm = require('./injected/ExodusEvm.cjs');
|
|
9
9
|
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
10
|
-
require('./walletConnect/
|
|
11
|
-
require('../_virtual/_tslib.cjs');
|
|
12
|
-
require('@walletconnect/ethereum-provider');
|
|
13
|
-
require('viem');
|
|
14
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
15
|
-
require('@dynamic-labs/wallet-book');
|
|
16
|
-
require('@dynamic-labs/utils');
|
|
17
|
-
var EthWalletConnector = require('./EthWalletConnector.cjs');
|
|
18
|
-
var constants = require('./constants.cjs');
|
|
19
|
-
require('@walletconnect/client');
|
|
10
|
+
require('./walletConnect/walletConnect.cjs');
|
|
20
11
|
var fetchWalletConnectWallets = require('./walletConnect/fetchWalletConnectWallets.cjs');
|
|
21
12
|
var coinbase = require('./coinbase/coinbase.cjs');
|
|
13
|
+
require('@dynamic-labs/rpc-provider-ethereum');
|
|
14
|
+
var EthWalletConnector = require('./EthWalletConnector.cjs');
|
|
22
15
|
var ethProviderHelper = require('./ethProviderHelper.cjs');
|
|
16
|
+
var constants = require('./constants.cjs');
|
|
23
17
|
|
|
24
18
|
const EthereumWalletConnectors = (props) => [
|
|
25
19
|
...fetchInjectedWalletConnectors.injectedWalletOverrides,
|
|
26
20
|
...fetchInjectedWalletConnectors.fetchInjectedWalletConnector(props),
|
|
27
21
|
...fetchWalletConnectWallets.fetchWalletConnectWallets(props),
|
|
28
|
-
...turnkey.
|
|
22
|
+
...turnkey.TurnkeyEVMWalletConnectors(props),
|
|
29
23
|
coinbase.Coinbase,
|
|
30
|
-
fetchWalletConnectWallets.getWalletConnectConnector(
|
|
24
|
+
fetchWalletConnectWallets.getWalletConnectConnector(),
|
|
31
25
|
];
|
|
32
26
|
|
|
33
27
|
exports.PhantomEvm = PhantomEvm.PhantomEvm;
|
|
@@ -35,6 +29,6 @@ exports.ExodusEvm = ExodusEvm.ExodusEvm;
|
|
|
35
29
|
exports.fetchInjectedWalletConnector = fetchInjectedWalletConnectors.fetchInjectedWalletConnector;
|
|
36
30
|
exports.injectedWalletOverrides = fetchInjectedWalletConnectors.injectedWalletOverrides;
|
|
37
31
|
exports.EthWalletConnector = EthWalletConnector.EthWalletConnector;
|
|
38
|
-
exports.INFURA_ID = constants.INFURA_ID;
|
|
39
32
|
exports.EthProviderHelper = ethProviderHelper.EthProviderHelper;
|
|
33
|
+
exports.INFURA_ID = constants.INFURA_ID;
|
|
40
34
|
exports.EthereumWalletConnectors = EthereumWalletConnectors;
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import './polyfills.js';
|
|
2
|
-
import {
|
|
2
|
+
import { TurnkeyEVMWalletConnectors } from '@dynamic-labs/turnkey';
|
|
3
3
|
export { PhantomEvm } from './injected/PhantomEvm.js';
|
|
4
4
|
export { ExodusEvm } from './injected/ExodusEvm.js';
|
|
5
5
|
import { injectedWalletOverrides, fetchInjectedWalletConnector } from './injected/fetchInjectedWalletConnectors.js';
|
|
6
6
|
export { fetchInjectedWalletConnector, injectedWalletOverrides } from './injected/fetchInjectedWalletConnectors.js';
|
|
7
|
-
import './walletConnect/
|
|
8
|
-
import '../_virtual/_tslib.js';
|
|
9
|
-
import '@walletconnect/ethereum-provider';
|
|
10
|
-
import 'viem';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
-
import '@dynamic-labs/wallet-book';
|
|
13
|
-
import '@dynamic-labs/utils';
|
|
14
|
-
export { EthWalletConnector } from './EthWalletConnector.js';
|
|
15
|
-
export { INFURA_ID } from './constants.js';
|
|
16
|
-
import '@walletconnect/client';
|
|
7
|
+
import './walletConnect/walletConnect.js';
|
|
17
8
|
import { fetchWalletConnectWallets, getWalletConnectConnector } from './walletConnect/fetchWalletConnectWallets.js';
|
|
18
9
|
import { Coinbase } from './coinbase/coinbase.js';
|
|
10
|
+
import '@dynamic-labs/rpc-provider-ethereum';
|
|
11
|
+
export { EthWalletConnector } from './EthWalletConnector.js';
|
|
19
12
|
export { EthProviderHelper } from './ethProviderHelper.js';
|
|
13
|
+
export { INFURA_ID } from './constants.js';
|
|
20
14
|
|
|
21
15
|
const EthereumWalletConnectors = (props) => [
|
|
22
16
|
...injectedWalletOverrides,
|
|
23
17
|
...fetchInjectedWalletConnector(props),
|
|
24
18
|
...fetchWalletConnectWallets(props),
|
|
25
|
-
...
|
|
19
|
+
...TurnkeyEVMWalletConnectors(props),
|
|
26
20
|
Coinbase,
|
|
27
|
-
getWalletConnectConnector(
|
|
21
|
+
getWalletConnectConnector(),
|
|
28
22
|
];
|
|
29
23
|
|
|
30
24
|
export { EthereumWalletConnectors };
|
|
@@ -10,6 +10,7 @@ class ExodusEvm extends InjectedWalletBase {
|
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(props);
|
|
12
12
|
this.name = 'ExodusEvm';
|
|
13
|
+
this.overrideKey = 'exodusevm';
|
|
13
14
|
this.walletConnectorFallback = true;
|
|
14
15
|
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
15
16
|
}
|
|
@@ -2,6 +2,7 @@ import { EthWalletConnectorOpts } from '..';
|
|
|
2
2
|
import InjectedWalletBase from './InjectedWalletBase';
|
|
3
3
|
export declare class ExodusEvm extends InjectedWalletBase {
|
|
4
4
|
name: string;
|
|
5
|
+
overrideKey: string;
|
|
5
6
|
walletConnectorFallback: boolean;
|
|
6
7
|
constructor(props: EthWalletConnectorOpts);
|
|
7
8
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
4
4
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
5
|
+
var utils = require('@dynamic-labs/utils');
|
|
5
6
|
var ethProviderHelper = require('../ethProviderHelper.cjs');
|
|
6
7
|
var EthWalletConnector = require('../EthWalletConnector.cjs');
|
|
7
|
-
var walletConnectV2 = require('../walletConnect/walletConnectV2.cjs');
|
|
8
8
|
var walletConnect = require('../walletConnect/walletConnect.cjs');
|
|
9
9
|
|
|
10
10
|
class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
@@ -27,19 +27,28 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
|
27
27
|
return this.ethProviderHelper;
|
|
28
28
|
}
|
|
29
29
|
getMobileOrInstalledWallet() {
|
|
30
|
-
var _a, _b
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (!this.wallet) {
|
|
32
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
33
|
+
}
|
|
34
|
+
if (this.isInstalledOnBrowser()) {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
// this is to handle the case where the user is in a webview.
|
|
38
|
+
// when the user is in a webview, customers should set the deepLinkPreference prop to universal,
|
|
39
|
+
// in which case this condition will be false, and the SDK will use WalletConnect (if available)
|
|
40
|
+
if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
|
|
41
|
+
this.constructorProps.deepLinkPreference !== 'universal' &&
|
|
42
|
+
utils.isMobile()) {
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
// this is the case where the wallet is not installed on the browser and
|
|
46
|
+
// it does not support WalletConnect. in this case, the SDK will instruct
|
|
47
|
+
// the user to download the wallet extension
|
|
48
|
+
if (!this.walletConnectorFallback) {
|
|
49
|
+
return this;
|
|
41
50
|
}
|
|
42
|
-
return this;
|
|
51
|
+
return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
43
52
|
}
|
|
44
53
|
setupEventListeners() {
|
|
45
54
|
const provider = this.getWalletClient();
|
|
@@ -51,23 +60,23 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
|
51
60
|
const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this);
|
|
52
61
|
this.teardownEventListeners = tearDownEventListeners;
|
|
53
62
|
}
|
|
54
|
-
getWalletClient() {
|
|
63
|
+
getWalletClient(chainId) {
|
|
55
64
|
var _a;
|
|
56
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
65
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
57
66
|
}
|
|
58
67
|
isInstalledOnBrowser() {
|
|
59
68
|
var _a;
|
|
60
69
|
return ((_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findProvider()) !== undefined;
|
|
61
70
|
}
|
|
62
|
-
|
|
71
|
+
getAddress() {
|
|
63
72
|
var _a;
|
|
64
73
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.
|
|
74
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.getAddress();
|
|
66
75
|
});
|
|
67
76
|
}
|
|
68
77
|
connect() {
|
|
69
78
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
yield this.
|
|
79
|
+
yield this.getAddress();
|
|
71
80
|
});
|
|
72
81
|
}
|
|
73
82
|
signMessage(messageToSign) {
|
|
@@ -14,9 +14,9 @@ declare abstract class InjectedWalletBase extends EthWalletConnector {
|
|
|
14
14
|
getEthProviderHelper(): EthProviderHelper | undefined;
|
|
15
15
|
getMobileOrInstalledWallet(): InjectedWalletBase;
|
|
16
16
|
setupEventListeners(): void;
|
|
17
|
-
getWalletClient(): WalletClient | undefined;
|
|
17
|
+
getWalletClient(chainId?: string): WalletClient | undefined;
|
|
18
18
|
isInstalledOnBrowser(): boolean;
|
|
19
|
-
|
|
19
|
+
getAddress(): Promise<string | undefined>;
|
|
20
20
|
connect(): Promise<void>;
|
|
21
21
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
22
22
|
proveOwnership(messageToSign: string): Promise<string | undefined>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { isMobile } from '@dynamic-labs/utils';
|
|
3
4
|
import { EthProviderHelper } from '../ethProviderHelper.js';
|
|
4
5
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
5
|
-
import { WalletConnectV2 } from '../walletConnect/walletConnectV2.js';
|
|
6
6
|
import { WalletConnect } from '../walletConnect/walletConnect.js';
|
|
7
7
|
|
|
8
8
|
class InjectedWalletBase extends EthWalletConnector {
|
|
@@ -25,19 +25,28 @@ class InjectedWalletBase extends EthWalletConnector {
|
|
|
25
25
|
return this.ethProviderHelper;
|
|
26
26
|
}
|
|
27
27
|
getMobileOrInstalledWallet() {
|
|
28
|
-
var _a, _b
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
var _a, _b;
|
|
29
|
+
if (!this.wallet) {
|
|
30
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
31
|
+
}
|
|
32
|
+
if (this.isInstalledOnBrowser()) {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
// this is to handle the case where the user is in a webview.
|
|
36
|
+
// when the user is in a webview, customers should set the deepLinkPreference prop to universal,
|
|
37
|
+
// in which case this condition will be false, and the SDK will use WalletConnect (if available)
|
|
38
|
+
if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
|
|
39
|
+
this.constructorProps.deepLinkPreference !== 'universal' &&
|
|
40
|
+
isMobile()) {
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
// this is the case where the wallet is not installed on the browser and
|
|
44
|
+
// it does not support WalletConnect. in this case, the SDK will instruct
|
|
45
|
+
// the user to download the wallet extension
|
|
46
|
+
if (!this.walletConnectorFallback) {
|
|
47
|
+
return this;
|
|
39
48
|
}
|
|
40
|
-
return this;
|
|
49
|
+
return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
41
50
|
}
|
|
42
51
|
setupEventListeners() {
|
|
43
52
|
const provider = this.getWalletClient();
|
|
@@ -49,23 +58,23 @@ class InjectedWalletBase extends EthWalletConnector {
|
|
|
49
58
|
const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this);
|
|
50
59
|
this.teardownEventListeners = tearDownEventListeners;
|
|
51
60
|
}
|
|
52
|
-
getWalletClient() {
|
|
61
|
+
getWalletClient(chainId) {
|
|
53
62
|
var _a;
|
|
54
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
|
|
63
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient(chainId);
|
|
55
64
|
}
|
|
56
65
|
isInstalledOnBrowser() {
|
|
57
66
|
var _a;
|
|
58
67
|
return ((_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findProvider()) !== undefined;
|
|
59
68
|
}
|
|
60
|
-
|
|
69
|
+
getAddress() {
|
|
61
70
|
var _a;
|
|
62
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.
|
|
72
|
+
return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.getAddress();
|
|
64
73
|
});
|
|
65
74
|
}
|
|
66
75
|
connect() {
|
|
67
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
yield this.
|
|
77
|
+
yield this.getAddress();
|
|
69
78
|
});
|
|
70
79
|
}
|
|
71
80
|
signMessage(messageToSign) {
|
|
@@ -11,15 +11,16 @@ class PhantomEvm extends InjectedWalletBase {
|
|
|
11
11
|
constructor(props) {
|
|
12
12
|
super(props);
|
|
13
13
|
this.name = 'PhantomEvm';
|
|
14
|
+
this.overrideKey = 'phantomevm';
|
|
14
15
|
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
getAddress() {
|
|
17
18
|
const _super = Object.create(null, {
|
|
18
|
-
|
|
19
|
+
getAddress: { get: () => super.getAddress }
|
|
19
20
|
});
|
|
20
21
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
21
22
|
if (this.isInstalledOnBrowser()) {
|
|
22
|
-
return _super.
|
|
23
|
+
return _super.getAddress.call(this);
|
|
23
24
|
}
|
|
24
25
|
if (utils.isMobile()) {
|
|
25
26
|
utils.handleMobileWalletRedirect({
|
|
@@ -2,6 +2,7 @@ import { EthWalletConnectorOpts } from '..';
|
|
|
2
2
|
import InjectedWalletBase from './InjectedWalletBase';
|
|
3
3
|
export declare class PhantomEvm extends InjectedWalletBase {
|
|
4
4
|
name: string;
|
|
5
|
+
overrideKey: string;
|
|
5
6
|
constructor(props: EthWalletConnectorOpts);
|
|
6
|
-
|
|
7
|
+
getAddress(): Promise<string | undefined>;
|
|
7
8
|
}
|
|
@@ -7,15 +7,16 @@ class PhantomEvm extends InjectedWalletBase {
|
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super(props);
|
|
9
9
|
this.name = 'PhantomEvm';
|
|
10
|
+
this.overrideKey = 'phantomevm';
|
|
10
11
|
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
getAddress() {
|
|
13
14
|
const _super = Object.create(null, {
|
|
14
|
-
|
|
15
|
+
getAddress: { get: () => super.getAddress }
|
|
15
16
|
});
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
if (this.isInstalledOnBrowser()) {
|
|
18
|
-
return _super.
|
|
19
|
+
return _super.getAddress.call(this);
|
|
19
20
|
}
|
|
20
21
|
if (isMobile()) {
|
|
21
22
|
handleMobileWalletRedirect({
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
|
+
|
|
7
|
+
// on desktop, we use EIP-6963 to connect to the wallet so the injectedConfig
|
|
8
|
+
// is not needed.
|
|
9
|
+
const zerionWalletBookConfig = {
|
|
10
|
+
eip6963Config: {
|
|
11
|
+
rdns: 'io.zerion.wallet',
|
|
12
|
+
},
|
|
13
|
+
filterFromWalletConnect: true,
|
|
14
|
+
injectedConfig: [
|
|
15
|
+
{
|
|
16
|
+
chain: 'evm',
|
|
17
|
+
// adds isMetaMask flag to the wallet connector so that the window provider works
|
|
18
|
+
// in the zerion in-app browser.
|
|
19
|
+
extensionLocators: [{ flag: 'isMetaMask', value: true }],
|
|
20
|
+
windowLocations: ['zerionWallet', 'zerionwallet.ethereum'],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: 'Zerion',
|
|
24
|
+
};
|
|
25
|
+
class Zerion extends InjectedWalletBase {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
this.name = 'Zerion';
|
|
29
|
+
this.overrideKey = 'zerion';
|
|
30
|
+
this.wallet = zerionWalletBookConfig;
|
|
31
|
+
}
|
|
32
|
+
isInstalledOnBrowser() {
|
|
33
|
+
var _a;
|
|
34
|
+
return Boolean(window.zerionWallet || ((_a = window.zerionwallet) === null || _a === void 0 ? void 0 : _a.ethereum));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.Zerion = Zerion;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
2
|
+
import { EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
3
|
+
import InjectedWalletBase from './InjectedWalletBase';
|
|
4
|
+
export declare class Zerion extends InjectedWalletBase {
|
|
5
|
+
name: string;
|
|
6
|
+
overrideKey: string;
|
|
7
|
+
wallet: WalletSchema;
|
|
8
|
+
constructor(props: EthWalletConnectorOpts);
|
|
9
|
+
isInstalledOnBrowser(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
2
|
+
|
|
3
|
+
// on desktop, we use EIP-6963 to connect to the wallet so the injectedConfig
|
|
4
|
+
// is not needed.
|
|
5
|
+
const zerionWalletBookConfig = {
|
|
6
|
+
eip6963Config: {
|
|
7
|
+
rdns: 'io.zerion.wallet',
|
|
8
|
+
},
|
|
9
|
+
filterFromWalletConnect: true,
|
|
10
|
+
injectedConfig: [
|
|
11
|
+
{
|
|
12
|
+
chain: 'evm',
|
|
13
|
+
// adds isMetaMask flag to the wallet connector so that the window provider works
|
|
14
|
+
// in the zerion in-app browser.
|
|
15
|
+
extensionLocators: [{ flag: 'isMetaMask', value: true }],
|
|
16
|
+
windowLocations: ['zerionWallet', 'zerionwallet.ethereum'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
name: 'Zerion',
|
|
20
|
+
};
|
|
21
|
+
class Zerion extends InjectedWalletBase {
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.name = 'Zerion';
|
|
25
|
+
this.overrideKey = 'zerion';
|
|
26
|
+
this.wallet = zerionWalletBookConfig;
|
|
27
|
+
}
|
|
28
|
+
isInstalledOnBrowser() {
|
|
29
|
+
var _a;
|
|
30
|
+
return Boolean(window.zerionWallet || ((_a = window.zerionwallet) === null || _a === void 0 ? void 0 : _a.ethereum));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Zerion };
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
5
7
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
8
|
var PhantomEvm = require('./PhantomEvm.cjs');
|
|
7
9
|
var ExodusEvm = require('./ExodusEvm.cjs');
|
|
10
|
+
var Zerion = require('./Zerion.cjs');
|
|
8
11
|
|
|
9
12
|
const injectedWalletOverrides = [
|
|
10
13
|
PhantomEvm.PhantomEvm,
|
|
11
14
|
ExodusEvm.ExodusEvm,
|
|
15
|
+
Zerion.Zerion,
|
|
12
16
|
];
|
|
13
17
|
const filteredInjectedWalletKeysOverrides = [
|
|
14
18
|
'phantomevm',
|
|
15
19
|
'coinbase',
|
|
16
20
|
'exodusevm',
|
|
21
|
+
'zerion',
|
|
17
22
|
];
|
|
18
23
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
19
24
|
var _a;
|
|
@@ -36,6 +41,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
36
41
|
// this is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
37
42
|
this.overrideKey = key;
|
|
38
43
|
}
|
|
44
|
+
getAddress() {
|
|
45
|
+
const _super = Object.create(null, {
|
|
46
|
+
getAddress: { get: () => super.getAddress }
|
|
47
|
+
});
|
|
48
|
+
var _a;
|
|
49
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (this.isInstalledOnBrowser()) {
|
|
51
|
+
return _super.getAddress.call(this);
|
|
52
|
+
}
|
|
53
|
+
const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
54
|
+
if (!inAppBrowserBase) {
|
|
55
|
+
const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
|
|
56
|
+
walletConnectorCore.logger.error(error.message);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
const cleanedTargetUrl = window.location.href.replace('https://', '');
|
|
60
|
+
window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
|
|
61
|
+
return undefined;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
39
64
|
};
|
|
40
65
|
});
|
|
41
66
|
};
|
|
@@ -2,6 +2,5 @@ import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core'
|
|
|
2
2
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
3
3
|
export declare const injectedWalletOverrides: WalletConnectorConstructor[];
|
|
4
4
|
export declare const fetchInjectedWalletConnector: ({ walletBook, }: {
|
|
5
|
-
isWalletConnectV2Enabled: boolean;
|
|
6
5
|
walletBook: WalletBookSchema;
|
|
7
6
|
}) => WalletConnectorConstructor[];
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
1
3
|
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
2
4
|
import { PhantomEvm } from './PhantomEvm.js';
|
|
3
5
|
import { ExodusEvm } from './ExodusEvm.js';
|
|
6
|
+
import { Zerion } from './Zerion.js';
|
|
4
7
|
|
|
5
8
|
const injectedWalletOverrides = [
|
|
6
9
|
PhantomEvm,
|
|
7
10
|
ExodusEvm,
|
|
11
|
+
Zerion,
|
|
8
12
|
];
|
|
9
13
|
const filteredInjectedWalletKeysOverrides = [
|
|
10
14
|
'phantomevm',
|
|
11
15
|
'coinbase',
|
|
12
16
|
'exodusevm',
|
|
17
|
+
'zerion',
|
|
13
18
|
];
|
|
14
19
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
15
20
|
var _a;
|
|
@@ -32,6 +37,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
|
32
37
|
// this is the key from the wallet book entry so that we don't purely rely on the normalized name
|
|
33
38
|
this.overrideKey = key;
|
|
34
39
|
}
|
|
40
|
+
getAddress() {
|
|
41
|
+
const _super = Object.create(null, {
|
|
42
|
+
getAddress: { get: () => super.getAddress }
|
|
43
|
+
});
|
|
44
|
+
var _a;
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (this.isInstalledOnBrowser()) {
|
|
47
|
+
return _super.getAddress.call(this);
|
|
48
|
+
}
|
|
49
|
+
const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
|
|
50
|
+
if (!inAppBrowserBase) {
|
|
51
|
+
const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
|
|
52
|
+
logger.error(error.message);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const cleanedTargetUrl = window.location.href.replace('https://', '');
|
|
56
|
+
window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
|
|
57
|
+
return undefined;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
35
60
|
};
|
|
36
61
|
});
|
|
37
62
|
};
|
|
@@ -2,47 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var walletConnectV2 = require('./walletConnectV2.cjs');
|
|
6
5
|
var walletConnect = require('./walletConnect.cjs');
|
|
7
6
|
|
|
8
|
-
const fetchWalletConnectWallets = ({
|
|
7
|
+
const fetchWalletConnectWallets = ({ walletBook, }) => {
|
|
9
8
|
var _a;
|
|
10
|
-
return Object.
|
|
11
|
-
.filter((wallet) => wallet.walletConnect && !wallet.filterFromWalletConnect)
|
|
12
|
-
.map((wallet) => {
|
|
13
|
-
var _a;
|
|
9
|
+
return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
10
|
+
.filter(([, wallet]) => wallet.walletConnect && !wallet.filterFromWalletConnect)
|
|
11
|
+
.map(([key, wallet]) => {
|
|
14
12
|
const { shortName } = wallet;
|
|
15
13
|
const name = shortName || wallet.name;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
super(Object.assign(Object.assign({}, props), { walletName: name }));
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return class extends walletConnect.WalletConnect {
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(Object.assign(Object.assign({}, props), { walletName: name }));
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
14
|
+
return class extends walletConnect.WalletConnect {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(Object.assign(Object.assign({}, props), { walletName: name }));
|
|
17
|
+
this.overrideKey = key;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
33
20
|
});
|
|
34
21
|
};
|
|
35
|
-
const getWalletConnectConnector = (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
39
|
-
}
|
|
22
|
+
const getWalletConnectConnector = () => class extends walletConnect.WalletConnect {
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
40
25
|
}
|
|
41
|
-
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
26
|
+
};
|
|
46
27
|
|
|
47
28
|
exports.fetchWalletConnectWallets = fetchWalletConnectWallets;
|
|
48
29
|
exports.getWalletConnectConnector = getWalletConnectConnector;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
2
2
|
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
export declare const fetchWalletConnectWallets: ({
|
|
4
|
-
isWalletConnectV2Enabled: boolean;
|
|
3
|
+
export declare const fetchWalletConnectWallets: ({ walletBook, }: {
|
|
5
4
|
walletBook: WalletBookSchema;
|
|
6
5
|
}) => Array<WalletConnectorConstructor>;
|
|
7
|
-
export declare const getWalletConnectConnector: (
|
|
8
|
-
isWalletConnectV2Enabled: boolean;
|
|
9
|
-
}) => WalletConnectorConstructor;
|
|
6
|
+
export declare const getWalletConnectConnector: () => WalletConnectorConstructor;
|