@dynamic-labs/ethereum 0.19.0-alpha.20 → 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 CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [0.19.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.20...v0.19.0-alpha.21) (2023-10-23)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * Restructure the SDK packages (#3623)
8
+
9
+ ### Features
10
+
11
+ * add support for overriding views ([#3649](https://github.com/dynamic-labs/DynamicAuth/issues/3649)) ([a722a1e](https://github.com/dynamic-labs/DynamicAuth/commit/a722a1e48d71373939e5f692bf215985959e1f0b))
12
+
13
+
14
+ * Restructure the SDK packages ([#3623](https://github.com/dynamic-labs/DynamicAuth/issues/3623)) ([aff5342](https://github.com/dynamic-labs/DynamicAuth/commit/aff5342f469a91b9092128daf74396c3af47f698))
15
+
2
16
  ## [0.19.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.19...v0.19.0-alpha.20) (2023-10-23)
3
17
 
4
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.19.0-alpha.20",
3
+ "version": "0.19.0-alpha.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,16 +26,18 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
+ "@coinbase/wallet-sdk": "3.6.4",
29
30
  "@walletconnect/client": "1.8.0",
30
31
  "@walletconnect/ethereum-provider": "1.8.0",
31
32
  "@walletconnect/universal-provider": "2.10.1",
32
33
  "eventemitter3": "5.0.1",
33
34
  "buffer": "6.0.3",
34
- "@dynamic-labs/rpc-providers": "0.19.0-alpha.20",
35
- "@dynamic-labs/types": "0.19.0-alpha.20",
36
- "@dynamic-labs/utils": "0.19.0-alpha.20",
37
- "@dynamic-labs/wallet-book": "0.19.0-alpha.20",
38
- "@dynamic-labs/wallet-connector-core": "0.19.0-alpha.20",
35
+ "@dynamic-labs/rpc-providers": "0.19.0-alpha.21",
36
+ "@dynamic-labs/turnkey": "0.19.0-alpha.21",
37
+ "@dynamic-labs/types": "0.19.0-alpha.21",
38
+ "@dynamic-labs/utils": "0.19.0-alpha.21",
39
+ "@dynamic-labs/wallet-book": "0.19.0-alpha.21",
40
+ "@dynamic-labs/wallet-connector-core": "0.19.0-alpha.21",
39
41
  "stream": "0.0.2"
40
42
  },
41
43
  "peerDependencies": {
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../../_virtual/_tslib.cjs');
6
+ var walletSdk = require('@coinbase/wallet-sdk');
7
+ var viem = require('viem');
8
+ var utils = require('@dynamic-labs/utils');
9
+ var constants = require('../../constants.cjs');
10
+
11
+ const jsonRpcUrl = `https://mainnet.infura.io/v3/${constants.INFURA_ID}`;
12
+ const chainId = 1;
13
+ let coinbaseProvider;
14
+ const getCoinbaseProvider = ({ opts: { appLogoUrl, appName = '', evmNetworks = [] } = {}, handlers, }) => {
15
+ var _a, _b;
16
+ if (!coinbaseProvider) {
17
+ const coinbaseWalletSDK = new walletSdk.CoinbaseWalletSDK({
18
+ appLogoUrl,
19
+ appName,
20
+ eventListener: {
21
+ onEvent: (eventType) => {
22
+ if (eventType === 'walletlink_sdk.disconnected') {
23
+ handlers === null || handlers === void 0 ? void 0 : handlers.onDisconnect();
24
+ }
25
+ },
26
+ },
27
+ headlessMode: true,
28
+ });
29
+ const network = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.find((network) => network.chainId === chainId);
30
+ const rpcUrl = ((_a = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) ||
31
+ ((_b = network === null || network === void 0 ? void 0 : network.rpcUrls) === null || _b === void 0 ? void 0 : _b[0]) ||
32
+ jsonRpcUrl;
33
+ coinbaseProvider = coinbaseWalletSDK.makeWeb3Provider(rpcUrl, chainId);
34
+ }
35
+ return coinbaseProvider;
36
+ };
37
+ const killCoinbaseSession = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
38
+ if (coinbaseProvider) {
39
+ coinbaseProvider.close();
40
+ coinbaseProvider.disconnect();
41
+ }
42
+ });
43
+ const fetchPublicAddress = (coinbaseProviderOpts, opts) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
44
+ var _a;
45
+ const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
46
+ const { qrUrl } = provider;
47
+ if (!qrUrl) {
48
+ throw new utils.DynamicError('no qr url available');
49
+ }
50
+ (_a = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _a === void 0 ? void 0 : _a.call(opts, qrUrl);
51
+ const [address] = yield provider.request({
52
+ method: 'eth_requestAccounts',
53
+ });
54
+ return address;
55
+ });
56
+ const signMessage = (coinbaseProviderOpts, messageToSign) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
57
+ const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
58
+ const [address] = yield provider.request({
59
+ method: 'eth_requestAccounts',
60
+ });
61
+ try {
62
+ return yield provider.request({
63
+ method: 'personal_sign',
64
+ params: [viem.toHex(viem.toBytes(messageToSign)), address.toLowerCase()],
65
+ });
66
+ }
67
+ catch (err) {
68
+ yield provider.close();
69
+ return undefined;
70
+ }
71
+ });
72
+
73
+ exports.fetchPublicAddress = fetchPublicAddress;
74
+ exports.getCoinbaseProvider = getCoinbaseProvider;
75
+ exports.killCoinbaseSession = killCoinbaseSession;
76
+ exports.signMessage = signMessage;
@@ -0,0 +1,6 @@
1
+ import { FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
+ import { GetCoinbaseProvider, GetCoinbaseProviderOpts } from './types';
3
+ export declare const getCoinbaseProvider: GetCoinbaseProvider;
4
+ export declare const killCoinbaseSession: () => Promise<void>;
5
+ export declare const fetchPublicAddress: (coinbaseProviderOpts: GetCoinbaseProviderOpts, opts?: FetchPublicAddressOpts) => Promise<string | undefined>;
6
+ export declare const signMessage: (coinbaseProviderOpts: GetCoinbaseProviderOpts, messageToSign: string) => Promise<string | undefined>;
@@ -0,0 +1,69 @@
1
+ import { __awaiter } from '../../../_virtual/_tslib.js';
2
+ import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk';
3
+ import { toHex, toBytes } from 'viem';
4
+ import { DynamicError } from '@dynamic-labs/utils';
5
+ import { INFURA_ID } from '../../constants.js';
6
+
7
+ const jsonRpcUrl = `https://mainnet.infura.io/v3/${INFURA_ID}`;
8
+ const chainId = 1;
9
+ let coinbaseProvider;
10
+ const getCoinbaseProvider = ({ opts: { appLogoUrl, appName = '', evmNetworks = [] } = {}, handlers, }) => {
11
+ var _a, _b;
12
+ if (!coinbaseProvider) {
13
+ const coinbaseWalletSDK = new CoinbaseWalletSDK({
14
+ appLogoUrl,
15
+ appName,
16
+ eventListener: {
17
+ onEvent: (eventType) => {
18
+ if (eventType === 'walletlink_sdk.disconnected') {
19
+ handlers === null || handlers === void 0 ? void 0 : handlers.onDisconnect();
20
+ }
21
+ },
22
+ },
23
+ headlessMode: true,
24
+ });
25
+ const network = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.find((network) => network.chainId === chainId);
26
+ const rpcUrl = ((_a = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) ||
27
+ ((_b = network === null || network === void 0 ? void 0 : network.rpcUrls) === null || _b === void 0 ? void 0 : _b[0]) ||
28
+ jsonRpcUrl;
29
+ coinbaseProvider = coinbaseWalletSDK.makeWeb3Provider(rpcUrl, chainId);
30
+ }
31
+ return coinbaseProvider;
32
+ };
33
+ const killCoinbaseSession = () => __awaiter(void 0, void 0, void 0, function* () {
34
+ if (coinbaseProvider) {
35
+ coinbaseProvider.close();
36
+ coinbaseProvider.disconnect();
37
+ }
38
+ });
39
+ const fetchPublicAddress = (coinbaseProviderOpts, opts) => __awaiter(void 0, void 0, void 0, function* () {
40
+ var _a;
41
+ const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
42
+ const { qrUrl } = provider;
43
+ if (!qrUrl) {
44
+ throw new DynamicError('no qr url available');
45
+ }
46
+ (_a = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _a === void 0 ? void 0 : _a.call(opts, qrUrl);
47
+ const [address] = yield provider.request({
48
+ method: 'eth_requestAccounts',
49
+ });
50
+ return address;
51
+ });
52
+ const signMessage = (coinbaseProviderOpts, messageToSign) => __awaiter(void 0, void 0, void 0, function* () {
53
+ const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
54
+ const [address] = yield provider.request({
55
+ method: 'eth_requestAccounts',
56
+ });
57
+ try {
58
+ return yield provider.request({
59
+ method: 'personal_sign',
60
+ params: [toHex(toBytes(messageToSign)), address.toLowerCase()],
61
+ });
62
+ }
63
+ catch (err) {
64
+ yield provider.close();
65
+ return undefined;
66
+ }
67
+ });
68
+
69
+ export { fetchPublicAddress, getCoinbaseProvider, killCoinbaseSession, signMessage };
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ export * from './types';
@@ -0,0 +1,14 @@
1
+ import { CoinbaseWalletProvider } from '@coinbase/wallet-sdk';
2
+ import { GenericNetwork } from '@dynamic-labs/types';
3
+ export type GetCoinbaseProviderOpts = {
4
+ appLogoUrl?: string;
5
+ appName?: string;
6
+ evmNetworks?: GenericNetwork[];
7
+ };
8
+ export type CoinbaseProviderHandlerOpts = {
9
+ onDisconnect(): Promise<void>;
10
+ };
11
+ export type GetCoinbaseProvider = (args: {
12
+ handlers?: CoinbaseProviderHandlerOpts;
13
+ opts?: GetCoinbaseProviderOpts;
14
+ }) => CoinbaseWalletProvider;
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../_virtual/_tslib.cjs');
6
+ var viem = require('viem');
7
+ var EthWalletConnector = require('../EthWalletConnector.cjs');
8
+ var legacyEthProviderHelper = require('../legacyEthProviderHelper.cjs');
9
+ var client = require('./client/client.cjs');
10
+
11
+ class Coinbase extends EthWalletConnector.EthWalletConnector {
12
+ constructor(_a) {
13
+ var { appName, appLogoUrl, evmNetworks } = _a, props = _tslib.__rest(_a, ["appName", "appLogoUrl", "evmNetworks"]);
14
+ super(Object.assign({ evmNetworks }, props));
15
+ this.name = 'Coinbase';
16
+ this.supportedChains = ['EVM', 'ETH'];
17
+ this.connectedChain = 'EVM';
18
+ this.canConnectViaQrCode = true;
19
+ this.coinbaseProviderOpts = {
20
+ appLogoUrl: appLogoUrl,
21
+ appName: appName,
22
+ evmNetworks: evmNetworks,
23
+ };
24
+ }
25
+ setupEventListeners() {
26
+ const provider = legacyEthProviderHelper.LegacyEthProviderHelper.findProvider(this.name);
27
+ if (!provider) {
28
+ return;
29
+ }
30
+ const { tearDownEventListeners } = legacyEthProviderHelper.LegacyEthProviderHelper._setupEventListeners(this.name, this, viem.createPublicClient({ transport: viem.custom(provider) }));
31
+ this.teardownEventListeners = tearDownEventListeners;
32
+ }
33
+ getWalletClient() {
34
+ if (this.isInstalledOnBrowser()) {
35
+ return legacyEthProviderHelper.LegacyEthProviderHelper.findWalletClient(this.name);
36
+ }
37
+ return viem.createWalletClient({
38
+ transport: viem.custom(client.getCoinbaseProvider({
39
+ opts: this.coinbaseProviderOpts,
40
+ })),
41
+ });
42
+ }
43
+ isInstalledOnBrowser() {
44
+ return legacyEthProviderHelper.LegacyEthProviderHelper.isInstalledHelper(this.name);
45
+ }
46
+ fetchPublicAddress(opts) {
47
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
48
+ if (this.isInstalledOnBrowser()) {
49
+ return legacyEthProviderHelper.LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
50
+ }
51
+ return client.fetchPublicAddress(this.coinbaseProviderOpts, opts);
52
+ });
53
+ }
54
+ signMessage(messageToSign) {
55
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
56
+ if (this.isInstalledOnBrowser()) {
57
+ return legacyEthProviderHelper.LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
58
+ }
59
+ return client.signMessage(this.coinbaseProviderOpts, messageToSign);
60
+ });
61
+ }
62
+ endSession() {
63
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
64
+ if (this.isInstalledOnBrowser())
65
+ return;
66
+ client.killCoinbaseSession();
67
+ });
68
+ }
69
+ }
70
+
71
+ exports.Coinbase = Coinbase;
@@ -0,0 +1,535 @@
1
+ import { Chain, FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
+ import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
3
+ type CoinbaseOpts = EthWalletConnectorOpts & {
4
+ appLogoUrl?: string;
5
+ appName?: string;
6
+ };
7
+ export declare class Coinbase extends EthWalletConnector {
8
+ name: string;
9
+ supportedChains: Chain[];
10
+ connectedChain: Chain;
11
+ canConnectViaQrCode: boolean;
12
+ private coinbaseProviderOpts;
13
+ constructor({ appName, appLogoUrl, evmNetworks, ...props }: CoinbaseOpts);
14
+ setupEventListeners(): void;
15
+ getWalletClient(): {
16
+ account: import("viem").Account | undefined;
17
+ batch?: {
18
+ multicall?: boolean | {
19
+ batchSize?: number | undefined;
20
+ wait?: number | undefined;
21
+ } | undefined;
22
+ } | undefined;
23
+ cacheTime: number;
24
+ chain: import("viem").Chain | undefined;
25
+ key: string;
26
+ name: string;
27
+ pollingInterval: number;
28
+ request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
29
+ transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
30
+ type: string;
31
+ uid: string;
32
+ addChain: (args: import("viem").AddChainParameters) => Promise<void>;
33
+ deployContract: <const TAbi extends import("viem").Abi | readonly unknown[], TChainOverride extends import("viem").Chain | undefined>(args: import("viem").DeployContractParameters<TAbi, import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride>) => Promise<`0x${string}`>;
34
+ getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
35
+ getChainId: () => Promise<number>;
36
+ getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
37
+ prepareTransactionRequest: <TChainOverride_1 extends import("viem").Chain | undefined>(args: import("viem").PrepareTransactionRequestParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_1>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
38
+ requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
39
+ requestPermissions: (args: {
40
+ [x: string]: Record<string, any>;
41
+ eth_accounts: Record<string, any>;
42
+ }) => Promise<import("viem").RequestPermissionsReturnType>;
43
+ sendRawTransaction: (args: import("viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
44
+ sendTransaction: <TChainOverride_2 extends import("viem").Chain | undefined>(args: import("viem").SendTransactionParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_2>) => Promise<`0x${string}`>;
45
+ signMessage: (args: import("viem").SignMessageParameters<import("viem").Account | undefined>) => Promise<`0x${string}`>;
46
+ signTransaction: <TChainOverride_3 extends import("viem").Chain | undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_3>) => Promise<`0x${string}`>;
47
+ signTypedData: <const TTypedData extends {
48
+ [x: string]: readonly import("viem").TypedDataParameter[];
49
+ [x: `string[${string}]`]: undefined;
50
+ [x: `function[${string}]`]: undefined;
51
+ [x: `address[${string}]`]: undefined;
52
+ [x: `bool[${string}]`]: undefined;
53
+ [x: `bytes[${string}]`]: undefined;
54
+ [x: `bytes16[${string}]`]: undefined;
55
+ [x: `bytes1[${string}]`]: undefined;
56
+ [x: `bytes2[${string}]`]: undefined;
57
+ [x: `bytes3[${string}]`]: undefined;
58
+ [x: `bytes4[${string}]`]: undefined;
59
+ [x: `bytes5[${string}]`]: undefined;
60
+ [x: `bytes6[${string}]`]: undefined;
61
+ [x: `bytes7[${string}]`]: undefined;
62
+ [x: `bytes8[${string}]`]: undefined;
63
+ [x: `bytes9[${string}]`]: undefined;
64
+ [x: `bytes10[${string}]`]: undefined;
65
+ [x: `bytes11[${string}]`]: undefined;
66
+ [x: `bytes12[${string}]`]: undefined;
67
+ [x: `bytes13[${string}]`]: undefined;
68
+ [x: `bytes14[${string}]`]: undefined;
69
+ [x: `bytes15[${string}]`]: undefined;
70
+ [x: `bytes17[${string}]`]: undefined;
71
+ [x: `bytes18[${string}]`]: undefined;
72
+ [x: `bytes19[${string}]`]: undefined;
73
+ [x: `bytes20[${string}]`]: undefined;
74
+ [x: `bytes21[${string}]`]: undefined;
75
+ [x: `bytes22[${string}]`]: undefined;
76
+ [x: `bytes23[${string}]`]: undefined;
77
+ [x: `bytes24[${string}]`]: undefined;
78
+ [x: `bytes25[${string}]`]: undefined;
79
+ [x: `bytes26[${string}]`]: undefined;
80
+ [x: `bytes27[${string}]`]: undefined;
81
+ [x: `bytes28[${string}]`]: undefined;
82
+ [x: `bytes29[${string}]`]: undefined;
83
+ [x: `bytes30[${string}]`]: undefined;
84
+ [x: `bytes31[${string}]`]: undefined;
85
+ [x: `bytes32[${string}]`]: undefined;
86
+ [x: `int[${string}]`]: undefined;
87
+ [x: `int16[${string}]`]: undefined;
88
+ [x: `int8[${string}]`]: undefined;
89
+ [x: `int24[${string}]`]: undefined;
90
+ [x: `int32[${string}]`]: undefined;
91
+ [x: `int40[${string}]`]: undefined;
92
+ [x: `int48[${string}]`]: undefined;
93
+ [x: `int56[${string}]`]: undefined;
94
+ [x: `int64[${string}]`]: undefined;
95
+ [x: `int72[${string}]`]: undefined;
96
+ [x: `int80[${string}]`]: undefined;
97
+ [x: `int88[${string}]`]: undefined;
98
+ [x: `int96[${string}]`]: undefined;
99
+ [x: `int104[${string}]`]: undefined;
100
+ [x: `int112[${string}]`]: undefined;
101
+ [x: `int120[${string}]`]: undefined;
102
+ [x: `int128[${string}]`]: undefined;
103
+ [x: `int136[${string}]`]: undefined;
104
+ [x: `int144[${string}]`]: undefined;
105
+ [x: `int152[${string}]`]: undefined;
106
+ [x: `int160[${string}]`]: undefined;
107
+ [x: `int168[${string}]`]: undefined;
108
+ [x: `int176[${string}]`]: undefined;
109
+ [x: `int184[${string}]`]: undefined;
110
+ [x: `int192[${string}]`]: undefined;
111
+ [x: `int200[${string}]`]: undefined;
112
+ [x: `int208[${string}]`]: undefined;
113
+ [x: `int216[${string}]`]: undefined;
114
+ [x: `int224[${string}]`]: undefined;
115
+ [x: `int232[${string}]`]: undefined;
116
+ [x: `int240[${string}]`]: undefined;
117
+ [x: `int248[${string}]`]: undefined;
118
+ [x: `int256[${string}]`]: undefined;
119
+ [x: `uint[${string}]`]: undefined;
120
+ [x: `uint16[${string}]`]: undefined;
121
+ [x: `uint8[${string}]`]: undefined;
122
+ [x: `uint24[${string}]`]: undefined;
123
+ [x: `uint32[${string}]`]: undefined;
124
+ [x: `uint40[${string}]`]: undefined;
125
+ [x: `uint48[${string}]`]: undefined;
126
+ [x: `uint56[${string}]`]: undefined;
127
+ [x: `uint64[${string}]`]: undefined;
128
+ [x: `uint72[${string}]`]: undefined;
129
+ [x: `uint80[${string}]`]: undefined;
130
+ [x: `uint88[${string}]`]: undefined;
131
+ [x: `uint96[${string}]`]: undefined;
132
+ [x: `uint104[${string}]`]: undefined;
133
+ [x: `uint112[${string}]`]: undefined;
134
+ [x: `uint120[${string}]`]: undefined;
135
+ [x: `uint128[${string}]`]: undefined;
136
+ [x: `uint136[${string}]`]: undefined;
137
+ [x: `uint144[${string}]`]: undefined;
138
+ [x: `uint152[${string}]`]: undefined;
139
+ [x: `uint160[${string}]`]: undefined;
140
+ [x: `uint168[${string}]`]: undefined;
141
+ [x: `uint176[${string}]`]: undefined;
142
+ [x: `uint184[${string}]`]: undefined;
143
+ [x: `uint192[${string}]`]: undefined;
144
+ [x: `uint200[${string}]`]: undefined;
145
+ [x: `uint208[${string}]`]: undefined;
146
+ [x: `uint216[${string}]`]: undefined;
147
+ [x: `uint224[${string}]`]: undefined;
148
+ [x: `uint232[${string}]`]: undefined;
149
+ [x: `uint240[${string}]`]: undefined;
150
+ [x: `uint248[${string}]`]: undefined;
151
+ [x: `uint256[${string}]`]: undefined;
152
+ string?: undefined;
153
+ address?: undefined;
154
+ bool?: undefined;
155
+ bytes?: undefined;
156
+ bytes16?: undefined;
157
+ bytes1?: undefined;
158
+ bytes2?: undefined;
159
+ bytes3?: undefined;
160
+ bytes4?: undefined;
161
+ bytes5?: undefined;
162
+ bytes6?: undefined;
163
+ bytes7?: undefined;
164
+ bytes8?: undefined;
165
+ bytes9?: undefined;
166
+ bytes10?: undefined;
167
+ bytes11?: undefined;
168
+ bytes12?: undefined;
169
+ bytes13?: undefined;
170
+ bytes14?: undefined;
171
+ bytes15?: undefined;
172
+ bytes17?: undefined;
173
+ bytes18?: undefined;
174
+ bytes19?: undefined;
175
+ bytes20?: undefined;
176
+ bytes21?: undefined;
177
+ bytes22?: undefined;
178
+ bytes23?: undefined;
179
+ bytes24?: undefined;
180
+ bytes25?: undefined;
181
+ bytes26?: undefined;
182
+ bytes27?: undefined;
183
+ bytes28?: undefined;
184
+ bytes29?: undefined;
185
+ bytes30?: undefined;
186
+ bytes31?: undefined;
187
+ bytes32?: undefined;
188
+ int16?: undefined;
189
+ int8?: undefined;
190
+ int24?: undefined;
191
+ int32?: undefined;
192
+ int40?: undefined;
193
+ int48?: undefined;
194
+ int56?: undefined;
195
+ int64?: undefined;
196
+ int72?: undefined;
197
+ int80?: undefined;
198
+ int88?: undefined;
199
+ int96?: undefined;
200
+ int104?: undefined;
201
+ int112?: undefined;
202
+ int120?: undefined;
203
+ int128?: undefined;
204
+ int136?: undefined;
205
+ int144?: undefined;
206
+ int152?: undefined;
207
+ int160?: undefined;
208
+ int168?: undefined;
209
+ int176?: undefined;
210
+ int184?: undefined;
211
+ int192?: undefined;
212
+ int200?: undefined;
213
+ int208?: undefined;
214
+ int216?: undefined;
215
+ int224?: undefined;
216
+ int232?: undefined;
217
+ int240?: undefined;
218
+ int248?: undefined;
219
+ int256?: undefined;
220
+ uint16?: undefined;
221
+ uint8?: undefined;
222
+ uint24?: undefined;
223
+ uint32?: undefined;
224
+ uint40?: undefined;
225
+ uint48?: undefined;
226
+ uint56?: undefined;
227
+ uint64?: undefined;
228
+ uint72?: undefined;
229
+ uint80?: undefined;
230
+ uint88?: undefined;
231
+ uint96?: undefined;
232
+ uint104?: undefined;
233
+ uint112?: undefined;
234
+ uint120?: undefined;
235
+ uint128?: undefined;
236
+ uint136?: undefined;
237
+ uint144?: undefined;
238
+ uint152?: undefined;
239
+ uint160?: undefined;
240
+ uint168?: undefined;
241
+ uint176?: undefined;
242
+ uint184?: undefined;
243
+ uint192?: undefined;
244
+ uint200?: undefined;
245
+ uint208?: undefined;
246
+ uint216?: undefined;
247
+ uint224?: undefined;
248
+ uint232?: undefined;
249
+ uint240?: undefined;
250
+ uint248?: undefined;
251
+ uint256?: undefined;
252
+ } | {
253
+ [key: string]: unknown;
254
+ }, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, import("viem").Account | undefined>) => Promise<`0x${string}`>;
255
+ switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
256
+ watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
257
+ writeContract: <const TAbi_1 extends import("viem").Abi | readonly unknown[], TFunctionName extends string, TChainOverride_4 extends import("viem").Chain | undefined>(args: import("viem").WriteContractParameters<TAbi_1, TFunctionName, import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_4>) => Promise<`0x${string}`>;
258
+ extend: <const client extends {
259
+ [x: string]: unknown;
260
+ account?: undefined;
261
+ batch?: undefined;
262
+ cacheTime?: undefined;
263
+ chain?: undefined;
264
+ key?: undefined;
265
+ name?: undefined;
266
+ pollingInterval?: undefined;
267
+ request?: undefined;
268
+ transport?: undefined;
269
+ type?: undefined;
270
+ uid?: undefined;
271
+ }>(fn: (client: import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<import("viem").Chain | undefined, import("viem").Account | undefined>>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<import("viem").Chain | undefined, import("viem").Account | undefined>>;
272
+ } | {
273
+ account: undefined;
274
+ batch?: {
275
+ multicall?: boolean | {
276
+ batchSize?: number | undefined;
277
+ wait?: number | undefined;
278
+ } | undefined;
279
+ } | undefined;
280
+ cacheTime: number;
281
+ chain: undefined;
282
+ key: string;
283
+ name: string;
284
+ pollingInterval: number;
285
+ request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
286
+ transport: import("viem").TransportConfig<"custom", import("viem").EIP1193RequestFn>;
287
+ type: string;
288
+ uid: string;
289
+ addChain: (args: import("viem").AddChainParameters) => Promise<void>;
290
+ deployContract: <const TAbi_2 extends import("viem").Abi | readonly unknown[], TChainOverride_5 extends import("viem").Chain | undefined>(args: import("viem").DeployContractParameters<TAbi_2, undefined, undefined, TChainOverride_5>) => Promise<`0x${string}`>;
291
+ getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
292
+ getChainId: () => Promise<number>;
293
+ getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
294
+ prepareTransactionRequest: <TChainOverride_6 extends import("viem").Chain | undefined>(args: import("viem").PrepareTransactionRequestParameters<undefined, undefined, TChainOverride_6>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
295
+ requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
296
+ requestPermissions: (args: {
297
+ [x: string]: Record<string, any>;
298
+ eth_accounts: Record<string, any>;
299
+ }) => Promise<import("viem").RequestPermissionsReturnType>;
300
+ sendRawTransaction: (args: import("viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
301
+ sendTransaction: <TChainOverride_7 extends import("viem").Chain | undefined>(args: import("viem").SendTransactionParameters<undefined, undefined, TChainOverride_7>) => Promise<`0x${string}`>;
302
+ signMessage: (args: import("viem").SignMessageParameters<undefined>) => Promise<`0x${string}`>;
303
+ signTransaction: <TChainOverride_8 extends import("viem").Chain | undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<undefined, undefined, TChainOverride_8>) => Promise<`0x${string}`>;
304
+ signTypedData: <const TTypedData_1 extends {
305
+ [x: string]: readonly import("viem").TypedDataParameter[];
306
+ [x: `string[${string}]`]: undefined;
307
+ [x: `function[${string}]`]: undefined;
308
+ [x: `address[${string}]`]: undefined;
309
+ [x: `bool[${string}]`]: undefined;
310
+ [x: `bytes[${string}]`]: undefined;
311
+ [x: `bytes16[${string}]`]: undefined;
312
+ [x: `bytes1[${string}]`]: undefined;
313
+ [x: `bytes2[${string}]`]: undefined;
314
+ [x: `bytes3[${string}]`]: undefined;
315
+ [x: `bytes4[${string}]`]: undefined;
316
+ [x: `bytes5[${string}]`]: undefined;
317
+ [x: `bytes6[${string}]`]: undefined;
318
+ [x: `bytes7[${string}]`]: undefined;
319
+ [x: `bytes8[${string}]`]: undefined;
320
+ [x: `bytes9[${string}]`]: undefined;
321
+ [x: `bytes10[${string}]`]: undefined;
322
+ [x: `bytes11[${string}]`]: undefined;
323
+ [x: `bytes12[${string}]`]: undefined;
324
+ [x: `bytes13[${string}]`]: undefined;
325
+ [x: `bytes14[${string}]`]: undefined;
326
+ [x: `bytes15[${string}]`]: undefined;
327
+ [x: `bytes17[${string}]`]: undefined;
328
+ [x: `bytes18[${string}]`]: undefined;
329
+ [x: `bytes19[${string}]`]: undefined;
330
+ [x: `bytes20[${string}]`]: undefined;
331
+ [x: `bytes21[${string}]`]: undefined;
332
+ [x: `bytes22[${string}]`]: undefined;
333
+ [x: `bytes23[${string}]`]: undefined;
334
+ [x: `bytes24[${string}]`]: undefined;
335
+ [x: `bytes25[${string}]`]: undefined;
336
+ [x: `bytes26[${string}]`]: undefined;
337
+ [x: `bytes27[${string}]`]: undefined;
338
+ [x: `bytes28[${string}]`]: undefined;
339
+ [x: `bytes29[${string}]`]: undefined;
340
+ [x: `bytes30[${string}]`]: undefined;
341
+ [x: `bytes31[${string}]`]: undefined;
342
+ [x: `bytes32[${string}]`]: undefined;
343
+ [x: `int[${string}]`]: undefined;
344
+ [x: `int16[${string}]`]: undefined;
345
+ [x: `int8[${string}]`]: undefined;
346
+ [x: `int24[${string}]`]: undefined;
347
+ [x: `int32[${string}]`]: undefined;
348
+ [x: `int40[${string}]`]: undefined;
349
+ [x: `int48[${string}]`]: undefined;
350
+ [x: `int56[${string}]`]: undefined;
351
+ [x: `int64[${string}]`]: undefined;
352
+ [x: `int72[${string}]`]: undefined;
353
+ [x: `int80[${string}]`]: undefined;
354
+ [x: `int88[${string}]`]: undefined;
355
+ [x: `int96[${string}]`]: undefined;
356
+ [x: `int104[${string}]`]: undefined;
357
+ [x: `int112[${string}]`]: undefined;
358
+ [x: `int120[${string}]`]: undefined;
359
+ [x: `int128[${string}]`]: undefined;
360
+ [x: `int136[${string}]`]: undefined;
361
+ [x: `int144[${string}]`]: undefined;
362
+ [x: `int152[${string}]`]: undefined;
363
+ [x: `int160[${string}]`]: undefined;
364
+ [x: `int168[${string}]`]: undefined;
365
+ [x: `int176[${string}]`]: undefined;
366
+ [x: `int184[${string}]`]: undefined;
367
+ [x: `int192[${string}]`]: undefined;
368
+ [x: `int200[${string}]`]: undefined;
369
+ [x: `int208[${string}]`]: undefined;
370
+ [x: `int216[${string}]`]: undefined;
371
+ [x: `int224[${string}]`]: undefined;
372
+ [x: `int232[${string}]`]: undefined;
373
+ [x: `int240[${string}]`]: undefined;
374
+ [x: `int248[${string}]`]: undefined;
375
+ [x: `int256[${string}]`]: undefined;
376
+ [x: `uint[${string}]`]: undefined;
377
+ [x: `uint16[${string}]`]: undefined;
378
+ [x: `uint8[${string}]`]: undefined;
379
+ [x: `uint24[${string}]`]: undefined;
380
+ [x: `uint32[${string}]`]: undefined;
381
+ [x: `uint40[${string}]`]: undefined;
382
+ [x: `uint48[${string}]`]: undefined;
383
+ [x: `uint56[${string}]`]: undefined;
384
+ [x: `uint64[${string}]`]: undefined;
385
+ [x: `uint72[${string}]`]: undefined;
386
+ [x: `uint80[${string}]`]: undefined;
387
+ [x: `uint88[${string}]`]: undefined;
388
+ [x: `uint96[${string}]`]: undefined;
389
+ [x: `uint104[${string}]`]: undefined;
390
+ [x: `uint112[${string}]`]: undefined;
391
+ [x: `uint120[${string}]`]: undefined;
392
+ [x: `uint128[${string}]`]: undefined;
393
+ [x: `uint136[${string}]`]: undefined;
394
+ [x: `uint144[${string}]`]: undefined;
395
+ [x: `uint152[${string}]`]: undefined;
396
+ [x: `uint160[${string}]`]: undefined;
397
+ [x: `uint168[${string}]`]: undefined;
398
+ [x: `uint176[${string}]`]: undefined;
399
+ [x: `uint184[${string}]`]: undefined;
400
+ [x: `uint192[${string}]`]: undefined;
401
+ [x: `uint200[${string}]`]: undefined;
402
+ [x: `uint208[${string}]`]: undefined;
403
+ [x: `uint216[${string}]`]: undefined;
404
+ [x: `uint224[${string}]`]: undefined;
405
+ [x: `uint232[${string}]`]: undefined;
406
+ [x: `uint240[${string}]`]: undefined;
407
+ [x: `uint248[${string}]`]: undefined;
408
+ [x: `uint256[${string}]`]: undefined;
409
+ string?: undefined;
410
+ address?: undefined;
411
+ bool?: undefined;
412
+ bytes?: undefined;
413
+ bytes16?: undefined;
414
+ bytes1?: undefined;
415
+ bytes2?: undefined;
416
+ bytes3?: undefined;
417
+ bytes4?: undefined;
418
+ bytes5?: undefined;
419
+ bytes6?: undefined;
420
+ bytes7?: undefined;
421
+ bytes8?: undefined;
422
+ bytes9?: undefined;
423
+ bytes10?: undefined;
424
+ bytes11?: undefined;
425
+ bytes12?: undefined;
426
+ bytes13?: undefined;
427
+ bytes14?: undefined;
428
+ bytes15?: undefined;
429
+ bytes17?: undefined;
430
+ bytes18?: undefined;
431
+ bytes19?: undefined;
432
+ bytes20?: undefined;
433
+ bytes21?: undefined;
434
+ bytes22?: undefined;
435
+ bytes23?: undefined;
436
+ bytes24?: undefined;
437
+ bytes25?: undefined;
438
+ bytes26?: undefined;
439
+ bytes27?: undefined;
440
+ bytes28?: undefined;
441
+ bytes29?: undefined;
442
+ bytes30?: undefined;
443
+ bytes31?: undefined;
444
+ bytes32?: undefined;
445
+ int16?: undefined;
446
+ int8?: undefined;
447
+ int24?: undefined;
448
+ int32?: undefined;
449
+ int40?: undefined;
450
+ int48?: undefined;
451
+ int56?: undefined;
452
+ int64?: undefined;
453
+ int72?: undefined;
454
+ int80?: undefined;
455
+ int88?: undefined;
456
+ int96?: undefined;
457
+ int104?: undefined;
458
+ int112?: undefined;
459
+ int120?: undefined;
460
+ int128?: undefined;
461
+ int136?: undefined;
462
+ int144?: undefined;
463
+ int152?: undefined;
464
+ int160?: undefined;
465
+ int168?: undefined;
466
+ int176?: undefined;
467
+ int184?: undefined;
468
+ int192?: undefined;
469
+ int200?: undefined;
470
+ int208?: undefined;
471
+ int216?: undefined;
472
+ int224?: undefined;
473
+ int232?: undefined;
474
+ int240?: undefined;
475
+ int248?: undefined;
476
+ int256?: undefined;
477
+ uint16?: undefined;
478
+ uint8?: undefined;
479
+ uint24?: undefined;
480
+ uint32?: undefined;
481
+ uint40?: undefined;
482
+ uint48?: undefined;
483
+ uint56?: undefined;
484
+ uint64?: undefined;
485
+ uint72?: undefined;
486
+ uint80?: undefined;
487
+ uint88?: undefined;
488
+ uint96?: undefined;
489
+ uint104?: undefined;
490
+ uint112?: undefined;
491
+ uint120?: undefined;
492
+ uint128?: undefined;
493
+ uint136?: undefined;
494
+ uint144?: undefined;
495
+ uint152?: undefined;
496
+ uint160?: undefined;
497
+ uint168?: undefined;
498
+ uint176?: undefined;
499
+ uint184?: undefined;
500
+ uint192?: undefined;
501
+ uint200?: undefined;
502
+ uint208?: undefined;
503
+ uint216?: undefined;
504
+ uint224?: undefined;
505
+ uint232?: undefined;
506
+ uint240?: undefined;
507
+ uint248?: undefined;
508
+ uint256?: undefined;
509
+ } | {
510
+ [key: string]: unknown;
511
+ }, TPrimaryType_1 extends string>(args: import("viem").SignTypedDataParameters<TTypedData_1, TPrimaryType_1, undefined>) => Promise<`0x${string}`>;
512
+ switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
513
+ watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
514
+ writeContract: <const TAbi_3 extends import("viem").Abi | readonly unknown[], TFunctionName_1 extends string, TChainOverride_9 extends import("viem").Chain | undefined>(args: import("viem").WriteContractParameters<TAbi_3, TFunctionName_1, undefined, undefined, TChainOverride_9>) => Promise<`0x${string}`>;
515
+ extend: <const client_1 extends {
516
+ [x: string]: unknown;
517
+ account?: undefined;
518
+ batch?: undefined;
519
+ cacheTime?: undefined;
520
+ chain?: undefined;
521
+ key?: undefined;
522
+ name?: undefined;
523
+ pollingInterval?: undefined;
524
+ request?: undefined;
525
+ transport?: undefined;
526
+ type?: undefined;
527
+ uid?: undefined;
528
+ }>(fn: (client: import("viem").Client<import("viem").CustomTransport, undefined, undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<undefined, undefined>>) => client_1) => import("viem").Client<import("viem").CustomTransport, undefined, undefined, import("viem").WalletRpcSchema, { [K_1 in keyof client_1]: client_1[K_1]; } & import("viem").WalletActions<undefined, undefined>>;
529
+ } | undefined;
530
+ isInstalledOnBrowser(): boolean;
531
+ fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
532
+ signMessage(messageToSign: string): Promise<string | undefined>;
533
+ endSession(): Promise<void>;
534
+ }
535
+ export {};
@@ -0,0 +1,67 @@
1
+ import { __rest, __awaiter } from '../../_virtual/_tslib.js';
2
+ import { createPublicClient, custom, createWalletClient } from 'viem';
3
+ import { EthWalletConnector } from '../EthWalletConnector.js';
4
+ import { LegacyEthProviderHelper } from '../legacyEthProviderHelper.js';
5
+ import { getCoinbaseProvider, fetchPublicAddress, signMessage, killCoinbaseSession } from './client/client.js';
6
+
7
+ class Coinbase extends EthWalletConnector {
8
+ constructor(_a) {
9
+ var { appName, appLogoUrl, evmNetworks } = _a, props = __rest(_a, ["appName", "appLogoUrl", "evmNetworks"]);
10
+ super(Object.assign({ evmNetworks }, props));
11
+ this.name = 'Coinbase';
12
+ this.supportedChains = ['EVM', 'ETH'];
13
+ this.connectedChain = 'EVM';
14
+ this.canConnectViaQrCode = true;
15
+ this.coinbaseProviderOpts = {
16
+ appLogoUrl: appLogoUrl,
17
+ appName: appName,
18
+ evmNetworks: evmNetworks,
19
+ };
20
+ }
21
+ setupEventListeners() {
22
+ const provider = LegacyEthProviderHelper.findProvider(this.name);
23
+ if (!provider) {
24
+ return;
25
+ }
26
+ const { tearDownEventListeners } = LegacyEthProviderHelper._setupEventListeners(this.name, this, createPublicClient({ transport: custom(provider) }));
27
+ this.teardownEventListeners = tearDownEventListeners;
28
+ }
29
+ getWalletClient() {
30
+ if (this.isInstalledOnBrowser()) {
31
+ return LegacyEthProviderHelper.findWalletClient(this.name);
32
+ }
33
+ return createWalletClient({
34
+ transport: custom(getCoinbaseProvider({
35
+ opts: this.coinbaseProviderOpts,
36
+ })),
37
+ });
38
+ }
39
+ isInstalledOnBrowser() {
40
+ return LegacyEthProviderHelper.isInstalledHelper(this.name);
41
+ }
42
+ fetchPublicAddress(opts) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ if (this.isInstalledOnBrowser()) {
45
+ return LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
46
+ }
47
+ return fetchPublicAddress(this.coinbaseProviderOpts, opts);
48
+ });
49
+ }
50
+ signMessage(messageToSign) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ if (this.isInstalledOnBrowser()) {
53
+ return LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
54
+ }
55
+ return signMessage(this.coinbaseProviderOpts, messageToSign);
56
+ });
57
+ }
58
+ endSession() {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ if (this.isInstalledOnBrowser())
61
+ return;
62
+ killCoinbaseSession();
63
+ });
64
+ }
65
+ }
66
+
67
+ export { Coinbase };
@@ -0,0 +1,3 @@
1
+ import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
+ export * from './coinbase';
3
+ export declare const CoinbaseWalletConnectors: (props: any) => WalletConnectorConstructor[];
package/src/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('./polyfills.cjs');
6
+ var turnkey = require('@dynamic-labs/turnkey');
6
7
  var BloctoInjected = require('./injected/BloctoInjected.cjs');
