@reown/appkit-core-react-native 2.0.0-alpha.1 → 2.0.0-alpha.3

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.
Files changed (228) hide show
  1. package/lib/commonjs/controllers/ApiController.js +16 -21
  2. package/lib/commonjs/controllers/ApiController.js.map +1 -1
  3. package/lib/commonjs/controllers/AssetController.js +0 -4
  4. package/lib/commonjs/controllers/AssetController.js.map +1 -1
  5. package/lib/commonjs/controllers/BlockchainApiController.js +102 -112
  6. package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
  7. package/lib/commonjs/controllers/ConnectionsController.js +248 -51
  8. package/lib/commonjs/controllers/ConnectionsController.js.map +1 -1
  9. package/lib/commonjs/controllers/EnsController.js +4 -4
  10. package/lib/commonjs/controllers/EnsController.js.map +1 -1
  11. package/lib/commonjs/controllers/EventsController.js +4 -4
  12. package/lib/commonjs/controllers/EventsController.js.map +1 -1
  13. package/lib/commonjs/controllers/ModalController.js +6 -7
  14. package/lib/commonjs/controllers/ModalController.js.map +1 -1
  15. package/lib/commonjs/controllers/OnRampController.js +117 -53
  16. package/lib/commonjs/controllers/OnRampController.js.map +1 -1
  17. package/lib/commonjs/controllers/OptionsController.js +10 -4
  18. package/lib/commonjs/controllers/OptionsController.js.map +1 -1
  19. package/lib/commonjs/controllers/PublicStateController.js.map +1 -1
  20. package/lib/commonjs/controllers/RouterController.js +6 -21
  21. package/lib/commonjs/controllers/RouterController.js.map +1 -1
  22. package/lib/commonjs/controllers/SendController.js +100 -100
  23. package/lib/commonjs/controllers/SendController.js.map +1 -1
  24. package/lib/commonjs/controllers/SnackController.js +29 -5
  25. package/lib/commonjs/controllers/SnackController.js.map +1 -1
  26. package/lib/commonjs/controllers/SwapController.js +109 -117
  27. package/lib/commonjs/controllers/SwapController.js.map +1 -1
  28. package/lib/commonjs/controllers/ThemeController.js.map +1 -1
  29. package/lib/commonjs/controllers/TransactionsController.js +23 -19
  30. package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
  31. package/lib/commonjs/controllers/WcController.js +73 -0
  32. package/lib/commonjs/controllers/WcController.js.map +1 -0
  33. package/lib/commonjs/index.js +3 -38
  34. package/lib/commonjs/index.js.map +1 -1
  35. package/lib/commonjs/package.json +1 -0
  36. package/lib/commonjs/utils/ApiUtil.js.map +1 -1
  37. package/lib/commonjs/utils/AssetUtil.js +6 -14
  38. package/lib/commonjs/utils/AssetUtil.js.map +1 -1
  39. package/lib/commonjs/utils/ConstantsUtil.js +13 -425
  40. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  41. package/lib/commonjs/utils/CoreHelperUtil.js +13 -8
  42. package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
  43. package/lib/commonjs/utils/EventUtil.js.map +1 -1
  44. package/lib/commonjs/utils/FetchUtil.js +34 -10
  45. package/lib/commonjs/utils/FetchUtil.js.map +1 -1
  46. package/lib/commonjs/utils/RouterUtil.js.map +1 -1
  47. package/lib/commonjs/utils/StorageUtil.js +77 -129
  48. package/lib/commonjs/utils/StorageUtil.js.map +1 -1
  49. package/lib/commonjs/utils/SwapApiUtil.js +2 -17
  50. package/lib/commonjs/utils/SwapApiUtil.js.map +1 -1
  51. package/lib/commonjs/utils/SwapCalculationUtil.js.map +1 -1
  52. package/lib/module/controllers/ApiController.js +17 -21
  53. package/lib/module/controllers/ApiController.js.map +1 -1
  54. package/lib/module/controllers/AssetController.js +2 -4
  55. package/lib/module/controllers/AssetController.js.map +1 -1
  56. package/lib/module/controllers/BlockchainApiController.js +103 -111
  57. package/lib/module/controllers/BlockchainApiController.js.map +1 -1
  58. package/lib/module/controllers/ConnectionsController.js +250 -51
  59. package/lib/module/controllers/ConnectionsController.js.map +1 -1
  60. package/lib/module/controllers/EnsController.js +4 -2
  61. package/lib/module/controllers/EnsController.js.map +1 -1
  62. package/lib/module/controllers/EventsController.js +3 -1
  63. package/lib/module/controllers/EventsController.js.map +1 -1
  64. package/lib/module/controllers/ModalController.js +8 -7
  65. package/lib/module/controllers/ModalController.js.map +1 -1
  66. package/lib/module/controllers/OnRampController.js +118 -52
  67. package/lib/module/controllers/OnRampController.js.map +1 -1
  68. package/lib/module/controllers/OptionsController.js +12 -4
  69. package/lib/module/controllers/OptionsController.js.map +1 -1
  70. package/lib/module/controllers/PublicStateController.js +2 -0
  71. package/lib/module/controllers/PublicStateController.js.map +1 -1
  72. package/lib/module/controllers/RouterController.js +8 -21
  73. package/lib/module/controllers/RouterController.js.map +1 -1
  74. package/lib/module/controllers/SendController.js +99 -97
  75. package/lib/module/controllers/SendController.js.map +1 -1
  76. package/lib/module/controllers/SnackController.js +31 -5
  77. package/lib/module/controllers/SnackController.js.map +1 -1
  78. package/lib/module/controllers/SwapController.js +111 -117
  79. package/lib/module/controllers/SwapController.js.map +1 -1
  80. package/lib/module/controllers/ThemeController.js +2 -0
  81. package/lib/module/controllers/ThemeController.js.map +1 -1
  82. package/lib/module/controllers/TransactionsController.js +23 -17
  83. package/lib/module/controllers/TransactionsController.js.map +1 -1
  84. package/lib/module/controllers/WcController.js +70 -0
  85. package/lib/module/controllers/WcController.js.map +1 -0
  86. package/lib/module/index.js +5 -6
  87. package/lib/module/index.js.map +1 -1
  88. package/lib/module/utils/ApiUtil.js +2 -0
  89. package/lib/module/utils/ApiUtil.js.map +1 -1
  90. package/lib/module/utils/AssetUtil.js +8 -14
  91. package/lib/module/utils/AssetUtil.js.map +1 -1
  92. package/lib/module/utils/ConstantsUtil.js +15 -425
  93. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  94. package/lib/module/utils/CoreHelperUtil.js +15 -6
  95. package/lib/module/utils/CoreHelperUtil.js.map +1 -1
  96. package/lib/module/utils/EventUtil.js +2 -0
  97. package/lib/module/utils/EventUtil.js.map +1 -1
  98. package/lib/module/utils/FetchUtil.js +36 -10
  99. package/lib/module/utils/FetchUtil.js.map +1 -1
  100. package/lib/module/utils/RouterUtil.js +2 -0
  101. package/lib/module/utils/RouterUtil.js.map +1 -1
  102. package/lib/module/utils/StorageUtil.js +80 -129
  103. package/lib/module/utils/StorageUtil.js.map +1 -1
  104. package/lib/module/utils/SwapApiUtil.js +4 -17
  105. package/lib/module/utils/SwapApiUtil.js.map +1 -1
  106. package/lib/module/utils/SwapCalculationUtil.js +3 -0
  107. package/lib/module/utils/SwapCalculationUtil.js.map +1 -1
  108. package/lib/typescript/controllers/ApiController.d.ts +3 -4
  109. package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
  110. package/lib/typescript/controllers/AssetController.d.ts +0 -2
  111. package/lib/typescript/controllers/AssetController.d.ts.map +1 -1
  112. package/lib/typescript/controllers/BlockchainApiController.d.ts +21 -13
  113. package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
  114. package/lib/typescript/controllers/ConnectionsController.d.ts +19 -17
  115. package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -1
  116. package/lib/typescript/controllers/EnsController.d.ts +1 -1
  117. package/lib/typescript/controllers/EventsController.d.ts +1 -1
  118. package/lib/typescript/controllers/EventsController.d.ts.map +1 -1
  119. package/lib/typescript/controllers/ModalController.d.ts +1 -1
  120. package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
  121. package/lib/typescript/controllers/OnRampController.d.ts +4 -3
  122. package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
  123. package/lib/typescript/controllers/OptionsController.d.ts +4 -4
  124. package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
  125. package/lib/typescript/controllers/RouterController.d.ts +5 -20
  126. package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
  127. package/lib/typescript/controllers/SendController.d.ts +5 -7
  128. package/lib/typescript/controllers/SendController.d.ts.map +1 -1
  129. package/lib/typescript/controllers/SnackController.d.ts +3 -3
  130. package/lib/typescript/controllers/SnackController.d.ts.map +1 -1
  131. package/lib/typescript/controllers/SwapController.d.ts +11 -11
  132. package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
  133. package/lib/typescript/controllers/TransactionsController.d.ts +3 -3
  134. package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
  135. package/lib/typescript/controllers/WcController.d.ts +27 -0
  136. package/lib/typescript/controllers/WcController.d.ts.map +1 -0
  137. package/lib/typescript/index.d.ts +1 -7
  138. package/lib/typescript/index.d.ts.map +1 -1
  139. package/lib/typescript/utils/AssetUtil.d.ts +2 -3
  140. package/lib/typescript/utils/AssetUtil.d.ts.map +1 -1
  141. package/lib/typescript/utils/ConstantsUtil.d.ts +7 -415
  142. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  143. package/lib/typescript/utils/CoreHelperUtil.d.ts +4 -4
  144. package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
  145. package/lib/typescript/utils/EventUtil.d.ts +1 -1
  146. package/lib/typescript/utils/EventUtil.d.ts.map +1 -1
  147. package/lib/typescript/utils/FetchUtil.d.ts +1 -1
  148. package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
  149. package/lib/typescript/utils/StorageUtil.d.ts +8 -19
  150. package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
  151. package/lib/typescript/utils/SwapApiUtil.d.ts +3 -4
  152. package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -1
  153. package/lib/typescript/utils/SwapCalculationUtil.d.ts +1 -1
  154. package/lib/typescript/utils/SwapCalculationUtil.d.ts.map +1 -1
  155. package/package.json +9 -23
  156. package/src/controllers/ApiController.ts +24 -28
  157. package/src/controllers/AssetController.ts +0 -6
  158. package/src/controllers/BlockchainApiController.ts +76 -121
  159. package/src/controllers/ConnectionsController.ts +308 -78
  160. package/src/controllers/EnsController.ts +3 -3
  161. package/src/controllers/EventsController.ts +2 -2
  162. package/src/controllers/ModalController.ts +7 -9
  163. package/src/controllers/OnRampController.ts +179 -82
  164. package/src/controllers/OptionsController.ts +24 -8
  165. package/src/controllers/RouterController.ts +12 -54
  166. package/src/controllers/SendController.ts +123 -112
  167. package/src/controllers/SnackController.ts +31 -5
  168. package/src/controllers/SwapController.ts +130 -146
  169. package/src/controllers/TransactionsController.ts +24 -18
  170. package/src/controllers/WcController.ts +93 -0
  171. package/src/index.ts +2 -21
  172. package/src/utils/AssetUtil.ts +7 -17
  173. package/src/utils/ConstantsUtil.ts +15 -429
  174. package/src/utils/CoreHelperUtil.ts +31 -8
  175. package/src/utils/EventUtil.ts +1 -1
  176. package/src/utils/FetchUtil.ts +38 -11
  177. package/src/utils/StorageUtil.ts +146 -157
  178. package/src/utils/SwapApiUtil.ts +18 -37
  179. package/src/utils/SwapCalculationUtil.ts +1 -2
  180. package/lib/commonjs/controllers/AccountController.js +0 -93
  181. package/lib/commonjs/controllers/AccountController.js.map +0 -1
  182. package/lib/commonjs/controllers/ConnectionController.js +0 -132
  183. package/lib/commonjs/controllers/ConnectionController.js.map +0 -1
  184. package/lib/commonjs/controllers/ConnectorController.js +0 -50
  185. package/lib/commonjs/controllers/ConnectorController.js.map +0 -1
  186. package/lib/commonjs/controllers/NetworkController.js +0 -90
  187. package/lib/commonjs/controllers/NetworkController.js.map +0 -1
  188. package/lib/commonjs/controllers/WebviewController.js +0 -52
  189. package/lib/commonjs/controllers/WebviewController.js.map +0 -1
  190. package/lib/commonjs/utils/NetworkUtil.js +0 -46
  191. package/lib/commonjs/utils/NetworkUtil.js.map +0 -1
  192. package/lib/commonjs/utils/TypeUtil.js +0 -6
  193. package/lib/commonjs/utils/TypeUtil.js.map +0 -1
  194. package/lib/module/controllers/AccountController.js +0 -88
  195. package/lib/module/controllers/AccountController.js.map +0 -1
  196. package/lib/module/controllers/ConnectionController.js +0 -127
  197. package/lib/module/controllers/ConnectionController.js.map +0 -1
  198. package/lib/module/controllers/ConnectorController.js +0 -45
  199. package/lib/module/controllers/ConnectorController.js.map +0 -1
  200. package/lib/module/controllers/NetworkController.js +0 -85
  201. package/lib/module/controllers/NetworkController.js.map +0 -1
  202. package/lib/module/controllers/WebviewController.js +0 -47
  203. package/lib/module/controllers/WebviewController.js.map +0 -1
  204. package/lib/module/utils/NetworkUtil.js +0 -40
  205. package/lib/module/utils/NetworkUtil.js.map +0 -1
  206. package/lib/module/utils/TypeUtil.js +0 -2
  207. package/lib/module/utils/TypeUtil.js.map +0 -1
  208. package/lib/typescript/controllers/AccountController.d.ts +0 -33
  209. package/lib/typescript/controllers/AccountController.d.ts.map +0 -1
  210. package/lib/typescript/controllers/ConnectionController.d.ts +0 -68
  211. package/lib/typescript/controllers/ConnectionController.d.ts.map +0 -1
  212. package/lib/typescript/controllers/ConnectorController.d.ts +0 -18
  213. package/lib/typescript/controllers/ConnectorController.d.ts.map +0 -1
  214. package/lib/typescript/controllers/NetworkController.d.ts +0 -34
  215. package/lib/typescript/controllers/NetworkController.d.ts.map +0 -1
  216. package/lib/typescript/controllers/WebviewController.d.ts +0 -21
  217. package/lib/typescript/controllers/WebviewController.d.ts.map +0 -1
  218. package/lib/typescript/utils/NetworkUtil.d.ts +0 -8
  219. package/lib/typescript/utils/NetworkUtil.d.ts.map +0 -1
  220. package/lib/typescript/utils/TypeUtil.d.ts +0 -817
  221. package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
  222. package/src/controllers/AccountController.ts +0 -128
  223. package/src/controllers/ConnectionController.ts +0 -208
  224. package/src/controllers/ConnectorController.ts +0 -64
  225. package/src/controllers/NetworkController.ts +0 -120
  226. package/src/controllers/WebviewController.ts +0 -63
  227. package/src/utils/NetworkUtil.ts +0 -33
  228. package/src/utils/TypeUtil.ts +0 -995
