@augustdigital/sdk 8.3.2 → 8.6.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 (213) hide show
  1. package/README.md +207 -117
  2. package/lib/abis/ERC20_Bytes32.d.ts +4 -0
  3. package/lib/abis/ERC20_Bytes32.js +4 -0
  4. package/lib/abis/ERC4626.d.ts +1 -0
  5. package/lib/abis/ERC4626.js +1 -0
  6. package/lib/abis/ERC721.d.ts +1 -0
  7. package/lib/abis/ERC721.js +1 -0
  8. package/lib/abis/FeeOracle.js +1 -0
  9. package/lib/abis/LendingPool.js +1 -0
  10. package/lib/abis/LendingPoolV2.js +1 -0
  11. package/lib/abis/Multicall3.js +3 -0
  12. package/lib/abis/OFT.d.ts +20 -0
  13. package/lib/abis/OFT.js +20 -0
  14. package/lib/abis/SmartAccount.d.ts +1 -0
  15. package/lib/abis/SmartAccount.js +3 -0
  16. package/lib/abis/SwapRouter.d.ts +1 -0
  17. package/lib/abis/SwapRouter.js +1 -0
  18. package/lib/abis/UniversalSignatureValidator.js +3 -0
  19. package/lib/abis/index.d.ts +5 -0
  20. package/lib/abis/index.js +5 -0
  21. package/lib/adapters/evm/getters.d.ts +17 -2
  22. package/lib/adapters/evm/getters.js +35 -3
  23. package/lib/adapters/evm/index.d.ts +266 -4
  24. package/lib/adapters/evm/index.js +270 -1
  25. package/lib/adapters/evm/utils.d.ts +6 -0
  26. package/lib/adapters/evm/utils.js +7 -0
  27. package/lib/adapters/solana/constants.d.ts +1 -1
  28. package/lib/adapters/solana/constants.js +4 -1
  29. package/lib/adapters/solana/getters.d.ts +9 -1
  30. package/lib/adapters/solana/getters.js +21 -0
  31. package/lib/adapters/solana/idl/vault-idl.js +9 -0
  32. package/lib/adapters/solana/index.d.ts +59 -4
  33. package/lib/adapters/solana/index.js +61 -0
  34. package/lib/adapters/solana/types.d.ts +1 -1
  35. package/lib/adapters/solana/utils.d.ts +31 -3
  36. package/lib/adapters/solana/utils.js +79 -4
  37. package/lib/adapters/solana/vault.actions.d.ts +23 -4
  38. package/lib/adapters/solana/vault.actions.js +47 -3
  39. package/lib/adapters/stellar/actions.d.ts +26 -1
  40. package/lib/adapters/stellar/actions.js +33 -0
  41. package/lib/adapters/stellar/constants.d.ts +26 -0
  42. package/lib/adapters/stellar/constants.js +29 -0
  43. package/lib/adapters/stellar/getters.d.ts +56 -0
  44. package/lib/adapters/stellar/getters.js +81 -0
  45. package/lib/adapters/stellar/index.d.ts +70 -0
  46. package/lib/adapters/stellar/index.js +71 -0
  47. package/lib/adapters/stellar/soroban.d.ts +21 -1
  48. package/lib/adapters/stellar/soroban.js +47 -1
  49. package/lib/adapters/stellar/submit.d.ts +29 -0
  50. package/lib/adapters/stellar/submit.js +90 -5
  51. package/lib/adapters/stellar/types.d.ts +27 -0
  52. package/lib/adapters/stellar/types.js +3 -0
  53. package/lib/adapters/stellar/utils.d.ts +10 -0
  54. package/lib/adapters/stellar/utils.js +10 -0
  55. package/lib/adapters/sui/getters.d.ts +7 -1
  56. package/lib/adapters/sui/getters.js +6 -0
  57. package/lib/adapters/sui/index.d.ts +16 -1
  58. package/lib/adapters/sui/index.js +17 -0
  59. package/lib/adapters/sui/transformer.d.ts +8 -2
  60. package/lib/adapters/sui/transformer.js +7 -0
  61. package/lib/adapters/sui/types.d.ts +1 -1
  62. package/lib/adapters/sui/utils.d.ts +6 -0
  63. package/lib/adapters/sui/utils.js +6 -0
  64. package/lib/core/analytics/chain-name.d.ts +8 -0
  65. package/lib/core/analytics/chain-name.js +8 -0
  66. package/lib/core/analytics/constants.d.ts +4 -0
  67. package/lib/core/analytics/constants.js +4 -0
  68. package/lib/core/analytics/env.d.ts +25 -0
  69. package/lib/core/analytics/env.js +26 -0
  70. package/lib/core/analytics/index.d.ts +26 -0
  71. package/lib/core/analytics/index.js +35 -0
  72. package/lib/core/analytics/instrumentation.d.ts +26 -0
  73. package/lib/core/analytics/instrumentation.js +66 -2
  74. package/lib/core/analytics/method-taxonomy.d.ts +16 -0
  75. package/lib/core/analytics/method-taxonomy.js +18 -0
  76. package/lib/core/analytics/metrics.d.ts +23 -0
  77. package/lib/core/analytics/metrics.js +40 -0
  78. package/lib/core/analytics/sanitize.d.ts +38 -0
  79. package/lib/core/analytics/sanitize.js +46 -0
  80. package/lib/core/analytics/sentry-runtime.d.ts +11 -0
  81. package/lib/core/analytics/sentry-runtime.js +20 -1
  82. package/lib/core/analytics/sentry.d.ts +47 -2
  83. package/lib/core/analytics/sentry.js +115 -2
  84. package/lib/core/analytics/types.d.ts +28 -1
  85. package/lib/core/analytics/user-identity.d.ts +36 -2
  86. package/lib/core/analytics/user-identity.js +43 -1
  87. package/lib/core/analytics/version.d.ts +6 -1
  88. package/lib/core/analytics/version.js +6 -1
  89. package/lib/core/auth/verify.js +5 -0
  90. package/lib/core/base.class.d.ts +78 -3
  91. package/lib/core/base.class.js +66 -4
  92. package/lib/core/cache.d.ts +5 -0
  93. package/lib/core/cache.js +6 -0
  94. package/lib/core/constants/adapters.d.ts +16 -1
  95. package/lib/core/constants/adapters.js +28 -8
  96. package/lib/core/constants/core.d.ts +14 -1
  97. package/lib/core/constants/core.js +18 -0
  98. package/lib/core/constants/swap-router.d.ts +83 -1
  99. package/lib/core/constants/swap-router.js +91 -1
  100. package/lib/core/constants/vaults.d.ts +57 -1
  101. package/lib/core/constants/vaults.js +66 -1
  102. package/lib/core/constants/web3.d.ts +4 -1
  103. package/lib/core/constants/web3.js +15 -5
  104. package/lib/core/errors/index.d.ts +38 -2
  105. package/lib/core/errors/index.js +38 -0
  106. package/lib/core/fetcher.d.ts +136 -2
  107. package/lib/core/fetcher.js +229 -25
  108. package/lib/core/helpers/adapters.d.ts +10 -1
  109. package/lib/core/helpers/adapters.js +11 -0
  110. package/lib/core/helpers/chain-address.d.ts +10 -0
  111. package/lib/core/helpers/chain-address.js +11 -0
  112. package/lib/core/helpers/core.d.ts +49 -4
  113. package/lib/core/helpers/core.js +74 -7
  114. package/lib/core/helpers/explorer-link.d.ts +15 -1
  115. package/lib/core/helpers/explorer-link.js +14 -0
  116. package/lib/core/helpers/signer.d.ts +27 -1
  117. package/lib/core/helpers/signer.js +39 -0
  118. package/lib/core/helpers/swap-router.d.ts +33 -1
  119. package/lib/core/helpers/swap-router.js +32 -0
  120. package/lib/core/helpers/vault-version.d.ts +2 -1
  121. package/lib/core/helpers/vault-version.js +2 -0
  122. package/lib/core/helpers/vaults.d.ts +9 -1
  123. package/lib/core/helpers/vaults.js +22 -8
  124. package/lib/core/helpers/web3.d.ts +154 -2
  125. package/lib/core/helpers/web3.js +192 -15
  126. package/lib/core/logger/index.d.ts +55 -0
  127. package/lib/core/logger/index.js +19 -0
  128. package/lib/core/logger/slack.d.ts +3 -0
  129. package/lib/core/logger/slack.js +3 -0
  130. package/lib/core/vault-metadata.d.ts +7 -1
  131. package/lib/core/vault-metadata.js +6 -0
  132. package/lib/core/version-check.d.ts +52 -0
  133. package/lib/core/version-check.js +82 -1
  134. package/lib/evm/methods/crossChainVault.d.ts +90 -0
  135. package/lib/evm/methods/crossChainVault.js +187 -2
  136. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  137. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  138. package/lib/evm/methods/index.d.ts +1 -0
  139. package/lib/evm/methods/index.js +1 -0
  140. package/lib/evm/types/crossChain.d.ts +202 -0
  141. package/lib/evm/types/crossChain.js +12 -1
  142. package/lib/index.d.ts +16 -0
  143. package/lib/index.js +19 -0
  144. package/lib/main.d.ts +289 -6
  145. package/lib/main.js +312 -0
  146. package/lib/modules/api/index.d.ts +1 -0
  147. package/lib/modules/api/index.js +6 -0
  148. package/lib/modules/api/main.d.ts +52 -0
  149. package/lib/modules/api/main.js +130 -0
  150. package/lib/modules/sub-accounts/fetcher.d.ts +17 -2
  151. package/lib/modules/sub-accounts/fetcher.js +15 -0
  152. package/lib/modules/sub-accounts/main.d.ts +35 -2
  153. package/lib/modules/sub-accounts/main.js +39 -1
  154. package/lib/modules/sub-accounts/utils.d.ts +4 -1
  155. package/lib/modules/sub-accounts/utils.js +3 -0
  156. package/lib/modules/vaults/adapter.helpers.d.ts +21 -3
  157. package/lib/modules/vaults/adapter.helpers.js +34 -0
  158. package/lib/modules/vaults/fetcher.d.ts +45 -0
  159. package/lib/modules/vaults/fetcher.js +91 -4
  160. package/lib/modules/vaults/getters.d.ts +295 -0
  161. package/lib/modules/vaults/getters.js +567 -26
  162. package/lib/modules/vaults/index.d.ts +12 -0
  163. package/lib/modules/vaults/index.js +12 -0
  164. package/lib/modules/vaults/main.d.ts +292 -4
  165. package/lib/modules/vaults/main.js +382 -8
  166. package/lib/modules/vaults/read.actions.d.ts +170 -2
  167. package/lib/modules/vaults/read.actions.js +143 -0
  168. package/lib/modules/vaults/types.d.ts +34 -0
  169. package/lib/modules/vaults/utils/call-data-decoder.d.ts +48 -1
  170. package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
  171. package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
  172. package/lib/modules/vaults/utils/date-utils.js +47 -1
  173. package/lib/modules/vaults/utils.d.ts +85 -0
  174. package/lib/modules/vaults/utils.js +139 -7
  175. package/lib/modules/vaults/write.actions.d.ts +363 -3
  176. package/lib/modules/vaults/write.actions.js +399 -3
  177. package/lib/polyfills.js +4 -2
  178. package/lib/sdk.d.ts +23847 -0
  179. package/lib/services/coingecko/fetcher.d.ts +15 -1
  180. package/lib/services/coingecko/fetcher.js +30 -9
  181. package/lib/services/debank/fetcher.d.ts +15 -1
  182. package/lib/services/debank/fetcher.js +12 -0
  183. package/lib/services/debank/utils.d.ts +1 -1
  184. package/lib/services/debank/utils.js +18 -1
  185. package/lib/services/layerzero/deposits.d.ts +12 -1
  186. package/lib/services/layerzero/deposits.js +34 -11
  187. package/lib/services/layerzero/redeems.d.ts +11 -1
  188. package/lib/services/layerzero/redeems.js +13 -0
  189. package/lib/services/layerzero/utils.d.ts +8 -0
  190. package/lib/services/layerzero/utils.js +11 -0
  191. package/lib/services/octavfi/fetcher.d.ts +8 -1
  192. package/lib/services/octavfi/fetcher.js +25 -0
  193. package/lib/services/octavfi/types.d.ts +1 -1
  194. package/lib/services/octavfi/utils.d.ts +14 -2
  195. package/lib/services/octavfi/utils.js +44 -10
  196. package/lib/services/subgraph/fetcher.js +4 -2
  197. package/lib/services/subgraph/vaults.d.ts +12 -0
  198. package/lib/services/subgraph/vaults.js +119 -2
  199. package/lib/services/swap-quotes/index.d.ts +80 -0
  200. package/lib/services/swap-quotes/index.js +27 -1
  201. package/lib/services/swap-quotes/paraswap.d.ts +25 -0
  202. package/lib/services/swap-quotes/paraswap.js +22 -0
  203. package/lib/types/pools.d.ts +5 -2
  204. package/lib/types/staking.d.ts +1 -1
  205. package/lib/types/sub-accounts.d.ts +1 -1
  206. package/lib/types/subgraph.d.ts +10 -1
  207. package/lib/types/typed-contract.d.ts +64 -0
  208. package/lib/types/vaults.d.ts +163 -2
  209. package/lib/types/vaults.js +10 -0
  210. package/lib/types/web3.d.ts +9 -1
  211. package/lib/types/web3.js +1 -0
  212. package/lib/types/webserver.d.ts +47 -2
  213. package/package.json +6 -5