7
8
  var BraveEvm = require('./injected/BraveEvm.cjs');
8
9
  var Dawn = require('./injected/Dawn.cjs');
@@ -26,6 +27,7 @@ var EthWalletConnector = require('./EthWalletConnector.cjs');
26
27
  var constants = require('./constants.cjs');
27
28
  require('@walletconnect/client');
28
29
  var fetchWalletConnectWallets = require('./walletConnect/fetchWalletConnectWallets.cjs');
30
+ var coinbase = require('./coinbase/coinbase.cjs');
29
31
  var ethProviderHelper = require('./ethProviderHelper.cjs');
30
32
  var legacyEthProviderHelper = require('./legacyEthProviderHelper.cjs');
31
33
 
@@ -33,6 +35,8 @@ const EthereumWalletConnectors = (props) => [
33
35
  ...legacyInjectedWallets.legacyInjectedWallets,
34
36
  ...fetchInjectedWalletConnectors.fetchInjectedWalletConnector(props),
35
37
  ...fetchWalletConnectWallets.fetchWalletConnectWallets(props),
38
+ ...turnkey.TurnkeyWalletConnectors(props),
39
+ coinbase.Coinbase,
36
40
  fetchWalletConnectWallets.getWalletConnectConnector(props),
37
41
  ];
