@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
@@ -0,0 +1,52 @@
1
+ import type { ChainNamespace, CaipAddress, AdapterType } from '../common';
2
+ import type { WalletConnector } from '../wallet';
3
+ import type { BalanceChangedEvent } from './balance';
4
+
5
+ export interface BlockchainAdapterConfig {
6
+ supportedNamespace: ChainNamespace;
7
+ adapterType: AdapterType;
8
+ }
9
+
10
+ export interface BlockchainAdapterInitParams {
11
+ connector: WalletConnector;
12
+ }
13
+
14
+ export interface AdapterEvents {
15
+ accountsChanged: (event: AccountsChangedEvent) => void;
16
+ chainChanged: (event: ChainChangedEvent) => void;
17
+ disconnect: (event: DisconnectEvent) => void;
18
+ balanceChanged: (event: BalanceChangedEvent) => void;
19
+ }
20
+
21
+ export type AccountsChangedEvent = {
22
+ accounts: CaipAddress[];
23
+ };
24
+
25
+ export type ChainChangedEvent = {
26
+ chainId: string;
27
+ };
28
+
29
+ export type DisconnectEvent = undefined;
30
+
31
+ export interface Provider {
32
+ connect<T>(params?: any): Promise<T>;
33
+ disconnect(): Promise<void>;
34
+ request<T = unknown>(
35
+ args: RequestArguments,
36
+ chain?: string | undefined,
37
+ expiry?: number | undefined
38
+ ): Promise<T>;
39
+ on(event: string, listener: (args?: any) => void): any;
40
+ off(event: string, listener: (args?: any) => void): any;
41
+ }
42
+
43
+ export interface RequestArguments {
44
+ method: string;
45
+ params?: unknown[] | Record<string, unknown> | object | undefined;
46
+ }
47
+
48
+ export interface ConnectionResponse {
49
+ accounts: string[];
50
+ chainId: string;
51
+ [key: string]: any;
52
+ }
@@ -0,0 +1,31 @@
1
+ import type { CaipAddress } from '../common';
2
+ import type { Tokens } from '../wallet';
3
+ import type { AppKitNetwork } from './network';
4
+
5
+ export interface Balance {
6
+ name?: string;
7
+ amount: string;
8
+ symbol: string;
9
+ quantity?: {
10
+ decimals: string;
11
+ numeric: string;
12
+ };
13
+ chainId?: string;
14
+ address?: CaipAddress; // contract address
15
+ value?: number; //total value of the amount in currency
16
+ price?: number; //price of the token in currency
17
+ iconUrl?: string;
18
+ }
19
+
20
+ export interface GetBalanceParams {
21
+ network: AppKitNetwork;
22
+ address?: CaipAddress;
23
+ tokens?: Tokens;
24
+ }
25
+
26
+ export type GetBalanceResponse = Balance;
27
+
28
+ export type BalanceChangedEvent = {
29
+ address: CaipAddress;
30
+ balance: Balance;
31
+ };
@@ -0,0 +1,5 @@
1
+ // Blockchain types barrel export
2
+ export * from './adapter';
3
+ export * from './balance';
4
+ export * from './network';
5
+ export * from './transaction';
@@ -0,0 +1,39 @@
1
+ import type { ChainNamespace, CaipNetworkId } from '../common';
2
+
3
+ export type Network = {
4
+ // Core viem/chain properties
5
+ id: number | string;
6
+ name: string;
7
+ nativeCurrency: { name: string; symbol: string; decimals: number };
8
+ rpcUrls: {
9
+ default: { http: readonly string[] };
10
+ [key: string]: { http: readonly string[] } | undefined;
11
+ };
12
+ blockExplorers?: {
13
+ default: { name: string; url: string };
14
+ [key: string]: { name: string; url: string } | undefined;
15
+ };
16
+
17
+ // AppKit specific / CAIP properties (Optional in type, but needed in practice)
18
+ chainNamespace?: ChainNamespace; // e.g., 'eip155'
19
+ caipNetworkId?: CaipNetworkId; // e.g., 'eip155:1'
20
+ testnet?: boolean;
21
+ deprecatedCaipNetworkId?: CaipNetworkId; // for Solana deprecated id
22
+ imageUrl?: string;
23
+ };
24
+
25
+ export type AppKitNetwork = Network & {
26
+ chainNamespace: ChainNamespace; // mandatory for AppKitNetwork
27
+ caipNetworkId: CaipNetworkId; // mandatory for AppKitNetwork
28
+ };
29
+
30
+ export interface CaipNetwork {
31
+ id: CaipNetworkId;
32
+ name?: string;
33
+ imageId?: string;
34
+ imageUrl?: string;
35
+ }
36
+
37
+ export interface AppKitOpenOptions {
38
+ view: 'Account' | 'Connect' | 'Networks' | 'Swap' | 'OnRamp';
39
+ }
@@ -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' | 'polkadot' | '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
+ // SIWE types
22
+ export * from './siwe';
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,44 @@
1
+ import type {
2
+ SIWESession,
3
+ SIWECreateMessageArgs,
4
+ SIWEMessageArgs,
5
+ SIWEVerifyMessageArgs
6
+ } from './message';
7
+
8
+ export interface SIWEClientMethods {
9
+ getNonce: (address?: string) => Promise<string>;
10
+ createMessage: (args: SIWECreateMessageArgs) => string;
11
+ verifyMessage: (args: SIWEVerifyMessageArgs) => Promise<boolean>;
12
+ getSession: () => Promise<SIWESession | null>;
13
+ signOut: () => Promise<boolean>;
14
+ getMessageParams?: () => Promise<SIWEMessageArgs>;
15
+ onSignIn?: (session?: SIWESession) => void;
16
+ onSignOut?: () => void;
17
+ }
18
+
19
+ export interface SIWEConfig extends SIWEClientMethods {
20
+ // Defaults to true
21
+ enabled?: boolean;
22
+ // In milliseconds, defaults to 5 minutes
23
+ nonceRefetchIntervalMs?: number;
24
+ // In milliseconds, defaults to 5 minutes
25
+ sessionRefetchIntervalMs?: number;
26
+ // Defaults to true
27
+ signOutOnDisconnect?: boolean;
28
+ // Defaults to true
29
+ signOutOnAccountChange?: boolean;
30
+ // Defaults to true
31
+ signOutOnNetworkChange?: boolean;
32
+ }
33
+
34
+ export interface AppKitSIWEClient extends SIWEClientMethods {
35
+ signIn: () => Promise<SIWESession | undefined>;
36
+ options: {
37
+ enabled: boolean;
38
+ nonceRefetchIntervalMs: number;
39
+ sessionRefetchIntervalMs: number;
40
+ signOutOnDisconnect: boolean;
41
+ signOutOnAccountChange: boolean;
42
+ signOutOnNetworkChange: boolean;
43
+ };
44
+ }
@@ -0,0 +1,3 @@
1
+ // SIWE types barrel export
2
+ export * from './config';
3
+ export * from './message';
@@ -0,0 +1,62 @@
1
+ import type { CaipAddress, CaipNetworkId } from '../common';
2
+
3
+ export interface SIWESession {
4
+ address: string;
5
+ chainId: number;
6
+ }
7
+
8
+ interface CacaoHeader {
9
+ t: 'caip122';
10
+ }
11
+
12
+ export interface SIWECreateMessageArgs {
13
+ domain: string;
14
+ nonce: string;
15
+ uri: string;
16
+ address: CaipAddress;
17
+ version: '1';
18
+ type?: CacaoHeader['t'];
19
+ nbf?: string;
20
+ exp?: string;
21
+ statement?: string;
22
+ requestId?: string;
23
+ resources?: string[];
24
+ expiry?: number;
25
+ iat?: string;
26
+ }
27
+
28
+ export type SIWEMessageArgs = {
29
+ chains: CaipNetworkId[];
30
+ methods?: string[];
31
+ } & Omit<SIWECreateMessageArgs, 'address' | 'nonce' | 'version'>;
32
+
33
+ interface CacaoPayload {
34
+ domain: string;
35
+ aud: string;
36
+ nonce: string;
37
+ iss: string;
38
+ version?: string;
39
+ iat?: string;
40
+ nbf?: string;
41
+ exp?: string;
42
+ statement?: string;
43
+ requestId?: string;
44
+ resources?: string[];
45
+ type?: string;
46
+ }
47
+
48
+ interface Cacao {
49
+ h: CacaoHeader;
50
+ p: CacaoPayload;
51
+ s: {
52
+ t: 'eip191' | 'eip1271';
53
+ s: string;
54
+ m?: string;
55
+ };
56
+ }
57
+
58
+ export interface SIWEVerifyMessageArgs {
59
+ message: string;
60
+ signature: string;
61
+ cacao?: Cacao;
62
+ }
@@ -0,0 +1,30 @@
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
+ }
@@ -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,33 @@
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
+ }
24
+
25
+ export interface LinkingRecord {
26
+ redirect: string;
27
+ href: string;
28
+ }
29
+
30
+ export interface WalletDeepLink {
31
+ href: string;
32
+ name: string;
33
+ }