@@ -1,8 +1,90 @@
1
- import { IAddress } from '../../types';
1
+ import type { IAddress } from '../../types';
2
+ /**
3
+ * Address of the `SwapRouter` periphery contract on each supported chain.
4
+ *
5
+ * Missing keys mean no SwapRouter is deployed on that chain — callers
6
+ * should fall back to legacy adapter paths.
7
+ *
8
+ * @see {@link getSwapRouterAddress} for the typed lookup helper.
9
+ */
2
10
  export declare const SWAP_ROUTER_ADDRESSES: Readonly<Record<number, IAddress>>;
11
+ /**
12
+ * Vault addresses registered on a `SwapRouter` via `enableVault`. The
13
+ * presence of a vault here is the signal to route its deposits through the
14
+ * SwapRouter rather than the legacy adapter path.
15
+ *
16
+ * Entries mirror the on-chain `vaultInfo[addr].referenceAsset != 0` state of
17
+ * the `SwapRouter` deployment. Verify against the deployed contract before
18
+ * adding a new entry — a vault that is not registered on-chain will revert
19
+ * with `InvalidVault` at deposit time.
20
+ *
21
+ * Lowercase comparison is required when checking — use
22
+ * {@link vaultUsesSwapRouter} rather than reading this set directly.
23
+ */
3
24
  export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