38
42
 
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import './polyfills.js';
2
+ import { TurnkeyWalletConnectors } from '@dynamic-labs/turnkey';
2
3
  export { BloctoInjected } from './injected/BloctoInjected.js';
3
4
  export { BraveEvm } from './injected/BraveEvm.js';
4
5
  export { Dawn } from './injected/Dawn.js';
@@ -24,6 +25,7 @@ export { EthWalletConnector } from './EthWalletConnector.js';
24
25
  export { INFURA_ID } from './constants.js';
25
26
  import '@walletconnect/client';
26
27
  import { fetchWalletConnectWallets, getWalletConnectConnector } from './walletConnect/fetchWalletConnectWallets.js';
28
+ import { Coinbase } from './coinbase/coinbase.js';
27
29
  export { EthProviderHelper } from './ethProviderHelper.js';
28
30
  export { LegacyEthProviderHelper } from './legacyEthProviderHelper.js';
29
31
 
@@ -31,6 +33,8 @@ const EthereumWalletConnectors = (props) => [
31
33
  ...legacyInjectedWallets,
32
34
  ...fetchInjectedWalletConnector(props),
33
35
  ...fetchWalletConnectWallets(props),
36
+ ...TurnkeyWalletConnectors(props),
37
+ Coinbase,
34
38
  getWalletConnectConnector(props),
35
39
  ];
