@axonfi/sdk 0.2.1 → 0.3.0

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  Give your AI agents a wallet they can't drain.
4
4
 
5
+ ## What is Axon Finance
6
+
5
7
  Treasury and payment infrastructure for autonomous AI agents. Non-custodial vaults, gasless bots, AI verification.
6
8
 
7
9
  ## Why Axon Finance
@@ -19,19 +21,24 @@ Your agents pay. You stay in control.
19
21
  ## Install
20
22
 
21
23
  ```bash
22
- npm install @axonfi/sdk viem
24
+ npm install @axonfi/sdk
23
25
  ```
24
26
 
25
27
  ## Quick Start
26
28
 
29
+ ### With Encrypted Keystore (recommended)
30
+
27
31
  ```typescript
28
- import { AxonClient } from '@axonfi/sdk';
32
+ import { AxonClient, decryptKeystore } from '@axonfi/sdk';
33
+ import fs from 'fs';
34
+
35
+ const keystore = fs.readFileSync('./axon-bot.json', 'utf8');
36
+ const botPrivateKey = await decryptKeystore(keystore, process.env.BOT_PASSPHRASE!);
29
37
 
30
38
  const axon = new AxonClient({
31
39
  vaultAddress: '0x...',
32
40
  chainId: 8453, // Base
33
- botPrivateKey: '0x...',
34
- relayerUrl: 'https://relay.axonfi.xyz',
41
+ botPrivateKey,
35
42
  });
36
43
 
37
44
  // Pay 5 USDC — SDK handles decimals automatically
@@ -45,6 +52,18 @@ const result = await axon.pay({
45
52
  console.log(result.status, result.txHash);
46
53
  ```
47
54
 
55
+ ### With Raw Private Key
56
+
57
+ ```typescript
58
+ import { AxonClient } from '@axonfi/sdk';
59
+
60
+ const axon = new AxonClient({
61
+ vaultAddress: '0x...',
62
+ chainId: 8453,
63
+ botPrivateKey: process.env.BOT_PRIVATE_KEY!,
64
+ });
65
+ ```
66
+
48
67
  ### Human-Friendly Amounts
49
68
 
50
69
  The SDK accepts amounts in three formats:
@@ -70,23 +89,6 @@ token: Token.USDC; // type-safe enum
70
89
  token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'; // raw address
71
90
  ```
72
91
 
73
- ### Encrypted Bot Keys
74
-
75
- ```typescript
76
- import { AxonClient, decryptKeystore } from '@axonfi/sdk';
77
- import fs from 'fs';
78
-
79
- const keystore = fs.readFileSync('./axon-bot.json', 'utf8');
80
- const botPrivateKey = await decryptKeystore(keystore, process.env.BOT_PASSPHRASE!);
81
-
82
- const axon = new AxonClient({
83
- vaultAddress: '0x...',
84
- chainId: 8453,
85
- botPrivateKey,
86
- relayerUrl: 'https://relay.axonfi.xyz',
87
- });
88
- ```
89
-
90
92
  ## API
91
93
 
92
94
  ### Payments
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.replace(/\/$/, "");
3066
+ this.relayerUrl = (config.relayerUrl ?? "https://relay.axonfi.xyz").replace(/\/$/, "");
3067
3067
  if (!config.botPrivateKey) {
3068
3068
  throw new Error("botPrivateKey is required in AxonClientConfig");
3069
3069
  }