@wagmi/connectors 0.3.21 → 0.3.23

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.
@@ -1,64 +1 @@
1
- import { CoinbaseWalletProvider } from '@coinbase/wallet-sdk';
2
- import { CoinbaseWalletSDKOptions } from '@coinbase/wallet-sdk/dist/CoinbaseWalletSDK';
3
- import { Chain } from '@wagmi/core/chains';
4
- import { providers } from 'ethers';
5
- import { C as Connector } from './base-84a689bb.js';
6
- import '@wagmi/core';
7
- import 'eventemitter3';
8
-
9
- type Options = Omit<CoinbaseWalletSDKOptions, 'reloadOnDisconnect'> & {
10
- /**
11
- * Fallback Ethereum JSON RPC URL
12
- * @default ""
13
- */
14
- jsonRpcUrl?: string;
15
- /**
16
- * Fallback Ethereum Chain ID
17
- * @default 1
18
- */
19
- chainId?: number;
20
- /**
21
- * Whether or not to reload dapp automatically after disconnect.
22
- */
23
- reloadOnDisconnect?: boolean;
24
- };
25
- declare class CoinbaseWalletConnector extends Connector<CoinbaseWalletProvider, Options, providers.JsonRpcSigner> {
26
- #private;
27
- readonly id = "coinbaseWallet";
28
- readonly name = "Coinbase Wallet";
29
- readonly ready = true;
30
- constructor({ chains, options }: {
31
- chains?: Chain[];
32
- options: Options;
33
- });
34
- connect({ chainId }?: {
35
- chainId?: number;
36
- }): Promise<{
37
- account: `0x${string}`;
38
- chain: {
39
- id: number;
40
- unsupported: boolean;
41
- };
42
- provider: providers.Web3Provider;
43
- }>;
44
- disconnect(): Promise<void>;
45
- getAccount(): Promise<`0x${string}`>;
46
- getChainId(): Promise<number>;
47
- getProvider(): Promise<CoinbaseWalletProvider>;
48
- getSigner({ chainId }?: {
49
- chainId?: number;
50
- }): Promise<providers.JsonRpcSigner>;
51
- isAuthorized(): Promise<boolean>;
52
- switchChain(chainId: number): Promise<Chain>;
53
- watchAsset({ address, decimals, image, symbol, }: {
54
- address: string;
55
- decimals?: number;
56
- image?: string;
57
- symbol: string;
58
- }): Promise<boolean>;
59
- protected onAccountsChanged: (accounts: string[]) => void;
60
- protected onChainChanged: (chainId: number | string) => void;
61
- protected onDisconnect: () => void;
62
- }
63
-
64
- export { CoinbaseWalletConnector };
1
+ export * from '../src/coinbaseWallet'
package/dist/index.d.ts CHANGED
@@ -1,6 +1 @@
1
- export { C as Connector, a as ConnectorData, b as ConnectorEvents } from './base-84a689bb.js';
2
- export { E as Ethereum } from './types-82d07ee0.js';
3
- import '@wagmi/core';
4
- import '@wagmi/core/chains';
5
- import 'eventemitter3';
6
- import 'abitype';
1
+ export * from '../src/index'
@@ -1,68 +1 @@
1
- import { Address } from '@wagmi/core';
2
- import { Chain } from '@wagmi/core/chains';
3
- import { providers } from 'ethers';
4
- import { C as Connector } from './base-84a689bb.js';
5
- import { E as Ethereum } from './types-82d07ee0.js';
6
- import 'eventemitter3';
7
- import 'abitype';
8
-
9
- type InjectedConnectorOptions = {
10
- /** Name of connector */
11
- name?: string | ((detectedName: string | string[]) => string);
12
- /**
13
- * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target
14
- *
15
- * @default
16
- * () => typeof window !== 'undefined' ? window.ethereum : undefined
17
- */
18
- getProvider?: () => Ethereum | undefined;
19
- /**
20
- * MetaMask and other injected providers do not support programmatic disconnect.
21
- * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info.
22
- * @default true
23
- */
24
- shimDisconnect?: boolean;
25
- };
26
- type ConnectorOptions = InjectedConnectorOptions & Required<Pick<InjectedConnectorOptions, 'getProvider'>>;
27
- declare class InjectedConnector extends Connector<Ethereum | undefined, ConnectorOptions, providers.JsonRpcSigner> {
28
- #private;
29
- readonly id: string;
30
- readonly name: string;
31
- readonly ready: boolean;
32
- protected shimDisconnectKey: string;
33
- constructor({ chains, options: options_, }?: {
34
- chains?: Chain[];
35
- options?: InjectedConnectorOptions;
36
- });
37
- connect({ chainId }?: {
38
- chainId?: number;
39
- }): Promise<{
40
- account: `0x${string}`;
41
- chain: {
42
- id: number;
43
- unsupported: boolean;
44
- };
45
- provider: Ethereum;
46
- }>;
47
- disconnect(): Promise<void>;
48
- getAccount(): Promise<`0x${string}`>;
49
- getChainId(): Promise<number>;
50
- getProvider(): Promise<Ethereum | undefined>;
51
- getSigner({ chainId }?: {
52
- chainId?: number;
53
- }): Promise<providers.JsonRpcSigner>;
54
- isAuthorized(): Promise<boolean>;
55
- switchChain(chainId: number): Promise<Chain>;
56
- watchAsset({ address, decimals, image, symbol, }: {
57
- address: Address;
58
- decimals?: number;
59
- image?: string;
60
- symbol: string;
61
- }): Promise<boolean>;
62
- protected onAccountsChanged: (accounts: string[]) => void;
63
- protected onChainChanged: (chainId: number | string) => void;
64
- protected onDisconnect: (error: Error) => Promise<void>;
65
- protected isUserRejectedRequestError(error: unknown): boolean;
66
- }
67
-
68
- export { InjectedConnector, InjectedConnectorOptions };
1
+ export * from '../src/injected'
package/dist/ledger.d.ts CHANGED
@@ -1,43 +1 @@
1
- import { EthereumProvider } from '@ledgerhq/connect-kit-loader';
2
- import { Chain } from '@wagmi/core';
3
- import { providers } from 'ethers';
4
- import { C as Connector, a as ConnectorData } from './base-84a689bb.js';
5
- import '@wagmi/core/chains';
6
- import 'eventemitter3';
7
-
8
- type LedgerConnectorOptions = {
9
- bridge?: string;
10
- chainId?: number;
11
- enableDebugLogs?: boolean;
12
- rpc?: {
13
- [chainId: number]: string;
14
- };
15
- };
16
- type LedgerSigner = providers.JsonRpcSigner;
17
- declare class LedgerConnector extends Connector<EthereumProvider, LedgerConnectorOptions, LedgerSigner> {
18
- #private;
19
- readonly id = "ledger";
20
- readonly name = "Ledger";
21
- readonly ready = true;
22
- constructor({ chains, options, }?: {
23
- chains?: Chain[];
24
- options?: LedgerConnectorOptions;
25
- });
26
- connect(): Promise<Required<ConnectorData>>;
27
- disconnect(): Promise<void>;
28
- getAccount(): Promise<`0x${string}`>;
29
- getChainId(): Promise<number>;
30
- getProvider({ chainId, create }?: {
31
- chainId?: number;
32
- create?: boolean;
33
- }): Promise<EthereumProvider>;
34
- getSigner({ chainId }?: {
35
- chainId?: number;
36
- }): Promise<providers.JsonRpcSigner>;
37
- isAuthorized(): Promise<boolean>;
38
- protected onAccountsChanged: (accounts: string[]) => void;
39
- protected onChainChanged: (chainId: number | string) => void;
40
- protected onDisconnect: () => void;
41
- }
42
-
43
- export { LedgerConnector };
1
+ export * from '../src/ledger'
@@ -1,36 +1 @@
1
- import { Chain } from '@wagmi/core/chains';
2
- import { InjectedConnectorOptions, InjectedConnector } from './injected.js';
3
- import { E as Ethereum } from './types-82d07ee0.js';
4
- import '@wagmi/core';
5
- import 'ethers';
6
- import './base-84a689bb.js';
7
- import 'eventemitter3';
8
- import 'abitype';
9
-
10
- type MetaMaskConnectorOptions = Pick<InjectedConnectorOptions, 'shimDisconnect'> & {
11
- /**
12
- * While "disconnected" with `shimDisconnect`, allows user to select a different MetaMask account (than the currently connected account) when trying to connect.
13
- */
14
- UNSTABLE_shimOnConnectSelectAccount?: boolean;
15
- };
16
- declare class MetaMaskConnector extends InjectedConnector {
17
- #private;
18
- readonly id = "metaMask";
19
- protected shimDisconnectKey: string;
20
- constructor({ chains, options: options_, }?: {
21
- chains?: Chain[];
22
- options?: MetaMaskConnectorOptions;
23
- });
24
- connect({ chainId }?: {
25
- chainId?: number;
26
- }): Promise<{
27
- account: `0x${string}`;
28
- chain: {
29
- id: number;
30
- unsupported: boolean;
31
- };
32
- provider: Ethereum;
33
- }>;
34
- }
35
-
36
- export { MetaMaskConnector, MetaMaskConnectorOptions };
1
+ export * from '../src/metaMask'
@@ -1,82 +1 @@
1
- import * as ethers from 'ethers';
2
- import { providers } from 'ethers';
3
- import { Chain } from '@wagmi/core/chains';
4
- import { C as Connector, a as ConnectorData } from '../base-84a689bb.js';
5
- import { Signer } from '@wagmi/core';
6
- import EventEmitter from 'eventemitter3';
7
-
8
- type MockProviderOptions = {
9
- chainId: number;
10
- flags?: {
11
- isAuthorized?: boolean;
12
- failConnect?: boolean;
13
- failSwitchChain?: boolean;
14
- noSwitchChain?: boolean;
15
- };
16
- signer: Signer;
17
- };
18
- type Events = {
19
- accountsChanged(accounts: string[]): void;
20
- chainChanged(chainId: number | string): void;
21
- disconnect(): void;
22
- };
23
- type Event = keyof Events;
24
- declare class MockProvider extends providers.BaseProvider {
25
- #private;
26
- events: EventEmitter<Events, any>;
27
- constructor(options: MockProviderOptions);
28
- enable(): Promise<string[]>;
29
- disconnect(): Promise<void>;
30
- getAccounts(): Promise<`0x${string}`[]>;
31
- getSigner(): ethers.Signer;
32
- switchChain(chainId: number): Promise<void>;
33
- switchSigner(signer: Signer): Promise<void>;
34
- watchAsset(_asset: {
35
- address: string;
36
- decimals?: number;
37
- image?: string;
38
- symbol: string;
39
- }): Promise<boolean>;
40
- on(event: Event, listener: providers.Listener): this;
41
- once(event: Event, listener: providers.Listener): this;
42
- removeListener(event: Event, listener: providers.Listener): this;
43
- off(event: Event, listener: providers.Listener): this;
44
- toJSON(): string;
45
- }
46
-
47
- type MockConnectorOptions = Omit<MockProviderOptions, 'chainId'> & {
48
- chainId?: number;
49
- };
50
- declare class MockConnector extends Connector<MockProvider, MockConnectorOptions> {
51
- #private;
52
- readonly id = "mock";
53
- readonly name = "Mock";
54
- readonly ready = true;
55
- constructor({ chains, options, }: {
56
- chains?: Chain[];
57
- options: MockConnectorOptions;
58
- });
59
- connect({ chainId }?: {
60
- chainId?: number;
61
- }): Promise<Required<ConnectorData<any>>>;
62
- disconnect(): Promise<void>;
63
- getAccount(): Promise<`0x${string}`>;
64
- getChainId(): Promise<number>;
65
- getProvider({ chainId }?: {
66
- chainId?: number;
67
- }): Promise<MockProvider>;
68
- getSigner(): Promise<ethers.Signer>;
69
- isAuthorized(): Promise<boolean>;
70
- watchAsset(asset: {
71
- address: string;
72
- decimals?: number;
73
- image?: string;
74
- symbol: string;
75
- }): Promise<boolean>;
76
- protected onAccountsChanged: (accounts: string[]) => void;
77
- protected onChainChanged: (chainId: number | string) => void;
78
- protected onDisconnect: () => void;
79
- toJSON(): string;
80
- }
81
-
82
- export { MockConnector, MockProvider, MockProviderOptions };
1
+ export * from '../../src/mock/index'
package/dist/safe.d.ts CHANGED
@@ -1,53 +1 @@
1
- import { SafeAppProvider } from '@safe-global/safe-apps-provider';
2
- import { Opts } from '@safe-global/safe-apps-sdk';
3
- import { Chain } from '@wagmi/core';
4
- import { providers } from 'ethers';
5
- import { C as Connector } from './base-84a689bb.js';
6
- import '@wagmi/core/chains';
7
- import 'eventemitter3';
8
-
9
- type SafeConnectorProvider = SafeAppProvider;
10
- type SafeConnectorOptions = Opts & {
11
- /**
12
- * Connector automatically connects when used as Safe App.
13
- *
14
- * This flag simulates the disconnect behavior by keeping track of connection status in storage
15
- * and only autoconnecting when previously connected by user action (e.g. explicitly choosing to connect).
16
- *
17
- * @default false
18
- */
19
- shimDisconnect?: boolean;
20
- };
21
- /**
22
- * Connector for [Safe Wallet](https://safe.global)
23
- */
24
- declare class SafeConnector extends Connector<SafeConnectorProvider, SafeConnectorOptions> {
25
- #private;
26
- readonly id = "safe";
27
- readonly name = "Safe";
28
- ready: boolean;
29
- protected shimDisconnectKey: string;
30
- constructor({ chains, options: options_, }: {
31
- chains?: Chain[];
32
- options?: SafeConnectorOptions;
33
- });
34
- connect(): Promise<{
35
- account: `0x${string}`;
36
- provider: SafeAppProvider;
37
- chain: {
38
- id: number;
39
- unsupported: boolean;
40
- };
41
- }>;
42
- disconnect(): Promise<void>;
43
- getAccount(): Promise<`0x${string}`>;
44
- getChainId(): Promise<number>;
45
- getProvider(): Promise<SafeAppProvider>;
46
- getSigner(): Promise<providers.JsonRpcSigner>;
47
- isAuthorized(): Promise<boolean>;
48
- protected onAccountsChanged(_accounts: string[]): void;
49
- protected onChainChanged(_chainId: string | number): void;
50
- protected onDisconnect(): void;
51
- }
52
-
53
- export { SafeConnector, SafeConnectorOptions, SafeConnectorProvider };
1
+ export * from '../src/safe'
@@ -1,107 +1 @@
1
- import { Chain } from '@wagmi/core';
2
- import WalletConnectProvider from '@walletconnect/ethereum-provider';
3
- import { EthereumProviderOptions } from '@walletconnect/ethereum-provider/dist/types/EthereumProvider';
4
- import { providers } from 'ethers';
5
- import { C as Connector } from './base-84a689bb.js';
6
- import '@wagmi/core/chains';
7
- import 'eventemitter3';
8
-
9
- type WalletConnectOptions = {
10
- /**
11
- * WalletConnect Cloud Project ID.
12
- * @link https://cloud.walletconnect.com/sign-in.
13
- */
14
- projectId: EthereumProviderOptions['projectId'];
15
- /**
16
- * If a new chain is added to a previously existing configured connector `chains`, this flag
17
- * will determine if that chain should be considered as stale. A stale chain is a chain that
18
- * WalletConnect has yet to establish a relationship with (ie. the user has not approved or
19
- * rejected the chain).
20
- *
21
- * Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires
22
- * the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when
23
- * a user tries to switch to a chain that they have not approved.
24
- *
25
- * This flag mainly affects the behavior when a wallet does not support dynamic chain authorization
26
- * with WalletConnect v2.
27
- *
28
- * If `true` (default), the new chain will be treated as a stale chain. If the user
29
- * has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect
30
- * session, the connector will disconnect upon the dapp auto-connecting, and the user will have to
31
- * reconnect to the dapp (revalidate the chain) in order to approve the newly added chain.
32
- * This is the default behavior to avoid an unexpected error upon switching chains which may
33
- * be a confusing user experience (ie. the user will not know they have to reconnect
34
- * unless the dapp handles these types of errors).
35
- *
36
- * If `false`, the new chain will be treated as a validated chain. This means that if the user
37
- * has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully
38
- * auto-connect the user. This comes with the trade-off that the connector will throw an error
39
- * when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly
40
- * modifies their configured chains, and they do not want to disconnect the user upon
41
- * auto-connecting. If the user decides to switch to the unapproved chain, it is important that the
42
- * dapp handles this error and prompts the user to reconnect to the dapp in order to approve
43
- * the newly added chain.
44
- *
45
- * @default true
46
- */
47
- isNewChainsStale?: boolean;
48
- /**
49
- * Metadata for your app.
50
- * @link https://docs.walletconnect.com/2.0/javascript/providers/ethereum#initialization
51
- */
52
- metadata?: EthereumProviderOptions['metadata'];
53
- /**
54
- * Whether or not to show the QR code modal.
55
- * @default true
56
- * @link https://docs.walletconnect.com/2.0/javascript/providers/ethereum#initialization
57
- */
58
- showQrModal?: EthereumProviderOptions['showQrModal'];
59
- /**
60
- * Options of QR code modal.
61
- * @link https://docs.walletconnect.com/2.0/web3modal/options
62
- */
63
- qrModalOptions?: EthereumProviderOptions['qrModalOptions'];
64
- };
65
- type WalletConnectSigner = providers.JsonRpcSigner;
66
- type ConnectConfig = {
67
- /** Target chain to connect to. */
68
- chainId?: number;
69
- /** If provided, will attempt to connect to an existing pairing. */
70
- pairingTopic?: string;
71
- };
72
- declare class WalletConnectConnector extends Connector<WalletConnectProvider, WalletConnectOptions, WalletConnectSigner> {
73
- #private;
74
- readonly id = "walletConnect";
75
- readonly name = "WalletConnect";
76
- readonly ready = true;
77
- constructor(config: {
78
- chains?: Chain[];
79
- options: WalletConnectOptions;
80
- });
81
- connect({ chainId, pairingTopic }?: ConnectConfig): Promise<{
82
- account: `0x${string}`;
83
- chain: {
84
- id: number;
85
- unsupported: boolean;
86
- };
87
- provider: providers.Web3Provider;
88
- }>;
89
- disconnect(): Promise<void>;
90
- getAccount(): Promise<`0x${string}`>;
91
- getChainId(): Promise<number>;
92
- getProvider({ chainId }?: {
93
- chainId?: number;
94
- }): Promise<WalletConnectProvider>;
95
- getSigner({ chainId }?: {
96
- chainId?: number;
97
- }): Promise<providers.JsonRpcSigner>;
98
- isAuthorized(): Promise<boolean>;
99
- switchChain(chainId: number): Promise<Chain>;
100
- protected onAccountsChanged: (accounts: string[]) => void;
101
- protected onChainChanged: (chainId: number | string) => void;
102
- protected onDisconnect: () => void;
103
- protected onDisplayUri: (uri: string) => void;
104
- protected onConnect: () => void;
105
- }
106
-
107
- export { WalletConnectConnector };
1
+ export * from '../src/walletConnect'
@@ -1,45 +1 @@
1
- import { Chain } from '@wagmi/core/chains';
2
- import WalletConnectProvider from '@walletconnect/legacy-provider';
3
- import { providers } from 'ethers';
4
- import { C as Connector } from './base-84a689bb.js';
5
- import '@wagmi/core';
6
- import 'eventemitter3';
7
-
8
- type WalletConnectOptions = ConstructorParameters<typeof WalletConnectProvider>[0];
9
- type WalletConnectSigner = providers.JsonRpcSigner;
10
- declare class WalletConnectLegacyConnector extends Connector<WalletConnectProvider, WalletConnectOptions, WalletConnectSigner> {
11
- #private;
12
- readonly id = "walletConnectLegacy";
13
- readonly name = "WalletConnectLegacy";
14
- readonly ready = true;
15
- constructor(config: {
16
- chains?: Chain[];
17
- options: WalletConnectOptions;
18
- });
19
- connect({ chainId }?: {
20
- chainId?: number;
21
- }): Promise<{
22
- account: `0x${string}`;
23
- chain: {
24
- id: number;
25
- unsupported: boolean;
26
- };
27
- provider: providers.Web3Provider;
28
- }>;
29
- disconnect(): Promise<void>;
30
- getAccount(): Promise<`0x${string}`>;
31
- getChainId(): Promise<number>;
32
- getProvider({ chainId, create, }?: {
33
- chainId?: number;
34
- create?: boolean;
35
- }): Promise<WalletConnectProvider>;
36
- getSigner({ chainId }?: {
37
- chainId?: number;
38
- }): Promise<providers.JsonRpcSigner>;
39
- isAuthorized(): Promise<boolean>;
40
- protected onAccountsChanged: (accounts: string[]) => void;
41
- protected onChainChanged: (chainId: number | string) => void;
42
- protected onDisconnect: () => void;
43
- }
44
-
45
- export { WalletConnectLegacyConnector };
1
+ export * from '../src/walletConnectLegacy'
package/package.json CHANGED
@@ -2,7 +2,11 @@
2
2
  "name": "@wagmi/connectors",