25
+ /**
26
+ * 32-byte origin codes registered on the `SwapRouter` via `addOrigin`.
27
+ * Drives origin/referral-fee accrual. The on-chain admin must register a
28
+ * code before it can be used — calls with an unknown code revert with
29
+ * `InvalidOrigin`.
30
+ *
31
+ * `default` is the all-zero sentinel — the SwapRouter treats it as "no
32
+ * origin fee" and skips the origin-fee transfer.
33
+ */
4
34
  export declare const ORIGIN_CODES: {
35
+ /** All-zero sentinel — no origin fee. */
5
36
  readonly default: `0x${string}`;
6
37
  };
38
+ /**
39
+ * Maximum number of swap legs the contract accepts in a single
40
+ * `swapAndDeposit` call. Mirrors the on-chain `MAX_SWAPS` constant; reading
41
+ * the on-chain value at call time would add an RPC for no gain.
42
+ *
43
+ * Kept here so the SDK can reject oversize inputs at the boundary rather
44
+ * than wait for the on-chain `TooManySwaps` revert.
45
+ */
7
46
  export declare const SWAP_ROUTER_MAX_SWAPS = 9;
47
+ /**
48
+ * Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
49
+ * the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
50
+ * every dispatch. Used to validate that native-token deposits target a
51
+ * vault whose reference asset is the wrapped native — the only configuration
52
+ * the contract's `depositNativeToken` / `swapAndDepositNativeToken` accept.
53
+ */
8
54
  export declare const SWAP_ROUTER_WRAPPED_NATIVE: Readonly<Record<number, IAddress>>;
55
+ /**
56
+ * The DEX aggregator whitelisted on each chain's `SwapRouter` via
57
+ * `enableRouter`, plus the single aggregator contract method every swap leg is
58
+ * pinned to and that method's 4-byte selector.
59
+ *
60
+ * This is the single source of truth tying the off-chain swap-leg builder to
61
+ * the on-chain router whitelist. The two MUST agree or `swapAndDeposit` reverts
62
+ * with `InvalidRouter()` (router not whitelisted) or `InvalidNotWhitelisted()`
63
+ * (selector not authorized). It is consumed in three places:
64
+ *
65
+ * - `dispatchViaSwapRouter` asks {@link fetchSwapQuote} to pin the aggregator to
66
+ * `contractMethod`, then asserts the returned quote's `router` and payload
67
+ * selector match this entry before broadcasting — failing closed rather than
68
+ * letting the user pay gas for a transaction the contract will reject.
69
+ * - The CI check `scripts/verify-swap-router-aggregator.mjs` asserts the
70
+ * deployed `SwapRouter` actually has `tokenTransferProxies[router] != 0` and
71
+ * `isAuthorizedSelector(router, selector) == true` for every entry here, so
72
+ * config drift is caught at release time, not by a user's failed deposit.
73
+ *
74
+ * Pinning to one generic method matters: the aggregator otherwise picks a route
75
+ * method per quote (e.g. a direct `swapExactAmountInOnUniswapV3`) that varies
76
+ * with market conditions, producing a different selector each time. Pinning
77
+ * collapses that to one stable selector so the on-chain whitelist needs only
78
+ * that selector and never drifts as routing changes.
79
+ *
80
+ * `router` is the address the aggregator's calldata targets (ParaSwap v6.2
81
+ * pulls tokens to the Augustus contract itself, so the SwapRouter's
82
+ * `tokenTransferProxies[router]` is the router address). `selector` is
83
+ * `bytes4(keccak256("<contractMethod>(...)"))`. Verify both against the
84
+ * deployed router before adding a chain — a wrong value reverts at deposit time.
85
+ */
86
+ export declare const SWAP_ROUTER_DEX_AGGREGATOR: Readonly<Record<number, {
87
+ router: IAddress;
88
+ contractMethod: string;
89
+ selector: `0x${string}`;
90
+ }>>;
@@ -1,18 +1,108 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SWAP_ROUTER_WRAPPED_NATIVE = exports.SWAP_ROUTER_MAX_SWAPS = exports.ORIGIN_CODES = exports.VAULTS_USING_SWAP_ROUTER = exports.SWAP_ROUTER_ADDRESSES = void 0;
3
+ exports.SWAP_ROUTER_DEX_AGGREGATOR = exports.SWAP_ROUTER_WRAPPED_NATIVE = exports.SWAP_ROUTER_MAX_SWAPS = exports.ORIGIN_CODES = exports.VAULTS_USING_SWAP_ROUTER = exports.SWAP_ROUTER_ADDRESSES = void 0;
4
+ /**
5
+ * Address of the `SwapRouter` periphery contract on each supported chain.
6
+ *
7
+ * Missing keys mean no SwapRouter is deployed on that chain — callers
8
+ * should fall back to legacy adapter paths.
9
+ *
10
+ * @see {@link getSwapRouterAddress} for the typed lookup helper.
11
+ */
4
12
  exports.SWAP_ROUTER_ADDRESSES = {
5
13
  1: '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0',
6
14
  };
