@reown/appkit-common-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 (291) hide show
  1. package/lib/commonjs/adapters/BlockchainAdapter.js +28 -13
  2. package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -1
  3. package/lib/commonjs/adapters/EvmAdapter.js +126 -16
  4. package/lib/commonjs/adapters/EvmAdapter.js.map +1 -1
  5. package/lib/commonjs/adapters/SolanaBaseAdapter.js +1 -3
  6. package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -1
  7. package/lib/commonjs/contracts/erc20.js.map +1 -1
  8. package/lib/commonjs/contracts/usdt.js.map +1 -1
  9. package/lib/commonjs/index.js +4 -4
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/networks/bitcoin.js.map +1 -1
  12. package/lib/commonjs/networks/solana.js.map +1 -1
  13. package/lib/commonjs/package.json +1 -0
  14. package/lib/commonjs/types/api/blockchain-api.js +15 -0
  15. package/lib/commonjs/types/api/blockchain-api.js.map +1 -0
  16. package/lib/commonjs/types/api/events.js +6 -0
  17. package/lib/commonjs/types/api/events.js.map +1 -0
  18. package/lib/commonjs/types/api/index.js +39 -0
  19. package/lib/commonjs/types/api/index.js.map +1 -0
  20. package/lib/commonjs/types/api/wallet-api.js +2 -0
  21. package/lib/commonjs/types/api/wallet-api.js.map +1 -0
  22. package/lib/commonjs/types/blockchain/adapter.js +6 -0
  23. package/lib/commonjs/types/blockchain/adapter.js.map +1 -0
  24. package/lib/commonjs/types/blockchain/balance.js +6 -0
  25. package/lib/commonjs/types/blockchain/balance.js.map +1 -0
  26. package/lib/commonjs/types/blockchain/index.js +50 -0
  27. package/lib/commonjs/types/blockchain/index.js.map +1 -0
  28. package/lib/commonjs/types/blockchain/network.js +6 -0
  29. package/lib/commonjs/types/blockchain/network.js.map +1 -0
  30. package/lib/commonjs/types/blockchain/transaction.js +2 -0
  31. package/lib/commonjs/types/blockchain/transaction.js.map +1 -0
  32. package/lib/commonjs/types/common.js +2 -0
  33. package/lib/commonjs/types/common.js.map +1 -0
  34. package/lib/commonjs/types/index.js +105 -0
  35. package/lib/commonjs/types/index.js.map +1 -0
  36. package/lib/commonjs/types/onramp/countries.js +2 -0
  37. package/lib/commonjs/types/onramp/countries.js.map +1 -0
  38. package/lib/commonjs/types/onramp/currencies.js +2 -0
  39. package/lib/commonjs/types/onramp/currencies.js.map +1 -0
  40. package/lib/commonjs/types/onramp/errors.js +22 -0
  41. package/lib/commonjs/types/onramp/errors.js.map +1 -0
  42. package/lib/commonjs/types/onramp/index.js +50 -0
  43. package/lib/commonjs/types/onramp/index.js.map +1 -0
  44. package/lib/commonjs/types/onramp/quotes.js +2 -0
  45. package/lib/commonjs/types/onramp/quotes.js.map +1 -0
  46. package/lib/commonjs/types/siwe/config.js +6 -0
  47. package/lib/commonjs/types/siwe/config.js.map +1 -0
  48. package/lib/commonjs/types/siwe/index.js +28 -0
  49. package/lib/commonjs/types/siwe/index.js.map +1 -0
  50. package/lib/commonjs/types/siwe/message.js +6 -0
  51. package/lib/commonjs/types/siwe/message.js.map +1 -0
  52. package/lib/commonjs/types/storage.js +2 -0
  53. package/lib/commonjs/types/storage.js.map +1 -0
  54. package/lib/commonjs/types/swap/index.js +17 -0
  55. package/lib/commonjs/types/swap/index.js.map +1 -0
  56. package/lib/commonjs/types/swap/tokens.js +6 -0
  57. package/lib/commonjs/types/swap/tokens.js.map +1 -0
  58. package/lib/commonjs/types/ui.js +6 -0
  59. package/lib/commonjs/types/ui.js.map +1 -0
  60. package/lib/commonjs/types/wallet/connection.js +6 -0
  61. package/lib/commonjs/types/wallet/connection.js.map +1 -0
  62. package/lib/commonjs/{utils/TypeUtil.js → types/wallet/connector.js} +7 -13
  63. package/lib/commonjs/types/wallet/connector.js.map +1 -0
  64. package/lib/commonjs/types/wallet/index.js +39 -0
  65. package/lib/commonjs/types/wallet/index.js.map +1 -0
  66. package/lib/commonjs/types/wallet/wallet-info.js +6 -0
  67. package/lib/commonjs/types/wallet/wallet-info.js.map +1 -0
  68. package/lib/commonjs/utils/ConstantsUtil.js +34 -6
  69. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  70. package/lib/commonjs/utils/ContractUtil.js.map +1 -1
  71. package/lib/commonjs/utils/DateUtil.js.map +1 -1
  72. package/lib/commonjs/utils/ErrorUtil.js +2 -2
  73. package/lib/commonjs/utils/ErrorUtil.js.map +1 -1
  74. package/lib/commonjs/utils/NamesUtil.js.map +1 -1
  75. package/lib/commonjs/utils/NetworkUtil.js +3 -0
  76. package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
  77. package/lib/commonjs/utils/NumberUtil.js +1 -2
  78. package/lib/commonjs/utils/NumberUtil.js.map +1 -1
  79. package/lib/commonjs/utils/PresetsUtil.js +0 -18
  80. package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
  81. package/lib/commonjs/utils/StringUtil.js +7 -0
  82. package/lib/commonjs/utils/StringUtil.js.map +1 -1
  83. package/lib/module/adapters/BlockchainAdapter.js +30 -13
  84. package/lib/module/adapters/BlockchainAdapter.js.map +1 -1
  85. package/lib/module/adapters/EvmAdapter.js +129 -16
  86. package/lib/module/adapters/EvmAdapter.js.map +1 -1
  87. package/lib/module/adapters/SolanaBaseAdapter.js +3 -3
  88. package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -1
  89. package/lib/module/contracts/erc20.js +2 -0
  90. package/lib/module/contracts/erc20.js.map +1 -1
  91. package/lib/module/contracts/usdt.js +2 -0
  92. package/lib/module/contracts/usdt.js.map +1 -1
  93. package/lib/module/index.js +3 -1
  94. package/lib/module/index.js.map +1 -1
  95. package/lib/module/networks/bitcoin.js +2 -0
  96. package/lib/module/networks/bitcoin.js.map +1 -1
  97. package/lib/module/networks/solana.js +2 -0
  98. package/lib/module/networks/solana.js.map +1 -1
  99. package/lib/module/types/api/blockchain-api.js +10 -0
  100. package/lib/module/types/api/blockchain-api.js.map +1 -0
  101. package/lib/module/types/api/events.js +4 -0
  102. package/lib/module/types/api/events.js.map +1 -0
  103. package/lib/module/types/api/index.js +7 -0
  104. package/lib/module/types/api/index.js.map +1 -0
  105. package/lib/module/types/api/wallet-api.js +2 -0
  106. package/lib/module/types/api/wallet-api.js.map +1 -0
  107. package/lib/module/types/blockchain/adapter.js +4 -0
  108. package/lib/module/types/blockchain/adapter.js.map +1 -0
  109. package/lib/module/types/blockchain/balance.js +4 -0
  110. package/lib/module/types/blockchain/balance.js.map +1 -0
  111. package/lib/module/types/blockchain/index.js +8 -0
  112. package/lib/module/types/blockchain/index.js.map +1 -0
  113. package/lib/module/types/blockchain/network.js +4 -0
  114. package/lib/module/types/blockchain/network.js.map +1 -0
  115. package/lib/module/types/blockchain/transaction.js +2 -0
  116. package/lib/module/types/blockchain/transaction.js.map +1 -0
  117. package/lib/module/types/common.js +2 -0
  118. package/lib/module/types/common.js.map +1 -0
  119. package/lib/module/types/index.js +31 -0
  120. package/lib/module/types/index.js.map +1 -0
  121. package/lib/module/types/onramp/countries.js +2 -0
  122. package/lib/module/types/onramp/countries.js.map +1 -0
  123. package/lib/module/types/onramp/currencies.js +2 -0
  124. package/lib/module/types/onramp/currencies.js.map +1 -0
  125. package/lib/module/types/onramp/errors.js +18 -0
  126. package/lib/module/types/onramp/errors.js.map +1 -0
  127. package/lib/module/types/onramp/index.js +8 -0
  128. package/lib/module/types/onramp/index.js.map +1 -0
  129. package/lib/module/types/onramp/quotes.js +2 -0
  130. package/lib/module/types/onramp/quotes.js.map +1 -0
  131. package/lib/module/types/siwe/config.js +4 -0
  132. package/lib/module/types/siwe/config.js.map +1 -0
  133. package/lib/module/types/siwe/index.js +6 -0
  134. package/lib/module/types/siwe/index.js.map +1 -0
  135. package/lib/module/types/siwe/message.js +4 -0
  136. package/lib/module/types/siwe/message.js.map +1 -0
  137. package/lib/module/types/storage.js +2 -0
  138. package/lib/module/types/storage.js.map +1 -0
  139. package/lib/module/types/swap/index.js +5 -0
  140. package/lib/module/types/swap/index.js.map +1 -0
  141. package/lib/module/types/swap/tokens.js +4 -0
  142. package/lib/module/types/swap/tokens.js.map +1 -0
  143. package/lib/module/types/ui.js +4 -0
  144. package/lib/module/types/ui.js.map +1 -0
  145. package/lib/module/types/wallet/connection.js +4 -0
  146. package/lib/module/types/wallet/connection.js.map +1 -0
  147. package/lib/module/{utils/TypeUtil.js → types/wallet/connector.js} +9 -14
  148. package/lib/module/types/wallet/connector.js.map +1 -0
  149. package/lib/module/types/wallet/index.js +7 -0
  150. package/lib/module/types/wallet/index.js.map +1 -0
  151. package/lib/module/types/wallet/wallet-info.js +4 -0
  152. package/lib/module/types/wallet/wallet-info.js.map +1 -0
  153. package/lib/module/utils/ConstantsUtil.js +36 -6
  154. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  155. package/lib/module/utils/ContractUtil.js +2 -0
  156. package/lib/module/utils/ContractUtil.js.map +1 -1
  157. package/lib/module/utils/DateUtil.js +2 -0
  158. package/lib/module/utils/DateUtil.js.map +1 -1
  159. package/lib/module/utils/ErrorUtil.js +4 -2
  160. package/lib/module/utils/ErrorUtil.js.map +1 -1
  161. package/lib/module/utils/NamesUtil.js +2 -0
  162. package/lib/module/utils/NamesUtil.js.map +1 -1
  163. package/lib/module/utils/NetworkUtil.js +5 -0
  164. package/lib/module/utils/NetworkUtil.js.map +1 -1
  165. package/lib/module/utils/NumberUtil.js +2 -0
  166. package/lib/module/utils/NumberUtil.js.map +1 -1
  167. package/lib/module/utils/PresetsUtil.js +2 -18
  168. package/lib/module/utils/PresetsUtil.js.map +1 -1
  169. package/lib/module/utils/StringUtil.js +9 -0
  170. package/lib/module/utils/StringUtil.js.map +1 -1
  171. package/lib/typescript/adapters/BlockchainAdapter.d.ts +6 -7
  172. package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -1
  173. package/lib/typescript/adapters/EvmAdapter.d.ts +21 -1
  174. package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -1
  175. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +2 -0
  176. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -1
  177. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +2 -0
  178. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +1 -0
  179. package/lib/typescript/index.d.ts +1 -1
  180. package/lib/typescript/index.d.ts.map +1 -1
  181. package/lib/typescript/networks/bitcoin.d.ts +1 -1
  182. package/lib/typescript/networks/bitcoin.d.ts.map +1 -1
  183. package/lib/typescript/networks/solana.d.ts +1 -1
  184. package/lib/typescript/networks/solana.d.ts.map +1 -1
  185. package/lib/typescript/types/api/blockchain-api.d.ts +183 -0
  186. package/lib/typescript/types/api/blockchain-api.d.ts.map +1 -0
  187. package/lib/typescript/types/api/events.d.ts +304 -0
  188. package/lib/typescript/types/api/events.d.ts.map +1 -0
  189. package/lib/typescript/types/api/index.d.ts +4 -0
  190. package/lib/typescript/types/api/index.d.ts.map +1 -0
  191. package/lib/typescript/types/api/wallet-api.d.ts +45 -0
  192. package/lib/typescript/types/api/wallet-api.d.ts.map +1 -0
  193. package/lib/typescript/types/blockchain/adapter.d.ts +40 -0
  194. package/lib/typescript/types/blockchain/adapter.d.ts.map +1 -0
  195. package/lib/typescript/types/blockchain/balance.d.ts +28 -0
  196. package/lib/typescript/types/blockchain/balance.d.ts.map +1 -0
  197. package/lib/typescript/types/blockchain/index.d.ts +5 -0
  198. package/lib/typescript/types/blockchain/index.d.ts.map +1 -0
  199. package/lib/typescript/types/blockchain/network.d.ts +47 -0
  200. package/lib/typescript/types/blockchain/network.d.ts.map +1 -0
  201. package/lib/typescript/types/blockchain/transaction.d.ts +63 -0
  202. package/lib/typescript/types/blockchain/transaction.d.ts.map +1 -0
  203. package/lib/typescript/types/common.d.ts +24 -0
  204. package/lib/typescript/types/common.d.ts.map +1 -0
  205. package/lib/typescript/types/index.d.ts +10 -0
  206. package/lib/typescript/types/index.d.ts.map +1 -0
  207. package/lib/typescript/types/onramp/countries.d.ts +11 -0
  208. package/lib/typescript/types/onramp/countries.d.ts.map +1 -0
  209. package/lib/typescript/types/onramp/currencies.d.ts +30 -0
  210. package/lib/typescript/types/onramp/currencies.d.ts.map +1 -0
  211. package/lib/typescript/types/onramp/errors.d.ts +21 -0
  212. package/lib/typescript/types/onramp/errors.d.ts.map +1 -0
  213. package/lib/typescript/types/onramp/index.d.ts +5 -0
  214. package/lib/typescript/types/onramp/index.d.ts.map +1 -0
  215. package/lib/typescript/types/onramp/quotes.d.ts +45 -0
  216. package/lib/typescript/types/onramp/quotes.d.ts.map +1 -0
  217. package/lib/typescript/types/siwe/config.d.ts +31 -0
  218. package/lib/typescript/types/siwe/config.d.ts.map +1 -0
  219. package/lib/typescript/types/siwe/index.d.ts +3 -0
  220. package/lib/typescript/types/siwe/index.d.ts.map +1 -0
  221. package/lib/typescript/types/siwe/message.d.ts +57 -0
  222. package/lib/typescript/types/siwe/message.d.ts.map +1 -0
  223. package/lib/typescript/types/storage.d.ts +27 -0
  224. package/lib/typescript/types/storage.d.ts.map +1 -0
  225. package/lib/typescript/types/swap/index.d.ts +2 -0
  226. package/lib/typescript/types/swap/index.d.ts.map +1 -0
  227. package/lib/typescript/types/swap/tokens.d.ts +19 -0
  228. package/lib/typescript/types/swap/tokens.d.ts.map +1 -0
  229. package/lib/typescript/types/ui.d.ts +26 -0
  230. package/lib/typescript/types/ui.d.ts.map +1 -0
  231. package/lib/typescript/types/wallet/connection.d.ts +30 -0
  232. package/lib/typescript/types/wallet/connection.d.ts.map +1 -0
  233. package/lib/typescript/types/wallet/connector.d.ts +57 -0
  234. package/lib/typescript/types/wallet/connector.d.ts.map +1 -0
  235. package/lib/typescript/types/wallet/index.d.ts +4 -0
  236. package/lib/typescript/types/wallet/index.d.ts.map +1 -0
  237. package/lib/typescript/types/wallet/wallet-info.d.ts +36 -0
  238. package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -0
  239. package/lib/typescript/utils/ConstantsUtil.d.ts +30 -4
  240. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  241. package/lib/typescript/utils/NetworkUtil.d.ts +2 -0
  242. package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
  243. package/lib/typescript/utils/PresetsUtil.d.ts +0 -5
  244. package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
  245. package/lib/typescript/utils/StringUtil.d.ts +1 -0
  246. package/lib/typescript/utils/StringUtil.d.ts.map +1 -1
  247. package/package.json +7 -17
  248. package/src/adapters/BlockchainAdapter.ts +38 -21
  249. package/src/adapters/EvmAdapter.ts +186 -18
  250. package/src/adapters/SolanaBaseAdapter.ts +2 -1
  251. package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
  252. package/src/index.ts +2 -1
  253. package/src/networks/bitcoin.ts +1 -1
  254. package/src/networks/solana.ts +1 -1
  255. package/src/types/api/blockchain-api.ts +213 -0
  256. package/src/types/api/events.ts +394 -0
  257. package/src/types/api/index.ts +4 -0
  258. package/src/types/api/wallet-api.ts +64 -0
  259. package/src/types/blockchain/adapter.ts +52 -0
  260. package/src/types/blockchain/balance.ts +31 -0
  261. package/src/types/blockchain/index.ts +5 -0
  262. package/src/types/blockchain/network.ts +39 -0
  263. package/src/types/blockchain/transaction.ts +71 -0
  264. package/src/types/common.ts +56 -0
  265. package/src/types/index.ts +28 -0
  266. package/src/types/onramp/countries.ts +11 -0
  267. package/src/types/onramp/currencies.ts +32 -0
  268. package/src/types/onramp/errors.ts +22 -0
  269. package/src/types/onramp/index.ts +5 -0
  270. package/src/types/onramp/quotes.ts +46 -0
  271. package/src/types/siwe/config.ts +44 -0
  272. package/src/types/siwe/index.ts +3 -0
  273. package/src/types/siwe/message.ts +62 -0
  274. package/src/types/storage.ts +30 -0
  275. package/src/types/swap/index.ts +2 -0
  276. package/src/types/swap/tokens.ts +21 -0
  277. package/src/types/ui.ts +26 -0
  278. package/src/types/wallet/connection.ts +33 -0
  279. package/src/types/wallet/connector.ts +84 -0
  280. package/src/types/wallet/index.ts +4 -0
  281. package/src/types/wallet/wallet-info.ts +41 -0
  282. package/src/utils/ConstantsUtil.ts +36 -8
  283. package/src/utils/ErrorUtil.ts +2 -2
  284. package/src/utils/NetworkUtil.ts +5 -0
  285. package/src/utils/PresetsUtil.ts +0 -25
  286. package/src/utils/StringUtil.ts +7 -0
  287. package/lib/commonjs/utils/TypeUtil.js.map +0 -1
  288. package/lib/module/utils/TypeUtil.js.map +0 -1
  289. package/lib/typescript/utils/TypeUtil.d.ts +0 -276
  290. package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
  291. package/src/utils/TypeUtil.ts +0 -336