@@ -1,995 +0,0 @@
1
- import { type EventEmitter } from 'events';
2
- import type { CaipAddress, CaipNetworkId } from '@reown/appkit-common-react-native';
3
-
4
- import type {
5
- Balance,
6
- SocialProvider,
7
- ThemeMode,
8
- Transaction,
9
- ConnectorType,
10
- Metadata
11
- } from '@reown/appkit-common-react-native';
12
-
13
- import { OnRampErrorType } from './ConstantsUtil';
14
-
15
- export interface BaseError {
16
- message?: string;
17
- }
18
-
19
- export type ConnectedWalletInfo =
20
- | {
21
- name?: string;
22
- icon?: string;
23
- description?: string;
24
- url?: string;
25
- icons?: string[];
26
- redirect?: {
27
- native?: string;
28
- universal?: string;
29
- linkMode?: boolean;
30
- };
31
- [key: string]: unknown;
32
- }
33
- | undefined;
34
-
35
- export interface LinkingRecord {
36
- redirect: string;
37
- href: string;
38
- }
39
-
40
- export type ProjectId = string;
41
-
42
- export type Platform = 'mobile' | 'web' | 'qrcode' | 'email' | 'unsupported';
43
-
44
- export type Connector = {
45
- id: string;
46
- type: ConnectorType;
47
- name?: string;
48
- imageId?: string;
49
- explorerId?: string;
50
- imageUrl?: string;
51
- info?: { rdns?: string };
52
- provider?: unknown;
53
- installed?: boolean;
54
- };
55
-
56
- export type CaipNamespaces = Record<
57
- string,
58
- {
59
- chains: CaipNetworkId[];
60
- methods: string[];
61
- events: string[];
62
- }
63
- >;
64
-
65
- export type SdkType = 'appkit';
66
-
67
- export type SdkVersion =
68
- | `react-native-wagmi-${string}`
69
- | `react-native-ethers5-${string}`
70
- | `react-native-ethers-${string}`;
71
-
72
- type EnabledSocials = Exclude<SocialProvider, 'farcaster'>;
73
-
74
- export type Features = {
75
- /**
76
- * @description Enable or disable the swaps feature. Enabled by default.
77
- * @type {boolean}
78
- */
79
- swaps?: boolean;
80
- /**
81
- * @description Enable or disable the onramp feature. Enabled by default.
82
- * @type {boolean}
83
- */
84
- onramp?: boolean;
85
- /**
86
- * @description Enable or disable the email feature. Enabled by default.
87
- * @type {boolean}
88
- */
89
- email?: boolean;
90
- /**
91
- * @description Show or hide the regular wallet options when email is enabled. Enabled by default.
92
- * @type {boolean}
93
- */
94
- emailShowWallets?: boolean;
95
- /**
96
- * @description Enable or disable the socials feature. Enabled by default.
97
- * @type {EnabledSocials[]}
98
- */
99
- socials?: EnabledSocials[] | false;
100
- };
101
-
102
- // -- ApiController Types -------------------------------------------------------
103
- export interface WcWallet {
104
- id: string;
105
- name: string;
106
- homepage?: string;
107
- image_id?: string;
108
- image_url?: string;
109
- order?: number;
110
- mobile_link?: string | null;
111
- desktop_link?: string | null;
112
- webapp_link?: string | null;
113
- link_mode?: string | null;
114
- app_store?: string | null;
115
- play_store?: string | null;
116
- }
117
-
118
- export interface DataWallet {
119
- id: string;
120
- ios_schema?: string;
121
- android_app_id?: string;
122
- }
123
-
124
- export interface ApiGetWalletsRequest {
125
- page: number;
126
- entries: number;
127
- search?: string;
128
- include?: string[];
129
- exclude?: string[];
130
- }
131
-
132
- export interface ApiGetWalletsResponse {
133
- data: WcWallet[];
134
- count: number;
135
- }
136
-
137
- export interface ApiGetDataWalletsResponse {
138
- data: DataWallet[];
139
- count: number;
140
- }
141
-
142
- export interface ApiGetAnalyticsConfigResponse {
143
- isAnalyticsEnabled: boolean;
144
- }
145
-
146
- export type RequestCache =
147
- | 'default'
148
- | 'force-cache'
149
- | 'no-cache'
150
- | 'no-store'
151
- | 'only-if-cached'
152
- | 'reload';
153
-
154
- // -- BlockchainApiController Types ---------------------------------------------
155
- export interface BlockchainApiIdentityRequest {
156
- address: string;
157
- }
158
-
159
- export interface BlockchainApiIdentityResponse {
160
- avatar: string;
161
- name: string;
162
- }
163
-
164
- export interface BlockchainApiBalanceResponse {
165
- balances: Balance[];
166
- }
167
-
168
- export interface BlockchainApiTransactionsRequest {
169
- account: string;
170
- projectId: string;
171
- cursor?: string;
172
- onramp?: 'coinbase';
173
- signal?: AbortSignal;
174
- cache?: RequestCache;
175
- chainId?: CaipNetworkId;
176
- }
177
-
178
- export interface BlockchainApiTransactionsResponse {
179
- data: Transaction[];
180
- next: string | null;
181
- }
182
-
183
- export interface BlockchainApiSwapAllowanceResponse {
184
- allowance: string;
185
- }
186
-
187
- export interface BlockchainApiGenerateSwapCalldataRequest {
188
- projectId: string;
189
- userAddress: string;
190
- from: string;
191
- to: string;
192
- amount: string;
193
- eip155?: {
194
- slippage: string;
195
- permit?: string;
196
- };
197
- }
198
-
199
- export interface BlockchainApiGenerateSwapCalldataResponse {
200
- tx: {
201
- from: CaipAddress;
202
- to: CaipAddress;
203
- data: `0x${string}`;
204
- amount: string;
205
- eip155: {
206
- gas: string;
207
- gasPrice: string;
208
- };
209
- };
210
- }
211
-
212
- export interface BlockchainApiGenerateApproveCalldataRequest {
213
- projectId: string;
214
- userAddress: string;
215
- from: string;
216
- to: string;
217
- amount?: number;
218
- }
219
-
220
- export interface BlockchainApiGenerateApproveCalldataResponse {
221
- tx: {
222
- from: CaipAddress;
223
- to: CaipAddress;
224
- data: `0x${string}`;
225
- value: string;
226
- eip155: {
227
- gas: number;
228
- gasPrice: string;
229
- };
230
- };
231
- }
232
-
233
- export interface BlockchainApiTokenPriceRequest {
234
- projectId: string;
235
- currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
236
- addresses: string[];
237
- }
238
-
239
- export interface BlockchainApiTokenPriceResponse {
240
- fungibles: {
241
- name: string;
242
- symbol: string;
243
- iconUrl: string;
244
- price: number;
245
- }[];
246
- }
247
-
248
- export interface BlockchainApiSwapAllowanceRequest {
249
- projectId: string;
250
- tokenAddress: string;
251
- userAddress: string;
252
- }
253
-
254
- export interface BlockchainApiGasPriceRequest {
255
- projectId: string;
256
- chainId: string;
257
- }
258
-
259
- export interface BlockchainApiGasPriceResponse {
260
- standard: string;
261
- fast: string;
262
- instant: string;
263
- }
264
-
265
- export interface BlockchainApiEnsError extends BaseError {
266
- status: string;
267
- reasons: { name: string; description: string }[];
268
- }
269
-
270
- export type ReownName = `${string}.reown.id` | `${string}.wcn.id`;
271
-
272
- export interface BlockchainApiLookupEnsName {
273
- name: ReownName;
274
- registered: number;
275
- updated: number;
276
- addresses: Record<
277
- string,
278
- {
279
- address: string;
280
- created: string;
281
- }
282
- >;
283
- attributes: {
284
- avatar?: string;
285
- bio?: string;
286
- }[];
287
- }
288
-
289
- export interface BlockchainApiSwapQuoteRequest {
290
- projectId: string;
291
- chainId?: string;
292
- amount: string;
293
- userAddress: string;
294
- from: string;
295
- to: string;
296
- gasPrice: string;
297
- }
298
-
299
- export interface BlockchainApiSwapQuoteResponse {
300
- quotes: {
301
- id: string | null;
302
- fromAmount: string;
303
- fromAccount: string;
304
- toAmount: string;
305
- toAccount: string;
306
- }[];
307
- }
308
-
309
- export interface BlockchainApiSwapTokensRequest {
310
- projectId: string;
311
- chainId?: string;
312
- }
313
-
314
- export interface BlockchainApiOnRampQuotesRequest {
315
- countryCode: string;
316
- paymentMethodType: string;
317
- destinationCurrencyCode: string;
318
- sourceAmount: number;
319
- sourceCurrencyCode: string;
320
- walletAddress: string;
321
- }
322
-
323
- export interface BlockchainApiSwapTokensResponse {
324
- tokens: SwapToken[];
325
- }
326
-
327
- export interface BlockchainApiOnRampWidgetRequest {
328
- countryCode: string;
329
- destinationCurrencyCode: string;
330
- paymentMethodType: string;
331
- serviceProvider: string;
332
- sourceAmount: number;
333
- sourceCurrencyCode: string;
334
- walletAddress: string;
335
- redirectUrl?: string;
336
- }
337
-
338
- export type BlockchainApiOnRampWidgetResponse = {
339
- widgetUrl: string;
340
- };
341
-
342
- // -- OptionsController Types ---------------------------------------------------
343
- export type CustomWallet = Pick<
344
- WcWallet,
345
- | 'id'
346
- | 'name'
347
- | 'homepage'
348
- | 'image_url'
349
- | 'mobile_link'
350
- | 'desktop_link'
351
- | 'webapp_link'
352
- | 'link_mode'
353
- | 'app_store'
354
- | 'play_store'
355
- >;
356
-
357
- // -- EventsController Types ----------------------------------------------------
358
- export type EventName =
359
- | 'MODAL_LOADED'
360
- | 'MODAL_OPEN'
361
- | 'MODAL_CLOSE'
362
- | 'CLICK_ALL_WALLETS'
363
- | 'CLICK_NETWORKS'
364
- | 'SWITCH_NETWORK'
365
- | 'SELECT_WALLET'
366
- | 'CONNECT_SUCCESS'
367
- | 'CONNECT_ERROR'
368
- | 'DISCONNECT_SUCCESS'
369
- | 'DISCONNECT_ERROR'
370
- | 'CLICK_WALLET_HELP'
371
- | 'CLICK_NETWORK_HELP'
372
- | 'CLICK_GET_WALLET'
373
- | 'EMAIL_LOGIN_SELECTED'
374
- | 'EMAIL_SUBMITTED'
375
- | 'DEVICE_REGISTERED_FOR_EMAIL'
376
- | 'EMAIL_VERIFICATION_CODE_SENT'
377
- | 'EMAIL_VERIFICATION_CODE_PASS'
378
- | 'EMAIL_VERIFICATION_CODE_FAIL'
379
- | 'EMAIL_EDIT'
380
- | 'EMAIL_EDIT_COMPLETE'
381
- | 'EMAIL_UPGRADE_FROM_MODAL'
382
- | 'CLICK_SIGN_SIWE_MESSAGE'
383
- | 'CLICK_CANCEL_SIWE'
384
- | 'SIWE_AUTH_SUCCESS'
385
- | 'SIWE_AUTH_ERROR'
386
- | 'CLICK_TRANSACTIONS'
387
- | 'ERROR_FETCH_TRANSACTIONS'
388
- | 'LOAD_MORE_TRANSACTIONS'
389
- | 'OPEN_SEND'
390
- | 'OPEN_SWAP'
391
- | 'INITIATE_SWAP'
392
- | 'SWAP_SUCCESS'
393
- | 'SWAP_ERROR'
394
- | 'SEND_INITIATED'
395
- | 'SEND_SUCCESS'
396
- | 'SEND_ERROR'
397
- | 'SOCIAL_LOGIN_STARTED'
398
- | 'SOCIAL_LOGIN_SUCCESS'
399
- | 'SOCIAL_LOGIN_REQUEST_USER_DATA'
400
- | 'SOCIAL_LOGIN_CANCELED'
401
- | 'SOCIAL_LOGIN_ERROR'
402
- | 'SET_PREFERRED_ACCOUNT_TYPE';
403
-
404
- export type Event =
405
- | {
406
- type: 'track';
407
- event: 'MODAL_CREATED';
408
- }
409
- | {
410
- type: 'track';
411
- event: 'MODAL_LOADED';
412
- }
413
- | {
414
- type: 'track';
415
- event: 'MODAL_OPEN';
416
- properties: {
417
- connected: boolean;
418
- };
419
- }
420
- | {
421
- type: 'track';
422
- event: 'MODAL_CLOSE';
423
- properties: {
424
- connected: boolean;
425
- };
426
- }
427
- | {
428
- type: 'track';
429
- event: 'CLICK_ALL_WALLETS';
430
- }
431
- | {
432
- type: 'track';
433
- event: 'CLICK_NETWORKS';
434
- }
435
- | {
436
- type: 'track';
437
- event: 'SWITCH_NETWORK';
438
- properties: {
439
- network: number | string;
440
- };
441
- }
442
- | {
443
- type: 'track';
444
- event: 'SELECT_WALLET';
445
- properties: {
446
- name: string;
447
- platform?: Platform;
448
- explorer_id?: string;
449
- };
450
- }
451
- | {
452
- type: 'track';
453
- event: 'CONNECT_SUCCESS';
454
- properties: {
455
- name: string;
456
- method: Platform;
457
- explorer_id?: string;
458
- };
459
- }
460
- | {
461
- type: 'track';
462
- event: 'CONNECT_ERROR';
463
- properties: {
464
- message: string;
465
- };
466
- }
467
- | {
468
- type: 'track';
469
- event: 'DISCONNECT_SUCCESS';
470
- }
471
- | {
472
- type: 'track';
473
- event: 'DISCONNECT_ERROR';
474
- }
475
- | {
476
- type: 'track';
477
- event: 'CLICK_WALLET_HELP';
478
- }
479
- | {
480
- type: 'track';
481
- event: 'CLICK_NETWORK_HELP';
482
- }
483
- | {
484
- type: 'track';
485
- event: 'CLICK_GET_WALLET';
486
- }
487
- | {
488
- type: 'track';
489
- event: 'EMAIL_LOGIN_SELECTED';
490
- }
491
- | {
492
- type: 'track';
493
- event: 'EMAIL_SUBMITTED';
494
- }
495
- | {
496
- type: 'track';
497
- event: 'DEVICE_REGISTERED_FOR_EMAIL';
498
- }
499
- | {
500
- type: 'track';
501
- event: 'EMAIL_VERIFICATION_CODE_SENT';
502
- }
503
- | {
504
- type: 'track';
505
- event: 'EMAIL_VERIFICATION_CODE_PASS';
506
- }
507
- | {
508
- type: 'track';
509
- event: 'EMAIL_VERIFICATION_CODE_FAIL';
510
- }
511
- | {
512
- type: 'track';
513
- event: 'EMAIL_EDIT';
514
- }
515
- | {
516
- type: 'track';
517
- event: 'EMAIL_EDIT_COMPLETE';
518
- }
519
- | {
520
- type: 'track';
521
- event: 'EMAIL_UPGRADE_FROM_MODAL';
522
- }
523
- | {
524
- type: 'track';
525
- event: 'CLICK_SIGN_SIWE_MESSAGE';
526
- properties: {
527
- network: string;
528
- isSmartAccount: boolean;
529
- };
530
- }
531
- | {
532
- type: 'track';
533
- event: 'CLICK_CANCEL_SIWE';
534
- properties: {
535
- network: string;
536
- isSmartAccount: boolean;
537
- };
538
- }
539
- | {
540
- type: 'track';
541
- event: 'SIWE_AUTH_SUCCESS';
542
- properties: {
543
- network: string;
544
- isSmartAccount: boolean;
545
- };
546
- }
547
- | {
548
- type: 'track';
549
- event: 'SIWE_AUTH_ERROR';
550
- properties: {
551
- network: string;
552
- isSmartAccount: boolean;
553
- };
554
- }
555
- | {
556
- type: 'track';
557
- event: 'CLICK_TRANSACTIONS';
558
- properties: {
559
- isSmartAccount: boolean;
560
- };
561
- }
562
- | {
563
- type: 'track';
564
- event: 'ERROR_FETCH_TRANSACTIONS';
565
- properties: {
566
- address: string;
567
- projectId: string;
568
- cursor: string | undefined;
569
- isSmartAccount: boolean;
570
- };
571
- }
572
- | {
573
- type: 'track';
574
- event: 'LOAD_MORE_TRANSACTIONS';
575
- properties: {
576
- address: string | undefined;
577
- projectId: string;
578
- cursor: string | undefined;
579
- isSmartAccount: boolean;
580
- };
581
- }
582
- | {
583
- type: 'track';
584
- event: 'OPEN_SEND';
585
- properties: {
586
- isSmartAccount: boolean;
587
- network: string;
588
- };
589
- }
590
- | {
591
- type: 'track';
592
- event: 'OPEN_SWAP';
593
- properties: {
594
- isSmartAccount: boolean;
595
- network: string;
596
- };
597
- }
598
- | {
599
- type: 'track';
600
- event: 'INITIATE_SWAP';
601
- properties: {
602
- isSmartAccount: boolean;
603
- network: string;
604
- swapFromToken: string;
605
- swapToToken: string;
606
- swapFromAmount: string;
607
- swapToAmount: string;
608
- };
609
- }
610
- | {
611
- type: 'track';
612
- event: 'SWAP_SUCCESS';
613
- properties: {
614
- isSmartAccount: boolean;
615
- network: string;
616
- swapFromToken: string;
617
- swapToToken: string;
618
- swapFromAmount: string;
619
- swapToAmount: string;
620
- };
621
- }
622
- | {
623
- type: 'track';
624
- event: 'SWAP_ERROR';
625
- properties: {
626
- isSmartAccount: boolean;
627
- network: string;
628
- swapFromToken: string;
629
- swapToToken: string;
630
- swapFromAmount: string;
631
- swapToAmount: string;
632
- message: string;
633
- };
634
- }
635
- | {
636
- type: 'track';
637
- event: 'SEND_INITIATED';
638
- properties: {
639
- isSmartAccount: boolean;
640
- network: string;
641
- token: string;
642
- amount: number;
643
- };
644
- }
645
- | {
646
- type: 'track';
647
- event: 'SEND_SUCCESS';
648
- properties: {
649
- isSmartAccount: boolean;
650
- network: string;
651
- token: string;
652
- amount: number;
653
- };
654
- }
655
- | {
656
- type: 'track';
657
- event: 'SEND_ERROR';
658
- properties: {
659
- isSmartAccount: boolean;
660
- network: string;
661
- token: string;
662
- amount: number;
663
- };
664
- }
665
- | {
666
- type: 'track';
667
- event: 'SOCIAL_LOGIN_STARTED';
668
- properties: {
669
- provider: SocialProvider;
670
- };
671
- }
672
- | {
673
- type: 'track';
674
- event: 'SOCIAL_LOGIN_SUCCESS';
675
- properties: {
676
- provider: SocialProvider;
677
- };
678
- }
679
- | {
680
- type: 'track';
681
- event: 'SOCIAL_LOGIN_REQUEST_USER_DATA';
682
- properties: {
683
- provider: SocialProvider;
684
- };
685
- }
686
- | {
687
- type: 'track';
688
- event: 'SOCIAL_LOGIN_CANCELED';
689
- properties: {
690
- provider: SocialProvider;
691
- };
692
- }
693
- | {
694
- type: 'track';
695
- event: 'SOCIAL_LOGIN_ERROR';
696
- properties: {
697
- provider: SocialProvider;
698
- };
699
- }
700
- | {
701
- type: 'track';
702
- event: 'SET_PREFERRED_ACCOUNT_TYPE';
703
- properties: {
704
- accountType: AppKitFrameAccountType;
705
- network: string;
706
- };
707
- }
708
- | {
709
- type: 'track';
710
- event: 'SELECT_BUY_CRYPTO';
711
- }
712
- | {
713
- type: 'track';
714
- event: 'SELECT_BUY_ASSET';
715
- properties: {
716
- asset: string;
717
- };
718
- }
719
- | {
720
- type: 'track';
721
- event: 'BUY_SUBMITTED';
722
- properties: {
723
- asset?: string;
724
- network?: string;
725
- amount?: string;
726
- currency?: string;
727
- provider?: string;
728
- serviceProvider?: string;
729
- paymentMethod?: string;
730
- };
731
- }
732
- | {
733
- type: 'track';
734
- event: 'BUY_SUCCESS';
735
- properties: {
736
- asset?: string | null;
737
- network?: string | null;
738
- amount?: string | null;
739
- currency?: string | null;
740
- provider?: string | null;
741
- orderId?: string | null;
742
- };
743
- }
744
- | {
745
- type: 'track';
746
- event: 'BUY_FAIL';
747
- properties: {
748
- asset?: string;
749
- network?: string;
750
- amount?: string;
751
- currency?: string;
752
- provider?: string;
753
- serviceProvider?: string;
754
- paymentMethod?: string;
755
- message?: string;
756
- };
757
- }
758
- | {
759
- type: 'track';
760
- event: 'BUY_CANCEL';
761
- properties?: {
762
- message?: string;
763
- };
764
- };
765
-
766
- // -- Send Controller Types -------------------------------------
767
- export type EstimateGasTransactionArgs = {
768
- chainNamespace?: 'eip155';
769
- address: `0x${string}`;
770
- to: `0x${string}`;
771
- data: `0x${string}`;
772
- };
773
-
774
- export interface SendTransactionArgs {
775
- to: `0x${string}`;
776
- data: `0x${string}`;
777
- value: bigint;
778
- gas?: bigint;
779
- gasPrice: bigint;
780
- address: `0x${string}`;
781
- chainNamespace?: 'eip155';
782
- }
783
-
784
- export interface WriteContractArgs {
785
- receiverAddress: `0x${string}`;
786
- tokenAmount: bigint;
787
- tokenAddress: `0x${string}`;
788
- fromAddress: `0x${string}`;
789
- method: 'send' | 'transfer' | 'call';
790
- abi: any;
791
- }
792
-
793
- // -- Swap Controller Types -------------------------------------
794
- export type SwapToken = {
795
- name: string;
796
- symbol: string;
797
- address: CaipAddress;
798
- decimals: number;
799
- logoUri: string;
800
- eip2612?: boolean;
801
- };
802
-
803
- export type SwapTokenWithBalance = SwapToken & {
804
- quantity: {
805
- decimals: string;
806
- numeric: string;
807
- };
808
- price: number;
809
- value: number;
810
- };
811
-
812
- export type SwapInputTarget = 'sourceToken' | 'toToken';
813
-
814
- // -- OnRamp Controller Types ------------------------------------------------
815
- export type OnRampErrorTypeValues = (typeof OnRampErrorType)[keyof typeof OnRampErrorType];
816
-
817
- export interface OnRampError {
818
- type: OnRampErrorTypeValues;
819
- message: string;
820
- }
821
-
822
- export type OnRampPaymentMethod = {
823
- logos: {
824
- dark: string;
825
- light: string;
826
- };
827
- name: string;
828
- paymentMethod: string;
829
- paymentType: string;
830
- };
831
-
832
- export type OnRampCountry = {
833
- countryCode: string;
834
- flagImageUrl: string;
835
- name: string;
836
- };
837
-
838
- export type OnRampFiatCurrency = {
839
- currencyCode: string;
840
- name: string;
841
- symbolImageUrl: string;
842
- };
843
-
844
- export type OnRampCryptoCurrency = {
845
- currencyCode: string;
846
- name: string;
847
- chainCode: string;
848
- chainName: string;
849
- chainId: string;
850
- contractAddress: string | null;
851
- symbolImageUrl: string;
852
- };
853
-
854
- export type OnRampQuote = {
855
- countryCode: string;
856
- customerScore: number;
857
- destinationAmount: number;
858
- destinationAmountWithoutFees: number;
859
- destinationCurrencyCode: string;
860
- exchangeRate: number;
861
- fiatAmountWithoutFees: number;
862
- lowKyc: boolean;
863
- networkFee: number;
864
- paymentMethodType: string;
865
- serviceProvider: string;
866
- sourceAmount: number;
867
- sourceAmountWithoutFees: number;
868
- sourceCurrencyCode: string;
869
- totalFee: number;
870
- transactionFee: number;
871
- transactionType: string;
872
- };
873
-
874
- export type OnRampServiceProvider = {
875
- categories: string[];
876
- categoryStatuses: {
877
- additionalProp: string;
878
- };
879
- logos: {
880
- dark: string;
881
- darkShort: string;
882
- light: string;
883
- lightShort: string;
884
- };
885
- name: string;
886
- serviceProvider: string;
887
- status: string;
888
- websiteUrl: string;
889
- };
890
-
891
- export type OnRampFiatLimit = {
892
- currencyCode: string;
893
- defaultAmount: number | null;
894
- minimumAmount: number;
895
- maximumAmount: number;
896
- };
897
-
898
- export type OnRampTransactionResult = {
899
- purchaseCurrency: string | null;
900
- purchaseAmount: string | null;
901
- purchaseImageUrl: string | null;
902
- paymentCurrency: string | null;
903
- paymentAmount: string | null;
904
- status: string | null;
905
- network: string | null;
906
- };
907
-
908
- // -- Email Types ------------------------------------------------
909
- /**
910
- * Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
911
- * It's duplicated in order to decouple scaffold from email package
912
- */
913
-
914
- export type AppKitFrameAccountType = 'eoa' | 'smartAccount';
915
-
916
- export interface AppKitFrameProvider {
917
- readonly id: string;
918
- readonly name: string;
919
- getEventEmitter(): EventEmitter;
920
- getSecureSiteURL(): string;
921
- getSecureSiteDashboardURL(): string;
922
- getSecureSiteIconURL(): string;
923
- getEmail(): string | undefined;
924
- getUsername(): string | undefined;
925
- getLastUsedChainId(): Promise<number | undefined>;
926
- rejectRpcRequest(): void;
927
- connectEmail(payload: { email: string }): Promise<{
928
- action: 'VERIFY_DEVICE' | 'VERIFY_OTP';
929
- }>;
930
- connectDevice(): Promise<unknown>;
931
- connectSocial(uri: string): Promise<{
932
- chainId: string | number;
933
- email: string;
934
- address: string;
935
- accounts?: {
936
- type: AppKitFrameAccountType;
937
- address: string;
938
- }[];
939
- userName?: string;
940
- }>;
941
- getSocialRedirectUri(payload: { provider: SocialProvider }): Promise<{
942
- uri: string;
943
- }>;
944
- connectOtp(payload: { otp: string }): Promise<unknown>;
945
- connectFarcaster: () => Promise<{ userName: string }>;
946
- getFarcasterUri(): Promise<{ url: string }>;
947
- isConnected(): Promise<{
948
- isConnected: boolean;
949
- }>;
950
- getChainId(): Promise<{
951
- chainId: number;
952
- }>;
953
- updateEmail(payload: { email: string }): Promise<{
954
- action: 'VERIFY_PRIMARY_OTP' | 'VERIFY_SECONDARY_OTP';
955
- }>;
956
- updateEmailPrimaryOtp(payload: { otp: string }): Promise<unknown>;
957
- updateEmailSecondaryOtp(payload: { otp: string }): Promise<{
958
- newEmail: string;
959
- }>;
960
- syncTheme(payload: {
961
- themeMode: ThemeMode | undefined;
962
- themeVariables: Record<string, string | number> | undefined;
963
- }): Promise<unknown>;
964
- syncDappData(payload: {
965
- projectId: string;
966
- sdkVersion: SdkVersion;
967
- sdkType: SdkType;
968
- metadata?: Metadata;
969
- }): Promise<unknown>;
970
- connect(payload?: { chainId: number | undefined }): Promise<{
971
- chainId: number;
972
- email?: string | null;
973
- address: string;
974
- smartAccountDeployed: boolean;
975
- preferredAccountType: AppKitFrameAccountType;
976
- }>;
977
- switchNetwork(chainId: number): Promise<{
978
- chainId: number;
979
- }>;
980
- setPreferredAccount(type: AppKitFrameAccountType): Promise<{
981
- type: AppKitFrameAccountType;
982
- address: string;
983
- }>;
984
- setOnTimeout(callback: () => void): void;
985
- getSmartAccountEnabledNetworks(): Promise<{
986
- smartAccountEnabledNetworks: number[];
987
- }>;
988
- disconnect(): Promise<unknown>;
989
- request(req: any): Promise<any>;
990
- AuthView: () => React.JSX.Element | null;
991
- Webview: () => React.JSX.Element | null;
992
- onSetPreferredAccount: (
993
- callback: (values: { type: AppKitFrameAccountType; address: string }) => void
994
- ) => void;
995
- }