@axonfi/sdk 0.12.0 → 0.13.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.
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1016,6 +1016,19 @@ declare function getBotConfig(publicClient: PublicClient, vaultAddress: Address,
|
|
|
1016
1016
|
declare function isBotActive(publicClient: PublicClient, vaultAddress: Address, botAddress: Address): Promise<boolean>;
|
|
1017
1017
|
/** Returns the operator ceilings set by the vault owner. */
|
|
1018
1018
|
declare function getOperatorCeilings(publicClient: PublicClient, vaultAddress: Address): Promise<OperatorCeilings>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Computes the maximum USD an operator-compromised wallet could drain per day.
|
|
1021
|
+
* Pure computation from operator ceilings — no RPC call needed.
|
|
1022
|
+
*
|
|
1023
|
+
* Formula: `min(maxOperatorBots × maxBotDailyLimit, vaultDailyAggregate)`.
|
|
1024
|
+
* Returns `0` if the operator has no bot-add permission (`maxOperatorBots === 0`).
|
|
1025
|
+
*
|
|
1026
|
+
* Returns a human-readable USD number (e.g. `1000` for $1,000).
|
|
1027
|
+
*
|
|
1028
|
+
* This is accurate because the contract enforces that sub-daily spending windows
|
|
1029
|
+
* cannot exceed `maxBotDailyLimit` when extrapolated to 24 hours.
|
|
1030
|
+
*/
|
|
1031
|
+
declare function operatorMaxDrainPerDay(ceilings: OperatorCeilings): number;
|
|
1019
1032
|
/**
|
|
1020
1033
|
* Returns whether ERC-1271 bot signatures are enabled on the vault.
|
|
1021
1034
|
*
|
|
@@ -3747,4 +3760,4 @@ declare const AxonRegistryAbi: readonly [{
|
|
|
3747
3760
|
readonly inputs: readonly [];
|
|
3748
3761
|
}];
|
|
3749
3762
|
|
|
3750
|
-
export { ALLOWED_WINDOWS, type AmountInput, AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigInput, type BotConfigParams, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, type Permit2Authorization, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SpendingLimitInput, type SupportedChainId, type SwapInput, type SwapIntent, Token, type TokenInput, type TosStatus, type TransferAuthorization, USDC, USDC_EIP712_DOMAIN, type VaultInfo, WINDOW, WITNESS_TYPE_STRING, type X402HandleResult, type X402PaymentOption, type X402PaymentRequired, type X402Resource, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
|
3763
|
+
export { ALLOWED_WINDOWS, type AmountInput, AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigInput, type BotConfigParams, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, type Permit2Authorization, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SpendingLimitInput, type SupportedChainId, type SwapInput, type SwapIntent, Token, type TokenInput, type TosStatus, type TransferAuthorization, USDC, USDC_EIP712_DOMAIN, type VaultInfo, WINDOW, WITNESS_TYPE_STRING, type X402HandleResult, type X402PaymentOption, type X402PaymentRequired, type X402Resource, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1016,6 +1016,19 @@ declare function getBotConfig(publicClient: PublicClient, vaultAddress: Address,
|
|
|
1016
1016
|
declare function isBotActive(publicClient: PublicClient, vaultAddress: Address, botAddress: Address): Promise<boolean>;
|
|
1017
1017
|
/** Returns the operator ceilings set by the vault owner. */
|
|
1018
1018
|
declare function getOperatorCeilings(publicClient: PublicClient, vaultAddress: Address): Promise<OperatorCeilings>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Computes the maximum USD an operator-compromised wallet could drain per day.
|
|
1021
|
+
* Pure computation from operator ceilings — no RPC call needed.
|
|
1022
|
+
*
|
|
1023
|
+
* Formula: `min(maxOperatorBots × maxBotDailyLimit, vaultDailyAggregate)`.
|
|
1024
|
+
* Returns `0` if the operator has no bot-add permission (`maxOperatorBots === 0`).
|
|
1025
|
+
*
|
|
1026
|
+
* Returns a human-readable USD number (e.g. `1000` for $1,000).
|
|
1027
|
+
*
|
|
1028
|
+
* This is accurate because the contract enforces that sub-daily spending windows
|
|
1029
|
+
* cannot exceed `maxBotDailyLimit` when extrapolated to 24 hours.
|
|
1030
|
+
*/
|
|
1031
|
+
declare function operatorMaxDrainPerDay(ceilings: OperatorCeilings): number;
|
|
1019
1032
|
/**
|
|
1020
1033
|
* Returns whether ERC-1271 bot signatures are enabled on the vault.
|
|
1021
1034
|
*
|
|
@@ -3747,4 +3760,4 @@ declare const AxonRegistryAbi: readonly [{
|
|
|
3747
3760
|
readonly inputs: readonly [];
|
|
3748
3761
|
}];
|
|
3749
3762
|
|
|
3750
|
-
export { ALLOWED_WINDOWS, type AmountInput, AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigInput, type BotConfigParams, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, type Permit2Authorization, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SpendingLimitInput, type SupportedChainId, type SwapInput, type SwapIntent, Token, type TokenInput, type TosStatus, type TransferAuthorization, USDC, USDC_EIP712_DOMAIN, type VaultInfo, WINDOW, WITNESS_TYPE_STRING, type X402HandleResult, type X402PaymentOption, type X402PaymentRequired, type X402Resource, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
|
3763
|
+
export { ALLOWED_WINDOWS, type AmountInput, AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigInput, type BotConfigParams, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, type Permit2Authorization, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SpendingLimitInput, type SupportedChainId, type SwapInput, type SwapIntent, Token, type TokenInput, type TosStatus, type TransferAuthorization, USDC, USDC_EIP712_DOMAIN, type VaultInfo, WINDOW, WITNESS_TYPE_STRING, type X402HandleResult, type X402PaymentOption, type X402PaymentRequired, type X402Resource, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
package/dist/index.js
CHANGED
|
@@ -3222,6 +3222,13 @@ async function getOperatorCeilings(publicClient, vaultAddress) {
|
|
|
3222
3222
|
minAiTriggerFloor
|
|
3223
3223
|
};
|
|
3224
3224
|
}
|
|
3225
|
+
function operatorMaxDrainPerDay(ceilings) {
|
|
3226
|
+
const { maxOperatorBots, maxBotDailyLimit, vaultDailyAggregate } = ceilings;
|
|
3227
|
+
if (maxOperatorBots === 0n || maxBotDailyLimit === 0n) return 0;
|
|
3228
|
+
const theoretical = maxOperatorBots * maxBotDailyLimit;
|
|
3229
|
+
const raw = vaultDailyAggregate > 0n && vaultDailyAggregate < theoretical ? vaultDailyAggregate : theoretical;
|
|
3230
|
+
return Number(raw) / 1e6;
|
|
3231
|
+
}
|
|
3225
3232
|
async function isErc1271BotsEnabled(publicClient, vaultAddress) {
|
|
3226
3233
|
return publicClient.readContract({
|
|
3227
3234
|
address: vaultAddress,
|
|
@@ -4938,6 +4945,6 @@ var AxonRegistryAbi = [
|
|
|
4938
4945
|
}
|
|
4939
4946
|
];
|
|
4940
4947
|
|
|
4941
|
-
export { ALLOWED_WINDOWS, AxonClient, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, KNOWN_TOKENS, NATIVE_ETH, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, USDC_EIP712_DOMAIN, WINDOW, WITNESS_TYPE_STRING, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
|
4948
|
+
export { ALLOWED_WINDOWS, AxonClient, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, KNOWN_TOKENS, NATIVE_ETH, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, USDC_EIP712_DOMAIN, WINDOW, WITNESS_TYPE_STRING, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
|
4942
4949
|
//# sourceMappingURL=index.js.map
|
|
4943
4950
|
//# sourceMappingURL=index.js.map
|