@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
@@ -1,3 +1,7 @@
1
+ /**
2
+ * [bytes32-flavored ERC-20](https://docs.makerdao.com/smart-contract-modules/mkr-module#4.-gotchas-potential-source-of-user-error)
3
+ * for tokens (ie. Maker) that use bytes32 instead of string.
4
+ */
1
5
  export declare const ABI_ERC20_BYTES32: readonly [{
2
6
  readonly type: "event";
3
7
  readonly name: "Approval";
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC20_BYTES32 = void 0;
4
+ /**
5
+ * [bytes32-flavored ERC-20](https://docs.makerdao.com/smart-contract-modules/mkr-module#4.-gotchas-potential-source-of-user-error)
6
+ * for tokens (ie. Maker) that use bytes32 instead of string.
7
+ */
4
8
  exports.ABI_ERC20_BYTES32 = [
5
9
  {
6
10
  type: 'event',
@@ -1,3 +1,4 @@
1
+ /** [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626) */
1
2
  export declare const ABI_ERC4626: readonly [{
2
3
  readonly anonymous: false;
3
4
  readonly inputs: readonly [{
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC4626 = void 0;
4
+ /** [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626) */
4
5
  exports.ABI_ERC4626 = [
5
6
  {
6
7
  anonymous: false,
@@ -1,3 +1,4 @@
1
+ /** [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721) */
1
2
  export declare const ABI_ERC721: readonly [{
2
3
  readonly type: "event";
3
4
  readonly name: "Approval";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_ERC721 = void 0;
4
+ /** [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721) */
4
5
  exports.ABI_ERC721 = [
5
6
  {
6
7
  type: 'event',
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_FEE_ORACLE = void 0;
4
+ // export const ABI_FEE_ORACLE = [{"type":"constructor","inputs":[{"name":"ownerAddr","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"FEES_DIVISOR","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getContextFeeAmount","inputs":[{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[{"name":"feePercent","type":"uint256","internalType":"uint256"},{"name":"feeAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getContextFeeRate","inputs":[{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"setContextFeeRate","inputs":[{"name":"feePercent","type":"uint256","internalType":"uint256"},{"name":"categoryId","type":"bytes32","internalType":"bytes32"},{"name":"specificAddr","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false}] as const;
4
5
  exports.ABI_FEE_ORACLE = [
5
6
  {
6
7
  inputs: [
@@ -1155,6 +1155,7 @@ exports.ABI_LENDING_POOLS = [
1155
1155
  type: 'function',
1156
1156
  },
1157
1157
  {
1158
+ // TokenizedVaults only
1158
1159
  inputs: [],
1159
1160
  name: 'operator',
1160
1161
  outputs: [
@@ -1168,6 +1168,7 @@ exports.ABI_LENDING_POOL_V2 = [
1168
1168
  type: 'function',
1169
1169
  },
1170
1170
  {
1171
+ // Tokenized Vaults only
1171
1172
  inputs: [],
1172
1173
  name: 'operator',
1173
1174
  outputs: [
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_MULTICALL3 = void 0;
4
+ /* [Multicall3](https://github.com/mds1/multicall) */
4
5
  exports.ABI_MULTICALL3 = [
5
6
  {
6
7
  inputs: [
@@ -44,6 +45,8 @@ exports.ABI_MULTICALL3 = [
44
45
  type: 'function',
45
46
  },
46
47
  ];
48
+ // Universal resolver error definitions (reserved for future use)
49
+ // @ts-expect-error - Reserved for future ENS integration
47
50
  const universalResolverErrors = [
48
51
  {
49
52
  inputs: [],
package/lib/abis/OFT.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ /**
2
+ * ABI fragments for OFT (Omnichain Fungible Token) and related contracts
3
+ * used in LayerZero cross-chain vault operations.
4
+ *
5
+ * @module ABIs/OFT
6
+ */
7
+ /** ERC20 allowance + approve ABI for cross-chain approval checks */
1
8
  export declare const ABI_CROSS_CHAIN_ERC20: readonly [{
2
9
  readonly inputs: readonly [{
3
10
  readonly internalType: "address";
@@ -35,6 +42,11 @@ export declare const ABI_CROSS_CHAIN_ERC20: readonly [{
35
42
  readonly stateMutability: "nonpayable";
36
43
  readonly type: "function";
37
44
  }];
45
+ /**
46
+ * Multi-asset vault previewDeposit ABI.
47
+ * Uses `previewDeposit(address, uint256)` instead of standard ERC4626's
48
+ * `previewDeposit(uint256)` to specify which asset is being deposited.
49
+ */
38
50
  export declare const ABI_MULTI_ASSET_PREVIEW_DEPOSIT: readonly [{
39
51
  readonly type: "function";
40
52
  readonly name: "previewDeposit";
@@ -58,6 +70,11 @@ export declare const ABI_MULTI_ASSET_PREVIEW_DEPOSIT: readonly [{
58
70
  }];
59
71
  readonly stateMutability: "view";
60
72
  }];
73
+ /**
74
+ * Multi-asset vault previewRedemption ABI.
75
+ * Uses `previewRedemption(uint256, bool)` to preview redeem output
76
+ * with an `isInstant` flag.
77
+ */
61
78
  export declare const ABI_MULTI_ASSET_PREVIEW_REDEEM: readonly [{
62
79
  readonly type: "function";
63
80
  readonly name: "previewRedemption";
@@ -81,6 +98,9 @@ export declare const ABI_MULTI_ASSET_PREVIEW_REDEEM: readonly [{
81
98
  }];
82
99
  readonly stateMutability: "view";
83
100
  }];
101
+ /**
102
+ * Standard ERC4626 previewRedeem ABI.
103
+ */
84
104
  export declare const ABI_STANDARD_PREVIEW_REDEEM: readonly [{
85
105
  readonly type: "function";
86
106
  readonly name: "previewRedeem";
package/lib/abis/OFT.js CHANGED
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
+ /**
3
+ * ABI fragments for OFT (Omnichain Fungible Token) and related contracts
4
+ * used in LayerZero cross-chain vault operations.
5
+ *
6
+ * @module ABIs/OFT
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.ABI_STANDARD_PREVIEW_REDEEM = exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = exports.ABI_CROSS_CHAIN_ERC20 = void 0;
10
+ /** ERC20 allowance + approve ABI for cross-chain approval checks */
4
11
  exports.ABI_CROSS_CHAIN_ERC20 = [
5
12
  {
6
13
  inputs: [
@@ -23,6 +30,11 @@ exports.ABI_CROSS_CHAIN_ERC20 = [
23
30
  type: 'function',
24
31
  },
25
32
  ];
33
+ /**
34
+ * Multi-asset vault previewDeposit ABI.
35
+ * Uses `previewDeposit(address, uint256)` instead of standard ERC4626's
36
+ * `previewDeposit(uint256)` to specify which asset is being deposited.
37
+ */
26
38
  exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = [
27
39
  {
28
40
  type: 'function',
@@ -38,6 +50,11 @@ exports.ABI_MULTI_ASSET_PREVIEW_DEPOSIT = [
38
50
  stateMutability: 'view',
39
51
  },
40
52
  ];
53
+ /**
54
+ * Multi-asset vault previewRedemption ABI.
55
+ * Uses `previewRedemption(uint256, bool)` to preview redeem output
56
+ * with an `isInstant` flag.
57
+ */
41
58
  exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = [
42
59
  {
43
60
  type: 'function',
@@ -53,6 +70,9 @@ exports.ABI_MULTI_ASSET_PREVIEW_REDEEM = [
53
70
  stateMutability: 'view',
54
71
  },
55
72
  ];
73
+ /**
74
+ * Standard ERC4626 previewRedeem ABI.
75
+ */
56
76
  exports.ABI_STANDARD_PREVIEW_REDEEM = [
57
77
  {
58
78
  type: 'function',
@@ -1,3 +1,4 @@
1
+ /** @internal */
1
2
  export declare const ABI_SMART_ACCOUNT: readonly [{
2
3
  readonly name: "isValidSignature";
3
4
  readonly type: "function";
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_SMART_ACCOUNT = void 0;
4
+ // ERC-1271
5
+ // isValidSignature(bytes32 hash, bytes signature) → bytes4 magicValue
6
+ /** @internal */
4
7
  exports.ABI_SMART_ACCOUNT = [
5
8
  {
6
9
  name: 'isValidSignature',
@@ -1,3 +1,4 @@
1
+ /** ABI for the August `SwapRouter` periphery contract. */
1
2
  export declare const ABI_SWAP_ROUTER: readonly [{
2
3
  readonly inputs: readonly [];
3
4
  readonly stateMutability: "nonpayable";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_SWAP_ROUTER = void 0;
4
+ /** ABI for the August `SwapRouter` periphery contract. */
4
5
  exports.ABI_SWAP_ROUTER = [
5
6
  { inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
6
7
  { inputs: [], name: 'AlreadyConfigured', type: 'error' },
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ABI_UNIVERSAL_SIGNATURE_VALIDATOR = void 0;
4
+ // ERC-6492 - universal deployless signature validator contract
5
+ // constructor(address _signer, bytes32 _hash, bytes _signature) → bytes4 returnValue
6
+ // returnValue is either 0x1 (valid) or 0x0 (invalid)
4
7
  exports.ABI_UNIVERSAL_SIGNATURE_VALIDATOR = [
5
8
  {
6
9
  inputs: [
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Contract ABI definitions for interacting with August/Upshift smart contracts.
3
+ *
4
+ * @module ABIs
5
+ */
1
6
  export * from './LendingPool';
2
7
  export * from './ERC20';
3
8
  export * from './Loan';
package/lib/abis/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * Contract ABI definitions for interacting with August/Upshift smart contracts.
4
+ *
5
+ * @module ABIs
6
+ */
2
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
8
  if (k2 === undefined) k2 = k;
4
9
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,4 +1,19 @@
1
- import { ITokenizedVault } from '../../types';
2
- import { IVaultBaseOptions } from '../../modules/vaults/types';
1
+ import type { ITokenizedVault } from '../../types';
2
+ import type { IVaultBaseOptions } from '../../modules/vaults/types';
3
+ /**
4
+ * Fetch EVM vault data for v1 vault contracts (legacy format).
5
+ * Queries on-chain state and combines with backend metadata.
6
+ * @param tokenizedVault Vault metadata from backend
7
+ * @param options RPC configuration and chain details
8
+ * @returns Formatted vault object or null if closed/invisible
9
+ */
3
10
  export declare const getEvmVaultV1: (tokenizedVault: ITokenizedVault, options: IVaultBaseOptions) => Promise<import("../../types").IVault>;
11
+ /**
12
+ * Fetch EVM vault data for v2 vault contracts (current format).
13
+ * V2 vaults use separate contracts for vault, receipt token, and whitelist.
14
+ * Queries all three contracts and combines results.
15
+ * @param tokenizedVault Vault metadata from backend
16
+ * @param options RPC configuration and chain details
17
+ * @returns Formatted vault object or null if closed/invisible
18
+ */
4
19
  export declare const getEvmVaultV2: (tokenizedVault: ITokenizedVault, options: IVaultBaseOptions) => Promise<import("../../types").IVault>;
@@ -6,17 +6,29 @@ const core_1 = require("../../core");
6
6
  const utils_1 = require("../../modules/vaults/utils");
7
7
  const TokenizedVaultV2_1 = require("../../abis/TokenizedVaultV2");
8
8
  const TokenizedVaultV2Receipt_1 = require("../../abis/TokenizedVaultV2Receipt");
9
+ /**
10
+ * Fetch EVM vault data for v1 vault contracts (legacy format).
11
+ * Queries on-chain state and combines with backend metadata.
12
+ * @param tokenizedVault Vault metadata from backend
13
+ * @param options RPC configuration and chain details
14
+ * @returns Formatted vault object or null if closed/invisible
15
+ */
9
16
  const getEvmVaultV1 = async (tokenizedVault, options) => {
10
17
  const vault = tokenizedVault.address;
11
18
  if (!vault) {
12
19
  throw new Error('Vault address is undefined');
13
20
  }
21
+ // Skip closed staging vaults that shouldn't be displayed — unless the caller
22
+ // explicitly opts in (portfolio mode), where a user's position in a closed,
23
+ // invisible vault must still resolve its metadata.
14
24
  if (tokenizedVault.status === 'closed' &&
15
- tokenizedVault.is_visible === false) {
25
+ tokenizedVault.is_visible === false &&
26
+ !options?.includeClosed) {
16
27
  core_1.Logger.log.warn('getEvmVaultV1', `closed: ${tokenizedVault.vault_name}`);
17
28
  return null;
18
29
  }
19
30
  const provider = (0, core_1.createProvider)(options.rpcUrl);
31
+ // Batch fetch all vault contract data
20
32
  const vaultContract = (0, core_1.createContract)({
21
33
  address: vault,
22
34
  abi: abis_1.ABI_LENDING_POOL_V2,
@@ -45,6 +57,7 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
45
57
  }
46
58
  return vaultContract[f]();
47
59
  }));
60
+ // Normalize contract call results into typed object
48
61
  const formattedContractCalls = vaultContractCalls.reduce((acc, curr, i) => {
49
62
  let val;
50
63
  if (core_1.VAULT_FUNCTIONS_V1[i] === 'maxDepositAmount') {
@@ -69,6 +82,7 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
69
82
  val = Number(curr.toString());
70
83
  }
71
84
  else if (core_1.VAULT_FUNCTIONS_V1[i] === 'loansOperator') {
85
+ // TODO: hardcoded as we cannot pull the real strategist
72
86
  val = '0x4DCb388488622e47683EAd1a147947140a31e485';
73
87
  }
74
88
  else {
@@ -76,21 +90,35 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
76
90
  }
77
91
  return { ...acc, [core_1.VAULT_FUNCTIONS_V1[i]]: val };
78
92
  }, {});
93
+ // Combine on-chain and backend data into unified vault object
79
94
  const returnObj = await (0, utils_1.buildFormattedVault)(provider, tokenizedVault, formattedContractCalls);
80
95
  return returnObj;
81
96
  };
82
97
  exports.getEvmVaultV1 = getEvmVaultV1;
98
+ /**
99
+ * Fetch EVM vault data for v2 vault contracts (current format).
100
+ * V2 vaults use separate contracts for vault, receipt token, and whitelist.
101
+ * Queries all three contracts and combines results.
102
+ * @param tokenizedVault Vault metadata from backend
103
+ * @param options RPC configuration and chain details
104
+ * @returns Formatted vault object or null if closed/invisible
105
+ */
83
106
  const getEvmVaultV2 = async (tokenizedVault, options) => {
84
107
  const provider = (0, core_1.createProvider)(options.rpcUrl);
85
108
  const vault = tokenizedVault.address;
86
109
  if (!vault) {
87
110
  throw new Error('Vault address is undefined');
88
111
  }
112
+ // Skip closed staging vaults that shouldn't be displayed — unless the caller
113
+ // explicitly opts in (portfolio mode), where a user's position in a closed,
114
+ // invisible vault must still resolve its metadata.
89
115
  if (tokenizedVault.status === 'closed' &&
90
- tokenizedVault.is_visible === false) {
116
+ tokenizedVault.is_visible === false &&
117
+ !options?.includeClosed) {
91
118
  core_1.Logger.log.warn('getEvmVaultV2', `closed: ${tokenizedVault.vault_name}`);
92
119
  return null;
93
120
  }
121
+ // Fetch vault contract state
94
122
  const vaultContract = (0, core_1.createContract)({
95
123
  address: vault,
96
124
  abi: TokenizedVaultV2_1.ABI_TOKENIZED_VAULT_V2,
@@ -110,7 +138,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
110
138
  const receiptAddress = vaultContractCalls[core_1.VAULT_FUNCTIONS_V2.length - 1];
111
139
  const whitelistedAssetsAddress = vaultContractCalls[0];
112
140
  const reciptContract = (0, core_1.createContract)({
113
- address: receiptAddress,
141
+ address: receiptAddress, // lpTokenAddress
114
142
  abi: TokenizedVaultV2Receipt_1.ABI_TOKENIZED_VAULT_V2_RECEIPT,
115
143
  provider,
116
144
  });
@@ -127,6 +155,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
127
155
  (0, core_1.getWhitelistedAssets)(provider, whitelistedAssetsAddress),
128
156
  ]);
129
157
  const whitelistedAssetsContractCalls = [whitelistedList];
158
+ // Merge all contract call results
130
159
  const combinedCalls = [
131
160
  ...vaultContractCalls,
132
161
  ...receiptContractCalls,
@@ -137,6 +166,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
137
166
  ...core_1.VAULT_FUNCTIONS_V2_RECEIPT,
138
167
  ...core_1.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS,
139
168
  ];
169
+ // Normalize all contract results with proper decimal handling
140
170
  const formattedContractCalls = combinedCalls.reduce((acc, curr, i) => {
141
171
  let val;
142
172
  if (combinedFunctions[i] === 'depositCap') {
@@ -163,6 +193,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
163
193
  val = Number(curr.toString());
164
194
  }
165
195
  else if (combinedFunctions[i] === 'loansOperator') {
196
+ // @hardcoded: we cannot pull the real strategist
166
197
  val = '0x4DCb388488622e47683EAd1a147947140a31e485';
167
198
  }
168
199
  else {
@@ -170,6 +201,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
170
201
  }
171
202
  return { ...acc, [combinedFunctions[i]]: val };
172
203
  }, {});
204
+ // Combine on-chain and backend data into unified vault object
173
205
  const returnObj = await (0, utils_1.buildFormattedVault)(provider, tokenizedVault, formattedContractCalls);
174
206
  return returnObj;
175
207
  };