@axonfi/sdk 0.2.0 → 0.2.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/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # @axonfi/sdk
2
2
 
3
+ Give your AI agents a wallet they can't drain.
4
+
3
5
  Treasury and payment infrastructure for autonomous AI agents. Non-custodial vaults, gasless bots, AI verification.
4
6
 
5
- ## Why Axon
7
+ ## Why Axon Finance
6
8
 
7
9
  Giving bots funded wallets is risky: scattered keys, no spending controls, one compromised key drains everything. Axon flips this model:
8
10
 
9
- - **Non-custodial vaults** — each Principal deploys their own vault. Only the owner can withdraw. Enforced on-chain.
11
+ - **Non-custodial vaults** — each owner deploys their own vault. Only the owner can withdraw. Enforced on-chain.
10
12
  - **Bounded risk** — per-tx caps, daily limits, velocity windows, destination whitelists. Bots can only operate within the policies you set.
11
13
  - **AI verification** — 3-agent LLM consensus (safety, behavioral, reasoning) for flagged transactions. 2/3 consensus required.
12
14
  - **Gasless bots** — bots sign EIP-712 intents off-chain. Axon's relayer handles gas, simulation, and on-chain execution.
@@ -27,7 +29,7 @@ import { AxonClient } from '@axonfi/sdk';
27
29
 
28
30
  const axon = new AxonClient({
29
31
  vaultAddress: '0x...',
30
- chainId: 8453, // Base
32
+ chainId: 8453, // Base
31
33
  botPrivateKey: '0x...',
32
34
  relayerUrl: 'https://relay.axonfi.xyz',
33
35
  });
@@ -63,9 +65,9 @@ Token field accepts addresses, `Token` enum values, or symbol strings:
63
65
  ```typescript
64
66
  import { Token, USDC } from '@axonfi/sdk';
65
67
 
66
- token: 'USDC' // bare symbol string
67
- token: Token.USDC // type-safe enum
68
- token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' // raw address
68
+ token: 'USDC'; // bare symbol string
69
+ token: Token.USDC; // type-safe enum
70
+ token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'; // raw address
69
71
  ```
70
72
 
71
73
  ### Encrypted Bot Keys
@@ -93,8 +95,8 @@ const axon = new AxonClient({
93
95
  // Send a payment
94
96
  const result = await axon.pay({
95
97
  to: '0xRecipient',
96
- token: 'USDC', // or Token.USDC, or an address
97
- amount: 25, // or '25', or 25_000_000n
98
+ token: 'USDC', // or Token.USDC, or an address
99
+ amount: 25, // or '25', or 25_000_000n
98
100
  memo: 'Invoice #42',
99
101
  });
100
102
 
@@ -126,11 +128,11 @@ const result = await axon.execute({
126
128
  ### Vault Reads
127
129
 
128
130
  ```typescript
129
- await axon.getBalance('0xUSDC...'); // vault token balance
130
- await axon.isActive(); // bot registered + active?
131
- await axon.isPaused(); // vault paused?
132
- await axon.getVaultInfo(); // owner, operator, version
133
- await axon.canPayTo('0xRecipient'); // destination allowed?
131
+ await axon.getBalance('0xUSDC...'); // vault token balance
132
+ await axon.isActive(); // bot registered + active?
133
+ await axon.isPaused(); // vault paused?
134
+ await axon.getVaultInfo(); // owner, operator, version
135
+ await axon.canPayTo('0xRecipient'); // destination allowed?
134
136
  ```
135
137
 
136
138
  ### Utilities
@@ -138,37 +140,37 @@ await axon.canPayTo('0xRecipient'); // destination allowed?
138
140
  ```typescript
139
141
  import { parseAmount, resolveTokenDecimals, resolveToken, encodeRef } from '@axonfi/sdk';
140
142
 
141
- parseAmount(5.2, 'USDC'); // 5_200_000n
142
- resolveTokenDecimals('WETH'); // 18
143
- resolveToken('USDC', 8453); // 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
144
- encodeRef('invoice-042'); // keccak256 → bytes32
143
+ parseAmount(5.2, 'USDC'); // 5_200_000n
144
+ resolveTokenDecimals('WETH'); // 18
145
+ resolveToken('USDC', 8453); // 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
146
+ encodeRef('invoice-042'); // keccak256 → bytes32
145
147
  ```
146
148
 
147
149
  ## Response Paths
148
150
 
149
151
  Payments resolve through one of three paths:
150
152
 
151
- | Path | Trigger | Timing | Response |
152
- |------|---------|--------|----------|
153
- | **Fast** | Below all thresholds | ~2s | `status: "approved"`, `txHash` |
154
- | **AI Scan** | Exceeds AI threshold | ~30s | `status: "approved"` or routes to review |
155
- | **Human Review** | No AI consensus | Async | `status: "pending_review"`, poll for result |
153
+ | Path | Trigger | Timing | Response |
154
+ | ---------------- | -------------------- | ------ | ------------------------------------------- |
155
+ | **Fast** | Below all thresholds | ~2s | `status: "approved"`, `txHash` |
156
+ | **AI Scan** | Exceeds AI threshold | ~30s | `status: "approved"` or routes to review |
157
+ | **Human Review** | No AI consensus | Async | `status: "pending_review"`, poll for result |
156
158
 
157
159
  ## Security Model
158
160
 
159
- - **Principals** (vault owners) control everything: bot whitelist, spending limits, withdrawal. Hardware wallet recommended.
161
+ - **Owners** control everything: bot whitelist, spending limits, withdrawal. Hardware wallet recommended.
160
162
  - **Bots** only sign payment intents. They never hold ETH, never submit transactions, and can be removed instantly.
161
163
  - **Relayer** (Axon) can only execute bot-signed intents within configured limits. Cannot withdraw or modify vault config.
162
- - **If Axon goes offline**, the Principal retains full withdrawal access directly through the on-chain vault contract.
164
+ - **If Axon goes offline**, the owner retains full withdrawal access directly through the on-chain vault contract.
163
165
 
164
166
  ## Chains
165
167
 
166
- | Chain | ID | Status |
167
- |-------|----|--------|
168
- | Base | 8453 | Live |
169
- | Arbitrum One | 42161 | Live |
170
- | Optimism | 10 | Live |
171
- | Polygon PoS | 137 | Live |
168
+ | Chain | ID | Status |
169
+ | ------------ | ----- | ------- |
170
+ | Base | 8453 | Live |
171
+ | Arbitrum One | 42161 | Live |
172
+ | Optimism | 10 | Live |
173
+ | Polygon PoS | 137 | Live |
172
174
  | Base Sepolia | 84532 | Testnet |
173
175
 
174
176
  ## Documentation