@sodax/sdk 0.0.1-rc.4 → 0.0.1-rc.41

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 (304) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +176 -11
  3. package/dist/index.cjs +18618 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +11181 -0
  6. package/dist/index.d.ts +11180 -9
  7. package/dist/index.mjs +18348 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +32 -32
  10. package/dist/abis/asset-manager.abi.d.ts +0 -418
  11. package/dist/abis/asset-manager.abi.d.ts.map +0 -1
  12. package/dist/abis/asset-manager.abi.js +0 -542
  13. package/dist/abis/asset-manager.abi.js.map +0 -1
  14. package/dist/abis/connection.abi.d.ts +0 -72
  15. package/dist/abis/connection.abi.d.ts.map +0 -1
  16. package/dist/abis/connection.abi.js +0 -92
  17. package/dist/abis/connection.abi.js.map +0 -1
  18. package/dist/abis/erc20.abi.d.ts +0 -236
  19. package/dist/abis/erc20.abi.d.ts.map +0 -1
  20. package/dist/abis/erc20.abi.js +0 -311
  21. package/dist/abis/erc20.abi.js.map +0 -1
  22. package/dist/abis/index.d.ts +0 -10
  23. package/dist/abis/index.d.ts.map +0 -1
  24. package/dist/abis/index.js +0 -10
  25. package/dist/abis/index.js.map +0 -1
  26. package/dist/abis/intents.abi.d.ts +0 -901
  27. package/dist/abis/intents.abi.d.ts.map +0 -1
  28. package/dist/abis/intents.abi.js +0 -1158
  29. package/dist/abis/intents.abi.js.map +0 -1
  30. package/dist/abis/pool.abi.d.ts +0 -626
  31. package/dist/abis/pool.abi.d.ts.map +0 -1
  32. package/dist/abis/pool.abi.js +0 -812
  33. package/dist/abis/pool.abi.js.map +0 -1
  34. package/dist/abis/spokeAssetManager.abi.d.ts +0 -169
  35. package/dist/abis/spokeAssetManager.abi.d.ts.map +0 -1
  36. package/dist/abis/spokeAssetManager.abi.js +0 -217
  37. package/dist/abis/spokeAssetManager.abi.js.map +0 -1
  38. package/dist/abis/uiPoolData.abi.d.ts +0 -369
  39. package/dist/abis/uiPoolData.abi.d.ts.map +0 -1
  40. package/dist/abis/uiPoolData.abi.js +0 -476
  41. package/dist/abis/uiPoolData.abi.js.map +0 -1
  42. package/dist/abis/vaultToken.abi.d.ts +0 -816
  43. package/dist/abis/vaultToken.abi.d.ts.map +0 -1
  44. package/dist/abis/vaultToken.abi.js +0 -1062
  45. package/dist/abis/vaultToken.abi.js.map +0 -1
  46. package/dist/abis/walletFactory.abi.d.ts +0 -20
  47. package/dist/abis/walletFactory.abi.d.ts.map +0 -1
  48. package/dist/abis/walletFactory.abi.js +0 -27
  49. package/dist/abis/walletFactory.abi.js.map +0 -1
  50. package/dist/constants.d.ts +0 -550
  51. package/dist/constants.d.ts.map +0 -1
  52. package/dist/constants.js +0 -1196
  53. package/dist/constants.js.map +0 -1
  54. package/dist/constants.test.d.ts +0 -2
  55. package/dist/constants.test.d.ts.map +0 -1
  56. package/dist/constants.test.js +0 -129
  57. package/dist/constants.test.js.map +0 -1
  58. package/dist/entities/Providers.d.ts +0 -54
  59. package/dist/entities/Providers.d.ts.map +0 -1
  60. package/dist/entities/Providers.js +0 -51
  61. package/dist/entities/Providers.js.map +0 -1
  62. package/dist/entities/Sodax.d.ts +0 -23
  63. package/dist/entities/Sodax.d.ts.map +0 -1
  64. package/dist/entities/Sodax.js +0 -29
  65. package/dist/entities/Sodax.js.map +0 -1
  66. package/dist/entities/Sodax.test.d.ts +0 -2
  67. package/dist/entities/Sodax.test.d.ts.map +0 -1
  68. package/dist/entities/Sodax.test.js +0 -392
  69. package/dist/entities/Sodax.test.js.map +0 -1
  70. package/dist/entities/cosmos/CW20Token.d.ts +0 -39
  71. package/dist/entities/cosmos/CW20Token.d.ts.map +0 -1
  72. package/dist/entities/cosmos/CW20Token.js +0 -65
  73. package/dist/entities/cosmos/CW20Token.js.map +0 -1
  74. package/dist/entities/cosmos/CWSpokeProvider.d.ts +0 -92
  75. package/dist/entities/cosmos/CWSpokeProvider.d.ts.map +0 -1
  76. package/dist/entities/cosmos/CWSpokeProvider.js +0 -143
  77. package/dist/entities/cosmos/CWSpokeProvider.js.map +0 -1
  78. package/dist/entities/cosmos/CosmosWalletProvider.d.ts +0 -28
  79. package/dist/entities/cosmos/CosmosWalletProvider.d.ts.map +0 -1
  80. package/dist/entities/cosmos/CosmosWalletProvider.js +0 -102
  81. package/dist/entities/cosmos/CosmosWalletProvider.js.map +0 -1
  82. package/dist/entities/cosmos/InjectiveWalletProvider.d.ts +0 -25
  83. package/dist/entities/cosmos/InjectiveWalletProvider.d.ts.map +0 -1
  84. package/dist/entities/cosmos/InjectiveWalletProvider.js +0 -76
  85. package/dist/entities/cosmos/InjectiveWalletProvider.js.map +0 -1
  86. package/dist/entities/icon/HanaWalletConnector.d.ts +0 -36
  87. package/dist/entities/icon/HanaWalletConnector.d.ts.map +0 -1
  88. package/dist/entities/icon/HanaWalletConnector.js +0 -92
  89. package/dist/entities/icon/HanaWalletConnector.js.map +0 -1
  90. package/dist/entities/icon/IconSpokeProvider.d.ts +0 -10
  91. package/dist/entities/icon/IconSpokeProvider.d.ts.map +0 -1
  92. package/dist/entities/icon/IconSpokeProvider.js +0 -12
  93. package/dist/entities/icon/IconSpokeProvider.js.map +0 -1
  94. package/dist/entities/icon/index.d.ts +0 -4
  95. package/dist/entities/icon/index.d.ts.map +0 -1
  96. package/dist/entities/icon/index.js +0 -4
  97. package/dist/entities/icon/index.js.map +0 -1
  98. package/dist/entities/icon/utils.d.ts +0 -3
  99. package/dist/entities/icon/utils.d.ts.map +0 -1
  100. package/dist/entities/icon/utils.js +0 -4
  101. package/dist/entities/icon/utils.js.map +0 -1
  102. package/dist/entities/index.d.ts +0 -7
  103. package/dist/entities/index.d.ts.map +0 -1
  104. package/dist/entities/index.js +0 -7
  105. package/dist/entities/index.js.map +0 -1
  106. package/dist/entities/solana/Configs.d.ts +0 -10
  107. package/dist/entities/solana/Configs.d.ts.map +0 -1
  108. package/dist/entities/solana/Configs.js +0 -50
  109. package/dist/entities/solana/Configs.js.map +0 -1
  110. package/dist/entities/solana/SolanaSpokeProvider.d.ts +0 -9
  111. package/dist/entities/solana/SolanaSpokeProvider.d.ts.map +0 -1
  112. package/dist/entities/solana/SolanaSpokeProvider.js +0 -9
  113. package/dist/entities/solana/SolanaSpokeProvider.js.map +0 -1
  114. package/dist/entities/solana/SolanaWalletProvider.d.ts +0 -20
  115. package/dist/entities/solana/SolanaWalletProvider.d.ts.map +0 -1
  116. package/dist/entities/solana/SolanaWalletProvider.js +0 -53
  117. package/dist/entities/solana/SolanaWalletProvider.js.map +0 -1
  118. package/dist/entities/solana/index.d.ts +0 -4
  119. package/dist/entities/solana/index.d.ts.map +0 -1
  120. package/dist/entities/solana/index.js +0 -4
  121. package/dist/entities/solana/index.js.map +0 -1
  122. package/dist/entities/solana/pda/pda.d.ts +0 -45
  123. package/dist/entities/solana/pda/pda.d.ts.map +0 -1
  124. package/dist/entities/solana/pda/pda.js +0 -44
  125. package/dist/entities/solana/pda/pda.js.map +0 -1
  126. package/dist/entities/solana/types/asset_manager.d.ts +0 -919
  127. package/dist/entities/solana/types/asset_manager.d.ts.map +0 -1
  128. package/dist/entities/solana/types/asset_manager.js +0 -2
  129. package/dist/entities/solana/types/asset_manager.js.map +0 -1
  130. package/dist/entities/solana/types/connection.d.ts +0 -446
  131. package/dist/entities/solana/types/connection.d.ts.map +0 -1
  132. package/dist/entities/solana/types/connection.js +0 -2
  133. package/dist/entities/solana/types/connection.js.map +0 -1
  134. package/dist/entities/solana/types/rate_limit_contract.d.ts +0 -348
  135. package/dist/entities/solana/types/rate_limit_contract.d.ts.map +0 -1
  136. package/dist/entities/solana/types/rate_limit_contract.js +0 -2
  137. package/dist/entities/solana/types/rate_limit_contract.js.map +0 -1
  138. package/dist/entities/solana/utils/utils.d.ts +0 -6
  139. package/dist/entities/solana/utils/utils.d.ts.map +0 -1
  140. package/dist/entities/solana/utils/utils.js +0 -18
  141. package/dist/entities/solana/utils/utils.js.map +0 -1
  142. package/dist/entities/stellar/StellarSpokeProvider.d.ts +0 -17
  143. package/dist/entities/stellar/StellarSpokeProvider.d.ts.map +0 -1
  144. package/dist/entities/stellar/StellarSpokeProvider.js +0 -125
  145. package/dist/entities/stellar/StellarSpokeProvider.js.map +0 -1
  146. package/dist/entities/sui/SuiSpokeProvider.d.ts +0 -35
  147. package/dist/entities/sui/SuiSpokeProvider.d.ts.map +0 -1
  148. package/dist/entities/sui/SuiSpokeProvider.js +0 -145
  149. package/dist/entities/sui/SuiSpokeProvider.js.map +0 -1
  150. package/dist/errors.d.ts +0 -2
  151. package/dist/errors.d.ts.map +0 -1
  152. package/dist/errors.js +0 -2
  153. package/dist/errors.js.map +0 -1
  154. package/dist/guards.d.ts +0 -25
  155. package/dist/guards.d.ts.map +0 -1
  156. package/dist/guards.js +0 -110
  157. package/dist/guards.js.map +0 -1
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js +0 -10
  160. package/dist/index.js.map +0 -1
  161. package/dist/services/hub/EvmAssetManagerService.d.ts +0 -61
  162. package/dist/services/hub/EvmAssetManagerService.d.ts.map +0 -1
  163. package/dist/services/hub/EvmAssetManagerService.js +0 -103
  164. package/dist/services/hub/EvmAssetManagerService.js.map +0 -1
  165. package/dist/services/hub/EvmVaultTokenService.d.ts +0 -81
  166. package/dist/services/hub/EvmVaultTokenService.d.ts.map +0 -1
  167. package/dist/services/hub/EvmVaultTokenService.js +0 -161
  168. package/dist/services/hub/EvmVaultTokenService.js.map +0 -1
  169. package/dist/services/hub/EvmWalletAbstraction.d.ts +0 -9
  170. package/dist/services/hub/EvmWalletAbstraction.d.ts.map +0 -1
  171. package/dist/services/hub/EvmWalletAbstraction.js +0 -14
  172. package/dist/services/hub/EvmWalletAbstraction.js.map +0 -1
  173. package/dist/services/hub/index.d.ts +0 -4
  174. package/dist/services/hub/index.d.ts.map +0 -1
  175. package/dist/services/hub/index.js +0 -4
  176. package/dist/services/hub/index.js.map +0 -1
  177. package/dist/services/index.d.ts +0 -7
  178. package/dist/services/index.d.ts.map +0 -1
  179. package/dist/services/index.js +0 -7
  180. package/dist/services/index.js.map +0 -1
  181. package/dist/services/intentRelay/IntentRelayApiService.d.ts +0 -112
  182. package/dist/services/intentRelay/IntentRelayApiService.d.ts.map +0 -1
  183. package/dist/services/intentRelay/IntentRelayApiService.js +0 -160
  184. package/dist/services/intentRelay/IntentRelayApiService.js.map +0 -1
  185. package/dist/services/intentRelay/IntentRelayApiService.test.d.ts +0 -2
  186. package/dist/services/intentRelay/IntentRelayApiService.test.d.ts.map +0 -1
  187. package/dist/services/intentRelay/IntentRelayApiService.test.js +0 -134
  188. package/dist/services/intentRelay/IntentRelayApiService.test.js.map +0 -1
  189. package/dist/services/intentRelay/index.d.ts +0 -2
  190. package/dist/services/intentRelay/index.d.ts.map +0 -1
  191. package/dist/services/intentRelay/index.js +0 -2
  192. package/dist/services/intentRelay/index.js.map +0 -1
  193. package/dist/services/moneyMarket/MoneyMarketService.d.ts +0 -525
  194. package/dist/services/moneyMarket/MoneyMarketService.d.ts.map +0 -1
  195. package/dist/services/moneyMarket/MoneyMarketService.js +0 -814
  196. package/dist/services/moneyMarket/MoneyMarketService.js.map +0 -1
  197. package/dist/services/moneyMarket/MoneyMarketService.test.d.ts +0 -2
  198. package/dist/services/moneyMarket/MoneyMarketService.test.d.ts.map +0 -1
  199. package/dist/services/moneyMarket/MoneyMarketService.test.js +0 -262
  200. package/dist/services/moneyMarket/MoneyMarketService.test.js.map +0 -1
  201. package/dist/services/moneyMarket/index.d.ts +0 -2
  202. package/dist/services/moneyMarket/index.d.ts.map +0 -1
  203. package/dist/services/moneyMarket/index.js +0 -2
  204. package/dist/services/moneyMarket/index.js.map +0 -1
  205. package/dist/services/shared/Erc20Service.d.ts +0 -42
  206. package/dist/services/shared/Erc20Service.d.ts.map +0 -1
  207. package/dist/services/shared/Erc20Service.js +0 -108
  208. package/dist/services/shared/Erc20Service.js.map +0 -1
  209. package/dist/services/shared/index.d.ts +0 -2
  210. package/dist/services/shared/index.d.ts.map +0 -1
  211. package/dist/services/shared/index.js +0 -2
  212. package/dist/services/shared/index.js.map +0 -1
  213. package/dist/services/solver/EvmSolverService.d.ts +0 -125
  214. package/dist/services/solver/EvmSolverService.d.ts.map +0 -1
  215. package/dist/services/solver/EvmSolverService.js +0 -166
  216. package/dist/services/solver/EvmSolverService.js.map +0 -1
  217. package/dist/services/solver/SolverApiService.d.ts +0 -40
  218. package/dist/services/solver/SolverApiService.d.ts.map +0 -1
  219. package/dist/services/solver/SolverApiService.js +0 -157
  220. package/dist/services/solver/SolverApiService.js.map +0 -1
  221. package/dist/services/solver/SolverApiService.test.d.ts +0 -2
  222. package/dist/services/solver/SolverApiService.test.d.ts.map +0 -1
  223. package/dist/services/solver/SolverApiService.test.js +0 -181
  224. package/dist/services/solver/SolverApiService.test.js.map +0 -1
  225. package/dist/services/solver/SolverService.d.ts +0 -295
  226. package/dist/services/solver/SolverService.d.ts.map +0 -1
  227. package/dist/services/solver/SolverService.js +0 -429
  228. package/dist/services/solver/SolverService.js.map +0 -1
  229. package/dist/services/solver/SolverService.test.d.ts +0 -2
  230. package/dist/services/solver/SolverService.test.d.ts.map +0 -1
  231. package/dist/services/solver/SolverService.test.js +0 -439
  232. package/dist/services/solver/SolverService.test.js.map +0 -1
  233. package/dist/services/solver/index.d.ts +0 -3
  234. package/dist/services/solver/index.d.ts.map +0 -1
  235. package/dist/services/solver/index.js +0 -3
  236. package/dist/services/solver/index.js.map +0 -1
  237. package/dist/services/spoke/CWSpokeService.d.ts +0 -67
  238. package/dist/services/spoke/CWSpokeService.d.ts.map +0 -1
  239. package/dist/services/spoke/CWSpokeService.js +0 -75
  240. package/dist/services/spoke/CWSpokeService.js.map +0 -1
  241. package/dist/services/spoke/EvmSpokeService.d.ts +0 -62
  242. package/dist/services/spoke/EvmSpokeService.d.ts.map +0 -1
  243. package/dist/services/spoke/EvmSpokeService.js +0 -120
  244. package/dist/services/spoke/EvmSpokeService.js.map +0 -1
  245. package/dist/services/spoke/IconSpokeService.d.ts +0 -56
  246. package/dist/services/spoke/IconSpokeService.d.ts.map +0 -1
  247. package/dist/services/spoke/IconSpokeService.js +0 -124
  248. package/dist/services/spoke/IconSpokeService.js.map +0 -1
  249. package/dist/services/spoke/SolanaSpokeService.d.ts +0 -46
  250. package/dist/services/spoke/SolanaSpokeService.d.ts.map +0 -1
  251. package/dist/services/spoke/SolanaSpokeService.js +0 -170
  252. package/dist/services/spoke/SolanaSpokeService.js.map +0 -1
  253. package/dist/services/spoke/SpokeService.d.ts +0 -34
  254. package/dist/services/spoke/SpokeService.d.ts.map +0 -1
  255. package/dist/services/spoke/SpokeService.js +0 -102
  256. package/dist/services/spoke/SpokeService.js.map +0 -1
  257. package/dist/services/spoke/StellarSpokeService.d.ts +0 -35
  258. package/dist/services/spoke/StellarSpokeService.d.ts.map +0 -1
  259. package/dist/services/spoke/StellarSpokeService.js +0 -39
  260. package/dist/services/spoke/StellarSpokeService.js.map +0 -1
  261. package/dist/services/spoke/SuiSpokeService.d.ts +0 -69
  262. package/dist/services/spoke/SuiSpokeService.d.ts.map +0 -1
  263. package/dist/services/spoke/SuiSpokeService.js +0 -74
  264. package/dist/services/spoke/SuiSpokeService.js.map +0 -1
  265. package/dist/services/spoke/index.d.ts +0 -3
  266. package/dist/services/spoke/index.d.ts.map +0 -1
  267. package/dist/services/spoke/index.js +0 -3
  268. package/dist/services/spoke/index.js.map +0 -1
  269. package/dist/tests/services/hub/EvmAssetManagerService.test.d.ts +0 -2
  270. package/dist/tests/services/hub/EvmAssetManagerService.test.d.ts.map +0 -1
  271. package/dist/tests/services/hub/EvmAssetManagerService.test.js +0 -138
  272. package/dist/tests/services/hub/EvmAssetManagerService.test.js.map +0 -1
  273. package/dist/tests/services/hub/EvmMoneyMarketService.test.d.ts +0 -2
  274. package/dist/tests/services/hub/EvmMoneyMarketService.test.d.ts.map +0 -1
  275. package/dist/tests/services/hub/EvmMoneyMarketService.test.js +0 -121
  276. package/dist/tests/services/hub/EvmMoneyMarketService.test.js.map +0 -1
  277. package/dist/tests/services/hub/EvmVaultTokenService.test.d.ts +0 -2
  278. package/dist/tests/services/hub/EvmVaultTokenService.test.d.ts.map +0 -1
  279. package/dist/tests/services/hub/EvmVaultTokenService.test.js +0 -98
  280. package/dist/tests/services/hub/EvmVaultTokenService.test.js.map +0 -1
  281. package/dist/tests/services/spoke/EvmSpokeService.test.d.ts +0 -2
  282. package/dist/tests/services/spoke/EvmSpokeService.test.d.ts.map +0 -1
  283. package/dist/tests/services/spoke/EvmSpokeService.test.js +0 -198
  284. package/dist/tests/services/spoke/EvmSpokeService.test.js.map +0 -1
  285. package/dist/types.d.ts +0 -352
  286. package/dist/types.d.ts.map +0 -1
  287. package/dist/types.js +0 -30
  288. package/dist/types.js.map +0 -1
  289. package/dist/utils/evm-utils.d.ts +0 -10
  290. package/dist/utils/evm-utils.d.ts.map +0 -1
  291. package/dist/utils/evm-utils.js +0 -15
  292. package/dist/utils/evm-utils.js.map +0 -1
  293. package/dist/utils/index.d.ts +0 -3
  294. package/dist/utils/index.d.ts.map +0 -1
  295. package/dist/utils/index.js +0 -3
  296. package/dist/utils/index.js.map +0 -1
  297. package/dist/utils/shared-utils.d.ts +0 -20
  298. package/dist/utils/shared-utils.d.ts.map +0 -1
  299. package/dist/utils/shared-utils.js +0 -69
  300. package/dist/utils/shared-utils.js.map +0 -1
  301. package/dist/utils/shared-utils.test.d.ts +0 -2
  302. package/dist/utils/shared-utils.test.d.ts.map +0 -1
  303. package/dist/utils/shared-utils.test.js +0 -63
  304. package/dist/utils/shared-utils.test.js.map +0 -1
