@upshiftfinance/sdk 0.0.0-stage → 0.2.0

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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -2
  3. package/lib/abis/AddressResolver.d.ts +28 -0
  4. package/lib/abis/AddressResolver.js +23 -0
  5. package/lib/abis/ChainlinkV3.d.ts +87 -0
  6. package/lib/abis/ChainlinkV3.js +117 -0
  7. package/lib/abis/ERC20.d.ts +168 -0
  8. package/lib/abis/ERC20.js +226 -0
  9. package/lib/abis/ERC20_Bytes32.d.ts +139 -0
  10. package/lib/abis/ERC20_Bytes32.js +196 -0
  11. package/lib/abis/ERC4626.d.ts +364 -0
  12. package/lib/abis/ERC4626.js +507 -0
  13. package/lib/abis/ERC721.d.ts +231 -0
  14. package/lib/abis/ERC721.js +321 -0
  15. package/lib/abis/FeeOracle.d.ts +120 -0
  16. package/lib/abis/FeeOracle.js +162 -0
  17. package/lib/abis/LendingPool.d.ts +1393 -0
  18. package/lib/abis/LendingPool.js +1807 -0
  19. package/lib/abis/LendingPoolV2.d.ts +1413 -0
  20. package/lib/abis/LendingPoolV2.js +1833 -0
  21. package/lib/abis/LendingPoolV3.d.ts +1677 -0
  22. package/lib/abis/LendingPoolV3.js +1160 -0
  23. package/lib/abis/Loan.d.ts +837 -0
  24. package/lib/abis/Loan.js +1080 -0
  25. package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
  26. package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
  27. package/lib/abis/Multicall3.d.ts +30 -0
  28. package/lib/abis/Multicall3.js +97 -0
  29. package/lib/abis/OFT.d.ts +116 -0
  30. package/lib/abis/OFT.js +85 -0
  31. package/lib/abis/PoolAdapter.d.ts +36 -0
  32. package/lib/abis/PoolAdapter.js +51 -0
  33. package/lib/abis/RewardDistributor.d.ts +267 -0
  34. package/lib/abis/RewardDistributor.js +352 -0
  35. package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
  36. package/lib/abis/RwaRedeemSubaccount.js +548 -0
  37. package/lib/abis/SmartAccount.d.ts +17 -0
  38. package/lib/abis/SmartAccount.js +19 -0
  39. package/lib/abis/SwapRouter.d.ts +953 -0
  40. package/lib/abis/SwapRouter.js +1228 -0
  41. package/lib/abis/TextResolver.d.ts +16 -0
  42. package/lib/abis/TextResolver.js +16 -0
  43. package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
  44. package/lib/abis/TokenizedVaultV2.js +1041 -0
  45. package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
  46. package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
  47. package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
  48. package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
  49. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
  50. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
  51. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
  52. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
  53. package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
  54. package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
  55. package/lib/abis/UniversalResolverResolve.d.ts +69 -0
  56. package/lib/abis/UniversalResolverResolve.js +35 -0
  57. package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
  58. package/lib/abis/UniversalSignatureValidator.js +30 -0
  59. package/lib/abis/WrapperAdapter.d.ts +71 -0
  60. package/lib/abis/WrapperAdapter.js +77 -0
  61. package/lib/abis/index.d.ts +34 -0
  62. package/lib/abis/index.js +51 -0
  63. package/lib/adapters/evm/getters.d.ts +19 -0
  64. package/lib/adapters/evm/getters.js +249 -0
  65. package/lib/adapters/evm/index.d.ts +539 -0
  66. package/lib/adapters/evm/index.js +656 -0
  67. package/lib/adapters/evm/utils.d.ts +8 -0
  68. package/lib/adapters/evm/utils.js +51 -0
  69. package/lib/adapters/solana/confirm.d.ts +88 -0
  70. package/lib/adapters/solana/confirm.js +291 -0
  71. package/lib/adapters/solana/constants.d.ts +42 -0
  72. package/lib/adapters/solana/constants.js +59 -0
  73. package/lib/adapters/solana/getters.d.ts +42 -0
  74. package/lib/adapters/solana/getters.js +275 -0
  75. package/lib/adapters/solana/idl/vault-idl.d.ts +700 -0
  76. package/lib/adapters/solana/idl/vault-idl.js +2101 -0
  77. package/lib/adapters/solana/idl/withdrawal-queue-idl.d.ts +795 -0
  78. package/lib/adapters/solana/idl/withdrawal-queue-idl.js +1864 -0
  79. package/lib/adapters/solana/index.d.ts +372 -0
  80. package/lib/adapters/solana/index.js +459 -0
  81. package/lib/adapters/solana/pricing.d.ts +184 -0
  82. package/lib/adapters/solana/pricing.js +239 -0
  83. package/lib/adapters/solana/queue-hints.d.ts +29 -0
  84. package/lib/adapters/solana/queue-hints.js +59 -0
  85. package/lib/adapters/solana/queue.actions.d.ts +97 -0
  86. package/lib/adapters/solana/queue.actions.js +468 -0
  87. package/lib/adapters/solana/token-reads.d.ts +108 -0
  88. package/lib/adapters/solana/token-reads.js +145 -0
  89. package/lib/adapters/solana/types.d.ts +325 -0
  90. package/lib/adapters/solana/types.js +3 -0
  91. package/lib/adapters/solana/utils.d.ts +229 -0
  92. package/lib/adapters/solana/utils.js +773 -0
  93. package/lib/adapters/solana/vault.actions.d.ts +140 -0
  94. package/lib/adapters/solana/vault.actions.js +657 -0
  95. package/lib/adapters/solana/withdrawal-queue.d.ts +125 -0
  96. package/lib/adapters/solana/withdrawal-queue.js +301 -0
  97. package/lib/adapters/stellar/actions.d.ts +41 -0
  98. package/lib/adapters/stellar/actions.js +126 -0
  99. package/lib/adapters/stellar/constants.d.ts +43 -0
  100. package/lib/adapters/stellar/constants.js +53 -0
  101. package/lib/adapters/stellar/getters.d.ts +68 -0
  102. package/lib/adapters/stellar/getters.js +290 -0
  103. package/lib/adapters/stellar/index.d.ts +126 -0
  104. package/lib/adapters/stellar/index.js +187 -0
  105. package/lib/adapters/stellar/invocation.d.ts +55 -0
  106. package/lib/adapters/stellar/invocation.js +92 -0
  107. package/lib/adapters/stellar/soroban.d.ts +131 -0
  108. package/lib/adapters/stellar/soroban.js +617 -0
  109. package/lib/adapters/stellar/submit.d.ts +42 -0
  110. package/lib/adapters/stellar/submit.js +195 -0
  111. package/lib/adapters/stellar/types.d.ts +57 -0
  112. package/lib/adapters/stellar/types.js +6 -0
  113. package/lib/adapters/stellar/utils.d.ts +24 -0
  114. package/lib/adapters/stellar/utils.js +34 -0
  115. package/lib/adapters/sui/client.d.ts +83 -0
  116. package/lib/adapters/sui/client.js +216 -0
  117. package/lib/adapters/sui/constants.d.ts +33 -0
  118. package/lib/adapters/sui/constants.js +31 -0
  119. package/lib/adapters/sui/index.d.ts +57 -0
  120. package/lib/adapters/sui/index.js +100 -0
  121. package/lib/adapters/sui/targets.d.ts +171 -0
  122. package/lib/adapters/sui/targets.js +225 -0
  123. package/lib/adapters/sui/utils.d.ts +8 -0
  124. package/lib/adapters/sui/utils.js +17 -0
  125. package/lib/core/analytics/app-name.d.ts +27 -0
  126. package/lib/core/analytics/app-name.js +48 -0
  127. package/lib/core/analytics/chain-name.d.ts +9 -0
  128. package/lib/core/analytics/chain-name.js +34 -0
  129. package/lib/core/analytics/constants.d.ts +15 -0
  130. package/lib/core/analytics/constants.js +28 -0
  131. package/lib/core/analytics/env.d.ts +46 -0
  132. package/lib/core/analytics/env.js +147 -0
  133. package/lib/core/analytics/index.d.ts +39 -0
  134. package/lib/core/analytics/index.js +83 -0
  135. package/lib/core/analytics/instrumentation.d.ts +29 -0
  136. package/lib/core/analytics/instrumentation.js +292 -0
  137. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  138. package/lib/core/analytics/method-taxonomy.js +156 -0
  139. package/lib/core/analytics/metrics.d.ts +48 -0
  140. package/lib/core/analytics/metrics.js +142 -0
  141. package/lib/core/analytics/sanitize.d.ts +57 -0
  142. package/lib/core/analytics/sanitize.js +272 -0
  143. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  144. package/lib/core/analytics/sentry-runtime.js +131 -0
  145. package/lib/core/analytics/sentry.d.ts +100 -0
  146. package/lib/core/analytics/sentry.js +696 -0
  147. package/lib/core/analytics/types.d.ts +55 -0
  148. package/lib/core/analytics/types.js +3 -0
  149. package/lib/core/analytics/user-identity.d.ts +55 -0
  150. package/lib/core/analytics/user-identity.js +218 -0
  151. package/lib/core/analytics/version.d.ts +6 -0
  152. package/lib/core/analytics/version.js +10 -0
  153. package/lib/core/attribution.d.ts +159 -0
  154. package/lib/core/attribution.js +194 -0
  155. package/lib/core/auth/index.d.ts +1 -0
  156. package/lib/core/auth/index.js +18 -0
  157. package/lib/core/auth/verify.d.ts +2 -0
  158. package/lib/core/auth/verify.js +35 -0
  159. package/lib/core/base.class.d.ts +193 -0
  160. package/lib/core/base.class.js +163 -0
  161. package/lib/core/cache.d.ts +9 -0
  162. package/lib/core/cache.js +31 -0
  163. package/lib/core/constants/adapters.d.ts +103 -0
  164. package/lib/core/constants/adapters.js +180 -0
  165. package/lib/core/constants/core.d.ts +162 -0
  166. package/lib/core/constants/core.js +281 -0
  167. package/lib/core/constants/swap-router.d.ts +180 -0
  168. package/lib/core/constants/swap-router.js +203 -0
  169. package/lib/core/constants/vaults.d.ts +93 -0
  170. package/lib/core/constants/vaults.js +277 -0
  171. package/lib/core/constants/web3.d.ts +106 -0
  172. package/lib/core/constants/web3.js +251 -0
  173. package/lib/core/errors/index.d.ts +177 -0
  174. package/lib/core/errors/index.js +257 -0
  175. package/lib/core/fetcher.d.ts +237 -0
  176. package/lib/core/fetcher.js +1103 -0
  177. package/lib/core/helpers/adapters.d.ts +13 -0
  178. package/lib/core/helpers/adapters.js +39 -0
  179. package/lib/core/helpers/chain-address.d.ts +13 -0
  180. package/lib/core/helpers/chain-address.js +47 -0
  181. package/lib/core/helpers/chain-error.d.ts +207 -0
  182. package/lib/core/helpers/chain-error.js +697 -0
  183. package/lib/core/helpers/chain-support.d.ts +98 -0
  184. package/lib/core/helpers/chain-support.js +139 -0
  185. package/lib/core/helpers/concurrency.d.ts +51 -0
  186. package/lib/core/helpers/concurrency.js +79 -0
  187. package/lib/core/helpers/core.d.ts +92 -0
  188. package/lib/core/helpers/core.js +368 -0
  189. package/lib/core/helpers/explorer-link.d.ts +16 -0
  190. package/lib/core/helpers/explorer-link.js +26 -0
  191. package/lib/core/helpers/multicall.d.ts +68 -0
  192. package/lib/core/helpers/multicall.js +103 -0
  193. package/lib/core/helpers/revert-decode.d.ts +248 -0
  194. package/lib/core/helpers/revert-decode.js +515 -0
  195. package/lib/core/helpers/signer.d.ts +61 -0
  196. package/lib/core/helpers/signer.js +184 -0
  197. package/lib/core/helpers/swap-router.d.ts +269 -0
  198. package/lib/core/helpers/swap-router.js +542 -0
  199. package/lib/core/helpers/vault-version.d.ts +24 -0
  200. package/lib/core/helpers/vault-version.js +83 -0
  201. package/lib/core/helpers/vaults.d.ts +89 -0
  202. package/lib/core/helpers/vaults.js +241 -0
  203. package/lib/core/helpers/web3.d.ts +366 -0
  204. package/lib/core/helpers/web3.js +1034 -0
  205. package/lib/core/index.d.ts +23 -0
  206. package/lib/core/index.js +40 -0
  207. package/lib/core/logger/curator-alert.d.ts +217 -0
  208. package/lib/core/logger/curator-alert.js +276 -0
  209. package/lib/core/logger/index.d.ts +99 -0
  210. package/lib/core/logger/index.js +163 -0
  211. package/lib/core/logger/slack.d.ts +49 -0
  212. package/lib/core/logger/slack.js +111 -0
  213. package/lib/core/vault-metadata.d.ts +12 -0
  214. package/lib/core/vault-metadata.js +42 -0
  215. package/lib/core/version-check.d.ts +58 -0
  216. package/lib/core/version-check.js +182 -0
  217. package/lib/evm/index.d.ts +2 -0
  218. package/lib/evm/index.js +19 -0
  219. package/lib/evm/methods/crossChainVault.d.ts +132 -0
  220. package/lib/evm/methods/crossChainVault.js +857 -0
  221. package/lib/evm/methods/crossChainVaultRegistry.d.ts +92 -0
  222. package/lib/evm/methods/crossChainVaultRegistry.js +239 -0
  223. package/lib/evm/methods/index.d.ts +2 -0
  224. package/lib/evm/methods/index.js +19 -0
  225. package/lib/evm/types/crossChain.d.ts +363 -0
  226. package/lib/evm/types/crossChain.js +20 -0
  227. package/lib/evm/types/index.d.ts +1 -0
  228. package/lib/evm/types/index.js +18 -0
  229. package/lib/index.d.ts +30 -0
  230. package/lib/index.js +52 -0
  231. package/lib/main.d.ts +596 -0
  232. package/lib/main.js +681 -0
  233. package/lib/modules/api/fetcher.d.ts +108 -0
  234. package/lib/modules/api/fetcher.js +187 -0
  235. package/lib/modules/api/index.d.ts +1 -0
  236. package/lib/modules/api/index.js +6 -0
  237. package/lib/modules/api/main.d.ts +587 -0
  238. package/lib/modules/api/main.js +911 -0
  239. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  240. package/lib/modules/sub-accounts/fetcher.js +96 -0
  241. package/lib/modules/sub-accounts/index.d.ts +2 -0
  242. package/lib/modules/sub-accounts/index.js +19 -0
  243. package/lib/modules/sub-accounts/main.d.ts +249 -0
  244. package/lib/modules/sub-accounts/main.js +211 -0
  245. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  246. package/lib/modules/sub-accounts/utils.js +112 -0
  247. package/lib/modules/vaults/adapter.helpers.d.ts +84 -0
  248. package/lib/modules/vaults/adapter.helpers.js +202 -0
  249. package/lib/modules/vaults/fetcher.d.ts +147 -0
  250. package/lib/modules/vaults/fetcher.js +357 -0
  251. package/lib/modules/vaults/getters.d.ts +1060 -0
  252. package/lib/modules/vaults/getters.js +4079 -0
  253. package/lib/modules/vaults/index.d.ts +20 -0
  254. package/lib/modules/vaults/index.js +44 -0
  255. package/lib/modules/vaults/main.d.ts +607 -0
  256. package/lib/modules/vaults/main.js +1687 -0
  257. package/lib/modules/vaults/prefetch.d.ts +65 -0
  258. package/lib/modules/vaults/prefetch.js +120 -0
  259. package/lib/modules/vaults/read.actions.d.ts +406 -0
  260. package/lib/modules/vaults/read.actions.js +891 -0
  261. package/lib/modules/vaults/types.d.ts +149 -0
  262. package/lib/modules/vaults/types.js +3 -0
  263. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  264. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  265. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  266. package/lib/modules/vaults/utils/date-utils.js +84 -0
  267. package/lib/modules/vaults/utils.d.ts +153 -0
  268. package/lib/modules/vaults/utils.js +818 -0
  269. package/lib/modules/vaults/write.actions.d.ts +812 -0
  270. package/lib/modules/vaults/write.actions.js +2377 -0
  271. package/lib/polyfills.d.ts +1 -0
  272. package/lib/polyfills.js +12 -0
  273. package/lib/sdk.d.ts +30173 -0
  274. package/lib/services/coingecko/fetcher.d.ts +15 -0
  275. package/lib/services/coingecko/fetcher.js +67 -0
  276. package/lib/services/coingecko/index.d.ts +2 -0
  277. package/lib/services/coingecko/index.js +19 -0
  278. package/lib/services/coingecko/utils.d.ts +1 -0
  279. package/lib/services/coingecko/utils.js +24 -0
  280. package/lib/services/debank/fetcher.d.ts +126 -0
  281. package/lib/services/debank/fetcher.js +47 -0
  282. package/lib/services/debank/index.d.ts +2 -0
  283. package/lib/services/debank/index.js +19 -0
  284. package/lib/services/debank/utils.d.ts +50 -0
  285. package/lib/services/debank/utils.js +325 -0
  286. package/lib/services/layerzero/deposits.d.ts +55 -0
  287. package/lib/services/layerzero/deposits.js +174 -0
  288. package/lib/services/layerzero/redeems.d.ts +20 -0
  289. package/lib/services/layerzero/redeems.js +92 -0
  290. package/lib/services/layerzero/utils.d.ts +9 -0
  291. package/lib/services/layerzero/utils.js +22 -0
  292. package/lib/services/octavfi/fetcher.d.ts +33 -0
  293. package/lib/services/octavfi/fetcher.js +39 -0
  294. package/lib/services/octavfi/index.d.ts +3 -0
  295. package/lib/services/octavfi/index.js +20 -0
  296. package/lib/services/octavfi/types.d.ts +34 -0
  297. package/lib/services/octavfi/types.js +3 -0
  298. package/lib/services/octavfi/utils.d.ts +16 -0
  299. package/lib/services/octavfi/utils.js +244 -0
  300. package/lib/services/subgraph/fetcher.d.ts +2 -0
  301. package/lib/services/subgraph/fetcher.js +66 -0
  302. package/lib/services/subgraph/index.d.ts +2 -0
  303. package/lib/services/subgraph/index.js +19 -0
  304. package/lib/services/subgraph/schema.d.ts +48 -0
  305. package/lib/services/subgraph/schema.js +87 -0
  306. package/lib/services/subgraph/vaults.d.ts +83 -0
  307. package/lib/services/subgraph/vaults.js +1282 -0
  308. package/lib/services/swap-quotes/index.d.ts +105 -0
  309. package/lib/services/swap-quotes/index.js +77 -0
  310. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  311. package/lib/services/swap-quotes/paraswap.js +138 -0
  312. package/lib/services/untangled/fetcher.d.ts +40 -0
  313. package/lib/services/untangled/fetcher.js +110 -0
  314. package/lib/services/untangled/index.d.ts +3 -0
  315. package/lib/services/untangled/index.js +20 -0
  316. package/lib/services/untangled/types.d.ts +83 -0
  317. package/lib/services/untangled/types.js +10 -0
  318. package/lib/services/untangled/utils.d.ts +91 -0
  319. package/lib/services/untangled/utils.js +339 -0
  320. package/lib/types/api.d.ts +498 -0
  321. package/lib/types/api.js +3 -0
  322. package/lib/types/index.d.ts +12 -0
  323. package/lib/types/index.js +28 -0
  324. package/lib/types/points.d.ts +28 -0
  325. package/lib/types/points.js +3 -0
  326. package/lib/types/pools.d.ts +144 -0
  327. package/lib/types/pools.js +3 -0
  328. package/lib/types/staking.d.ts +28 -0
  329. package/lib/types/staking.js +3 -0
  330. package/lib/types/sub-accounts.d.ts +150 -0
  331. package/lib/types/sub-accounts.js +3 -0
  332. package/lib/types/subgraph.d.ts +84 -0
  333. package/lib/types/subgraph.js +3 -0
  334. package/lib/types/typed-contract.d.ts +102 -0
  335. package/lib/types/typed-contract.js +3 -0
  336. package/lib/types/user.d.ts +1 -0
  337. package/lib/types/user.js +3 -0
  338. package/lib/types/vaults.d.ts +886 -0
  339. package/lib/types/vaults.js +30 -0
  340. package/lib/types/web3.d.ts +100 -0
  341. package/lib/types/web3.js +14 -0
  342. package/lib/types/webserver.d.ts +730 -0
  343. package/lib/types/webserver.js +3 -0
  344. package/package.json +79 -3
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUI_VAULT_CONTRACTS = exports.SUI_GRPC_URLS = exports.SUI_COIN_REGISTRY_ID = exports.SUI_CLOCK_ID = exports.SUI_CHAIN_ID = void 0;
4
+ // Canonical definition lives in `core/constants/web3.ts` so `core/` can
5
+ // recognise the Sui chain ID without importing the adapter layer. Re-exported
6
+ // here to keep `adapters/sui/constants` import sites unchanged.
7
+ var web3_1 = require("../../core/constants/web3");
8
+ Object.defineProperty(exports, "SUI_CHAIN_ID", { enumerable: true, get: function () { return web3_1.SUI_CHAIN_ID; } });
9
+ /** Sui's shared `Clock` system object, passed to time-dependent vault calls. */
10
+ exports.SUI_CLOCK_ID = '0x6';
11
+ /** Sui's shared `CoinRegistry` system object (coin metadata / currencies). */
12
+ exports.SUI_COIN_REGISTRY_ID = '0xc';
13
+ /**
14
+ * Mysten's public fullnodes, which serve gRPC-web. The SDK talks gRPC-web so
15
+ * the same code runs in browsers; a consumer `rpcUrl` goes in front of these as
16
+ * the primary (see `resolveSuiNetworkConfig`).
17
+ */
18
+ exports.SUI_GRPC_URLS = {
19
+ mainnet: 'https://fullnode.mainnet.sui.io:443',
20
+ testnet: 'https://fullnode.testnet.sui.io:443',
21
+ };
22
+ /**
23
+ * Built-in contract IDs per network. Empty until the contracts are published
24
+ * there: until then callers pass `packageId`, `originalPackageId` and
25
+ * `registryId` through `new UpshiftSDK({ sui })`.
26
+ */
27
+ exports.SUI_VAULT_CONTRACTS = {
28
+ mainnet: {},
29
+ testnet: {},
30
+ };
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Sui Adapter for Upshift SDK
3
+ *
4
+ * @module SuiAdapter
5
+ */
6
+ import type { ISuiConfig, ISuiNetwork } from '../../types';
7
+ import * as SuiClient from './client';
8
+ import * as SuiConstants from './constants';
9
+ import * as SuiTargets from './targets';
10
+ import * as SuiUtils from './utils';
11
+ export declare const Sui: {
12
+ utils: typeof SuiUtils;
13
+ constants: typeof SuiConstants;
14
+ client: typeof SuiClient;
15
+ targets: typeof SuiTargets;
16
+ };
17
+ /**
18
+ * Sui Adapter for Upshift SDK.
19
+ *
20
+ * Holds the Sui configuration passed to `new UpshiftSDK({ sui })` and the Sui
21
+ * chain-identity helpers. It makes no network calls.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const sdk = new UpshiftSDK({ appName: 'my-app', sui: { network: 'testnet' } });
26
+ * sdk.sui.network; // 'testnet'
27
+ * sdk.sui.isSuiAddress(vault.address);
28
+ * ```
29
+ */
30
+ declare class SuiAdapter {
31
+ private readonly _config;
32
+ /**
33
+ * @param config - Optional Sui settings; omit to target Sui mainnet.
34
+ */
35
+ constructor(config?: ISuiConfig);
36
+ /** The SDK's Sui chain ID, `-2` (same as the backend's `chain` for Sui vaults). */
37
+ get chainId(): number;
38
+ /** Configured Sui network; `'mainnet'` unless the SDK was built with another. */
39
+ get network(): ISuiNetwork;
40
+ /** Configured RPC endpoint override, or `undefined` when none was given. */
41
+ get rpcUrl(): string | undefined;
42
+ /**
43
+ * Check whether a string is a Sui address or object ID (`0x` + 64 hex chars).
44
+ *
45
+ * @param address - Candidate address.
46
+ * @returns `true` for the long, 64-hex-digit form only.
47
+ */
48
+ isSuiAddress(address: string): boolean;
49
+ /**
50
+ * Check whether a chain ID is Sui's (`-2`).
51
+ *
52
+ * @param chainId - Numeric chain ID, e.g. a backend vault row's `chain`.
53
+ * @returns `true` only for `-2`.
54
+ */
55
+ isSuiVault(chainId: number): boolean;
56
+ }
57
+ export default SuiAdapter;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Sui = void 0;
37
+ const SuiClient = __importStar(require("./client"));
38
+ const SuiConstants = __importStar(require("./constants"));
39
+ const SuiTargets = __importStar(require("./targets"));
40
+ const SuiUtils = __importStar(require("./utils"));
41
+ exports.Sui = {
42
+ utils: SuiUtils,
43
+ constants: SuiConstants,
44
+ client: SuiClient,
45
+ targets: SuiTargets,
46
+ };
47
+ /**
48
+ * Sui Adapter for Upshift SDK.
49
+ *
50
+ * Holds the Sui configuration passed to `new UpshiftSDK({ sui })` and the Sui
51
+ * chain-identity helpers. It makes no network calls.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const sdk = new UpshiftSDK({ appName: 'my-app', sui: { network: 'testnet' } });
56
+ * sdk.sui.network; // 'testnet'
57
+ * sdk.sui.isSuiAddress(vault.address);
58
+ * ```
59
+ */
60
+ class SuiAdapter {
61
+ _config;
62
+ /**
63
+ * @param config - Optional Sui settings; omit to target Sui mainnet.
64
+ */
65
+ constructor(config = {}) {
66
+ this._config = { ...config };
67
+ }
68
+ /** The SDK's Sui chain ID, `-2` (same as the backend's `chain` for Sui vaults). */
69
+ get chainId() {
70
+ return SuiConstants.SUI_CHAIN_ID;
71
+ }
72
+ /** Configured Sui network; `'mainnet'` unless the SDK was built with another. */
73
+ get network() {
74
+ return this._config.network ?? 'mainnet';
75
+ }
76
+ /** Configured RPC endpoint override, or `undefined` when none was given. */
77
+ get rpcUrl() {
78
+ return this._config.rpcUrl;
79
+ }
80
+ /**
81
+ * Check whether a string is a Sui address or object ID (`0x` + 64 hex chars).
82
+ *
83
+ * @param address - Candidate address.
84
+ * @returns `true` for the long, 64-hex-digit form only.
85
+ */
86
+ isSuiAddress(address) {
87
+ return SuiUtils.isSuiAddress(address);
88
+ }
89
+ /**
90
+ * Check whether a chain ID is Sui's (`-2`).
91
+ *
92
+ * @param chainId - Numeric chain ID, e.g. a backend vault row's `chain`.
93
+ * @returns `true` only for `-2`.
94
+ */
95
+ isSuiVault(chainId) {
96
+ return SuiUtils.isSuiVault(chainId);
97
+ }
98
+ }
99
+ exports.default = SuiAdapter;
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Move-call targets for the Upshift Sui vault package.
3
+ *
4
+ * One table names every package function the SDK calls, together with the Move
5
+ * parameter list it expects. The target helpers read the module and function
6
+ * from it, and the contracts drift check
7
+ * (`packages/sdk/scripts/check-sui-contracts-drift.mjs`) compares the parameter
8
+ * lists with the Move sources at the commit pinned in
9
+ * `packages/sdk/.sui-vaults-contracts-pin`, so a contract change that would
10
+ * break a call fails CI instead of a user's transaction.
11
+ *
12
+ * @module SuiTargets
13
+ */
14
+ import type { ISuiConfig } from '../../types';
15
+ import { type ISuiVaultContracts } from './constants';
16
+ /** A package function the SDK calls, with the Move signature it relies on. */
17
+ export interface ISuiVaultTargetSpec {
18
+ /** Move module inside the `upshift_vault` package. */
19
+ module: 'coin_entry' | 'vault' | 'withdrawal';
20
+ /** Function name inside `module`. */
21
+ function: string;
22
+ /**
23
+ * Parameter types as written in the Move source, without names (for example
24
+ * `&mut Vault<Asset, Share>`). Checked against the pinned contracts.
25
+ */
26
+ params: readonly string[];
27
+ }
28
+ /**
29
+ * Every `upshift_vault` function the SDK calls, keyed by a stable name.
30
+ *
31
+ * Vault functions take the `<Asset, Share>` type arguments built by
32
+ * {@link suiVaultTypeArguments}; `withdrawal::share` takes `<Share>` only.
33
+ */
34
+ export declare const SUI_VAULT_TARGETS: {
35
+ readonly deposit: {
36
+ readonly module: "coin_entry";
37
+ readonly function: "deposit";
38
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Asset>", "&mut TxContext"];
39
+ };
40
+ readonly depositChecked: {
41
+ readonly module: "coin_entry";
42
+ readonly function: "deposit_checked";
43
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Asset>", "u64", "&mut TxContext"];
44
+ };
45
+ readonly redeem: {
46
+ readonly module: "coin_entry";
47
+ readonly function: "redeem";
48
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "&mut TxContext"];
49
+ };
50
+ readonly redeemChecked: {
51
+ readonly module: "coin_entry";
52
+ readonly function: "redeem_checked";
53
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "u64", "&mut TxContext"];
54
+ };
55
+ readonly requestWithdrawal: {
56
+ readonly module: "coin_entry";
57
+ readonly function: "request_withdrawal";
58
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "u64", "address", "Option<address>", "&Clock", "&TxContext"];
59
+ };
60
+ readonly cancelWithdrawal: {
61
+ readonly module: "coin_entry";
62
+ readonly function: "cancel_withdrawal";
63
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "&mut TxContext"];
64
+ };
65
+ readonly shareWithdrawalRequest: {
66
+ readonly module: "withdrawal";
67
+ readonly function: "share";
68
+ readonly params: readonly ["WithdrawalRequest<Share>"];
69
+ };
70
+ readonly finalizeWithdrawal: {
71
+ readonly module: "vault";
72
+ readonly function: "finalize_withdrawal";
73
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "&Clock", "&TxContext"];
74
+ };
75
+ readonly finalizeWithdrawalChecked: {
76
+ readonly module: "vault";
77
+ readonly function: "finalize_withdrawal_checked";
78
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "u64", "&Clock", "&TxContext"];
79
+ };
80
+ readonly chargeManagementFee: {
81
+ readonly module: "vault";
82
+ readonly function: "charge_management_fee";
83
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "&Clock"];
84
+ };
85
+ readonly totalAssets: {
86
+ readonly module: "vault";
87
+ readonly function: "total_assets";
88
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry"];
89
+ };
90
+ readonly totalSupply: {
91
+ readonly module: "vault";
92
+ readonly function: "total_supply";
93
+ readonly params: readonly ["&Vault<Asset, Share>"];
94
+ };
95
+ readonly sharePrice: {
96
+ readonly module: "vault";
97
+ readonly function: "share_price";
98
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry"];
99
+ };
100
+ readonly previewDeposit: {
101
+ readonly module: "vault";
102
+ readonly function: "preview_deposit";
103
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry", "u64"];
104
+ };
105
+ readonly previewRedemption: {
106
+ readonly module: "vault";
107
+ readonly function: "preview_redemption";
108
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry", "u64", "bool"];
109
+ };
110
+ };
111
+ /** Name of a package function the SDK calls; a key of {@link SUI_VAULT_TARGETS}. */
112
+ export type ISuiVaultTarget = keyof typeof SUI_VAULT_TARGETS;
113
+ /** A fully qualified move-call target: `<package>::<module>::<function>`. */
114
+ export type ISuiMoveCallTarget = `${string}::${string}::${string}`;
115
+ /**
116
+ * Resolve the Upshift vault contract IDs for a Sui config: each `sui` override
117
+ * wins over the SDK's built-in ID for the network.
118
+ *
119
+ * @param config - The `sui` config passed to `new UpshiftSDK({ sui })`.
120
+ * @returns The package, original package and Registry IDs for the network.
121
+ * @throws {@link UpshiftValidationError} (`INVALID_INPUT`) when an ID is
122
+ * missing for the network — the SDK ships none until the contracts are
123
+ * published there — or is not a long-form Sui ID (`0x` + 64 hex chars).
124
+ * @example
125
+ * ```ts
126
+ * const contracts = resolveSuiVaultContracts({
127
+ * network: 'testnet',
128
+ * packageId: '0x…',
129
+ * originalPackageId: '0x…',
130
+ * registryId: '0x…',
131
+ * });
132
+ * ```
133
+ */
134
+ export declare function resolveSuiVaultContracts(config?: ISuiConfig): ISuiVaultContracts;
135
+ /**
136
+ * Build the move-call target for a package function, on the latest package.
137
+ *
138
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
139
+ * @param target - Which package function to call.
140
+ * @returns `<packageId>::<module>::<function>`, ready for `tx.moveCall`.
141
+ * @example
142
+ * ```ts
143
+ * tx.moveCall({
144
+ * target: suiMoveCallTarget(contracts, 'deposit'),
145
+ * typeArguments: suiVaultTypeArguments(assetType, shareType),
146
+ * arguments: [tx.object(vaultId), tx.object(contracts.registryId), coin],
147
+ * });
148
+ * ```
149
+ */
150
+ export declare function suiMoveCallTarget(contracts: Pick<ISuiVaultContracts, 'packageId'>, target: ISuiVaultTarget): ISuiMoveCallTarget;
151
+ /**
152
+ * Type arguments for a vault function: `[Asset, Share]`, in that order.
153
+ *
154
+ * @param assetCoinType - Move type of the deposit coin, e.g. `0x…::usdc::USDC`.
155
+ * @param shareCoinType - Move type of the vault's share coin.
156
+ * @returns `[assetCoinType, shareCoinType]`.
157
+ */
158
+ export declare function suiVaultTypeArguments(assetCoinType: string, shareCoinType: string): [string, string];
159
+ /**
160
+ * The on-chain Move type of a vault object, which names the original package.
161
+ *
162
+ * Matches the `type` a fullnode reports for the object: type arguments joined
163
+ * by a bare comma, as the node prints them. Pass coin types in the node's
164
+ * long form (`0x` + 64 hex chars) for an exact string match.
165
+ *
166
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
167
+ * @param assetCoinType - Move type of the deposit coin.
168
+ * @param shareCoinType - Move type of the vault's share coin.
169
+ * @returns `<originalPackageId>::vault::Vault<Asset,Share>`.
170
+ */
171
+ export declare function suiVaultObjectType(contracts: Pick<ISuiVaultContracts, 'originalPackageId'>, assetCoinType: string, shareCoinType: string): string;
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUI_VAULT_TARGETS = void 0;
4
+ exports.resolveSuiVaultContracts = resolveSuiVaultContracts;
5
+ exports.suiMoveCallTarget = suiMoveCallTarget;
6
+ exports.suiVaultTypeArguments = suiVaultTypeArguments;
7
+ exports.suiVaultObjectType = suiVaultObjectType;
8
+ const errors_1 = require("../../core/errors");
9
+ const chain_address_1 = require("../../core/helpers/chain-address");
10
+ const constants_1 = require("./constants");
11
+ /**
12
+ * Every `upshift_vault` function the SDK calls, keyed by a stable name.
13
+ *
14
+ * Vault functions take the `<Asset, Share>` type arguments built by
15
+ * {@link suiVaultTypeArguments}; `withdrawal::share` takes `<Share>` only.
16
+ */
17
+ exports.SUI_VAULT_TARGETS = {
18
+ deposit: {
19
+ module: 'coin_entry',
20
+ function: 'deposit',
21
+ params: [
22
+ '&mut Vault<Asset, Share>',
23
+ '&Registry',
24
+ 'Coin<Asset>',
25
+ '&mut TxContext',
26
+ ],
27
+ },
28
+ depositChecked: {
29
+ module: 'coin_entry',
30
+ function: 'deposit_checked',
31
+ params: [
32
+ '&mut Vault<Asset, Share>',
33
+ '&Registry',
34
+ 'Coin<Asset>',
35
+ 'u64',
36
+ '&mut TxContext',
37
+ ],
38
+ },
39
+ redeem: {
40
+ module: 'coin_entry',
41
+ function: 'redeem',
42
+ params: [
43
+ '&mut Vault<Asset, Share>',
44
+ '&Registry',
45
+ 'Coin<Share>',
46
+ '&mut TxContext',
47
+ ],
48
+ },
49
+ redeemChecked: {
50
+ module: 'coin_entry',
51
+ function: 'redeem_checked',
52
+ params: [
53
+ '&mut Vault<Asset, Share>',
54
+ '&Registry',
55
+ 'Coin<Share>',
56
+ 'u64',
57
+ '&mut TxContext',
58
+ ],
59
+ },
60
+ requestWithdrawal: {
61
+ module: 'coin_entry',
62
+ function: 'request_withdrawal',
63
+ params: [
64
+ '&mut Vault<Asset, Share>',
65
+ '&Registry',
66
+ 'Coin<Share>',
67
+ 'u64',
68
+ 'address',
69
+ 'Option<address>',
70
+ '&Clock',
71
+ '&TxContext',
72
+ ],
73
+ },
74
+ cancelWithdrawal: {
75
+ module: 'coin_entry',
76
+ function: 'cancel_withdrawal',
77
+ params: [
78
+ '&mut Vault<Asset, Share>',
79
+ '&Registry',
80
+ 'WithdrawalRequest<Share>',
81
+ '&mut TxContext',
82
+ ],
83
+ },
84
+ shareWithdrawalRequest: {
85
+ module: 'withdrawal',
86
+ function: 'share',
87
+ params: ['WithdrawalRequest<Share>'],
88
+ },
89
+ finalizeWithdrawal: {
90
+ module: 'vault',
91
+ function: 'finalize_withdrawal',
92
+ params: [
93
+ '&mut Vault<Asset, Share>',
94
+ '&Registry',
95
+ 'WithdrawalRequest<Share>',
96
+ '&Clock',
97
+ '&TxContext',
98
+ ],
99
+ },
100
+ finalizeWithdrawalChecked: {
101
+ module: 'vault',
102
+ function: 'finalize_withdrawal_checked',
103
+ params: [
104
+ '&mut Vault<Asset, Share>',
105
+ '&Registry',
106
+ 'WithdrawalRequest<Share>',
107
+ 'u64',
108
+ '&Clock',
109
+ '&TxContext',
110
+ ],
111
+ },
112
+ chargeManagementFee: {
113
+ module: 'vault',
114
+ function: 'charge_management_fee',
115
+ params: ['&mut Vault<Asset, Share>', '&Registry', '&Clock'],
116
+ },
117
+ totalAssets: {
118
+ module: 'vault',
119
+ function: 'total_assets',
120
+ params: ['&Vault<Asset, Share>', '&Registry'],
121
+ },
122
+ totalSupply: {
123
+ module: 'vault',
124
+ function: 'total_supply',
125
+ params: ['&Vault<Asset, Share>'],
126
+ },
127
+ sharePrice: {
128
+ module: 'vault',
129
+ function: 'share_price',
130
+ params: ['&Vault<Asset, Share>', '&Registry'],
131
+ },
132
+ previewDeposit: {
133
+ module: 'vault',
134
+ function: 'preview_deposit',
135
+ params: ['&Vault<Asset, Share>', '&Registry', 'u64'],
136
+ },
137
+ previewRedemption: {
138
+ module: 'vault',
139
+ function: 'preview_redemption',
140
+ params: ['&Vault<Asset, Share>', '&Registry', 'u64', 'bool'],
141
+ },
142
+ };
143
+ /**
144
+ * Resolve the Upshift vault contract IDs for a Sui config: each `sui` override
145
+ * wins over the SDK's built-in ID for the network.
146
+ *
147
+ * @param config - The `sui` config passed to `new UpshiftSDK({ sui })`.
148
+ * @returns The package, original package and Registry IDs for the network.
149
+ * @throws {@link UpshiftValidationError} (`INVALID_INPUT`) when an ID is
150
+ * missing for the network — the SDK ships none until the contracts are
151
+ * published there — or is not a long-form Sui ID (`0x` + 64 hex chars).
152
+ * @example
153
+ * ```ts
154
+ * const contracts = resolveSuiVaultContracts({
155
+ * network: 'testnet',
156
+ * packageId: '0x…',
157
+ * originalPackageId: '0x…',
158
+ * registryId: '0x…',
159
+ * });
160
+ * ```
161
+ */
162
+ function resolveSuiVaultContracts(config = {}) {
163
+ const network = config.network ?? 'mainnet';
164
+ const defaults = constants_1.SUI_VAULT_CONTRACTS[network];
165
+ const resolved = {
166
+ packageId: config.packageId ?? defaults.packageId,
167
+ originalPackageId: config.originalPackageId ?? defaults.originalPackageId,
168
+ registryId: config.registryId ?? defaults.registryId,
169
+ };
170
+ for (const [field, value] of Object.entries(resolved)) {
171
+ if (!value) {
172
+ throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Sui ${network}: no ${field} for the Upshift vault contracts. ` +
173
+ `Pass it as \`sui.${field}\` in new UpshiftSDK({ sui }).`, { context: { network, field } });
174
+ }
175
+ if (!(0, chain_address_1.isSuiAddress)(value)) {
176
+ throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Sui ${network}: ${field} must be a long-form Sui ID (0x + 64 hex chars).`, { context: { network, field } });
177
+ }
178
+ }
179
+ return resolved;
180
+ }
181
+ /**
182
+ * Build the move-call target for a package function, on the latest package.
183
+ *
184
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
185
+ * @param target - Which package function to call.
186
+ * @returns `<packageId>::<module>::<function>`, ready for `tx.moveCall`.
187
+ * @example
188
+ * ```ts
189
+ * tx.moveCall({
190
+ * target: suiMoveCallTarget(contracts, 'deposit'),
191
+ * typeArguments: suiVaultTypeArguments(assetType, shareType),
192
+ * arguments: [tx.object(vaultId), tx.object(contracts.registryId), coin],
193
+ * });
194
+ * ```
195
+ */
196
+ function suiMoveCallTarget(contracts, target) {
197
+ const spec = exports.SUI_VAULT_TARGETS[target];
198
+ return `${contracts.packageId}::${spec.module}::${spec.function}`;
199
+ }
200
+ /**
201
+ * Type arguments for a vault function: `[Asset, Share]`, in that order.
202
+ *
203
+ * @param assetCoinType - Move type of the deposit coin, e.g. `0x…::usdc::USDC`.
204
+ * @param shareCoinType - Move type of the vault's share coin.
205
+ * @returns `[assetCoinType, shareCoinType]`.
206
+ */
207
+ function suiVaultTypeArguments(assetCoinType, shareCoinType) {
208
+ return [assetCoinType, shareCoinType];
209
+ }
210
+ /**
211
+ * The on-chain Move type of a vault object, which names the original package.
212
+ *
213
+ * Matches the `type` a fullnode reports for the object: type arguments joined
214
+ * by a bare comma, as the node prints them. Pass coin types in the node's
215
+ * long form (`0x` + 64 hex chars) for an exact string match.
216
+ *
217
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
218
+ * @param assetCoinType - Move type of the deposit coin.
219
+ * @param shareCoinType - Move type of the vault's share coin.
220
+ * @returns `<originalPackageId>::vault::Vault<Asset,Share>`.
221
+ */
222
+ function suiVaultObjectType(contracts, assetCoinType, shareCoinType) {
223
+ return `${contracts.originalPackageId}::vault::Vault<${assetCoinType},${shareCoinType}>`;
224
+ }
225
+ //# sourceMappingURL=targets.js.map
@@ -0,0 +1,8 @@
1
+ export { isSuiAddress } from '../../core/helpers/chain-address';
2
+ /**
3
+ * Whether `chainId` is the SDK's Sui chain ID ({@link SUI_CHAIN_ID}, `-2`).
4
+ *
5
+ * @param chainId - Numeric chain ID, e.g. a backend vault row's `chain`.
6
+ * @returns `true` only for `-2`.
7
+ */
8
+ export declare function isSuiVault(chainId: number): boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSuiAddress = void 0;
4
+ exports.isSuiVault = isSuiVault;
5
+ const constants_1 = require("./constants");
6
+ var chain_address_1 = require("../../core/helpers/chain-address");
7
+ Object.defineProperty(exports, "isSuiAddress", { enumerable: true, get: function () { return chain_address_1.isSuiAddress; } });
8
+ /**
9
+ * Whether `chainId` is the SDK's Sui chain ID ({@link SUI_CHAIN_ID}, `-2`).
10
+ *
11
+ * @param chainId - Numeric chain ID, e.g. a backend vault row's `chain`.
12
+ * @returns `true` only for `-2`.
13
+ */
14
+ function isSuiVault(chainId) {
15
+ return chainId === constants_1.SUI_CHAIN_ID;
16
+ }
17
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Validate an `appName` slug at SDK boundary points (the `UpshiftSDK`
3
+ * constructor and the standalone {@link initializeSentry} entry point).
4
+ *
5
+ * Rules (kept intentionally narrow so the value is safe to use as a Sentry
6
+ * tag, an HTTP header value, and a filesystem-safe identifier — this is
7
+ * why we accept slugs only, not display names):
8
+ * - non-empty after trim
9
+ * - 3..64 characters
10
+ * - only `[a-zA-Z0-9._-]`
11
+ * - not shaped like an EVM address (`0x` + 40 hex chars) — an address
12
+ * passes the character rules but is a high-cardinality wallet
13
+ * identifier, not an application name. This also catches callers of
14
+ * `initializeSentry` still passing the pre-v9 positional argument
15
+ * order, where a wallet address occupied the slot `appName` now holds.
16
+ *
17
+ * Throws a descriptive `UpshiftValidationError` (code `INVALID_INPUT`) that
18
+ * names the failed rule and includes a remediation hint pointing at the
19
+ * docs link.
20
+ *
21
+ * @param value - The candidate app name, as received from the caller.
22
+ * @returns The trimmed, validated slug.
23
+ * @throws UpshiftValidationError when the value is missing, empty,
24
+ * mis-typed, out of the 3–64 length range, contains disallowed
25
+ * characters, or is shaped like an EVM address.
26
+ */
27
+ export declare function validateAppName(value: unknown): string;