@agentsbank/sdk 1.0.8 → 1.0.10

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/.env.example ADDED
@@ -0,0 +1,53 @@
1
+ # AgentsBank SDK - Environment Variables Template
2
+ # Copy this to .env and fill in your actual credentials
3
+ # SECURITY WARNING: Never commit .env to version control
4
+
5
+ # ============================================
6
+ # API Configuration (REQUIRED)
7
+ # ============================================
8
+ # Base URL of AgentsBank API
9
+ # For local development: http://localhost:3000
10
+ # For production: https://api.agentsbank.online
11
+ AGENTSBANK_API_URL=https://api.agentsbank.online
12
+
13
+ # ============================================
14
+ # Authentication (Choose ONE method)
15
+ # ============================================
16
+
17
+ # METHOD 1: API Key (Recommended for production)
18
+ AGENTSBANK_API_KEY=your-api-key-here-do-not-share
19
+
20
+ # METHOD 2: Agent Credentials (For testing/setup)
21
+ # Uncomment and fill only if using credential-based auth
22
+ # AGENTSBANK_AGENT_USERNAME=agent_name
23
+ # AGENTSBANK_AGENT_PASSWORD=agent_password_secret
24
+
25
+ # ============================================
26
+ # Optional: Pre-authenticated Token
27
+ # ============================================
28
+ # Only needed if you have a pre-issued JWT token
29
+ # AGENTSBANK_AUTH_TOKEN=jwt-token-here
30
+
31
+ # ============================================
32
+ # Optional: Runtime Configuration
33
+ # ============================================
34
+ # Environment: 'production' or 'sandbox'
35
+ AGENTSBANK_ENVIRONMENT=production
36
+
37
+ # Request timeout in milliseconds
38
+ AGENTSBANK_TIMEOUT_MS=10000
39
+
40
+ # Enable audit logging
41
+ AGENTSBANK_AUDIT_LOG=true
42
+
43
+ # Webhook URL for transaction notifications (optional)
44
+ # AGENTSBANK_WEBHOOK_URL=https://your-domain.com/webhooks/agentsbank
45
+
46
+ # ============================================
47
+ # Security Checklist
48
+ # ============================================
49
+ # ✓ API key obtained from https://dashboard.agentsbank.ai
50
+ # ✓ Never commit this file to git (add to .gitignore)
51
+ # ✓ Rotate API key monthly or when team member leaves
52
+ # ✓ Use different credentials for development vs production
53
+ # ✓ Enable audit logging in production
package/CHANGELOG.md CHANGED
@@ -5,37 +5,33 @@ All notable changes to the AgentsBank SDK are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.8] - 2026-02-14
9
-
10
- ### Fixed
11
- - **Critical**: Fixed all SDK endpoint paths to include `/api` prefix for compatibility with backend routing
12
- - `/auth/agent/login` → `/api/auth/agent/login`
13
- - `/wallets` → `/api/wallets`
14
- - `/transactions` → `/api/transactions`
15
- - All wallet, transaction, and auth endpoints updated
16
- - **Enhanced error handling**: Added response interceptor to provide detailed error messages
17
- - API errors now show status codes and endpoint URLs
18
- - Network errors provide guidance on API availability
19
- - Authentication errors suggest credential verification
20
- - **SDK configuration**: Updated default API URL from `api.agentsbank.ai` to `api.agentsbank.online`
21
- - **Login error messages**: Improved authentication error feedback with specific guidance
22
- - **NPM Publishing**: Added public access configuration for scoped package
8
+ ## [1.0.10] - 2026-02-14
23
9
 
24
10
  ### Added
25
- - Response error interceptor for better debugging experience
26
- - Network error detection with "API might be offline" message
27
- - Endpoint URL in error messages for easier troubleshooting
28
- - Public access configuration in package.json
11
+ - **Autonomous Mode Support**: Added optional `autonomousMode` config flag for trusted agents
12
+ - Allows financial transactions without `UserApprovalContext` when explicitly enabled
13
+ - Maintains security by requiring guardrails (spending limits, audit logging, whitelisting)
14
+ - Still generates audit trail with synthetic approval context for compliance
29
15
 