3
3
  "description": "A collection of connectors for wagmi",
4
4
  "license": "MIT",
5
- "version": "0.3.21",
5
+ "version": "0.3.23",
6
+ "scripts": {
7
+ "build": "tsup",
8
+ "dev": "DEV=true tsup"
9
+ },
6
10
  "peerDependencies": {
7
11
  "@wagmi/core": ">=0.9.x",
8
12
  "ethers": ">=5.5.1 <6",
@@ -19,11 +23,11 @@
19
23
  "dependencies": {
20
24
  "@coinbase/wallet-sdk": "^3.6.6",
21
25
  "@ledgerhq/connect-kit-loader": "^1.0.1",
22
- "@walletconnect/ethereum-provider": "2.8.1",
23
- "@walletconnect/legacy-provider": "^2.0.0",
24
- "@walletconnect/modal": "^2.4.6",
25
26
  "@safe-global/safe-apps-provider": "^0.15.2",
26
27
  "@safe-global/safe-apps-sdk": "^7.9.0",
28
+ "@walletconnect/ethereum-provider": "2.9.0",
29
+ "@walletconnect/legacy-provider": "^2.0.0",
30
+ "@walletconnect/modal": "^2.5.9",
27
31
  "abitype": "^0.3.0",
28
32
  "eventemitter3": "^4.0.7"
29
33
  },
@@ -115,9 +119,5 @@
115
119
  "wallet",
116
120
  "web3",
117
121
  "abi"
118
- ],
119
- "scripts": {
120
- "build": "tsup",
121
- "dev": "DEV=true tsup"
122
- }
123
- }
122
+ ]
123
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022–PRESENT weth, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,65 +0,0 @@
1
- import { Address } from '@wagmi/core';
2
- import { Chain } from '@wagmi/core/chains';
3
- import EventEmitter from 'eventemitter3';
4
-
5
- type ConnectorData<Provider = any> = {
6
- account?: Address;
7
- chain?: {
8
- id: number;
9
- unsupported: boolean;
10
- };
11
- provider?: Provider;
12
- };
13
- interface ConnectorEvents<Provider = any> {
14
- change(data: ConnectorData<Provider>): void;
15
- connect(data: ConnectorData<Provider>): void;
16
- message({ type, data }: {
17
- type: string;
18
- data?: unknown;
19
- }): void;
20
- disconnect(): void;
21
- error(error: Error): void;
22
- }
23
- declare abstract class Connector<Provider = any, Options = any, Signer = any> extends EventEmitter<ConnectorEvents<Provider>> {
24
- /** Unique connector id */
25
- abstract readonly id: string;
26
- /** Connector name */
27
- abstract readonly name: string;
28
- /** Chains connector supports */
29
- readonly chains: Chain[];
30
- /** Options to use with connector */
31
- readonly options: Options;
32
- /** Whether connector is usable */
33
- abstract readonly ready: boolean;
34
- constructor({ chains, options, }: {
35
- chains?: Chain[];
36
- options: Options;
37
- });
38
- abstract connect(config?: {
39
- chainId?: number;
40
- }): Promise<Required<ConnectorData>>;
41
- abstract disconnect(): Promise<void>;
42
- abstract getAccount(): Promise<Address>;
43
- abstract getChainId(): Promise<number>;
44
- abstract getProvider(config?: {
45
- chainId?: number;
46
- }): Promise<Provider>;
47
- abstract getSigner(config?: {
48
- chainId?: number;
49
- }): Promise<Signer>;
50
- abstract isAuthorized(): Promise<boolean>;
51
- switchChain?(chainId: number): Promise<Chain>;
52
- watchAsset?(asset: {
53
- address: string;
54
- decimals?: number;
55
- image?: string;
56
- symbol: string;
57
- }): Promise<boolean>;
58
- protected abstract onAccountsChanged(accounts: Address[]): void;
59
- protected abstract onChainChanged(chain: number | string): void;
60
- protected abstract onDisconnect(error: Error): void;
61
- protected getBlockExplorerUrls(chain: Chain): string[] | undefined;
62
- protected isChainUnsupported(chainId: number): boolean;
63
- }
64
-
65
- export { Connector as C, ConnectorData as a, ConnectorEvents as b };