@axonfi/sdk 0.5.1 → 0.5.3
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 +15 -7
- package/dist/index.cjs +409 -386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +410 -387
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ Giving bots funded wallets is risky: scattered keys, no spending controls, one c
|
|
|
18
18
|
|
|
19
19
|
Your agents pay. You stay in control.
|
|
20
20
|
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Payments** — Send USDC or any ERC-20 to any address. Gasless for bots (EIP-712 intents, relayer pays gas). Per-tx caps, daily limits, AI verification.
|
|
24
|
+
- **DeFi Protocol Execution** — Interact with Uniswap, Aave, GMX, Ostium, Lido, and any on-chain protocol from your vault. Atomic approve/call/revoke.
|
|
25
|
+
- **In-Vault Swaps** — Rebalance tokens inside the vault without withdrawing. Separate caps from payment limits.
|
|
26
|
+
- **HTTP 402 Paywalls (x402)** — Native support for [x402](https://www.x402.org/) APIs. One-call `handlePaymentRequired()` handles parsing, vault funding, signing, and retry headers. EIP-3009 (USDC) and Permit2 (any ERC-20).
|
|
27
|
+
- **AI Verification** — 3-agent LLM consensus (safety, behavioral, reasoning) for flagged transactions. Configurable per bot: threshold-based or always-on.
|
|
28
|
+
- **Non-Custodial Vaults** — Each owner deploys their own vault. Only the owner can withdraw. Enforced on-chain.
|
|
29
|
+
- **Human-Friendly Amounts** — Pass `5`, `"5.2"`, or `5_200_000n`. SDK handles decimals. Token resolution by symbol, enum, or address.
|
|
30
|
+
- **Multi-Chain** — Base, Arbitrum. USDC as base asset. Same SDK, same API.
|
|
31
|
+
|
|
21
32
|
## Install
|
|
22
33
|
|
|
23
34
|
```bash
|
|
@@ -44,9 +55,8 @@ Everything can be done from code — no dashboard needed. An agent can bootstrap
|
|
|
44
55
|
import {
|
|
45
56
|
AxonClient, deployVault, addBot, deposit,
|
|
46
57
|
createAxonPublicClient, createAxonWalletClient,
|
|
47
|
-
|
|
58
|
+
WINDOW, Chain,
|
|
48
59
|
} from '@axonfi/sdk';
|
|
49
|
-
import { parseUnits } from 'viem';
|
|
50
60
|
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
|
|
51
61
|
|
|
52
62
|
// ── 1. Owner wallet (funded with ETH for gas) ─────────────────────
|
|
@@ -82,12 +92,10 @@ await addBot(ownerWallet, publicClient, vaultAddress, botAddress, {
|
|
|
82
92
|
|
|
83
93
|
// ── 6. Deposit funds (on-chain tx, ~0.0005 ETH gas) ───────────────
|
|
84
94
|
// Option A: Deposit ETH (vault accepts native ETH directly)
|
|
85
|
-
await deposit(ownerWallet, publicClient, vaultAddress,
|
|
86
|
-
NATIVE_ETH, parseUnits('0.1', 18));
|
|
95
|
+
await deposit(ownerWallet, publicClient, vaultAddress, 'ETH', 0.1);
|
|
87
96
|
|
|
88
97
|
// Option B: Deposit USDC (SDK handles approve + deposit)
|
|
89
|
-
await deposit(ownerWallet, publicClient, vaultAddress,
|
|
90
|
-
USDC[chainId], parseUnits('500', 6));
|
|
98
|
+
await deposit(ownerWallet, publicClient, vaultAddress, 'USDC', 500);
|
|
91
99
|
|
|
92
100
|
// ── 7. Bot is ready — gasless from here ────────────────────────────
|
|
93
101
|
// Save botKey securely. The bot never needs ETH.
|
|
@@ -119,7 +127,7 @@ Vaults accept native ETH directly — no wrapping needed. You can start a vault
|
|
|
119
127
|
// Deploy vault + deposit ETH — no USDC needed
|
|
120
128
|
const vault = await deployVault(ownerWallet, publicClient, factory);
|
|
121
129
|
await addBot(ownerWallet, publicClient, vault, botAddress, config);
|
|
122
|
-
await deposit(ownerWallet, publicClient, vault,
|
|
130
|
+
await deposit(ownerWallet, publicClient, vault, 'ETH', 0.5);
|
|
123
131
|
|
|
124
132
|
// Bot can now pay in any token — the relayer swaps ETH → USDC automatically
|
|
125
133
|
await axon.pay({ to: '0x...', token: 'USDC', amount: 10 });
|