30
- ### Security
31
- - No changes to security constraints. SDK continues to require:
32
- - Explicit API credentials (apiUrl + apiKey or agent credentials)
33
- - UserApprovalContext for financial operations
34
- - Audit logging for all transactions
16
+ ### Changed
17
+ - Updated all domain references from `agentsbank.ai` to `agentsbank.online`
18
+ - Improved security documentation to reflect default-secure-but-flexible approach
19
+ - Enhanced README with Autonomous Mode best practices section
20
+
21
+ ### Fixed
22
+ - Type definitions now support `'autonomous'` approval method
23
+ - Response error interceptor provides better error messages
24
+ - Network connectivity detection with helpful guidance
25
+
26
+ ### Documentation
27
+ - Updated all API endpoint examples to use `api.agentsbank.online`
28
+ - Added comprehensive Autonomous Mode setup guide
29
+ - Enhanced security requirements section with dual-mode explanation
30
+ - Updated all support links to `agentsbank.online`
35
31
 
36
32
  ---
37
33
 
38
- ## [1.0.7] - 2026-02-14
34
+ ## [1.0.8] - 2026-02-14
39
35
 
40
36
  ### Fixed
41
37
  - Fixed SDK endpoint paths to include `/api` prefix
package/README.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  ## ⚠️ Critical Security Requirements
4
4
 
5
- This SDK manages **real financial transactions** on blockchain networks. It is **not autonomously invocable** and requires explicit human approval for all financial operations.
5
+ This SDK manages **real financial transactions** on blockchain networks.
6
+
7
+ **Default Mode**: Requires explicit human approval for all financial operations via `UserApprovalContext`.
8
+
9
+ **Autonomous Mode** (Optional): Can be enabled for trusted agents via `autonomousMode: true` config flag. Requires strict guardrails (spending limits, whitelisting, audit logging) to prevent unauthorized transactions.
10
+
6
11
 
7
- ---
8
12
 
9
13
  ## 📋 Credential Checklist
10
14
 
@@ -29,7 +33,7 @@ npm install @agentsbank/sdk
29
33
 
30
34
  ### Setup
31
35
 
32
- 1. **Get credentials** from https://dashboard.agentsbank.ai
36
+ 1. **Get credentials** from https://dashboard.agentsbank.online
33
37
  2. **Copy environment template**:
34
38
  ```bash
35
39
  cp .env.example .env
@@ -123,6 +127,41 @@ const confirmed = await bank.waitForConfirmation(
123
127
  console.log('Final status:', confirmed.status); // 'confirmed' | 'failed'
124
128
  ```
125
129
 
130
+ ### 🚀 Autonomous Mode (Advanced)
131
+
132
+ **For trusted autonomous agents only** - allows financial operations without human approval.
133
+
134
+ ```typescript
135
+ // Initialize with autonomous mode enabled
136
+ const autonomousBank = new AgentsBankSDK({
137
+ apiUrl: process.env.AGENTSBANK_API_URL!,
138
+ apiKey: process.env.AGENTSBANK_API_KEY!,
139
+ autonomousMode: true, // ⚠️ Enable autonomous execution
140
+ auditLogger: (event) => {
141
+ console.log(`[AUTONOMOUS] ${event.operation}`, event);
142
+ }
143
+ });
144
+
145
+ // Now transactions can execute without UserApprovalContext
146
+ const transaction = await autonomousBank.sendTransaction(
147
+ walletId,
148
+ '0xRecipient...',
149
+ '1.5',
150
+ undefined, // ← No approval needed in autonomous mode
151
+ 'ETH'
152
+ );
153
+
154
+ // ✅ Still logs as 'agent_autonomous_...' for audit trail
155
+ console.log('Autonomous Transaction ID:', transaction.tx_id);
156
+ ```
157
+
158
+ **⚠️ Security Requirements for Autonomous Mode:**
159
+ - Guardrails MUST be configured (max daily spend, transaction limits, whitelist)
160
+ - Audit logging MUST be enabled
161
+ - Should be used only for time-sensitive agent operations
162
+ - Spending limits should be conservative
163
+ - Agent should have read-only access to limited wallets
164
+
126
165
  ---
127
166
 
128
167
  ## 🔑 Authentication Methods
@@ -131,7 +170,7 @@ console.log('Final status:', confirmed.status); // 'confirmed' | 'failed'
131
170
 
