@axonfi/sdk 0.6.0 → 0.7.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/README.md CHANGED
@@ -318,6 +318,31 @@ await axon.getVaultInfo(); // owner, operator, version
318
318
  await axon.canPayTo('0xRecipient'); // destination allowed?
319
319
  ```
320
320
 
321
+ ### ERC-1271 Bot Signatures (External Protocol Signing)
322
+
323
+ By default, only the vault owner's signatures are accepted by external protocols that check ERC-1271 (e.g., Permit2, Cowswap, Seaport). Bot signatures are rejected.
324
+
325
+ If your bot needs to sign messages that external protocols validate against the vault (e.g., signing a Cowswap order, a Permit2 approval, or a Seaport listing), the vault owner must explicitly enable bot signing:
326
+
327
+ ```typescript
328
+ // Check if ERC-1271 bot signing is enabled (direct chain read)
329
+ import { isErc1271BotsEnabled, createAxonPublicClient } from '@axonfi/sdk';
330
+
331
+ const publicClient = createAxonPublicClient(chainId, rpcUrl);
332
+ const enabled = await isErc1271BotsEnabled(publicClient, vaultAddress);
333
+
334
+ if (!enabled) {
335
+ console.log('ERC-1271 bot signatures are disabled on this vault.');
336
+ console.log('The vault owner must enable it via the dashboard or by calling setErc1271Bots(true).');
337
+ }
338
+ ```
339
+
340
+ **When to enable:** Only if your bots interact with protocols that verify signatures via ERC-1271 — Cowswap (off-chain order signing), Permit2 (gasless token approvals), Seaport (NFT marketplace listings).
341
+
342
+ **When to keep disabled (default):** If your bots only make payments, execute DeFi calls, or rebalance tokens through Axon's standard `pay()` / `execute()` / `swap()` endpoints.
343
+
344
+ **Security note:** If a bot key is compromised while ERC-1271 is enabled, the attacker could sign Permit2 approvals or marketplace listings that drain vault funds. The owner can disable it instantly via the dashboard or `setErc1271Bots(false)`.
345
+
321
346
  ### Utilities
322
347
 
323
348
  Helper functions for amount conversion, token resolution, and reference encoding.
@@ -366,7 +391,7 @@ Supports EIP-3009 (USDC, gasless) and Permit2 (any ERC-20) settlement schemes.
366
391
  ## Security Model
367
392
 
368
393
  - **Owners** control everything: bot whitelist, spending limits, withdrawal. Hardware wallet recommended.
369
- - **Bots** only sign payment intents. They never hold ETH, never submit transactions, and can be removed instantly.
394
+ - **Bots** only sign payment intents. They never hold ETH, never submit transactions, and can be removed instantly. External protocol signing (ERC-1271) is disabled by default — must be explicitly enabled by the owner.
370
395
  - **Relayer** (Axon) can only execute bot-signed intents within configured limits. Cannot withdraw or modify vault config.
371
396
  - **If Axon goes offline**, the owner retains full withdrawal access directly through the on-chain vault contract.
372
397
 
package/dist/index.cjs CHANGED
@@ -1057,6 +1057,32 @@ var AxonVaultAbi = [
1057
1057
  ],
1058
1058
  "stateMutability": "view"
1059
1059
  },
1060
+ {
1061
+ "type": "function",
1062
+ "name": "erc1271BotsEnabled",
1063
+ "inputs": [],
1064
+ "outputs": [
1065
+ {
1066
+ "name": "",
1067
+ "type": "bool",
1068
+ "internalType": "bool"
1069
+ }
1070
+ ],
1071
+ "stateMutability": "view"
1072
+ },
1073
+ {
1074
+ "type": "function",
1075
+ "name": "setErc1271Bots",
1076
+ "inputs": [
1077
+ {
1078
+ "name": "enabled",
1079
+ "type": "bool",
1080
+ "internalType": "bool"
1081
+ }
1082
+ ],
1083
+ "outputs": [],
1084
+ "stateMutability": "nonpayable"
1085
+ },
1060
1086
  {
1061
1087
  "type": "function",
1062
1088
  "name": "onERC1155BatchReceived",
@@ -1656,6 +1682,19 @@ var AxonVaultAbi = [
1656
1682
  "outputs": [],
1657
1683
  "stateMutability": "nonpayable"
1658
1684
  },
1685
+ {
1686
+ "type": "event",
1687
+ "name": "ERC1271BotsToggled",
1688
+ "inputs": [
1689
+ {
1690
+ "name": "enabled",
1691
+ "type": "bool",
1692
+ "indexed": false,
1693
+ "internalType": "bool"
1694
+ }
1695
+ ],
1696
+ "anonymous": false
1697
+ },
1659
1698
  {
1660
1699
  "type": "event",
1661
1700
  "name": "BotAdded",
@@ -2097,6 +2136,12 @@ var AxonVaultAbi = [
2097
2136
  "indexed": false,
2098
2137
  "internalType": "uint256"
2099
2138
  },
2139
+ {
2140
+ "name": "value",
2141
+ "type": "uint256",
2142
+ "indexed": false,
2143
+ "internalType": "uint256"
2144
+ },
2100
2145
  {
2101
2146
  "name": "ref",
2102
2147
  "type": "bytes32",
@@ -3270,6 +3315,13 @@ async function operatorMaxDrainPerDay(publicClient, vaultAddress) {
3270
3315
  functionName: "operatorMaxDrainPerDay"
3271
3316
  });
3272
3317
  }
3318
+ async function isErc1271BotsEnabled(publicClient, vaultAddress) {
3319
+ return publicClient.readContract({
3320
+ address: vaultAddress,
3321
+ abi: AxonVaultAbi,
3322
+ functionName: "erc1271BotsEnabled"
3323
+ });
3324
+ }
3273
3325
  async function isVaultPaused(publicClient, vaultAddress) {
3274
3326
  return publicClient.readContract({
3275
3327
  address: vaultAddress,
@@ -4961,6 +5013,7 @@ exports.getVaultOwner = getVaultOwner;
4961
5013
  exports.getVaultVersion = getVaultVersion;
4962
5014
  exports.isBotActive = isBotActive;
4963
5015
  exports.isDestinationAllowed = isDestinationAllowed;
5016
+ exports.isErc1271BotsEnabled = isErc1271BotsEnabled;
4964
5017
  exports.isRebalanceTokenWhitelisted = isRebalanceTokenWhitelisted;
4965
5018
  exports.isVaultPaused = isVaultPaused;
4966
5019
  exports.operatorMaxDrainPerDay = operatorMaxDrainPerDay;