@@ -1,4 +1,4 @@
1
- import type { AppKitNetwork } from '../utils/TypeUtil';
1
+ import type { AppKitNetwork } from '../types';
2
2
 
3
3
  export const solana: AppKitNetwork = {
4
4
  id: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
@@ -0,0 +1,213 @@
1
+ import type { CaipAddress, CaipNetworkId, BaseError, RequestCache } from '../common';
2
+ import type { Transaction } from '../blockchain/transaction';
3
+ import type { SwapToken } from '../swap';
4
+
5
+ export interface BlockchainApiIdentityRequest {
6
+ address: `0x${string}`;
7
+ }
8
+
9
+ export interface BlockchainApiIdentityResponse {
10
+ avatar: string;
11
+ name: string;
12
+ }
13
+
14
+ export interface BlockchainApiBalance {
15
+ name: string;
16
+ symbol: string;
17
+ chainId: string;
18
+ address?: CaipAddress;
19
+ value?: number;
20
+ price: number;
21
+ quantity: {
22
+ decimals: string;
23
+ numeric: string;
24
+ };
25
+ iconUrl: string;
26
+ }
27
+
28
+ export interface BlockchainApiBalanceResponse {
29
+ balances: BlockchainApiBalance[];
30
+ }
31
+
32
+ export interface BlockchainApiTransactionsRequest {
33
+ account: string;
34
+ projectId: string;
35
+ cursor?: string;
36
+ signal?: AbortSignal;
37
+ cache?: RequestCache;
38
+ chainId: CaipNetworkId;
39
+ }
40
+
41
+ export interface BlockchainApiTransactionsResponse {
42
+ data: Transaction[];
43
+ next: string | null;
44
+ }
45
+
46
+ export interface BlockchainApiSwapAllowanceResponse {
47
+ allowance: string;
48
+ }
49
+
50
+ export interface BlockchainApiGenerateSwapCalldataRequest {
51
+ projectId: string;
52
+ userAddress: CaipAddress;
53
+ from: CaipAddress;
54
+ to: CaipAddress;
55
+ amount: string;
56
+ eip155?: {
57
+ slippage: string;
58
+ permit?: string;
59
+ };
60
+ }
61
+
62
+ export interface BlockchainApiGenerateSwapCalldataResponse {
63
+ tx: {
64
+ from: CaipAddress;
65
+ to: CaipAddress;
66
+ data: `0x${string}`;
67
+ amount: string;
68
+ eip155: {
69
+ gas: string;
70
+ gasPrice: string;
71
+ };
72
+ };
73
+ }
74
+
75
+ export interface BlockchainApiGenerateApproveCalldataRequest {
76
+ projectId: string;
77
+ userAddress: CaipAddress;
78
+ from: CaipAddress;
79
+ to: CaipAddress;
80
+ amount?: number;
81
+ }
82
+
83
+ export interface BlockchainApiGenerateApproveCalldataResponse {
84
+ tx: {
85
+ from: CaipAddress;
86
+ to: CaipAddress;
87
+ data: `0x${string}`;
88
+ value: string;
89
+ eip155: {
90
+ gas: number;
91
+ gasPrice: string;
92
+ };
93
+ };
94
+ }
95
+
96
+ export interface BlockchainApiTokenPriceRequest {
97
+ projectId: string;
98
+ currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
99
+ addresses: CaipAddress[];
100
+ }
101
+
102
+ export interface BlockchainApiTokenPriceResponse {
103
+ fungibles: {
104
+ name: string;
105
+ symbol: string;
106
+ iconUrl: string;
107
+ price: number;
108
+ }[];
109
+ }
110
+
111
+ export interface BlockchainApiSwapAllowanceRequest {
112
+ projectId: string;
113
+ tokenAddress: CaipAddress;
114
+ userAddress: CaipAddress;
115
+ }
116
+
117
+ export interface BlockchainApiGasPriceRequest {
118
+ projectId: string;
119
+ chainId: CaipNetworkId;
120
+ }
121
+
122
+ export interface BlockchainApiGasPriceResponse {
123
+ standard: string;
124
+ fast: string;
125
+ instant: string;
126
+ }
127
+
128
+ export interface BlockchainApiEnsError extends BaseError {
129
+ status: string;
130
+ reasons: { name: string; description: string }[];
131
+ }
132
+
133
+ export type ReownName = `${string}.reown.id` | `${string}.wcn.id`;
134
+
135
+ export interface BlockchainApiLookupEnsName {
136
+ name: ReownName;
137
+ registered: number;
138
+ updated: number;
139
+ addresses: Record<
140
+ string,
141
+ {
142
+ address: string;
143
+ created: string;
144
+ }
145
+ >;
146
+ attributes: {
147
+ avatar?: string;
148
+ bio?: string;
149
+ }[];
150
+ }
151
+
152
+ export interface BlockchainApiSwapQuoteRequest {
153
+ projectId: string;
154
+ chainId?: CaipNetworkId;
155
+ amount: string;
156
+ userAddress: CaipAddress;
157
+ from: CaipAddress;
158
+ to: CaipAddress;
159
+ gasPrice: string;
160
+ }
161
+
162
+ export interface BlockchainApiSwapQuoteResponse {
163
+ quotes: {
164
+ id: string | null;
165
+ fromAmount: string;
166
+ fromAccount: string;
167
+ toAmount: string;
168
+ toAccount: string;
169
+ }[];
170
+ }
171
+
172
+ export interface BlockchainApiSwapTokensRequest {
173
+ projectId: string;
174
+ chainId: CaipNetworkId;
175
+ }
176
+
177
+ export interface BlockchainApiOnRampQuotesRequest {
178
+ countryCode: string;
179
+ paymentMethodType?: string;
180
+ destinationCurrencyCode: string;
181
+ sourceAmount: number;
182
+ sourceCurrencyCode: string;
183
+ walletAddress: string;
184
+ excludeProviders?: string[];
185
+ }
186
+
187
+ export interface BlockchainApiSwapTokensResponse {
188
+ tokens: SwapToken[];
189
+ }
190
+
191
+ export interface BlockchainApiOnRampWidgetRequest {
192
+ countryCode: string;
193
+ destinationCurrencyCode: string;
194
+ paymentMethodType: string;
195
+ serviceProvider: string;
196
+ sourceAmount: number;
197
+ sourceCurrencyCode: string;
198
+ walletAddress: string;
199
+ redirectUrl?: string;
200
+ }
201
+
202
+ export type BlockchainApiOnRampWidgetResponse = {
203
+ widgetUrl: string;
204
+ };
205
+
206
+ export class BlockchainOnRampError extends Error {
207
+ code: string;
208
+ constructor(code: string, message: string) {
209
+ super(message);
210
+ this.code = code;
211
+ this.message = message;
212
+ }
213
+ }
@@ -0,0 +1,394 @@
1
+ import type { Platform, SocialProvider, AccountType } from '../common';
2
+
3
+ export type EventName =
4
+ | 'MODAL_LOADED'
5
+ | 'MODAL_OPEN'
6
+ | 'MODAL_CLOSE'
7
+ | 'CLICK_ALL_WALLETS'
8
+ | 'CLICK_NETWORKS'
9
+ | 'SWITCH_NETWORK'
10
+ | 'SELECT_WALLET'
11
+ | 'CONNECT_SUCCESS'
12
+ | 'CONNECT_ERROR'
13
+ | 'DISCONNECT_SUCCESS'
14
+ | 'DISCONNECT_ERROR'
15
+ | 'CLICK_WALLET_HELP'
16
+ | 'CLICK_NETWORK_HELP'
17
+ | 'CLICK_GET_WALLET'
18
+ | 'EMAIL_LOGIN_SELECTED'
19
+ | 'EMAIL_VERIFICATION_CODE_PASS'
20
+ | 'EMAIL_VERIFICATION_CODE_FAIL'
21
+ | 'EMAIL_EDIT'
22
+ | 'EMAIL_EDIT_COMPLETE'
23
+ | 'EMAIL_UPGRADE_FROM_MODAL'
24
+ | 'CLICK_SIGN_SIWE_MESSAGE'
25
+ | 'CLICK_CANCEL_SIWE'
26
+ | 'SIWE_AUTH_SUCCESS'
27
+ | 'SIWE_AUTH_ERROR'
28
+ | 'CLICK_TRANSACTIONS'
29
+ | 'ERROR_FETCH_TRANSACTIONS'
30
+ | 'LOAD_MORE_TRANSACTIONS'
31
+ | 'OPEN_SEND'
32
+ | 'OPEN_SWAP'
33
+ | 'INITIATE_SWAP'
34
+ | 'SWAP_SUCCESS'
35
+ | 'SWAP_ERROR'
36
+ | 'SEND_INITIATED'
37
+ | 'SEND_SUCCESS'
38
+ | 'SEND_ERROR'
39
+ | 'SOCIAL_LOGIN_STARTED'
40
+ | 'SOCIAL_LOGIN_SUCCESS'
41
+ | 'SOCIAL_LOGIN_REQUEST_USER_DATA'
42
+ | 'SOCIAL_LOGIN_CANCELED'
43
+ | 'SOCIAL_LOGIN_ERROR'
44
+ | 'SET_PREFERRED_ACCOUNT_TYPE';
45
+
46
+ export type Event =
47
+ | {
48
+ type: 'track';
49
+ event: 'MODAL_CREATED';
50
+ }
51
+ | {
52
+ type: 'track';
53
+ event: 'MODAL_LOADED';
54
+ }
55
+ | {
56
+ type: 'track';
57
+ event: 'MODAL_OPEN';
58
+ properties: {
59
+ connected: boolean;
60
+ };
61
+ }
62
+ | {
63
+ type: 'track';
64
+ event: 'MODAL_CLOSE';
65
+ properties: {
66
+ connected: boolean;
67
+ };
68
+ }
69
+ | {
70
+ type: 'track';
71
+ event: 'CLICK_ALL_WALLETS';
72
+ }
73
+ | {
74
+ type: 'track';
75
+ event: 'CLICK_NETWORKS';
76
+ }
77
+ | {
78
+ type: 'track';
79
+ event: 'SWITCH_NETWORK';
80
+ properties: {
81
+ network: number | string;
82
+ };
83
+ }
84
+ | {
85
+ type: 'track';
86
+ event: 'SELECT_WALLET';
87
+ properties: {
88
+ name: string;
89
+ platform?: Platform;
90
+ explorer_id?: string;
91
+ };
92
+ }
93
+ | {
94
+ type: 'track';
95
+ event: 'CONNECT_SUCCESS';
96
+ properties: {
97
+ name: string;
98
+ method: Platform;
99
+ explorer_id?: string;
100
+ };
101
+ }
102
+ | {
103
+ type: 'track';
104
+ event: 'CONNECT_ERROR';
105
+ properties: {
106
+ message: string;
107
+ };
108
+ }
109
+ | {
110
+ type: 'track';
111
+ event: 'DISCONNECT_SUCCESS';
112
+ }
113
+ | {
114
+ type: 'track';
115
+ event: 'DISCONNECT_ERROR';
116
+ }
117
+ | {
118
+ type: 'track';
119
+ event: 'CLICK_WALLET_HELP';
120
+ }
121
+ | {
122
+ type: 'track';
123
+ event: 'CLICK_NETWORK_HELP';
124
+ }
125
+ | {
126
+ type: 'track';
127
+ event: 'CLICK_GET_WALLET';
128
+ }
129
+ | {
130
+ type: 'track';
131
+ event: 'EMAIL_LOGIN_SELECTED';
132
+ }
133
+ | {
134
+ type: 'track';
135
+ event: 'EMAIL_VERIFICATION_CODE_PASS';
136
+ }
137
+ | {
138
+ type: 'track';
139
+ event: 'EMAIL_VERIFICATION_CODE_FAIL';
140
+ }
141
+ | {
142
+ type: 'track';
143
+ event: 'EMAIL_EDIT';
144
+ }
145
+ | {
146
+ type: 'track';
147
+ event: 'EMAIL_EDIT_COMPLETE';
148
+ }
149
+ | {
150
+ type: 'track';
151
+ event: 'EMAIL_UPGRADE_FROM_MODAL';
152
+ }
153
+ | {
154
+ type: 'track';
155
+ event: 'CLICK_SIGN_SIWE_MESSAGE';
156
+ properties: {
157
+ network: string;
158
+ isSmartAccount: boolean;
159
+ };
160
+ }
161
+ | {
162
+ type: 'track';
163
+ event: 'CLICK_CANCEL_SIWE';
164
+ properties: {
165
+ network: string;
166
+ isSmartAccount: boolean;
167
+ };
168
+ }
169
+ | {
170
+ type: 'track';
171
+ event: 'SIWE_AUTH_SUCCESS';
172
+ properties: {
173
+ network: string;
174
+ isSmartAccount: boolean;
175
+ };
176
+ }
177
+ | {
178
+ type: 'track';
179
+ event: 'SIWE_AUTH_ERROR';
180
+ properties: {
181
+ network: string;
182
+ isSmartAccount: boolean;
183
+ };
184
+ }
185
+ | {
186
+ type: 'track';
187
+ event: 'CLICK_TRANSACTIONS';
188
+ properties: {
189
+ isSmartAccount: boolean;
190
+ };
191
+ }
192
+ | {
193
+ type: 'track';
194
+ event: 'ERROR_FETCH_TRANSACTIONS';
195
+ properties: {
196
+ address: string;
197
+ projectId: string;
198
+ cursor: string | undefined;
199
+ isSmartAccount: boolean;
200
+ };
201
+ }
202
+ | {
203
+ type: 'track';
204
+ event: 'LOAD_MORE_TRANSACTIONS';
205
+ properties: {
206
+ address: string | undefined;
207
+ projectId: string;
208
+ cursor: string | undefined;
209
+ isSmartAccount: boolean;
210
+ };
211
+ }
212
+ | {
213
+ type: 'track';
214
+ event: 'OPEN_SEND';
215
+ properties: {
216
+ isSmartAccount: boolean;
217
+ network: string;
218
+ };
219
+ }
220
+ | {
221
+ type: 'track';
222
+ event: 'OPEN_SWAP';
223
+ properties: {
224
+ isSmartAccount: boolean;
225
+ network: string;
226
+ };
227
+ }
228
+ | {
229
+ type: 'track';
230
+ event: 'INITIATE_SWAP';
231
+ properties: {
232
+ isSmartAccount: boolean;
233
+ network: string;
234
+ swapFromToken: string;
235
+ swapToToken: string;
236
+ swapFromAmount: string;
237
+ swapToAmount: string;
238
+ };
239
+ }
240
+ | {
241
+ type: 'track';
242
+ event: 'SWAP_SUCCESS';
243
+ properties: {
244
+ isSmartAccount: boolean;
245
+ network: string;
246
+ swapFromToken: string;
247
+ swapToToken: string;
248
+ swapFromAmount: string;
249
+ swapToAmount: string;
250
+ };
251
+ }
252
+ | {
253
+ type: 'track';
254
+ event: 'SWAP_ERROR';
255
+ properties: {
256
+ isSmartAccount: boolean;
257
+ network: string;
258
+ swapFromToken: string;
259
+ swapToToken: string;
260
+ swapFromAmount: string;
261
+ swapToAmount: string;
262
+ message: string;
263
+ };
264
+ }
265
+ | {
266
+ type: 'track';
267
+ event: 'SEND_INITIATED';
268
+ properties: {
269
+ isSmartAccount: boolean;
270
+ network: string;
271
+ token: string;
272
+ amount: number;
273
+ };
274
+ }
275
+ | {
276
+ type: 'track';
277
+ event: 'SEND_SUCCESS';
278
+ properties: {
279
+ isSmartAccount: boolean;
280
+ network: string;
281
+ token: string;
282
+ amount: number;
283
+ };
284
+ }
285
+ | {
286
+ type: 'track';
287
+ event: 'SEND_ERROR';
288
+ properties: {
289
+ isSmartAccount: boolean;
290
+ network: string;
291
+ token: string;
292
+ amount: number;
293
+ };
294
+ }
295
+ | {
296
+ type: 'track';
297
+ event: 'SOCIAL_LOGIN_STARTED';
298
+ properties: {
299
+ provider: SocialProvider;
300
+ };
301
+ }
302
+ | {
303
+ type: 'track';
304
+ event: 'SOCIAL_LOGIN_SUCCESS';
305
+ properties: {
306
+ provider: SocialProvider;
307
+ };
308
+ }
309
+ | {
310
+ type: 'track';
311
+ event: 'SOCIAL_LOGIN_REQUEST_USER_DATA';
312
+ properties: {
313
+ provider: SocialProvider;
314
+ };
315
+ }
316
+ | {
317
+ type: 'track';
318
+ event: 'SOCIAL_LOGIN_CANCELED';
319
+ properties: {
320
+ provider: SocialProvider;
321
+ };
322
+ }
323
+ | {
324
+ type: 'track';
325
+ event: 'SOCIAL_LOGIN_ERROR';
326
+ properties: {
327
+ provider: SocialProvider;
328
+ };
329
+ }
330
+ | {
331
+ type: 'track';
332
+ event: 'SET_PREFERRED_ACCOUNT_TYPE';
333
+ properties: {
334
+ accountType: AccountType;
335
+ network: string;
336
+ };
337
+ }
338
+ | {
339
+ type: 'track';
340
+ event: 'SELECT_BUY_CRYPTO';
341
+ }
342
+ | {
343
+ type: 'track';
344
+ event: 'SELECT_BUY_ASSET';
345
+ properties: {
346
+ asset: string;
347
+ };
348
+ }
349
+ | {
350
+ type: 'track';
351
+ event: 'BUY_SUBMITTED';
352
+ properties: {
353
+ asset?: string;
354
+ network?: string;
355
+ amount?: string;
356
+ currency?: string;
357
+ provider?: string;
358
+ serviceProvider?: string;
359
+ paymentMethod?: string;
360
+ };
361
+ }
362
+ | {
363
+ type: 'track';
364
+ event: 'BUY_SUCCESS';
365
+ properties: {
366
+ asset?: string | null;
367
+ network?: string | null;
368
+ amount?: string | null;
369
+ currency?: string | null;
370
+ provider?: string | null;
371
+ orderId?: string | null;
372
+ };
373
+ }
374
+ | {
375
+ type: 'track';
376
+ event: 'BUY_FAIL';
377
+ properties: {
378
+ asset?: string;
379
+ network?: string;
380
+ amount?: string;
381
+ currency?: string;
382
+ provider?: string;
383
+ serviceProvider?: string;
384
+ paymentMethod?: string;
385
+ message?: string;
386
+ };
387
+ }
388
+ | {
389
+ type: 'track';
390
+ event: 'BUY_CANCEL';
391
+ properties?: {
392
+ message?: string;
393
+ };
394
+ };
@@ -0,0 +1,4 @@
1
+ // API types barrel export
2
+ export * from './blockchain-api';
3
+ export * from './wallet-api';
4
+ export * from './events';
@@ -0,0 +1,64 @@
1
+ export interface WcWallet {
2
+ id: string;
3
+ name: string;
4
+ homepage?: string;
5
+ image_id?: string;
6
+ image_url?: string;
7
+ order?: number;
8
+ mobile_link?: string | null;
9
+ desktop_link?: string | null;
10
+ webapp_link?: string | null;
11
+ link_mode?: string | null;
12
+ app_store?: string | null;
13
+ play_store?: string | null;
14
+ }
15
+
16
+ export interface DataWallet {
17
+ id: string;
18
+ ios_schema?: string;
19
+ android_app_id?: string;
20
+ }
21
+
22
+ export interface ApiGetWalletsRequest {
23
+ page: number;
24
+ entries: number;
25
+ search?: string;
26
+ include?: string[];
27
+ exclude?: string[];
28
+ }
29
+
30
+ export interface ApiGetWalletsResponse {
31
+ data: WcWallet[];
32
+ count: number;
33
+ }
34
+
35
+ export interface ApiGetDataWalletsResponse {
36
+ data: DataWallet[];
37
+ count: number;
38
+ }
39
+
40
+ export interface ApiGetAnalyticsConfigResponse {
41
+ isAnalyticsEnabled: boolean;
42
+ }
43
+
44
+ export type CustomWallet = Pick<
45
+ WcWallet,
46
+ | 'id'
47
+ | 'name'
48
+ | 'homepage'
49
+ | 'image_url'
50
+ | 'image_id'
51
+ | 'mobile_link'
52
+ | 'desktop_link'
53
+ | 'webapp_link'
54
+ | 'link_mode'
55
+ | 'app_store'
56
+ | 'play_store'
57
+ >;
58
+
59
+ export type UniversalProviderConfigOverride = {
60
+ methods?: Record<string, string[]>;
61
+ chains?: Record<string, string[]>;
62
+ events?: Record<string, string[]>;
63
+ rpcMap?: Record<string, string>;
64
+ };