@axonfi/sdk 0.3.0 → 0.3.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
@@ -93,8 +93,9 @@ token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'; // raw address
93
93
 
94
94
  ### Payments
95
95
 
96
+ Send USDC (or any ERC-20) to any address. The bot signs an EIP-712 intent — Axon verifies it against your vault's spending policies, simulates the transaction, and executes on-chain. If the payment exceeds the AI threshold, it goes through 3-agent verification before execution.
97
+
96
98
  ```typescript
97
- // Send a payment
98
99
  const result = await axon.pay({
99
100
  to: '0xRecipient',
100
101
  token: 'USDC', // or Token.USDC, or an address
@@ -102,12 +103,14 @@ const result = await axon.pay({
102
103
  memo: 'Invoice #42',
103
104
  });
104
105
 
105
- // Poll async payments
106
+ // Poll async payments (AI scan or human review)
106
107
  const status = await axon.poll(result.requestId);
107
108
  ```
108
109
 
109
110
  ### In-Vault Swaps
110
111
 
112
+ Rebalance tokens inside your vault without withdrawing. Swap between any tokens on the vault's rebalance whitelist (set by the owner). Restricted by a separate `maxRebalanceAmount` cap — independent from payment limits.
113
+
111
114
  ```typescript
112
115
  const result = await axon.swap({
113
116
  toToken: 'WETH',
@@ -118,6 +121,8 @@ const result = await axon.swap({
118
121
 
119
122
  ### DeFi Protocol Execution
120
123
 
124
+ Interact with any on-chain protocol (Uniswap, Aave, GMX, etc.) directly from your vault. The bot signs an `ExecuteIntent` specifying the target contract and calldata. The relayer handles token approvals, execution, and revocation in a single atomic transaction.
125
+
121
126
  ```typescript
122
127
  const result = await axon.execute({
123
128
  protocol: '0xUniswapRouter',
@@ -129,8 +134,10 @@ const result = await axon.execute({
129
134
 
130
135
  ### Vault Reads
131
136
 
137
+ Query your vault's on-chain state — balances, bot status, pause state, and destination checks. All reads go through the relayer (no RPC connection needed).
138
+
132
139
  ```typescript
133
- await axon.getBalance('0xUSDC...'); // vault token balance
140
+ await axon.getBalance('USDC'); // vault token balance
134
141
  await axon.isActive(); // bot registered + active?
135
142
  await axon.isPaused(); // vault paused?
136
143
  await axon.getVaultInfo(); // owner, operator, version
@@ -139,6 +146,8 @@ await axon.canPayTo('0xRecipient'); // destination allowed?
139
146
 
140
147
  ### Utilities
141
148
 
149
+ Helper functions for amount conversion, token resolution, and reference encoding.
150
+
142
151
  ```typescript
143
152
  import { parseAmount, resolveTokenDecimals, resolveToken, encodeRef } from '@axonfi/sdk';
144
153
 
package/dist/index.cjs CHANGED
@@ -3063,7 +3063,7 @@ var AxonClient = class {
3063
3063
  constructor(config) {
3064
3064
  this.vaultAddress = config.vaultAddress;
3065
3065
  this.chainId = config.chainId;
3066
- this.relayerUrl = (config.relayerUrl ?? "https://relay.axonfi.xyz").replace(/\/$/, "");
3066
+ this.relayerUrl = "https://relay.axonfi.xyz";
3067
3067
  if (!config.botPrivateKey) {
3068
3068
  throw new Error("botPrivateKey is required in AxonClientConfig");
3069
3069
  }