@buildaureon/sdk 0.1.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/LICENSE +21 -0
- package/README.md +532 -0
- package/config/network.json +10 -0
- package/dist/index.d.ts +792 -0
- package/dist/index.js +1030 -0
- package/dist/index.js.map +1 -0
- package/docs/architecture.md +205 -0
- package/docs/auth.md +215 -0
- package/docs/client-api.md +604 -0
- package/docs/data-contracts.md +632 -0
- package/docs/error-model.md +182 -0
- package/docs/integration-guide.md +196 -0
- package/docs/security.md +74 -0
- package/docs/transport.md +128 -0
- package/examples/e2e-policy-rebalance/main.ts +438 -0
- package/examples/e2e-policy-rebalance/underrun.ts +134 -0
- package/examples/e2e-policy-rebalance/verify-sizing.ts +147 -0
- package/examples/e2e-vault-flow/main.ts +270 -0
- package/examples/market-event/main.ts +65 -0
- package/examples/quickstart/main.ts +71 -0
- package/fixtures/reference-objectives.json +18 -0
- package/fixtures/reference-portfolio.json +10 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AUREON Contributors
|
|
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
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Aureon
|
|
4
|
+
|
|
5
|
+
**Financial Intelligence Layer for Onchain AI Agents**
|
|
6
|
+
|
|
7
|
+
The official TypeScript HTTP client for the AUREON API.
|
|
8
|
+
Financial Compass, capital health, and verified restore plans: one typed integration surface.
|
|
9
|
+
|
|
10
|
+
<br />
|
|
11
|
+
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
[](#requirements)
|
|
14
|
+
[](https://github.com/buildaureon)
|
|
15
|
+
[](LICENSE)
|
|
16
|
+
[](#requirements)
|
|
17
|
+
|
|
18
|
+
<br />
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @buildaureon/sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**CA (Robinhood Chain):** `0xd293291060334d42e5dbea6fb854c231af527777`
|
|
25
|
+
|
|
26
|
+
[Quickstart](#quickstart) · [Authentication](#authentication) · [API Surface](#api-surface) · [Docs](#documentation)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Table of Contents
|
|
33
|
+
|
|
34
|
+
1. [What is AUREON?](#what-is-aureon)
|
|
35
|
+
2. [Requirements & Installation](#requirements--installation)
|
|
36
|
+
3. [Architecture & System Flow](#architecture--system-flow)
|
|
37
|
+
- [3.1 Client-API Trust Boundary](#31-client-api-trust-boundary)
|
|
38
|
+
- [3.2 Session Authentication Flow](#32-session-authentication-flow)
|
|
39
|
+
- [3.3 Rebalancing & Watchdog Execution Flow](#33-rebalancing--watchdog-execution-flow)
|
|
40
|
+
4. [Quickstart](#quickstart-1)
|
|
41
|
+
5. [Detailed Authentication Guide](#detailed-authentication-guide)
|
|
42
|
+
- [5.1 API Keys](#51-api-keys)
|
|
43
|
+
- [5.2 Wallet Bearer Handshake](#52-wallet-bearer-handshake)
|
|
44
|
+
- [5.3 Token Provider Lifecycle](#53-token-provider-lifecycle)
|
|
45
|
+
6. [API Surface Reference & Code Walkthroughs](#api-surface-reference--code-walkthroughs)
|
|
46
|
+
- [6.1 Connection Smoke Tests](#61-connection-smoke-tests)
|
|
47
|
+
- [6.2 Managing the Capital Book](#62-managing-the-capital-book)
|
|
48
|
+
- [6.3 Defining and Querying Objectives](#63-defining-and-querying-objectives)
|
|
49
|
+
- [6.4 Evaluating Compliance, Health, and Timeline Logs](#64-evaluating-compliance-health-and-timeline-logs)
|
|
50
|
+
- [6.5 Non-Custodial Vault Operations](#65-non-custodial-vault-operations)
|
|
51
|
+
- [6.6 Executing Restore Plans & Rebalances](#66-executing-restore-plans--rebalances)
|
|
52
|
+
- [6.7 Simulating Market Events](#67-simulating-market-events)
|
|
53
|
+
- [6.8 Developer API Key Management](#68-developer-api-key-management)
|
|
54
|
+
7. [Client Configuration & Transport Engine](#client-configuration--transport-engine)
|
|
55
|
+
- [7.1 Configuration Reference Table](#71-configuration-reference-table)
|
|
56
|
+
- [7.2 Retries and Network Failover](#72-retries-and-network-failover)
|
|
57
|
+
8. [Error Model and Code Handling](#error-model-and-code-handling)
|
|
58
|
+
- [8.1 Error Code Reference Matrix](#81-error-code-reference-matrix)
|
|
59
|
+
- [8.2 Narrowing Errors in Practice](#82-narrowing-errors-in-practice)
|
|
60
|
+
9. [CLI Command-Line Guide](#cli-command-line-guide)
|
|
61
|
+
10. [Design Principles & Settlement Honesty](#design-principles--settlement-honesty)
|
|
62
|
+
11. [Documentation Registry Map](#documentation-registry-map)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## What is AUREON?
|
|
67
|
+
|
|
68
|
+
**AUREON** is a policy and execution layer for capital on **Robinhood Chain**. Traditional web3 interactions are transactional: an operator submits a single swap or deposit instruction, and once settled, the system forgets the broader goal.
|
|
69
|
+
|
|
70
|
+
AUREON introduces **Financial Compass Objectives (FCOs)** as execution primitives. Instead of sending raw transactions, developers register continuous financial rules (e.g., "maintain a stable coin buffer at 25% of total portfolio value"). The AUREON system:
|
|
71
|
+
|
|
72
|
+
* Monitors capital holdings across active addresses and smart vault contracts.
|
|
73
|
+
* Computes live portfolio value using public market data.
|
|
74
|
+
* Detects allocation breaches against registered objective bands.
|
|
75
|
+
* Produces recovery instructions (e.g., wrap/unwrap transactions or keeper-driven vault swaps).
|
|
76
|
+
* Maintains a cryptographic, append-only timeline of compliance audits.
|
|
77
|
+
|
|
78
|
+
```mermaid
|
|
79
|
+
flowchart TD
|
|
80
|
+
subgraph Public [Public Node / Operator App]
|
|
81
|
+
SDK["@buildaureon/sdk (TypeScript)"]
|
|
82
|
+
Signer[Wallet Signer / Viem]
|
|
83
|
+
end
|
|
84
|
+
subgraph Cloud [Hosted Ingress]
|
|
85
|
+
API[AUREON API Gateway]
|
|
86
|
+
Watchdog[Health Watchdog Engine]
|
|
87
|
+
DB[(SQLite Ledger)]
|
|
88
|
+
end
|
|
89
|
+
subgraph EVM [Robinhood Chain L2]
|
|
90
|
+
Vault[AUREON Smart Vault]
|
|
91
|
+
Keeper[Keeper Rebalance Adapter]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
SDK -->|"HTTPS request with Key + JWT"| API
|
|
95
|
+
API --> Watchdog
|
|
96
|
+
API --> DB
|
|
97
|
+
Watchdog -->|"Identify violation"| Keeper
|
|
98
|
+
Signer -->|"1. Request Calldata Steps"| API
|
|
99
|
+
API --x|"2. Returns steps (no keys held)"| Signer
|
|
100
|
+
Signer -->|"3. Signs & broadcasts transactions"| EVM
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Requirements & Installation
|
|
106
|
+
|
|
107
|
+
### Requirements
|
|
108
|
+
* **Node.js** version 20 or higher (ESM environment).
|
|
109
|
+
* **Viem** (version 2.x) if signing and broadcasting transaction steps is required.
|
|
110
|
+
|
|
111
|
+
### Installation
|
|
112
|
+
Add the package to your project using a package manager:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Using pnpm
|
|
116
|
+
pnpm add @buildaureon/sdk
|
|
117
|
+
|
|
118
|
+
# Using npm
|
|
119
|
+
npm install @buildaureon/sdk
|
|
120
|
+
|
|
121
|
+
# Using yarn
|
|
122
|
+
yarn add @buildaureon/sdk
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Architecture & System Flow
|
|
128
|
+
|
|
129
|
+
### 3.1 Client-API Trust Boundary
|
|
130
|
+
To protect user funds, AUREON uses a decoupled trust boundary. The hosted API handles monitoring, calculations, public oracle pricing, and rebalance coordination, while private keys remain with the client.
|
|
131
|
+
|
|
132
|
+
| Layer | Responsibility |
|
|
133
|
+
|---|---|
|
|
134
|
+
| **SDK** | Request transport, EIP-712 hashing utilities, parameter validation, retry backing, and vault deposit/withdrawal calldata construction. |
|
|
135
|
+
| **AUREON API** | Ledger syncing, objective validation logic, public price marks tracking, execution timeline compilation, and stage rebalance management. |
|
|
136
|
+
| **Host Application** | Private key storage, MetaMask/signer integrations, and transaction signing & broadcasting. |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 3.2 Session Authentication Flow
|
|
141
|
+
Authentication requires a challenge-response signature verification to link a wallet address with a temporary JWT session.
|
|
142
|
+
|
|
143
|
+
```mermaid
|
|
144
|
+
sequenceDiagram
|
|
145
|
+
autonumber
|
|
146
|
+
participant App as Client Operator
|
|
147
|
+
participant SDK as SDK Client
|
|
148
|
+
participant API as AUREON API Gateway
|
|
149
|
+
|
|
150
|
+
App->>SDK: aureon.getAuthNonce(address)
|
|
151
|
+
SDK->>API: GET /auth/nonce?address=0x...
|
|
152
|
+
API-->>SDK: { message, nonce, expiresAt }
|
|
153
|
+
SDK-->>App: { message, nonce }
|
|
154
|
+
Note over App: Operator signs message<br/>using private key
|
|
155
|
+
App->>SDK: aureon.verifyWallet({ address, message, signature })
|
|
156
|
+
SDK->>API: POST /auth/verify { address, message, signature }
|
|
157
|
+
API->>API: Verify EIP-191 Signature
|
|
158
|
+
API-->>SDK: { token, expiresAt, sessionId }
|
|
159
|
+
SDK-->>App: Return JWT Token
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### 3.3 Rebalancing & Watchdog Execution Flow
|
|
165
|
+
When portfolio weights drift, the system triggers a rebalance using the execution flow:
|
|
166
|
+
|
|
167
|
+
```mermaid
|
|
168
|
+
sequenceDiagram
|
|
169
|
+
autonumber
|
|
170
|
+
participant Client as Client Application
|
|
171
|
+
participant API as AUREON API Gateway
|
|
172
|
+
participant DB as SQLite DB
|
|
173
|
+
participant Engine as Health Engine
|
|
174
|
+
participant Keeper as Keeper Service
|
|
175
|
+
|
|
176
|
+
Client->>API: aureon.refreshWatchdog()
|
|
177
|
+
API->>DB: Pull current price marks & positions
|
|
178
|
+
API->>Engine: Recompute objective deviations
|
|
179
|
+
alt Drift Exceeds Tolerance Limit
|
|
180
|
+
Engine->>DB: Write health state: "violation"
|
|
181
|
+
Engine->>DB: Write event: "violation_detected"
|
|
182
|
+
Engine->>Keeper: Request restoration plan
|
|
183
|
+
Keeper-->>API: Return plan (e.g. vault_swap)
|
|
184
|
+
else Within Bands
|
|
185
|
+
Engine->>DB: Write health state: "healthy"
|
|
186
|
+
end
|
|
187
|
+
API-->>Client: Returns watchdog status and breach reports
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Quickstart
|
|
193
|
+
|
|
194
|
+
Initialize the SDK, retrieve a signing nonce, verify the signature, and sync wallet positions:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { createAureonClient, createSessionTokenProvider } from "@buildaureon/sdk";
|
|
198
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
199
|
+
import { createWalletClient, http } from "viem";
|
|
200
|
+
|
|
201
|
+
async function run() {
|
|
202
|
+
// 1. Setup session token container
|
|
203
|
+
const session = createSessionTokenProvider(null);
|
|
204
|
+
|
|
205
|
+
// 2. Initialize the client
|
|
206
|
+
const aureon = createAureonClient({
|
|
207
|
+
baseUrl: "https://api.aureonlabs.network",
|
|
208
|
+
apiKey: process.env.AUREON_API_KEY!,
|
|
209
|
+
getAccessToken: session.getAccessToken,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// 3. Perform a handshake to authenticate
|
|
213
|
+
const account = privateKeyToAccount("0x..."); // Operator private key
|
|
214
|
+
const { message } = await aureon.getAuthNonce(account.address);
|
|
215
|
+
|
|
216
|
+
const walletClient = createWalletClient({ account, transport: http() });
|
|
217
|
+
const signature = await walletClient.signMessage({ message, account });
|
|
218
|
+
|
|
219
|
+
const login = await aureon.verifyWallet({
|
|
220
|
+
address: account.address,
|
|
221
|
+
message,
|
|
222
|
+
signature,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// 4. Save credentials
|
|
226
|
+
session.setToken(login.token);
|
|
227
|
+
|
|
228
|
+
// 5. Query portfolio status
|
|
229
|
+
const synced = await aureon.syncPortfolio();
|
|
230
|
+
console.log("Portfolio Value USD:", synced.portfolio.totalNotionalUsd);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Detailed Authentication Guide
|
|
237
|
+
|
|
238
|
+
### 5.1 API Keys
|
|
239
|
+
API keys regulate product access at the gateway level. They must be sent with all client requests via the `X-Aureon-Api-Key` header. Generate new API keys inside the operator utility developer console.
|
|
240
|
+
|
|
241
|
+
### 5.2 Wallet Bearer Handshake
|
|
242
|
+
Bearer sessions scope data operations to a specific wallet. The SDK client obtains a nonce, signs it using an EVM signer, and posts the signature back to `/auth/verify` to receive a JWT session token.
|
|
243
|
+
|
|
244
|
+
### 5.3 Token Provider Lifecycle
|
|
245
|
+
The `createSessionTokenProvider` manager handles token resolution and injection. It can be passed directly as a resolver function:
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
import { createSessionTokenProvider } from "@buildaureon/sdk";
|
|
249
|
+
|
|
250
|
+
const session = createSessionTokenProvider(process.env.AUREON_TOKEN ?? null);
|
|
251
|
+
|
|
252
|
+
// Clear tokens on logout
|
|
253
|
+
await aureon.logout();
|
|
254
|
+
session.clear();
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## API Surface Reference & Code Walkthroughs
|
|
260
|
+
|
|
261
|
+
### 6.1 Connection Smoke Tests
|
|
262
|
+
```ts
|
|
263
|
+
const ping = await aureon.ping();
|
|
264
|
+
console.log(`Connected. Backend version: ${ping.version}`);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### 6.2 Managing the Capital Book
|
|
268
|
+
The Capital Book defines the assets tracked by AUREON. Sync positions from the chain or modify them directly:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
// Sync active balances from Robinhood Chain L2 and smart vaults
|
|
272
|
+
const syncResult = await aureon.syncPortfolio();
|
|
273
|
+
console.log("Current stable coin weight:", syncResult.portfolio.stableWeight);
|
|
274
|
+
|
|
275
|
+
// Manually define positions (useful for simulation environments)
|
|
276
|
+
const updatedBook = await aureon.setPortfolio([
|
|
277
|
+
{ symbol: "WETH", quantity: 2.5, category: "gas" },
|
|
278
|
+
{ symbol: "USDG", quantity: 2500, category: "stable" }
|
|
279
|
+
]);
|
|
280
|
+
|
|
281
|
+
// Clear all active ledger tracking rows
|
|
282
|
+
await aureon.clearPortfolio();
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 6.3 Defining and Querying Objectives
|
|
286
|
+
Objectives dictate the target weights and tolerance buffers. All SDK objectives are initialized with automatic rebalancing:
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
// Create a stable coin allocation objective
|
|
290
|
+
const stableObj = await aureon.createObjective({
|
|
291
|
+
name: "Stable Core Reserve",
|
|
292
|
+
kind: "stable_allocation",
|
|
293
|
+
targetWeight: 0.30, // Keep 30% of portfolio value in stables
|
|
294
|
+
tolerance: 0.03, // Rebalance if drift exceeds +/- 3%
|
|
295
|
+
priority: "high"
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Create a stock token tracking objective
|
|
299
|
+
const stockObj = await aureon.createObjective({
|
|
300
|
+
name: "Tesla Sleeve Allocation",
|
|
301
|
+
kind: "balanced_portfolio",
|
|
302
|
+
targetSymbol: "TSLA",
|
|
303
|
+
targetWeight: 0.20,
|
|
304
|
+
tolerance: 0.05
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// List objectives registered to the authenticated wallet
|
|
308
|
+
const objectives = await aureon.listObjectives();
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### 6.4 Evaluating Compliance, Health, and Timeline Logs
|
|
312
|
+
```ts
|
|
313
|
+
// Get active health states for all objectives
|
|
314
|
+
const healthRecords = await aureon.getHealth();
|
|
315
|
+
for (const health of healthRecords) {
|
|
316
|
+
console.log(`Objective ${health.objectiveId}: State: ${health.state}`);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Fetch timeline events (logs objective updates, breaches, and rebalances)
|
|
320
|
+
const timeline = await aureon.getTimeline();
|
|
321
|
+
timeline.forEach(event => console.log(`[${event.type}]: ${event.message}`));
|
|
322
|
+
|
|
323
|
+
// Fetch general dashboard overview metrics
|
|
324
|
+
const overview = await aureon.getOverview();
|
|
325
|
+
console.log("Global health score:", overview.globalHealthScore);
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### 6.5 Non-Custodial Vault Operations
|
|
329
|
+
Vault interactions construct raw transactions (calldatas) locally. The host application signs and broadcasts these to execute actions:
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
import { Hex } from "viem";
|
|
333
|
+
|
|
334
|
+
// 1. Prepare vault deposit parameters
|
|
335
|
+
const depositData = await aureon.prepareVaultDeposit({
|
|
336
|
+
symbol: "ETH",
|
|
337
|
+
amount: "0.5",
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// 2. Iterate and sign calldata steps
|
|
341
|
+
for (const step of depositData.steps) {
|
|
342
|
+
const hash = await walletClient.sendTransaction({
|
|
343
|
+
account,
|
|
344
|
+
to: step.to as `0x${string}`,
|
|
345
|
+
data: step.data as Hex,
|
|
346
|
+
value: BigInt(step.value),
|
|
347
|
+
});
|
|
348
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 6.6 Executing Restore Plans & Rebalances
|
|
353
|
+
If a deviation triggers a breach, fetch the restore instructions:
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
// 1. Fetch recovery plan details
|
|
357
|
+
const plan = await aureon.getRestorePlan(objective.id);
|
|
358
|
+
console.log(`Plan requires action: ${plan.kind} for ${plan.amountHuman} tokens.`);
|
|
359
|
+
|
|
360
|
+
// 2. Perform restoration
|
|
361
|
+
if (plan.kind === "vault_swap") {
|
|
362
|
+
// Vault swaps are handled directly on the backend
|
|
363
|
+
const receipt = await aureon.restoreObjective(objective.id);
|
|
364
|
+
console.log("Rebalance transaction hash:", receipt.transactionHash);
|
|
365
|
+
console.log("Settlement environment:", receipt.settlement); // "vault" or "staged"
|
|
366
|
+
} else {
|
|
367
|
+
// ETH wraps or WETH unwraps are executed client-side
|
|
368
|
+
console.warn("Execute wrap_eth or unwrap_weth using your wallet provider.");
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### 6.7 Simulating Market Events
|
|
373
|
+
Trigger price changes to test rebalancing routines:
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
// Trigger a mock 15% drop in NVDA's price mark
|
|
377
|
+
const shockResult = await aureon.applyMarketEvent({
|
|
378
|
+
symbol: "NVDA",
|
|
379
|
+
priceChangeRatio: -0.15,
|
|
380
|
+
autoRestore: true, // Trigger staged/vault restorations automatically if a breach occurs
|
|
381
|
+
});
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### 6.8 Developer API Key Management
|
|
385
|
+
Generate, toggle, and revoke keys:
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
// Generate a new key (Store the returned plain-text 'secret' immediately)
|
|
389
|
+
const newKey = await aureon.createApiKey("Secondary Bot Ingress");
|
|
390
|
+
console.log(`Plaintext secret: ${newKey.secret}`);
|
|
391
|
+
|
|
392
|
+
// List active keys
|
|
393
|
+
const keys = await aureon.listApiKeys();
|
|
394
|
+
|
|
395
|
+
// Toggle active/inactive state
|
|
396
|
+
await aureon.toggleApiKey(newKey.id);
|
|
397
|
+
|
|
398
|
+
// Revoke a key
|
|
399
|
+
await aureon.revokeApiKey(newKey.id);
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Client Configuration & Transport Engine
|
|
405
|
+
|
|
406
|
+
### 7.1 Configuration Reference Table
|
|
407
|
+
Pass these parameters inside the `AureonClientOptions` constructor payload:
|
|
408
|
+
|
|
409
|
+
| Parameter | Type | Default | Description |
|
|
410
|
+
|---|---|---|---|
|
|
411
|
+
| `baseUrl` | `string` | `"https://api.aureonlabs.network"` | Target API ingress endpoint |
|
|
412
|
+
| `apiKey` | `string` | `undefined` | Key sent with `X-Aureon-Api-Key` headers |
|
|
413
|
+
| `authToken` | `string` | `undefined` | Static JWT bearer token |
|
|
414
|
+
| `getAccessToken` | `() => string \| null` | `undefined` | Dynamic getter function resolving bearer tokens |
|
|
415
|
+
| `timeoutMs` | `number` | `30000` | Abort threshold per network call |
|
|
416
|
+
| `maxRetries` | `number` | `0` | Re-attempt counts for transport failures |
|
|
417
|
+
| `retryDelayMs` | `number` | `250` | Wait delay between retry loops |
|
|
418
|
+
| `headers` | `Record<string, string>` | `{}` | Key-value headers appended to requests |
|
|
419
|
+
| `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch wrapper engine overrides |
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
### 7.2 Retries and Network Failover
|
|
424
|
+
When `maxRetries` is greater than `0`, the client retries failed requests if it encounters a transient error (such as a timeout or a 503 HTTP status code). Retries use a fixed delay (`retryDelayMs`).
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Error Model and Code Handling
|
|
429
|
+
|
|
430
|
+
### 8.1 Error Code Reference Matrix
|
|
431
|
+
|
|
432
|
+
| Code | HTTP Status | Description |
|
|
433
|
+
|---|---|---|
|
|
434
|
+
| `UNAUTHORIZED` | 401 | Missing or invalid API key or Bearer token |
|
|
435
|
+
| `VALIDATION_ERROR`| 400 | Payload fails validation (e.g. name length or targetWeight bounds) |
|
|
436
|
+
| `NOT_FOUND` | 404 | Target object (objective, key, etc.) does not exist |
|
|
437
|
+
| `CONFLICT` | 409 | Request conflicts with current database state |
|
|
438
|
+
| `RATE_LIMITED` | 429 | Request count exceeds API limits |
|
|
439
|
+
| `SERVER_ERROR` | 500 / 503 | Server-side execution failure |
|
|
440
|
+
| `TIMEOUT` | N/A | Call exceeded client-configured `timeoutMs` |
|
|
441
|
+
| `NETWORK_ERROR` | N/A | Endpoint unreachable or client is offline |
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
### 8.2 Narrowing Errors in Practice
|
|
446
|
+
AUREON methods throw custom error instances. Wrap calls in a try/catch block and use `isAureonError` to handle them:
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
import { isAureonError } from "@buildaureon/sdk";
|
|
450
|
+
|
|
451
|
+
try {
|
|
452
|
+
const objective = await aureon.getObjective("missing_id");
|
|
453
|
+
} catch (error) {
|
|
454
|
+
if (isAureonError(error)) {
|
|
455
|
+
switch (error.code) {
|
|
456
|
+
case "NOT_FOUND":
|
|
457
|
+
console.error("The specified objective does not exist.");
|
|
458
|
+
break;
|
|
459
|
+
case "UNAUTHORIZED":
|
|
460
|
+
console.error("Check your API key and wallet session configuration.");
|
|
461
|
+
break;
|
|
462
|
+
default:
|
|
463
|
+
console.error(`Aureon error: ${error.message}`);
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
console.error("Generic execution failure:", error);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## CLI Command-Line Guide
|
|
474
|
+
|
|
475
|
+
The SDK package includes a developer CLI utility. Provide configuration values using environment variables:
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
export AUREON_API_KEY=your_key
|
|
479
|
+
export AUREON_TOKEN=your_bearer_token
|
|
480
|
+
|
|
481
|
+
# Verify connection
|
|
482
|
+
pnpm --filter @buildaureon/sdk cli ping
|
|
483
|
+
|
|
484
|
+
# Fetch current account metadata
|
|
485
|
+
pnpm --filter @buildaureon/sdk cli me
|
|
486
|
+
|
|
487
|
+
# Synchronize current on-chain balances
|
|
488
|
+
pnpm --filter @buildaureon/sdk cli sync
|
|
489
|
+
|
|
490
|
+
# Print Capital Book portfolio weights
|
|
491
|
+
pnpm --filter @buildaureon/sdk cli portfolio
|
|
492
|
+
|
|
493
|
+
# List all registered objectives
|
|
494
|
+
pnpm --filter @buildaureon/sdk cli objectives
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Design Principles & Settlement Honesty
|
|
500
|
+
|
|
501
|
+
1. **Non-Custodial Design**: Private keys never leave the client application. The AUREON API gateway only receives signature verification requests and constructs unsigned transaction payloads.
|
|
502
|
+
2. **Settlement Transparency**: Execution receipts include a `settlement` attribute (`"staged"` or `"vault"`).
|
|
503
|
+
* `"vault"` indicates the transaction settled on-chain on Robinhood Chain L2.
|
|
504
|
+
* `"staged"` indicates a local ledger update only. Staged transactions must be labeled transparently in user interfaces.
|
|
505
|
+
3. **Seeded Ledger Capital**: Position data comes from synchronized block queries or explicit operator inputs. The SDK does not fabricate capital balances.
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## Documentation Registry Map
|
|
510
|
+
|
|
511
|
+
For more detail, refer to the documents inside the `sdk/docs/` directory:
|
|
512
|
+
|
|
513
|
+
| Document | Focus |
|
|
514
|
+
|---|---|
|
|
515
|
+
| [docs/architecture.md](docs/architecture.md) | Client vs API boundary lines and system maps |
|
|
516
|
+
| [docs/auth.md](docs/auth.md) | Wallet handshake, signature verifications, and JWT lifecycles |
|
|
517
|
+
| [docs/client-api.md](docs/client-api.md) | Detailed parameter index for all client methods |
|
|
518
|
+
| [docs/data-contracts.md](docs/data-contracts.md) | Type index matching hosted JSON endpoints |
|
|
519
|
+
| [docs/error-model.md](docs/error-model.md) | Complete error code listing and code mappings |
|
|
520
|
+
| [docs/integration-guide.md](docs/integration-guide.md) | End-to-end integration walkthroughs |
|
|
521
|
+
| [docs/security.md](docs/security.md) | API key and token security guidelines |
|
|
522
|
+
| [docs/transport.md](docs/transport.md) | Transport configurations, retry loops, and error-handling |
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Community & Resources
|
|
527
|
+
|
|
528
|
+
* **Official Website**: [aureonlabs.network](https://aureonlabs.network)
|
|
529
|
+
* **Operator Utility Platform**: [app.aureonlabs.network](https://app.aureonlabs.network)
|
|
530
|
+
* **Twitter / X**: [@buildaureon](https://x.com/buildaureon)
|
|
531
|
+
* **GitHub Repository**: [github.com/buildaureon](https://github.com/buildaureon)
|
|
532
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultBaseUrl": "https://api.aureonlabs.network",
|
|
3
|
+
"localBaseUrl": "http://127.0.0.1:8787",
|
|
4
|
+
"appUrl": "https://app.aureonlabs.network",
|
|
5
|
+
"product": "AUREON",
|
|
6
|
+
"chain": "Robinhood Chain Testnet",
|
|
7
|
+
"chainId": 46630,
|
|
8
|
+
"sdkPackage": "@buildaureon/sdk",
|
|
9
|
+
"sdkVersion": "0.1.0"
|
|
10
|
+
}
|