@reown/appkit-core-react-native 0.0.0-fix-approved-networks-20250822000414 → 0.0.0-fix-ui-changes-20250828183750

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