@rango-dev/wallets-react 0.27.1-next.12 → 0.27.1-next.14

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.
@@ -11,6 +11,11 @@ import type {
11
11
  import type { BlockchainMeta, SignerFactory } from 'rango-types';
12
12
  import type { PropsWithChildren } from 'react';
13
13
 
14
+ import { LegacyEvents as Events } from '@rango-dev/wallets-core/legacy';
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ type InstanceType = any;
18
+
14
19
  export type State = {
15
20
  [key: string]: WalletState | undefined;
16
21
  };
@@ -18,10 +23,10 @@ export type State = {
18
23
  export type ConnectResult = {
19
24
  accounts: string[] | null;
20
25
  network: Network | null;
21
- provider: any;
26
+ provider: InstanceType;
22
27
  };
23
28
 
24
- export type Providers = { [type in WalletType]?: any };
29
+ export type Providers = { [type in WalletType]?: InstanceType };
25
30
 
26
31
  export type ExtendedWalletInfo = WalletInfo & {
27
32
  properties?: ProviderInfo['properties'];
@@ -34,6 +39,7 @@ export type ProviderContext = {
34
39
  namespaces?: LegacyNamespaceInputForConnect[]
35
40
  ): Promise<ConnectResult[]>;
36
41
  disconnect(type: WalletType): Promise<void>;
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
43
  disconnectAll(): Promise<PromiseSettledResult<any>[]>;
38
44
  state(type: WalletType): WalletState;
39
45
  canSwitchNetworkTo(type: WalletType, network: Network): boolean;
@@ -60,14 +66,7 @@ export type ProviderProps = PropsWithChildren<{
60
66
  };
61
67
  }>;
62
68
 
63
- export enum Events {
64
- CONNECTED = 'connected',
65
- CONNECTING = 'connecting',
66
- REACHABLE = 'reachable',
67
- INSTALLED = 'installed',
68
- ACCOUNTS = 'accounts',
69
- NETWORK = 'network',
70
- }
69
+ export { Events };
71
70
 
72
71
  export type ProviderConnectResult = {
73
72
  accounts: string[];
@@ -76,7 +75,7 @@ export type ProviderConnectResult = {
76
75
 
77
76
  export type GetInstanceOptions = {
78
77
  network?: Network;
79
- currentProvider: any;
78
+ currentProvider: InstanceType;
80
79
  meta: BlockchainMeta[];
81
80
  getState: () => WalletState;
82
81
  /**
@@ -90,26 +89,28 @@ export type GetInstanceOptions = {
90
89
  };
91
90
 
92
91
  export type GetInstance =
93
- | (() => any)
94
- | ((options: GetInstanceOptions) => Promise<any>);
92
+ | (() => InstanceType)
93
+ | ((options: GetInstanceOptions) => Promise<InstanceType>);
95
94
  export type TryGetInstance =
96
- | (() => any)
97
- | ((options: Pick<GetInstanceOptions, 'force' | 'network'>) => Promise<any>);
95
+ | (() => InstanceType)
96
+ | ((
97
+ options: Pick<GetInstanceOptions, 'force' | 'network'>
98
+ ) => Promise<InstanceType>);
98
99
  export type Connect = (options: {
99
- instance: any;
100
+ instance: InstanceType;
100
101
  network?: Network;
101
102
  meta: BlockchainMeta[];
102
103
  }) => Promise<ProviderConnectResult | ProviderConnectResult[]>;
103
104
 
104
105
  export type Disconnect = (options: {
105
- instance: any;
106
+ instance: InstanceType;
106
107
  destroyInstance: () => void;
107
108
  }) => Promise<void>;
108
109
 
109
110
  type CleanupSubscribe = () => void;
110
111
 
111
112
  export type Subscribe = (options: {
112
- instance: any;
113
+ instance: InstanceType;
113
114
  state: WalletState;
114
115
  meta: BlockchainMeta[];
115
116
  updateChainId: (chainId: string) => void;
@@ -119,7 +120,7 @@ export type Subscribe = (options: {
119
120
  }) => CleanupSubscribe | void;
120
121
 
121
122
  export type SwitchNetwork = (options: {
122
- instance: any;
123
+ instance: InstanceType;
123
124
  network: Network;
124
125
  meta: BlockchainMeta[];
125
126
  newInstance?: TryGetInstance;
@@ -128,7 +129,7 @@ export type SwitchNetwork = (options: {
128
129
  }) => Promise<void>;
129
130
 
130
131
  export type Suggest = (options: {
131
- instance: any;
132
+ instance: InstanceType;
132
133
  network: Network;
133
134
  meta: BlockchainMeta[];
134
135
  }) => Promise<void>;
@@ -136,17 +137,17 @@ export type Suggest = (options: {
136
137
  export type CanSwitchNetwork = (options: {
137
138
  network: Network;
138
139
  meta: BlockchainMeta[];
139
- provider: any;
140
+ provider: InstanceType;
140
141
  }) => boolean;
141
142
 
142
143
  export type CanEagerConnect = (options: {
143
- instance: any;
144
+ instance: InstanceType;
144
145
  meta: BlockchainMeta[];
145
146
  }) => Promise<boolean>;
146
147
 
147
148
  export interface WalletActions {
148
149
  connect: Connect;
149
- getInstance: any;
150
+ getInstance: InstanceType;
150
151
  disconnect?: Disconnect;
151
152
  subscribe?: Subscribe;
152
153
  // unsubscribe, // coupled to subscribe.
@@ -154,7 +155,7 @@ export interface WalletActions {
154
155
  // Optional, but should be provided at the same time.
155
156
  suggest?: Suggest;
156
157
  switchNetwork?: SwitchNetwork;
157
- getSigners: (provider: any) => Promise<SignerFactory>;
158
+ getSigners: (provider: InstanceType) => Promise<SignerFactory>;
158
159
  canSwitchNetworkTo?: CanSwitchNetwork;
159
160
  canEagerConnect?: CanEagerConnect;
160
161
  getWalletInfo(allBlockChains: BlockchainMeta[]): WalletInfo;