36
40
 
@@ -19,7 +19,7 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
19
19
  if (!this.wallet) {
20
20
  this.wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
21
21
  }
22
- if (!this.ethProviderHelper) {
22
+ if (this.wallet && !this.ethProviderHelper) {
23
23
  this.ethProviderHelper = new ethProviderHelper.EthProviderHelper(this.wallet);
24
24
  }
25
25
  return this.ethProviderHelper;
@@ -43,18 +43,24 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
43
43
  const provider = this.getWalletClient();
44
44
  if (!provider)
45
45
  return;
46
- const { tearDownEventListeners } = this.getEthProviderHelper()._setupEventListeners(this, viem.createPublicClient({ transport: viem.custom(provider) }));
46
+ const ethProviderHelper = this.getEthProviderHelper();
47
+ if (!ethProviderHelper)
48
+ return;
49
+ const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this, viem.createPublicClient({ transport: viem.custom(provider) }));
47
50
  this.teardownEventListeners = tearDownEventListeners;
48
51
  }
49
52
  getWalletClient() {
50
- return this.getEthProviderHelper().findWalletClient();
53
+ var _a;
54
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
51
55
  }
52
56
  isInstalledOnBrowser() {
53
- return this.getEthProviderHelper().findProvider() !== undefined;
57
+ var _a;
58
+ return ((_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findProvider()) !== undefined;
54
59
  }
55
60
  fetchPublicAddress() {
61
+ var _a;
56
62
  return _tslib.__awaiter(this, void 0, void 0, function* () {
57
- return this.getEthProviderHelper().fetchPublicAddress();
63
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress();
58
64
  });
59
65
  }
60
66
  connect() {
@@ -63,8 +69,9 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
63
69
  });
