@augustdigital/sdk 8.12.0 → 8.14.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.
@@ -328,6 +328,59 @@ export declare class AugustVaults extends AugustBase {
328
328
  untilTs?: number;
329
329
  types?: IVaultUserHistoryItem['type'][];
330
330
  }): Promise<IVaultUserHistoryItem[]>;
331
+ /**
332
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
333
+ * chain — the any-token set a deposit UI can offer as swap-and-deposit inputs,
334
+ * each verified `true` against the router's on-chain allowlist.
335
+ *
336
+ * Reconstructs the set from the router's `TokenEnabled` event history and
337
+ * re-checks `whitelistedTokens(token)` for each (the mapping is not
338
+ * enumerable). See {@link getSwapRouterWhitelistedTokens} for the full
339
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
340
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
341
+ * provider is configured.
342
+ *
343
+ * @param chainId - EVM chain ID to resolve the allowlist for.
344
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
345
+ * @returns Checksummed whitelisted token addresses; `[]` when unavailable.
346
+ * Callers still exclude a target vault's natively-accepted assets (those
347
+ * deposit without a swap).
348
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
349
+ * @example
350
+ * ```ts
351
+ * const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
352
+ * ```
353
+ */
354
+ getSwapRouterWhitelistedTokens(chainId: number, options?: {
355
+ fromBlock?: number;
356
+ }): Promise<IAddress[]>;
357
+ /**
358
+ * Resolve the vaults currently eligible for the any-token `SwapRouter`
359
+ * deposit surface on a chain — every vault the router has `enableVault`-ed
360
+ * whose on-chain registration is still live.
361
+ *
362
+ * Reconstructs the set from the router's `VaultEnabled` event history and
363
+ * re-checks `vaultInfo(vault).referenceAsset != 0` for each (the mapping is
364
+ * not enumerable). See {@link getSwapRouterEligibleVaults} for the full
365
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
366
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
367
+ * provider is configured.
368
+ *
369
+ * On-chain eligibility only — app-level policy (e.g. excluding vaults with
370
+ * their own OVault deposit flow) remains the caller's responsibility.
371
+ *
372
+ * @param chainId - EVM chain ID to resolve eligible vaults for.
373
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
374
+ * @returns Checksummed eligible vault addresses; `[]` when unavailable.
375
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
376
+ * @example
377
+ * ```ts
378
+ * const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
379
+ * ```
380
+ */
381
+ getSwapRouterEligibleVaults(chainId: number, options?: {
382
+ fromBlock?: number;
383
+ }): Promise<IAddress[]>;
331
384
  /**
332
385
  * @function getStakingPositions gets all available reward staking positions
333
386
  * @param wallet optionally passed user wallet address
@@ -1070,6 +1070,79 @@ class AugustVaults extends core_1.AugustBase {
1070
1070
  return true;
1071
1071
  });
1072
1072
  }
1073
+ /**
1074
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
1075
+ * chain — the any-token set a deposit UI can offer as swap-and-deposit inputs,
1076
+ * each verified `true` against the router's on-chain allowlist.
1077
+ *
1078
+ * Reconstructs the set from the router's `TokenEnabled` event history and
1079
+ * re-checks `whitelistedTokens(token)` for each (the mapping is not
1080
+ * enumerable). See {@link getSwapRouterWhitelistedTokens} for the full
1081
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
1082
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
1083
+ * provider is configured.
1084
+ *
1085
+ * @param chainId - EVM chain ID to resolve the allowlist for.
1086
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
1087
+ * @returns Checksummed whitelisted token addresses; `[]` when unavailable.
1088
+ * Callers still exclude a target vault's natively-accepted assets (those
1089
+ * deposit without a swap).
1090
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
1091
+ * @example
1092
+ * ```ts
1093
+ * const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
1094
+ * ```
1095
+ */
1096
+ async getSwapRouterWhitelistedTokens(chainId, options) {
1097
+ if (!(0, core_1.getSwapRouterAddress)(chainId))
1098
+ return [];
1099
+ const rpcUrl = this.providers?.[chainId];
1100
+ if (!rpcUrl) {
1101
+ core_1.Logger.log.warn('getSwapRouterWhitelistedTokens', `no provider configured for chain ${chainId}`);
1102
+ return [];
1103
+ }
1104
+ return (0, core_1.getSwapRouterWhitelistedTokens)(chainId, {
1105
+ rpcUrl,
1106
+ fromBlock: options?.fromBlock,
1107
+ });
1108
+ }
1109
+ /**
1110
+ * Resolve the vaults currently eligible for the any-token `SwapRouter`
1111
+ * deposit surface on a chain — every vault the router has `enableVault`-ed
1112
+ * whose on-chain registration is still live.
1113
+ *
1114
+ * Reconstructs the set from the router's `VaultEnabled` event history and
1115
+ * re-checks `vaultInfo(vault).referenceAsset != 0` for each (the mapping is
1116
+ * not enumerable). See {@link getSwapRouterEligibleVaults} for the full
1117
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
1118
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
1119
+ * provider is configured.
1120
+ *
1121
+ * On-chain eligibility only — app-level policy (e.g. excluding vaults with
1122
+ * their own OVault deposit flow) remains the caller's responsibility.
1123
+ *
1124
+ * @param chainId - EVM chain ID to resolve eligible vaults for.
1125
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
1126
+ * @returns Checksummed eligible vault addresses; `[]` when unavailable.
1127
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
1128
+ * @example
1129
+ * ```ts
1130
+ * const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
1131
+ * ```
1132
+ */
1133
+ async getSwapRouterEligibleVaults(chainId, options) {
1134
+ if (!(0, core_1.getSwapRouterAddress)(chainId))
1135
+ return [];
1136
+ const rpcUrl = this.providers?.[chainId];
1137
+ if (!rpcUrl) {
1138
+ core_1.Logger.log.warn('getSwapRouterEligibleVaults', `no provider configured for chain ${chainId}`);
1139
+ return [];
1140
+ }
1141
+ return (0, core_1.getSwapRouterEligibleVaults)(chainId, {
1142
+ rpcUrl,
1143
+ fromBlock: options?.fromBlock,
1144
+ });
1145
+ }
1073
1146
  /**
1074
1147
  * @function getStakingPositions gets all available reward staking positions
1075
1148
  * @param wallet optionally passed user wallet address
@@ -353,10 +353,10 @@ function buildBackendVault(tokenizedVault, overrides) {
353
353
  fees: {
354
354
  performance: tokenizedVault.weekly_performance_fee_bps || 0,
355
355
  management: tokenizedVault.platform_fee_override?.management_fee || 0,
356
- isManagementWaived: false,
356
+ isManagementWaived: (0, vaults_1.resolveFeeWaived)(tokenizedVault.platform_fee_override?.is_fee_waived ?? false, tokenizedVault.management_fee_waived_until_date ?? null, tokenizedVault.management_fee_waived_until_tvl ?? null),
357
357
  managementFeeWaivedUntilDate: tokenizedVault.management_fee_waived_until_date ?? null,
358
358
  managementFeeWaivedUntilTvl: tokenizedVault.management_fee_waived_until_tvl ?? null,
359
- isPerformanceWaived: false,
359
+ isPerformanceWaived: (0, vaults_1.resolveFeeWaived)(tokenizedVault.platform_fee_override?.is_fee_waived ?? false, tokenizedVault.performance_fee_waived_until_date ?? null, tokenizedVault.performance_fee_waived_until_tvl ?? null),
360
360
  performanceFeeWaivedUntilDate: tokenizedVault.performance_fee_waived_until_date ?? null,
361
361
  performanceFeeWaivedUntilTvl: tokenizedVault.performance_fee_waived_until_tvl ?? null,
362
362
  },
@@ -466,10 +466,10 @@ async function buildFormattedVault(provider, tokenizedVault, contractCalls) {
466
466
  fees: {
467
467
  performance: tokenizedVault.weekly_performance_fee_bps,
468
468
  management: tokenizedVault.platform_fee_override.management_fee,
469
- isManagementWaived: tokenizedVault.platform_fee_override.is_fee_waived,
469
+ isManagementWaived: (0, vaults_1.resolveFeeWaived)(tokenizedVault.platform_fee_override.is_fee_waived, tokenizedVault.management_fee_waived_until_date, tokenizedVault.management_fee_waived_until_tvl),
470
470
  managementFeeWaivedUntilDate: tokenizedVault.management_fee_waived_until_date,
471
471
  managementFeeWaivedUntilTvl: tokenizedVault.management_fee_waived_until_tvl,
472
- isPerformanceWaived: tokenizedVault.platform_fee_override.is_fee_waived,
472
+ isPerformanceWaived: (0, vaults_1.resolveFeeWaived)(tokenizedVault.platform_fee_override.is_fee_waived, tokenizedVault.performance_fee_waived_until_date, tokenizedVault.performance_fee_waived_until_tvl),
473
473
  performanceFeeWaivedUntilDate: tokenizedVault.performance_fee_waived_until_date,
474
474
  performanceFeeWaivedUntilTvl: tokenizedVault.performance_fee_waived_until_tvl,
475
475
  },