@augustdigital/sdk 8.3.2 → 8.5.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 (204) hide show
  1. package/lib/abis/ERC20_Bytes32.d.ts +4 -0
  2. package/lib/abis/ERC20_Bytes32.js +4 -0
  3. package/lib/abis/ERC4626.d.ts +1 -0
  4. package/lib/abis/ERC4626.js +1 -0
  5. package/lib/abis/ERC721.d.ts +1 -0
  6. package/lib/abis/ERC721.js +1 -0
  7. package/lib/abis/FeeOracle.js +1 -0
  8. package/lib/abis/LendingPool.js +1 -0
  9. package/lib/abis/LendingPoolV2.js +1 -0
  10. package/lib/abis/Multicall3.js +3 -0
  11. package/lib/abis/OFT.d.ts +20 -0
  12. package/lib/abis/OFT.js +20 -0
  13. package/lib/abis/SmartAccount.d.ts +1 -0
  14. package/lib/abis/SmartAccount.js +3 -0
  15. package/lib/abis/SwapRouter.d.ts +1 -0
  16. package/lib/abis/SwapRouter.js +1 -0
  17. package/lib/abis/UniversalSignatureValidator.js +3 -0
  18. package/lib/abis/index.d.ts +5 -0
  19. package/lib/abis/index.js +5 -0
  20. package/lib/adapters/evm/getters.d.ts +17 -2
  21. package/lib/adapters/evm/getters.js +35 -3
  22. package/lib/adapters/evm/index.d.ts +262 -0
  23. package/lib/adapters/evm/index.js +268 -1
  24. package/lib/adapters/evm/utils.d.ts +6 -0
  25. package/lib/adapters/evm/utils.js +7 -0
  26. package/lib/adapters/solana/constants.js +4 -1
  27. package/lib/adapters/solana/getters.d.ts +8 -0
  28. package/lib/adapters/solana/getters.js +21 -0
  29. package/lib/adapters/solana/idl/vault-idl.js +9 -0
  30. package/lib/adapters/solana/index.d.ts +55 -0
  31. package/lib/adapters/solana/index.js +57 -0
  32. package/lib/adapters/solana/utils.d.ts +28 -0
  33. package/lib/adapters/solana/utils.js +79 -4
  34. package/lib/adapters/solana/vault.actions.d.ts +19 -0
  35. package/lib/adapters/solana/vault.actions.js +47 -3
  36. package/lib/adapters/stellar/actions.d.ts +25 -0
  37. package/lib/adapters/stellar/actions.js +33 -0
  38. package/lib/adapters/stellar/constants.d.ts +26 -0
  39. package/lib/adapters/stellar/constants.js +29 -0
  40. package/lib/adapters/stellar/getters.d.ts +56 -0
  41. package/lib/adapters/stellar/getters.js +81 -0
  42. package/lib/adapters/stellar/index.d.ts +48 -0
  43. package/lib/adapters/stellar/index.js +48 -0
  44. package/lib/adapters/stellar/soroban.d.ts +20 -0
  45. package/lib/adapters/stellar/soroban.js +46 -0
  46. package/lib/adapters/stellar/submit.d.ts +12 -0
  47. package/lib/adapters/stellar/submit.js +19 -0
  48. package/lib/adapters/stellar/types.d.ts +27 -0
  49. package/lib/adapters/stellar/types.js +3 -0
  50. package/lib/adapters/stellar/utils.d.ts +10 -0
  51. package/lib/adapters/stellar/utils.js +10 -0
  52. package/lib/adapters/sui/getters.d.ts +6 -0
  53. package/lib/adapters/sui/getters.js +6 -0
  54. package/lib/adapters/sui/index.d.ts +15 -0
  55. package/lib/adapters/sui/index.js +15 -0
  56. package/lib/adapters/sui/transformer.d.ts +6 -0
  57. package/lib/adapters/sui/transformer.js +6 -0
  58. package/lib/adapters/sui/utils.d.ts +6 -0
  59. package/lib/adapters/sui/utils.js +6 -0
  60. package/lib/core/analytics/chain-name.d.ts +8 -0
  61. package/lib/core/analytics/chain-name.js +8 -0
  62. package/lib/core/analytics/constants.d.ts +4 -0
  63. package/lib/core/analytics/constants.js +4 -0
  64. package/lib/core/analytics/env.d.ts +25 -0
  65. package/lib/core/analytics/env.js +26 -0
  66. package/lib/core/analytics/index.d.ts +26 -0
  67. package/lib/core/analytics/index.js +35 -0
  68. package/lib/core/analytics/instrumentation.d.ts +26 -0
  69. package/lib/core/analytics/instrumentation.js +66 -2
  70. package/lib/core/analytics/method-taxonomy.d.ts +16 -0
  71. package/lib/core/analytics/method-taxonomy.js +18 -0
  72. package/lib/core/analytics/metrics.d.ts +23 -0
  73. package/lib/core/analytics/metrics.js +40 -0
  74. package/lib/core/analytics/sanitize.d.ts +38 -0
  75. package/lib/core/analytics/sanitize.js +46 -0
  76. package/lib/core/analytics/sentry-runtime.d.ts +11 -0
  77. package/lib/core/analytics/sentry-runtime.js +19 -0
  78. package/lib/core/analytics/sentry.d.ts +45 -0
  79. package/lib/core/analytics/sentry.js +115 -2
  80. package/lib/core/analytics/types.d.ts +27 -0
  81. package/lib/core/analytics/user-identity.d.ts +34 -0
  82. package/lib/core/analytics/user-identity.js +42 -0
  83. package/lib/core/analytics/version.d.ts +6 -1
  84. package/lib/core/analytics/version.js +6 -1
  85. package/lib/core/auth/verify.js +5 -0
  86. package/lib/core/base.class.d.ts +75 -0
  87. package/lib/core/base.class.js +56 -0
  88. package/lib/core/cache.d.ts +5 -0
  89. package/lib/core/cache.js +6 -0
  90. package/lib/core/constants/adapters.d.ts +15 -0
  91. package/lib/core/constants/adapters.js +28 -8
  92. package/lib/core/constants/core.d.ts +12 -1
  93. package/lib/core/constants/core.js +12 -0
  94. package/lib/core/constants/swap-router.d.ts +46 -0
  95. package/lib/core/constants/swap-router.js +50 -0
  96. package/lib/core/constants/vaults.d.ts +56 -0
  97. package/lib/core/constants/vaults.js +66 -1
  98. package/lib/core/constants/web3.d.ts +3 -0
  99. package/lib/core/constants/web3.js +18 -5
  100. package/lib/core/errors/index.d.ts +36 -0
  101. package/lib/core/errors/index.js +29 -0
  102. package/lib/core/fetcher.d.ts +134 -0
  103. package/lib/core/fetcher.js +191 -5
  104. package/lib/core/helpers/adapters.d.ts +9 -0
  105. package/lib/core/helpers/adapters.js +11 -0
  106. package/lib/core/helpers/chain-address.d.ts +10 -0
  107. package/lib/core/helpers/chain-address.js +11 -0
  108. package/lib/core/helpers/core.d.ts +42 -0
  109. package/lib/core/helpers/core.js +66 -1
  110. package/lib/core/helpers/explorer-link.d.ts +14 -0
  111. package/lib/core/helpers/explorer-link.js +14 -0
  112. package/lib/core/helpers/signer.d.ts +26 -0
  113. package/lib/core/helpers/signer.js +39 -0
  114. package/lib/core/helpers/swap-router.d.ts +32 -0
  115. package/lib/core/helpers/swap-router.js +32 -0
  116. package/lib/core/helpers/vault-version.d.ts +1 -0
  117. package/lib/core/helpers/vault-version.js +2 -0
  118. package/lib/core/helpers/vaults.d.ts +8 -0
  119. package/lib/core/helpers/vaults.js +22 -8
  120. package/lib/core/helpers/web3.d.ts +152 -0
  121. package/lib/core/helpers/web3.js +183 -6
  122. package/lib/core/logger/index.d.ts +55 -0
  123. package/lib/core/logger/index.js +19 -0
  124. package/lib/core/logger/slack.d.ts +3 -0
  125. package/lib/core/logger/slack.js +3 -0
  126. package/lib/core/vault-metadata.d.ts +6 -0
  127. package/lib/core/vault-metadata.js +6 -0
  128. package/lib/core/version-check.d.ts +52 -0
  129. package/lib/core/version-check.js +81 -0
  130. package/lib/evm/methods/crossChainVault.d.ts +90 -0
  131. package/lib/evm/methods/crossChainVault.js +186 -1
  132. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  133. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  134. package/lib/evm/methods/index.d.ts +1 -0
  135. package/lib/evm/methods/index.js +1 -0
  136. package/lib/evm/types/crossChain.d.ts +202 -0
  137. package/lib/evm/types/crossChain.js +11 -0
  138. package/lib/index.d.ts +16 -0
  139. package/lib/index.js +19 -0
  140. package/lib/main.d.ts +288 -5
  141. package/lib/main.js +305 -0
  142. package/lib/modules/api/index.d.ts +1 -0
  143. package/lib/modules/api/index.js +6 -0
  144. package/lib/modules/api/main.d.ts +52 -0
  145. package/lib/modules/api/main.js +130 -0
  146. package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
  147. package/lib/modules/sub-accounts/fetcher.js +15 -0
  148. package/lib/modules/sub-accounts/main.d.ts +33 -0
  149. package/lib/modules/sub-accounts/main.js +38 -0
  150. package/lib/modules/sub-accounts/utils.d.ts +3 -0
  151. package/lib/modules/sub-accounts/utils.js +3 -0
  152. package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
  153. package/lib/modules/vaults/adapter.helpers.js +34 -0
  154. package/lib/modules/vaults/fetcher.d.ts +20 -0
  155. package/lib/modules/vaults/fetcher.js +40 -3
  156. package/lib/modules/vaults/getters.d.ts +295 -0
  157. package/lib/modules/vaults/getters.js +552 -12
  158. package/lib/modules/vaults/index.d.ts +12 -0
  159. package/lib/modules/vaults/index.js +12 -0
  160. package/lib/modules/vaults/main.d.ts +292 -4
  161. package/lib/modules/vaults/main.js +379 -7
  162. package/lib/modules/vaults/read.actions.d.ts +168 -0
  163. package/lib/modules/vaults/read.actions.js +143 -0
  164. package/lib/modules/vaults/types.d.ts +34 -0
  165. package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
  166. package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
  167. package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
  168. package/lib/modules/vaults/utils/date-utils.js +47 -1
  169. package/lib/modules/vaults/utils.d.ts +69 -0
  170. package/lib/modules/vaults/utils.js +104 -5
  171. package/lib/modules/vaults/write.actions.d.ts +363 -3
  172. package/lib/modules/vaults/write.actions.js +364 -2
  173. package/lib/polyfills.js +2 -0
  174. package/lib/sdk.d.ts +23705 -0
  175. package/lib/services/coingecko/fetcher.d.ts +13 -0
  176. package/lib/services/coingecko/fetcher.js +17 -0
  177. package/lib/services/debank/fetcher.d.ts +14 -0
  178. package/lib/services/debank/fetcher.js +12 -0
  179. package/lib/services/debank/utils.js +17 -0
  180. package/lib/services/layerzero/deposits.d.ts +11 -0
  181. package/lib/services/layerzero/deposits.js +34 -11
  182. package/lib/services/layerzero/redeems.d.ts +10 -0
  183. package/lib/services/layerzero/redeems.js +13 -0
  184. package/lib/services/layerzero/utils.d.ts +8 -0
  185. package/lib/services/layerzero/utils.js +11 -0
  186. package/lib/services/octavfi/fetcher.d.ts +7 -0
  187. package/lib/services/octavfi/fetcher.js +25 -0
  188. package/lib/services/octavfi/utils.d.ts +12 -0
  189. package/lib/services/octavfi/utils.js +44 -10
  190. package/lib/services/subgraph/fetcher.js +4 -2
  191. package/lib/services/subgraph/vaults.d.ts +12 -0
  192. package/lib/services/subgraph/vaults.js +43 -2
  193. package/lib/services/swap-quotes/index.d.ts +71 -0
  194. package/lib/services/swap-quotes/index.js +25 -0
  195. package/lib/services/swap-quotes/paraswap.d.ts +17 -0
  196. package/lib/services/swap-quotes/paraswap.js +14 -0
  197. package/lib/types/pools.d.ts +3 -0
  198. package/lib/types/typed-contract.d.ts +64 -0
  199. package/lib/types/vaults.d.ts +137 -2
  200. package/lib/types/vaults.js +10 -0
  201. package/lib/types/web3.d.ts +8 -0
  202. package/lib/types/web3.js +1 -0
  203. package/lib/types/webserver.d.ts +45 -0
  204. package/package.json +6 -5
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * Cross-Chain Vault Registry
4
+ *
5
+ * Address-keyed registry of August's LayerZero OVault deployments plus the
6
+ * resolver helpers that turn a vault address into the
7
+ * {@link ICrossChainVaultConfig} consumed by `buildCrossChainVaultTx`,
8
+ * `crossChainVaultDeposit`, and `quoteCrossChainDeposit`.
9
+ *
10
+ * This is the cross-chain analogue of the SwapRouter registry
11
+ * (`VAULTS_USING_SWAP_ROUTER` / `getSwapRouterAddress`): consumers resolve a
12
+ * full config by vault address instead of hand-assembling the per-chain
13
+ * contract maps and LayerZero EIDs. Without it, every consuming app would
14
+ * re-encode the same address book.
15
+ *
16
+ * Addresses are ported verbatim from upshift-app `src/config/ovault.ts` and
17
+ * cross-checked against the read-side `LAYERZERO_VAULTS` registry in
18
+ * `services/layerzero/deposits.ts`. Verify against the deployed contracts
19
+ * before adding or editing an entry — a wrong address silently routes funds
20
+ * to the wrong chain.
21
+ *
22
+ * Return convention (deliberate, mirrors the SwapRouter helpers): lookups that
23
+ * resolve a single optional value (`getCrossChainVaultConfig`,
24
+ * `getOVaultChains`) return `undefined` for an unregistered vault, while
25
+ * list-returning helpers (`getWithdrawDestinationChains`) return `[]` so
26
+ * callers can iterate without a null-check.
27
+ *
28
+ * @module evm/methods/crossChainVaultRegistry
29
+ */
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.CROSS_CHAIN_VAULT_CONFIGS = void 0;
32
+ exports.getCrossChainVaultConfig = getCrossChainVaultConfig;
33
+ exports.isCrossChainVault = isCrossChainVault;
34
+ exports.getOVaultChains = getOVaultChains;
35
+ exports.isHubOnlyReceipt = isHubOnlyReceipt;
36
+ exports.getWithdrawDestinationChains = getWithdrawDestinationChains;
37
+ const crossChainVault_1 = require("./crossChainVault");
38
+ // EVM chain IDs for the chains carrying OVault deployments. Plain literals
39
+ // (not `viem/chains`) keep viem an optional peer dependency — importing viem
40
+ // at module load would break SDK consumers that do not install it.
41
+ const ETHEREUM = 1;
42
+ const ARBITRUM = 42161;
43
+ const AVALANCHE = 43114;
44
+ const BASE = 8453;
45
+ const SONIC = 146;
46
+ const MONAD = 143;
47
+ const CONFIGS = [
48
+ {
49
+ vaultName: 'Upshift Core USDC',
50
+ vaultSymbol: 'coreUSDC',
51
+ hubChainId: ETHEREUM,
52
+ vaultAddress: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32',
53
+ spokeChainIds: [ARBITRUM, AVALANCHE, BASE, SONIC],
54
+ contracts: {
55
+ assetToken: {
56
+ [ETHEREUM]: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
57
+ [ARBITRUM]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
58
+ [AVALANCHE]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
59
+ [BASE]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
60
+ [SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
61
+ },
62
+ assetOFT: {
63
+ [ETHEREUM]: '0xc026395860Db2d07ee33e05fE50ed7bD583189C7',
64
+ [ARBITRUM]: '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
65
+ [AVALANCHE]: '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47',
66
+ [BASE]: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
67
+ [SONIC]: '0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9',
68
+ },
69
+ shareOFTAdapter: '0x4a21dcba38c3816c78144f33bb42d8fa17f38067',
70
+ composerSync: '0xc2637d7721791cc9cb196628d1e5e06887b1d4b9',
71
+ shareOFT: {
72
+ [ARBITRUM]: '0x50a31ff4d57841681011837c17aa201c6a34203c',
73
+ [AVALANCHE]: '0x1FA931Bf85248aD2eDf0004DD9A284698358e708',
74
+ [BASE]: '0x1fa931bf85248ad2edf0004dd9a284698358e708',
75
+ [SONIC]: '0x4bdd224fe59a3ae0b249125ad4c5b3126074c71b',
76
+ },
77
+ },
78
+ layerZeroEids: {
79
+ hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
80
+ spokes: {
81
+ [ARBITRUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ARBITRUM,
82
+ [AVALANCHE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.AVALANCHE,
83
+ [BASE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.BASE,
84
+ [SONIC]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.SONIC,
85
+ },
86
+ },
87
+ hubOnlyReceipt: true,
88
+ },
89
+ {
90
+ vaultName: 'Upshift USDC',
91
+ vaultSymbol: 'upUSDC',
92
+ hubChainId: ETHEREUM,
93
+ vaultAddress: '0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42',
94
+ spokeChainIds: [ARBITRUM, AVALANCHE, BASE, SONIC],
95
+ contracts: {
96
+ assetToken: {
97
+ [ETHEREUM]: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
98
+ [ARBITRUM]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
99
+ [AVALANCHE]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
100
+ [BASE]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
101
+ [SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
102
+ },
103
+ assetOFT: {
104
+ [ETHEREUM]: '0xc026395860Db2d07ee33e05fE50ed7bD583189C7',
105
+ [ARBITRUM]: '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
106
+ [AVALANCHE]: '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47',
107
+ [BASE]: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
108
+ [SONIC]: '0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9',
109
+ },
110
+ shareOFTAdapter: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
111
+ composerSync: '0xbe82134b95a8e9370e6759f3c8f44087cd9a52be',
112
+ shareOFT: {
113
+ [ARBITRUM]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
114
+ [AVALANCHE]: '0x81971A3C359cFE74259CfF1b46FB5f2112ddDE34',
115
+ [BASE]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
116
+ [SONIC]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
117
+ },
118
+ },
119
+ layerZeroEids: {
120
+ hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
121
+ spokes: {
122
+ [ARBITRUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ARBITRUM,
123
+ [AVALANCHE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.AVALANCHE,
124
+ [BASE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.BASE,
125
+ [SONIC]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.SONIC,
126
+ },
127
+ },
128
+ hubOnlyReceipt: true,
129
+ },
130
+ {
131
+ vaultName: 'earnAUSD',
132
+ vaultSymbol: 'earnAUSD',
133
+ hubChainId: MONAD,
134
+ vaultAddress: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA',
135
+ spokeChainIds: [ETHEREUM],
136
+ contracts: {
137
+ assetToken: {
138
+ [MONAD]: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
139
+ [ETHEREUM]: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
140
+ },
141
+ assetOFT: {
142
+ [MONAD]: '0x9CaB7Ede13dc56652E44D2404E969C212f22689b',
143
+ [ETHEREUM]: '0x9CaB7Ede13dc56652E44D2404E969C212f22689b',
144
+ },
145
+ shareOFTAdapter: '0x9549Fa3DF579Cca9F3e328695382675F7f1f0F34',
146
+ composerSync: '0xd1B1b12533E12BADB8ea6D63AeDd11922cAE5580',
147
+ shareOFT: {
148
+ [ETHEREUM]: '0xa6916b65c5e3fEdf46c0a2F59bff776e872C8992',
149
+ },
150
+ },
151
+ layerZeroEids: {
152
+ hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.MONAD,
153
+ spokes: {
154
+ [ETHEREUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
155
+ },
156
+ },
157
+ multiAsset: {
158
+ hubAssetAddress: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
159
+ },
160
+ },
161
+ ];
162
+ /**
163
+ * August's LayerZero OVault deployments, keyed by lowercase hub-chain vault
164
+ * address. Resolve entries with {@link getCrossChainVaultConfig} rather than
165
+ * indexing directly — the helper handles address-casing for you.
166
+ *
167
+ * @see {@link getCrossChainVaultConfig} for the typed, case-insensitive lookup.
168
+ */
169
+ exports.CROSS_CHAIN_VAULT_CONFIGS = Object.freeze(Object.fromEntries(CONFIGS.map((config) => [config.vaultAddress.toLowerCase(), config])));
170
+ /**
171
+ * Resolve the full cross-chain config for a vault. Address comparison is
172
+ * case-insensitive.
173
+ *
174
+ * @param vault - Hub-chain vault contract address.
175
+ * @returns The {@link ICrossChainVaultConfig} to pass to
176
+ * `crossChainVaultDeposit` / `quoteCrossChainDeposit`, or `undefined` when
177
+ * the vault is not a registered OVault deployment.
178
+ * @example
179
+ * ```ts
180
+ * const config = getCrossChainVaultConfig('0xE9B725010A9E419412ed67d0fA5f3A5f40159D32');
181
+ * if (config) await quoteCrossChainDeposit({ config, ...rest });
182
+ * ```
183
+ */
184
+ function getCrossChainVaultConfig(vault) {
185
+ return exports.CROSS_CHAIN_VAULT_CONFIGS[vault.toLowerCase()];
186
+ }
187
+ /**
188
+ * Whether a vault is a registered LayerZero OVault and should route deposits
189
+ * through the cross-chain flow. Address comparison is case-insensitive.
190
+ *
191
+ * @param vault - Vault contract address.
192
+ * @returns `true` when the vault has an entry in
193
+ * {@link CROSS_CHAIN_VAULT_CONFIGS}.
194
+ */
195
+ function isCrossChainVault(vault) {
196
+ return getCrossChainVaultConfig(vault) !== undefined;
197
+ }
198
+ /**
199
+ * Get the hub and spoke chain IDs a vault is deployed across — the set of
200
+ * chains a user can deposit from.
201
+ *
202
+ * @param vault - Vault contract address.
203
+ * @returns `{ hub, spokes }` chain IDs, or `undefined` when the vault is not a
204
+ * registered OVault deployment.
205
+ */
206
+ function getOVaultChains(vault) {
207
+ const config = getCrossChainVaultConfig(vault);
208
+ if (!config)
209
+ return undefined;
210
+ return { hub: config.hubChainId, spokes: config.spokeChainIds };
211
+ }
212
+ /**
213
+ * Whether a vault's receipt token is hub-only (no cross-chain withdraw).
214
+ * The deposit UI must not offer a spoke share destination for these vaults.
215
+ *
216
+ * @param vault - Vault contract address.
217
+ * @returns `true` for vaults whose shares cannot leave the hub chain
218
+ * (AUGUST-6300).
219
+ */
220
+ function isHubOnlyReceipt(vault) {
221
+ return getCrossChainVaultConfig(vault)?.hubOnlyReceipt === true;
222
+ }
223
+ /**
224
+ * Chains a user can receive the underlying asset on when withdrawing.
225
+ * Hub-only-receipt vaults redeem to the hub chain only (AUGUST-6300); all
226
+ * other OVault vaults can redeem to the hub or any spoke.
227
+ *
228
+ * @param vault - Vault contract address.
229
+ * @returns Destination chain IDs, or an empty array when the vault is not a
230
+ * registered OVault deployment.
231
+ */
232
+ function getWithdrawDestinationChains(vault) {
233
+ const config = getCrossChainVaultConfig(vault);
234
+ if (!config)
235
+ return [];
236
+ if (isHubOnlyReceipt(vault))
237
+ return [config.hubChainId];
238
+ return [config.hubChainId, ...config.spokeChainIds];
239
+ }
240
+ //# sourceMappingURL=crossChainVaultRegistry.js.map
@@ -1 +1,2 @@
1
1
  export * from './crossChainVault';
2
+ export * from './crossChainVaultRegistry';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./crossChainVault"), exports);
18
+ __exportStar(require("./crossChainVaultRegistry"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,31 @@
1
+ /**
2
+ * Cross-Chain Vault Type Definitions
3
+ *
4
+ * Defines all request/response interfaces for LayerZero OVault cross-chain
5
+ * vault operations. These types are generic and not tied to any specific
6
+ * vault configuration — SDK consumers provide their own config.
7
+ *
8
+ * @module evm/types/crossChain
9
+ */
1
10
  import type { IAddress } from '../../types';
11
+ /**
12
+ * Injected dependency for the `@layerzerolabs/ovault-evm` SDK.
13
+ *
14
+ * Because the `@layerzerolabs/ovault-evm` package has broken ESM exports
15
+ * (bare directory imports in a `"type": "module"` package), the SDK cannot
16
+ * `require()` it internally. Instead, the consuming application imports it
17
+ * in its own bundler context and passes it to SDK functions via this type.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { OVaultSyncMessageBuilder, OVaultSyncOperations } from '@layerzerolabs/ovault-evm';
22
+ *
23
+ * await buildCrossChainVaultTx({
24
+ * ovaultSdk: { OVaultSyncMessageBuilder, OVaultSyncOperations },
25
+ * // ...other params
26
+ * });
27
+ * ```
28
+ */
2
29
  export interface IOVaultSdkDependency {
3
30
  OVaultSyncMessageBuilder: {
4
31
  generateOVaultInputs: (input: unknown) => Promise<unknown>;
@@ -9,58 +36,131 @@ export interface IOVaultSdkDependency {
9
36
  REDEEM: string;
10
37
  };
11
38
  }
39
+ /**
40
+ * Cross-chain vault configuration provided by SDK consumers.
41
+ *
42
+ * Each vault deployment requires 5 contract types:
43
+ * 1. AssetOFT — OFT wrapper for the underlying asset (e.g., USDC) on hub + spoke chains
44
+ * 2. ERC4626 Vault — The actual vault contract on the hub chain
45
+ * 3. ShareOFTAdapter — Wraps vault shares for cross-chain transport (hub chain)
46
+ * 4. ComposerSync — Orchestrates cross-chain operations (hub chain)
47
+ * 5. ShareOFT — Share token representation on spoke chains
48
+ */
12
49
  export interface ICrossChainVaultConfig {
50
+ /** Human-readable vault name */
13
51
  vaultName: string;
52
+ /** Vault receipt token symbol */
14
53
  vaultSymbol: string;
54
+ /** Chain ID where the ERC4626 vault lives */
15
55
  hubChainId: number;
56
+ /** Address of the ERC4626 vault on the hub chain */
16
57
  vaultAddress: IAddress;
58
+ /** Chain IDs where users can deposit from (spoke chains) */
17
59
  spokeChainIds: number[];
60
+ /** Contract addresses for the OVault deployment */
18
61
  contracts: {
62
+ /** Underlying asset token addresses per chain (e.g., native USDC) */
19
63
  assetToken: Record<number, IAddress>;
64
+ /** AssetOFT (OFT wrapper for the asset) addresses per chain */
20
65
  assetOFT: Record<number, IAddress>;
66
+ /** ShareOFTAdapter address on the hub chain */
21
67
  shareOFTAdapter: IAddress;
68
+ /** VaultComposerSync address on the hub chain */
22
69
  composerSync: IAddress;
70
+ /** ShareOFT addresses on spoke chains */
23
71
  shareOFT: Record<number, IAddress>;
24
72
  };
73
+ /** LayerZero Endpoint IDs (NOT chain IDs) */
25
74
  layerZeroEids: {
75
+ /** Hub chain LayerZero EID */
26
76
  hub: number;
77
+ /** Spoke chain LayerZero EIDs keyed by chain ID */
27
78
  spokes: Record<number, number>;
28
79
  };
80
+ /**
81
+ * Multi-asset vault support.
82
+ * When set, the vault uses `previewDeposit(address, uint256)` instead of
83
+ * the standard ERC4626 `previewDeposit(uint256)`.
84
+ */
29
85
  multiAsset?: {
86
+ /** Asset address on hub chain used for previewDeposit calls */
30
87
  hubAssetAddress: IAddress;
31
88
  };
89
+ /**
90
+ * When `true`, the vault's receipt token cannot leave the hub chain: there
91
+ * is no OFT/bridge for it, so minting shares on a spoke would strand the
92
+ * user (AUGUST-6300). Withdraw UIs must offer the hub chain only. Defaults
93
+ * to `false` when omitted. Drives `getWithdrawDestinationChains`.
94
+ */
95
+ hubOnlyReceipt?: boolean;
32
96
  }
97
+ /** Operation type for cross-chain vault transactions */
33
98
  export type CrossChainOperation = 'DEPOSIT' | 'REDEEM';
99
+ /**
100
+ * Parameters for building a cross-chain vault transaction.
101
+ * Used internally by `buildCrossChainVaultTx`.
102
+ */
34
103
  export interface ICrossChainBuildRequest {
104
+ /** Injected `@layerzerolabs/ovault-evm` SDK dependency */
35
105
  ovaultSdk: IOVaultSdkDependency;
106
+ /** Cross-chain vault configuration */
36
107
  config: ICrossChainVaultConfig;
108
+ /** Operation to perform */
37
109
  operation: CrossChainOperation;
110
+ /** Amount to deposit/redeem (human-readable string, raw bigint, or number) */
38
111
  amount: string | number | bigint;
112
+ /** Decimals of the token being deposited/redeemed */
39
113
  decimals: number;
114
+ /** Chain ID the user is currently on */
40
115
  userChainId: number;
116
+ /** User's wallet address */
41
117
  walletAddress: IAddress;
118
+ /** Chain to receive shares (deposit) or assets (redeem). Defaults to user's chain */
42
119
  destinationChainId?: number;
120
+ /** Recipient address. Defaults to walletAddress */
43
121
  recipientAddress?: IAddress;
122
+ /** Slippage tolerance in basis points (default: 100 = 1%) */
44
123
  slippageBps?: number;
124
+ /**
125
+ * viem Chain object for the hub chain (with RPC URLs configured).
126
+ * Required for SDK to create a public client for on-chain reads.
127
+ */
45
128
  hubChain: unknown;
129
+ /**
130
+ * viem Chain object for the user's source chain (with RPC URLs configured).
131
+ */
46
132
  sourceChain: unknown;
133
+ /** Fee buffer percentage applied to LZ native fees (default: 50) */
47
134
  feeBufferPercent?: number;
135
+ /** Gas limit for lzCompose on hub chain (default: 2_000_000n) */
48
136
  hubLzComposeGasLimit?: bigint;
49
137
  }
138
+ /**
139
+ * Result from building a cross-chain vault transaction.
140
+ */
50
141
  export interface ICrossChainBuildResult {
51
142
  success: boolean;
52
143
  data?: {
144
+ /** Contract address to call */
53
145
  contractAddress: IAddress;
146
+ /** Function name to call on the contract */
54
147
  contractFunctionName: string;
148
+ /** ABI for the contract call */
55
149
  abi: readonly unknown[];
150
+ /** Arguments for the contract function */
56
151
  txArgs: readonly unknown[];
152
+ /** Native value to send with the transaction (includes LZ fees) */
57
153
  messageValue: bigint;
154
+ /** LayerZero messaging fee breakdown */
58
155
  messageFee: {
59
156
  nativeFee: bigint;
60
157
  lzTokenFee: bigint;
61
158
  };
159
+ /** Expected output amount on destination */
62
160
  dstAmount: bigint;
161
+ /** Minimum output amount (after slippage) */
63
162
  minDstAmount: bigint;
163
+ /** Approval info if token approval is required */
64
164
  approval?: {
65
165
  tokenAddress: IAddress;
66
166
  spender: IAddress;
@@ -69,93 +169,195 @@ export interface ICrossChainBuildResult {
69
169
  };
70
170
  error?: string;
71
171
  }
172
+ /**
173
+ * Request parameters for executing a cross-chain deposit.
174
+ */
72
175
  export interface ICrossChainDepositRequest {
176
+ /** Injected `@layerzerolabs/ovault-evm` SDK dependency */
73
177
  ovaultSdk: IOVaultSdkDependency;
178
+ /** Cross-chain vault configuration */
74
179
  config: ICrossChainVaultConfig;
180
+ /** Amount to deposit (human-readable) */
75
181
  amount: string;
182
+ /** Decimals of the deposit token */
76
183
  decimals: number;
184
+ /** Chain ID the user is depositing from */
77
185
  userChainId: number;
186
+ /** User's wallet address */
78
187
  walletAddress: IAddress;
188
+ /** viem WalletClient for signing transactions */
79
189
  walletClient: unknown;
190
+ /** viem PublicClient for reading chain state */
80
191
  publicClient: unknown;
192
+ /** viem Chain object for the hub chain (with RPC URLs) */
81
193
  hubChain: unknown;
194
+ /** viem Chain object for the source chain (with RPC URLs) */
82
195
  sourceChain: unknown;
196
+ /** Chain to receive shares on. Defaults to user's chain */
83
197
  destinationChainId?: number;
198
+ /** Skip the internal approval check (set true when caller handles approval) */
84
199
  skipApprovalCheck?: boolean;
200
+ /** Slippage tolerance in basis points (default: 100 = 1%) */
85
201
  slippageBps?: number;
202
+ /** Fee buffer percentage (default: 50) */
86
203
  feeBufferPercent?: number;
204
+ /** Gas buffer multiplier as percentage (default: 150 = 1.5x) */
87
205
  gasBufferPercent?: number;
88
206
  }
207
+ /**
208
+ * Result from a cross-chain deposit execution.
209
+ */
89
210
  export interface ICrossChainDepositResult {
211
+ /** Transaction hash */
90
212
  transactionHash: string;
213
+ /** Whether the on-chain receipt shows success */
91
214
  success: boolean;
92
215
  }
216
+ /**
217
+ * Request parameters for executing a cross-chain redemption.
218
+ */
93
219
  export interface ICrossChainRedeemRequest {
220
+ /** Injected `@layerzerolabs/ovault-evm` SDK dependency */
94
221
  ovaultSdk: IOVaultSdkDependency;
222
+ /** Cross-chain vault configuration */
95
223
  config: ICrossChainVaultConfig;
224
+ /** Amount of shares to redeem (human-readable) */
96
225
  amount: string;
226
+ /** Decimals of the share token */
97
227
  decimals: number;
228
+ /** Chain ID the user is on (must be hub chain) */
98
229
  userChainId: number;
230
+ /** User's wallet address */
99
231
  walletAddress: IAddress;
232
+ /** viem WalletClient for signing transactions */
100
233
  walletClient: unknown;
234
+ /** viem PublicClient for reading chain state */
101
235
  publicClient: unknown;
236
+ /** viem Chain object for the hub chain (with RPC URLs) */
102
237
  hubChain: unknown;
238
+ /** viem Chain object for the source chain (with RPC URLs) */
103
239
  sourceChain: unknown;
240
+ /** Chain to receive assets on. Defaults to user's chain */
104
241
  destinationChainId?: number;
242
+ /** Skip the internal approval check (set true when caller handles approval) */
105
243
  skipApprovalCheck?: boolean;
244
+ /** Slippage tolerance in basis points (default: 100 = 1%) */
106
245
  slippageBps?: number;
246
+ /** Fee buffer percentage (default: 50) */
107
247
  feeBufferPercent?: number;
248
+ /** Gas buffer multiplier as percentage (default: 200 = 2x) */
108
249
  gasBufferPercent?: number;
250
+ /** Minimum gas limit for redeem operations (default: 5_000_000n) */
109
251
  minGasLimit?: bigint;
110
252
  }
253
+ /**
254
+ * Result from a cross-chain redeem execution.
255
+ */
111
256
  export interface ICrossChainRedeemResult {
257
+ /** Transaction hash */
112
258
  transactionHash: string;
259
+ /** Whether the on-chain receipt shows success */
113
260
  success: boolean;
114
261
  }
262
+ /**
263
+ * Request parameters for quoting a cross-chain deposit.
264
+ */
115
265
  export interface IQuoteCrossChainDepositRequest {
266
+ /** Injected `@layerzerolabs/ovault-evm` SDK dependency */
116
267
  ovaultSdk: IOVaultSdkDependency;
268
+ /** Cross-chain vault configuration */
117
269
  config: ICrossChainVaultConfig;
270
+ /** Amount to deposit (human-readable) */
118
271
  amount: string;
272
+ /** Decimals of the deposit token */
119
273
  decimals: number;
274
+ /** Chain ID the user would deposit from */
120
275
  userChainId: number;
276
+ /** User's wallet address */
121
277
  walletAddress: IAddress;
278
+ /** viem Chain object for the hub chain (with RPC URLs) */
122
279
  hubChain: unknown;
280
+ /** viem Chain object for the source chain (with RPC URLs) */
123
281
  sourceChain: unknown;
282
+ /** Destination chain for shares */
124
283
  destinationChainId?: number;
284
+ /** Slippage tolerance in basis points (default: 100 = 1%) */
125
285
  slippageBps?: number;
286
+ /** Fee buffer percentage (default: 50) */
126
287
  feeBufferPercent?: number;
127
288
  }
289
+ /**
290
+ * Request parameters for quoting a cross-chain redeem.
291
+ */
128
292
  export interface IQuoteCrossChainRedeemRequest {
293
+ /** Injected `@layerzerolabs/ovault-evm` SDK dependency */
129
294
  ovaultSdk: IOVaultSdkDependency;
295
+ /** Cross-chain vault configuration */
130
296
  config: ICrossChainVaultConfig;
297
+ /** Amount of shares to redeem (human-readable) */
131
298
  amount: string;
299
+ /** Decimals of the share token */
132
300
  decimals: number;
301
+ /** User's wallet address */
133
302
  walletAddress: IAddress;
303
+ /** viem Chain object for the hub chain (with RPC URLs) */
134
304
  hubChain: unknown;
305
+ /** viem Chain object for the source chain (with RPC URLs) */
135
306
  sourceChain: unknown;
307
+ /** Destination chain for assets */
136
308
  destinationChainId?: number;
309
+ /** Slippage tolerance in basis points (default: 100 = 1%) */
137
310
  slippageBps?: number;
311
+ /** Fee buffer percentage (default: 50) */
138
312
  feeBufferPercent?: number;
139
313
  }
314
+ /**
315
+ * Result from a cross-chain fee/output quote.
316
+ */
140
317
  export interface IQuoteCrossChainResult {
318
+ /** Native fee in wei (includes buffer) */
141
319
  nativeFee: bigint;
320
+ /** Expected output amount on destination */
142
321
  dstAmount: bigint;
322
+ /** Minimum output amount (after slippage) */
143
323
  minDstAmount: bigint;
324
+ /** Unix epoch (ms) when this quote was generated. */
144
325
  quotedAt: number;
326
+ /** Unix epoch (ms) after which this quote is stale. */
145
327
  expiresAt: number;
146
328
  }
329
+ /** Default validity window for a cross-chain quote (30s). */
147
330
  export declare const CROSS_CHAIN_QUOTE_TTL_MS = 30000;
331
+ /** Returns `true` when the quote should be refreshed before submitting. */
148
332
  export declare function isQuoteStale(quote: Pick<IQuoteCrossChainResult, 'expiresAt'>, now?: number): boolean;
333
+ /**
334
+ * Cross-chain operation status for tracking LayerZero messages.
335
+ */
149
336
  export interface ICrossChainOperationStatus {
337
+ /** Source chain transaction hash */
150
338
  srcTxHash: string;
339
+ /** Current status of the cross-chain message */
151
340
  status: 'PENDING' | 'INFLIGHT' | 'DELIVERED' | 'FAILED';
341
+ /** Source chain ID */
152
342
  srcChainId: number;
343
+ /** Destination chain ID */
153
344
  dstChainId: number;
154
345
  }
346
+ /**
347
+ * Refund status for failed cross-chain operations.
348
+ * LayerZero may refund assets if delivery fails.
349
+ */
155
350
  export interface IRefundStatus {
351
+ /** Whether a refund has been initiated */
156
352
  refunded: boolean;
353
+ /** Refund transaction hash (if available) */
157
354
  refundTxHash?: string;
355
+ /** Amount refunded in the source token's smallest unit */
158
356
  refundAmount?: bigint;
357
+ /** Chain ID where the refund was issued */
159
358
  refundChainId?: number;
160
359
  }
360
+ /**
361
+ * Error classification for cross-chain operations.
362
+ */
161
363
  export type CrossChainErrorType = 'max-deposit' | 'nonce' | 'no-peer' | 'bridge-fee' | 'insufficient-balance' | 'user-rejected' | 'gas' | 'network' | 'unknown';
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
+ /**
3
+ * Cross-Chain Vault Type Definitions
4
+ *
5
+ * Defines all request/response interfaces for LayerZero OVault cross-chain
6
+ * vault operations. These types are generic and not tied to any specific
7
+ * vault configuration — SDK consumers provide their own config.
8
+ *
9
+ * @module evm/types/crossChain
10
+ */
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.CROSS_CHAIN_QUOTE_TTL_MS = void 0;
4
13
  exports.isQuoteStale = isQuoteStale;
14
+ /** Default validity window for a cross-chain quote (30s). */
5
15
  exports.CROSS_CHAIN_QUOTE_TTL_MS = 30000;
16
+ /** Returns `true` when the quote should be refreshed before submitting. */
6
17
  function isQuoteStale(quote, now = Date.now()) {
7
18
  return now >= quote.expiresAt;
8
19
  }
package/lib/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import './polyfills';
2
+ /**
3
+ * Export other packages
4
+ */
2
5
  export * from './types';
3
6
  export * from './core';
4
7
  export * from './abis';
@@ -6,9 +9,22 @@ export * from './services/debank';
6
9
  export * from './services/swap-quotes';
7
10
  export * from './modules/vaults';
8
11
  export * from './modules/sub-accounts';
12
+ export * from './modules/api';
13
+ /**
14
+ * EVM cross-chain (LayerZero OVault) exports
15
+ */
9
16
  export * from './evm';
17
+ /**
18
+ * Solana export
19
+ */
10
20
  export * from './adapters/solana';
21
+ /**
22
+ * Stellar export
23
+ */
11
24
  export * from './adapters/stellar';
12
25
  export declare const VAULT_ADDRESSES: Record<"musd" | "predlp" | "sentusd" | "pregrid" | "repouscc" | "earnxrp" | "tivkbtc" | "tivusdt0" | "supermon" | "earnmon" | "k3europ" | "wmon/ausd" | "wbtc/ausd" | "earnausd_monad" | "sausd" | "farmbold" | "sentuscc" | "sentbtc" | "svusdc" | "apusdc" | "testwethtsa" | "tacusr" | "upinjusdt" | "tac-teth" | "upausd" | "taccbbtc" | "xupusdc" | "uptbtc" | "gteth" | "ageth" | "upusdc" | "hgeth" | "upssylva" | "hbbtc" | "hbhype" | "upazt" | "susdt" | "upedge" | "coreusdc" | "upcusdo" | "shifteth" | "upsusde" | "uplbtc" | "upavax" | "tacrseth" | "earnausd" | "alpineusdcflagship" | "alpinecoinshiftusdc" | "upbtc" | "upstrbtc" | "maxiusr" | "upgammausdc" | "xhype" | "wildusd" | "alpinebtc" | "prenusd" | "upyzusd" | "upnusd" | "hlpe" | "nemo eth yield", `0x${string}`>;
26
+ /**
27
+ * Export the SDK class as default
28
+ */
13
29
  import { AugustSDK } from './main';
14
30
  export default AugustSDK;