132
171
  ```typescript
133
172
  const bank = new AgentsBankSDK({
134
- apiUrl: 'https://api.agentsbank.ai',
173
+ apiUrl: 'https://api.agentsbank.online',
135
174
  apiKey: process.env.AGENTSBANK_API_KEY, // From dashboard
136
175
  });
137
176
  ```
@@ -140,7 +179,7 @@ const bank = new AgentsBankSDK({
140
179
 
141
180
  ```typescript
142
181
  const bank = new AgentsBankSDK({
143
- apiUrl: 'https://api.agentsbank.ai',
182
+ apiUrl: 'https://api.agentsbank.online',
144
183
  agentUsername: process.env.AGENTSBANK_AGENT_USERNAME,
145
184
  agentPassword: process.env.AGENTSBANK_AGENT_PASSWORD,
146
185
  });
@@ -153,7 +192,7 @@ const token = await bank.login();
153
192
 
154
193
  ```typescript
155
194
  const bank = new AgentsBankSDK({
156
- apiUrl: 'https://api.agentsbank.ai',
195
+ apiUrl: 'https://api.agentsbank.online',
157
196
  token: process.env.AGENTSBANK_AUTH_TOKEN, // JWT from previous auth
158
197
  });
159
198
  ```
@@ -175,11 +214,11 @@ echo ".env.*.local" >> .gitignore
175
214
 
176
215
  ```bash
177
216
  # development
178
- AGENTSBANK_API_URL=https://sandbox.agentsbank.ai
217
+ AGENTSBANK_API_URL=https://sandbox.agentsbank.online
179
218
  AGENTSBANK_API_KEY=sk_sandbox_...
180
219
 
181
220
  # production
182
- AGENTSBANK_API_URL=https://api.agentsbank.ai
221
+ AGENTSBANK_API_URL=https://api.agentsbank.online
183
222
  AGENTSBANK_API_KEY=sk_prod_...
184
223
  ```
185
224
 
@@ -325,10 +364,10 @@ All SDK operations are logged with:
325
364
 
326
365
  ## 📞 Support
327
366
 
328
- - **Documentation**: https://docs.agentsbank.ai
329
- - **Dashboard**: https://dashboard.agentsbank.ai
330
- - **Status Page**: https://status.agentsbank.ai
331
- - **Security Issues**: security@agentsbank.ai
367
+ - **Documentation**: https://docs.agentsbank.online
368
+ - **Dashboard**: https://dashboard.agentsbank.online
369
+ - **Status Page**: https://status.agentsbank.online
370
+ - **Security Issues**: security@agentsbank.online
332
371
 
333
372
  ---
334
373
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsbank/sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "🔒 Secure Financial SDK for AgentsBank - Multi-chain wallet & transaction management. Requires explicit credentials and user authorization for financial operations.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,7 +19,9 @@ export const SDK_SECURITY_CONFIG = {
19
19
  // ============================================
20
20
  riskLevel: 'HIGH' as const, // Financial transaction platform
21
21
  financialOperations: true,
22
- autonomousExecutionAllowed: false, // CRITICAL: Must not be autonomously invocable
22
+ autonomousExecutionAllowed: false, // DEFAULT: Must not be autonomously invocable
23
+ autonomousModeSupportedButOptional: true, // Can be enabled via config flag if needed
24
+ defaultRequiresApproval: true, // By default, all transactions require approval
23
25
 
24
26
  // ============================================
25
27
  // Credential Scope & Constraints
@@ -61,12 +63,14 @@ export const SDK_SECURITY_CONFIG = {
61
63
  // ============================================
62
64
  financialOperationConstraints: {
63
65
  sendTransaction: {
64
- requiresUserApprovalContext: true,
66
+ requiresUserApprovalContext: true, // DEFAULT: Always required
67
+ canBypassApprovalInAutonomousMode: true, // Can be disabled if autonomousMode=true in SDKConfig
65
68
  requiresUserId: true,
66
69
  requiresApprovalTimestamp: true,
67
70
  auditLoggingRequired: true,
68
71
  atomicity: 'required' as const, // Must succeed or fail completely
69
72
  rollbackOnFailure: true,
73
+ warningIfAutonomous: 'Executing financial transaction WITHOUT human approval',
70
74
  },
71
75
  createWallet: {
72
76
  requiresUserApprovalContext: false, // Optional for wallet creation