@reown/appkit-common-react-native 2.0.0 → 2.0.1

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 (312) hide show
  1. package/lib/commonjs/adapters/BitcoinBaseAdapter.js +10 -0
  2. package/lib/commonjs/adapters/BitcoinBaseAdapter.js.map +1 -0
  3. package/lib/commonjs/adapters/BlockchainAdapter.js +38 -14
  4. package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -1
  5. package/lib/commonjs/adapters/EvmAdapter.js +126 -16
  6. package/lib/commonjs/adapters/EvmAdapter.js.map +1 -1
  7. package/lib/commonjs/adapters/SolanaBaseAdapter.js +1 -3
  8. package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -1
  9. package/lib/commonjs/contracts/erc20.js.map +1 -1
  10. package/lib/commonjs/contracts/usdt.js.map +1 -1
  11. package/lib/commonjs/index.js +13 -5
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/networks/bitcoin.js.map +1 -1
  14. package/lib/commonjs/networks/solana.js.map +1 -1
  15. package/lib/commonjs/package.json +1 -0
  16. package/lib/commonjs/types/api/blockchain-api.js +15 -0
  17. package/lib/commonjs/types/api/blockchain-api.js.map +1 -0
  18. package/lib/commonjs/types/api/events.js +6 -0
  19. package/lib/commonjs/types/api/events.js.map +1 -0
  20. package/lib/commonjs/types/api/index.js +39 -0
  21. package/lib/commonjs/types/api/index.js.map +1 -0
  22. package/lib/commonjs/types/api/wallet-api.js +6 -0
  23. package/lib/commonjs/types/api/wallet-api.js.map +1 -0
  24. package/lib/commonjs/types/blockchain/adapter.js +6 -0
  25. package/lib/commonjs/types/blockchain/adapter.js.map +1 -0
  26. package/lib/commonjs/types/blockchain/balance.js +6 -0
  27. package/lib/commonjs/types/blockchain/balance.js.map +1 -0
  28. package/lib/commonjs/types/blockchain/index.js +50 -0
  29. package/lib/commonjs/types/blockchain/index.js.map +1 -0
  30. package/lib/commonjs/types/blockchain/network.js +6 -0
  31. package/lib/commonjs/types/blockchain/network.js.map +1 -0
  32. package/lib/commonjs/types/blockchain/transaction.js +2 -0
  33. package/lib/commonjs/types/blockchain/transaction.js.map +1 -0
  34. package/lib/commonjs/types/common.js +2 -0
  35. package/lib/commonjs/types/common.js.map +1 -0
  36. package/lib/commonjs/types/index.js +105 -0
  37. package/lib/commonjs/types/index.js.map +1 -0
  38. package/lib/commonjs/types/onramp/countries.js +2 -0
  39. package/lib/commonjs/types/onramp/countries.js.map +1 -0
  40. package/lib/commonjs/types/onramp/currencies.js +2 -0
  41. package/lib/commonjs/types/onramp/currencies.js.map +1 -0
  42. package/lib/commonjs/types/onramp/errors.js +22 -0
  43. package/lib/commonjs/types/onramp/errors.js.map +1 -0
  44. package/lib/commonjs/types/onramp/index.js +50 -0
  45. package/lib/commonjs/types/onramp/index.js.map +1 -0
  46. package/lib/commonjs/types/onramp/quotes.js +2 -0
  47. package/lib/commonjs/types/onramp/quotes.js.map +1 -0
  48. package/lib/commonjs/types/siwx/config.js +6 -0
  49. package/lib/commonjs/types/siwx/config.js.map +1 -0
  50. package/lib/commonjs/types/siwx/index.js +50 -0
  51. package/lib/commonjs/types/siwx/index.js.map +1 -0
  52. package/lib/commonjs/types/siwx/message.js +6 -0
  53. package/lib/commonjs/types/siwx/message.js.map +1 -0
  54. package/lib/commonjs/types/siwx/storage.js +6 -0
  55. package/lib/commonjs/types/siwx/storage.js.map +1 -0
  56. package/lib/commonjs/types/siwx/verifier.js +35 -0
  57. package/lib/commonjs/types/siwx/verifier.js.map +1 -0
  58. package/lib/commonjs/types/storage.js +24 -0
  59. package/lib/commonjs/types/storage.js.map +1 -0
  60. package/lib/commonjs/types/swap/index.js +17 -0
  61. package/lib/commonjs/types/swap/index.js.map +1 -0
  62. package/lib/commonjs/types/swap/tokens.js +6 -0
  63. package/lib/commonjs/types/swap/tokens.js.map +1 -0
  64. package/lib/commonjs/types/ui.js +6 -0
  65. package/lib/commonjs/types/ui.js.map +1 -0
  66. package/lib/commonjs/types/wallet/connection.js +6 -0
  67. package/lib/commonjs/types/wallet/connection.js.map +1 -0
  68. package/lib/commonjs/{utils/TypeUtil.js → types/wallet/connector.js} +7 -13
  69. package/lib/commonjs/types/wallet/connector.js.map +1 -0
  70. package/lib/commonjs/types/wallet/index.js +39 -0
  71. package/lib/commonjs/types/wallet/index.js.map +1 -0
  72. package/lib/commonjs/types/wallet/wallet-info.js +6 -0
  73. package/lib/commonjs/types/wallet/wallet-info.js.map +1 -0
  74. package/lib/commonjs/utils/ConstantsUtil.js +45 -6
  75. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  76. package/lib/commonjs/utils/ContractUtil.js.map +1 -1
  77. package/lib/commonjs/utils/DateUtil.js.map +1 -1
  78. package/lib/commonjs/utils/ErrorUtil.js +2 -2
  79. package/lib/commonjs/utils/ErrorUtil.js.map +1 -1
  80. package/lib/commonjs/utils/NamesUtil.js.map +1 -1
  81. package/lib/commonjs/utils/NetworkUtil.js +3 -0
  82. package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
  83. package/lib/commonjs/utils/NumberUtil.js +1 -2
  84. package/lib/commonjs/utils/NumberUtil.js.map +1 -1
  85. package/lib/commonjs/utils/PresetsUtil.js +0 -18
  86. package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
  87. package/lib/commonjs/utils/StringUtil.js +7 -0
  88. package/lib/commonjs/utils/StringUtil.js.map +1 -1
  89. package/lib/module/adapters/BitcoinBaseAdapter.js +5 -0
  90. package/lib/module/adapters/BitcoinBaseAdapter.js.map +1 -0
  91. package/lib/module/adapters/BlockchainAdapter.js +40 -14
  92. package/lib/module/adapters/BlockchainAdapter.js.map +1 -1
  93. package/lib/module/adapters/EvmAdapter.js +129 -16
  94. package/lib/module/adapters/EvmAdapter.js.map +1 -1
  95. package/lib/module/adapters/SolanaBaseAdapter.js +3 -3
  96. package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -1
  97. package/lib/module/contracts/erc20.js +2 -0
  98. package/lib/module/contracts/erc20.js.map +1 -1
  99. package/lib/module/contracts/usdt.js +2 -0
  100. package/lib/module/contracts/usdt.js.map +1 -1
  101. package/lib/module/index.js +4 -1
  102. package/lib/module/index.js.map +1 -1
  103. package/lib/module/networks/bitcoin.js +2 -0
  104. package/lib/module/networks/bitcoin.js.map +1 -1
  105. package/lib/module/networks/solana.js +2 -0
  106. package/lib/module/networks/solana.js.map +1 -1
  107. package/lib/module/types/api/blockchain-api.js +10 -0
  108. package/lib/module/types/api/blockchain-api.js.map +1 -0
  109. package/lib/module/types/api/events.js +4 -0
  110. package/lib/module/types/api/events.js.map +1 -0
  111. package/lib/module/types/api/index.js +7 -0
  112. package/lib/module/types/api/index.js.map +1 -0
  113. package/lib/module/types/api/wallet-api.js +4 -0
  114. package/lib/module/types/api/wallet-api.js.map +1 -0
  115. package/lib/module/types/blockchain/adapter.js +4 -0
  116. package/lib/module/types/blockchain/adapter.js.map +1 -0
  117. package/lib/module/types/blockchain/balance.js +4 -0
  118. package/lib/module/types/blockchain/balance.js.map +1 -0
  119. package/lib/module/types/blockchain/index.js +8 -0
  120. package/lib/module/types/blockchain/index.js.map +1 -0
  121. package/lib/module/types/blockchain/network.js +4 -0
  122. package/lib/module/types/blockchain/network.js.map +1 -0
  123. package/lib/module/types/blockchain/transaction.js +2 -0
  124. package/lib/module/types/blockchain/transaction.js.map +1 -0
  125. package/lib/module/types/common.js +2 -0
  126. package/lib/module/types/common.js.map +1 -0
  127. package/lib/module/types/index.js +31 -0
  128. package/lib/module/types/index.js.map +1 -0
  129. package/lib/module/types/onramp/countries.js +2 -0
  130. package/lib/module/types/onramp/countries.js.map +1 -0
  131. package/lib/module/types/onramp/currencies.js +2 -0
  132. package/lib/module/types/onramp/currencies.js.map +1 -0
  133. package/lib/module/types/onramp/errors.js +18 -0
  134. package/lib/module/types/onramp/errors.js.map +1 -0
  135. package/lib/module/types/onramp/index.js +8 -0
  136. package/lib/module/types/onramp/index.js.map +1 -0
  137. package/lib/module/types/onramp/quotes.js +2 -0
  138. package/lib/module/types/onramp/quotes.js.map +1 -0
  139. package/lib/module/types/siwx/config.js +4 -0
  140. package/lib/module/types/siwx/config.js.map +1 -0
  141. package/lib/module/types/siwx/index.js +7 -0
  142. package/lib/module/types/siwx/index.js.map +1 -0
  143. package/lib/module/types/siwx/message.js +4 -0
  144. package/lib/module/types/siwx/message.js.map +1 -0
  145. package/lib/module/types/siwx/storage.js +4 -0
  146. package/lib/module/types/siwx/storage.js.map +1 -0
  147. package/lib/module/types/siwx/verifier.js +30 -0
  148. package/lib/module/types/siwx/verifier.js.map +1 -0
  149. package/lib/module/types/storage.js +20 -0
  150. package/lib/module/types/storage.js.map +1 -0
  151. package/lib/module/types/swap/index.js +5 -0
  152. package/lib/module/types/swap/index.js.map +1 -0
  153. package/lib/module/types/swap/tokens.js +4 -0
  154. package/lib/module/types/swap/tokens.js.map +1 -0
  155. package/lib/module/types/ui.js +4 -0
  156. package/lib/module/types/ui.js.map +1 -0
  157. package/lib/module/types/wallet/connection.js +4 -0
  158. package/lib/module/types/wallet/connection.js.map +1 -0
  159. package/lib/module/{utils/TypeUtil.js → types/wallet/connector.js} +9 -14
  160. package/lib/module/types/wallet/connector.js.map +1 -0
  161. package/lib/module/types/wallet/index.js +7 -0
  162. package/lib/module/types/wallet/index.js.map +1 -0
  163. package/lib/module/types/wallet/wallet-info.js +4 -0
  164. package/lib/module/types/wallet/wallet-info.js.map +1 -0
  165. package/lib/module/utils/ConstantsUtil.js +47 -6
  166. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  167. package/lib/module/utils/ContractUtil.js +2 -0
  168. package/lib/module/utils/ContractUtil.js.map +1 -1
  169. package/lib/module/utils/DateUtil.js +2 -0
  170. package/lib/module/utils/DateUtil.js.map +1 -1
  171. package/lib/module/utils/ErrorUtil.js +4 -2
  172. package/lib/module/utils/ErrorUtil.js.map +1 -1
  173. package/lib/module/utils/NamesUtil.js +2 -0
  174. package/lib/module/utils/NamesUtil.js.map +1 -1
  175. package/lib/module/utils/NetworkUtil.js +5 -0
  176. package/lib/module/utils/NetworkUtil.js.map +1 -1
  177. package/lib/module/utils/NumberUtil.js +2 -0
  178. package/lib/module/utils/NumberUtil.js.map +1 -1
  179. package/lib/module/utils/PresetsUtil.js +2 -18
  180. package/lib/module/utils/PresetsUtil.js.map +1 -1
  181. package/lib/module/utils/StringUtil.js +9 -0
  182. package/lib/module/utils/StringUtil.js.map +1 -1
  183. package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts +5 -0
  184. package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts.map +1 -0
  185. package/lib/typescript/adapters/BlockchainAdapter.d.ts +6 -7
  186. package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -1
  187. package/lib/typescript/adapters/EvmAdapter.d.ts +21 -1
  188. package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -1
  189. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +3 -0
  190. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -1
  191. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +2 -0
  192. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +1 -0
  193. package/lib/typescript/index.d.ts +2 -1
  194. package/lib/typescript/index.d.ts.map +1 -1
  195. package/lib/typescript/networks/bitcoin.d.ts +1 -1
  196. package/lib/typescript/networks/bitcoin.d.ts.map +1 -1
  197. package/lib/typescript/networks/solana.d.ts +1 -1
  198. package/lib/typescript/networks/solana.d.ts.map +1 -1
  199. package/lib/typescript/types/api/blockchain-api.d.ts +183 -0
  200. package/lib/typescript/types/api/blockchain-api.d.ts.map +1 -0
  201. package/lib/typescript/types/api/events.d.ts +357 -0
  202. package/lib/typescript/types/api/events.d.ts.map +1 -0
  203. package/lib/typescript/types/api/index.d.ts +4 -0
  204. package/lib/typescript/types/api/index.d.ts.map +1 -0
  205. package/lib/typescript/types/api/wallet-api.d.ts +51 -0
  206. package/lib/typescript/types/api/wallet-api.d.ts.map +1 -0
  207. package/lib/typescript/types/blockchain/adapter.d.ts +40 -0
  208. package/lib/typescript/types/blockchain/adapter.d.ts.map +1 -0
  209. package/lib/typescript/types/blockchain/balance.d.ts +28 -0
  210. package/lib/typescript/types/blockchain/balance.d.ts.map +1 -0
  211. package/lib/typescript/types/blockchain/index.d.ts +5 -0
  212. package/lib/typescript/types/blockchain/index.d.ts.map +1 -0
  213. package/lib/typescript/types/blockchain/network.d.ts +47 -0
  214. package/lib/typescript/types/blockchain/network.d.ts.map +1 -0
  215. package/lib/typescript/types/blockchain/transaction.d.ts +63 -0
  216. package/lib/typescript/types/blockchain/transaction.d.ts.map +1 -0
  217. package/lib/typescript/types/common.d.ts +24 -0
  218. package/lib/typescript/types/common.d.ts.map +1 -0
  219. package/lib/typescript/types/index.d.ts +10 -0
  220. package/lib/typescript/types/index.d.ts.map +1 -0
  221. package/lib/typescript/types/onramp/countries.d.ts +11 -0
  222. package/lib/typescript/types/onramp/countries.d.ts.map +1 -0
  223. package/lib/typescript/types/onramp/currencies.d.ts +30 -0
  224. package/lib/typescript/types/onramp/currencies.d.ts.map +1 -0
  225. package/lib/typescript/types/onramp/errors.d.ts +21 -0
  226. package/lib/typescript/types/onramp/errors.d.ts.map +1 -0
  227. package/lib/typescript/types/onramp/index.d.ts +5 -0
  228. package/lib/typescript/types/onramp/index.d.ts.map +1 -0
  229. package/lib/typescript/types/onramp/quotes.d.ts +45 -0
  230. package/lib/typescript/types/onramp/quotes.d.ts.map +1 -0
  231. package/lib/typescript/types/siwx/config.d.ts +73 -0
  232. package/lib/typescript/types/siwx/config.d.ts.map +1 -0
  233. package/lib/typescript/types/siwx/index.d.ts +5 -0
  234. package/lib/typescript/types/siwx/index.d.ts.map +1 -0
  235. package/lib/typescript/types/siwx/message.d.ts +92 -0
  236. package/lib/typescript/types/siwx/message.d.ts.map +1 -0
  237. package/lib/typescript/types/siwx/storage.d.ts +41 -0
  238. package/lib/typescript/types/siwx/storage.d.ts.map +1 -0
  239. package/lib/typescript/types/siwx/verifier.d.ts +28 -0
  240. package/lib/typescript/types/siwx/verifier.d.ts.map +1 -0
  241. package/lib/typescript/types/storage.d.ts +59 -0
  242. package/lib/typescript/types/storage.d.ts.map +1 -0
  243. package/lib/typescript/types/swap/index.d.ts +2 -0
  244. package/lib/typescript/types/swap/index.d.ts.map +1 -0
  245. package/lib/typescript/types/swap/tokens.d.ts +19 -0
  246. package/lib/typescript/types/swap/tokens.d.ts.map +1 -0
  247. package/lib/typescript/types/ui.d.ts +26 -0
  248. package/lib/typescript/types/ui.d.ts.map +1 -0
  249. package/lib/typescript/types/wallet/connection.d.ts +31 -0
  250. package/lib/typescript/types/wallet/connection.d.ts.map +1 -0
  251. package/lib/typescript/types/wallet/connector.d.ts +59 -0
  252. package/lib/typescript/types/wallet/connector.d.ts.map +1 -0
  253. package/lib/typescript/types/wallet/index.d.ts +4 -0
  254. package/lib/typescript/types/wallet/index.d.ts.map +1 -0
  255. package/lib/typescript/types/wallet/wallet-info.d.ts +37 -0
  256. package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -0
  257. package/lib/typescript/utils/ConstantsUtil.d.ts +43 -4
  258. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  259. package/lib/typescript/utils/NetworkUtil.d.ts +2 -0
  260. package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
  261. package/lib/typescript/utils/PresetsUtil.d.ts +0 -5
  262. package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
  263. package/lib/typescript/utils/StringUtil.d.ts +1 -0
  264. package/lib/typescript/utils/StringUtil.d.ts.map +1 -1
  265. package/package.json +10 -19
  266. package/src/adapters/BitcoinBaseAdapter.ts +5 -0
  267. package/src/adapters/BlockchainAdapter.ts +48 -21
  268. package/src/adapters/EvmAdapter.ts +186 -18
  269. package/src/adapters/SolanaBaseAdapter.ts +3 -1
  270. package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
  271. package/src/index.ts +3 -1
  272. package/src/networks/bitcoin.ts +1 -1
  273. package/src/networks/solana.ts +1 -1
  274. package/src/types/api/blockchain-api.ts +213 -0
  275. package/src/types/api/events.ts +462 -0
  276. package/src/types/api/index.ts +4 -0
  277. package/src/types/api/wallet-api.ts +71 -0
  278. package/src/types/blockchain/adapter.ts +52 -0
  279. package/src/types/blockchain/balance.ts +31 -0
  280. package/src/types/blockchain/index.ts +5 -0
  281. package/src/types/blockchain/network.ts +39 -0
  282. package/src/types/blockchain/transaction.ts +71 -0
  283. package/src/types/common.ts +56 -0
  284. package/src/types/index.ts +28 -0
  285. package/src/types/onramp/countries.ts +11 -0
  286. package/src/types/onramp/currencies.ts +32 -0
  287. package/src/types/onramp/errors.ts +22 -0
  288. package/src/types/onramp/index.ts +5 -0
  289. package/src/types/onramp/quotes.ts +46 -0
  290. package/src/types/siwx/config.ts +73 -0
  291. package/src/types/siwx/index.ts +4 -0
  292. package/src/types/siwx/message.ts +92 -0
  293. package/src/types/siwx/storage.ts +44 -0
  294. package/src/types/siwx/verifier.ts +32 -0
  295. package/src/types/storage.ts +64 -0
  296. package/src/types/swap/index.ts +2 -0
  297. package/src/types/swap/tokens.ts +21 -0
  298. package/src/types/ui.ts +26 -0
  299. package/src/types/wallet/connection.ts +34 -0
  300. package/src/types/wallet/connector.ts +83 -0
  301. package/src/types/wallet/index.ts +4 -0
  302. package/src/types/wallet/wallet-info.ts +42 -0
  303. package/src/utils/ConstantsUtil.ts +48 -7
  304. package/src/utils/ErrorUtil.ts +2 -2
  305. package/src/utils/NetworkUtil.ts +5 -0
  306. package/src/utils/PresetsUtil.ts +0 -25
  307. package/src/utils/StringUtil.ts +7 -0
  308. package/lib/commonjs/utils/TypeUtil.js.map +0 -1
  309. package/lib/module/utils/TypeUtil.js.map +0 -1
  310. package/lib/typescript/utils/TypeUtil.d.ts +0 -276
  311. package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
  312. package/src/utils/TypeUtil.ts +0 -336