15
+ /**
16
+ * Vault addresses registered on a `SwapRouter` via `enableVault`. The
17
+ * presence of a vault here is the signal to route its deposits through the
18
+ * SwapRouter rather than the legacy adapter path.
19
+ *
20
+ * Entries mirror the on-chain `vaultInfo[addr].referenceAsset != 0` state of
21
+ * the `SwapRouter` deployment. Verify against the deployed contract before
22
+ * adding a new entry — a vault that is not registered on-chain will revert
23
+ * with `InvalidVault` at deposit time.
24
+ *
25
+ * Lowercase comparison is required when checking — use
26
+ * {@link vaultUsesSwapRouter} rather than reading this set directly.
27
+ */
7
28
  exports.VAULTS_USING_SWAP_ROUTER = new Set([
29
+ // Upshift Core USDC — ERC-4626 vault, reference asset USDC. Enabled on
30
+ // the mainnet SwapRouter at vaultType=1 (VAULT_TYPE_ERC4626).
8
31
  '0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
32
+ // Sentora USD — Tokenized Vault V2, reference asset USDC. Enabled on the
33
+ // mainnet SwapRouter at vaultType=2 (VAULT_TYPE_TOKENIZED_VAULT_V2).
9
34
  '0x74ad2f789ed583dbd141bbdafc673fe1f033718b',
10
35
  ]);
36
+ /**
37
+ * 32-byte origin codes registered on the `SwapRouter` via `addOrigin`.
38
+ * Drives origin/referral-fee accrual. The on-chain admin must register a
39
+ * code before it can be used — calls with an unknown code revert with
40
+ * `InvalidOrigin`.
41
+ *
42
+ * `default` is the all-zero sentinel — the SwapRouter treats it as "no
43
+ * origin fee" and skips the origin-fee transfer.
44
+ */
11
45
  exports.ORIGIN_CODES = {
46
+ /** All-zero sentinel — no origin fee. */
12
47
  default: '0x0000000000000000000000000000000000000000000000000000000000000000',
13
48
  };
49
+ /**
50
+ * Maximum number of swap legs the contract accepts in a single
51
+ * `swapAndDeposit` call. Mirrors the on-chain `MAX_SWAPS` constant; reading
52
+ * the on-chain value at call time would add an RPC for no gain.
53
+ *
54
+ * Kept here so the SDK can reject oversize inputs at the boundary rather
55
+ * than wait for the on-chain `TooManySwaps` revert.
56
+ */
14
57
  exports.SWAP_ROUTER_MAX_SWAPS = 9;
58
+ /**
59
+ * Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
60
+ * the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
61
+ * every dispatch. Used to validate that native-token deposits target a
62
+ * vault whose reference asset is the wrapped native — the only configuration
63
+ * the contract's `depositNativeToken` / `swapAndDepositNativeToken` accept.
64
+ */
15
65
  exports.SWAP_ROUTER_WRAPPED_NATIVE = {
16
66
  1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
17
67
  };
68
+ /**
69
+ * The DEX aggregator whitelisted on each chain's `SwapRouter` via
70
+ * `enableRouter`, plus the single aggregator contract method every swap leg is
71
+ * pinned to and that method's 4-byte selector.
72
+ *
73
+ * This is the single source of truth tying the off-chain swap-leg builder to
74
+ * the on-chain router whitelist. The two MUST agree or `swapAndDeposit` reverts
75
+ * with `InvalidRouter()` (router not whitelisted) or `InvalidNotWhitelisted()`
76
+ * (selector not authorized). It is consumed in three places:
77
+ *
78
+ * - `dispatchViaSwapRouter` asks {@link fetchSwapQuote} to pin the aggregator to
79
+ * `contractMethod`, then asserts the returned quote's `router` and payload
80
+ * selector match this entry before broadcasting — failing closed rather than
81
+ * letting the user pay gas for a transaction the contract will reject.
82
+ * - The CI check `scripts/verify-swap-router-aggregator.mjs` asserts the
83
+ * deployed `SwapRouter` actually has `tokenTransferProxies[router] != 0` and
84
+ * `isAuthorizedSelector(router, selector) == true` for every entry here, so
85
+ * config drift is caught at release time, not by a user's failed deposit.
86
+ *
87
+ * Pinning to one generic method matters: the aggregator otherwise picks a route
88
+ * method per quote (e.g. a direct `swapExactAmountInOnUniswapV3`) that varies
89
+ * with market conditions, producing a different selector each time. Pinning
90
+ * collapses that to one stable selector so the on-chain whitelist needs only
91
+ * that selector and never drifts as routing changes.
92
+ *
93
+ * `router` is the address the aggregator's calldata targets (ParaSwap v6.2
94
+ * pulls tokens to the Augustus contract itself, so the SwapRouter's
95
+ * `tokenTransferProxies[router]` is the router address). `selector` is
96
+ * `bytes4(keccak256("<contractMethod>(...)"))`. Verify both against the
97
+ * deployed router before adding a chain — a wrong value reverts at deposit time.
98
+ */
99
+ exports.SWAP_ROUTER_DEX_AGGREGATOR = {
100
+ // ParaSwap AugustusV6.2 (Velora). `swapExactAmountIn` is the generic
101
+ // executor method; its selector is 0xe3ead59e.
102
+ 1: {
103
+ router: '0x6A000F20005980200259B80c5102003040001068',
104
+ contractMethod: 'swapExactAmountIn',
105
+ selector: '0xe3ead59e',
106
+ },
107
+ };
18
108
  //# sourceMappingURL=swap-router.js.map
