@axonfi/sdk 0.3.4 → 0.3.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Axon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -29,7 +29,7 @@ npm install @axonfi/sdk
29
29
  ### With Encrypted Keystore (recommended)
30
30
 
31
31
  ```typescript
32
- import { AxonClient, decryptKeystore } from '@axonfi/sdk';
32
+ import { AxonClient, Chain, Token, decryptKeystore } from '@axonfi/sdk';
33
33
  import fs from 'fs';
34
34
 
35
35
  const keystore = fs.readFileSync('./axon-bot.json', 'utf8');
@@ -37,14 +37,14 @@ const botPrivateKey = await decryptKeystore(keystore, process.env.BOT_PASSPHRASE
37
37
 
38
38
  const axon = new AxonClient({
39
39
  vaultAddress: '0x...',
40
- chainId: 8453, // Base
40
+ chainId: Chain.Base,
41
41
  botPrivateKey,
42
42
  });
43
43
 
44
44
  // Pay 5 USDC — SDK handles decimals automatically
45
45
  const result = await axon.pay({
46
46
  to: '0xRecipient',
47
- token: 'USDC',
47
+ token: Token.USDC,
48
48
  amount: 5,
49
49
  memo: 'API call payment',
50
50
  });
@@ -55,11 +55,11 @@ console.log(result.status, result.txHash);
55
55
  ### With Raw Private Key
56
56
 
57
57
  ```typescript
58
- import { AxonClient } from '@axonfi/sdk';
58
+ import { AxonClient, Chain } from '@axonfi/sdk';
59
59
 
60
60
  const axon = new AxonClient({
61
61
  vaultAddress: '0x...',
62
- chainId: 8453,
62
+ chainId: Chain.Base,
63
63
  botPrivateKey: process.env.BOT_PRIVATE_KEY!,
64
64
  });
65
65
  ```
@@ -70,13 +70,13 @@ The SDK accepts amounts in three formats:
70
70
 
71
71
  ```typescript
72
72
  // Human-readable number — SDK converts using token decimals
73
- await axon.pay({ to, token: 'USDC', amount: 5.2 });
73
+ await axon.pay({ to, token: Token.USDC, amount: 5.2 });
74
74
 
75
75
  // Human-readable string — recommended for computed values
76
- await axon.pay({ to, token: 'USDC', amount: '5.2' });
76
+ await axon.pay({ to, token: Token.USDC, amount: '5.2' });
77
77
 
78
78
  // Raw bigint — base units, passed through as-is
79
- await axon.pay({ to, token: 'USDC', amount: 5_200_000n });
79
+ await axon.pay({ to, token: Token.USDC, amount: 5_200_000n });
80
80
  ```
81
81
 
82
82
  Token field accepts addresses, `Token` enum values, or symbol strings:
@@ -98,8 +98,8 @@ Send USDC (or any ERC-20) to any address. The bot signs an EIP-712 intent — Ax
98
98
  ```typescript
99
99
  const result = await axon.pay({
100
100
  to: '0xRecipient',
101
- token: 'USDC', // or Token.USDC, or an address
102
- amount: 25, // or '25', or 25_000_000n
101
+ token: Token.USDC,
102
+ amount: 25,
103
103
  memo: 'Invoice #42',
104
104
  });
105
105
 
@@ -113,7 +113,7 @@ Rebalance tokens inside your vault without withdrawing. Swap between any tokens
113
113
 
114
114
  ```typescript
115
115
  const result = await axon.swap({
116
- toToken: 'WETH',
116
+ toToken: Token.WETH,
117
117
  minToAmount: 0.001,
118
118
  memo: 'Rebalance to WETH',
119
119
  });
@@ -127,7 +127,7 @@ Interact with DeFi and Web3 protocols (Uniswap, Aave, GMX, etc.) that need permi
127
127
  const result = await axon.execute({
128
128
  protocol: '0xUniswapRouter',
129
129
  callData: '0x...',
130
- token: 'USDC',
130
+ token: Token.USDC,
131
131
  amount: 100,
132
132
  });
133
133
  ```
@@ -184,13 +184,16 @@ Payments resolve through one of three paths:
184
184
  | Optimism | 10 | Coming soon |
185
185
  | Polygon PoS | 137 | Coming soon |
186
186
 
187
- ## Documentation
187
+ ## Links
188
188
 
189
- - [Full SDK Reference](https://axonfi.xyz/docs/sdk/typescript/client)
190
- - [Quickstart Guide](https://axonfi.xyz/docs/getting-started/quickstart)
191
- - [How It Works](https://axonfi.xyz/docs/getting-started/how-it-works)
192
- - [Security Model](https://axonfi.xyz/docs/architecture/security-model)
193
- - [HTTP 402 Payments](https://axonfi.xyz/docs/guides/http-402)
189
+ - [Website](https://axonfi.xyz)
190
+ - [Dashboard](https://app.axonfi.xyz)
191
+ - [Documentation](https://axonfi.xyz/llms.txt)
192
+ - [npm — @axonfi/sdk](https://www.npmjs.com/package/@axonfi/sdk)
193
+ - [PyPI axonfi](https://pypi.org/project/axonfi/) (Python SDK)
194
+ - [Smart Contracts](https://github.com/axonfi/contracts)
195
+ - [Examples](https://github.com/axonfi/examples)
196
+ - [Twitter/X — @axonfixyz](https://x.com/axonfixyz)
194
197
 
195
198
  ## License
196
199
 
package/dist/index.cjs CHANGED
@@ -2814,7 +2814,8 @@ var KNOWN_TOKENS = {
2814
2814
  addresses: {
2815
2815
  8453: "0x4200000000000000000000000000000000000006",
2816
2816
  84532: "0x4200000000000000000000000000000000000006",
2817
- 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
2817
+ 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
2818
+ 421614: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
2818
2819
  }
2819
2820
  },
2820
2821
  WBTC: {