@@ -1,34 +0,0 @@
1
- import { type EvmHubProvider, type SpokeProvider } from '../../entities/index.js';
2
- import type { GetSpokeDepositParamsType, PromiseTxReturnType, TxReturnType } from '../../types.js';
3
- import type { Address, Hex, HubAddress } from '@sodax/types';
4
- /**
5
- * SpokeService is a main class that provides functionalities for dealing with spoke chains.
6
- * It uses command pattern to execute different spoke chain operations.
7
- */
8
- export declare class SpokeService {
9
- /**
10
- * Deposit tokens to the spoke chain.
11
- * @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
12
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
13
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
14
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
15
- */
16
- static deposit<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: GetSpokeDepositParamsType<T>, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<PromiseTxReturnType<T, R>>;
17
- /**
18
- * Get the balance of the token in the spoke chain.
19
- * @param {Address} token - The address of the token to get the balance of.
20
- * @param {SpokeProvider} spokeProvider - The spoke provider.
21
- * @returns {Promise<bigint>} The balance of the token.
22
- */
23
- static getDeposit(token: Address, spokeProvider: SpokeProvider): Promise<bigint>;
24
- /**
25
- * Calls a contract on the spoke chain using the user's wallet.
26
- * @param {HubAddress} from - The address of the user on the hub chain.
27
- * @param {Hex} payload - The payload to send to the contract.
28
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
29
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
30
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
31
- */
32
- static callWallet<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<T, R>>;
33
- }
34
- //# sourceMappingURL=SpokeService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpokeService.d.ts","sourceRoot":"","sources":["../../../src/services/spoke/SpokeService.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,aAAa,EAGnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB7D;;;GAGG;AAGH,qBAAa,YAAY;IACvB;;;;;;OAMG;WACiB,OAAO,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,CAAC,SAAS,OAAO,GAAG,KAAK,EAC5F,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC,EACpC,aAAa,EAAE,CAAC,EAChB,WAAW,EAAE,cAAc,EAC3B,GAAG,CAAC,EAAE,CAAC,GACN,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAuDrC;;;;;OAKG;WACW,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAuBvF;;;;;;;OAOG;WACiB,UAAU,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,CAAC,SAAS,OAAO,GAAG,KAAK,EAC/F,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,GAAG,EACZ,aAAa,EAAE,CAAC,EAChB,WAAW,EAAE,cAAc,EAC3B,GAAG,CAAC,EAAE,CAAC,GACN,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CA2C/B"}
@@ -1,102 +0,0 @@
1
- import { CWSpokeProvider } from '../../entities/cosmos/CWSpokeProvider.js';
2
- import { IconSpokeProvider } from '../../entities/icon/IconSpokeProvider.js';
3
- import { EvmSpokeProvider, SolanaSpokeProvider, StellarSpokeProvider, SuiSpokeProvider, } from '../../entities/index.js';
4
- import { CWSpokeService } from './CWSpokeService.js';
5
- import { EvmSpokeService } from './EvmSpokeService.js';
6
- import { IconSpokeService } from './IconSpokeService.js';
7
- import { SolanaSpokeService } from './SolanaSpokeService.js';
8
- import { StellarSpokeService } from './StellarSpokeService.js';
9
- import { SuiSpokeService } from './SuiSpokeService.js';
10
- import { isCWSpokeProvider, isEvmSpokeProvider, isIconSpokeProvider, isSolanaSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, } from '../../guards.js';
11
- /**
12
- * SpokeService is a main class that provides functionalities for dealing with spoke chains.
13
- * It uses command pattern to execute different spoke chain operations.
14
- */
15
- // biome-ignore lint/complexity/noStaticOnlyClass:
16
- export class SpokeService {
17
- /**
18
- * Deposit tokens to the spoke chain.
19
- * @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
20
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
21
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
22
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
23
- */
24
- static async deposit(params, spokeProvider, hubProvider, raw) {
25
- if (spokeProvider instanceof EvmSpokeProvider) {
26
- return EvmSpokeService.deposit(params, spokeProvider, hubProvider, raw);
27
- }
28
- if (spokeProvider instanceof CWSpokeProvider) {
29
- return CWSpokeService.deposit(params, spokeProvider, hubProvider, raw);
30
- }
31
- if (spokeProvider instanceof IconSpokeProvider) {
32
- return IconSpokeService.deposit(params, spokeProvider, hubProvider, raw);
33
- }
34
- if (spokeProvider instanceof SuiSpokeProvider) {
35
- return SuiSpokeService.deposit(params, spokeProvider, hubProvider, raw);
36
- }
37
- if (spokeProvider instanceof SolanaSpokeProvider) {
38
- return SolanaSpokeService.deposit(params, spokeProvider, hubProvider, raw);
39
- }
40
- if (spokeProvider instanceof StellarSpokeProvider) {
41
- return StellarSpokeService.deposit(params, spokeProvider, hubProvider, raw);
42
- }
43
- throw new Error('Invalid spoke provider');
44
- }
45
- /**
46
- * Get the balance of the token in the spoke chain.
47
- * @param {Address} token - The address of the token to get the balance of.
48
- * @param {SpokeProvider} spokeProvider - The spoke provider.
49
- * @returns {Promise<bigint>} The balance of the token.
50
- */
51
- static getDeposit(token, spokeProvider) {
52
- if (spokeProvider instanceof EvmSpokeProvider) {
53
- return EvmSpokeService.getDeposit(token, spokeProvider);
54
- }
55
- if (spokeProvider instanceof CWSpokeProvider) {
56
- return CWSpokeService.getDeposit(token, spokeProvider);
57
- }
58
- if (spokeProvider instanceof StellarSpokeProvider) {
59
- return StellarSpokeService.getDeposit(token, spokeProvider);
60
- }
61
- if (spokeProvider instanceof SuiSpokeProvider) {
62
- return SuiSpokeService.getDeposit(token, spokeProvider);
63
- }
64
- if (spokeProvider instanceof IconSpokeProvider) {
65
- return IconSpokeService.getDeposit(token, spokeProvider);
66
- }
67
- if (spokeProvider instanceof SolanaSpokeProvider) {
68
- return SolanaSpokeService.getDeposit(token, spokeProvider);
69
- }
70
- throw new Error('Invalid spoke provider');
71
- }
72
- /**
73
- * Calls a contract on the spoke chain using the user's wallet.
74
- * @param {HubAddress} from - The address of the user on the hub chain.
75
- * @param {Hex} payload - The payload to send to the contract.
76
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
77
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
78
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
79
- */
80
- static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
81
- if (isEvmSpokeProvider(spokeProvider)) {
82
- return (await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider));
83
- }
84
- if (isCWSpokeProvider(spokeProvider)) {
85
- return (await CWSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw));
86
- }
87
- if (isIconSpokeProvider(spokeProvider)) {
88
- return (await IconSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw));
89
- }
90
- if (isSuiSpokeProvider(spokeProvider)) {
91
- return (await SuiSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw));
92
- }
93
- if (isSolanaSpokeProvider(spokeProvider)) {
94
- return (await SolanaSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw));
95
- }
96
- if (isStellarSpokeProvider(spokeProvider)) {
97
- return (await StellarSpokeService.callWallet(from, payload, spokeProvider, hubProvider));
98
- }
99
- throw new Error('Invalid spoke provider');
100
- }
101
- }
102
- //# sourceMappingURL=SpokeService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpokeService.js","sourceRoot":"","sources":["../../../src/services/spoke/SpokeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAEL,gBAAgB,EAChB,mBAAmB,EAEnB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AAEH,kDAAkD;AAClD,MAAM,OAAO,YAAY;IACvB;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO,CACzB,MAAoC,EACpC,aAAgB,EAChB,WAA2B,EAC3B,GAAO;QAEP,IAAI,aAAa,YAAY,gBAAgB,EAAE,CAAC;YAC9C,OAAO,eAAe,CAAC,OAAO,CAC5B,MAAqD,EACrD,aAAa,EACb,WAAW,EACX,GAAG,CACyB,CAAC;QACjC,CAAC;QACD,IAAI,aAAa,YAAY,eAAe,EAAE,CAAC;YAC7C,OAAO,cAAc,CAAC,OAAO,CAC3B,MAAoD,EACpD,aAAa,EACb,WAAW,EACX,GAAG,CACyB,CAAC;QACjC,CAAC;QACD,IAA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IAAI,EACJ,OAAO,EACP,aAAa,EACb,WAAW,EACX,GAAG,CACJ,CAAsE,CAAC;QAC1E,CAAC;QACD,IAAI,sBAAsB,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1C,OAAO,CAAC,MAAM,mBAAmB,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAGhE,CAAC;QAC1B,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;CACF"}
@@ -1,35 +0,0 @@
1
- import { type Address, type Hex } from 'viem';
2
- import type { EvmHubProvider } from '../../entities/index.js';
3
- import type { StellarSpokeProvider } from '../../entities/stellar/StellarSpokeProvider.js';
4
- import { type HubAddress, type PromiseStellarTxReturnType } from '../../index.js';
5
- export type StellarSpokeDepositParams = {
6
- from: Hex;
7
- to?: HubAddress;
8
- token: string;
9
- amount: bigint;
10
- data: Hex;
11
- };
12
- export type TransferToHubParams = {
13
- token: string;
14
- recipient: Address;
15
- amount: bigint;
16
- data: Hex;
17
- };
18
- export declare class StellarSpokeService {
19
- private constructor();
20
- static deposit<R extends boolean = false>(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseStellarTxReturnType<R>;
21
- static getDeposit(token: string, spokeProvider: StellarSpokeProvider): Promise<bigint>;
22
- /**
23
- * Calls a contract on the spoke chain using the user's wallet.
24
- * @param from - The address of the user on the hub chain.
25
- * @param payload - The payload to send to the contract.
26
- * @param spokeProvider - The spoke provider.
27
- * @param hubProvider - The hub provider.
28
- * @param raw - Whether to return the raw transaction data.
29
- * @returns The transaction result.
30
- */
31
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseStellarTxReturnType<R>;
32
- private static transfer;
33
- private static call;
34
- }
35
- //# sourceMappingURL=StellarSpokeService.d.ts.map
@@ -1 +0,0 @@
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,GACN,0BAA0B,CAAC,CAAC,CAAC;mBAKX,QAAQ;mBAcR,IAAI;CAc1B"}
@@ -1,39 +0,0 @@
1
- import { fromHex } from 'viem';
2
- import { getIntentRelayChainId } from '../../index.js';
3
- import { EvmWalletAbstraction } from '../hub/index.js';
4
- export class StellarSpokeService {
5
- constructor() { }
6
- static async deposit(params, spokeProvider, hubProvider, raw) {
7
- const userWallet = params.to ??
8
- (await EvmWalletAbstraction.getUserHubWalletAddress(spokeProvider.chainConfig.chain.id, params.from, hubProvider));
9
- return StellarSpokeService.transfer({
10
- token: params.token,
11
- recipient: userWallet,
12
- amount: params.amount,
13
- data: params.data,
14
- }, spokeProvider, raw);
15
- }
16
- static async getDeposit(token, spokeProvider) {
17
- return BigInt(await spokeProvider.getBalance(token));
18
- }
19
- /**
20
- * Calls a contract on the spoke chain using the user's wallet.
21
- * @param from - The address of the user on the hub chain.
22
- * @param payload - The payload to send to the contract.
23
- * @param spokeProvider - The spoke provider.
24
- * @param hubProvider - The hub provider.
25
- * @param raw - Whether to return the raw transaction data.
26
- * @returns The transaction result.
27
- */
28
- static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
29
- const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
30
- return StellarSpokeService.call(BigInt(relayId), from, payload, spokeProvider, raw);
31
- }
32
- static async transfer({ token, recipient, amount, data = '0x' }, spokeProvider, raw) {
33
- return await spokeProvider.deposit(token, amount.toString(), fromHex(recipient, 'bytes'), fromHex(data, 'bytes'), raw);
34
- }
35
- static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
36
- return await spokeProvider.sendMessage(dstChainId.toString(), fromHex(dstAddress, 'bytes'), fromHex(payload, 'bytes'), raw);
37
- }
38
- }
39
- //# sourceMappingURL=StellarSpokeService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StellarSpokeService.js","sourceRoot":"","sources":["../../../src/services/spoke/StellarSpokeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,OAAO,E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,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAuB,EAC9D,aAAmC,EACnC,GAAO;QAEP,OAAO,MAAM,aAAa,CAAC,OAAO,CAChC,KAAK,EACL,MAAM,CAAC,QAAQ,EAAE,EACjB,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,EAC3B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EACtB,GAAG,CACJ,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,IAAI,CACvB,UAAkB,EAClB,UAAsB,EACtB,OAAY,EACZ,aAAmC,EACnC,GAAO;QAEP,OAAO,MAAM,aAAa,CAAC,WAAW,CACpC,UAAU,CAAC,QAAQ,EAAE,EACrB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAC5B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EACzB,GAAG,CACJ,CAAC;IACJ,CAAC;CACF"}
@@ -1,69 +0,0 @@
1
- import { type Address, type Hex } from 'viem';
2
- import type { EvmHubProvider } from '../../entities/index.js';
3
- import type { SuiSpokeProvider } from '../../entities/sui/SuiSpokeProvider.js';
4
- import { type HubAddress, type PromiseSuiTxReturnType } from '../../index.js';
5
- export type SuiSpokeDepositParams = {
6
- from: Hex;
7
- to?: HubAddress;
8
- token: string;
9
- amount: bigint;
10
- data: Hex;
11
- };
12
- export type TransferToHubParams = {
13
- token: string;
14
- recipient: Address;
15
- amount: bigint;
16
- data: Hex;
17
- };
18
- export declare class SuiSpokeService {
19
- private constructor();
20
- /**
21
- * Deposit tokens to the spoke chain.
22
- * @param {CWSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
23
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
24
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
25
- * @param {boolean} raw - The return type raw or just transaction hash
26
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
27
- */
28
- static deposit<R extends boolean = false>(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSuiTxReturnType<R>;
29
- /**
30
- * Get the balance of the token in the spoke chain.
31
- * @param {Address} token - The address of the token to get the balance of.
32
- * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
33
- * @returns {Promise<bigint>} The balance of the token.
34
- */
35
- static getDeposit(token: string, spokeProvider: SuiSpokeProvider): Promise<bigint>;
36
- /**
37
- * Calls a contract on the spoke chain using the user's wallet.
38
- * @param {HubAddress} from - The address of the user on the spoke chain.
39
- * @param {Hex} payload - The payload to send to the contract.
40
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
41
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
42
- * @param {boolean} raw - The return type raw or just transaction hash
43
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
44
- */
45
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSuiTxReturnType<R>;
46
- /**
47
- * Transfers tokens to the hub chain.
48
- * @param {TransferToHubParams} params - The parameters for the transfer, including:
49
- * - {string} token: The address of the token to transfer (use address(0) for native token).
50
- * - {Uint8Array} recipient: The recipient address on the hub chain.
51
- * - {string} amount: The amount to transfer.
52
- * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
53
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
54
- * @param {boolean} raw - The return type raw or just transaction hash
55
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
56
- */
57
- private static transfer;
58
- /**
59
- * Sends a message to the hub chain.
60
- * @param {bigint} dstChainId - The chain ID of the hub chain.
61
- * @param {HubAddress} dstAddress - The address on the hub chain.
62
- * @param {Hex} payload - The payload to send.
63
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
64
- * @param {boolean} raw - The return type raw or just transaction hash
65
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
66
- */
67
- private static call;
68
- }
69
- //# sourceMappingURL=SuiSpokeService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SuiSpokeService.d.ts","sourceRoot":"","sources":["../../../src/services/spoke/SuiSpokeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAW,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,sBAAsB,EAAyB,MAAM,gBAAgB,CAAC;AAGrG,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,GAAG,CAAC;IACV,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,qBAAa,eAAe;IAC1B,OAAO;IAEP;;;;;;;OAOG;WACiB,OAAO,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACnD,MAAM,EAAE,qBAAqB,EAC7B,aAAa,EAAE,gBAAgB,EAC/B,WAAW,EAAE,cAAc,EAC3B,GAAG,CAAC,EAAE,CAAC,GACN,sBAAsB,CAAC,CAAC,CAAC;IAqB5B;;;;;OAKG;WACiB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/F;;;;;;;;OAQG;WACiB,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACtD,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,GAAG,EACZ,aAAa,EAAE,gBAAgB,EAC/B,WAAW,EAAE,cAAc,EAC3B,GAAG,CAAC,EAAE,CAAC,GACN,sBAAsB,CAAC,CAAC,CAAC;IAU5B;;;;;;;;;;OAUG;mBACkB,QAAQ;IAQ7B;;;;;;;;OAQG;mBACkB,IAAI;CAS1B"}
@@ -1,74 +0,0 @@
1
- import { fromHex } from 'viem';
2
- import { getIntentRelayChainId } from '../../index.js';
3
- import { EvmWalletAbstraction } from '../hub/index.js';
4
- export class SuiSpokeService {
5
- constructor() { }
6
- /**
7
- * Deposit tokens to the spoke chain.
8
- * @param {CWSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
9
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
10
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
11
- * @param {boolean} raw - The return type raw or just transaction hash
12
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
13
- */
14
- static async deposit(params, spokeProvider, hubProvider, raw) {
15
- const userWallet = params.to ??
16
- (await EvmWalletAbstraction.getUserHubWalletAddress(spokeProvider.chainConfig.chain.id, params.from, hubProvider));
17
- return SuiSpokeService.transfer({
18
- token: params.token,
19
- recipient: userWallet,
20
- amount: params.amount,
21
- data: params.data,
22
- }, spokeProvider, raw);
23
- }
24
- /**
25
- * Get the balance of the token in the spoke chain.
26
- * @param {Address} token - The address of the token to get the balance of.
27
- * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
28
- * @returns {Promise<bigint>} The balance of the token.
29
- */
30
- static async getDeposit(token, spokeProvider) {
31
- return spokeProvider.getBalance(token);
32
- }
33
- /**
34
- * Calls a contract on the spoke chain using the user's wallet.
35
- * @param {HubAddress} from - The address of the user on the spoke chain.
36
- * @param {Hex} payload - The payload to send to the contract.
37
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
38
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
39
- * @param {boolean} raw - The return type raw or just transaction hash
40
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
41
- */
42
- static async callWallet(from, payload, spokeProvider, hubProvider, raw) {
43
- const userWallet = await EvmWalletAbstraction.getUserHubWalletAddress(spokeProvider.chainConfig.chain.id, from, hubProvider);
44
- const relayId = getIntentRelayChainId(hubProvider.chainConfig.chain.id);
45
- return SuiSpokeService.call(BigInt(relayId), userWallet, payload, spokeProvider, raw);
46
- }
47
- /**
48
- * Transfers tokens to the hub chain.
49
- * @param {TransferToHubParams} params - The parameters for the transfer, including:
50
- * - {string} token: The address of the token to transfer (use address(0) for native token).
51
- * - {Uint8Array} recipient: The recipient address on the hub chain.
52
- * - {string} amount: The amount to transfer.
53
- * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
54
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
55
- * @param {boolean} raw - The return type raw or just transaction hash
56
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
57
- */
58
- static async transfer({ token, recipient, amount, data = '0x' }, spokeProvider, raw) {
59
- return spokeProvider.transfer(token, amount, fromHex(recipient, 'bytes'), fromHex(data, 'bytes'), raw);
60
- }
61
- /**
62
- * Sends a message to the hub chain.
63
- * @param {bigint} dstChainId - The chain ID of the hub chain.
64
- * @param {HubAddress} dstAddress - The address on the hub chain.
65
- * @param {Hex} payload - The payload to send.
66
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
67
- * @param {boolean} raw - The return type raw or just transaction hash
68
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
69
- */
70
- static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
71
- return spokeProvider.sendMessage(dstChainId, fromHex(dstAddress, 'bytes'), fromHex(payload, 'bytes'), raw);
72
- }
73
- }
74
- //# sourceMappingURL=SuiSpokeService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SuiSpokeService.js","sourceRoot":"","sources":["../../../src/services/spoke/SuiSpokeService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,OAAO,EAAE,MAAM,MAAM,CAAC;AAGvD,OAAO,EAAgD,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAiBvD,MAAM,OAAO,eAAe;IAC1B,gBAAuB,CAAC;IAExB;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO,CACzB,MAA6B,EAC7B,aAA+B,EAC/B,WAA2B,EAC3B,GAAO;QAEP,MAAM,UAAU,GACd,MAAM,CAAC,EAAE;YACT,CAAC,MAAM,oBAAoB,CAAC,uBAAuB,CACjD,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAClC,MAAM,CAAC,IAAI,EACX,WAAW,CACZ,CAAC,CAAC;QAEL,OAAO,eAAe,CAAC,QAAQ,CAC7B;YACE,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,UAAU;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,aAAa,EACb,GAAG,CACJ,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAa,EAAE,aAA+B;QAC3E,OAAO,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAC5B,IAAgB,EAChB,OAAY,EACZ,aAA+B,EAC/B,WAA2B,EAC3B,GAAO;QAEP,MAAM,UAAU,GAAY,MAAM,oBAAoB,CAAC,uBAAuB,CAC5E,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAClC,IAAI,EACJ,WAAW,CACZ,CAAC;QACF,MAAM,OAAO,GAAG,qBAAqB,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxE,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;;OAUG;IACK,MAAM,CAAC,KAAK,CAAC,QAAQ,CAC3B,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAuB,EAC9D,aAA+B,EAC/B,GAAO;QAEP,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IACzG,CAAC;IAED;;;;;;;;OAQG;IACK,MAAM,CAAC,KAAK,CAAC,IAAI,CACvB,UAAkB,EAClB,UAAsB,EACtB,OAAY,EACZ,aAA+B,EAC/B,GAAO;QAEP,OAAO,aAAa,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7G,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- export * from './EvmSpokeService.js';
2
- export * from './SpokeService.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/spoke/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './EvmSpokeService.js';
2
- export * from './SpokeService.js';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/spoke/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=EvmAssetManagerService.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EvmAssetManagerService.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/services/hub/EvmAssetManagerService.test.ts"],"names":[],"mappings":""}
@@ -1,138 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { decodeFunctionData } from 'viem';
3
- import { assetManagerAbi } from '../../../abis/index.js';
4
- import { EvmAssetManagerService, EvmSpokeProvider, spokeChainConfig, getHubChainConfig, EvmHubProvider, } from '../../../index.js';
5
- import { BSC_MAINNET_CHAIN_ID, SONIC_MAINNET_CHAIN_ID } from '@sodax/types';
6
- describe('EvmAssetManagerService', () => {
7
- const bscEthToken = '0x2170Ed0880ac9A755fd29B2688956BD959F933F8';
8
- const mockEvmWalletProvider = {
9
- sendTransaction: vi.fn(),
10
- getWalletAddress: vi.fn().mockResolvedValue('0x9999999999999999999999999999999999999999'),
11
- getWalletAddressBytes: vi.fn().mockResolvedValue('0x9999999999999999999999999999999999999999'),
12
- waitForTransactionReceipt: vi.fn(),
13
- };
14
- const mockBscSpokeProvider = new EvmSpokeProvider(mockEvmWalletProvider, spokeChainConfig[BSC_MAINNET_CHAIN_ID]);
15
- const mockHubConfig = {
16
- hubRpcUrl: 'https://rpc.soniclabs.com',
17
- chainConfig: getHubChainConfig(SONIC_MAINNET_CHAIN_ID),
18
- };
19
- const mockHubProvider = new EvmHubProvider(mockHubConfig);
20
- describe('getAssetInfo', () => {
21
- it('should correctly fetch asset information', async () => {
22
- const mockResponse = [
23
- mockBscSpokeProvider.chainConfig.chain.id,
24
- mockBscSpokeProvider.chainConfig.addresses.spokeAddress,
25
- ];
26
- vi.spyOn(mockBscSpokeProvider.publicClient, 'readContract').mockResolvedValueOnce(mockResponse);
27
- const result = await EvmAssetManagerService.getAssetInfo(bscEthToken, mockBscSpokeProvider.chainConfig.addresses.assetManager, mockBscSpokeProvider.publicClient);
28
- expect(mockBscSpokeProvider.publicClient.readContract).toHaveBeenCalledWith({
29
- address: mockBscSpokeProvider.chainConfig.addresses.assetManager,
30
- abi: assetManagerAbi,
31
- functionName: 'assetInfo',
32
- args: [bscEthToken],
33
- });
34
- expect(result).toEqual({
35
- chainId: mockBscSpokeProvider.chainConfig.chain.id,
36
- spokeAddress: mockBscSpokeProvider.chainConfig.addresses.spokeAddress,
37
- });
38
- });
39
- it('should handle zero values', async () => {
40
- const mockResponse = [0n, '0x0000000000000000000000000000000000000000'];
41
- vi.spyOn(mockBscSpokeProvider.publicClient, 'readContract').mockResolvedValueOnce(mockResponse);
42
- const result = await EvmAssetManagerService.getAssetInfo(bscEthToken, mockBscSpokeProvider.chainConfig.addresses.assetManager, mockBscSpokeProvider.publicClient);
43
- expect(result).toEqual({
44
- chainId: 0n,
45
- spokeAddress: '0x0000000000000000000000000000000000000000',
46
- });
47
- });
48
- });
49
- describe('encodeTransfer', () => {
50
- it('should correctly encode transfer transaction data', async () => {
51
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
52
- const encodedCall = EvmAssetManagerService.encodeTransfer(bscEthToken, walletAddress, 1000000000000000000n, mockBscSpokeProvider.chainConfig.addresses.assetManager);
53
- expect(encodedCall).toEqual({
54
- address: mockBscSpokeProvider.chainConfig.addresses.assetManager,
55
- value: 0n,
56
- data: expect.any(String),
57
- });
58
- const decoded = decodeFunctionData({
59
- abi: assetManagerAbi,
60
- data: encodedCall.data,
61
- });
62
- expect(decoded.functionName).toBe('transfer');
63
- expect(decoded.args).toEqual([bscEthToken, walletAddress, 1000000000000000000n, '0x']);
64
- });
65
- it('should handle zero amount transfers', async () => {
66
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
67
- const encodedCall = EvmAssetManagerService.encodeTransfer(bscEthToken, walletAddress, 0n, mockBscSpokeProvider.chainConfig.addresses.assetManager);
68
- const decoded = decodeFunctionData({
69
- abi: assetManagerAbi,
70
- data: encodedCall.data,
71
- });
72
- expect(decoded.args).toEqual([bscEthToken, walletAddress, 0n, '0x']);
73
- });
74
- it('should handle maximum uint256 amount', async () => {
75
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
76
- const maxUint256 = 2n ** 256n - 1n;
77
- const encodedCall = EvmAssetManagerService.encodeTransfer(bscEthToken, walletAddress, maxUint256, mockBscSpokeProvider.chainConfig.addresses.assetManager);
78
- const decoded = decodeFunctionData({
79
- abi: assetManagerAbi,
80
- data: encodedCall.data,
81
- });
82
- expect(decoded.args?.[2]).toBe(maxUint256);
83
- });
84
- it('should maintain data precision for large numbers', async () => {
85
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
86
- const largeAmount = 2n ** 128n;
87
- const encodedCall = EvmAssetManagerService.encodeTransfer(bscEthToken, walletAddress, largeAmount, mockBscSpokeProvider.chainConfig.addresses.assetManager);
88
- const decoded = decodeFunctionData({
89
- abi: assetManagerAbi,
90
- data: encodedCall.data,
91
- });
92
- expect(decoded.args?.[2]).toBe(largeAmount);
93
- });
94
- });
95
- describe('depositToData', () => {
96
- let depositParams;
97
- beforeEach(async () => {
98
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
99
- depositParams = {
100
- token: bscEthToken,
101
- to: walletAddress,
102
- amount: 1000000000000000000n,
103
- };
104
- });
105
- it('should correctly encode deposit transaction data', async () => {
106
- const result = EvmAssetManagerService.depositToData(depositParams, mockBscSpokeProvider.chainConfig.chain.id);
107
- expect(result).toBe('0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000022000000000000000000000000057fc2ac5701e463ae261adbd6c99fbeb48ce5293000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000004effb5813271699683c25c734f4dabc45b3637090000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000004effb5813271699683c25c734f4dabc45b36370900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004447e7ef2400000000000000000000000057fc2ac5701e463ae261adbd6c99fbeb48ce52930000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000004effb5813271699683c25c734f4dabc45b363709000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000099999999999999999999999999999999999999990000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000');
108
- });
109
- it('should throw error if asset config not found', async () => {
110
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
111
- const invalidToken = '0x9999999999999999999999999999999999999999';
112
- const invalidParams = { ...depositParams, token: invalidToken, to: walletAddress };
113
- expect(() => EvmAssetManagerService.depositToData(invalidParams, mockBscSpokeProvider.chainConfig.chain.id)).toThrow('[depositToData] Hub asset not found');
114
- });
115
- });
116
- describe('withdrawAssetData', () => {
117
- let withdrawParams;
118
- beforeEach(async () => {
119
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
120
- withdrawParams = {
121
- token: bscEthToken,
122
- to: walletAddress,
123
- amount: 1000000000000000000n,
124
- };
125
- });
126
- it('should correctly encode withdraw transaction data', async () => {
127
- const result = EvmAssetManagerService.withdrawAssetData(withdrawParams, mockHubProvider, mockBscSpokeProvider.chainConfig.chain.id);
128
- expect(result).toBe('0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000060c5681bd1db4e50735c4ca3386005a4ba4937c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e4c6b4180b00000000000000000000000057fc2ac5701e463ae261adbd6c99fbeb48ce529300000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000149999999999999999999999999999999999999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
129
- });
130
- it('should throw error if asset config not found', async () => {
131
- const walletAddress = (await mockEvmWalletProvider.getWalletAddress());
132
- const invalidToken = '0x9999999999999999999999999999999999999999';
133
- const invalidParams = { ...withdrawParams, token: invalidToken, to: walletAddress };
134
- expect(() => EvmAssetManagerService.withdrawAssetData(invalidParams, mockHubProvider, mockBscSpokeProvider.chainConfig.chain.id)).toThrow('[withdrawAssetData] Hub asset not found');
135
- });
136
- });
137
- });
138
- //# sourceMappingURL=EvmAssetManagerService.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EvmAssetManagerService.test.js","sourceRoot":"","sources":["../../../../src/tests/services/hub/EvmAssetManagerService.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAgB,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5E,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,WAAW,GAAG,4CAA4C,CAAC;IAEjE,MAAM,qBAAqB,GA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AAK,CAAC,EAAE,CAC1C,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CACjB,o8BAAo8B,CACr8B,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC5D,MAAM,aAAa,GAAG,CAAC,MAAM,qBAAqB,CAAC,gBAAgB,EAAE,CAAkB,CAAC;YACxF,MAAM,YAAY,GAAG,4CAAuD,CAAC;YAC7E,MAAM,aAAa,GAAG,EAAE,GAAG,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC;YAEpF,MAAM,CAAC,GAAG,EAAE,CACV,sBAAsB,CAAC,iBAAiB,CACtC,aAAa,EACb,eAAe,EACf,oBAAoB,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAC1C,CACF,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=EvmMoneyMarketService.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EvmMoneyMarketService.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/services/hub/EvmMoneyMarketService.test.ts"],"names":[],"mappings":""}