@@ -1,4 +1,14 @@
1
- import { IAddress, IPoolFunctions } from '../../types';
1
+ import type { IAddress, IPoolFunctions } from '../../types';
2
+ /**
3
+ * Table of Contents
4
+ * - Hardcoded Addresses
5
+ * - Vault Functions to Call
6
+ * - Subgraph URLs
7
+ * - Vault Receipt Symbol Mapping
8
+ */
9
+ /**
10
+ * Hardcoded subaccount addresses for specific vaults allocations
11
+ */
2
12
  export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
3
13
  AgoraAUSD: {
4
14
  address: IAddress;
@@ -11,22 +21,68 @@ export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
11
21
  useDebank: boolean;
12
22
  };
13
23
  };
24
+ /**
25
+ * @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
26
+ * @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
27
+ */
14
28
  export declare const MULTI_ASSET_VAULTS: `0x${string}`[];
15
29
  export declare const WRAPPER_ADAPTOR: {
16
30
  43114: IAddress;
17
31
  1: IAddress;
18
32
  };
33
+ /**
34
+ * @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
35
+ * @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
36
+ */
19
37
  export declare const OLD_LENDING_POOLS: `0x${string}`[];
20
38
  export declare const IDLE_CAPITAL_BORROWER_ADDRESS: `0x${string}`[];
39
+ /**
40
+ * Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
41
+ * Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
42
+ * checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
43
+ * would throw). Add an address here to drop its `latest_reported_tvl` from
44
+ * the headline number — e.g. closed pre-deposit vaults, test vaults, or
45
+ * migrated v1 pools that are double-counted by a v2 successor.
46
+ */
21
47
  export declare const TVL_EXCLUDED_VAULTS: ReadonlySet<string>;
48
+ /**
49
+ * Vault Functions to Call
50
+ */
51
+ /**
52
+ * The functions to call on the vault contract
53
+ * @returns The functions to call
54
+ */
22
55
  export declare const VAULT_FUNCTIONS_V1: IPoolFunctions[];
23
56
  export declare const VAULT_FUNCTIONS_V2: IPoolFunctions[];
24
57
  export declare const VAULT_FUNCTIONS_V2_RECEIPT: IPoolFunctions[];
25
58
  export declare const VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS: IPoolFunctions[];
59
+ /**
60
+ * NEMO ETH Yield vault address (lowercase for comparisons)
61
+ */
26
62
  export declare const NEMO_VAULT_ADDRESS = "0xa422c3018c46ba90a14acd14f96cb60616f5c91b";
63
+ /**
64
+ * Subgraph base URL
65
+ * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
66
+ */
27
67
  export declare const GOLDSKY_BASE_URL = "https://api.goldsky.com/api/private/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs";
68
+ /**
69
+ * Subgraph URLs
70
+ * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
71
+ */
28
72
  export declare const SUBGRAPH_VAULT_URLS: Record<VaultSymbols, string>;
73
+ /**
74
+ * Vault Receipt Symbol Mapping
75
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
76
+ */
29
77
  type VaultSymbols = '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' | 'musd' | 'earnausd' | 'alpineusdcflagship' | 'alpinecoinshiftusdc' | 'upbtc' | 'upstrbtc' | 'maxiusr' | 'upgammausdc' | 'xhype' | 'wildusd' | 'alpinebtc' | 'prenusd' | 'upyzusd' | 'upnusd' | 'hlpe' | 'nemo eth yield';
78
+ /**
79
+ * Vault Symbols Mapping
80
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
81
+ */
30
82
  export declare const VAULT_SYMBOLS: Record<IAddress, string>;
83
+ /**
84
+ * Vault Symbols Reverse Mapping
85
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
86
+ */
31
87
  export declare const VAULT_SYMBOLS_REVERSE: Record<VaultSymbols, IAddress>;
32
88
  export {};
@@ -2,33 +2,63 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VAULT_SYMBOLS_REVERSE = exports.VAULT_SYMBOLS = exports.SUBGRAPH_VAULT_URLS = exports.GOLDSKY_BASE_URL = exports.NEMO_VAULT_ADDRESS = exports.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS = exports.VAULT_FUNCTIONS_V2_RECEIPT = exports.VAULT_FUNCTIONS_V2 = exports.VAULT_FUNCTIONS_V1 = exports.TVL_EXCLUDED_VAULTS = exports.IDLE_CAPITAL_BORROWER_ADDRESS = exports.OLD_LENDING_POOLS = exports.WRAPPER_ADAPTOR = exports.MULTI_ASSET_VAULTS = exports.VAULT_ALLOCATION_SUBACCOUNTS = void 0;
4
4
  const ethers_1 = require("ethers");
5
+ /**
6
+ * Table of Contents
7
+ * - Hardcoded Addresses
8
+ * - Vault Functions to Call
9
+ * - Subgraph URLs
10
+ * - Vault Receipt Symbol Mapping
11
+ */
12
+ /**
13
+ * Hardcoded subaccount addresses for specific vaults allocations
14
+ */
5
15
  exports.VAULT_ALLOCATION_SUBACCOUNTS = {
16
+ // For the Agora AUSD vault, fetch the vault allocations from the Caleb subaccount
6
17
  AgoraAUSD: {
7
18
  address: (0, ethers_1.getAddress)('0x828BC5895b78b2fb591018Ca5bDC2064742D6D0f'),
8
19
  subaccount: (0, ethers_1.getAddress)('0xFff71B0b66f076C60Fa2f176a34a6EA709ccF21B'),
9
20
  useDebank: false,
10
21
  },
22
+ // For the Earn AUSD (Monad) vault, fetch the vault loans from the RockawayX subaccount
23
+ // fetch the rest of the exposures from Debank
11
24
  earnAUSD: {
12
25
  address: (0, ethers_1.getAddress)('0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA'),
13
26
  subaccount: (0, ethers_1.getAddress)('0xC8c0Ffb8Ff3BDA26321224e800B3B38AEaB48799'),
14
27
  useDebank: true,
15
28
  },
16
29
  };
