@reown/appkit-core-react-native 0.0.0-feat-onramp-20250718200617 → 0.0.0-feat-coinbase-20250722173213
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/lib/commonjs/controllers/AccountController.js +20 -17
- package/lib/commonjs/controllers/AccountController.js.map +1 -1
- package/lib/commonjs/controllers/ApiController.js +28 -16
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +166 -67
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionController.js +8 -11
- package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionsController.js +387 -0
- package/lib/commonjs/controllers/ConnectionsController.js.map +1 -0
- package/lib/commonjs/controllers/EnsController.js +4 -4
- package/lib/commonjs/controllers/EnsController.js.map +1 -1
- package/lib/commonjs/controllers/EventsController.js +4 -4
- package/lib/commonjs/controllers/EventsController.js.map +1 -1
- package/lib/commonjs/controllers/ModalController.js +6 -7
- package/lib/commonjs/controllers/ModalController.js.map +1 -1
- package/lib/commonjs/controllers/OnRampController.js +22 -70
- package/lib/commonjs/controllers/OnRampController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +11 -3
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js +1 -22
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/SendController.js +101 -101
- package/lib/commonjs/controllers/SendController.js.map +1 -1
- package/lib/commonjs/controllers/SnackController.js +29 -5
- package/lib/commonjs/controllers/SnackController.js.map +1 -1
- package/lib/commonjs/controllers/SwapController.js +151 -150
- package/lib/commonjs/controllers/SwapController.js.map +1 -1
- package/lib/commonjs/controllers/ThemeController.js +9 -1
- package/lib/commonjs/controllers/ThemeController.js.map +1 -1
- package/lib/commonjs/controllers/TransactionsController.js +25 -21
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/commonjs/index.js +3 -24
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/AssetUtil.js +3 -15
- package/lib/commonjs/utils/AssetUtil.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +538 -9
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +12 -6
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/FetchUtil.js +9 -28
- package/lib/commonjs/utils/FetchUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js +51 -42
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapApiUtil.js +15 -21
- package/lib/commonjs/utils/SwapApiUtil.js.map +1 -1
- package/lib/module/controllers/AccountController.js +20 -17
- package/lib/module/controllers/AccountController.js.map +1 -1
- package/lib/module/controllers/ApiController.js +27 -16
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +166 -67
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionController.js +8 -11
- package/lib/module/controllers/ConnectionController.js.map +1 -1
- package/lib/module/controllers/ConnectionsController.js +382 -0
- package/lib/module/controllers/ConnectionsController.js.map +1 -0
- package/lib/module/controllers/EnsController.js +2 -2
- package/lib/module/controllers/EnsController.js.map +1 -1
- package/lib/module/controllers/EventsController.js +1 -1
- package/lib/module/controllers/EventsController.js.map +1 -1
- package/lib/module/controllers/ModalController.js +6 -7
- package/lib/module/controllers/ModalController.js.map +1 -1
- package/lib/module/controllers/OnRampController.js +22 -70
- package/lib/module/controllers/OnRampController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +11 -3
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js +1 -22
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/SendController.js +98 -98
- package/lib/module/controllers/SendController.js.map +1 -1
- package/lib/module/controllers/SnackController.js +29 -5
- package/lib/module/controllers/SnackController.js.map +1 -1
- package/lib/module/controllers/SwapController.js +151 -150
- package/lib/module/controllers/SwapController.js.map +1 -1
- package/lib/module/controllers/ThemeController.js +9 -1
- package/lib/module/controllers/ThemeController.js.map +1 -1
- package/lib/module/controllers/TransactionsController.js +23 -19
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/module/index.js +1 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/AssetUtil.js +3 -15
- package/lib/module/utils/AssetUtil.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +538 -9
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +12 -6
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/FetchUtil.js +9 -28
- package/lib/module/utils/FetchUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js +51 -42
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/module/utils/SwapApiUtil.js +15 -21
- package/lib/module/utils/SwapApiUtil.js.map +1 -1
- package/lib/typescript/controllers/AccountController.d.ts +4 -4
- package/lib/typescript/controllers/AccountController.d.ts.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts +3 -2
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts +28 -12
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +3 -11
- package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionsController.d.ts +53 -0
- package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -0
- package/lib/typescript/controllers/ModalController.d.ts +1 -1
- package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
- package/lib/typescript/controllers/OnRampController.d.ts +1 -3
- package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +7 -2
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/PublicStateController.d.ts +1 -1
- package/lib/typescript/controllers/PublicStateController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +4 -16
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/SendController.d.ts +5 -7
- package/lib/typescript/controllers/SendController.d.ts.map +1 -1
- package/lib/typescript/controllers/SnackController.d.ts +3 -3
- package/lib/typescript/controllers/SnackController.d.ts.map +1 -1
- package/lib/typescript/controllers/SwapController.d.ts +12 -11
- package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
- package/lib/typescript/controllers/ThemeController.d.ts +1 -1
- package/lib/typescript/controllers/ThemeController.d.ts.map +1 -1
- package/lib/typescript/controllers/TransactionsController.d.ts +3 -3
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/AssetUtil.d.ts +2 -3
- package/lib/typescript/utils/AssetUtil.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +422 -3
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +5 -4
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts +14 -7
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapApiUtil.d.ts +3 -3
- package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +42 -191
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/controllers/AccountController.ts +23 -27
- package/src/controllers/ApiController.ts +29 -10
- package/src/controllers/BlockchainApiController.ts +140 -55
- package/src/controllers/ConnectionController.ts +12 -24
- package/src/controllers/ConnectionsController.ts +509 -0
- package/src/controllers/EnsController.ts +2 -2
- package/src/controllers/EventsController.ts +1 -1
- package/src/controllers/ModalController.ts +8 -8
- package/src/controllers/NetworkController.ts +1 -1
- package/src/controllers/OnRampController.ts +34 -99
- package/src/controllers/OptionsController.ts +19 -13
- package/src/controllers/PublicStateController.ts +1 -1
- package/src/controllers/RouterController.ts +5 -54
- package/src/controllers/SendController.ts +124 -113
- package/src/controllers/SnackController.ts +31 -5
- package/src/controllers/SwapController.ts +174 -181
- package/src/controllers/ThemeController.ts +11 -2
- package/src/controllers/TransactionsController.ts +26 -20
- package/src/index.ts +3 -6
- package/src/utils/AssetUtil.ts +4 -20
- package/src/utils/ConstantsUtil.ts +544 -9
- package/src/utils/CoreHelperUtil.ts +34 -9
- package/src/utils/FetchUtil.ts +10 -31
- package/src/utils/StorageUtil.ts +60 -48
- package/src/utils/SwapApiUtil.ts +27 -38
- package/src/utils/TypeUtil.ts +43 -193
- package/lib/commonjs/controllers/ConnectorController.js +0 -49
- package/lib/commonjs/controllers/ConnectorController.js.map +0 -1
- package/lib/commonjs/controllers/WebviewController.js +0 -52
- package/lib/commonjs/controllers/WebviewController.js.map +0 -1
- package/lib/commonjs/utils/ConnectionUtil.js +0 -33
- package/lib/commonjs/utils/ConnectionUtil.js.map +0 -1
- package/lib/commonjs/utils/NetworkUtil.js +0 -46
- package/lib/commonjs/utils/NetworkUtil.js.map +0 -1
- package/lib/module/controllers/ConnectorController.js +0 -44
- package/lib/module/controllers/ConnectorController.js.map +0 -1
- package/lib/module/controllers/WebviewController.js +0 -47
- package/lib/module/controllers/WebviewController.js.map +0 -1
- package/lib/module/utils/ConnectionUtil.js +0 -27
- package/lib/module/utils/ConnectionUtil.js.map +0 -1
- package/lib/module/utils/NetworkUtil.js +0 -40
- package/lib/module/utils/NetworkUtil.js.map +0 -1
- package/lib/typescript/controllers/ConnectorController.d.ts +0 -18
- package/lib/typescript/controllers/ConnectorController.d.ts.map +0 -1
- package/lib/typescript/controllers/WebviewController.d.ts +0 -21
- package/lib/typescript/controllers/WebviewController.d.ts.map +0 -1
- package/lib/typescript/utils/ConnectionUtil.d.ts +0 -4
- package/lib/typescript/utils/ConnectionUtil.d.ts.map +0 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +0 -8
- package/lib/typescript/utils/NetworkUtil.d.ts.map +0 -1
- package/src/controllers/ConnectorController.ts +0 -63
- package/src/controllers/WebviewController.ts +0 -63
- package/src/utils/ConnectionUtil.ts +0 -27
- package/src/utils/NetworkUtil.ts +0 -33
package/src/utils/TypeUtil.ts
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
SocialProvider,
|
|
5
|
-
ThemeMode,
|
|
6
|
-
Transaction,
|
|
7
|
-
ConnectorType
|
|
8
|
-
} from '@reown/appkit-common-react-native';
|
|
1
|
+
import type { AccountType, CaipAddress, CaipNetworkId } from '@reown/appkit-common-react-native';
|
|
2
|
+
import type { SocialProvider, Transaction } from '@reown/appkit-common-react-native';
|
|
3
|
+
|
|
9
4
|
import { OnRampErrorType } from './ConstantsUtil';
|
|
10
5
|
|
|
11
6
|
export interface BaseError {
|
|
12
7
|
message?: string;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
|
-
export type CaipAddress = `${string}:${string}:${string}`;
|
|
16
|
-
|
|
17
|
-
export type CaipNetworkId = `${string}:${string}`;
|
|
18
|
-
|
|
19
|
-
export interface CaipNetwork {
|
|
20
|
-
id: CaipNetworkId;
|
|
21
|
-
name?: string;
|
|
22
|
-
imageId?: string;
|
|
23
|
-
imageUrl?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
10
|
export type ConnectedWalletInfo =
|
|
27
11
|
| {
|
|
28
12
|
name?: string;
|
|
@@ -48,18 +32,6 @@ export type ProjectId = string;
|
|
|
48
32
|
|
|
49
33
|
export type Platform = 'mobile' | 'web' | 'qrcode' | 'email' | 'unsupported';
|
|
50
34
|
|
|
51
|
-
export type Connector = {
|
|
52
|
-
id: string;
|
|
53
|
-
type: ConnectorType;
|
|
54
|
-
name?: string;
|
|
55
|
-
imageId?: string;
|
|
56
|
-
explorerId?: string;
|
|
57
|
-
imageUrl?: string;
|
|
58
|
-
info?: { rdns?: string };
|
|
59
|
-
provider?: unknown;
|
|
60
|
-
installed?: boolean;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
35
|
export type CaipNamespaces = Record<
|
|
64
36
|
string,
|
|
65
37
|
{
|
|
@@ -71,12 +43,9 @@ export type CaipNamespaces = Record<
|
|
|
71
43
|
|
|
72
44
|
export type SdkType = 'appkit';
|
|
73
45
|
|
|
74
|
-
export type SdkVersion =
|
|
75
|
-
| `react-native-wagmi-${string}`
|
|
76
|
-
| `react-native-ethers5-${string}`
|
|
77
|
-
| `react-native-ethers-${string}`;
|
|
46
|
+
export type SdkVersion = `react-native-${string}-${string}`;
|
|
78
47
|
|
|
79
|
-
type EnabledSocials =
|
|
48
|
+
type EnabledSocials = SocialProvider;
|
|
80
49
|
|
|
81
50
|
export type Features = {
|
|
82
51
|
/**
|
|
@@ -90,15 +59,10 @@ export type Features = {
|
|
|
90
59
|
*/
|
|
91
60
|
onramp?: boolean;
|
|
92
61
|
/**
|
|
93
|
-
* @description
|
|
94
|
-
* @type {boolean}
|
|
95
|
-
*/
|
|
96
|
-
email?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* @description Show or hide the regular wallet options when email is enabled. Enabled by default.
|
|
62
|
+
* @description Show or hide the regular wallet options when socials are enabled. Enabled by default.
|
|
99
63
|
* @type {boolean}
|
|
100
64
|
*/
|
|
101
|
-
|
|
65
|
+
showWallets?: boolean;
|
|
102
66
|
/**
|
|
103
67
|
* @description Enable or disable the socials feature. Enabled by default.
|
|
104
68
|
* @type {EnabledSocials[]}
|
|
@@ -160,7 +124,7 @@ export type RequestCache =
|
|
|
160
124
|
|
|
161
125
|
// -- BlockchainApiController Types ---------------------------------------------
|
|
162
126
|
export interface BlockchainApiIdentityRequest {
|
|
163
|
-
address: string
|
|
127
|
+
address: `0x${string}`;
|
|
164
128
|
}
|
|
165
129
|
|
|
166
130
|
export interface BlockchainApiIdentityResponse {
|
|
@@ -168,8 +132,22 @@ export interface BlockchainApiIdentityResponse {
|
|
|
168
132
|
name: string;
|
|
169
133
|
}
|
|
170
134
|
|
|
135
|
+
export interface BlockchainApiBalance {
|
|
136
|
+
name: string;
|
|
137
|
+
symbol: string;
|
|
138
|
+
chainId: string;
|
|
139
|
+
address?: CaipAddress;
|
|
140
|
+
value?: number;
|
|
141
|
+
price: number;
|
|
142
|
+
quantity: {
|
|
143
|
+
decimals: string;
|
|
144
|
+
numeric: string;
|
|
145
|
+
};
|
|
146
|
+
iconUrl: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
171
149
|
export interface BlockchainApiBalanceResponse {
|
|
172
|
-
balances:
|
|
150
|
+
balances: BlockchainApiBalance[];
|
|
173
151
|
}
|
|
174
152
|
|
|
175
153
|
export interface BlockchainApiTransactionsRequest {
|
|
@@ -179,6 +157,7 @@ export interface BlockchainApiTransactionsRequest {
|
|
|
179
157
|
onramp?: 'coinbase';
|
|
180
158
|
signal?: AbortSignal;
|
|
181
159
|
cache?: RequestCache;
|
|
160
|
+
chainId: CaipNetworkId;
|
|
182
161
|
}
|
|
183
162
|
|
|
184
163
|
export interface BlockchainApiTransactionsResponse {
|
|
@@ -192,9 +171,9 @@ export interface BlockchainApiSwapAllowanceResponse {
|
|
|
192
171
|
|
|
193
172
|
export interface BlockchainApiGenerateSwapCalldataRequest {
|
|
194
173
|
projectId: string;
|
|
195
|
-
userAddress:
|
|
196
|
-
from:
|
|
197
|
-
to:
|
|
174
|
+
userAddress: CaipAddress;
|
|
175
|
+
from: CaipAddress;
|
|
176
|
+
to: CaipAddress;
|
|
198
177
|
amount: string;
|
|
199
178
|
eip155?: {
|
|
200
179
|
slippage: string;
|
|
@@ -217,9 +196,9 @@ export interface BlockchainApiGenerateSwapCalldataResponse {
|
|
|
217
196
|
|
|
218
197
|
export interface BlockchainApiGenerateApproveCalldataRequest {
|
|
219
198
|
projectId: string;
|
|
220
|
-
userAddress:
|
|
221
|
-
from:
|
|
222
|
-
to:
|
|
199
|
+
userAddress: CaipAddress;
|
|
200
|
+
from: CaipAddress;
|
|
201
|
+
to: CaipAddress;
|
|
223
202
|
amount?: number;
|
|
224
203
|
}
|
|
225
204
|
|
|
@@ -239,7 +218,7 @@ export interface BlockchainApiGenerateApproveCalldataResponse {
|
|
|
239
218
|
export interface BlockchainApiTokenPriceRequest {
|
|
240
219
|
projectId: string;
|
|
241
220
|
currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
|
|
242
|
-
addresses:
|
|
221
|
+
addresses: CaipAddress[];
|
|
243
222
|
}
|
|
244
223
|
|
|
245
224
|
export interface BlockchainApiTokenPriceResponse {
|
|
@@ -253,13 +232,13 @@ export interface BlockchainApiTokenPriceResponse {
|
|
|
253
232
|
|
|
254
233
|
export interface BlockchainApiSwapAllowanceRequest {
|
|
255
234
|
projectId: string;
|
|
256
|
-
tokenAddress:
|
|
257
|
-
userAddress:
|
|
235
|
+
tokenAddress: CaipAddress;
|
|
236
|
+
userAddress: CaipAddress;
|
|
258
237
|
}
|
|
259
238
|
|
|
260
239
|
export interface BlockchainApiGasPriceRequest {
|
|
261
240
|
projectId: string;
|
|
262
|
-
chainId:
|
|
241
|
+
chainId: CaipNetworkId;
|
|
263
242
|
}
|
|
264
243
|
|
|
265
244
|
export interface BlockchainApiGasPriceResponse {
|
|
@@ -294,11 +273,11 @@ export interface BlockchainApiLookupEnsName {
|
|
|
294
273
|
|
|
295
274
|
export interface BlockchainApiSwapQuoteRequest {
|
|
296
275
|
projectId: string;
|
|
297
|
-
chainId?:
|
|
276
|
+
chainId?: CaipNetworkId;
|
|
298
277
|
amount: string;
|
|
299
|
-
userAddress:
|
|
300
|
-
from:
|
|
301
|
-
to:
|
|
278
|
+
userAddress: CaipAddress;
|
|
279
|
+
from: CaipAddress;
|
|
280
|
+
to: CaipAddress;
|
|
302
281
|
gasPrice: string;
|
|
303
282
|
}
|
|
304
283
|
|
|
@@ -314,17 +293,16 @@ export interface BlockchainApiSwapQuoteResponse {
|
|
|
314
293
|
|
|
315
294
|
export interface BlockchainApiSwapTokensRequest {
|
|
316
295
|
projectId: string;
|
|
317
|
-
chainId
|
|
296
|
+
chainId: CaipNetworkId;
|
|
318
297
|
}
|
|
319
298
|
|
|
320
299
|
export interface BlockchainApiOnRampQuotesRequest {
|
|
321
300
|
countryCode: string;
|
|
322
|
-
paymentMethodType
|
|
301
|
+
paymentMethodType: string;
|
|
323
302
|
destinationCurrencyCode: string;
|
|
324
303
|
sourceAmount: number;
|
|
325
304
|
sourceCurrencyCode: string;
|
|
326
305
|
walletAddress: string;
|
|
327
|
-
excludeProviders?: string[];
|
|
328
306
|
}
|
|
329
307
|
|
|
330
308
|
export interface BlockchainApiSwapTokensResponse {
|
|
@@ -347,31 +325,13 @@ export type BlockchainApiOnRampWidgetResponse = {
|
|
|
347
325
|
};
|
|
348
326
|
|
|
349
327
|
// -- OptionsController Types ---------------------------------------------------
|
|
350
|
-
export interface Token {
|
|
351
|
-
address: string;
|
|
352
|
-
image?: string;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export type Tokens = Record<CaipNetworkId, Token>;
|
|
356
|
-
|
|
357
|
-
export type Metadata = {
|
|
358
|
-
name: string;
|
|
359
|
-
description: string;
|
|
360
|
-
url: string;
|
|
361
|
-
icons: string[];
|
|
362
|
-
redirect?: {
|
|
363
|
-
native?: string;
|
|
364
|
-
universal?: string;
|
|
365
|
-
linkMode?: boolean;
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
|
|
369
328
|
export type CustomWallet = Pick<
|
|
370
329
|
WcWallet,
|
|
371
330
|
| 'id'
|
|
372
331
|
| 'name'
|
|
373
332
|
| 'homepage'
|
|
374
333
|
| 'image_url'
|
|
334
|
+
| 'image_id'
|
|
375
335
|
| 'mobile_link'
|
|
376
336
|
| 'desktop_link'
|
|
377
337
|
| 'webapp_link'
|
|
@@ -397,9 +357,6 @@ export type EventName =
|
|
|
397
357
|
| 'CLICK_NETWORK_HELP'
|
|
398
358
|
| 'CLICK_GET_WALLET'
|
|
399
359
|
| 'EMAIL_LOGIN_SELECTED'
|
|
400
|
-
| 'EMAIL_SUBMITTED'
|
|
401
|
-
| 'DEVICE_REGISTERED_FOR_EMAIL'
|
|
402
|
-
| 'EMAIL_VERIFICATION_CODE_SENT'
|
|
403
360
|
| 'EMAIL_VERIFICATION_CODE_PASS'
|
|
404
361
|
| 'EMAIL_VERIFICATION_CODE_FAIL'
|
|
405
362
|
| 'EMAIL_EDIT'
|
|
@@ -462,7 +419,7 @@ export type Event =
|
|
|
462
419
|
type: 'track';
|
|
463
420
|
event: 'SWITCH_NETWORK';
|
|
464
421
|
properties: {
|
|
465
|
-
network: string;
|
|
422
|
+
network: number | string;
|
|
466
423
|
};
|
|
467
424
|
}
|
|
468
425
|
| {
|
|
@@ -514,18 +471,6 @@ export type Event =
|
|
|
514
471
|
type: 'track';
|
|
515
472
|
event: 'EMAIL_LOGIN_SELECTED';
|
|
516
473
|
}
|
|
517
|
-
| {
|
|
518
|
-
type: 'track';
|
|
519
|
-
event: 'EMAIL_SUBMITTED';
|
|
520
|
-
}
|
|
521
|
-
| {
|
|
522
|
-
type: 'track';
|
|
523
|
-
event: 'DEVICE_REGISTERED_FOR_EMAIL';
|
|
524
|
-
}
|
|
525
|
-
| {
|
|
526
|
-
type: 'track';
|
|
527
|
-
event: 'EMAIL_VERIFICATION_CODE_SENT';
|
|
528
|
-
}
|
|
529
474
|
| {
|
|
530
475
|
type: 'track';
|
|
531
476
|
event: 'EMAIL_VERIFICATION_CODE_PASS';
|
|
@@ -727,7 +672,7 @@ export type Event =
|
|
|
727
672
|
type: 'track';
|
|
728
673
|
event: 'SET_PREFERRED_ACCOUNT_TYPE';
|
|
729
674
|
properties: {
|
|
730
|
-
accountType:
|
|
675
|
+
accountType: AccountType;
|
|
731
676
|
network: string;
|
|
732
677
|
};
|
|
733
678
|
}
|
|
@@ -861,12 +806,6 @@ export type OnRampCountry = {
|
|
|
861
806
|
name: string;
|
|
862
807
|
};
|
|
863
808
|
|
|
864
|
-
export type OnRampCountryDefaults = {
|
|
865
|
-
countryCode: string;
|
|
866
|
-
defaultCurrencyCode: string;
|
|
867
|
-
defaultPaymentMethods: string[];
|
|
868
|
-
};
|
|
869
|
-
|
|
870
809
|
export type OnRampFiatCurrency = {
|
|
871
810
|
currencyCode: string;
|
|
872
811
|
name: string;
|
|
@@ -936,92 +875,3 @@ export type OnRampTransactionResult = {
|
|
|
936
875
|
status: string | null;
|
|
937
876
|
network: string | null;
|
|
938
877
|
};
|
|
939
|
-
|
|
940
|
-
// -- Email Types ------------------------------------------------
|
|
941
|
-
/**
|
|
942
|
-
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
943
|
-
* It's duplicated in order to decouple scaffold from email package
|
|
944
|
-
*/
|
|
945
|
-
|
|
946
|
-
export type AppKitFrameAccountType = 'eoa' | 'smartAccount';
|
|
947
|
-
|
|
948
|
-
export interface AppKitFrameProvider {
|
|
949
|
-
readonly id: string;
|
|
950
|
-
readonly name: string;
|
|
951
|
-
getEventEmitter(): EventEmitter;
|
|
952
|
-
getSecureSiteURL(): string;
|
|
953
|
-
getSecureSiteDashboardURL(): string;
|
|
954
|
-
getSecureSiteIconURL(): string;
|
|
955
|
-
getEmail(): string | undefined;
|
|
956
|
-
getUsername(): string | undefined;
|
|
957
|
-
getLastUsedChainId(): Promise<number | undefined>;
|
|
958
|
-
rejectRpcRequest(): void;
|
|
959
|
-
connectEmail(payload: { email: string }): Promise<{
|
|
960
|
-
action: 'VERIFY_DEVICE' | 'VERIFY_OTP';
|
|
961
|
-
}>;
|
|
962
|
-
connectDevice(): Promise<unknown>;
|
|
963
|
-
connectSocial(uri: string): Promise<{
|
|
964
|
-
chainId: string | number;
|
|
965
|
-
email: string;
|
|
966
|
-
address: string;
|
|
967
|
-
accounts?: {
|
|
968
|
-
type: AppKitFrameAccountType;
|
|
969
|
-
address: string;
|
|
970
|
-
}[];
|
|
971
|
-
userName?: string;
|
|
972
|
-
}>;
|
|
973
|
-
getSocialRedirectUri(payload: { provider: SocialProvider }): Promise<{
|
|
974
|
-
uri: string;
|
|
975
|
-
}>;
|
|
976
|
-
connectOtp(payload: { otp: string }): Promise<unknown>;
|
|
977
|
-
connectFarcaster: () => Promise<{ userName: string }>;
|
|
978
|
-
getFarcasterUri(): Promise<{ url: string }>;
|
|
979
|
-
isConnected(): Promise<{
|
|
980
|
-
isConnected: boolean;
|
|
981
|
-
}>;
|
|
982
|
-
getChainId(): Promise<{
|
|
983
|
-
chainId: number;
|
|
984
|
-
}>;
|
|
985
|
-
updateEmail(payload: { email: string }): Promise<{
|
|
986
|
-
action: 'VERIFY_PRIMARY_OTP' | 'VERIFY_SECONDARY_OTP';
|
|
987
|
-
}>;
|
|
988
|
-
updateEmailPrimaryOtp(payload: { otp: string }): Promise<unknown>;
|
|
989
|
-
updateEmailSecondaryOtp(payload: { otp: string }): Promise<{
|
|
990
|
-
newEmail: string;
|
|
991
|
-
}>;
|
|
992
|
-
syncTheme(payload: {
|
|
993
|
-
themeMode: ThemeMode | undefined;
|
|
994
|
-
themeVariables: Record<string, string | number> | undefined;
|
|
995
|
-
}): Promise<unknown>;
|
|
996
|
-
syncDappData(payload: {
|
|
997
|
-
projectId: string;
|
|
998
|
-
sdkVersion: SdkVersion;
|
|
999
|
-
sdkType: SdkType;
|
|
1000
|
-
metadata?: Metadata;
|
|
1001
|
-
}): Promise<unknown>;
|
|
1002
|
-
connect(payload?: { chainId: number | undefined }): Promise<{
|
|
1003
|
-
chainId: number;
|
|
1004
|
-
email?: string | null;
|
|
1005
|
-
address: string;
|
|
1006
|
-
smartAccountDeployed: boolean;
|
|
1007
|
-
preferredAccountType: AppKitFrameAccountType;
|
|
1008
|
-
}>;
|
|
1009
|
-
switchNetwork(chainId: number): Promise<{
|
|
1010
|
-
chainId: number;
|
|
1011
|
-
}>;
|
|
1012
|
-
setPreferredAccount(type: AppKitFrameAccountType): Promise<{
|
|
1013
|
-
type: AppKitFrameAccountType;
|
|
1014
|
-
address: string;
|
|
1015
|
-
}>;
|
|
1016
|
-
setOnTimeout(callback: () => void): void;
|
|
1017
|
-
getSmartAccountEnabledNetworks(): Promise<{
|
|
1018
|
-
smartAccountEnabledNetworks: number[];
|
|
1019
|
-
}>;
|
|
1020
|
-
disconnect(): Promise<unknown>;
|
|
1021
|
-
request(req: any): Promise<any>;
|
|
1022
|
-
AuthView: () => React.JSX.Element | null;
|
|
1023
|
-
Webview: () => React.JSX.Element | null;
|
|
1024
|
-
onSetPreferredAccount: (
|
|
1025
|
-
callback: (values: { type: AppKitFrameAccountType; address: string }) => void
|
|
1026
|
-
) => void;
|
|
1027
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConnectorController = void 0;
|
|
7
|
-
var _utils = require("valtio/utils");
|
|
8
|
-
var _valtio = require("valtio");
|
|
9
|
-
var _StorageUtil = require("../utils/StorageUtil");
|
|
10
|
-
// -- Types --------------------------------------------- //
|
|
11
|
-
|
|
12
|
-
// -- State --------------------------------------------- //
|
|
13
|
-
const state = (0, _valtio.proxy)({
|
|
14
|
-
connectors: []
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// -- Controller ---------------------------------------- //
|
|
18
|
-
const ConnectorController = exports.ConnectorController = {
|
|
19
|
-
state,
|
|
20
|
-
subscribeKey(key, callback) {
|
|
21
|
-
return (0, _utils.subscribeKey)(state, key, callback);
|
|
22
|
-
},
|
|
23
|
-
setConnectors(connectors) {
|
|
24
|
-
state.connectors = connectors.map(c => (0, _valtio.ref)(c));
|
|
25
|
-
},
|
|
26
|
-
addConnector(connector) {
|
|
27
|
-
state.connectors = [...state.connectors, (0, _valtio.ref)(connector)];
|
|
28
|
-
},
|
|
29
|
-
getConnectors() {
|
|
30
|
-
return state.connectors;
|
|
31
|
-
},
|
|
32
|
-
getAuthConnector() {
|
|
33
|
-
return state.connectors.find(c => c.type === 'AUTH');
|
|
34
|
-
},
|
|
35
|
-
setConnectedConnector(connectorType, saveStorage = true) {
|
|
36
|
-
state.connectedConnector = connectorType;
|
|
37
|
-
if (saveStorage) {
|
|
38
|
-
if (connectorType) {
|
|
39
|
-
_StorageUtil.StorageUtil.setConnectedConnector(connectorType);
|
|
40
|
-
} else {
|
|
41
|
-
_StorageUtil.StorageUtil.removeConnectedConnector();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
setAuthLoading(loading) {
|
|
46
|
-
state.authLoading = loading;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=ConnectorController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_valtio","_StorageUtil","state","proxy","connectors","ConnectorController","exports","subscribeKey","key","callback","subKey","setConnectors","map","c","ref","addConnector","connector","getConnectors","getAuthConnector","find","type","setConnectedConnector","connectorType","saveStorage","connectedConnector","StorageUtil","removeConnectedConnector","setAuthLoading","loading","authLoading"],"sourceRoot":"../../../src","sources":["controllers/ConnectorController.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;;AASA;AACA,MAAMG,KAAK,GAAG,IAAAC,aAAK,EAA2B;EAC5CC,UAAU,EAAE;AACd,CAAC,CAAC;;AAEF;AACO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjCH,KAAK;EAELK,YAAYA,CAAqBC,GAAM,EAAEC,QAAsD,EAAE;IAC/F,OAAO,IAAAC,mBAAM,EAACR,KAAK,EAAEM,GAAG,EAAEC,QAAQ,CAAC;EACrC,CAAC;EAEDE,aAAaA,CAACP,UAAkD,EAAE;IAChEF,KAAK,CAACE,UAAU,GAAGA,UAAU,CAACQ,GAAG,CAACC,CAAC,IAAI,IAAAC,WAAG,EAACD,CAAC,CAAC,CAAC;EAChD,CAAC;EAEDE,YAAYA,CAACC,SAAoB,EAAE;IACjCd,KAAK,CAACE,UAAU,GAAG,CAAC,GAAGF,KAAK,CAACE,UAAU,EAAE,IAAAU,WAAG,EAACE,SAAS,CAAC,CAAC;EAC1D,CAAC;EAEDC,aAAaA,CAAA,EAAG;IACd,OAAOf,KAAK,CAACE,UAAU;EACzB,CAAC;EAEDc,gBAAgBA,CAAA,EAAG;IACjB,OAAOhB,KAAK,CAACE,UAAU,CAACe,IAAI,CAACN,CAAC,IAAIA,CAAC,CAACO,IAAI,KAAK,MAAM,CAAC;EACtD,CAAC;EAEDC,qBAAqBA,CACnBC,aAA6D,EAC7DC,WAAW,GAAG,IAAI,EAClB;IACArB,KAAK,CAACsB,kBAAkB,GAAGF,aAAa;IAExC,IAAIC,WAAW,EAAE;MACf,IAAID,aAAa,EAAE;QACjBG,wBAAW,CAACJ,qBAAqB,CAACC,aAAa,CAAC;MAClD,CAAC,MAAM;QACLG,wBAAW,CAACC,wBAAwB,CAAC,CAAC;MACxC;IACF;EACF,CAAC;EAEDC,cAAcA,CAACC,OAAgD,EAAE;IAC/D1B,KAAK,CAAC2B,WAAW,GAAGD,OAAO;EAC7B;AACF,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WebviewController = void 0;
|
|
7
|
-
var _valtio = require("valtio");
|
|
8
|
-
// -- Types --------------------------------------------- //
|
|
9
|
-
|
|
10
|
-
// -- State --------------------------------------------- //
|
|
11
|
-
const state = (0, _valtio.proxy)({
|
|
12
|
-
frameViewVisible: false,
|
|
13
|
-
webviewVisible: false,
|
|
14
|
-
connecting: false,
|
|
15
|
-
connectingProvider: undefined,
|
|
16
|
-
processingAuth: false
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// -- Controller ---------------------------------------- //
|
|
20
|
-
const WebviewController = exports.WebviewController = {
|
|
21
|
-
state,
|
|
22
|
-
subscribe(callback) {
|
|
23
|
-
return (0, _valtio.subscribe)(state, () => callback(state));
|
|
24
|
-
},
|
|
25
|
-
setFrameViewVisible(frameViewVisible) {
|
|
26
|
-
state.frameViewVisible = frameViewVisible;
|
|
27
|
-
},
|
|
28
|
-
setWebviewVisible(visible) {
|
|
29
|
-
state.webviewVisible = visible;
|
|
30
|
-
},
|
|
31
|
-
setWebviewUrl(url) {
|
|
32
|
-
state.webviewUrl = url;
|
|
33
|
-
},
|
|
34
|
-
setConnecting(connecting) {
|
|
35
|
-
state.connecting = connecting;
|
|
36
|
-
},
|
|
37
|
-
setConnectingProvider(provider) {
|
|
38
|
-
state.connectingProvider = provider;
|
|
39
|
-
},
|
|
40
|
-
setProcessingAuth(processingAuth) {
|
|
41
|
-
state.processingAuth = processingAuth;
|
|
42
|
-
},
|
|
43
|
-
reset() {
|
|
44
|
-
state.frameViewVisible = false;
|
|
45
|
-
state.webviewVisible = false;
|
|
46
|
-
state.connecting = false;
|
|
47
|
-
state.connectingProvider = undefined;
|
|
48
|
-
state.processingAuth = false;
|
|
49
|
-
state.webviewUrl = undefined;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=WebviewController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_valtio","require","state","proxy","frameViewVisible","webviewVisible","connecting","connectingProvider","undefined","processingAuth","WebviewController","exports","subscribe","callback","sub","setFrameViewVisible","setWebviewVisible","visible","setWebviewUrl","url","webviewUrl","setConnecting","setConnectingProvider","provider","setProcessingAuth","reset"],"sourceRoot":"../../../src","sources":["controllers/WebviewController.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA;;AAUA;AACA,MAAMC,KAAK,GAAG,IAAAC,aAAK,EAAyB;EAC1CC,gBAAgB,EAAE,KAAK;EACvBC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE,KAAK;EACjBC,kBAAkB,EAAEC,SAAS;EAC7BC,cAAc,EAAE;AAClB,CAAC,CAAC;;AAEF;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BR,KAAK;EAELU,SAASA,CAACC,QAAoD,EAAE;IAC9D,OAAO,IAAAC,iBAAG,EAACZ,KAAK,EAAE,MAAMW,QAAQ,CAACX,KAAK,CAAC,CAAC;EAC1C,CAAC;EAEDa,mBAAmBA,CAACX,gBAA4D,EAAE;IAChFF,KAAK,CAACE,gBAAgB,GAAGA,gBAAgB;EAC3C,CAAC;EAEDY,iBAAiBA,CAACC,OAAiD,EAAE;IACnEf,KAAK,CAACG,cAAc,GAAGY,OAAO;EAChC,CAAC;EAEDC,aAAaA,CAACC,GAAyC,EAAE;IACvDjB,KAAK,CAACkB,UAAU,GAAGD,GAAG;EACxB,CAAC;EAEDE,aAAaA,CAACf,UAAgD,EAAE;IAC9DJ,KAAK,CAACI,UAAU,GAAGA,UAAU;EAC/B,CAAC;EAEDgB,qBAAqBA,CAACC,QAAsD,EAAE;IAC5ErB,KAAK,CAACK,kBAAkB,GAAGgB,QAAQ;EACrC,CAAC;EAEDC,iBAAiBA,CAACf,cAAwD,EAAE;IAC1EP,KAAK,CAACO,cAAc,GAAGA,cAAc;EACvC,CAAC;EAEDgB,KAAKA,CAAA,EAAG;IACNvB,KAAK,CAACE,gBAAgB,GAAG,KAAK;IAC9BF,KAAK,CAACG,cAAc,GAAG,KAAK;IAC5BH,KAAK,CAACI,UAAU,GAAG,KAAK;IACxBJ,KAAK,CAACK,kBAAkB,GAAGC,SAAS;IACpCN,KAAK,CAACO,cAAc,GAAG,KAAK;IAC5BP,KAAK,CAACkB,UAAU,GAAGZ,SAAS;EAC9B;AACF,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConnectionUtil = void 0;
|
|
7
|
-
var _AccountController = require("../controllers/AccountController");
|
|
8
|
-
var _ConnectionController = require("../controllers/ConnectionController");
|
|
9
|
-
var _EventsController = require("../controllers/EventsController");
|
|
10
|
-
var _ModalController = require("../controllers/ModalController");
|
|
11
|
-
var _RouterController = require("../controllers/RouterController");
|
|
12
|
-
var _TransactionsController = require("../controllers/TransactionsController");
|
|
13
|
-
const ConnectionUtil = exports.ConnectionUtil = {
|
|
14
|
-
async disconnect() {
|
|
15
|
-
try {
|
|
16
|
-
await _ConnectionController.ConnectionController.disconnect();
|
|
17
|
-
_ModalController.ModalController.close();
|
|
18
|
-
_AccountController.AccountController.setIsConnected(false);
|
|
19
|
-
_RouterController.RouterController.reset('Connect');
|
|
20
|
-
_TransactionsController.TransactionsController.resetTransactions();
|
|
21
|
-
_EventsController.EventsController.sendEvent({
|
|
22
|
-
type: 'track',
|
|
23
|
-
event: 'DISCONNECT_SUCCESS'
|
|
24
|
-
});
|
|
25
|
-
} catch (error) {
|
|
26
|
-
_EventsController.EventsController.sendEvent({
|
|
27
|
-
type: 'track',
|
|
28
|
-
event: 'DISCONNECT_ERROR'
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=ConnectionUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_AccountController","require","_ConnectionController","_EventsController","_ModalController","_RouterController","_TransactionsController","ConnectionUtil","exports","disconnect","ConnectionController","ModalController","close","AccountController","setIsConnected","RouterController","reset","TransactionsController","resetTransactions","EventsController","sendEvent","type","event","error"],"sourceRoot":"../../../src","sources":["utils/ConnectionUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AAEO,MAAMM,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC5B,MAAME,UAAUA,CAAA,EAAG;IACjB,IAAI;MACF,MAAMC,0CAAoB,CAACD,UAAU,CAAC,CAAC;MACvCE,gCAAe,CAACC,KAAK,CAAC,CAAC;MACvBC,oCAAiB,CAACC,cAAc,CAAC,KAAK,CAAC;MACvCC,kCAAgB,CAACC,KAAK,CAAC,SAAS,CAAC;MACjCC,8CAAsB,CAACC,iBAAiB,CAAC,CAAC;MAC1CC,kCAAgB,CAACC,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdJ,kCAAgB,CAACC,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;EACF;AACF,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NetworkUtil = void 0;
|
|
7
|
-
var _RouterUtil = require("./RouterUtil");
|
|
8
|
-
var _RouterController = require("../controllers/RouterController");
|
|
9
|
-
var _NetworkController = require("../controllers/NetworkController");
|
|
10
|
-
var _AccountController = require("../controllers/AccountController");
|
|
11
|
-
var _ConnectorController = require("../controllers/ConnectorController");
|
|
12
|
-
var _SwapController = require("../controllers/SwapController");
|
|
13
|
-
const NetworkUtil = exports.NetworkUtil = {
|
|
14
|
-
async handleNetworkSwitch(network) {
|
|
15
|
-
const {
|
|
16
|
-
isConnected
|
|
17
|
-
} = _AccountController.AccountController.state;
|
|
18
|
-
const {
|
|
19
|
-
caipNetwork,
|
|
20
|
-
approvedCaipNetworkIds,
|
|
21
|
-
supportsAllNetworks
|
|
22
|
-
} = _NetworkController.NetworkController.state;
|
|
23
|
-
const isAuthConnected = _ConnectorController.ConnectorController.state.connectedConnector === 'AUTH';
|
|
24
|
-
let eventData = null;
|
|
25
|
-
if (isConnected && caipNetwork?.id !== network.id) {
|
|
26
|
-
if (approvedCaipNetworkIds?.includes(network.id) && !isAuthConnected) {
|
|
27
|
-
await _NetworkController.NetworkController.switchActiveNetwork(network);
|
|
28
|
-
_RouterUtil.RouterUtil.navigateAfterNetworkSwitch(['ConnectingSiwe']);
|
|
29
|
-
eventData = {
|
|
30
|
-
type: 'SWITCH_NETWORK',
|
|
31
|
-
networkId: network.id
|
|
32
|
-
};
|
|
33
|
-
} else if (supportsAllNetworks || isAuthConnected) {
|
|
34
|
-
_RouterController.RouterController.push('SwitchNetwork', {
|
|
35
|
-
network
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
} else if (!isConnected) {
|
|
39
|
-
_NetworkController.NetworkController.setCaipNetwork(network);
|
|
40
|
-
_RouterController.RouterController.push('Connect');
|
|
41
|
-
}
|
|
42
|
-
_SwapController.SwapController.resetState();
|
|
43
|
-
return eventData;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=NetworkUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_RouterUtil","require","_RouterController","_NetworkController","_AccountController","_ConnectorController","_SwapController","NetworkUtil","exports","handleNetworkSwitch","network","isConnected","AccountController","state","caipNetwork","approvedCaipNetworkIds","supportsAllNetworks","NetworkController","isAuthConnected","ConnectorController","connectedConnector","eventData","id","includes","switchActiveNetwork","RouterUtil","navigateAfterNetworkSwitch","type","networkId","RouterController","push","setCaipNetwork","SwapController","resetState"],"sourceRoot":"../../../src","sources":["utils/NetworkUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAGO,MAAMM,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzB,MAAME,mBAAmBA,CAACC,OAAoB,EAAE;IAC9C,MAAM;MAAEC;IAAY,CAAC,GAAGC,oCAAiB,CAACC,KAAK;IAC/C,MAAM;MAAEC,WAAW;MAAEC,sBAAsB;MAAEC;IAAoB,CAAC,GAAGC,oCAAiB,CAACJ,KAAK;IAC5F,MAAMK,eAAe,GAAGC,wCAAmB,CAACN,KAAK,CAACO,kBAAkB,KAAK,MAAM;IAC/E,IAAIC,SAAS,GAAG,IAAI;IAEpB,IAAIV,WAAW,IAAIG,WAAW,EAAEQ,EAAE,KAAKZ,OAAO,CAACY,EAAE,EAAE;MACjD,IAAIP,sBAAsB,EAAEQ,QAAQ,CAACb,OAAO,CAACY,EAAE,CAAC,IAAI,CAACJ,eAAe,EAAE;QACpE,MAAMD,oCAAiB,CAACO,mBAAmB,CAACd,OAAO,CAAC;QACpDe,sBAAU,CAACC,0BAA0B,CAAC,CAAC,gBAAgB,CAAC,CAAC;QACzDL,SAAS,GAAG;UAAEM,IAAI,EAAE,gBAAgB;UAAEC,SAAS,EAAElB,OAAO,CAACY;QAAG,CAAC;MAC/D,CAAC,MAAM,IAAIN,mBAAmB,IAAIE,eAAe,EAAE;QACjDW,kCAAgB,CAACC,IAAI,CAAC,eAAe,EAAE;UAAEpB;QAAQ,CAAC,CAAC;MACrD;IACF,CAAC,MAAM,IAAI,CAACC,WAAW,EAAE;MACvBM,oCAAiB,CAACc,cAAc,CAACrB,OAAO,CAAC;MACzCmB,kCAAgB,CAACC,IAAI,CAAC,SAAS,CAAC;IAClC;IAEAE,8BAAc,CAACC,UAAU,CAAC,CAAC;IAE3B,OAAOZ,SAAS;EAClB;AACF,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { subscribeKey as subKey } from 'valtio/utils';
|
|
2
|
-
import { proxy, ref } from 'valtio';
|
|
3
|
-
import { StorageUtil } from '../utils/StorageUtil';
|
|
4
|
-
|
|
5
|
-
// -- Types --------------------------------------------- //
|
|
6
|
-
|
|
7
|
-
// -- State --------------------------------------------- //
|
|
8
|
-
const state = proxy({
|
|
9
|
-
connectors: []
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// -- Controller ---------------------------------------- //
|
|
13
|
-
export const ConnectorController = {
|
|
14
|
-
state,
|
|
15
|
-
subscribeKey(key, callback) {
|
|
16
|
-
return subKey(state, key, callback);
|
|
17
|
-
},
|
|
18
|
-
setConnectors(connectors) {
|
|
19
|
-
state.connectors = connectors.map(c => ref(c));
|
|
20
|
-
},
|
|
21
|
-
addConnector(connector) {
|
|
22
|
-
state.connectors = [...state.connectors, ref(connector)];
|
|
23
|
-
},
|
|
24
|
-
getConnectors() {
|
|
25
|
-
return state.connectors;
|
|
26
|
-
},
|
|
27
|
-
getAuthConnector() {
|
|
28
|
-
return state.connectors.find(c => c.type === 'AUTH');
|
|
29
|
-
},
|
|
30
|
-
setConnectedConnector(connectorType, saveStorage = true) {
|
|
31
|
-
state.connectedConnector = connectorType;
|
|
32
|
-
if (saveStorage) {
|
|
33
|
-
if (connectorType) {
|
|
34
|
-
StorageUtil.setConnectedConnector(connectorType);
|
|
35
|
-
} else {
|
|
36
|
-
StorageUtil.removeConnectedConnector();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
setAuthLoading(loading) {
|
|
41
|
-
state.authLoading = loading;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=ConnectorController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["subscribeKey","subKey","proxy","ref","StorageUtil","state","connectors","ConnectorController","key","callback","setConnectors","map","c","addConnector","connector","getConnectors","getAuthConnector","find","type","setConnectedConnector","connectorType","saveStorage","connectedConnector","removeConnectedConnector","setAuthLoading","loading","authLoading"],"sourceRoot":"../../../src","sources":["controllers/ConnectorController.ts"],"mappings":"AACA,SAASA,YAAY,IAAIC,MAAM,QAAQ,cAAc;AACrD,SAASC,KAAK,EAAEC,GAAG,QAAQ,QAAQ;AAEnC,SAASC,WAAW,QAAQ,sBAAsB;;AAElD;;AASA;AACA,MAAMC,KAAK,GAAGH,KAAK,CAA2B;EAC5CI,UAAU,EAAE;AACd,CAAC,CAAC;;AAEF;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjCF,KAAK;EAELL,YAAYA,CAAqBQ,GAAM,EAAEC,QAAsD,EAAE;IAC/F,OAAOR,MAAM,CAACI,KAAK,EAAEG,GAAG,EAAEC,QAAQ,CAAC;EACrC,CAAC;EAEDC,aAAaA,CAACJ,UAAkD,EAAE;IAChED,KAAK,CAACC,UAAU,GAAGA,UAAU,CAACK,GAAG,CAACC,CAAC,IAAIT,GAAG,CAACS,CAAC,CAAC,CAAC;EAChD,CAAC;EAEDC,YAAYA,CAACC,SAAoB,EAAE;IACjCT,KAAK,CAACC,UAAU,GAAG,CAAC,GAAGD,KAAK,CAACC,UAAU,EAAEH,GAAG,CAACW,SAAS,CAAC,CAAC;EAC1D,CAAC;EAEDC,aAAaA,CAAA,EAAG;IACd,OAAOV,KAAK,CAACC,UAAU;EACzB,CAAC;EAEDU,gBAAgBA,CAAA,EAAG;IACjB,OAAOX,KAAK,CAACC,UAAU,CAACW,IAAI,CAACL,CAAC,IAAIA,CAAC,CAACM,IAAI,KAAK,MAAM,CAAC;EACtD,CAAC;EAEDC,qBAAqBA,CACnBC,aAA6D,EAC7DC,WAAW,GAAG,IAAI,EAClB;IACAhB,KAAK,CAACiB,kBAAkB,GAAGF,aAAa;IAExC,IAAIC,WAAW,EAAE;MACf,IAAID,aAAa,EAAE;QACjBhB,WAAW,CAACe,qBAAqB,CAACC,aAAa,CAAC;MAClD,CAAC,MAAM;QACLhB,WAAW,CAACmB,wBAAwB,CAAC,CAAC;MACxC;IACF;EACF,CAAC;EAEDC,cAAcA,CAACC,OAAgD,EAAE;IAC/DpB,KAAK,CAACqB,WAAW,GAAGD,OAAO;EAC7B;AACF,CAAC"}
|