64
70
  }
65
71
  signMessage(messageToSign) {
72
+ var _a;
66
73
  return _tslib.__awaiter(this, void 0, void 0, function* () {
67
- return this.getEthProviderHelper().signMessage(messageToSign);
74
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.signMessage(messageToSign);
68
75
  });
69
76
  }
70
77
  proveOwnership(messageToSign) {
@@ -11,267 +11,10 @@ declare abstract class InjectedWalletBase extends EthWalletConnector {
11
11
  walletConnectorFallback: boolean;
12
12
  ethProviderHelper: EthProviderHelper | undefined;
13
13
  wallet: WalletSchema | undefined;
14
- getEthProviderHelper(): EthProviderHelper;
14
+ getEthProviderHelper(): EthProviderHelper | undefined;
15
15
  getMobileOrInstalledWallet(): InjectedWalletBase;
16
16
  setupEventListeners(): void;
17
- getWalletClient(): {
18
- account: import("viem").Account | undefined;
19
- batch?: {
20
- multicall?: boolean | {
21
- batchSize?: number | undefined;
22
- wait?: number | undefined;
23
- } | undefined;
24
- } | undefined;
25
- cacheTime: number;
26
- chain: import("viem").Chain | undefined;
27
- key: string;
28
- name: string;
29
- pollingInterval: number;
30
- request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
31
- transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
32
- type: string;
33
- uid: string;
34
- addChain: (args: import("viem").AddChainParameters) => Promise<void>;
35
- deployContract: <const TAbi extends import("viem").Abi | readonly unknown[], TChainOverride extends import("viem").Chain | undefined>(args: import("viem").DeployContractParameters<TAbi, import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride>) => Promise<`0x${string}`>;
36
- getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
37
- getChainId: () => Promise<number>;
38
- getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
39
- prepareTransactionRequest: <TChainOverride_1 extends import("viem").Chain | undefined>(args: import("viem").PrepareTransactionRequestParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_1>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
40
- requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
41
- requestPermissions: (args: {
42
- [x: string]: Record<string, any>;
43
- eth_accounts: Record<string, any>;
44
- }) => Promise<import("viem").RequestPermissionsReturnType>;
45
- sendRawTransaction: (args: import("viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
46
- sendTransaction: <TChainOverride_2 extends import("viem").Chain | undefined>(args: import("viem").SendTransactionParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_2>) => Promise<`0x${string}`>;
47
- signMessage: (args: import("viem").SignMessageParameters<import("viem").Account | undefined>) => Promise<`0x${string}`>;
48
- signTransaction: <TChainOverride_3 extends import("viem").Chain | undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_3>) => Promise<`0x${string}`>;
49
- signTypedData: <const TTypedData extends {
50
- [x: string]: readonly import("viem").TypedDataParameter[];
51
- [x: `string[${string}]`]: undefined;
52
- [x: `function[${string}]`]: undefined;
53
- [x: `address[${string}]`]: undefined;
54
- [x: `bool[${string}]`]: undefined;
55
- [x: `bytes[${string}]`]: undefined;
56
- [x: `bytes16[${string}]`]: undefined;
57
- [x: `bytes1[${string}]`]: undefined;
58
- [x: `bytes2[${string}]`]: undefined;
59
- [x: `bytes3[${string}]`]: undefined;
60
- [x: `bytes4[${string}]`]: undefined;
61
- [x: `bytes5[${string}]`]: undefined;
62
- [x: `bytes6[${string}]`]: undefined;
63
- [x: `bytes7[${string}]`]: undefined;
64
- [x: `bytes8[${string}]`]: undefined;
65
- [x: `bytes9[${string}]`]: undefined;
66
- [x: `bytes10[${string}]`]: undefined;
67
- [x: `bytes11[${string}]`]: undefined;
68
- [x: `bytes12[${string}]`]: undefined;
69
- [x: `bytes13[${string}]`]: undefined;
70
- [x: `bytes14[${string}]`]: undefined;
71
- [x: `bytes15[${string}]`]: undefined;
72
- [x: `bytes17[${string}]`]: undefined;
73
- [x: `bytes18[${string}]`]: undefined;
74
- [x: `bytes19[${string}]`]: undefined;
75
- [x: `bytes20[${string}]`]: undefined;
76
- [x: `bytes21[${string}]`]: undefined;
77
- [x: `bytes22[${string}]`]: undefined;
78
- [x: `bytes23[${string}]`]: undefined;
79
- [x: `bytes24[${string}]`]: undefined;
80
- [x: `bytes25[${string}]`]: undefined;
81
- [x: `bytes26[${string}]`]: undefined;
82
- [x: `bytes27[${string}]`]: undefined;
83
- [x: `bytes28[${string}]`]: undefined;
84
- [x: `bytes29[${string}]`]: undefined;
85
- [x: `bytes30[${string}]`]: undefined;
86
- [x: `bytes31[${string}]`]: undefined;
87
- [x: `bytes32[${string}]`]: undefined;
88
- [x: `int[${string}]`]: undefined;
89
- [x: `int16[${string}]`]: undefined;
90
- [x: `int8[${string}]`]: undefined;
91
- [x: `int24[${string}]`]: undefined;
92
- [x: `int32[${string}]`]: undefined;
93
- [x: `int40[${string}]`]: undefined;
94
- [x: `int48[${string}]`]: undefined;
95
- [x: `int56[${string}]`]: undefined;
96
- [x: `int64[${string}]`]: undefined;
97
- [x: `int72[${string}]`]: undefined;
98
- [x: `int80[${string}]`]: undefined;
99
- [x: `int88[${string}]`]: undefined;
100
- [x: `int96[${string}]`]: undefined;
101
- [x: `int104[${string}]`]: undefined;
102
- [x: `int112[${string}]`]: undefined;
103
- [x: `int120[${string}]`]: undefined;
104
- [x: `int128[${string}]`]: undefined;
105
- [x: `int136[${string}]`]: undefined;
106
- [x: `int144[${string}]`]: undefined;
107
- [x: `int152[${string}]`]: undefined;
108
- [x: `int160[${string}]`]: undefined;
109
- [x: `int168[${string}]`]: undefined;
110
- [x: `int176[${string}]`]: undefined;
111
- [x: `int184[${string}]`]: undefined;
112
- [x: `int192[${string}]`]: undefined;
113
- [x: `int200[${string}]`]: undefined;
114
- [x: `int208[${string}]`]: undefined;
115
- [x: `int216[${string}]`]: undefined;
116
- [x: `int224[${string}]`]: undefined;
117
- [x: `int232[${string}]`]: undefined;
118
- [x: `int240[${string}]`]: undefined;
119
- [x: `int248[${string}]`]: undefined;
120
- [x: `int256[${string}]`]: undefined;
121
- [x: `uint[${string}]`]: undefined;
122
- [x: `uint16[${string}]`]: undefined;
123
- [x: `uint8[${string}]`]: undefined;
124
- [x: `uint24[${string}]`]: undefined;
125
- [x: `uint32[${string}]`]: undefined;
126
- [x: `uint40[${string}]`]: undefined;
127
- [x: `uint48[${string}]`]: undefined;
128
- [x: `uint56[${string}]`]: undefined;
129
- [x: `uint64[${string}]`]: undefined;
130
- [x: `uint72[${string}]`]: undefined;
131
- [x: `uint80[${string}]`]: undefined;
132
- [x: `uint88[${string}]`]: undefined;
133
- [x: `uint96[${string}]`]: undefined;
134
- [x: `uint104[${string}]`]: undefined;
135
- [x: `uint112[${string}]`]: undefined;
136
- [x: `uint120[${string}]`]: undefined;
137
- [x: `uint128[${string}]`]: undefined;
138
- [x: `uint136[${string}]`]: undefined;
139
- [x: `uint144[${string}]`]: undefined;
140
- [x: `uint152[${string}]`]: undefined;
141
- [x: `uint160[${string}]`]: undefined;
142
- [x: `uint168[${string}]`]: undefined;
143
- [x: `uint176[${string}]`]: undefined;
144
- [x: `uint184[${string}]`]: undefined;
145
- [x: `uint192[${string}]`]: undefined;
146
- [x: `uint200[${string}]`]: undefined;
147
- [x: `uint208[${string}]`]: undefined;
148
- [x: `uint216[${string}]`]: undefined;
149
- [x: `uint224[${string}]`]: undefined;
150
- [x: `uint232[${string}]`]: undefined;
151
- [x: `uint240[${string}]`]: undefined;
152
- [x: `uint248[${string}]`]: undefined;
153
- [x: `uint256[${string}]`]: undefined;
154
- string?: undefined;
155
- address?: undefined;
156
- bool?: undefined;
157
- bytes?: undefined;
158
- bytes16?: undefined;
159
- bytes1?: undefined;
160
- bytes2?: undefined;
161
- bytes3?: undefined;
162
- bytes4?: undefined;
163
- bytes5?: undefined;
164
- bytes6?: undefined;
165
- bytes7?: undefined;
166
- bytes8?: undefined;
167
- bytes9?: undefined;
168
- bytes10?: undefined;
169
- bytes11?: undefined;
170
- bytes12?: undefined;
171
- bytes13?: undefined;
172
- bytes14?: undefined;
173
- bytes15?: undefined;
174
- bytes17?: undefined;
175
- bytes18?: undefined;
176
- bytes19?: undefined;
177
- bytes20?: undefined;
178
- bytes21?: undefined;
179
- bytes22?: undefined;
180
- bytes23?: undefined;
181
- bytes24?: undefined;
182
- bytes25?: undefined;
183
- bytes26?: undefined;
184
- bytes27?: undefined;
185
- bytes28?: undefined;
186
- bytes29?: undefined;
187
- bytes30?: undefined;
188
- bytes31?: undefined;
189
- bytes32?: undefined;
190
- int16?: undefined;
191
- int8?: undefined;
192
- int24?: undefined;
193
- int32?: undefined;
194
- int40?: undefined;
195
- int48?: undefined;
196
- int56?: undefined;
197
- int64?: undefined;
198
- int72?: undefined;
199
- int80?: undefined;
200
- int88?: undefined;
201
- int96?: undefined;
202
- int104?: undefined;
203
- int112?: undefined;
204
- int120?: undefined;
205
- int128?: undefined;
206
- int136?: undefined;
207
- int144?: undefined;
208
- int152?: undefined;
209
- int160?: undefined;
210
- int168?: undefined;
211
- int176?: undefined;
212
- int184?: undefined;
213
- int192?: undefined;
214
- int200?: undefined;
215
- int208?: undefined;
216
- int216?: undefined;
217
- int224?: undefined;
218
- int232?: undefined;
219
- int240?: undefined;
220
- int248?: undefined;
221
- int256?: undefined;
222
- uint16?: undefined;
223
- uint8?: undefined;
224
- uint24?: undefined;
225
- uint32?: undefined;
226
- uint40?: undefined;
227
- uint48?: undefined;
228
- uint56?: undefined;
229
- uint64?: undefined;
230
- uint72?: undefined;
231
- uint80?: undefined;
232
- uint88?: undefined;
233
- uint96?: undefined;
234
- uint104?: undefined;
235
- uint112?: undefined;
236
- uint120?: undefined;
237
- uint128?: undefined;
238
- uint136?: undefined;
239
- uint144?: undefined;
240
- uint152?: undefined;
241
- uint160?: undefined;
242
- uint168?: undefined;
243
- uint176?: undefined;
244
- uint184?: undefined;
245
- uint192?: undefined;
246
- uint200?: undefined;
247
- uint208?: undefined;
248
- uint216?: undefined;
249
- uint224?: undefined;
250
- uint232?: undefined;
251
- uint240?: undefined;
252
- uint248?: undefined;
253
- uint256?: undefined;
254
- } | {
255
- [key: string]: unknown;
256
- }, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, import("viem").Account | undefined>) => Promise<`0x${string}`>;
257
- switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
258
- watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
259
- writeContract: <const TAbi_1 extends import("viem").Abi | readonly unknown[], TFunctionName extends string, TChainOverride_4 extends import("viem").Chain | undefined>(args: import("viem").WriteContractParameters<TAbi_1, TFunctionName, import("viem").Chain | undefined, import("viem").Account | undefined, TChainOverride_4>) => Promise<`0x${string}`>;
260
- extend: <const client extends {
261
- [x: string]: unknown;
262
- account?: undefined;
263
- batch?: undefined;
264
- cacheTime?: undefined;
265
- chain?: undefined;
266
- key?: undefined;
267
- name?: undefined;
268
- pollingInterval?: undefined;
269
- request?: undefined;
270
- transport?: undefined;
271
- type?: undefined;
272
- uid?: undefined;
273
- }>(fn: (client: import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<import("viem").Chain | undefined, import("viem").Account | undefined>>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem").Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<import("viem").Chain | undefined, import("viem").Account | undefined>>;
274
- } | undefined;
17
+ getWalletClient(): WalletClient | undefined;
275
18
  isInstalledOnBrowser(): boolean;
276
19
  fetchPublicAddress(): Promise<string | undefined>;
277
20
  connect(): Promise<void>;
@@ -17,7 +17,7 @@ class InjectedWalletBase extends EthWalletConnector {
17
17
  if (!this.wallet) {
18
18
  this.wallet = getWalletBookWallet(this.walletBook, this.key);
19
19
  }
20
- if (!this.ethProviderHelper) {
20
+ if (this.wallet && !this.ethProviderHelper) {
21
21
  this.ethProviderHelper = new EthProviderHelper(this.wallet);
22
22
  }
23
23
  return this.ethProviderHelper;
@@ -41,18 +41,24 @@ class InjectedWalletBase extends EthWalletConnector {
41
41
  const provider = this.getWalletClient();
42
42
  if (!provider)
43
43
  return;
44
- const { tearDownEventListeners } = this.getEthProviderHelper()._setupEventListeners(this, createPublicClient({ transport: custom(provider) }));
44
+ const ethProviderHelper = this.getEthProviderHelper();
45
+ if (!ethProviderHelper)
46
+ return;
47
+ const { tearDownEventListeners } = ethProviderHelper._setupEventListeners(this, createPublicClient({ transport: custom(provider) }));
45
48
  this.teardownEventListeners = tearDownEventListeners;
46
49
  }
47
50
  getWalletClient() {
48
- return this.getEthProviderHelper().findWalletClient();
51
+ var _a;
52
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findWalletClient();
49
53
  }
50
54
  isInstalledOnBrowser() {
51
- return this.getEthProviderHelper().findProvider() !== undefined;
55
+ var _a;
56
+ return ((_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.findProvider()) !== undefined;
52
57
  }
53
58
  fetchPublicAddress() {
59
+ var _a;
54
60
  return __awaiter(this, void 0, void 0, function* () {
55
- return this.getEthProviderHelper().fetchPublicAddress();
61
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress();
56
62
  });
57
63
  }
58
64
  connect() {
@@ -61,8 +67,9 @@ class InjectedWalletBase extends EthWalletConnector {
61
67
  });
62
68
  }
63
69
  signMessage(messageToSign) {
70
+ var _a;
64
71
  return __awaiter(this, void 0, void 0, function* () {
65
- return this.getEthProviderHelper().signMessage(messageToSign);
72
+ return (_a = this.getEthProviderHelper()) === null || _a === void 0 ? void 0 : _a.signMessage(messageToSign);
66
73
  });
67
74
  }
68
75
  proveOwnership(messageToSign) {