@axonfi/sdk 0.2.0 → 0.2.2

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