30
+ /**
31
+ * @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
32
+ * @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
33
+ */
17
34
  exports.MULTI_ASSET_VAULTS = [
35
+ //Wild
18
36
  (0, ethers_1.getAddress)('0x18EE038C114a07f4B08b420fb1E4149a4F357249'),
37
+ //Yuzu
19
38
  (0, ethers_1.getAddress)('0x517677A19D8ae6FF600FB86C3C7bFCCD651e3eec'),
39
+ //HyENA
20
40
  (0, ethers_1.getAddress)('0x8fFDcd8A96d293f45aA044d10b899F9D71897E8a'),
41
+ //SingularV
21
42
  (0, ethers_1.getAddress)('0xd411aCaE2Bc7019322277A21ff005d94705661C5'),
43
+ //Neutrl
22
44
  (0, ethers_1.getAddress)('0xAEEb2fB279a5aA837367B9D2582F898a63b06ca1'),
45
+ // HCL Stroom
23
46
  (0, ethers_1.getAddress)('0x0C949AAf28bF0318bAa5f2cbF2F2D970f57879aB'),
47
+ //Aptos Aave
24
48
  (0, ethers_1.getAddress)('0xA38d92eC538e9aa3edb980b89701A9d38a1FE015'),
49
+ // Sentora USCC
25
50
  (0, ethers_1.getAddress)('0x63C5d615e937697a80606788965E209414738820'),
51
+ // Sentora wBTC
26
52
  (0, ethers_1.getAddress)('0x3cC0D33B1AEac3d23eA89214b3AC5B4607032167'),
27
53
  ];
28
54
  exports.WRAPPER_ADAPTOR = {
29
55
  43114: (0, ethers_1.getAddress)('0xb2C57614B93c41A7Ec3B91980C0Bb7453904c6e8'),
30
56
  1: (0, ethers_1.getAddress)('0x044155804b2ef8fc53C69E3661ceA9b905EDE7Bc'),
31
57
  };
