@reown/appkit-core-react-native 0.0.0-feat-onramp-20250722205908 → 0.0.0-feat-coinbase-20250723185200
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 +204 -74
- 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 -69
- package/lib/commonjs/controllers/OnRampController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +17 -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 +90 -95
- 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 +203 -73
- 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 +23 -70
- package/lib/module/controllers/OnRampController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +17 -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 +92 -95
- 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 +29 -15
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +5 -16
- 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 +8 -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 +18 -14
- 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 -195
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/controllers/AccountController.ts +23 -27
- package/src/controllers/ApiController.ts +29 -10
- package/src/controllers/BlockchainApiController.ts +179 -65
- package/src/controllers/ConnectionController.ts +14 -29
- 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 +35 -99
- package/src/controllers/OptionsController.ts +27 -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 +35 -8
- package/src/utils/FetchUtil.ts +10 -31
- package/src/utils/StorageUtil.ts +167 -105
- package/src/utils/SwapApiUtil.ts +27 -38
- package/src/utils/TypeUtil.ts +43 -198
- 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;
|
|
@@ -39,27 +23,10 @@ export type ConnectedWalletInfo =
|
|
|
39
23
|
}
|
|
40
24
|
| undefined;
|
|
41
25
|
|
|
42
|
-
export interface LinkingRecord {
|
|
43
|
-
redirect: string;
|
|
44
|
-
href: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
26
|
export type ProjectId = string;
|
|
48
27
|
|
|
49
28
|
export type Platform = 'mobile' | 'web' | 'qrcode' | 'email' | 'unsupported';
|
|
50
29
|
|
|
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
30
|
export type CaipNamespaces = Record<
|
|
64
31
|
string,
|
|
65
32
|
{
|
|
@@ -71,12 +38,9 @@ export type CaipNamespaces = Record<
|
|
|
71
38
|
|
|
72
39
|
export type SdkType = 'appkit';
|
|
73
40
|
|
|
74
|
-
export type SdkVersion =
|
|
75
|
-
| `react-native-wagmi-${string}`
|
|
76
|
-
| `react-native-ethers5-${string}`
|
|
77
|
-
| `react-native-ethers-${string}`;
|
|
41
|
+
export type SdkVersion = `react-native-${string}-${string}`;
|
|
78
42
|
|
|
79
|
-
type EnabledSocials =
|
|
43
|
+
type EnabledSocials = SocialProvider;
|
|
80
44
|
|
|
81
45
|
export type Features = {
|
|
82
46
|
/**
|
|
@@ -90,15 +54,10 @@ export type Features = {
|
|
|
90
54
|
*/
|
|
91
55
|
onramp?: boolean;
|
|
92
56
|
/**
|
|
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.
|
|
57
|
+
* @description Show or hide the regular wallet options when socials are enabled. Enabled by default.
|
|
99
58
|
* @type {boolean}
|
|
100
59
|
*/
|
|
101
|
-
|
|
60
|
+
showWallets?: boolean;
|
|
102
61
|
/**
|
|
103
62
|
* @description Enable or disable the socials feature. Enabled by default.
|
|
104
63
|
* @type {EnabledSocials[]}
|
|
@@ -160,7 +119,7 @@ export type RequestCache =
|
|
|
160
119
|
|
|
161
120
|
// -- BlockchainApiController Types ---------------------------------------------
|
|
162
121
|
export interface BlockchainApiIdentityRequest {
|
|
163
|
-
address: string
|
|
122
|
+
address: `0x${string}`;
|
|
164
123
|
}
|
|
165
124
|
|
|
166
125
|
export interface BlockchainApiIdentityResponse {
|
|
@@ -168,8 +127,22 @@ export interface BlockchainApiIdentityResponse {
|
|
|
168
127
|
name: string;
|
|
169
128
|
}
|
|
170
129
|
|
|
130
|
+
export interface BlockchainApiBalance {
|
|
131
|
+
name: string;
|
|
132
|
+
symbol: string;
|
|
133
|
+
chainId: string;
|
|
134
|
+
address?: CaipAddress;
|
|
135
|
+
value?: number;
|
|
136
|
+
price: number;
|
|
137
|
+
quantity: {
|
|
138
|
+
decimals: string;
|
|
139
|
+
numeric: string;
|
|
140
|
+
};
|
|
141
|
+
iconUrl: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
171
144
|
export interface BlockchainApiBalanceResponse {
|
|
172
|
-
balances:
|
|
145
|
+
balances: BlockchainApiBalance[];
|
|
173
146
|
}
|
|
174
147
|
|
|
175
148
|
export interface BlockchainApiTransactionsRequest {
|
|
@@ -179,6 +152,7 @@ export interface BlockchainApiTransactionsRequest {
|
|
|
179
152
|
onramp?: 'coinbase';
|
|
180
153
|
signal?: AbortSignal;
|
|
181
154
|
cache?: RequestCache;
|
|
155
|
+
chainId: CaipNetworkId;
|
|
182
156
|
}
|
|
183
157
|
|
|
184
158
|
export interface BlockchainApiTransactionsResponse {
|
|
@@ -192,9 +166,9 @@ export interface BlockchainApiSwapAllowanceResponse {
|
|
|
192
166
|
|
|
193
167
|
export interface BlockchainApiGenerateSwapCalldataRequest {
|
|
194
168
|
projectId: string;
|
|
195
|
-
userAddress:
|
|
196
|
-
from:
|
|
197
|
-
to:
|
|
169
|
+
userAddress: CaipAddress;
|
|
170
|
+
from: CaipAddress;
|
|
171
|
+
to: CaipAddress;
|
|
198
172
|
amount: string;
|
|
199
173
|
eip155?: {
|
|
200
174
|
slippage: string;
|
|
@@ -217,9 +191,9 @@ export interface BlockchainApiGenerateSwapCalldataResponse {
|
|
|
217
191
|
|
|
218
192
|
export interface BlockchainApiGenerateApproveCalldataRequest {
|
|
219
193
|
projectId: string;
|
|
220
|
-
userAddress:
|
|
221
|
-
from:
|
|
222
|
-
to:
|
|
194
|
+
userAddress: CaipAddress;
|
|
195
|
+
from: CaipAddress;
|
|
196
|
+
to: CaipAddress;
|
|
223
197
|
amount?: number;
|
|
224
198
|
}
|
|
225
199
|
|
|
@@ -239,7 +213,7 @@ export interface BlockchainApiGenerateApproveCalldataResponse {
|
|
|
239
213
|
export interface BlockchainApiTokenPriceRequest {
|
|
240
214
|
projectId: string;
|
|
241
215
|
currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
|
|
242
|
-
addresses:
|
|
216
|
+
addresses: CaipAddress[];
|
|
243
217
|
}
|
|
244
218
|
|
|
245
219
|
export interface BlockchainApiTokenPriceResponse {
|
|
@@ -253,13 +227,13 @@ export interface BlockchainApiTokenPriceResponse {
|
|
|
253
227
|
|
|
254
228
|
export interface BlockchainApiSwapAllowanceRequest {
|
|
255
229
|
projectId: string;
|
|
256
|
-
tokenAddress:
|
|
257
|
-
userAddress:
|
|
230
|
+
tokenAddress: CaipAddress;
|
|
231
|
+
userAddress: CaipAddress;
|
|
258
232
|
}
|
|
259
233
|
|
|
260
234
|
export interface BlockchainApiGasPriceRequest {
|
|
261
235
|
projectId: string;
|
|
262
|
-
chainId:
|
|
236
|
+
chainId: CaipNetworkId;
|
|
263
237
|
}
|
|
264
238
|
|
|
265
239
|
export interface BlockchainApiGasPriceResponse {
|
|
@@ -294,11 +268,11 @@ export interface BlockchainApiLookupEnsName {
|
|
|
294
268
|
|
|
295
269
|
export interface BlockchainApiSwapQuoteRequest {
|
|
296
270
|
projectId: string;
|
|
297
|
-
chainId?:
|
|
271
|
+
chainId?: CaipNetworkId;
|
|
298
272
|
amount: string;
|
|
299
|
-
userAddress:
|
|
300
|
-
from:
|
|
301
|
-
to:
|
|
273
|
+
userAddress: CaipAddress;
|
|
274
|
+
from: CaipAddress;
|
|
275
|
+
to: CaipAddress;
|
|
302
276
|
gasPrice: string;
|
|
303
277
|
}
|
|
304
278
|
|
|
@@ -314,17 +288,16 @@ export interface BlockchainApiSwapQuoteResponse {
|
|
|
314
288
|
|
|
315
289
|
export interface BlockchainApiSwapTokensRequest {
|
|
316
290
|
projectId: string;
|
|
317
|
-
chainId
|
|
291
|
+
chainId: CaipNetworkId;
|
|
318
292
|
}
|
|
319
293
|
|
|
320
294
|
export interface BlockchainApiOnRampQuotesRequest {
|
|
321
295
|
countryCode: string;
|
|
322
|
-
paymentMethodType
|
|
296
|
+
paymentMethodType: string;
|
|
323
297
|
destinationCurrencyCode: string;
|
|
324
298
|
sourceAmount: number;
|
|
325
299
|
sourceCurrencyCode: string;
|
|
326
300
|
walletAddress: string;
|
|
327
|
-
excludeProviders?: string[];
|
|
328
301
|
}
|
|
329
302
|
|
|
330
303
|
export interface BlockchainApiSwapTokensResponse {
|
|
@@ -347,31 +320,13 @@ export type BlockchainApiOnRampWidgetResponse = {
|
|
|
347
320
|
};
|
|
348
321
|
|
|
349
322
|
// -- 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
323
|
export type CustomWallet = Pick<
|
|
370
324
|
WcWallet,
|
|
371
325
|
| 'id'
|
|
372
326
|
| 'name'
|
|
373
327
|
| 'homepage'
|
|
374
328
|
| 'image_url'
|
|
329
|
+
| 'image_id'
|
|
375
330
|
| 'mobile_link'
|
|
376
331
|
| 'desktop_link'
|
|
377
332
|
| 'webapp_link'
|
|
@@ -397,9 +352,6 @@ export type EventName =
|
|
|
397
352
|
| 'CLICK_NETWORK_HELP'
|
|
398
353
|
| 'CLICK_GET_WALLET'
|
|
399
354
|
| 'EMAIL_LOGIN_SELECTED'
|
|
400
|
-
| 'EMAIL_SUBMITTED'
|
|
401
|
-
| 'DEVICE_REGISTERED_FOR_EMAIL'
|
|
402
|
-
| 'EMAIL_VERIFICATION_CODE_SENT'
|
|
403
355
|
| 'EMAIL_VERIFICATION_CODE_PASS'
|
|
404
356
|
| 'EMAIL_VERIFICATION_CODE_FAIL'
|
|
405
357
|
| 'EMAIL_EDIT'
|
|
@@ -462,7 +414,7 @@ export type Event =
|
|
|
462
414
|
type: 'track';
|
|
463
415
|
event: 'SWITCH_NETWORK';
|
|
464
416
|
properties: {
|
|
465
|
-
network: string;
|
|
417
|
+
network: number | string;
|
|
466
418
|
};
|
|
467
419
|
}
|
|
468
420
|
| {
|
|
@@ -514,18 +466,6 @@ export type Event =
|
|
|
514
466
|
type: 'track';
|
|
515
467
|
event: 'EMAIL_LOGIN_SELECTED';
|
|
516
468
|
}
|
|
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
469
|
| {
|
|
530
470
|
type: 'track';
|
|
531
471
|
event: 'EMAIL_VERIFICATION_CODE_PASS';
|
|
@@ -727,7 +667,7 @@ export type Event =
|
|
|
727
667
|
type: 'track';
|
|
728
668
|
event: 'SET_PREFERRED_ACCOUNT_TYPE';
|
|
729
669
|
properties: {
|
|
730
|
-
accountType:
|
|
670
|
+
accountType: AccountType;
|
|
731
671
|
network: string;
|
|
732
672
|
};
|
|
733
673
|
}
|
|
@@ -861,12 +801,6 @@ export type OnRampCountry = {
|
|
|
861
801
|
name: string;
|
|
862
802
|
};
|
|
863
803
|
|
|
864
|
-
export type OnRampCountryDefaults = {
|
|
865
|
-
countryCode: string;
|
|
866
|
-
defaultCurrencyCode: string;
|
|
867
|
-
defaultPaymentMethods: string[];
|
|
868
|
-
};
|
|
869
|
-
|
|
870
804
|
export type OnRampFiatCurrency = {
|
|
871
805
|
currencyCode: string;
|
|
872
806
|
name: string;
|
|
@@ -936,92 +870,3 @@ export type OnRampTransactionResult = {
|
|
|
936
870
|
status: string | null;
|
|
937
871
|
network: string | null;
|
|
938
872
|
};
|
|
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"}
|