@@ -0,0 +1,71 @@
1
+ export type TransactionStatus = 'confirmed' | 'failed' | 'pending';
2
+ export type TransactionDirection = 'in' | 'out' | 'self';
3
+ export type TransactionImage = {
4
+ type: 'FUNGIBLE' | 'NFT' | undefined;
5
+ url: string | undefined;
6
+ };
7
+
8
+ export interface Transaction {
9
+ id: string;
10
+ metadata: TransactionMetadata;
11
+ transfers: TransactionTransfer[];
12
+ }
13
+
14
+ export interface TransactionMetadata {
15
+ application: {
16
+ iconUrl: string | null;
17
+ name: string | null;
18
+ };
19
+ operationType: string;
20
+ hash: string;
21
+ minedAt: string;
22
+ sentFrom: string;
23
+ sentTo: string;
24
+ status: TransactionStatus;
25
+ nonce: number;
26
+ chain?: string;
27
+ }
28
+
29
+ export interface TransactionTransfer {
30
+ fungible_info?: {
31
+ name?: string;
32
+ symbol?: string;
33
+ icon?: {
34
+ url: string;
35
+ };
36
+ };
37
+ nft_info?: TransactionNftInfo;
38
+ direction: TransactionDirection;
39
+ quantity: TransactionQuantity;
40
+ value?: number;
41
+ price?: number;
42
+ }
43
+
44
+ export interface TransactionNftInfo {
45
+ name?: string;
46
+ content?: TransactionContent;
47
+ flags: TransactionNftInfoFlags;
48
+ }
49
+
50
+ export interface TransactionNftInfoFlags {
51
+ is_spam: boolean;
52
+ }
53
+
54
+ export interface TransactionContent {
55
+ preview?: TransactionPreview;
56
+ detail?: TransactionDetail;
57
+ }
58
+
59
+ export interface TransactionPreview {
60
+ url: string;
61
+ content_type?: null;
62
+ }
63
+
64
+ export interface TransactionDetail {
65
+ url: string;
66
+ content_type?: null;
67
+ }
68
+
69
+ export interface TransactionQuantity {
70
+ numeric: string;
71
+ }
@@ -0,0 +1,56 @@
1
+ // Common types used across the AppKit ecosystem
2
+
3
+ export type CaipAddress = `${string}:${string}:${string}`;
4
+
5
+ export type CaipNetworkId = `${string}:${string}`;
6
+
7
+ export type ChainNamespace = 'eip155' | 'solana' | 'bip122';
8
+
9
+ export type AdapterType = 'solana' | 'wagmi' | 'ethers' | 'universal' | 'bip122';
10
+
11
+ export type AccountType = 'eoa' | 'smartAccount';
12
+
13
+ export type SocialProvider =
14
+ | 'google'
15
+ | 'facebook'
16
+ | 'github'
17
+ | 'apple'
18
+ | 'x'
19
+ | 'discord'
20
+ | 'email'
21
+ | 'farcaster';
22
+
23
+ export type ThemeMode = 'dark' | 'light';
24
+
25
+ export interface ThemeVariables {
26
+ accent?: string;
27
+ }
28
+
29
+ export interface BaseError {
30
+ message?: string;
31
+ }
32
+
33
+ export type ProjectId = string;
34
+
35
+ export type Platform = 'mobile' | 'web' | 'qrcode' | 'email' | 'unsupported';
36
+
37
+ export type SdkType = 'appkit';
38
+
39
+ export type SdkVersion = `react-native-${string}-${string}`;
40
+
41
+ export type RequestCache =
42
+ | 'default'
43
+ | 'force-cache'
44
+ | 'no-cache'
45
+ | 'no-store'
46
+ | 'only-if-cached'
47
+ | 'reload';
48
+
49
+ export type CaipNamespaces = Record<
50
+ string,
51
+ {
52
+ chains: CaipNetworkId[];
53
+ methods: string[];
54
+ events: string[];
55
+ }
56
+ >;
@@ -0,0 +1,28 @@
1
+ // Main types barrel export - re-exports all types from all domains
2
+
3
+ // Common types
4
+ export * from './common';
5
+
6
+ // Blockchain types
7
+ export * from './blockchain';
8
+
9
+ // Wallet types
10
+ export * from './wallet';
11
+
12
+ // API types
13
+ export * from './api';
14
+
15
+ // Swap types
16
+ export * from './swap';
17
+
18
+ // OnRamp types
19
+ export * from './onramp';
20
+
21
+ // SIWX types
22
+ export * from './siwx';
23
+
24
+ // Storage types
25
+ export * from './storage';
26
+
27
+ // UI types
28
+ export * from './ui';
@@ -0,0 +1,11 @@
1
+ export type OnRampCountry = {
2
+ countryCode: string;
3
+ flagImageUrl: string;
4
+ name: string;
5
+ };
6
+
7
+ export type OnRampCountryDefaults = {
8
+ countryCode: string;
9
+ defaultCurrencyCode: string;
10
+ defaultPaymentMethods: string[];
11
+ };
@@ -0,0 +1,32 @@
1
+ export type OnRampFiatCurrency = {
2
+ currencyCode: string;
3
+ name: string;
4
+ symbolImageUrl: string;
5
+ };
6
+
7
+ export type OnRampCryptoCurrency = {
8
+ currencyCode: string;
9
+ name: string;
10
+ chainCode: string;
11
+ chainName: string;
12
+ chainId: string;
13
+ contractAddress: string | null;
14
+ symbolImageUrl: string;
15
+ };
16
+
17
+ export type OnRampFiatLimit = {
18
+ currencyCode: string;
19
+ defaultAmount: number | null;
20
+ minimumAmount: number;
21
+ maximumAmount: number;
22
+ };
23
+
24
+ export type OnRampTransactionResult = {
25
+ purchaseCurrency: string | null;
26
+ purchaseAmount: string | null;
27
+ purchaseImageUrl: string | null;
28
+ paymentCurrency: string | null;
29
+ paymentAmount: string | null;
30
+ status: string | null;
31
+ network: string | null;
32
+ };
@@ -0,0 +1,22 @@
1
+ export const OnRampErrorType = {
2
+ AMOUNT_TOO_LOW: 'INVALID_AMOUNT_TOO_LOW',
3
+ AMOUNT_TOO_HIGH: 'INVALID_AMOUNT_TOO_HIGH',
4
+ INVALID_AMOUNT: 'INVALID_AMOUNT',
5
+ INCOMPATIBLE_REQUEST: 'INCOMPATIBLE_REQUEST',
6
+ BAD_REQUEST: 'BAD_REQUEST',
7
+ NO_VALID_QUOTES: 'NO_VALID_QUOTES',
8
+ FAILED_TO_LOAD: 'FAILED_TO_LOAD',
9
+ FAILED_TO_LOAD_COUNTRIES: 'FAILED_TO_LOAD_COUNTRIES',
10
+ FAILED_TO_LOAD_PROVIDERS: 'FAILED_TO_LOAD_PROVIDERS',
11
+ FAILED_TO_LOAD_METHODS: 'FAILED_TO_LOAD_METHODS',
12
+ FAILED_TO_LOAD_CURRENCIES: 'FAILED_TO_LOAD_CURRENCIES',
13
+ FAILED_TO_LOAD_LIMITS: 'FAILED_TO_LOAD_LIMITS',
14
+ UNKNOWN: 'UNKNOWN_ERROR'
15
+ } as const;
16
+
17
+ export type OnRampErrorTypeValues = (typeof OnRampErrorType)[keyof typeof OnRampErrorType];
18
+
19
+ export interface OnRampError {
20
+ type: OnRampErrorTypeValues;
21
+ message: string;
22
+ }
@@ -0,0 +1,5 @@
1
+ // OnRamp types barrel export
2
+ export * from './countries';
3
+ export * from './currencies';
4
+ export * from './quotes';
5
+ export * from './errors';
@@ -0,0 +1,46 @@
1
+ export type OnRampPaymentMethod = {
2
+ logos: {
3
+ dark: string;
4
+ light: string;
5
+ };
6
+ name: string;
7
+ paymentMethod: string;
8
+ paymentType: string;
9
+ };
10
+
11
+ export type OnRampQuote = {
12
+ countryCode: string;
13
+ customerScore: number;
14
+ destinationAmount: number;
15
+ destinationAmountWithoutFees: number;
16
+ destinationCurrencyCode: string;
17
+ exchangeRate: number;
18
+ fiatAmountWithoutFees: number;
19
+ lowKyc: boolean;
20
+ networkFee: number;
21
+ paymentMethodType: string;
22
+ serviceProvider: string;
23
+ sourceAmount: number;
24
+ sourceAmountWithoutFees: number;
25
+ sourceCurrencyCode: string;
26
+ totalFee: number;
27
+ transactionFee: number;
28
+ transactionType: string;
29
+ };
30
+
31
+ export type OnRampServiceProvider = {
32
+ categories: string[];
33
+ categoryStatuses: {
34
+ additionalProp: string;
35
+ };
36
+ logos: {
37
+ dark: string;
38
+ darkShort: string;
39
+ light: string;
40
+ lightShort: string;
41
+ };
42
+ name: string;
43
+ serviceProvider: string;
44
+ status: string;
45
+ websiteUrl: string;
46
+ };
@@ -0,0 +1,73 @@
1
+ import type { CaipNetworkId } from '../common';
2
+ import type { SIWXSession, SIWXMessage } from './message';
3
+
4
+ /**
5
+ * This interface represents the SIWX configuration plugin, which is used to create and manage SIWX messages and sessions.
6
+ * You may use it to create a custom implementation following your needs, but watch close for the methods requirements.
7
+ */
8
+ export interface SIWXConfig {
9
+ /**
10
+ * This method will be called to create a new message to be signed by the user.
11
+ *
12
+ * Constraints:
13
+ * - The message MUST be unique and contain all the necessary information to verify the user's identity.
14
+ * - SIWXMessage.toString() method MUST be implemented to return the message string.
15
+ *
16
+ * @param input SIWXMessage.Input
17
+ * @returns SIWXMessage
18
+ */
19
+ createMessage: (input: SIWXMessage.Input) => Promise<SIWXMessage>;
20
+ /**
21
+ * This method will be called to store a new single session.
22
+ *
23
+ * Constraints:
24
+ * - This method MUST verify if the session is valid and store it in the storage successfully.
25
+ *
26
+ * @param session SIWXSession
27
+ */
28
+ addSession: (session: SIWXSession) => Promise<void>;
29
+ /**
30
+ * This method will be called to revoke all the sessions stored for a specific chain and address.
31
+ *
32
+ * Constraints:
33
+ * - This method MUST delete all the sessions stored for the specific chain and address successfully.
34
+ *
35
+ * @param chainId CaipNetworkId
36
+ * @param address string
37
+ */
38
+ revokeSession: (chainId: CaipNetworkId, address: string) => Promise<void>;
39
+ /**
40
+ * This method will be called to replace all the sessions in the storage with the new ones.
41
+ *
42
+ * Constraints:
43
+ * - This method MUST verify all the sessions before storing them in the storage;
44
+ * - This method MUST replace all the sessions in the storage with the new ones succesfully otherwise it MUST throw an error.
45
+ *
46
+ * @param sessions SIWXSession[]
47
+ */
48
+ setSessions: (sessions: SIWXSession[]) => Promise<void>;
49
+ /**
50
+ * This method will be called to get all the sessions stored for a specific chain and address.
51
+ *
52
+ * Constraints:
53
+ * - This method MUST return only sessions that are verified and valid;
54
+ * - This method MUST NOT return expired sessions.
55
+ *
56
+ * @param chainId CaipNetworkId
57
+ * @param address string
58
+ * @returns
59
+ */
60
+ getSessions: (chainId: CaipNetworkId, address: string) => Promise<SIWXSession[]>;
61
+ /**
62
+ * This method determines whether the wallet stays connected when the user denies the signature request.
63
+ *
64
+ * @returns {boolean}
65
+ */
66
+ getRequired?: () => boolean;
67
+ /**
68
+ * This flag determines whether the session should be cleared when the user disconnects.
69
+ *
70
+ * @default true
71
+ */
72
+ signOutOnDisconnect?: boolean;
73
+ }
@@ -0,0 +1,4 @@
1
+ export * from './config';
2
+ export * from './message';
3
+ export * from './verifier';
4
+ export * from './storage';
@@ -0,0 +1,92 @@
1
+ import type { CaipNetworkId } from '../common';
2
+
3
+ /**
4
+ * This interface represents a SIWX session, which is used to store the user's identity information.
5
+ */
6
+ export interface SIWXSession {
7
+ data: SIWXMessage.Data;
8
+ message: string;
9
+ signature: string;
10
+ cacao?: Cacao;
11
+ }
12
+ /**
13
+ * This interface represents a SIWX message, which is used to create a message to be signed by the user.
14
+ * This must contain the necessary information to verify the user's identity and how to generate the string message.
15
+ */
16
+ export interface SIWXMessage extends SIWXMessage.Data, SIWXMessage.Methods {}
17
+ export declare namespace SIWXMessage {
18
+ /**
19
+ * This interface represents the SIWX message data, which is used to create a message to be signed by the user.
20
+ */
21
+ interface Data extends Input, Metadata, Identifier {}
22
+ /**
23
+ * This interface represents the SIWX message input.
24
+ * Here must contain what is different for each user of the application.
25
+ */
26
+ interface Input {
27
+ accountAddress: string;
28
+ chainId: CaipNetworkId;
29
+ notBefore?: Timestamp;
30
+ }
31
+ /**
32
+ * This interface represents the SIWX message metadata.
33
+ * Here must contain the main data related to the app.
34
+ */
35
+ interface Metadata {
36
+ domain: string;
37
+ uri: string;
38
+ version: string;
39
+ nonce: string;
40
+ statement?: string;
41
+ resources?: string[];
42
+ }
43
+ /**
44
+ * This interface represents the SIWX message identifier.
45
+ * Here must contain the request id and the timestamps.
46
+ */
47
+ interface Identifier {
48
+ requestId?: string;
49
+ issuedAt?: Timestamp;
50
+ expirationTime?: Timestamp;
51
+ }
52
+ /**
53
+ * This interface represents the SIWX message methods.
54
+ * Here must contain the method to generate the message string and any other method performed by the SIWX message.
55
+ */
56
+ interface Methods {
57
+ toString: () => string;
58
+ }
59
+ /**
60
+ * The timestamp is a UTC string representing the time in ISO 8601 format.
61
+ */
62
+ type Timestamp = string;
63
+ }
64
+
65
+ interface CacaoHeader {
66
+ t: 'caip122';
67
+ }
68
+
69
+ interface CacaoPayload {
70
+ domain: string;
71
+ aud: string;
72
+ nonce: string;
73
+ iss: string;
74
+ version?: string;
75
+ iat?: string;
76
+ nbf?: string;
77
+ exp?: string;
78
+ statement?: string;
79
+ requestId?: string;
80
+ resources?: string[];
81
+ type?: string;
82
+ }
83
+
84
+ interface Cacao {
85
+ h: CacaoHeader;
86
+ p: CacaoPayload;
87
+ s: {
88
+ t: 'eip191' | 'eip1271';
89
+ s: string;
90
+ m?: string;
91
+ };
92
+ }
@@ -0,0 +1,44 @@
1
+ import type { CaipNetworkId } from '../common';
2
+ import type { SIWXSession } from './message';
3
+
4
+ /**
5
+ * This is the interface for a SIWX storage.
6
+ */
7
+ export interface SIWXStorage {
8
+ /**
9
+ * Adds a new session for the storage.
10
+ * This method should not verify the session, only store it.
11
+ *
12
+ * @param session SIWXSession
13
+ * @returns Promise<void>
14
+ */
15
+ add(session: SIWXSession): Promise<void>;
16
+
17
+ /**
18
+ * Deletes a session from the storage.
19
+ *
20
+ * @param chainId CaipNetworkId
21
+ * @param address string
22
+ * @returns Promise<void>
23
+ */
24
+ delete(chainId: CaipNetworkId, address: string): Promise<void>;
25
+
26
+ /**
27
+ * Gets a list of sessions for a given chainId and address.
28
+ * This method should not verify sessions, only return the sessions that are stored.
29
+ *
30
+ * @param chainId CaipNetworkId
31
+ * @param address string
32
+ * @returns Promise<SIWXSession[]>
33
+ */
34
+ get(chainId: CaipNetworkId, address: string): Promise<SIWXSession[]>;
35
+
36
+ /**
37
+ * Replaces the current sessions with the new list of sessions.
38
+ * This method should not verify sessions, only store them.
39
+ *
40
+ * @param sessions SIWXSession[]
41
+ * @returns Promise<void>
42
+ */
43
+ set(sessions: SIWXSession[]): Promise<void>;
44
+ }
@@ -0,0 +1,32 @@
1
+ import type { ChainNamespace } from '../common';
2
+ import type { SIWXSession } from './message';
3
+
4
+ /**
5
+ * This is the base class for a SIWX verifier.
6
+ */
7
+ export abstract class SIWXVerifier {
8
+ /**
9
+ * The chain namespace that this verifier should verify.
10
+ */
11
+ public abstract readonly chainNamespace: ChainNamespace;
12
+
13
+ /**
14
+ * This method should return true if the verifier should verify the session.
15
+ * By default it will check by the chain namespace, but you may override it for a specific requirement.
16
+ *
17
+ * @param session SIWXSession
18
+ * @returns boolean
19
+ */
20
+ public shouldVerify(session: SIWXSession): boolean {
21
+ return session.data.chainId.startsWith(this.chainNamespace);
22
+ }
23
+
24
+ /**
25
+ * This method should verify the session.
26
+ * You must implement this method with the verification logic.
27
+ *
28
+ * @param session SIWXSession
29
+ * @returns Promise<boolean> - If `true` means the session is valid.
30
+ */
31
+ abstract verify(session: SIWXSession): Promise<boolean>;
32
+ }
@@ -0,0 +1,64 @@
1
+ export interface Storage {
2
+ /**
3
+ * Returns all keys in storage.
4
+ */
5
+ getKeys(): Promise<string[]>;
6
+
7
+ /**
8
+ * Returns all key-value entries in storage.
9
+ */
10
+ getEntries<T = any>(): Promise<[string, T][]>;
11
+
12
+ /**
13
+ * Get an item from storage for a given key.
14
+ * @param key The key to retrieve.
15
+ */
16
+ getItem<T = any>(key: string): Promise<T | undefined>;
17
+
18
+ /**
19
+ * Set an item in storage for a given key.
20
+ * @param key The key to set.
21
+ * @param value The value to set.
22
+ */
23
+ setItem<T = any>(key: string, value: T): Promise<void>;
24
+
25
+ /**
26
+ * Remove an item from storage for a given key.
27
+ * @param key The key to remove.
28
+ */
29
+ removeItem(key: string): Promise<void>;
30
+ }
31
+
32
+ export interface SafeStorageItems {
33
+ 'WALLETCONNECT_DEEPLINK_CHOICE': string; //dont change this one
34
+ '@appkit/recent_wallet': string;
35
+ '@appkit/connected_connectors': string;
36
+ '@appkit/onramp_preferred_country': string;
37
+ '@appkit/onramp_countries': string;
38
+ '@appkit/onramp_service_providers': string;
39
+ '@appkit/onramp_fiat_limits': string;
40
+ '@appkit/onramp_fiat_currencies': string;
41
+ '@appkit/onramp_preferred_fiat_currency': string;
42
+ '@appkit/onramp_countries_defaults': string;
43
+ '@appkit/active_namespace': string;
44
+ '@appkit/coinbase_connector/session': string;
45
+ '@appkit/siwx-auth-token': string;
46
+ '@appkit/siwx-nonce-token': string;
47
+ }
48
+
49
+ export const SafeStorageKeys = {
50
+ WC_DEEPLINK: 'WALLETCONNECT_DEEPLINK_CHOICE', //dont change this one
51
+ RECENT_WALLET: '@appkit/recent_wallet',
52
+ CONNECTED_CONNECTORS: '@appkit/connected_connectors',
53
+ ONRAMP_PREFERRED_COUNTRY: '@appkit/onramp_preferred_country',
54
+ ONRAMP_COUNTRIES: '@appkit/onramp_countries',
55
+ ONRAMP_SERVICE_PROVIDERS: '@appkit/onramp_service_providers',
56
+ ONRAMP_FIAT_LIMITS: '@appkit/onramp_fiat_limits',
57
+ ONRAMP_FIAT_CURRENCIES: '@appkit/onramp_fiat_currencies',
58
+ ONRAMP_PREFERRED_FIAT_CURRENCY: '@appkit/onramp_preferred_fiat_currency',
59
+ ONRAMP_COUNTRIES_DEFAULTS: '@appkit/onramp_countries_defaults',
60
+ ACTIVE_NAMESPACE: '@appkit/active_namespace',
61
+ COINBASE_CONNECTOR_SESSION: '@appkit/coinbase_connector/session',
62
+ SIWX_AUTH_TOKEN: '@appkit/siwx-auth-token',
63
+ SIWX_NONCE_TOKEN: '@appkit/siwx-nonce-token'
64
+ } as const;
@@ -0,0 +1,2 @@
1
+ // Swap types barrel export
2
+ export * from './tokens';
@@ -0,0 +1,21 @@
1
+ import type { CaipAddress } from '../common';
2
+
3
+ export type SwapToken = {
4
+ name: string;
5
+ symbol: string;
6
+ address: CaipAddress;
7
+ decimals: number;
8
+ logoUri: string;
9
+ eip2612?: boolean;
10
+ };
11
+
12
+ export type SwapTokenWithBalance = SwapToken & {
13
+ quantity: {
14
+ decimals: string;
15
+ numeric: string;
16
+ };
17
+ price: number;
18
+ value: number;
19
+ };
20
+
21
+ export type SwapInputTarget = 'sourceToken' | 'toToken';
@@ -0,0 +1,26 @@
1
+ import type { SocialProvider } from './common';
2
+
3
+ type EnabledSocials = SocialProvider;
4
+
5
+ export type Features = {
6
+ /**
7
+ * @description Enable or disable the swaps feature. Enabled by default.
8
+ * @type {boolean}
9
+ */
10
+ swaps?: boolean;
11
+ /**
12
+ * @description Enable or disable the onramp feature. Enabled by default.
13
+ * @type {boolean}
14
+ */
15
+ onramp?: boolean;
16
+ /**
17
+ * @description Show or hide the regular wallet options when socials are enabled. Enabled by default.
18
+ * @type {boolean}
19
+ */
20
+ showWallets?: boolean;
21
+ /**
22
+ * @description Enable or disable the socials feature. Enabled by default.
23
+ * @type {EnabledSocials[]}
24
+ */
25
+ socials?: EnabledSocials[] | false;
26
+ };
@@ -0,0 +1,34 @@
1
+ import type { CaipAddress, CaipNetworkId, SocialProvider, AccountType } from '../common';
2
+ import type { Balance } from '../blockchain/balance';
3
+ import type { WalletInfo, Identity } from './wallet-info';
4
+ import type { BlockchainAdapter } from '../../adapters/BlockchainAdapter';
5
+
6
+ export interface Connection {
7
+ accounts: CaipAddress[];
8
+ balances: Map<CaipAddress, Balance[]>;
9
+ adapter: BlockchainAdapter;
10
+ caipNetwork: CaipNetworkId;
11
+ wallet?: WalletInfo;
12
+ properties?: ConnectionProperties;
13
+ type?: AccountType;
14
+ identities?: Map<CaipAddress, Identity>;
15
+ }
16
+
17
+ export interface ConnectionProperties {
18
+ email?: string;
19
+ username?: string;
20
+ smartAccounts?: CaipAddress[];
21
+ provider?: SocialProvider;
22
+ sessionTopic?: string;
23
+ canAddEvmChain?: boolean;
24
+ }
25
+
26
+ export interface LinkingRecord {
27
+ redirect: string;
28
+ href: string;
29
+ }
30
+
31
+ export interface WalletDeepLink {
32
+ href: string;
33
+ name: string;
34
+ }