58
+ /**
59
+ * @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
60
+ * @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
61
+ */
32
62
  exports.OLD_LENDING_POOLS = [
33
63
  (0, ethers_1.getAddress)('0xe1B4d34E8754600962Cd944B535180Bd758E6c2e'),
34
64
  (0, ethers_1.getAddress)('0xEBac5e50003d4B17Be422ff9775043cD61002f7f'),
@@ -38,9 +68,25 @@ exports.IDLE_CAPITAL_BORROWER_ADDRESS = [
38
68
  (0, ethers_1.getAddress)('0x2151C90C93F52bE82186f162c86DaEABc8911188'),
39
69
  (0, ethers_1.getAddress)('0xb74c137E5f976dbdCC638Ec9fd3e05d6D9124E55'),
40
70
  ];
71
+ /**
72
+ * Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
73
+ * Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
74
+ * checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
75
+ * would throw). Add an address here to drop its `latest_reported_tvl` from
76
+ * the headline number — e.g. closed pre-deposit vaults, test vaults, or
77
+ * migrated v1 pools that are double-counted by a v2 successor.
78
+ */
41
79
  exports.TVL_EXCLUDED_VAULTS = new Set([
42
- '0x3299A525986D2e94B3FC6c641C158f5e12dB912d',
80
+ '0x3299A525986D2e94B3FC6c641C158f5e12dB912d', // Fluent Pre Deposit Vault (migrated to fluent mainnet)
81
+ // '0x866C6c6627303Be103814150fC0e886BE5D9ea83', // Neutrl Pre Deposit Vault (migrated to Neutrl mainnet)
43
82
  ].map((a) => a.toLowerCase()));
83
+ /**
84
+ * Vault Functions to Call
85
+ */
86
+ /**
87
+ * The functions to call on the vault contract
88
+ * @returns The functions to call
89
+ */
44
90
  exports.VAULT_FUNCTIONS_V1 = [
45
91
  'decimals',
46
92
  'asset',
@@ -70,8 +116,19 @@ exports.VAULT_FUNCTIONS_V2_RECEIPT = [
70
116
  exports.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS = [
71
117
  'getWhitelistedAssets',
72
118
  ];
119
+ /**
120
+ * NEMO ETH Yield vault address (lowercase for comparisons)
121
+ */
73
122
  exports.NEMO_VAULT_ADDRESS = '0xa422c3018c46ba90a14acd14f96cb60616f5c91b';
123
+ /**
124
+ * Subgraph base URL
125
+ * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
126
+ */
74
127
  exports.GOLDSKY_BASE_URL = 'https://api.goldsky.com/api/private/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs';
128
+ /**
129
+ * Subgraph URLs
130
+ * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
131
+ */
75
132
  exports.SUBGRAPH_VAULT_URLS = {
76
133
  testwethtsa: ``,
77
134
  tacusr: `${exports.GOLDSKY_BASE_URL}/august-eth-tacUSR/1.0.0/gn`,
@@ -134,6 +191,10 @@ exports.SUBGRAPH_VAULT_URLS = {
134
191
  predlp: `${exports.GOLDSKY_BASE_URL}/august-eth-preDLP/1.0.0/gn`,
135
192
  'nemo eth yield': `${exports.GOLDSKY_BASE_URL}/august-mainnet-nemo-eth-yield/1.0.0/gn`,
136
193
  };
194
+ /**
195
+ * Vault Symbols Mapping
196
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
197
+ */
137
198
  exports.VAULT_SYMBOLS = {
138
199
  '0xaBC578B79892FC0Dc2906Ab5749862622aD38695': 'preDLP',
139
200
  '0x74aD2F789Ed583DBd141bbdafC673fE1F033718b': 'sentUSD',
@@ -197,5 +258,9 @@ exports.VAULT_SYMBOLS = {
197
258
  '0xb2FdA773822E5a04c8A70348d66257DD5Cf442DB': 'farmBOLD',
198
259
  '0xA422C3018C46ba90a14AcD14f96CB60616F5c91B': 'NEMO ETH Yield',
199
260
  };
261
+ /**
262
+ * Vault Symbols Reverse Mapping
263
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
264
+ */
200
265
  exports.VAULT_SYMBOLS_REVERSE = Object.fromEntries(Object.entries(exports.VAULT_SYMBOLS).map(([key, value]) => [value, key]));
201
266
  //# sourceMappingURL=vaults.js.map
@@ -1,4 +1,4 @@
1
- import { IChainId, IChainObj } from '../../types';
1
+ import type { IChainId, IChainObj } from '../../types';
2
2
  export declare const SPECIAL_CHAINS: {
3
3
  solana: {
4
4
  name: string;
@@ -30,6 +30,9 @@ export declare const ORACLE_CONTRACTS: {
30
30
  };
31
31
  export declare const NETWORKS: Record<IChainId, IChainObj>;
32
32
  export declare const AVAILABLE_CHAINS: IChainId[];
33
+ /**
34
+ * Fallbacks
35
+ */
33
36
  export declare const FALLBACK_DECIMALS = 18;
34
37
  export declare const FALLBACK_CHAINID = 42161;
35
38
  export declare const FALLBACK_RPC_URLS: Record<number, string[]>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FALLBACK_RPC_URLS = exports.FALLBACK_CHAINID = exports.FALLBACK_DECIMALS = exports.AVAILABLE_CHAINS = exports.NETWORKS = exports.ORACLE_CONTRACTS = exports.MIN_ABIS = exports.NATIVE_ADDRESS = exports.SPECIAL_CHAINS = void 0;
4
+ // Special Chains
4
5
  exports.SPECIAL_CHAINS = {
5
6
  solana: {
6
7
  name: 'Solana',
@@ -13,6 +14,7 @@ exports.SPECIAL_CHAINS = {
13
14
  explorer: 'https://stellar.expert',
14
15
  },
15
16
  };
17
+ // General
16
18
  exports.NATIVE_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
17
19
  exports.MIN_ABIS = {
18
20
  name: 'function name() view returns (string)',
@@ -23,13 +25,17 @@ exports.MIN_ABIS = {
23
25
  allowance: 'function allowance(address owner, address spender) external view returns (uint256)',
24
26
  managementFeePercent: 'function managementFeePercent() view returns (uint256)',
25
27
  };
28
+ // Search: New Chain
26
29
  exports.ORACLE_CONTRACTS = {
27
- 1: '0xA4E24C498D5B28517787D8407eFdcB157A4FbF50',
28
- 43114: '0x755537Cb5C76E06Bb492CF7c73567e252769c5f5',
29
- 42161: '0x24F7BC5CA6E4b53cF7311dE1f5bF8Ba528400E1e',
30
- 8453: '0x07858dF2D8D9aB1DCAAA8b743eb80C6250DFA947',
31
- 10: '0xe0049eBCCB23Cb81c3d4C9Fa175b32876b70C2AB',
30
+ 1: '0xA4E24C498D5B28517787D8407eFdcB157A4FbF50', // mainnet
31
+ 43114: '0x755537Cb5C76E06Bb492CF7c73567e252769c5f5', // avax
32
+ 42161: '0x24F7BC5CA6E4b53cF7311dE1f5bF8Ba528400E1e', // arbitrum
33
+ 8453: '0x07858dF2D8D9aB1DCAAA8b743eb80C6250DFA947', // base
34
+ 10: '0xe0049eBCCB23Cb81c3d4C9Fa175b32876b70C2AB', // OP
32
35
  };
36
+ // Networks
37
+ // Search: New Chain
38
+ // @todo: this should be used for wagmi configs
33
39
  exports.NETWORKS = {
34
40
  1: {
35
41
  name: 'Ethereum',
@@ -113,9 +119,13 @@ exports.NETWORKS = {
113
119
  },
114
120
  };
115
121
  exports.AVAILABLE_CHAINS = Object.keys(exports.NETWORKS).map((c) => Number(c));
122
+ /**
123
+ * Fallbacks
124
+ */
116
125
  exports.FALLBACK_DECIMALS = 18;
117
126
  exports.FALLBACK_CHAINID = 42161;
118
127
  exports.FALLBACK_RPC_URLS = {
128
+ // Ethereum Mainnet
119
129
  1: ['https://ethereum-rpc.publicnode.com'],
120
130
  42161: ['https://arbitrum-one-rpc.publicnode.com'],
121
131
  8453: ['https://base-rpc.publicnode.com'],
@@ -1,40 +1,76 @@
1
- export type AugustErrorCode = 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED' | 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'NETWORK_ERROR' | 'TIMEOUT' | 'RATE_LIMITED' | 'SERVER_ERROR' | 'UNKNOWN';
1
+ /**
2
+ * Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
3
+ * which extends the native `Error`.
4
+ *
5
+ * ```ts
6
+ * import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
7
+ *
8
+ * try {
9
+ * await sdk.getVault(...);
10
+ * } catch (err) {
11
+ * if (err instanceof AugustAuthError) refreshKey();
12
+ * else if (err instanceof AugustTimeoutError) retry();
13
+ * else throw err;
14
+ * }
15
+ * ```
16
+ */
17
+ /** Stable error codes attached to SDK errors. */
18
+ export type AugustErrorCode = 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED' | 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'ACCOUNT_NOT_FUNDED' | 'NETWORK_ERROR' | 'TIMEOUT' | 'RATE_LIMITED' | 'SERVER_ERROR' | 'UNKNOWN';
19
+ /** Options accepted by every SDK error constructor. */
2
20
  export interface AugustErrorOptions {
21
+ /** Original error preserved for stack-trace chaining. */
3
22
  cause?: unknown;
23
+ /** Set from the response `x-correlation-id` header when available. */
4
24
  correlationId?: string;
25
+ /** Structured context attached to the error for logging. */
5
26
  context?: Record<string, unknown>;
6
27
  }
28
+ /** Base class for all SDK errors. */
7
29
  export declare class AugustSDKError extends Error {
8
30
  readonly code: AugustErrorCode;
9
31
  readonly correlationId?: string;
10
32
  readonly context?: Record<string, unknown>;
11
33
  constructor(code: AugustErrorCode, message: string, options?: AugustErrorOptions);
34
+ /**
35
+ * Serialize own properties to a plain object. Native `Error` enumerates
36
+ * nothing, so `JSON.stringify(err)` returns `"{}"` without this.
37
+ */
12
38
  toJSON(): Record<string, unknown>;
13
39
  }
40
+ /** Authentication/authorization failure: missing key, invalid key, forbidden. */
14
41
  export declare class AugustAuthError extends AugustSDKError {
15
42
  constructor(code: Extract<AugustErrorCode, 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED'>, message: string, options?: AugustErrorOptions);
16
43
  }
44
+ /** Network-level failure: connection refused, DNS, fetch failed. */
17
45
  export declare class AugustNetworkError extends AugustSDKError {
18
46
  constructor(message: string, options?: AugustErrorOptions);
19
47
  }
48
+ /** Request exceeded its deadline. */
20
49
  export declare class AugustTimeoutError extends AugustSDKError {
50
+ /** Time elapsed (ms) before the request was aborted. */
21
51
  readonly timeoutMs: number;
22
52
  constructor(message: string, timeoutMs: number, options?: AugustErrorOptions);
23
53
  toJSON(): Record<string, unknown>;
24
54
  }
55
+ /** Caller-side input failed validation. */
25
56
  export declare class AugustValidationError extends AugustSDKError {
26
- constructor(code: Extract<AugustErrorCode, 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS'>, message: string, options?: AugustErrorOptions);
57
+ constructor(code: Extract<AugustErrorCode, 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'ACCOUNT_NOT_FUNDED'>, message: string, options?: AugustErrorOptions);
27
58
  }
59
+ /** Backend rate-limited the request (HTTP 429 or equivalent). */
28
60
  export declare class AugustRateLimitError extends AugustSDKError {
61
+ /** Suggested wait before retrying, in milliseconds. */
29
62
  readonly retryAfterMs?: number;
30
63
  constructor(message: string, options?: AugustErrorOptions & {
31
64
  retryAfterMs?: number;
32
65
  });
33
66
  toJSON(): Record<string, unknown>;
34
67
  }
68
+ /** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
35
69
  export declare class AugustServerError extends AugustSDKError {
70
+ /** HTTP status code returned by the backend. */
36
71
  readonly status: number;
37
72
  constructor(status: number, message: string, options?: AugustErrorOptions);
38
73
  toJSON(): Record<string, unknown>;
39
74
  }
75
+ /** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
40
76
  export declare function isAugustSDKError(err: unknown): err is AugustSDKError;
@@ -1,8 +1,28 @@
1
1
  "use strict";
2
+ /**
3
+ * Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
4
+ * which extends the native `Error`.
5
+ *
6
+ * ```ts
7
+ * import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
8
+ *
9
+ * try {
10
+ * await sdk.getVault(...);
11
+ * } catch (err) {
12
+ * if (err instanceof AugustAuthError) refreshKey();
13
+ * else if (err instanceof AugustTimeoutError) retry();
14
+ * else throw err;
15
+ * }
16
+ * ```
17
+ */
2
18
  Object.defineProperty(exports, "__esModule", { value: true });
3
19
  exports.AugustServerError = exports.AugustRateLimitError = exports.AugustValidationError = exports.AugustTimeoutError = exports.AugustNetworkError = exports.AugustAuthError = exports.AugustSDKError = void 0;
4
20
  exports.isAugustSDKError = isAugustSDKError;
21
+ /** Base class for all SDK errors. */
5
22
  class AugustSDKError extends Error {
23
+ code;
24
+ correlationId;
25
+ context;
6
26
  constructor(code, message, options = {}) {
7
27
  super(message);
8
28
  this.name = 'AugustSDKError';
@@ -12,8 +32,13 @@ class AugustSDKError extends Error {
12
32
  if (options.cause !== undefined) {
13
33
  this.cause = options.cause;
14
34
  }
35
+ // Restore prototype chain for transpilation targets that downlevel `extends Error`.
15
36
  Object.setPrototypeOf(this, new.target.prototype);
16
37
  }
38
+ /**
39
+ * Serialize own properties to a plain object. Native `Error` enumerates
40
+ * nothing, so `JSON.stringify(err)` returns `"{}"` without this.
41
+ */
17
42
  toJSON() {
18
43
  const out = {
19
44
  name: this.name,
@@ -37,6 +62,7 @@ class AugustSDKError extends Error {
37
62
  }
38
63
  }
39
64
  exports.AugustSDKError = AugustSDKError;
65
+ /** Authentication/authorization failure: missing key, invalid key, forbidden. */
40
66
  class AugustAuthError extends AugustSDKError {
41
67
  constructor(code, message, options) {
42
68
  super(code, message, options);
@@ -44,6 +70,7 @@ class AugustAuthError extends AugustSDKError {
44
70
  }
45
71
  }
46
72
  exports.AugustAuthError = AugustAuthError;
73
+ /** Network-level failure: connection refused, DNS, fetch failed. */
47
74
  class AugustNetworkError extends AugustSDKError {
48
75
  constructor(message, options) {
49
76
  super('NETWORK_ERROR', message, options);
@@ -51,7 +78,10 @@ class AugustNetworkError extends AugustSDKError {
51
78
  }
52
79
  }
53
80
  exports.AugustNetworkError = AugustNetworkError;
81
+ /** Request exceeded its deadline. */
54
82
  class AugustTimeoutError extends AugustSDKError {
83
+ /** Time elapsed (ms) before the request was aborted. */
84
+ timeoutMs;
55
85
  constructor(message, timeoutMs, options) {
56
86
  super('TIMEOUT', message, options);
57
87
  this.name = 'AugustTimeoutError';
@@ -62,6 +92,7 @@ class AugustTimeoutError extends AugustSDKError {
62
92
  }
63
93
  }
64
94
  exports.AugustTimeoutError = AugustTimeoutError;
95
+ /** Caller-side input failed validation. */
65
96
  class AugustValidationError extends AugustSDKError {
66
97
  constructor(code, message, options) {
67
98
  super(code, message, options);
@@ -69,7 +100,10 @@ class AugustValidationError extends AugustSDKError {
69
100
  }
70
101
  }
71
102
  exports.AugustValidationError = AugustValidationError;
103
+ /** Backend rate-limited the request (HTTP 429 or equivalent). */
72
104
  class AugustRateLimitError extends AugustSDKError {
105
+ /** Suggested wait before retrying, in milliseconds. */
106
+ retryAfterMs;
73
107
  constructor(message, options) {
74
108
  super('RATE_LIMITED', message, options);
75
109
  this.name = 'AugustRateLimitError';
@@ -83,7 +117,10 @@ class AugustRateLimitError extends AugustSDKError {
83
117
  }
84
118
  }
85
119
  exports.AugustRateLimitError = AugustRateLimitError;
120
+ /** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
86
121
  class AugustServerError extends AugustSDKError {
122
+ /** HTTP status code returned by the backend. */
123
+ status;
87
124
  constructor(status, message, options) {
88
125
  super('SERVER_ERROR', message, options);
89
126
  this.name = 'AugustServerError';
@@ -94,6 +131,7 @@ class AugustServerError extends AugustSDKError {
94
131
  }
95
132
  }
96
133
  exports.AugustServerError = AugustServerError;
134
+ /** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
97
135
  function isAugustSDKError(err) {
98
136
  return (err instanceof AugustSDKError ||
99
137
  (err instanceof Error &&