@reown/appkit 1.3.2 → 1.4.1
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/dist/esm/exports/adapters.js +2 -0
- package/dist/esm/exports/adapters.js.map +1 -0
- package/dist/esm/exports/constants.js +1 -1
- package/dist/esm/package.json +9 -1
- package/dist/esm/src/adapters/ChainAdapterBlueprint.js +138 -0
- package/dist/esm/src/adapters/ChainAdapterBlueprint.js.map +1 -0
- package/dist/esm/src/adapters/ChainAdapterConnector.js +2 -0
- package/dist/esm/src/adapters/ChainAdapterConnector.js.map +1 -0
- package/dist/esm/src/adapters/index.js +2 -0
- package/dist/esm/src/adapters/index.js.map +1 -0
- package/dist/esm/src/client.js +886 -40
- package/dist/esm/src/client.js.map +1 -1
- package/dist/esm/src/store/ProviderUtil.js.map +1 -1
- package/dist/esm/src/universal-adapter/client.js +98 -532
- package/dist/esm/src/universal-adapter/client.js.map +1 -1
- package/dist/esm/src/universal-adapter/index.js +1 -1
- package/dist/esm/src/universal-adapter/index.js.map +1 -1
- package/dist/esm/src/utils/HelpersUtil.js +6 -0
- package/dist/esm/src/utils/HelpersUtil.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/exports/adapters.d.ts +1 -0
- package/dist/types/exports/constants.d.ts +1 -1
- package/dist/types/src/adapters/ChainAdapterBlueprint.d.ts +324 -0
- package/dist/types/src/adapters/ChainAdapterConnector.d.ts +5 -0
- package/dist/types/src/adapters/index.d.ts +1 -0
- package/dist/types/src/client.d.ts +49 -10
- package/dist/types/src/library/react/index.d.ts +1 -1
- package/dist/types/src/library/vue/index.d.ts +1 -1
- package/dist/types/src/store/ProviderUtil.d.ts +5 -4
- package/dist/types/src/store/index.d.ts +1 -1
- package/dist/types/src/universal-adapter/client.d.ts +32 -44
- package/dist/types/src/universal-adapter/index.d.ts +1 -1
- package/dist/types/src/utils/HelpersUtil.d.ts +1 -0
- package/package.json +17 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../src/adapters/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "1.
|
|
1
|
+
export declare const PACKAGE_VERSION = "1.4.1";
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { type CaipAddress, type CaipNetwork, type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { ChainAdapterConnector } from './ChainAdapterConnector.js';
|
|
3
|
+
import { type Connector as AppKitConnector, type Tokens } from '@reown/appkit-core';
|
|
4
|
+
import type UniversalProvider from '@walletconnect/universal-provider';
|
|
5
|
+
import type { W3mFrameProvider } from '@reown/appkit-wallet';
|
|
6
|
+
import type { AppKitOptions } from '../utils/index.js';
|
|
7
|
+
import type { AppKit } from '../client.js';
|
|
8
|
+
type EventName = 'disconnect' | 'accountChanged' | 'switchNetwork';
|
|
9
|
+
type EventData = {
|
|
10
|
+
disconnect: () => void;
|
|
11
|
+
accountChanged: {
|
|
12
|
+
address: string;
|
|
13
|
+
chainId?: number | string;
|
|
14
|
+
};
|
|
15
|
+
switchNetwork: {
|
|
16
|
+
address?: string;
|
|
17
|
+
chainId: number | string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type EventCallback<T extends EventName> = (data: EventData[T]) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Abstract class representing a chain adapter blueprint.
|
|
23
|
+
* @template Connector - The type of connector extending ChainAdapterConnector
|
|
24
|
+
*/
|
|
25
|
+
export declare abstract class AdapterBlueprint<Connector extends ChainAdapterConnector = ChainAdapterConnector> {
|
|
26
|
+
namespace: ChainNamespace | undefined;
|
|
27
|
+
caipNetworks?: CaipNetwork[];
|
|
28
|
+
projectId?: string;
|
|
29
|
+
protected availableConnectors: Connector[];
|
|
30
|
+
protected connector?: Connector;
|
|
31
|
+
protected provider?: Connector['provider'];
|
|
32
|
+
private eventListeners;
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of AdapterBlueprint.
|
|
35
|
+
* @param {AdapterBlueprint.Params} params - The parameters for initializing the adapter
|
|
36
|
+
*/
|
|
37
|
+
constructor(params?: AdapterBlueprint.Params);
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the adapter with the given parameters.
|
|
40
|
+
* @param {AdapterBlueprint.Params} params - The parameters for initializing the adapter
|
|
41
|
+
*/
|
|
42
|
+
construct(params: AdapterBlueprint.Params): void;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the available connectors.
|
|
45
|
+
* @returns {Connector[]} An array of available connectors
|
|
46
|
+
*/
|
|
47
|
+
get connectors(): Connector[];
|
|
48
|
+
/**
|
|
49
|
+
* Gets the supported networks.
|
|
50
|
+
* @returns {CaipNetwork[]} An array of supported networks
|
|
51
|
+
*/
|
|
52
|
+
get networks(): CaipNetwork[];
|
|
53
|
+
/**
|
|
54
|
+
* Sets the universal provider for WalletConnect.
|
|
55
|
+
* @param {UniversalProvider} universalProvider - The universal provider instance
|
|
56
|
+
*/
|
|
57
|
+
setUniversalProvider(universalProvider: UniversalProvider): void;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the auth provider.
|
|
60
|
+
* @param {W3mFrameProvider} authProvider - The auth provider instance
|
|
61
|
+
*/
|
|
62
|
+
setAuthProvider(authProvider: W3mFrameProvider): void;
|
|
63
|
+
/**
|
|
64
|
+
* Adds one or more connectors to the available connectors list.
|
|
65
|
+
* @param {...Connector} connectors - The connectors to add
|
|
66
|
+
*/
|
|
67
|
+
protected addConnector(...connectors: Connector[]): void;
|
|
68
|
+
/**
|
|
69
|
+
* Adds an event listener for a specific event.
|
|
70
|
+
* @template T
|
|
71
|
+
* @param {T} eventName - The name of the event
|
|
72
|
+
* @param {EventCallback<T>} callback - The callback function to be called when the event is emitted
|
|
73
|
+
*/
|
|
74
|
+
on<T extends EventName>(eventName: T, callback: EventCallback<T>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Removes an event listener for a specific event.
|
|
77
|
+
* @template T
|
|
78
|
+
* @param {T} eventName - The name of the event
|
|
79
|
+
* @param {EventCallback<T>} callback - The callback function to be removed
|
|
80
|
+
*/
|
|
81
|
+
off<T extends EventName>(eventName: T, callback: EventCallback<T>): void;
|
|
82
|
+
/**
|
|
83
|
+
* Emits an event with the given name and optional data.
|
|
84
|
+
* @template T
|
|
85
|
+
* @param {T} eventName - The name of the event to emit
|
|
86
|
+
* @param {EventData[T]} [data] - The optional data to be passed to the event listeners
|
|
87
|
+
*/
|
|
88
|
+
protected emit<T extends EventName>(eventName: T, data?: EventData[T]): void;
|
|
89
|
+
/**
|
|
90
|
+
* Connects to WalletConnect.
|
|
91
|
+
* @param {(uri: string) => void} onUri - Callback function to handle the WalletConnect URI
|
|
92
|
+
* @param {number | string} [chainId] - Optional chain ID to connect to
|
|
93
|
+
*/
|
|
94
|
+
abstract connectWalletConnect(onUri: (uri: string) => void, chainId?: number | string): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Connects to a wallet.
|
|
97
|
+
* @param {AdapterBlueprint.ConnectParams} params - Connection parameters
|
|
98
|
+
* @returns {Promise<AdapterBlueprint.ConnectResult>} Connection result
|
|
99
|
+
*/
|
|
100
|
+
abstract connect(params: AdapterBlueprint.ConnectParams): Promise<AdapterBlueprint.ConnectResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Switches the network.
|
|
103
|
+
* @param {AdapterBlueprint.SwitchNetworkParams} params - Network switching parameters
|
|
104
|
+
*/
|
|
105
|
+
abstract switchNetwork(params: AdapterBlueprint.SwitchNetworkParams): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Disconnects the current wallet.
|
|
108
|
+
*/
|
|
109
|
+
abstract disconnect(params?: AdapterBlueprint.DisconnectParams): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the balance for a given address and chain ID.
|
|
112
|
+
* @param {AdapterBlueprint.GetBalanceParams} params - Balance retrieval parameters
|
|
113
|
+
* @returns {Promise<AdapterBlueprint.GetBalanceResult>} Balance result
|
|
114
|
+
*/
|
|
115
|
+
abstract getBalance(params: AdapterBlueprint.GetBalanceParams): Promise<AdapterBlueprint.GetBalanceResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Gets the profile for a given address and chain ID.
|
|
118
|
+
* @param {AdapterBlueprint.GetProfileParams} params - Profile retrieval parameters
|
|
119
|
+
* @returns {Promise<AdapterBlueprint.GetProfileResult>} Profile result
|
|
120
|
+
*/
|
|
121
|
+
abstract getProfile(params: AdapterBlueprint.GetProfileParams): Promise<AdapterBlueprint.GetProfileResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Synchronizes the connectors with the given options and AppKit instance.
|
|
124
|
+
* @param {AppKitOptions} [options] - Optional AppKit options
|
|
125
|
+
* @param {AppKit} [appKit] - Optional AppKit instance
|
|
126
|
+
*/
|
|
127
|
+
abstract syncConnectors(options?: AppKitOptions, appKit?: AppKit): void;
|
|
128
|
+
/**
|
|
129
|
+
* Synchronizes the connection with the given parameters.
|
|
130
|
+
* @param {AdapterBlueprint.SyncConnectionParams} params - Synchronization parameters
|
|
131
|
+
* @returns {Promise<AdapterBlueprint.ConnectResult>} Connection result
|
|
132
|
+
*/
|
|
133
|
+
abstract syncConnection(params: AdapterBlueprint.SyncConnectionParams): Promise<AdapterBlueprint.ConnectResult>;
|
|
134
|
+
/**
|
|
135
|
+
* Signs a message with the connected wallet.
|
|
136
|
+
* @param {AdapterBlueprint.SignMessageParams} params - Parameters including message to sign, address, and optional provider
|
|
137
|
+
* @returns {Promise<AdapterBlueprint.SignMessageResult>} Object containing the signature
|
|
138
|
+
*/
|
|
139
|
+
abstract signMessage(params: AdapterBlueprint.SignMessageParams): Promise<AdapterBlueprint.SignMessageResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Estimates gas for a transaction.
|
|
142
|
+
* @param {AdapterBlueprint.EstimateGasTransactionArgs} params - Parameters including address, to, data, and optional provider
|
|
143
|
+
* @returns {Promise<AdapterBlueprint.EstimateGasTransactionResult>} Object containing the gas estimate
|
|
144
|
+
*/
|
|
145
|
+
abstract estimateGas(params: AdapterBlueprint.EstimateGasTransactionArgs): Promise<AdapterBlueprint.EstimateGasTransactionResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Sends a transaction.
|
|
148
|
+
* @param {AdapterBlueprint.SendTransactionParams} params - Parameters including address, to, data, value, gasPrice, gas, and optional provider
|
|
149
|
+
* @returns {Promise<AdapterBlueprint.SendTransactionResult>} Object containing the transaction hash
|
|
150
|
+
*/
|
|
151
|
+
abstract sendTransaction(params: AdapterBlueprint.SendTransactionParams): Promise<AdapterBlueprint.SendTransactionResult>;
|
|
152
|
+
/**
|
|
153
|
+
* Writes a contract transaction.
|
|
154
|
+
* @param {AdapterBlueprint.WriteContractParams} params - Parameters including receiver address, token amount, token address, from address, method, and ABI
|
|
155
|
+
* @returns {Promise<AdapterBlueprint.WriteContractResult>} Object containing the transaction hash
|
|
156
|
+
*/
|
|
157
|
+
abstract writeContract(params: AdapterBlueprint.WriteContractParams): Promise<AdapterBlueprint.WriteContractResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Gets the ENS address for a given name.
|
|
160
|
+
* @param {AdapterBlueprint.GetEnsAddressParams} params - Parameters including name
|
|
161
|
+
* @returns {Promise<AdapterBlueprint.GetEnsAddressResult>} Object containing the ENS address
|
|
162
|
+
*/
|
|
163
|
+
abstract getEnsAddress(params: AdapterBlueprint.GetEnsAddressParams): Promise<AdapterBlueprint.GetEnsAddressResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Parses a decimal string value into a bigint with the specified number of decimals.
|
|
166
|
+
* @param {AdapterBlueprint.ParseUnitsParams} params - Parameters including value and decimals
|
|
167
|
+
* @returns {AdapterBlueprint.ParseUnitsResult} The parsed bigint value
|
|
168
|
+
*/
|
|
169
|
+
abstract parseUnits(params: AdapterBlueprint.ParseUnitsParams): AdapterBlueprint.ParseUnitsResult;
|
|
170
|
+
/**
|
|
171
|
+
* Formats a bigint value into a decimal string with the specified number of decimals.
|
|
172
|
+
* @param {AdapterBlueprint.FormatUnitsParams} params - Parameters including value and decimals
|
|
173
|
+
* @returns {AdapterBlueprint.FormatUnitsResult} The formatted decimal string
|
|
174
|
+
*/
|
|
175
|
+
abstract formatUnits(params: AdapterBlueprint.FormatUnitsParams): AdapterBlueprint.FormatUnitsResult;
|
|
176
|
+
/**
|
|
177
|
+
* Gets the WalletConnect provider.
|
|
178
|
+
* @param {AdapterBlueprint.GetWalletConnectProviderParams} params - Parameters including provider, caip networks, and active caip network
|
|
179
|
+
* @returns {AdapterBlueprint.GetWalletConnectProviderResult} The WalletConnect provider
|
|
180
|
+
*/
|
|
181
|
+
abstract getWalletConnectProvider(params: AdapterBlueprint.GetWalletConnectProviderParams): AdapterBlueprint.GetWalletConnectProviderResult;
|
|
182
|
+
/**
|
|
183
|
+
* Reconnects to a wallet.
|
|
184
|
+
* @param {AdapterBlueprint.ReconnectParams} params - Reconnection parameters
|
|
185
|
+
*/
|
|
186
|
+
reconnect?(params: AdapterBlueprint.ReconnectParams): Promise<void>;
|
|
187
|
+
abstract getCapabilities(params: AdapterBlueprint.GetCapabilitiesParams): Promise<unknown>;
|
|
188
|
+
abstract grantPermissions(params: AdapterBlueprint.GrantPermissionsParams): Promise<unknown>;
|
|
189
|
+
abstract revokePermissions(params: AdapterBlueprint.RevokePermissionsParams): Promise<`0x${string}`>;
|
|
190
|
+
}
|
|
191
|
+
export declare namespace AdapterBlueprint {
|
|
192
|
+
type Params = {
|
|
193
|
+
namespace?: ChainNamespace;
|
|
194
|
+
networks?: CaipNetwork[];
|
|
195
|
+
projectId?: string;
|
|
196
|
+
};
|
|
197
|
+
type SwitchNetworkParams = {
|
|
198
|
+
caipNetwork: CaipNetwork;
|
|
199
|
+
provider?: AppKitConnector['provider'];
|
|
200
|
+
providerType?: AppKitConnector['type'];
|
|
201
|
+
};
|
|
202
|
+
type GetBalanceParams = {
|
|
203
|
+
address: string;
|
|
204
|
+
chainId: number | string;
|
|
205
|
+
caipNetwork?: CaipNetwork;
|
|
206
|
+
tokens?: Tokens;
|
|
207
|
+
};
|
|
208
|
+
type GetProfileParams = {
|
|
209
|
+
address: string;
|
|
210
|
+
chainId: number | string;
|
|
211
|
+
};
|
|
212
|
+
type DisconnectParams = {
|
|
213
|
+
provider?: AppKitConnector['provider'];
|
|
214
|
+
providerType?: AppKitConnector['type'];
|
|
215
|
+
};
|
|
216
|
+
type ConnectParams = {
|
|
217
|
+
id: string;
|
|
218
|
+
provider?: unknown;
|
|
219
|
+
info?: unknown;
|
|
220
|
+
type: string;
|
|
221
|
+
chain?: ChainNamespace;
|
|
222
|
+
chainId?: number | string;
|
|
223
|
+
rpcUrl?: string;
|
|
224
|
+
};
|
|
225
|
+
type ReconnectParams = ConnectParams;
|
|
226
|
+
type SyncConnectionParams = {
|
|
227
|
+
id: string;
|
|
228
|
+
namespace: ChainNamespace;
|
|
229
|
+
chainId?: number | string;
|
|
230
|
+
rpcUrl: string;
|
|
231
|
+
};
|
|
232
|
+
type SignMessageParams = {
|
|
233
|
+
message: string;
|
|
234
|
+
address: string;
|
|
235
|
+
provider?: AppKitConnector['provider'];
|
|
236
|
+
};
|
|
237
|
+
type SignMessageResult = {
|
|
238
|
+
signature: string;
|
|
239
|
+
};
|
|
240
|
+
type EstimateGasTransactionArgs = {
|
|
241
|
+
address: string;
|
|
242
|
+
to: string;
|
|
243
|
+
data: string;
|
|
244
|
+
caipNetwork: CaipNetwork;
|
|
245
|
+
provider?: AppKitConnector['provider'];
|
|
246
|
+
};
|
|
247
|
+
type EstimateGasTransactionResult = {
|
|
248
|
+
gas: bigint;
|
|
249
|
+
};
|
|
250
|
+
type WriteContractParams = {
|
|
251
|
+
receiverAddress: string;
|
|
252
|
+
tokenAmount: bigint;
|
|
253
|
+
tokenAddress: string;
|
|
254
|
+
fromAddress: string;
|
|
255
|
+
method: 'send' | 'transfer' | 'call';
|
|
256
|
+
abi: any;
|
|
257
|
+
caipNetwork: CaipNetwork;
|
|
258
|
+
provider?: AppKitConnector['provider'];
|
|
259
|
+
caipAddress: CaipAddress;
|
|
260
|
+
};
|
|
261
|
+
type WriteContractResult = {
|
|
262
|
+
hash: string;
|
|
263
|
+
};
|
|
264
|
+
type ParseUnitsParams = {
|
|
265
|
+
value: string;
|
|
266
|
+
decimals: number;
|
|
267
|
+
};
|
|
268
|
+
type ParseUnitsResult = bigint;
|
|
269
|
+
type FormatUnitsParams = {
|
|
270
|
+
value: bigint;
|
|
271
|
+
decimals: number;
|
|
272
|
+
};
|
|
273
|
+
type FormatUnitsResult = string;
|
|
274
|
+
type GetWalletConnectProviderParams = {
|
|
275
|
+
provider: AppKitConnector['provider'];
|
|
276
|
+
caipNetworks: CaipNetwork[];
|
|
277
|
+
activeCaipNetwork: CaipNetwork;
|
|
278
|
+
};
|
|
279
|
+
type GetWalletConnectProviderResult = AppKitConnector['provider'];
|
|
280
|
+
type GetCapabilitiesParams = string;
|
|
281
|
+
type GrantPermissionsParams = object | readonly unknown[];
|
|
282
|
+
type RevokePermissionsParams = {
|
|
283
|
+
pci: string;
|
|
284
|
+
permissions: unknown[];
|
|
285
|
+
expiry: number;
|
|
286
|
+
address: `0x${string}`;
|
|
287
|
+
};
|
|
288
|
+
type SendTransactionParams = {
|
|
289
|
+
address: `0x${string}`;
|
|
290
|
+
to: string;
|
|
291
|
+
data: string;
|
|
292
|
+
value: bigint | number;
|
|
293
|
+
gasPrice: bigint | number;
|
|
294
|
+
gas?: bigint | number;
|
|
295
|
+
caipNetwork?: CaipNetwork;
|
|
296
|
+
provider?: AppKitConnector['provider'];
|
|
297
|
+
};
|
|
298
|
+
type SendTransactionResult = {
|
|
299
|
+
hash: string;
|
|
300
|
+
};
|
|
301
|
+
type GetEnsAddressParams = {
|
|
302
|
+
name: string;
|
|
303
|
+
caipNetwork: CaipNetwork;
|
|
304
|
+
};
|
|
305
|
+
type GetEnsAddressResult = {
|
|
306
|
+
address: string | false;
|
|
307
|
+
};
|
|
308
|
+
type GetBalanceResult = {
|
|
309
|
+
balance: string;
|
|
310
|
+
symbol: string;
|
|
311
|
+
};
|
|
312
|
+
type GetProfileResult = {
|
|
313
|
+
profileImage?: string;
|
|
314
|
+
profileName?: string;
|
|
315
|
+
};
|
|
316
|
+
type ConnectResult = {
|
|
317
|
+
id: AppKitConnector['id'];
|
|
318
|
+
type: AppKitConnector['type'];
|
|
319
|
+
provider: AppKitConnector['provider'];
|
|
320
|
+
chainId: number | string;
|
|
321
|
+
address: string;
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdapterBlueprint } from './ChainAdapterBlueprint.js';
|
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EventsControllerState, type PublicStateControllerState, type ThemeControllerState, type ModalControllerState, type ConnectedWalletInfo, type RouterControllerState, type ChainAdapter, type SdkVersion, type UseAppKitAccountReturn, type UseAppKitNetworkReturn, type ConnectorType, type Provider } from '@reown/appkit-core';
|
|
2
2
|
import { AccountController, BlockchainApiController, ConnectionController, ConnectorController, ChainController, EnsController, OptionsController, AssetUtil } from '@reown/appkit-core';
|
|
3
3
|
import { type CaipNetwork, type ChainNamespace } from '@reown/appkit-common';
|
|
4
4
|
import type { AppKitOptions } from './utils/TypesUtil.js';
|
|
5
|
-
import { UniversalAdapterClient } from './universal-adapter/client.js';
|
|
6
|
-
import type
|
|
5
|
+
import { UniversalAdapter as UniversalAdapterClient } from './universal-adapter/client.js';
|
|
6
|
+
import { type W3mFrameTypes } from '@reown/appkit-wallet';
|
|
7
7
|
import type { AppKitNetwork } from '@reown/appkit/networks';
|
|
8
|
+
import type { AdapterBlueprint } from './adapters/ChainAdapterBlueprint.js';
|
|
9
|
+
import UniversalProvider from '@walletconnect/universal-provider';
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
ethereum?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
export { AccountController };
|
|
9
16
|
export interface OpenOptions {
|
|
10
17
|
view: 'Account' | 'Connect' | 'Networks' | 'ApproveTransaction' | 'OnRampProviders';
|
|
11
18
|
}
|
|
19
|
+
type Adapters = Record<ChainNamespace, AdapterBlueprint>;
|
|
12
20
|
export declare class AppKit {
|
|
13
21
|
private static instance?;
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
activeAdapter?: AdapterBlueprint;
|
|
23
|
+
options: AppKitOptions;
|
|
16
24
|
adapters?: ChainAdapter[];
|
|
25
|
+
activeChainNamespace?: ChainNamespace;
|
|
26
|
+
chainNamespaces: ChainNamespace[];
|
|
27
|
+
chainAdapters?: Adapters;
|
|
17
28
|
universalAdapter?: UniversalAdapterClient;
|
|
29
|
+
private universalProvider?;
|
|
30
|
+
private connectionControllerClient?;
|
|
31
|
+
private networkControllerClient?;
|
|
32
|
+
private universalProviderInitPromise?;
|
|
33
|
+
private authProvider?;
|
|
18
34
|
private initPromise?;
|
|
19
|
-
|
|
35
|
+
version?: SdkVersion;
|
|
36
|
+
adapter?: ChainAdapter;
|
|
37
|
+
private caipNetworks?;
|
|
20
38
|
private defaultCaipNetwork?;
|
|
21
39
|
constructor(options: AppKitOptions & {
|
|
22
40
|
adapters?: ChainAdapter[];
|
|
@@ -24,6 +42,7 @@ export declare class AppKit {
|
|
|
24
42
|
sdkVersion: SdkVersion;
|
|
25
43
|
});
|
|
26
44
|
static getInstance(): AppKit | undefined;
|
|
45
|
+
private initialize;
|
|
27
46
|
open(options?: OpenOptions): Promise<void>;
|
|
28
47
|
close(): Promise<void>;
|
|
29
48
|
setLoading(loading: ModalControllerState['loading']): void;
|
|
@@ -31,7 +50,7 @@ export declare class AppKit {
|
|
|
31
50
|
getChainId(): string | number | undefined;
|
|
32
51
|
switchNetwork(appKitNetwork: AppKitNetwork): void;
|
|
33
52
|
getWalletProvider(): unknown;
|
|
34
|
-
getWalletProviderType():
|
|
53
|
+
getWalletProviderType(): ConnectorType | null | undefined;
|
|
35
54
|
subscribeProvider(): null;
|
|
36
55
|
getThemeMode(): import("@reown/appkit-core").ThemeMode;
|
|
37
56
|
getThemeVariables(): import("@reown/appkit-core").ThemeVariables;
|
|
@@ -65,8 +84,9 @@ export declare class AppKit {
|
|
|
65
84
|
addAddressLabel: (typeof AccountController)['addAddressLabel'];
|
|
66
85
|
removeAddressLabel: (typeof AccountController)['removeAddressLabel'];
|
|
67
86
|
getCaipAddress: (chainNamespace?: ChainNamespace) => `eip155:${string}:${string}` | `eip155:${number}:${string}` | `solana:${string}:${string}` | `solana:${number}:${string}` | `polkadot:${string}:${string}` | `polkadot:${number}:${string}` | undefined;
|
|
87
|
+
getAddressByChainNamespace: (chainNamespace: ChainNamespace) => string | undefined;
|
|
68
88
|
getAddress: (chainNamespace?: ChainNamespace) => string | undefined;
|
|
69
|
-
getProvider: () =>
|
|
89
|
+
getProvider: () => Provider | UniversalProvider | import("@reown/appkit-core").CombinedProvider | undefined;
|
|
70
90
|
getPreferredAccountType: () => W3mFrameTypes.AccountType;
|
|
71
91
|
setCaipAddress: (typeof AccountController)['setCaipAddress'];
|
|
72
92
|
setProvider: (typeof AccountController)['setProvider'];
|
|
@@ -94,7 +114,6 @@ export declare class AppKit {
|
|
|
94
114
|
setSmartAccountEnabledNetworks: (typeof ChainController)['setSmartAccountEnabledNetworks'];
|
|
95
115
|
setPreferredAccountType: (typeof AccountController)['setPreferredAccountType'];
|
|
96
116
|
getReownName: (typeof EnsController)['getNamesForAddress'];
|
|
97
|
-
resolveReownName: (name: string) => Promise<string | false>;
|
|
98
117
|
setEIP6963Enabled: (typeof OptionsController)['setEIP6963Enabled'];
|
|
99
118
|
setClientId: (typeof BlockchainApiController)['setClientId'];
|
|
100
119
|
getConnectorImage: (typeof AssetUtil)['getConnectorImage'];
|
|
@@ -103,8 +122,28 @@ export declare class AppKit {
|
|
|
103
122
|
private getDefaultMetaData;
|
|
104
123
|
private extendCaipNetworks;
|
|
105
124
|
private extendDefaultCaipNetwork;
|
|
125
|
+
private createClients;
|
|
126
|
+
private handleDisconnect;
|
|
127
|
+
private listenAuthConnector;
|
|
128
|
+
private listenWalletConnect;
|
|
129
|
+
private listenAdapter;
|
|
130
|
+
private getChainsFromNamespaces;
|
|
131
|
+
private syncWalletConnectAccount;
|
|
132
|
+
private syncWalletConnectAccounts;
|
|
133
|
+
private syncProvider;
|
|
134
|
+
private syncAccount;
|
|
135
|
+
private syncConnectedWalletInfo;
|
|
136
|
+
private syncIdentity;
|
|
137
|
+
private syncReownName;
|
|
138
|
+
private syncRequestedNetworks;
|
|
139
|
+
private syncExistingConnection;
|
|
140
|
+
private getAdapter;
|
|
141
|
+
private createUniversalProvider;
|
|
106
142
|
private initializeUniversalAdapter;
|
|
107
|
-
|
|
143
|
+
getUniversalProvider(): Promise<UniversalProvider | undefined>;
|
|
144
|
+
private createAuthProvider;
|
|
145
|
+
private createAdapters;
|
|
146
|
+
private initChainAdapters;
|
|
108
147
|
private setDefaultNetwork;
|
|
109
148
|
private initOrContinue;
|
|
110
149
|
}
|
|
@@ -25,7 +25,7 @@ export declare function getAppKit(appKit: AppKit): void;
|
|
|
25
25
|
export * from '@reown/appkit-core/react';
|
|
26
26
|
export declare function useAppKitProvider<T>(chainNamespace: ChainNamespace): {
|
|
27
27
|
walletProvider: T;
|
|
28
|
-
walletProviderType: import("
|
|
28
|
+
walletProviderType: import("@reown/appkit-core").ConnectorType | undefined;
|
|
29
29
|
};
|
|
30
30
|
export declare function useAppKitTheme(): {
|
|
31
31
|
themeMode: "dark" | "light";
|
|
@@ -28,7 +28,7 @@ export declare function getAppKit(appKit: AppKit): void;
|
|
|
28
28
|
export * from '@reown/appkit-core/vue';
|
|
29
29
|
export declare function useAppKitProvider<T>(chainNamespace: ChainNamespace): {
|
|
30
30
|
walletProvider: T | undefined;
|
|
31
|
-
walletProviderType: import("
|
|
31
|
+
walletProviderType: import("@reown/appkit-core").ConnectorType | undefined;
|
|
32
32
|
};
|
|
33
33
|
export declare function useAppKitTheme(): {
|
|
34
34
|
setThemeMode: (themeMode: ThemeModeOptions) => void;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type UniversalProvider from '@walletconnect/universal-provider';
|
|
2
2
|
import type { ChainNamespace } from '@reown/appkit-common';
|
|
3
|
+
import type { ConnectorType } from '@reown/appkit-core';
|
|
3
4
|
export interface ProviderStoreUtilState {
|
|
4
5
|
providers: Record<ChainNamespace, UniversalProvider | unknown | undefined>;
|
|
5
|
-
providerIds: Record<ChainNamespace,
|
|
6
|
+
providerIds: Record<ChainNamespace, ConnectorType | undefined>;
|
|
6
7
|
}
|
|
7
|
-
export type
|
|
8
|
+
export type ProviderType = 'walletConnect' | 'injected' | 'coinbaseWallet' | 'eip6963' | 'ID_AUTH' | 'coinbaseWalletSDK';
|
|
8
9
|
export declare const ProviderUtil: {
|
|
9
10
|
state: ProviderStoreUtilState;
|
|
10
11
|
subscribeKey<K extends keyof ProviderStoreUtilState>(key: K, callback: (value: ProviderStoreUtilState[K]) => void): () => void;
|
|
11
12
|
subscribeProviders(callback: (providers: ProviderStoreUtilState['providers']) => void): () => void;
|
|
12
13
|
setProvider<T = UniversalProvider>(chainNamespace: ChainNamespace, provider: T): void;
|
|
13
14
|
getProvider<T_1 = UniversalProvider>(chainNamespace: ChainNamespace): T_1 | undefined;
|
|
14
|
-
setProviderId(chainNamespace: ChainNamespace, providerId:
|
|
15
|
-
getProviderId(chainNamespace: ChainNamespace):
|
|
15
|
+
setProviderId(chainNamespace: ChainNamespace, providerId: ConnectorType): void;
|
|
16
|
+
getProviderId(chainNamespace: ChainNamespace): ConnectorType | undefined;
|
|
16
17
|
reset(): void;
|
|
17
18
|
resetChain(chainNamespace: ChainNamespace): void;
|
|
18
19
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ProviderUtil } from './ProviderUtil.js';
|
|
2
|
-
export type { ProviderStoreUtilState,
|
|
2
|
+
export type { ProviderStoreUtilState, ProviderType } from './ProviderUtil.js';
|
|
@@ -1,46 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type Metadata = {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
url: string;
|
|
10
|
-
icons: string[];
|
|
11
|
-
};
|
|
12
|
-
export declare class UniversalAdapterClient {
|
|
13
|
-
private walletConnectProviderInitPromise?;
|
|
14
|
-
private appKit;
|
|
15
|
-
caipNetworks: [CaipNetwork, ...CaipNetwork[]];
|
|
16
|
-
walletConnectProvider?: UniversalProvider;
|
|
17
|
-
metadata?: Metadata;
|
|
18
|
-
isUniversalAdapterClient: boolean;
|
|
19
|
-
chainNamespace: ChainNamespace;
|
|
20
|
-
networkControllerClient: NetworkControllerClient;
|
|
21
|
-
connectionControllerClient: ConnectionControllerClient;
|
|
22
|
-
options: AppKitOptions | undefined;
|
|
23
|
-
adapterType: AdapterType;
|
|
24
|
-
reportedAlertErrors: Record<string, boolean>;
|
|
25
|
-
constructor(options: AppKitOptionsWithCaipNetworks);
|
|
26
|
-
construct(appkit: AppKit, options: AppKitOptionsWithCaipNetworks): void;
|
|
27
|
-
switchNetwork(caipNetwork: CaipNetwork): void;
|
|
1
|
+
import type UniversalProvider from '@walletconnect/universal-provider';
|
|
2
|
+
import { AdapterBlueprint } from '../adapters/ChainAdapterBlueprint.js';
|
|
3
|
+
export declare class UniversalAdapter extends AdapterBlueprint {
|
|
4
|
+
connectWalletConnect(onUri: (uri: string) => void): Promise<void>;
|
|
5
|
+
connect(params: AdapterBlueprint.ConnectParams): Promise<AdapterBlueprint.ConnectResult>;
|
|
28
6
|
disconnect(): Promise<void>;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
7
|
+
syncConnectors(): Promise<void>;
|
|
8
|
+
getBalance(): Promise<AdapterBlueprint.GetBalanceResult>;
|
|
9
|
+
signMessage(params: AdapterBlueprint.SignMessageParams): Promise<AdapterBlueprint.SignMessageResult>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* These methods are supported only on `wagmi` and `ethers` since the Solana SDK does not support them in the same way.
|
|
13
|
+
* These function definition is to have a type parity between the clients. Currently not in use.
|
|
14
|
+
*/
|
|
15
|
+
estimateGas(): Promise<AdapterBlueprint.EstimateGasTransactionResult>;
|
|
16
|
+
getProfile(): Promise<AdapterBlueprint.GetProfileResult>;
|
|
17
|
+
sendTransaction(): Promise<AdapterBlueprint.SendTransactionResult>;
|
|
18
|
+
writeContract(): Promise<AdapterBlueprint.WriteContractResult>;
|
|
19
|
+
getEnsAddress(): Promise<AdapterBlueprint.GetEnsAddressResult>;
|
|
20
|
+
parseUnits(): AdapterBlueprint.ParseUnitsResult;
|
|
21
|
+
formatUnits(): AdapterBlueprint.FormatUnitsResult;
|
|
22
|
+
getCapabilities(): Promise<unknown>;
|
|
23
|
+
grantPermissions(): Promise<unknown>;
|
|
24
|
+
revokePermissions(): Promise<`0x${string}`>;
|
|
25
|
+
syncConnection(): Promise<{
|
|
26
|
+
id: string;
|
|
27
|
+
type: "WALLET_CONNECT";
|
|
28
|
+
chainId: number;
|
|
29
|
+
provider: UniversalProvider;
|
|
30
|
+
address: string;
|
|
31
|
+
}>;
|
|
32
|
+
switchNetwork(params: AdapterBlueprint.SwitchNetworkParams): Promise<void>;
|
|
33
|
+
getWalletConnectProvider(): UniversalProvider;
|
|
45
34
|
}
|
|
46
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { UniversalAdapter } from './client.js';
|
|
@@ -4,5 +4,6 @@ import type { SessionTypes } from '@walletconnect/types';
|
|
|
4
4
|
export declare const WcHelpersUtil: {
|
|
5
5
|
getMethodsByChainNamespace(chainNamespace: ChainNamespace): string[];
|
|
6
6
|
createNamespaces(caipNetworks: CaipNetwork[]): NamespaceConfig;
|
|
7
|
+
resolveReownName: (name: string) => Promise<string | false>;
|
|
7
8
|
getChainsFromNamespaces(namespaces?: SessionTypes.Namespaces): CaipNetworkId[];
|
|
8
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/exports/index.js",
|
|
6
6
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
"types": "./dist/types/exports/auth-provider.d.ts",
|
|
54
54
|
"import": "./dist/esm/exports/auth-provider.js",
|
|
55
55
|
"default": "./dist/esm/exports/auth-provider.js"
|
|
56
|
+
},
|
|
57
|
+
"./adapters": {
|
|
58
|
+
"types": "./dist/types/exports/adapters.d.ts",
|
|
59
|
+
"import": "./dist/esm/exports/adapters.js",
|
|
60
|
+
"default": "./dist/esm/exports/adapters.js"
|
|
56
61
|
}
|
|
57
62
|
},
|
|
58
63
|
"typesVersions": {
|
|
@@ -77,6 +82,9 @@
|
|
|
77
82
|
],
|
|
78
83
|
"auth-provider": [
|
|
79
84
|
"./dist/types/exports/auth-provider.d.ts"
|
|
85
|
+
],
|
|
86
|
+
"adapters": [
|
|
87
|
+
"./dist/types/exports/adapters.d.ts"
|
|
80
88
|
]
|
|
81
89
|
}
|
|
82
90
|
},
|
|
@@ -87,14 +95,14 @@
|
|
|
87
95
|
"bs58": "6.0.0",
|
|
88
96
|
"valtio": "1.11.2",
|
|
89
97
|
"viem": "2.x",
|
|
90
|
-
"@reown/appkit-common": "1.
|
|
91
|
-
"@reown/appkit-core": "1.
|
|
92
|
-
"@reown/appkit-polyfills": "1.
|
|
93
|
-
"@reown/appkit-scaffold-ui": "1.
|
|
94
|
-
"@reown/appkit-siwe": "1.
|
|
95
|
-
"@reown/appkit-ui": "1.
|
|
96
|
-
"@reown/appkit-utils": "1.
|
|
97
|
-
"@reown/appkit-wallet": "1.
|
|
98
|
+
"@reown/appkit-common": "1.4.1",
|
|
99
|
+
"@reown/appkit-core": "1.4.1",
|
|
100
|
+
"@reown/appkit-polyfills": "1.4.1",
|
|
101
|
+
"@reown/appkit-scaffold-ui": "1.4.1",
|
|
102
|
+
"@reown/appkit-siwe": "1.4.1",
|
|
103
|
+
"@reown/appkit-ui": "1.4.1",
|
|
104
|
+
"@reown/appkit-utils": "1.4.1",
|
|
105
|
+
"@reown/appkit-wallet": "1.4.1"
|
|
98
106
|
},
|
|
99
107
|
"devDependencies": {
|
|
100
108
|
"@types/react": "18.3.1",
|