@dynamic-labs/ethereum 2.1.0-alpha.9 → 2.1.0
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 +257 -0
- package/package.json +11 -11
- package/src/EthWalletConnector.cjs +5 -1
- package/src/EthWalletConnector.d.ts +2786 -6
- package/src/EthWalletConnector.js +5 -1
- package/src/coinbase/coinbase.cjs +59 -69
- package/src/coinbase/coinbase.d.ts +6894 -291
- package/src/coinbase/coinbase.js +60 -70
- package/src/coinbase/helpers.cjs +38 -0
- package/src/coinbase/helpers.d.ts +3 -0
- package/src/coinbase/helpers.js +34 -0
- package/src/coinbase/types.d.ts +21 -0
- package/src/ethProviderHelper.cjs +2 -2
- package/src/ethProviderHelper.d.ts +2 -2
- package/src/ethProviderHelper.js +2 -2
- package/src/index.cjs +3 -0
- package/src/index.js +3 -0
- package/src/injected/PhantomEvm.cjs +1 -1
- package/src/injected/PhantomEvm.js +1 -1
- package/src/injected/UnknownInjected.cjs +21 -0
- package/src/injected/UnknownInjected.d.ts +8 -0
- package/src/injected/UnknownInjected.js +17 -0
- package/src/injected/fetchInjectedWalletConnectors.cjs +0 -3
- package/src/injected/fetchInjectedWalletConnectors.js +0 -3
- package/src/injected/index.d.ts +1 -0
- package/src/types.d.ts +3 -3
- package/src/walletConnect/walletConnect.d.ts +6883 -17
- package/src/coinbase/client/client.cjs +0 -73
- package/src/coinbase/client/client.d.ts +0 -7
- package/src/coinbase/client/client.js +0 -66
- package/src/coinbase/client/index.d.ts +0 -2
- package/src/coinbase/client/types.d.ts +0 -17
- package/src/injected/Zerion.cjs +0 -39
- package/src/injected/Zerion.d.ts +0 -10
- package/src/injected/Zerion.js +0 -35
package/src/coinbase/coinbase.js
CHANGED
|
@@ -1,103 +1,93 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __rest, __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
-
import { createWalletClient, custom } from 'viem';
|
|
4
|
-
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { toHex, toBytes, createWalletClient, custom } from 'viem';
|
|
5
4
|
import { eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import {
|
|
5
|
+
import { chainsMap } from '@dynamic-labs/viem-utils';
|
|
7
6
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
8
|
-
import {
|
|
7
|
+
import { getCoinbaseProvider } from './helpers.js';
|
|
9
8
|
|
|
10
9
|
class Coinbase extends EthWalletConnector {
|
|
11
10
|
constructor(_a) {
|
|
12
|
-
var { appName, appLogoUrl, evmNetworks } = _a, props = __rest(_a, ["appName", "appLogoUrl", "evmNetworks"]);
|
|
11
|
+
var { appName, appLogoUrl, evmNetworks, coinbaseWalletPreference } = _a, props = __rest(_a, ["appName", "appLogoUrl", "evmNetworks", "coinbaseWalletPreference"]);
|
|
13
12
|
super(Object.assign({ evmNetworks }, props));
|
|
14
13
|
this.name = 'Coinbase';
|
|
15
14
|
this.overrideKey = 'coinbase';
|
|
16
15
|
this.supportedChains = ['EVM', 'ETH'];
|
|
17
16
|
this.connectedChain = 'EVM';
|
|
18
|
-
this.canConnectViaQrCode =
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
setupEventListeners() {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
if (!this.isInstalledOnBrowser()) {
|
|
32
|
-
this.setupCoinbaseProviderEventListeners();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const provider = (_a = this.ethProviderHelper) === null || _a === void 0 ? void 0 : _a.findProvider();
|
|
36
|
-
if (!provider) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const setupResponse = (_c = (_b = this.ethProviderHelper) === null || _b === void 0 ? void 0 : _b._setupEventListeners) === null || _c === void 0 ? void 0 : _c.call(_b, this);
|
|
40
|
-
if (!(setupResponse === null || setupResponse === void 0 ? void 0 : setupResponse.tearDownEventListeners))
|
|
41
|
-
return;
|
|
42
|
-
this.teardownEventListeners = setupResponse.tearDownEventListeners;
|
|
17
|
+
this.canConnectViaQrCode = false;
|
|
18
|
+
this.canConnectViaCustodialService = true;
|
|
19
|
+
this.coinbaseProvider = getCoinbaseProvider({
|
|
20
|
+
opts: {
|
|
21
|
+
appLogoUrl: appLogoUrl,
|
|
22
|
+
appName: appName,
|
|
23
|
+
evmNetworks: evmNetworks,
|
|
24
|
+
walletPreference: coinbaseWalletPreference,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
43
27
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
getConnectedAccounts() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
try {
|
|
31
|
+
const accounts = yield this.coinbaseProvider.request({
|
|
32
|
+
method: 'eth_accounts',
|
|
33
|
+
});
|
|
34
|
+
if (accounts[0]) {
|
|
35
|
+
this.setActiveAccount(accounts[0]);
|
|
36
|
+
}
|
|
37
|
+
return accounts;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
53
42
|
});
|
|
54
43
|
}
|
|
55
44
|
isInstalledOnBrowser() {
|
|
56
45
|
var _a;
|
|
57
|
-
return ((_a =
|
|
46
|
+
return Boolean((_a = window === null || window === void 0 ? void 0 : window.coinbaseWalletExtension) === null || _a === void 0 ? void 0 : _a.isCoinbaseWallet);
|
|
58
47
|
}
|
|
59
|
-
getAddress(
|
|
48
|
+
getAddress() {
|
|
60
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return
|
|
50
|
+
const [address] = yield this.coinbaseProvider.request({
|
|
51
|
+
method: 'eth_requestAccounts',
|
|
52
|
+
});
|
|
53
|
+
this.setActiveAccount(address);
|
|
54
|
+
return address;
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
57
|
signMessage(messageToSign) {
|
|
69
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
const [address] = yield this.coinbaseProvider.request({
|
|
60
|
+
method: 'eth_requestAccounts',
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
return yield this.coinbaseProvider.request({
|
|
64
|
+
method: 'personal_sign',
|
|
65
|
+
params: [toHex(toBytes(messageToSign)), address.toLowerCase()],
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
return undefined;
|
|
73
70
|
}
|
|
74
|
-
return signMessage(this.coinbaseProviderOpts, messageToSign);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
endSession() {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
if (this.isInstalledOnBrowser())
|
|
80
|
-
return;
|
|
81
|
-
killCoinbaseSession();
|
|
82
71
|
});
|
|
83
72
|
}
|
|
84
|
-
|
|
85
|
-
const { provider } = getCoinbaseClient({
|
|
86
|
-
opts: this.coinbaseProviderOpts,
|
|
87
|
-
});
|
|
88
|
-
if (!provider) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
73
|
+
setupEventListeners() {
|
|
91
74
|
const { handleAccountChange, handleChainChange, handleDisconnect } = eventListenerHandlers(this);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
this.coinbaseProvider.on('accountsChanged', handleAccountChange);
|
|
76
|
+
this.coinbaseProvider.on('chainChanged', handleChainChange);
|
|
77
|
+
this.coinbaseProvider.on('disconnect', handleDisconnect);
|
|
95
78
|
this.teardownEventListeners = () => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
this.coinbaseProvider.removeListener('accountsChanged', handleAccountChange);
|
|
80
|
+
this.coinbaseProvider.removeListener('chainChanged', handleChainChange);
|
|
81
|
+
this.coinbaseProvider.removeListener('disconnect', handleDisconnect);
|
|
99
82
|
};
|
|
100
83
|
}
|
|
84
|
+
getWalletClient(chainId) {
|
|
85
|
+
return createWalletClient({
|
|
86
|
+
account: this.getActiveAccount(),
|
|
87
|
+
chain: chainId ? chainsMap[chainId] : undefined,
|
|
88
|
+
transport: custom(this.coinbaseProvider),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
101
91
|
}
|
|
102
92
|
|
|
103
93
|
export { Coinbase };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var walletSdk = require('@coinbase/wallet-sdk');
|
|
7
|
+
|
|
8
|
+
// storing a reference to the coinbase provider because the provider methods work better when
|
|
9
|
+
// they are called on the same instance
|
|
10
|
+
let coinbaseProvider;
|
|
11
|
+
const baseSepolia = 84532;
|
|
12
|
+
const baseMainnet = 8453;
|
|
13
|
+
const getCoinbaseProvider = ({ opts: { appLogoUrl, appName, evmNetworks, walletPreference } = {}, }) => {
|
|
14
|
+
const appChainIds = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.map((network) => Number(network.chainId));
|
|
15
|
+
// just brings base sepolia to the front of the list, because that is treated as the default chain
|
|
16
|
+
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseSepolia);
|
|
17
|
+
if (hasBaseSepolia) {
|
|
18
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseSepolia ? -1 : b === baseSepolia ? 1 : 0);
|
|
19
|
+
}
|
|
20
|
+
// just brings base mainnet to the front, because that that is treated as the default chain
|
|
21
|
+
const hasBaseMainnet = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseMainnet);
|
|
22
|
+
if (hasBaseMainnet) {
|
|
23
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseMainnet ? -1 : b === baseMainnet ? 1 : 0);
|
|
24
|
+
}
|
|
25
|
+
if (!coinbaseProvider) {
|
|
26
|
+
const coinbaseSdk = new walletSdk.CoinbaseWalletSDK({
|
|
27
|
+
appChainIds,
|
|
28
|
+
appLogoUrl,
|
|
29
|
+
appName,
|
|
30
|
+
});
|
|
31
|
+
coinbaseProvider = coinbaseSdk.makeWeb3Provider({
|
|
32
|
+
options: walletPreference !== null && walletPreference !== void 0 ? walletPreference : 'all',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return coinbaseProvider;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.getCoinbaseProvider = getCoinbaseProvider;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk';
|
|
3
|
+
|
|
4
|
+
// storing a reference to the coinbase provider because the provider methods work better when
|
|
5
|
+
// they are called on the same instance
|
|
6
|
+
let coinbaseProvider;
|
|
7
|
+
const baseSepolia = 84532;
|
|
8
|
+
const baseMainnet = 8453;
|
|
9
|
+
const getCoinbaseProvider = ({ opts: { appLogoUrl, appName, evmNetworks, walletPreference } = {}, }) => {
|
|
10
|
+
const appChainIds = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.map((network) => Number(network.chainId));
|
|
11
|
+
// just brings base sepolia to the front of the list, because that is treated as the default chain
|
|
12
|
+
const hasBaseSepolia = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseSepolia);
|
|
13
|
+
if (hasBaseSepolia) {
|
|
14
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseSepolia ? -1 : b === baseSepolia ? 1 : 0);
|
|
15
|
+
}
|
|
16
|
+
// just brings base mainnet to the front, because that that is treated as the default chain
|
|
17
|
+
const hasBaseMainnet = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.some((network) => network.chainId === baseMainnet);
|
|
18
|
+
if (hasBaseMainnet) {
|
|
19
|
+
appChainIds === null || appChainIds === void 0 ? void 0 : appChainIds.sort((a, b) => a === baseMainnet ? -1 : b === baseMainnet ? 1 : 0);
|
|
20
|
+
}
|
|
21
|
+
if (!coinbaseProvider) {
|
|
22
|
+
const coinbaseSdk = new CoinbaseWalletSDK({
|
|
23
|
+
appChainIds,
|
|
24
|
+
appLogoUrl,
|
|
25
|
+
appName,
|
|
26
|
+
});
|
|
27
|
+
coinbaseProvider = coinbaseSdk.makeWeb3Provider({
|
|
28
|
+
options: walletPreference !== null && walletPreference !== void 0 ? walletPreference : 'all',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return coinbaseProvider;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { getCoinbaseProvider };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ProviderInterface } from '@coinbase/wallet-sdk';
|
|
2
|
+
import { type CoinbaseWalletPreference, type GenericNetwork } from '@dynamic-labs/types';
|
|
3
|
+
import { type EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
4
|
+
export type GetCoinbaseProviderOpts = {
|
|
5
|
+
appLogoUrl?: string;
|
|
6
|
+
appName?: string;
|
|
7
|
+
evmNetworks?: GenericNetwork[];
|
|
8
|
+
walletPreference?: CoinbaseWalletPreference;
|
|
9
|
+
};
|
|
10
|
+
export type CoinbaseProviderHandlerOpts = {
|
|
11
|
+
onDisconnect(): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type GetCoinbaseProvider = (args: {
|
|
14
|
+
handlers?: CoinbaseProviderHandlerOpts;
|
|
15
|
+
opts?: GetCoinbaseProviderOpts;
|
|
16
|
+
}) => ProviderInterface;
|
|
17
|
+
export type CoinbaseOpts = EthWalletConnectorOpts & {
|
|
18
|
+
appLogoUrl?: string;
|
|
19
|
+
appName?: string;
|
|
20
|
+
coinbaseWalletPreference?: CoinbaseWalletPreference;
|
|
21
|
+
};
|
|
@@ -63,9 +63,9 @@ class EthProviderHelper {
|
|
|
63
63
|
}
|
|
64
64
|
return providers;
|
|
65
65
|
}
|
|
66
|
-
installedProviderLookup(
|
|
66
|
+
installedProviderLookup(extensionLocators) {
|
|
67
67
|
const allInstalledProviders = this.installedProviders();
|
|
68
|
-
return walletConnectorCore.ProviderLookup(allInstalledProviders,
|
|
68
|
+
return walletConnectorCore.ProviderLookup(allInstalledProviders, extensionLocators);
|
|
69
69
|
}
|
|
70
70
|
eip6963ProviderLookup(rdns) {
|
|
71
71
|
var _a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hex, WalletClient } from 'viem';
|
|
2
2
|
import { ProviderCondition, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { WalletSchema } from '@dynamic-labs/wallet-book';
|
|
4
|
-
import { IEthereum,
|
|
4
|
+
import { IEthereum, ExtensionLocator } from './types';
|
|
5
5
|
import { EthWalletConnector } from '.';
|
|
6
6
|
export declare class EthProviderHelper {
|
|
7
7
|
private wallet;
|
|
@@ -25,7 +25,7 @@ export declare class EthProviderHelper {
|
|
|
25
25
|
windowLocations?: string[] | undefined;
|
|
26
26
|
} | undefined;
|
|
27
27
|
installedProviders(): IEthereum[];
|
|
28
|
-
installedProviderLookup(
|
|
28
|
+
installedProviderLookup(extensionLocators: Array<ProviderCondition<ExtensionLocator>>): IEthereum | undefined;
|
|
29
29
|
eip6963ProviderLookup(rdns: string): IEthereum | undefined;
|
|
30
30
|
isInstalledHelper(): boolean;
|
|
31
31
|
findProvider(): IEthereum | undefined;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -59,9 +59,9 @@ class EthProviderHelper {
|
|
|
59
59
|
}
|
|
60
60
|
return providers;
|
|
61
61
|
}
|
|
62
|
-
installedProviderLookup(
|
|
62
|
+
installedProviderLookup(extensionLocators) {
|
|
63
63
|
const allInstalledProviders = this.installedProviders();
|
|
64
|
-
return ProviderLookup(allInstalledProviders,
|
|
64
|
+
return ProviderLookup(allInstalledProviders, extensionLocators);
|
|
65
65
|
}
|
|
66
66
|
eip6963ProviderLookup(rdns) {
|
|
67
67
|
var _a;
|
package/src/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ require('./polyfills.cjs');
|
|
|
7
7
|
var turnkey = require('@dynamic-labs/turnkey');
|
|
8
8
|
var PhantomEvm = require('./injected/PhantomEvm.cjs');
|
|
9
9
|
var ExodusEvm = require('./injected/ExodusEvm.cjs');
|
|
10
|
+
var UnknownInjected = require('./injected/UnknownInjected.cjs');
|
|
10
11
|
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
11
12
|
require('./walletConnect/walletConnect.cjs');
|
|
12
13
|
var fetchWalletConnectWallets = require('./walletConnect/fetchWalletConnectWallets.cjs');
|
|
@@ -24,11 +25,13 @@ const EthereumWalletConnectors = (props) => [
|
|
|
24
25
|
...fetchWalletConnectWallets.fetchWalletConnectWallets(props),
|
|
25
26
|
...turnkey.TurnkeyEVMWalletConnectors(props),
|
|
26
27
|
coinbase.Coinbase,
|
|
28
|
+
UnknownInjected.UnknownInjected,
|
|
27
29
|
fetchWalletConnectWallets.getWalletConnectConnector(),
|
|
28
30
|
];
|
|
29
31
|
|
|
30
32
|
exports.PhantomEvm = PhantomEvm.PhantomEvm;
|
|
31
33
|
exports.ExodusEvm = ExodusEvm.ExodusEvm;
|
|
34
|
+
exports.UnknownInjected = UnknownInjected.UnknownInjected;
|
|
32
35
|
exports.fetchInjectedWalletConnector = fetchInjectedWalletConnectors.fetchInjectedWalletConnector;
|
|
33
36
|
exports.injectedWalletOverrides = fetchInjectedWalletConnectors.injectedWalletOverrides;
|
|
34
37
|
exports.EthWalletConnector = EthWalletConnector.EthWalletConnector;
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import './polyfills.js';
|
|
|
3
3
|
import { TurnkeyEVMWalletConnectors } from '@dynamic-labs/turnkey';
|
|
4
4
|
export { PhantomEvm } from './injected/PhantomEvm.js';
|
|
5
5
|
export { ExodusEvm } from './injected/ExodusEvm.js';
|
|
6
|
+
import { UnknownInjected } from './injected/UnknownInjected.js';
|
|
7
|
+
export { UnknownInjected } from './injected/UnknownInjected.js';
|
|
6
8
|
import { injectedWalletOverrides, fetchInjectedWalletConnector } from './injected/fetchInjectedWalletConnectors.js';
|
|
7
9
|
export { fetchInjectedWalletConnector, injectedWalletOverrides } from './injected/fetchInjectedWalletConnectors.js';
|
|
8
10
|
import './walletConnect/walletConnect.js';
|
|
@@ -21,6 +23,7 @@ const EthereumWalletConnectors = (props) => [
|
|
|
21
23
|
...fetchWalletConnectWallets(props),
|
|
22
24
|
...TurnkeyEVMWalletConnectors(props),
|
|
23
25
|
Coinbase,
|
|
26
|
+
UnknownInjected,
|
|
24
27
|
getWalletConnectConnector(),
|
|
25
28
|
];
|
|
26
29
|
|
|
@@ -11,7 +11,7 @@ var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
|
11
11
|
class PhantomEvm extends InjectedWalletBase {
|
|
12
12
|
constructor(props) {
|
|
13
13
|
super(props);
|
|
14
|
-
this.name = '
|
|
14
|
+
this.name = 'Phantom';
|
|
15
15
|
this.overrideKey = 'phantomevm';
|
|
16
16
|
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@ import InjectedWalletBase from './InjectedWalletBase.js';
|
|
|
7
7
|
class PhantomEvm extends InjectedWalletBase {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
|
-
this.name = '
|
|
10
|
+
this.name = 'Phantom';
|
|
11
11
|
this.overrideKey = 'phantomevm';
|
|
12
12
|
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
13
13
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
+
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
8
|
+
|
|
9
|
+
class UnknownInjected extends InjectedWalletBase {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.name = 'Unknown';
|
|
13
|
+
this.overrideKey = 'unknown';
|
|
14
|
+
this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
|
|
15
|
+
}
|
|
16
|
+
isInstalledOnBrowser() {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.UnknownInjected = UnknownInjected;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EthWalletConnectorOpts } from '..';
|
|
2
|
+
import InjectedWalletBase from './InjectedWalletBase';
|
|
3
|
+
export declare class UnknownInjected extends InjectedWalletBase {
|
|
4
|
+
name: string;
|
|
5
|
+
overrideKey: string;
|
|
6
|
+
constructor(props: EthWalletConnectorOpts);
|
|
7
|
+
isInstalledOnBrowser(): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
4
|
+
|
|
5
|
+
class UnknownInjected extends InjectedWalletBase {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.name = 'Unknown';
|
|
9
|
+
this.overrideKey = 'unknown';
|
|
10
|
+
this.wallet = findWalletBookWallet(this.walletBook, this.key);
|
|
11
|
+
}
|
|
12
|
+
isInstalledOnBrowser() {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { UnknownInjected };
|
|
@@ -8,18 +8,15 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
|
8
8
|
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
9
9
|
var PhantomEvm = require('./PhantomEvm.cjs');
|
|
10
10
|
var ExodusEvm = require('./ExodusEvm.cjs');
|
|
11
|
-
var Zerion = require('./Zerion.cjs');
|
|
12
11
|
|
|
13
12
|
const injectedWalletOverrides = [
|
|
14
13
|
PhantomEvm.PhantomEvm,
|
|
15
14
|
ExodusEvm.ExodusEvm,
|
|
16
|
-
Zerion.Zerion,
|
|
17
15
|
];
|
|
18
16
|
const filteredInjectedWalletKeysOverrides = [
|
|
19
17
|
'phantomevm',
|
|
20
18
|
'coinbase',
|
|
21
19
|
'exodusevm',
|
|
22
|
-
'zerion',
|
|
23
20
|
];
|
|
24
21
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
25
22
|
var _a;
|
|
@@ -4,18 +4,15 @@ import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
|
4
4
|
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
5
5
|
import { PhantomEvm } from './PhantomEvm.js';
|
|
6
6
|
import { ExodusEvm } from './ExodusEvm.js';
|
|
7
|
-
import { Zerion } from './Zerion.js';
|
|
8
7
|
|
|
9
8
|
const injectedWalletOverrides = [
|
|
10
9
|
PhantomEvm,
|
|
11
10
|
ExodusEvm,
|
|
12
|
-
Zerion,
|
|
13
11
|
];
|
|
14
12
|
const filteredInjectedWalletKeysOverrides = [
|
|
15
13
|
'phantomevm',
|
|
16
14
|
'coinbase',
|
|
17
15
|
'exodusevm',
|
|
18
|
-
'zerion',
|
|
19
16
|
];
|
|
20
17
|
const fetchInjectedWalletConnector = ({ walletBook, }) => {
|
|
21
18
|
var _a;
|
package/src/injected/index.d.ts
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -17,15 +17,15 @@ declare global {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export type IEthereum = {
|
|
20
|
-
[key in
|
|
20
|
+
[key in ExtensionLocator]: boolean;
|
|
21
21
|
} & {
|
|
22
22
|
providers?: object[];
|
|
23
23
|
request: <T extends string>(params: {
|
|
24
24
|
method: T;
|
|
25
25
|
} | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
|
|
26
26
|
} & EventEmitter;
|
|
27
|
-
export type
|
|
28
|
-
export type EthProviderCondition = ProviderCondition<
|
|
27
|
+
export type ExtensionLocator = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb' | 'isRabby' | 'isOkxWallet';
|
|
28
|
+
export type EthProviderCondition = ProviderCondition<ExtensionLocator>;
|
|
29
29
|
export type Provider = () => PublicClient | undefined;
|
|
30
30
|
export type ExternalProviderEventEmitter = PublicClient & {
|
|
31
31
|
on: (event: string, listener: (...args: Array<any>) => unknown) => void;
|