augustdigital-sdk 8.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  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 +1043 -0
  40. package/lib/abis/SwapRouter.js +740 -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 +209 -0
  65. package/lib/adapters/evm/index.d.ts +353 -0
  66. package/lib/adapters/evm/index.js +434 -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/constants.d.ts +33 -0
  70. package/lib/adapters/solana/constants.js +52 -0
  71. package/lib/adapters/solana/getters.d.ts +11 -0
  72. package/lib/adapters/solana/getters.js +165 -0
  73. package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
  74. package/lib/adapters/solana/idl/vault-idl.js +1084 -0
  75. package/lib/adapters/solana/index.d.ts +233 -0
  76. package/lib/adapters/solana/index.js +291 -0
  77. package/lib/adapters/solana/types.d.ts +67 -0
  78. package/lib/adapters/solana/types.js +3 -0
  79. package/lib/adapters/solana/utils.d.ts +141 -0
  80. package/lib/adapters/solana/utils.js +595 -0
  81. package/lib/adapters/solana/vault.actions.d.ts +57 -0
  82. package/lib/adapters/solana/vault.actions.js +379 -0
  83. package/lib/adapters/stellar/actions.d.ts +28 -0
  84. package/lib/adapters/stellar/actions.js +77 -0
  85. package/lib/adapters/stellar/constants.d.ts +43 -0
  86. package/lib/adapters/stellar/constants.js +53 -0
  87. package/lib/adapters/stellar/getters.d.ts +68 -0
  88. package/lib/adapters/stellar/getters.js +290 -0
  89. package/lib/adapters/stellar/index.d.ts +114 -0
  90. package/lib/adapters/stellar/index.js +175 -0
  91. package/lib/adapters/stellar/soroban.d.ts +123 -0
  92. package/lib/adapters/stellar/soroban.js +613 -0
  93. package/lib/adapters/stellar/submit.d.ts +34 -0
  94. package/lib/adapters/stellar/submit.js +149 -0
  95. package/lib/adapters/stellar/types.d.ts +58 -0
  96. package/lib/adapters/stellar/types.js +6 -0
  97. package/lib/adapters/stellar/utils.d.ts +24 -0
  98. package/lib/adapters/stellar/utils.js +34 -0
  99. package/lib/adapters/sui/constants.d.ts +14 -0
  100. package/lib/adapters/sui/constants.js +29 -0
  101. package/lib/adapters/sui/getters.d.ts +9 -0
  102. package/lib/adapters/sui/getters.js +60 -0
  103. package/lib/adapters/sui/index.d.ts +45 -0
  104. package/lib/adapters/sui/index.js +101 -0
  105. package/lib/adapters/sui/transformer.d.ts +10 -0
  106. package/lib/adapters/sui/transformer.js +107 -0
  107. package/lib/adapters/sui/types.d.ts +66 -0
  108. package/lib/adapters/sui/types.js +3 -0
  109. package/lib/adapters/sui/utils.d.ts +10 -0
  110. package/lib/adapters/sui/utils.js +29 -0
  111. package/lib/core/analytics/chain-name.d.ts +9 -0
  112. package/lib/core/analytics/chain-name.js +34 -0
  113. package/lib/core/analytics/constants.d.ts +5 -0
  114. package/lib/core/analytics/constants.js +9 -0
  115. package/lib/core/analytics/env.d.ts +29 -0
  116. package/lib/core/analytics/env.js +59 -0
  117. package/lib/core/analytics/index.d.ts +36 -0
  118. package/lib/core/analytics/index.js +79 -0
  119. package/lib/core/analytics/instrumentation.d.ts +29 -0
  120. package/lib/core/analytics/instrumentation.js +277 -0
  121. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  122. package/lib/core/analytics/method-taxonomy.js +128 -0
  123. package/lib/core/analytics/metrics.d.ts +33 -0
  124. package/lib/core/analytics/metrics.js +116 -0
  125. package/lib/core/analytics/sanitize.d.ts +44 -0
  126. package/lib/core/analytics/sanitize.js +260 -0
  127. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  128. package/lib/core/analytics/sentry-runtime.js +97 -0
  129. package/lib/core/analytics/sentry.d.ts +67 -0
  130. package/lib/core/analytics/sentry.js +613 -0
  131. package/lib/core/analytics/types.d.ts +48 -0
  132. package/lib/core/analytics/types.js +3 -0
  133. package/lib/core/analytics/user-identity.d.ts +41 -0
  134. package/lib/core/analytics/user-identity.js +141 -0
  135. package/lib/core/analytics/version.d.ts +6 -0
  136. package/lib/core/analytics/version.js +10 -0
  137. package/lib/core/attribution.d.ts +111 -0
  138. package/lib/core/attribution.js +142 -0
  139. package/lib/core/auth/index.d.ts +1 -0
  140. package/lib/core/auth/index.js +18 -0
  141. package/lib/core/auth/verify.d.ts +2 -0
  142. package/lib/core/auth/verify.js +31 -0
  143. package/lib/core/base.class.d.ts +152 -0
  144. package/lib/core/base.class.js +172 -0
  145. package/lib/core/cache.d.ts +9 -0
  146. package/lib/core/cache.js +31 -0
  147. package/lib/core/constants/adapters.d.ts +103 -0
  148. package/lib/core/constants/adapters.js +180 -0
  149. package/lib/core/constants/core.d.ts +133 -0
  150. package/lib/core/constants/core.js +209 -0
  151. package/lib/core/constants/swap-router.d.ts +150 -0
  152. package/lib/core/constants/swap-router.js +169 -0
  153. package/lib/core/constants/vaults.d.ts +93 -0
  154. package/lib/core/constants/vaults.js +273 -0
  155. package/lib/core/constants/web3.d.ts +91 -0
  156. package/lib/core/constants/web3.js +229 -0
  157. package/lib/core/errors/index.d.ts +114 -0
  158. package/lib/core/errors/index.js +183 -0
  159. package/lib/core/fetcher.d.ts +198 -0
  160. package/lib/core/fetcher.js +903 -0
  161. package/lib/core/helpers/adapters.d.ts +13 -0
  162. package/lib/core/helpers/adapters.js +39 -0
  163. package/lib/core/helpers/chain-address.d.ts +13 -0
  164. package/lib/core/helpers/chain-address.js +47 -0
  165. package/lib/core/helpers/chain-error.d.ts +207 -0
  166. package/lib/core/helpers/chain-error.js +682 -0
  167. package/lib/core/helpers/chain-support.d.ts +80 -0
  168. package/lib/core/helpers/chain-support.js +115 -0
  169. package/lib/core/helpers/core.d.ts +68 -0
  170. package/lib/core/helpers/core.js +285 -0
  171. package/lib/core/helpers/explorer-link.d.ts +16 -0
  172. package/lib/core/helpers/explorer-link.js +26 -0
  173. package/lib/core/helpers/multicall.d.ts +68 -0
  174. package/lib/core/helpers/multicall.js +103 -0
  175. package/lib/core/helpers/revert-decode.d.ts +248 -0
  176. package/lib/core/helpers/revert-decode.js +515 -0
  177. package/lib/core/helpers/signer.d.ts +52 -0
  178. package/lib/core/helpers/signer.js +145 -0
  179. package/lib/core/helpers/swap-router.d.ts +211 -0
  180. package/lib/core/helpers/swap-router.js +480 -0
  181. package/lib/core/helpers/vault-version.d.ts +23 -0
  182. package/lib/core/helpers/vault-version.js +75 -0
  183. package/lib/core/helpers/vaults.d.ts +89 -0
  184. package/lib/core/helpers/vaults.js +235 -0
  185. package/lib/core/helpers/web3.d.ts +353 -0
  186. package/lib/core/helpers/web3.js +992 -0
  187. package/lib/core/index.d.ts +23 -0
  188. package/lib/core/index.js +40 -0
  189. package/lib/core/logger/index.d.ts +98 -0
  190. package/lib/core/logger/index.js +144 -0
  191. package/lib/core/logger/slack.d.ts +16 -0
  192. package/lib/core/logger/slack.js +57 -0
  193. package/lib/core/vault-metadata.d.ts +12 -0
  194. package/lib/core/vault-metadata.js +42 -0
  195. package/lib/core/version-check.d.ts +58 -0
  196. package/lib/core/version-check.js +182 -0
  197. package/lib/evm/index.d.ts +2 -0
  198. package/lib/evm/index.js +19 -0
  199. package/lib/evm/methods/crossChainVault.d.ts +128 -0
  200. package/lib/evm/methods/crossChainVault.js +853 -0
  201. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  202. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  203. package/lib/evm/methods/index.d.ts +2 -0
  204. package/lib/evm/methods/index.js +19 -0
  205. package/lib/evm/types/crossChain.d.ts +363 -0
  206. package/lib/evm/types/crossChain.js +20 -0
  207. package/lib/evm/types/index.d.ts +1 -0
  208. package/lib/evm/types/index.js +18 -0
  209. package/lib/index.d.ts +30 -0
  210. package/lib/index.js +52 -0
  211. package/lib/main.d.ts +527 -0
  212. package/lib/main.js +601 -0
  213. package/lib/modules/api/fetcher.d.ts +82 -0
  214. package/lib/modules/api/fetcher.js +150 -0
  215. package/lib/modules/api/index.d.ts +1 -0
  216. package/lib/modules/api/index.js +6 -0
  217. package/lib/modules/api/main.d.ts +313 -0
  218. package/lib/modules/api/main.js +479 -0
  219. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  220. package/lib/modules/sub-accounts/fetcher.js +120 -0
  221. package/lib/modules/sub-accounts/index.d.ts +2 -0
  222. package/lib/modules/sub-accounts/index.js +19 -0
  223. package/lib/modules/sub-accounts/main.d.ts +243 -0
  224. package/lib/modules/sub-accounts/main.js +205 -0
  225. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  226. package/lib/modules/sub-accounts/utils.js +112 -0
  227. package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
  228. package/lib/modules/vaults/adapter.helpers.js +184 -0
  229. package/lib/modules/vaults/fetcher.d.ts +147 -0
  230. package/lib/modules/vaults/fetcher.js +368 -0
  231. package/lib/modules/vaults/getters.d.ts +570 -0
  232. package/lib/modules/vaults/getters.js +3051 -0
  233. package/lib/modules/vaults/index.d.ts +20 -0
  234. package/lib/modules/vaults/index.js +44 -0
  235. package/lib/modules/vaults/main.d.ts +601 -0
  236. package/lib/modules/vaults/main.js +1623 -0
  237. package/lib/modules/vaults/prefetch.d.ts +65 -0
  238. package/lib/modules/vaults/prefetch.js +120 -0
  239. package/lib/modules/vaults/read.actions.d.ts +225 -0
  240. package/lib/modules/vaults/read.actions.js +596 -0
  241. package/lib/modules/vaults/types.d.ts +71 -0
  242. package/lib/modules/vaults/types.js +3 -0
  243. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  244. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  245. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  246. package/lib/modules/vaults/utils/date-utils.js +84 -0
  247. package/lib/modules/vaults/utils.d.ts +140 -0
  248. package/lib/modules/vaults/utils.js +799 -0
  249. package/lib/modules/vaults/write.actions.d.ts +529 -0
  250. package/lib/modules/vaults/write.actions.js +1749 -0
  251. package/lib/polyfills.d.ts +1 -0
  252. package/lib/polyfills.js +12 -0
  253. package/lib/sdk.d.ts +26721 -0
  254. package/lib/services/coingecko/fetcher.d.ts +15 -0
  255. package/lib/services/coingecko/fetcher.js +67 -0
  256. package/lib/services/coingecko/index.d.ts +2 -0
  257. package/lib/services/coingecko/index.js +19 -0
  258. package/lib/services/coingecko/utils.d.ts +1 -0
  259. package/lib/services/coingecko/utils.js +24 -0
  260. package/lib/services/debank/fetcher.d.ts +126 -0
  261. package/lib/services/debank/fetcher.js +47 -0
  262. package/lib/services/debank/index.d.ts +2 -0
  263. package/lib/services/debank/index.js +19 -0
  264. package/lib/services/debank/utils.d.ts +38 -0
  265. package/lib/services/debank/utils.js +297 -0
  266. package/lib/services/layerzero/deposits.d.ts +49 -0
  267. package/lib/services/layerzero/deposits.js +166 -0
  268. package/lib/services/layerzero/redeems.d.ts +20 -0
  269. package/lib/services/layerzero/redeems.js +92 -0
  270. package/lib/services/layerzero/utils.d.ts +9 -0
  271. package/lib/services/layerzero/utils.js +22 -0
  272. package/lib/services/octavfi/fetcher.d.ts +9 -0
  273. package/lib/services/octavfi/fetcher.js +103 -0
  274. package/lib/services/octavfi/index.d.ts +3 -0
  275. package/lib/services/octavfi/index.js +20 -0
  276. package/lib/services/octavfi/types.d.ts +34 -0
  277. package/lib/services/octavfi/types.js +3 -0
  278. package/lib/services/octavfi/utils.d.ts +16 -0
  279. package/lib/services/octavfi/utils.js +212 -0
  280. package/lib/services/subgraph/fetcher.d.ts +2 -0
  281. package/lib/services/subgraph/fetcher.js +61 -0
  282. package/lib/services/subgraph/index.d.ts +2 -0
  283. package/lib/services/subgraph/index.js +19 -0
  284. package/lib/services/subgraph/schema.d.ts +45 -0
  285. package/lib/services/subgraph/schema.js +75 -0
  286. package/lib/services/subgraph/vaults.d.ts +25 -0
  287. package/lib/services/subgraph/vaults.js +1106 -0
  288. package/lib/services/swap-quotes/index.d.ts +105 -0
  289. package/lib/services/swap-quotes/index.js +77 -0
  290. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  291. package/lib/services/swap-quotes/paraswap.js +138 -0
  292. package/lib/types/api.d.ts +280 -0
  293. package/lib/types/api.js +3 -0
  294. package/lib/types/index.d.ts +12 -0
  295. package/lib/types/index.js +28 -0
  296. package/lib/types/points.d.ts +28 -0
  297. package/lib/types/points.js +3 -0
  298. package/lib/types/pools.d.ts +144 -0
  299. package/lib/types/pools.js +3 -0
  300. package/lib/types/staking.d.ts +28 -0
  301. package/lib/types/staking.js +3 -0
  302. package/lib/types/sub-accounts.d.ts +140 -0
  303. package/lib/types/sub-accounts.js +3 -0
  304. package/lib/types/subgraph.d.ts +74 -0
  305. package/lib/types/subgraph.js +3 -0
  306. package/lib/types/typed-contract.d.ts +102 -0
  307. package/lib/types/typed-contract.js +3 -0
  308. package/lib/types/user.d.ts +1 -0
  309. package/lib/types/user.js +3 -0
  310. package/lib/types/vaults.d.ts +714 -0
  311. package/lib/types/vaults.js +24 -0
  312. package/lib/types/web3.d.ts +51 -0
  313. package/lib/types/web3.js +14 -0
  314. package/lib/types/webserver.d.ts +698 -0
  315. package/lib/types/webserver.js +3 -0
  316. package/package.json +78 -0
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ /**
3
+ * Stellar Transaction Submission
4
+ *
5
+ * Submits signed Soroban transactions and polls for confirmation.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.submitStellarTransaction = submitStellarTransaction;
9
+ const stellar_sdk_1 = require("@stellar/stellar-sdk");
10
+ const core_1 = require("../../core");
11
+ const soroban_1 = require("./soroban");
12
+ const constants_1 = require("./constants");
13
+ /**
14
+ * Best-effort decode of the transaction-level result code (the XDR union
15
+ * discriminant, e.g. `"txBadSeq"`, `"txTooLate"`) from a Soroban
16
+ * `TransactionResult`. Typed `unknown` and probed structurally so it stays
17
+ * robust to RPC/SDK shape drift; returns `undefined` for anything that isn't a
18
+ * decoded union, so callers fall back to the stringified XDR in the message.
19
+ */
20
+ function extractTxResultCode(result) {
21
+ try {
22
+ const decoded = result;
23
+ if (typeof decoded?.result !== 'function')
24
+ return undefined;
25
+ // `|| undefined`: an empty discriminant shares the clean "no code" path.
26
+ return decoded.result().switch().name || undefined;
27
+ }
28
+ catch (e) {
29
+ // Only reached on a malformed / shape-drifted union (the non-union case
30
+ // already returned above). Breadcrumb it so decoder rot stays detectable;
31
+ // the caller still throws with the stringified XDR in the message.
32
+ core_1.Logger.log.warn('extractTxResultCode', { decodeError: String(e) });
33
+ return undefined;
34
+ }
35
+ }
36
+ /**
37
+ * `JSON.stringify` that never throws. A real `xdr.TransactionResult` can hold
38
+ * `bigint` fields (e.g. `feeCharged`), which make `JSON.stringify` throw a
39
+ * `TypeError` — that would escape and replace the `AugustSDKError` this detail
40
+ * is only meant to enrich. Returns `''` on failure so the caller falls back to
41
+ * the status; the decoded `resultCode` still carries the precise reason.
42
+ */
43
+ function safeStringify(value) {
44
+ try {
45
+ return JSON.stringify(value) ?? '';
46
+ }
47
+ catch {
48
+ return '';
49
+ }
50
+ }
51
+ /**
52
+ * Submit a signed Soroban transaction and poll until confirmed.
53
+ *
54
+ * @param signedXdr - Base64-encoded XDR of the signed transaction
55
+ * @param network - Stellar network name
56
+ * @param sorobanRpcUrl - Optional override Soroban RPC endpoint (e.g. a keyed
57
+ * Alchemy URL); becomes the primary with the SDK's public endpoints kept as
58
+ * failover. Omit to use the public endpoints.
59
+ * @returns The transaction hash once the network confirms it as successful
60
+ * @throws {@link AugustTimeoutError} when the transaction is not confirmed
61
+ * within the poll budget (`MAX_POLL_ATTEMPTS`).
62
+ * @throws {@link AugustSDKError} when the RPC rejects the submission or the
63
+ * transaction confirms as failed. Its `context` carries `{ network, status }`
64
+ * plus, when the result XDR decodes, a `resultCode` string holding the
65
+ * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode`
66
+ * is `undefined` when the code cannot be decoded.
67
+ * @example
68
+ * ```ts
69
+ * try {
70
+ * const hash = await submitStellarTransaction(signedXdr, 'mainnet');
71
+ * } catch (err) {
72
+ * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
73
+ * // stale sequence number — rebuild the transaction and resubmit
74
+ * }
75
+ * }
76
+ * ```
77
+ */
78
+ async function submitStellarTransaction(signedXdr, network, sorobanRpcUrl) {
79
+ const config = (0, soroban_1.resolveNetworkConfig)(network, sorobanRpcUrl);
80
+ const { passphrase } = config;
81
+ const server = await (0, soroban_1.getHealthyServer)(config);
82
+ const tx = stellar_sdk_1.TransactionBuilder.fromXDR(signedXdr, passphrase);
83
+ const sendResult = await server.sendTransaction(tx);
84
+ if (sendResult.status === 'ERROR') {
85
+ const errorResult = 'errorResult' in sendResult ? sendResult.errorResult : undefined;
86
+ const resultCode = extractTxResultCode(errorResult);
87
+ const detail = errorResult ? safeStringify(errorResult) : '';
88
+ const msg = `Transaction submission failed: ${detail || sendResult.status}`;
89
+ core_1.Logger.log.error('submitStellarTransaction', msg, { network, resultCode });
90
+ throw new core_1.AugustSDKError('UNKNOWN', msg, {
91
+ context: { network, status: sendResult.status, resultCode },
92
+ });
93
+ }
94
+ // Only PENDING (and DUPLICATE) mean the tx was accepted by the RPC.
95
+ // DUPLICATE means this exact transaction was already submitted — it may
96
+ // already be confirmed or still pending from a prior submission.
97
+ // TRY_AGAIN_LATER and any other status should be surfaced immediately
98
+ // so callers can retry submission instead of waiting for a poll timeout.
99
+ if (sendResult.status !== 'PENDING' && sendResult.status !== 'DUPLICATE') {
100
+ const msg = `Transaction not accepted by RPC (status: ${sendResult.status}). ` +
101
+ 'This may be retryable — the RPC node could be overloaded.';
102
+ core_1.Logger.log.error('submitStellarTransaction', msg, { network });
103
+ throw new core_1.AugustSDKError('UNKNOWN', msg, {
104
+ context: { network, status: sendResult.status },
105
+ });
106
+ }
107
+ // Geometric backoff (start POLL_INTERVAL_MS, ×POLL_INTERVAL_BACKOFF up to
108
+ // POLL_INTERVAL_MAX_MS) — fast on the happy path, gentler on slow ledgers.
109
+ let getResult = await server.getTransaction(sendResult.hash);
110
+ let polls = 0;
111
+ let nextDelay = constants_1.POLL_INTERVAL_MS;
112
+ while (getResult.status === 'NOT_FOUND') {
113
+ if (++polls >= constants_1.MAX_POLL_ATTEMPTS) {
114
+ const msg = `Transaction ${sendResult.hash} not confirmed after ${constants_1.MAX_POLL_ATTEMPTS} poll attempts`;
115
+ core_1.Logger.log.error('submitStellarTransaction', msg, {
116
+ hash: sendResult.hash,
117
+ network,
118
+ });
119
+ throw new core_1.AugustTimeoutError(msg, constants_1.POLL_INTERVAL_MAX_MS * polls, {
120
+ context: { hash: sendResult.hash, network },
121
+ });
122
+ }
123
+ await new Promise((r) => setTimeout(r, nextDelay));
124
+ nextDelay = Math.min(Math.round(nextDelay * constants_1.POLL_INTERVAL_BACKOFF), constants_1.POLL_INTERVAL_MAX_MS);
125
+ getResult = await server.getTransaction(sendResult.hash);
126
+ }
127
+ if (getResult.status === 'SUCCESS') {
128
+ return sendResult.hash;
129
+ }
130
+ const resultXdr = 'resultXdr' in getResult ? getResult.resultXdr : undefined;
131
+ const resultCode = extractTxResultCode(resultXdr);
132
+ const detail = resultXdr ? safeStringify(resultXdr) : '';
133
+ const failDetail = detail ? ` (${detail})` : '';
134
+ const msg = `Transaction failed: ${getResult.status}${failDetail}`;
135
+ core_1.Logger.log.error('submitStellarTransaction', msg, {
136
+ hash: sendResult.hash,
137
+ network,
138
+ resultCode,
139
+ });
140
+ throw new core_1.AugustSDKError('UNKNOWN', msg, {
141
+ context: {
142
+ hash: sendResult.hash,
143
+ network,
144
+ status: getResult.status,
145
+ resultCode,
146
+ },
147
+ });
148
+ }
149
+ //# sourceMappingURL=submit.js.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Stellar Vault Types
3
+ */
4
+ import type { IStellarNetwork } from '../../types/web3';
5
+ export type { IStellarNetwork };
6
+ /** Parameters for building an unsigned Stellar vault deposit transaction. */
7
+ export interface IStellarDepositParams {
8
+ contractId: string;
9
+ amount: string;
10
+ senderAddress: string;
11
+ network: IStellarNetwork;
12
+ /**
13
+ * Optional override Soroban RPC endpoint (e.g. a keyed Alchemy URL). When set
14
+ * it is the primary, with the SDK's public endpoints kept behind it as
15
+ * failover.
16
+ */
17
+ sorobanRpcUrl?: string;
18
+ }
19
+ /** Parameters for building an unsigned Stellar vault redeem transaction. */
20
+ export interface IStellarRedeemParams {
21
+ contractId: string;
22
+ shares: string;
23
+ receiverAddress: string;
24
+ network: IStellarNetwork;
25
+ /**
26
+ * Optional override Soroban RPC endpoint (e.g. a keyed Alchemy URL). When set
27
+ * it is the primary, with the SDK's public endpoints kept behind it as
28
+ * failover.
29
+ */
30
+ sorobanRpcUrl?: string;
31
+ }
32
+ /**
33
+ * User vault position returned by on-chain balance queries.
34
+ *
35
+ * `decimals` carries the share-token scale used to interpret `shares`. When the
36
+ * on-chain `decimals()` read fails, it falls back to STELLAR_FALLBACK_DECIMALS
37
+ * (7) and `decimalsFromFallback` is set to `true`. Callers that size a redeem
38
+ * from this position MUST check `decimalsFromFallback` and refuse to settle
39
+ * when it is `true` — trusting a fabricated 7 against an ERC4626 offset vault
40
+ * (share decimals = asset + offset) under-redeems by `10^offset`. See
41
+ * AUGUST-6381.
42
+ */
43
+ export interface IStellarUserPosition {
44
+ /** Raw share balance in smallest unit, as a non-negative integer string */
45
+ shares: string;
46
+ /** Share-token decimals; may be the fallback — see `decimalsFromFallback`. */
47
+ decimals: number;
48
+ /**
49
+ * `true` when `decimals` is the fallback (the on-chain `decimals()` read
50
+ * failed), `false` when it is the authoritative on-chain value. Treat `true`
51
+ * as a decimals read failure: do not trust `decimals` to scale or redeem.
52
+ *
53
+ * Optional for source back-compat (a consumer's existing object literal still
54
+ * compiles), but `getStellarUserPosition` always populates it — so a position
55
+ * obtained from the SDK never omits it.
56
+ */
57
+ decimalsFromFallback?: boolean;
58
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Stellar Vault Types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Stellar Utilities
3
+ */
4
+ import type { IStellarNetwork } from './types';
5
+ import { isStellarAddress } from '../../core/helpers/chain-address';
6
+ export { isStellarAddress };
7
+ /**
8
+ * Get the Stellar explorer URL for a given address or transaction.
9
+ */
10
+ export declare function getExplorerLink({ id, type, network, }: {
11
+ id: string;
12
+ type?: 'contract' | 'account' | 'tx';
13
+ network?: IStellarNetwork;
14
+ }): string;
15
+ /**
16
+ * Throw if the given address is a Stellar address.
17
+ * Used as a guard in vault operations that don't yet support Stellar.
18
+ */
19
+ export declare function assertNotStellar(address: string, operation: string): void;
20
+ export declare const StellarUtils: {
21
+ isStellarAddress: typeof isStellarAddress;
22
+ getExplorerLink: typeof getExplorerLink;
23
+ assertNotStellar: typeof assertNotStellar;
24
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Stellar Utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.StellarUtils = exports.isStellarAddress = void 0;
7
+ exports.getExplorerLink = getExplorerLink;
8
+ exports.assertNotStellar = assertNotStellar;
9
+ const core_1 = require("../../core");
10
+ const chain_address_1 = require("../../core/helpers/chain-address");
11
+ Object.defineProperty(exports, "isStellarAddress", { enumerable: true, get: function () { return chain_address_1.isStellarAddress; } });
12
+ /**
13
+ * Get the Stellar explorer URL for a given address or transaction.
14
+ */
15
+ function getExplorerLink({ id, type = 'contract', network = 'mainnet', }) {
16
+ const baseUrl = 'https://stellar.expert/explorer';
17
+ const net = network === 'mainnet' ? 'public' : 'testnet';
18
+ return `${baseUrl}/${net}/${type}/${id}`;
19
+ }
20
+ /**
21
+ * Throw if the given address is a Stellar address.
22
+ * Used as a guard in vault operations that don't yet support Stellar.
23
+ */
24
+ function assertNotStellar(address, operation) {
25
+ if ((0, chain_address_1.isStellarAddress)(address)) {
26
+ throw new core_1.AugustValidationError('INVALID_CHAIN', `${operation} is not yet supported for Stellar vaults: ${address}`);
27
+ }
28
+ }
29
+ exports.StellarUtils = {
30
+ isStellarAddress: chain_address_1.isStellarAddress,
31
+ getExplorerLink,
32
+ assertNotStellar,
33
+ };
34
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,14 @@
1
+ export { SUI_CHAIN_ID } from '../../core/constants/web3';
2
+ export declare const EMBER_API_BASE_URL = "https://vaults.api.sui-prod.bluefin.io/api/v1/vaults";
3
+ export declare const EMBER_ENDPOINTS: {
4
+ readonly VAULTS: "/";
5
+ readonly TVL: "/tvl-history";
6
+ };
7
+ export declare const EMBER_DEFAULTS: {
8
+ readonly DECIMALS: 18;
9
+ readonly USD_DECIMALS: 6;
10
+ readonly E9_DIVISOR: 1000000000;
11
+ readonly BPS_TO_PERCENT: 100;
12
+ readonly VERSION: "sui-0";
13
+ };
14
+ export declare const ALLOWED_SUI_VAULT_ADDRESSES: string[];
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALLOWED_SUI_VAULT_ADDRESSES = exports.EMBER_DEFAULTS = exports.EMBER_ENDPOINTS = exports.EMBER_API_BASE_URL = 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 (and the published API)
7
+ // unchanged.
8
+ var web3_1 = require("../../core/constants/web3");
9
+ Object.defineProperty(exports, "SUI_CHAIN_ID", { enumerable: true, get: function () { return web3_1.SUI_CHAIN_ID; } });
10
+ exports.EMBER_API_BASE_URL = 'https://vaults.api.sui-prod.bluefin.io/api/v1/vaults';
11
+ exports.EMBER_ENDPOINTS = {
12
+ VAULTS: '/',
13
+ TVL: '/tvl-history',
14
+ };
15
+ exports.EMBER_DEFAULTS = {
16
+ DECIMALS: 18,
17
+ USD_DECIMALS: 6,
18
+ E9_DIVISOR: 1e9,
19
+ BPS_TO_PERCENT: 100,
20
+ VERSION: 'sui-0',
21
+ };
22
+ exports.ALLOWED_SUI_VAULT_ADDRESSES = [
23
+ '0x94c2826b24e44f710c5f80e3ed7ce898258d7008e3a643c894d90d276924d4b9',
24
+ '0xfaf4d0ec9b76147c926c0c8b2aba39ea21ec991500c1e3e53b60d447b0e5f655',
25
+ '0x323578c2b24683ca845c68c1e2097697d65e235826a9dc931abce3b4b1e43642',
26
+ '0x1fdbd27ba90a7a5385185e3e0b76477202f2cadb0e4343163288c5625e7c5505',
27
+ '0x30844745c8197fdaf9fe06c4ffeb73fe05c092ce0040674a3758dbfcb032a1f4',
28
+ ].map((addr) => addr.toLowerCase());
29
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,9 @@
1
+ import type { IEmberVault, IFetchEmberVaultsOptions } from './types';
2
+ /**
3
+ * Fetch Ember vaults from API
4
+ */
5
+ export declare function getEmberVaults(options?: IFetchEmberVaultsOptions): Promise<IEmberVault[]>;
6
+ /**
7
+ * Fetch Ember TVL data
8
+ */
9
+ export declare function getEmberTVL(limit?: number): Promise<number>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEmberVaults = getEmberVaults;
4
+ exports.getEmberTVL = getEmberTVL;
5
+ const constants_1 = require("./constants");
6
+ const core_1 = require("../../core");
7
+ const logger_1 = require("../../core/logger");
8
+ /**
9
+ * Fetch Ember vaults from API
10
+ */
11
+ async function getEmberVaults(options) {
12
+ try {
13
+ const params = new URLSearchParams();
14
+ if (options?.limit)
15
+ params.append('limit', options.limit.toString());
16
+ if (options?.offset)
17
+ params.append('offset', options.offset.toString());
18
+ if (options?.status)
19
+ params.append('status', options.status);
20
+ const queryString = params.toString();
21
+ const url = `${constants_1.EMBER_API_BASE_URL}${queryString ? `?${queryString}` : ''}`;
22
+ const response = await fetch(url, core_1.DEFAULT_FETCH_OPTIONS);
23
+ if (!response.ok) {
24
+ throw new Error(`HTTP error! status: ${response.status}`);
25
+ }
26
+ const data = await response.json();
27
+ return Array.isArray(data) ? data : [];
28
+ }
29
+ catch (error) {
30
+ logger_1.Logger.log.error('getEmberVaults', error);
31
+ return [];
32
+ }
33
+ }
34
+ /**
35
+ * Fetch Ember TVL data
36
+ */
37
+ async function getEmberTVL(limit = 1) {
38
+ try {
39
+ const params = new URLSearchParams();
40
+ if (limit)
41
+ params.append('limit', limit.toString());
42
+ const queryString = params.toString();
43
+ const url = `${constants_1.EMBER_API_BASE_URL}${constants_1.EMBER_ENDPOINTS.TVL}${queryString ? `?${queryString}` : ''}`;
44
+ const response = await fetch(url, core_1.DEFAULT_FETCH_OPTIONS);
45
+ if (!response.ok) {
46
+ throw new Error(`HTTP error! status: ${response.status}`);
47
+ }
48
+ const result = await response.json();
49
+ if (Array.isArray(result) && result.length > 0) {
50
+ const latestEntry = result[0];
51
+ return Number(latestEntry.tvlE9) / constants_1.EMBER_DEFAULTS.E9_DIVISOR;
52
+ }
53
+ return 0;
54
+ }
55
+ catch (error) {
56
+ logger_1.Logger.log.error('getEmberTVL', error);
57
+ return 0;
58
+ }
59
+ }
60
+ //# sourceMappingURL=getters.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Sui Adapter for August SDK
3
+ *
4
+ * @module SuiAdapter
5
+ */
6
+ import * as SuiConstants from './constants';
7
+ import * as SuiGetters from './getters';
8
+ import * as SuiUtils from './utils';
9
+ import { transformEmberVaultToIVault, transformEmberVaultsToIVaults } from './transformer';
10
+ import type { IEmberVault, IFetchEmberVaultsOptions } from './types';
11
+ export declare const Sui: {
12
+ utils: typeof SuiUtils;
13
+ constants: typeof SuiConstants;
14
+ getters: typeof SuiGetters;
15
+ transformer: {
16
+ transformEmberVaultToIVault: typeof transformEmberVaultToIVault;
17
+ transformEmberVaultsToIVaults: typeof transformEmberVaultsToIVaults;
18
+ };
19
+ };
20
+ /**
21
+ * Sui Adapter for August SDK
22
+ *
23
+ * @example
24
+ * To access the Sui adapter instance
25
+ * ```
26
+ * const sdk = new AugustSDK()
27
+ * sdk.sui.getEmberVaults()
28
+ * ```
29
+ */
30
+ declare class SuiAdapter {
31
+ private _apiBaseUrl;
32
+ private _chainId;
33
+ constructor(apiBaseUrl?: string, chainId?: number);
34
+ get apiBaseUrl(): string;
35
+ get chainId(): number;
36
+ getEmberVaults(options?: IFetchEmberVaultsOptions): Promise<IEmberVault[]>;
37
+ getEmberTVL(limit?: number): Promise<number>;
38
+ convertFromE9(value: string | number): number;
39
+ calculateUtilization(current: string | number, maximum: string | number): number;
40
+ isSuiAddress(address: string): boolean;
41
+ isSuiVault(chainId: number): boolean;
42
+ transformEmberVaultToIVault(emberVault: IEmberVault): import("../..").IVault;
43
+ transformEmberVaultsToIVaults(emberVaults: IEmberVault[]): import("../..").IVault[];
44
+ }
45
+ export default SuiAdapter;
@@ -0,0 +1,101 @@
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
+ /**
38
+ * Sui Adapter for August SDK
39
+ *
40
+ * @module SuiAdapter
41
+ */
42
+ const SuiConstants = __importStar(require("./constants"));
43
+ const SuiGetters = __importStar(require("./getters"));
44
+ const SuiUtils = __importStar(require("./utils"));
45
+ const transformer_1 = require("./transformer");
46
+ exports.Sui = {
47
+ utils: SuiUtils,
48
+ constants: SuiConstants,
49
+ getters: SuiGetters,
50
+ transformer: { transformEmberVaultToIVault: transformer_1.transformEmberVaultToIVault, transformEmberVaultsToIVaults: transformer_1.transformEmberVaultsToIVaults },
51
+ };
52
+ /**
53
+ * Sui Adapter for August SDK
54
+ *
55
+ * @example
56
+ * To access the Sui adapter instance
57
+ * ```
58
+ * const sdk = new AugustSDK()
59
+ * sdk.sui.getEmberVaults()
60
+ * ```
61
+ */
62
+ class SuiAdapter {
63
+ _apiBaseUrl;
64
+ _chainId;
65
+ constructor(apiBaseUrl = SuiConstants.EMBER_API_BASE_URL, chainId = SuiConstants.SUI_CHAIN_ID) {
66
+ this._apiBaseUrl = apiBaseUrl;
67
+ this._chainId = chainId;
68
+ }
69
+ get apiBaseUrl() {
70
+ return this._apiBaseUrl;
71
+ }
72
+ get chainId() {
73
+ return this._chainId;
74
+ }
75
+ async getEmberVaults(options) {
76
+ return await SuiGetters.getEmberVaults(options);
77
+ }
78
+ async getEmberTVL(limit = 1) {
79
+ return await SuiGetters.getEmberTVL(limit);
80
+ }
81
+ convertFromE9(value) {
82
+ return SuiUtils.convertFromE9(value);
83
+ }
84
+ calculateUtilization(current, maximum) {
85
+ return SuiUtils.calculateUtilization(current, maximum);
86
+ }
87
+ isSuiAddress(address) {
88
+ return SuiUtils.isSuiAddress(address);
89
+ }
90
+ isSuiVault(chainId) {
91
+ return SuiUtils.isSuiVault(chainId);
92
+ }
93
+ transformEmberVaultToIVault(emberVault) {
94
+ return (0, transformer_1.transformEmberVaultToIVault)(emberVault);
95
+ }
96
+ transformEmberVaultsToIVaults(emberVaults) {
97
+ return (0, transformer_1.transformEmberVaultsToIVaults)(emberVaults);
98
+ }
99
+ }
100
+ exports.default = SuiAdapter;
101
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import type { IVault } from '../../types';
2
+ import type { IEmberVault } from './types';
3
+ /**
4
+ * Transform Ember vault to IVault format
5
+ */
6
+ export declare function transformEmberVaultToIVault(emberVault: IEmberVault): IVault;
7
+ /**
8
+ * Transform multiple Ember vaults
9
+ */
10
+ export declare function transformEmberVaultsToIVaults(emberVaults: IEmberVault[]): IVault[];
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformEmberVaultToIVault = transformEmberVaultToIVault;
4
+ exports.transformEmberVaultsToIVaults = transformEmberVaultsToIVaults;
5
+ const core_1 = require("../../core");
6
+ const constants_1 = require("./constants");
7
+ const utils_1 = require("./utils");
8
+ /**
9
+ * Transform Ember vault to IVault format
10
+ */
11
+ function transformEmberVaultToIVault(emberVault) {
12
+ const depositTokenDecimals = emberVault.depositCoin?.decimals || constants_1.EMBER_DEFAULTS.DECIMALS;
13
+ const receiptTokenDecimals = emberVault.receiptCoin?.decimals || constants_1.EMBER_DEFAULTS.DECIMALS;
14
+ const returnObj = {
15
+ chainId: constants_1.SUI_CHAIN_ID,
16
+ maxDailyDrawdown: 0,
17
+ risk: 'medium',
18
+ lagDuration: 0,
19
+ address: emberVault.address,
20
+ name: emberVault.name,
21
+ logoUrl: emberVault.logoUrl || '',
22
+ apy: {
23
+ apy: (0, utils_1.convertFromE9)(emberVault.reportedApy?.reportedApyE9 || 0) * 100,
24
+ pointsApy: null,
25
+ campaignApy: null,
26
+ explainer: '',
27
+ liquidApy: 0,
28
+ rewardsClaimable: 0,
29
+ rewardsCompounded: 0,
30
+ underlyingApy: (0, utils_1.convertFromE9)(emberVault.reportedApy?.reportedApyE9 || 0) * 100,
31
+ },
32
+ historical_apy: {
33
+ 7: (0, utils_1.convertFromE9)(emberVault.reportedApy?.reportedApyE9 || 0),
34
+ },
35
+ strategists: (emberVault.managers ||
36
+ emberVault.subAccounts?.map((s) => s.manager) ||
37
+ []).map((manager) => ({
38
+ address: manager?.id || '',
39
+ logo: manager?.logoUrl || '',
40
+ name: manager?.name?.toLowerCase() === 'gamma'
41
+ ? 'Gamma Research'
42
+ : manager?.name || 'Unknown',
43
+ type: 'subaccount',
44
+ website_url: null,
45
+ })),
46
+ fees: {
47
+ performance: (0, utils_1.convertFromE9)(emberVault.weeklyPerformanceFeeBpsE9 || 0) /
48
+ constants_1.EMBER_DEFAULTS.BPS_TO_PERCENT,
49
+ management: (0, utils_1.convertFromE9)(emberVault.managementFeePercentE9 || 0) * 100,
50
+ isManagementWaived: false,
51
+ managementFeeWaivedUntilDate: null,
52
+ managementFeeWaivedUntilTvl: null,
53
+ isPerformanceWaived: false,
54
+ performanceFeeWaivedUntilDate: null,
55
+ performanceFeeWaivedUntilTvl: null,
56
+ },
57
+ rewards: {
58
+ points: '0',
59
+ multiplier: 0,
60
+ multipliers: [],
61
+ additionalPoints: [],
62
+ additionalPointsDetailed: [],
63
+ },
64
+ version: constants_1.EMBER_DEFAULTS.VERSION,
65
+ description: emberVault.description || '',
66
+ startDatetime: new Date(emberVault.createdAt || Date.now()).toISOString(),
67
+ status: emberVault.status === 'deprecated' ? 'closed' : 'active',
68
+ tags: ['Sui DeFi', emberVault.publicType].filter(Boolean),
69
+ isFeatured: false,
70
+ isSpotlighted: false,
71
+ withdrawalOnly: undefined,
72
+ isVisible: emberVault.status === 'active' || emberVault.status === 'beta',
73
+ reserveTarget: 0,
74
+ reserveTolerance: 0,
75
+ isDepositPaused: emberVault.status === 'deprecated',
76
+ decimals: receiptTokenDecimals,
77
+ isWithdrawalPaused: emberVault.status === 'deprecated',
78
+ operator: '',
79
+ idleAssets: (0, core_1.toNormalizedBn)(0, receiptTokenDecimals),
80
+ depositAssets: [
81
+ {
82
+ address: emberVault.depositCoin?.address,
83
+ symbol: emberVault.depositCoin?.symbol || '',
84
+ decimals: depositTokenDecimals,
85
+ },
86
+ ],
87
+ totalAssets: (0, core_1.toNormalizedBn)(BigInt(emberVault.totalDeposits || '0'), depositTokenDecimals),
88
+ totalSupply: (0, core_1.toNormalizedBn)(BigInt(emberVault.totalDeposits || '0'), receiptTokenDecimals),
89
+ maxSupply: (0, core_1.toNormalizedBn)(BigInt(emberVault.maxDepositsAllowed || '0'), depositTokenDecimals),
90
+ receipt: {
91
+ symbol: emberVault.receiptCoin?.symbol || '',
92
+ address: emberVault.receiptCoin?.address,
93
+ decimals: receiptTokenDecimals,
94
+ },
95
+ composabilityIntegrations: [],
96
+ eoa_operators: [],
97
+ operators: [],
98
+ };
99
+ return returnObj;
100
+ }
101
+ /**
102
+ * Transform multiple Ember vaults
103
+ */
104
+ function transformEmberVaultsToIVaults(emberVaults) {
105
+ return emberVaults.map(transformEmberVaultToIVault);
106
+ }
107
+ //# sourceMappingURL=transformer.js.map