@axonfi/sdk 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3151,7 +3151,9 @@ function toBotConfigParams(input) {
3151
3151
  for (const sl of input.spendingLimits) {
3152
3152
  if (!ALLOWED_WINDOWS.has(BigInt(sl.windowSeconds))) {
3153
3153
  const allowed = [...ALLOWED_WINDOWS].map((w) => `${Number(w)}s`).join(", ");
3154
- throw new Error(`Invalid spending window: ${sl.windowSeconds}s. Allowed values: ${allowed}. Use WINDOW constants.`);
3154
+ throw new Error(
3155
+ `Invalid spending window: ${sl.windowSeconds}s. Allowed values: ${allowed}. Use WINDOW constants.`
3156
+ );
3155
3157
  }
3156
3158
  }
3157
3159
  return {
@@ -3224,7 +3226,11 @@ async function getOperatorCeilings(publicClient, vaultAddress) {
3224
3226
  }
3225
3227
  function operatorMaxDrainPerDay(ceilings) {
3226
3228
  const { maxOperatorBots, maxBotDailyLimit, vaultDailyAggregate } = ceilings;
3227
- if (maxOperatorBots === 0n || maxBotDailyLimit === 0n) return 0;
3229
+ if (maxOperatorBots === 0n) return 0;
3230
+ if (maxBotDailyLimit === 0n) {
3231
+ if (vaultDailyAggregate > 0n) return Number(vaultDailyAggregate) / 1e6;
3232
+ return Infinity;
3233
+ }
3228
3234
  const theoretical = maxOperatorBots * maxBotDailyLimit;
3229
3235
  const raw = vaultDailyAggregate > 0n && vaultDailyAggregate < theoretical ? vaultDailyAggregate : theoretical;
3230
3236
  return Number(raw) / 1e6;