@reown/appkit-core-react-native 1.0.1 → 1.1.0
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 +35 -1
- package/lib/commonjs/controllers/AccountController.js.map +1 -1
- package/lib/commonjs/controllers/ApiController.js +21 -9
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +84 -0
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionController.js +33 -7
- package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectorController.js +9 -1
- package/lib/commonjs/controllers/ConnectorController.js.map +1 -1
- package/lib/commonjs/controllers/EnsController.js +35 -0
- package/lib/commonjs/controllers/EnsController.js.map +1 -0
- package/lib/commonjs/controllers/EventsController.js +1 -15
- package/lib/commonjs/controllers/EventsController.js.map +1 -1
- package/lib/commonjs/controllers/ModalController.js +3 -1
- package/lib/commonjs/controllers/ModalController.js.map +1 -1
- package/lib/commonjs/controllers/NetworkController.js +20 -1
- package/lib/commonjs/controllers/NetworkController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +14 -2
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js +22 -1
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/SendController.js +176 -0
- package/lib/commonjs/controllers/SendController.js.map +1 -0
- package/lib/commonjs/controllers/SnackController.js +21 -1
- package/lib/commonjs/controllers/SnackController.js.map +1 -1
- package/lib/commonjs/controllers/SwapController.js +91 -0
- package/lib/commonjs/controllers/SwapController.js.map +1 -0
- package/lib/commonjs/controllers/TransactionsController.js +112 -0
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -0
- package/lib/commonjs/controllers/WebviewController.js +52 -0
- package/lib/commonjs/controllers/WebviewController.js.map +1 -0
- package/lib/commonjs/index.js +42 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ApiUtil.js +25 -0
- package/lib/commonjs/utils/ApiUtil.js.map +1 -0
- package/lib/commonjs/utils/ConstantsUtil.js +8 -1
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +33 -0
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/FetchUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js +24 -0
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapApiUtil.js +23 -0
- package/lib/commonjs/utils/SwapApiUtil.js.map +1 -0
- package/lib/commonjs/utils/SwapCalculationUtil.js +24 -0
- package/lib/commonjs/utils/SwapCalculationUtil.js.map +1 -0
- package/lib/commonjs/utils/TypeUtil.js +4 -0
- package/lib/module/controllers/AccountController.js +35 -1
- package/lib/module/controllers/AccountController.js.map +1 -1
- package/lib/module/controllers/ApiController.js +21 -9
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +84 -0
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionController.js +33 -7
- package/lib/module/controllers/ConnectionController.js.map +1 -1
- package/lib/module/controllers/ConnectorController.js +9 -1
- package/lib/module/controllers/ConnectorController.js.map +1 -1
- package/lib/module/controllers/EnsController.js +30 -0
- package/lib/module/controllers/EnsController.js.map +1 -0
- package/lib/module/controllers/EventsController.js +1 -15
- package/lib/module/controllers/EventsController.js.map +1 -1
- package/lib/module/controllers/ModalController.js +3 -1
- package/lib/module/controllers/ModalController.js.map +1 -1
- package/lib/module/controllers/NetworkController.js +20 -1
- package/lib/module/controllers/NetworkController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +14 -2
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js +22 -1
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/SendController.js +171 -0
- package/lib/module/controllers/SendController.js.map +1 -0
- package/lib/module/controllers/SnackController.js +21 -1
- package/lib/module/controllers/SnackController.js.map +1 -1
- package/lib/module/controllers/SwapController.js +86 -0
- package/lib/module/controllers/SwapController.js.map +1 -0
- package/lib/module/controllers/TransactionsController.js +107 -0
- package/lib/module/controllers/TransactionsController.js.map +1 -0
- package/lib/module/controllers/WebviewController.js +47 -0
- package/lib/module/controllers/WebviewController.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ApiUtil.js +19 -0
- package/lib/module/utils/ApiUtil.js.map +1 -0
- package/lib/module/utils/ConstantsUtil.js +8 -1
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +33 -0
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/FetchUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js +24 -0
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/module/utils/SwapApiUtil.js +17 -0
- package/lib/module/utils/SwapApiUtil.js.map +1 -0
- package/lib/module/utils/SwapCalculationUtil.js +19 -0
- package/lib/module/utils/SwapCalculationUtil.js.map +1 -0
- package/lib/module/utils/TypeUtil.js +1 -1
- package/lib/typescript/controllers/AccountController.d.ts +9 -1
- package/lib/typescript/controllers/AccountController.d.ts.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts +3 -1
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts +6 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +18 -1
- package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectorController.d.ts +1 -1
- package/lib/typescript/controllers/ConnectorController.d.ts.map +1 -1
- package/lib/typescript/controllers/EnsController.d.ts +10 -0
- package/lib/typescript/controllers/EnsController.d.ts.map +1 -0
- package/lib/typescript/controllers/EventsController.d.ts +0 -6
- package/lib/typescript/controllers/EventsController.d.ts.map +1 -1
- package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/NetworkController.d.ts +5 -0
- package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +6 -2
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +13 -1
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/SendController.d.ts +41 -0
- package/lib/typescript/controllers/SendController.d.ts.map +1 -0
- package/lib/typescript/controllers/SnackController.d.ts +7 -0
- package/lib/typescript/controllers/SnackController.d.ts.map +1 -1
- package/lib/typescript/controllers/SwapController.d.ts +29 -0
- package/lib/typescript/controllers/SwapController.d.ts.map +1 -0
- package/lib/typescript/controllers/TransactionsController.d.ts +21 -0
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -0
- package/lib/typescript/controllers/WebviewController.d.ts +21 -0
- package/lib/typescript/controllers/WebviewController.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +19 -26
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ApiUtil.d.ts +6 -0
- package/lib/typescript/utils/ApiUtil.d.ts.map +1 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts +3 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +6 -0
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +3 -0
- package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts +5 -1
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapApiUtil.d.ts +4 -0
- package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -0
- package/lib/typescript/utils/SwapCalculationUtil.d.ts +5 -0
- package/lib/typescript/utils/SwapCalculationUtil.d.ts.map +1 -0
- package/lib/typescript/utils/TypeUtil.d.ts +257 -4
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +5 -5
- package/readme.md +1 -1
- package/src/controllers/AccountController.ts +50 -2
- package/src/controllers/ApiController.ts +34 -23
- package/src/controllers/BlockchainApiController.ts +88 -1
- package/src/controllers/ConnectionController.ts +57 -8
- package/src/controllers/ConnectorController.ts +13 -1
- package/src/controllers/EnsController.ts +39 -0
- package/src/controllers/EventsController.ts +1 -13
- package/src/controllers/ModalController.ts +3 -1
- package/src/controllers/NetworkController.ts +34 -1
- package/src/controllers/OptionsController.ts +25 -4
- package/src/controllers/RouterController.ts +57 -10
- package/src/controllers/SendController.ts +234 -0
- package/src/controllers/SnackController.ts +28 -1
- package/src/controllers/SwapController.ts +108 -0
- package/src/controllers/TransactionsController.ts +142 -0
- package/src/controllers/WebviewController.ts +63 -0
- package/src/index.ts +43 -30
- package/src/utils/ApiUtil.ts +26 -0
- package/src/utils/ConstantsUtil.ts +13 -1
- package/src/utils/CoreHelperUtil.ts +38 -1
- package/src/utils/FetchUtil.ts +4 -0
- package/src/utils/StorageUtil.ts +31 -1
- package/src/utils/SwapApiUtil.ts +19 -0
- package/src/utils/SwapCalculationUtil.ts +21 -0
- package/src/utils/TypeUtil.ts +290 -4
package/src/utils/TypeUtil.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { type EventEmitter } from 'events';
|
|
2
|
+
import type { Balance, SocialProvider, Transaction } from '@reown/appkit-common-react-native';
|
|
3
|
+
|
|
4
|
+
export interface BaseError {
|
|
5
|
+
message?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
export type CaipAddress = `${string}:${string}:${string}`;
|
|
2
9
|
|
|
3
10
|
export type CaipNetworkId = `${string}:${string}`;
|
|
@@ -49,11 +56,33 @@ export type CaipNamespaces = Record<
|
|
|
49
56
|
}
|
|
50
57
|
>;
|
|
51
58
|
|
|
59
|
+
export type SdkType = 'appkit';
|
|
60
|
+
|
|
52
61
|
export type SdkVersion =
|
|
53
62
|
| `react-native-wagmi-${string}`
|
|
54
63
|
| `react-native-ethers5-${string}`
|
|
55
64
|
| `react-native-ethers-${string}`;
|
|
56
65
|
|
|
66
|
+
type EnabledSocials = Exclude<SocialProvider, 'farcaster'>;
|
|
67
|
+
|
|
68
|
+
export type Features = {
|
|
69
|
+
/**
|
|
70
|
+
* @description Enable or disable the email feature. Enabled by default.
|
|
71
|
+
* @type {boolean}
|
|
72
|
+
*/
|
|
73
|
+
email?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @description Show or hide the regular wallet options when email is enabled. Enabled by default.
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
*/
|
|
78
|
+
emailShowWallets?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @description Enable or disable the socials feature. Enabled by default.
|
|
81
|
+
* @type {EnabledSocials[]}
|
|
82
|
+
*/
|
|
83
|
+
socials?: EnabledSocials[] | false;
|
|
84
|
+
};
|
|
85
|
+
|
|
57
86
|
// -- ApiController Types -------------------------------------------------------
|
|
58
87
|
export interface WcWallet {
|
|
59
88
|
id: string;
|
|
@@ -98,6 +127,16 @@ export interface ApiGetAnalyticsConfigResponse {
|
|
|
98
127
|
isAnalyticsEnabled: boolean;
|
|
99
128
|
}
|
|
100
129
|
|
|
130
|
+
export type RequestCache =
|
|
131
|
+
| 'default'
|
|
132
|
+
| 'force-cache'
|
|
133
|
+
| 'no-cache'
|
|
134
|
+
| 'no-store'
|
|
135
|
+
| 'only-if-cached'
|
|
136
|
+
| 'reload';
|
|
137
|
+
|
|
138
|
+
// -- ThemeController Types ---------------------------------------------------
|
|
139
|
+
|
|
101
140
|
export type ThemeMode = 'dark' | 'light';
|
|
102
141
|
|
|
103
142
|
export interface ThemeVariables {
|
|
@@ -114,6 +153,74 @@ export interface BlockchainApiIdentityResponse {
|
|
|
114
153
|
name: string;
|
|
115
154
|
}
|
|
116
155
|
|
|
156
|
+
export interface BlockchainApiBalanceResponse {
|
|
157
|
+
balances: Balance[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface BlockchainApiTransactionsRequest {
|
|
161
|
+
account: string;
|
|
162
|
+
projectId: string;
|
|
163
|
+
cursor?: string;
|
|
164
|
+
onramp?: 'coinbase';
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
cache?: RequestCache;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface BlockchainApiTransactionsResponse {
|
|
170
|
+
data: Transaction[];
|
|
171
|
+
next: string | null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface BlockchainApiTokenPriceRequest {
|
|
175
|
+
projectId: string;
|
|
176
|
+
currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
|
|
177
|
+
addresses: string[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface BlockchainApiTokenPriceResponse {
|
|
181
|
+
fungibles: {
|
|
182
|
+
name: string;
|
|
183
|
+
symbol: string;
|
|
184
|
+
iconUrl: string;
|
|
185
|
+
price: number;
|
|
186
|
+
}[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface BlockchainApiGasPriceRequest {
|
|
190
|
+
projectId: string;
|
|
191
|
+
chainId: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface BlockchainApiGasPriceResponse {
|
|
195
|
+
standard: string;
|
|
196
|
+
fast: string;
|
|
197
|
+
instant: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface BlockchainApiEnsError extends BaseError {
|
|
201
|
+
status: string;
|
|
202
|
+
reasons: { name: string; description: string }[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type ReownName = `${string}.reown.id` | `${string}.wcn.id`;
|
|
206
|
+
|
|
207
|
+
export interface BlockchainApiLookupEnsName {
|
|
208
|
+
name: ReownName;
|
|
209
|
+
registered: number;
|
|
210
|
+
updated: number;
|
|
211
|
+
addresses: Record<
|
|
212
|
+
string,
|
|
213
|
+
{
|
|
214
|
+
address: string;
|
|
215
|
+
created: string;
|
|
216
|
+
}
|
|
217
|
+
>;
|
|
218
|
+
attributes: {
|
|
219
|
+
avatar?: string;
|
|
220
|
+
bio?: string;
|
|
221
|
+
}[];
|
|
222
|
+
}
|
|
223
|
+
|
|
117
224
|
// -- OptionsController Types ---------------------------------------------------
|
|
118
225
|
export interface Token {
|
|
119
226
|
address: string;
|
|
@@ -272,40 +379,204 @@ export type Event =
|
|
|
272
379
|
| {
|
|
273
380
|
type: 'track';
|
|
274
381
|
event: 'CLICK_SIGN_SIWE_MESSAGE';
|
|
382
|
+
properties: {
|
|
383
|
+
network: string;
|
|
384
|
+
isSmartAccount: boolean;
|
|
385
|
+
};
|
|
275
386
|
}
|
|
276
387
|
| {
|
|
277
388
|
type: 'track';
|
|
278
389
|
event: 'CLICK_CANCEL_SIWE';
|
|
390
|
+
properties: {
|
|
391
|
+
network: string;
|
|
392
|
+
isSmartAccount: boolean;
|
|
393
|
+
};
|
|
279
394
|
}
|
|
280
395
|
| {
|
|
281
396
|
type: 'track';
|
|
282
397
|
event: 'SIWE_AUTH_SUCCESS';
|
|
398
|
+
properties: {
|
|
399
|
+
network: string;
|
|
400
|
+
isSmartAccount: boolean;
|
|
401
|
+
};
|
|
283
402
|
}
|
|
284
403
|
| {
|
|
285
404
|
type: 'track';
|
|
286
405
|
event: 'SIWE_AUTH_ERROR';
|
|
406
|
+
properties: {
|
|
407
|
+
network: string;
|
|
408
|
+
isSmartAccount: boolean;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
| {
|
|
412
|
+
type: 'track';
|
|
413
|
+
event: 'CLICK_TRANSACTIONS';
|
|
414
|
+
properties: {
|
|
415
|
+
isSmartAccount: boolean;
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
| {
|
|
419
|
+
type: 'track';
|
|
420
|
+
event: 'ERROR_FETCH_TRANSACTIONS';
|
|
421
|
+
properties: {
|
|
422
|
+
address: string;
|
|
423
|
+
projectId: string;
|
|
424
|
+
cursor: string | undefined;
|
|
425
|
+
isSmartAccount: boolean;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
| {
|
|
429
|
+
type: 'track';
|
|
430
|
+
event: 'LOAD_MORE_TRANSACTIONS';
|
|
431
|
+
properties: {
|
|
432
|
+
address: string | undefined;
|
|
433
|
+
projectId: string;
|
|
434
|
+
cursor: string | undefined;
|
|
435
|
+
isSmartAccount: boolean;
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
| {
|
|
439
|
+
type: 'track';
|
|
440
|
+
event: 'OPEN_SEND';
|
|
441
|
+
properties: {
|
|
442
|
+
isSmartAccount: boolean;
|
|
443
|
+
network: string;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
| {
|
|
447
|
+
type: 'track';
|
|
448
|
+
event: 'SEND_INITIATED';
|
|
449
|
+
properties: {
|
|
450
|
+
isSmartAccount: boolean;
|
|
451
|
+
network: string;
|
|
452
|
+
token: string;
|
|
453
|
+
amount: number;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
| {
|
|
457
|
+
type: 'track';
|
|
458
|
+
event: 'SEND_SUCCESS';
|
|
459
|
+
properties: {
|
|
460
|
+
isSmartAccount: boolean;
|
|
461
|
+
network: string;
|
|
462
|
+
token: string;
|
|
463
|
+
amount: number;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
| {
|
|
467
|
+
type: 'track';
|
|
468
|
+
event: 'SEND_ERROR';
|
|
469
|
+
properties: {
|
|
470
|
+
isSmartAccount: boolean;
|
|
471
|
+
network: string;
|
|
472
|
+
token: string;
|
|
473
|
+
amount: number;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
| {
|
|
477
|
+
type: 'track';
|
|
478
|
+
event: 'SOCIAL_LOGIN_STARTED';
|
|
479
|
+
properties: {
|
|
480
|
+
provider: SocialProvider;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
| {
|
|
484
|
+
type: 'track';
|
|
485
|
+
event: 'SOCIAL_LOGIN_SUCCESS';
|
|
486
|
+
properties: {
|
|
487
|
+
provider: SocialProvider;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
| {
|
|
491
|
+
type: 'track';
|
|
492
|
+
event: 'SOCIAL_LOGIN_REQUEST_USER_DATA';
|
|
493
|
+
properties: {
|
|
494
|
+
provider: SocialProvider;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
| {
|
|
498
|
+
type: 'track';
|
|
499
|
+
event: 'SOCIAL_LOGIN_CANCELED';
|
|
500
|
+
properties: {
|
|
501
|
+
provider: SocialProvider;
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
| {
|
|
505
|
+
type: 'track';
|
|
506
|
+
event: 'SOCIAL_LOGIN_ERROR';
|
|
507
|
+
properties: {
|
|
508
|
+
provider: SocialProvider;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
| {
|
|
512
|
+
type: 'track';
|
|
513
|
+
event: 'SET_PREFERRED_ACCOUNT_TYPE';
|
|
514
|
+
properties: {
|
|
515
|
+
accountType: AppKitFrameAccountType;
|
|
516
|
+
network: string;
|
|
517
|
+
};
|
|
287
518
|
};
|
|
288
519
|
|
|
520
|
+
// -- Send Controller Types -------------------------------------
|
|
521
|
+
|
|
522
|
+
export interface SendTransactionArgs {
|
|
523
|
+
to: `0x${string}`;
|
|
524
|
+
data: `0x${string}`;
|
|
525
|
+
value: bigint;
|
|
526
|
+
gas?: bigint;
|
|
527
|
+
gasPrice: bigint;
|
|
528
|
+
address: `0x${string}`;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface WriteContractArgs {
|
|
532
|
+
receiverAddress: `0x${string}`;
|
|
533
|
+
tokenAmount: bigint;
|
|
534
|
+
tokenAddress: `0x${string}`;
|
|
535
|
+
fromAddress: `0x${string}`;
|
|
536
|
+
method: 'send' | 'transfer' | 'call';
|
|
537
|
+
abi: any;
|
|
538
|
+
}
|
|
539
|
+
|
|
289
540
|
// -- Email Types ------------------------------------------------
|
|
290
541
|
/**
|
|
291
|
-
* Matches type defined for packages/
|
|
542
|
+
* Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
|
|
292
543
|
* It's duplicated in order to decouple scaffold from email package
|
|
293
544
|
*/
|
|
545
|
+
|
|
546
|
+
export type AppKitFrameAccountType = 'eoa' | 'smartAccount';
|
|
547
|
+
|
|
294
548
|
export interface AppKitFrameProvider {
|
|
295
549
|
readonly id: string;
|
|
296
550
|
readonly name: string;
|
|
551
|
+
getEventEmitter(): EventEmitter;
|
|
297
552
|
getSecureSiteURL(): string;
|
|
298
553
|
getSecureSiteDashboardURL(): string;
|
|
299
554
|
getSecureSiteIconURL(): string;
|
|
300
555
|
getSecureSiteHeaders(): Record<string, string>;
|
|
301
|
-
getLoginEmailUsed(): Promise<boolean>;
|
|
302
556
|
getEmail(): string | undefined;
|
|
557
|
+
getUsername(): string | undefined;
|
|
558
|
+
getLastUsedChainId(): Promise<number | undefined>;
|
|
303
559
|
rejectRpcRequest(): void;
|
|
304
560
|
connectEmail(payload: { email: string }): Promise<{
|
|
305
561
|
action: 'VERIFY_DEVICE' | 'VERIFY_OTP';
|
|
306
562
|
}>;
|
|
307
563
|
connectDevice(): Promise<unknown>;
|
|
564
|
+
connectSocial(uri: string): Promise<{
|
|
565
|
+
chainId: string | number;
|
|
566
|
+
email: string;
|
|
567
|
+
address: string;
|
|
568
|
+
accounts?: {
|
|
569
|
+
type: AppKitFrameAccountType;
|
|
570
|
+
address: string;
|
|
571
|
+
}[];
|
|
572
|
+
userName?: string;
|
|
573
|
+
}>;
|
|
574
|
+
getSocialRedirectUri(payload: { provider: SocialProvider }): Promise<{
|
|
575
|
+
uri: string;
|
|
576
|
+
}>;
|
|
308
577
|
connectOtp(payload: { otp: string }): Promise<unknown>;
|
|
578
|
+
connectFarcaster: () => Promise<{ userName: string }>;
|
|
579
|
+
getFarcasterUri(): Promise<{ url: string }>;
|
|
309
580
|
isConnected(): Promise<{
|
|
310
581
|
isConnected: boolean;
|
|
311
582
|
}>;
|
|
@@ -326,17 +597,32 @@ export interface AppKitFrameProvider {
|
|
|
326
597
|
syncDappData(payload: {
|
|
327
598
|
projectId: string;
|
|
328
599
|
sdkVersion: SdkVersion;
|
|
600
|
+
sdkType: SdkType;
|
|
329
601
|
metadata?: Metadata;
|
|
330
602
|
}): Promise<unknown>;
|
|
331
603
|
connect(payload?: { chainId: number | undefined }): Promise<{
|
|
332
604
|
chainId: number;
|
|
333
|
-
email
|
|
605
|
+
email?: string | null;
|
|
334
606
|
address: string;
|
|
607
|
+
smartAccountDeployed: boolean;
|
|
608
|
+
preferredAccountType: AppKitFrameAccountType;
|
|
335
609
|
}>;
|
|
336
610
|
switchNetwork(chainId: number): Promise<{
|
|
337
611
|
chainId: number;
|
|
338
612
|
}>;
|
|
613
|
+
setPreferredAccount(type: AppKitFrameAccountType): Promise<{
|
|
614
|
+
type: AppKitFrameAccountType;
|
|
615
|
+
address: string;
|
|
616
|
+
}>;
|
|
617
|
+
setOnTimeout(callback: () => void): void;
|
|
618
|
+
getSmartAccountEnabledNetworks(): Promise<{
|
|
619
|
+
smartAccountEnabledNetworks: number[];
|
|
620
|
+
}>;
|
|
339
621
|
disconnect(): Promise<unknown>;
|
|
340
622
|
request(req: any): Promise<any>;
|
|
341
|
-
AuthView: () => JSX.Element | null;
|
|
623
|
+
AuthView: () => React.JSX.Element | null;
|
|
624
|
+
Webview: () => React.JSX.Element | null;
|
|
625
|
+
onSetPreferredAccount: (
|
|
626
|
+
callback: (values: { type: AppKitFrameAccountType; address: string }) => void
|
|
627
|
+
) => void;
|
|
342
628
|
}
|