@axonfi/sdk 0.11.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 +6 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +6 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1017,11 +1017,18 @@ declare function isBotActive(publicClient: PublicClient, vaultAddress: Address,
|
|
|
1017
1017
|
/** Returns the operator ceilings set by the vault owner. */
|
|
1018
1018
|
declare function getOperatorCeilings(publicClient: PublicClient, vaultAddress: Address): Promise<OperatorCeilings>;
|
|
1019
1019
|
/**
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
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.
|
|
1023
1030
|
*/
|
|
1024
|
-
declare function operatorMaxDrainPerDay(
|
|
1031
|
+
declare function operatorMaxDrainPerDay(ceilings: OperatorCeilings): number;
|
|
1025
1032
|
/**
|
|
1026
1033
|
* Returns whether ERC-1271 bot signatures are enabled on the vault.
|
|
1027
1034
|
*
|
|
@@ -2067,16 +2074,6 @@ declare const AxonVaultAbi: readonly [{
|
|
|
2067
2074
|
readonly internalType: "uint256";
|
|
2068
2075
|
}];
|
|
2069
2076
|
readonly stateMutability: "view";
|
|
2070
|
-
}, {
|
|
2071
|
-
readonly type: "function";
|
|
2072
|
-
readonly name: "operatorMaxDrainPerDay";
|
|
2073
|
-
readonly inputs: readonly [];
|
|
2074
|
-
readonly outputs: readonly [{
|
|
2075
|
-
readonly name: "";
|
|
2076
|
-
readonly type: "uint256";
|
|
2077
|
-
readonly internalType: "uint256";
|
|
2078
|
-
}];
|
|
2079
|
-
readonly stateMutability: "view";
|
|
2080
2077
|
}, {
|
|
2081
2078
|
readonly type: "function";
|
|
2082
2079
|
readonly name: "owner";
|
package/dist/index.d.ts
CHANGED
|
@@ -1017,11 +1017,18 @@ declare function isBotActive(publicClient: PublicClient, vaultAddress: Address,
|
|
|
1017
1017
|
/** Returns the operator ceilings set by the vault owner. */
|
|
1018
1018
|
declare function getOperatorCeilings(publicClient: PublicClient, vaultAddress: Address): Promise<OperatorCeilings>;
|
|
1019
1019
|
/**
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
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.
|
|
1023
1030
|
*/
|
|
1024
|
-
declare function operatorMaxDrainPerDay(
|
|
1031
|
+
declare function operatorMaxDrainPerDay(ceilings: OperatorCeilings): number;
|
|
1025
1032
|
/**
|
|
1026
1033
|
* Returns whether ERC-1271 bot signatures are enabled on the vault.
|
|
1027
1034
|
*
|
|
@@ -2067,16 +2074,6 @@ declare const AxonVaultAbi: readonly [{
|
|
|
2067
2074
|
readonly internalType: "uint256";
|
|
2068
2075
|
}];
|
|
2069
2076
|
readonly stateMutability: "view";
|
|
2070
|
-
}, {
|
|
2071
|
-
readonly type: "function";
|
|
2072
|
-
readonly name: "operatorMaxDrainPerDay";
|
|
2073
|
-
readonly inputs: readonly [];
|
|
2074
|
-
readonly outputs: readonly [{
|
|
2075
|
-
readonly name: "";
|
|
2076
|
-
readonly type: "uint256";
|
|
2077
|
-
readonly internalType: "uint256";
|
|
2078
|
-
}];
|
|
2079
|
-
readonly stateMutability: "view";
|
|
2080
2077
|
}, {
|
|
2081
2078
|
readonly type: "function";
|
|
2082
2079
|
readonly name: "owner";
|
package/dist/index.js
CHANGED
|
@@ -1201,19 +1201,6 @@ var AxonVaultAbi = [
|
|
|
1201
1201
|
],
|
|
1202
1202
|
"stateMutability": "view"
|
|
1203
1203
|
},
|
|
1204
|
-
{
|
|
1205
|
-
"type": "function",
|
|
1206
|
-
"name": "operatorMaxDrainPerDay",
|
|
1207
|
-
"inputs": [],
|
|
1208
|
-
"outputs": [
|
|
1209
|
-
{
|
|
1210
|
-
"name": "",
|
|
1211
|
-
"type": "uint256",
|
|
1212
|
-
"internalType": "uint256"
|
|
1213
|
-
}
|
|
1214
|
-
],
|
|
1215
|
-
"stateMutability": "view"
|
|
1216
|
-
},
|
|
1217
1204
|
{
|
|
1218
1205
|
"type": "function",
|
|
1219
1206
|
"name": "owner",
|
|
@@ -3235,12 +3222,12 @@ async function getOperatorCeilings(publicClient, vaultAddress) {
|
|
|
3235
3222
|
minAiTriggerFloor
|
|
3236
3223
|
};
|
|
3237
3224
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
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;
|
|
3244
3231
|
}
|
|
3245
3232
|
async function isErc1271BotsEnabled(publicClient, vaultAddress) {
|
|
3246
3233
|
return publicClient.readContract({
|