@buildaureon/sdk 0.1.7 → 0.1.8
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 +6 -3
- package/config/network.json +17 -7
- package/dist/index.d.ts +64 -12
- package/dist/index.js +98 -9
- package/dist/index.js.map +1 -1
- package/docs/architecture.md +10 -8
- package/docs/auth.md +5 -3
- package/docs/client-api.md +9 -3
- package/docs/error-model.md +2 -2
- package/docs/integration-guide.md +28 -25
- package/docs/receipt-validation.md +4 -1
- package/docs/security.md +1 -1
- package/docs/transport.md +2 -1
- package/examples/ai-to-objective-to-portfolio/main.ts +6 -3
- package/examples/audit-trail/main.ts +4 -2
- package/examples/drift-detect-restore/main.ts +6 -3
- package/examples/e2e-policy-rebalance/main.ts +13 -8
- package/examples/e2e-policy-rebalance/underrun.ts +13 -8
- package/examples/e2e-policy-rebalance/verify-sizing.ts +13 -8
- package/examples/e2e-vault-flow/main.ts +13 -8
- package/examples/full-aureon-loop/main.ts +6 -3
- package/examples/green-vs-plan/main.ts +6 -3
- package/examples/market-event/main.ts +6 -3
- package/examples/portfolio-watch/main.ts +6 -3
- package/examples/quickstart/main.ts +8 -5
- package/examples/receipt-verification/main.ts +6 -3
- package/examples/sdk-demo-terminal/main.ts +6 -4
- package/package.json +25 -23
package/docs/architecture.md
CHANGED
|
@@ -184,16 +184,18 @@ flowchart TD
|
|
|
184
184
|
|
|
185
185
|
---
|
|
186
186
|
|
|
187
|
-
## 8. Network
|
|
187
|
+
## 8. Network
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
|
|
|
189
|
+
Default omitted SDK/MCP options are the **isolated mainnet stack** (4663 + local 8788). Public `api.aureonlabs.network` is still **testnet 46630**.
|
|
190
|
+
|
|
191
|
+
| Item | Mainnet (default) | Testnet (opt-in) |
|
|
192
|
+
| --- | --- | --- |
|
|
193
|
+
| Chain | Robinhood Chain mainnet | Robinhood Chain testnet |
|
|
194
|
+
| Chain ID | `4663` | `46630` |
|
|
195
|
+
| API | `http://127.0.0.1:8788` | `https://api.aureonlabs.network` |
|
|
196
|
+
| Explorer | `https://robinhoodchain.blockscout.com` | `https://explorer.testnet.chain.robinhood.com` |
|
|
195
197
|
|
|
196
|
-
|
|
198
|
+
Production does **not** already sync 4663. Confirm live addresses from the API you actually call.
|
|
197
199
|
|
|
198
200
|
---
|
|
199
201
|
|
package/docs/auth.md
CHANGED
|
@@ -40,8 +40,9 @@ Control-plane calls (sync, objectives, health, restore, vault reads, prepare-*)
|
|
|
40
40
|
import { createAureonClient } from "@buildaureon/sdk";
|
|
41
41
|
|
|
42
42
|
const aureon = createAureonClient({
|
|
43
|
-
baseUrl: "https://api.aureonlabs.network",
|
|
44
43
|
apiKey: process.env.AUREON_API_KEY!, // issued key from Developers
|
|
44
|
+
// omit network → mainnet 4663 / http://127.0.0.1:8788
|
|
45
|
+
// network: "testnet" → public host (still 46630)
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
const me = await aureon.me();
|
|
@@ -88,7 +89,7 @@ import { createAureonClient, createSessionTokenProvider } from "@buildaureon/sdk
|
|
|
88
89
|
|
|
89
90
|
const session = createSessionTokenProvider(null);
|
|
90
91
|
const aureon = createAureonClient({
|
|
91
|
-
|
|
92
|
+
network: "testnet", // public host, still chain 46630
|
|
92
93
|
apiKey: process.env.AUREON_API_KEY,
|
|
93
94
|
getAccessToken: session.getAccessToken,
|
|
94
95
|
});
|
|
@@ -143,7 +144,8 @@ session.clear();
|
|
|
143
144
|
| Variable | Required | Description |
|
|
144
145
|
| --- | --- | --- |
|
|
145
146
|
| `AUREON_API_KEY` | Recommended | Issued developer key |
|
|
146
|
-
| `
|
|
147
|
+
| `AUREON_NETWORK` | No | Omit for mainnet 4663 / `http://127.0.0.1:8788`. Set `testnet` for the public host (still 46630). |
|
|
148
|
+
| `AUREON_API_URL` | No | Optional override. Must match `AUREON_NETWORK` if both are set. |
|
|
147
149
|
| `AUREON_TOKEN` | No | Optional Bearer for CLI / scripts |
|
|
148
150
|
|
|
149
151
|
CLI example:
|
package/docs/client-api.md
CHANGED
|
@@ -32,7 +32,8 @@ import {
|
|
|
32
32
|
} from "@buildaureon/sdk";
|
|
33
33
|
|
|
34
34
|
const aureon = createAureonClient({
|
|
35
|
-
//
|
|
35
|
+
// network defaults to mainnet (4663 / http://127.0.0.1:8788)
|
|
36
|
+
// network: "testnet" → public host (still chain 46630)
|
|
36
37
|
apiKey: process.env.AUREON_API_KEY,
|
|
37
38
|
getAccessToken: () => sessionToken,
|
|
38
39
|
timeoutMs: 30_000,
|
|
@@ -44,7 +45,8 @@ const aureon = createAureonClient({
|
|
|
44
45
|
|
|
45
46
|
| Option | Required | Default | Description |
|
|
46
47
|
|--------|----------|---------|-------------|
|
|
47
|
-
| `
|
|
48
|
+
| `network` | no | `mainnet` | `mainnet` = 4663 / `http://127.0.0.1:8788`. `testnet` = public host (still 46630). |
|
|
49
|
+
| `baseUrl` | no | mainnet local API | Absolute `http://` or `https://` URL. Wins when set; mismatch with `network` throws. |
|
|
48
50
|
| `apiKey` | SDK / CLI | N/A | Sent as `X-Aureon-Api-Key`. Issued developer keys also identify the bound wallet (no Bearer required). Env bootstrap keys are product-gate only. Utility uses wallet Bearer only. |
|
|
49
51
|
| `getAccessToken` | no | N/A | Optional Bearer getter. Wins over API-key identity when present. |
|
|
50
52
|
| `authToken` | no | N/A | Static Bearer string when `getAccessToken` is omitted. |
|
|
@@ -59,8 +61,12 @@ const aureon = createAureonClient({
|
|
|
59
61
|
|
|
60
62
|
| Rule | Behavior |
|
|
61
63
|
|------|----------|
|
|
62
|
-
| Omitted `baseUrl` |
|
|
64
|
+
| Omitted `network` and `baseUrl` | Local mainnet `http://127.0.0.1:8788`, chain 4663 |
|
|
65
|
+
| `network: "testnet"` | Public `https://api.aureonlabs.network` (still 46630) |
|
|
66
|
+
| Explicit `baseUrl` | Wins; infer network from known hosts |
|
|
67
|
+
| `network` + disagreeing `baseUrl` | Throws |
|
|
63
68
|
| Invalid `baseUrl` scheme | Throws via `assertBaseUrl` |
|
|
69
|
+
| `aureon.network` / `aureon.chainId` | Resolved bundle |
|
|
64
70
|
| Both `authToken` and `getAccessToken` | Transport uses `getAccessToken` only |
|
|
65
71
|
| `aureon.baseUrl` getter | Returns resolved base (no trailing slash) |
|
|
66
72
|
|
package/docs/error-model.md
CHANGED
|
@@ -134,7 +134,7 @@ flowchart TD
|
|
|
134
134
|
| --- | --- |
|
|
135
135
|
| Invalid / paused key | Stop loop; operator rotates Developers key |
|
|
136
136
|
| Bootstrap key alone | Switch to issued key |
|
|
137
|
-
| Vault empty on restore |
|
|
137
|
+
| Vault empty on restore | Expected first use. Call `prepareVaultDeposit`, return unsigned steps, wait for the **user/host** to broadcast. Agents do not fund the vault. |
|
|
138
138
|
| Locked field on update | Recreate objective |
|
|
139
139
|
| Conflict mid-restore | Back off; read timeline / executions |
|
|
140
140
|
| Staged settlement returned | Do not treat as on-chain success |
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
|
|
187
187
|
test("empty objective name fails validation", async () => {
|
|
188
188
|
const client = createAureonClient({
|
|
189
|
-
|
|
189
|
+
network: "testnet",
|
|
190
190
|
apiKey: "test",
|
|
191
191
|
});
|
|
192
192
|
|
|
@@ -11,8 +11,11 @@ Integrate `@buildaureon/sdk` into server-side agents and automated rebalancing l
|
|
|
11
11
|
```mermaid
|
|
12
12
|
flowchart TD
|
|
13
13
|
Init[1_issued_API_key_client] --> Sync[2_sync_Capital_Book]
|
|
14
|
-
Sync -->
|
|
15
|
-
|
|
14
|
+
Sync --> Empty{vault empty?}
|
|
15
|
+
Empty -->|yes| FourOhNine[restore 409]
|
|
16
|
+
FourOhNine --> Prep[prepareVaultDeposit unsigned]
|
|
17
|
+
Prep --> User[user/host signs when they use it]
|
|
18
|
+
Empty -->|no| Obj[create Auto objective]
|
|
16
19
|
Obj --> Loop[5_watchdog_heartbeat]
|
|
17
20
|
Loop -->|breach| Plan[6_restore_plan]
|
|
18
21
|
Plan --> Restore[7_restoreObjective]
|
|
@@ -22,10 +25,12 @@ flowchart TD
|
|
|
22
25
|
### Step 1 — Client
|
|
23
26
|
|
|
24
27
|
```ts
|
|
25
|
-
import { createAureonClient } from "@buildaureon/sdk";
|
|
28
|
+
import { createAureonClient, resolveAureonNetworkFromEnv } from "@buildaureon/sdk";
|
|
26
29
|
|
|
30
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
27
31
|
export const aureon = createAureonClient({
|
|
28
|
-
|
|
32
|
+
network: resolved.network,
|
|
33
|
+
baseUrl: resolved.baseUrl,
|
|
29
34
|
apiKey: process.env.AUREON_API_KEY!, // issued Developers key
|
|
30
35
|
timeoutMs: 30_000,
|
|
31
36
|
maxRetries: 2,
|
|
@@ -39,11 +44,17 @@ console.log("operating as", me.walletAddress);
|
|
|
39
44
|
Optional Bearer (usually unnecessary with an issued key):
|
|
40
45
|
|
|
41
46
|
```ts
|
|
42
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
createAureonClient,
|
|
49
|
+
createSessionTokenProvider,
|
|
50
|
+
resolveAureonNetworkFromEnv,
|
|
51
|
+
} from "@buildaureon/sdk";
|
|
43
52
|
|
|
53
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
44
54
|
const session = createSessionTokenProvider(process.env.AUREON_TOKEN ?? null);
|
|
45
55
|
export const aureon = createAureonClient({
|
|
46
|
-
|
|
56
|
+
network: resolved.network,
|
|
57
|
+
baseUrl: resolved.baseUrl,
|
|
47
58
|
apiKey: process.env.AUREON_API_KEY ?? null,
|
|
48
59
|
getAccessToken: session.getAccessToken,
|
|
49
60
|
});
|
|
@@ -62,28 +73,19 @@ console.log({
|
|
|
62
73
|
|
|
63
74
|
Prefer `syncPortfolio()` over hand-seeded books in production. Use `setPortfolio` only for controlled rehearsals.
|
|
64
75
|
|
|
65
|
-
### Step 3 —
|
|
76
|
+
### Step 3 — Empty vault is first use (do not fund for the user)
|
|
66
77
|
|
|
67
|
-
Automatic
|
|
78
|
+
Automatic restore on an empty vault must **409**. That is the same path as testnet. The SDK/MCP process does **not** broadcast a deposit. When the user actually uses the product, their host wallet signs `prepareVaultDeposit` steps.
|
|
68
79
|
|
|
69
80
|
```ts
|
|
70
81
|
import type { VaultPrepareResult } from "@buildaureon/sdk";
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (!status.empty && status.canRestore) return status;
|
|
79
|
-
|
|
80
|
-
const prep = await aureon.prepareVaultDeposit({ symbol, amount });
|
|
81
|
-
for (const step of prep.steps) {
|
|
82
|
-
const hash = await broadcast(step);
|
|
83
|
-
console.log(step.label, hash);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return aureon.getVaultStatus();
|
|
83
|
+
const status = await aureon.getVaultStatus();
|
|
84
|
+
if (status.empty) {
|
|
85
|
+
// restoreObjective must 409 here — do not treat that as a bug
|
|
86
|
+
const prep = await aureon.prepareVaultDeposit({ symbol: "USDG", amount: "0.05" });
|
|
87
|
+
// prep.steps are UNSIGNED. Return them. The user broadcasts when they fund.
|
|
88
|
+
return prep;
|
|
87
89
|
}
|
|
88
90
|
```
|
|
89
91
|
|
|
@@ -317,7 +319,8 @@ module.exports = {
|
|
|
317
319
|
autorestart: true,
|
|
318
320
|
env: {
|
|
319
321
|
NODE_ENV: "production",
|
|
320
|
-
AUREON_API_URL
|
|
322
|
+
// omit AUREON_API_URL for local mainnet 8788 / 4663
|
|
323
|
+
// AUREON_NETWORK: "testnet" // public host, still 46630
|
|
321
324
|
// AUREON_API_KEY from secret store / PM2 ecosystem secrets
|
|
322
325
|
},
|
|
323
326
|
},
|
|
@@ -380,7 +383,7 @@ Never log API keys, Bearer tokens, or private keys.
|
|
|
380
383
|
| --- | --- | --- |
|
|
381
384
|
| 401 invalid key | Wrong / paused / revoked key | Rotate in Developers |
|
|
382
385
|
| 401 need issued key | Env bootstrap key alone | Use an issued Developers key |
|
|
383
|
-
| Vault empty / cannot restore |
|
|
386
|
+
| Vault empty / cannot restore | First use — no user deposit yet | `prepareVaultDeposit` (unsigned). User/host broadcasts when they fund. Agents do not. |
|
|
384
387
|
| Update rejects symbol/mode | Locked at create | Recreate objective |
|
|
385
388
|
| Restore receipt `staged` | Ledger-local path | Do not claim on-chain |
|
|
386
389
|
| Health still violated after restore | Prices / sizing / liquidity | Re-read plan, vault balances, timeline |
|
|
@@ -9,12 +9,15 @@ Phase 2 receipts must follow honest settlement rules. Use the SDK validator afte
|
|
|
9
9
|
```ts
|
|
10
10
|
import {
|
|
11
11
|
createAureonClient,
|
|
12
|
+
resolveAureonNetworkFromEnv,
|
|
12
13
|
validateExecutionReceipt,
|
|
13
14
|
assertValidExecutionReceipt,
|
|
14
15
|
} from "@buildaureon/sdk";
|
|
15
16
|
|
|
17
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
16
18
|
const client = createAureonClient({
|
|
17
|
-
|
|
19
|
+
network: resolved.network,
|
|
20
|
+
baseUrl: resolved.baseUrl,
|
|
18
21
|
apiKey: process.env.AUREON_API_KEY!,
|
|
19
22
|
});
|
|
20
23
|
|
package/docs/security.md
CHANGED
|
@@ -82,7 +82,7 @@ Never collapse staged into “confirmed on Robinhood Chain.”
|
|
|
82
82
|
|
|
83
83
|
## 5. Transport and logging hygiene
|
|
84
84
|
|
|
85
|
-
-
|
|
85
|
+
- Default omitted client is local mainnet `http://127.0.0.1:8788` (4663). Use `network: "testnet"` for the public host (still 46630). Do not call that host production.
|
|
86
86
|
- Do not log raw `Authorization` or `X-Aureon-Api-Key`.
|
|
87
87
|
- Redact prepare step calldata in public logs if it includes sensitive amounts in your threat model.
|
|
88
88
|
- Set `timeoutMs` / `maxRetries` deliberately for agent loops (see [transport.md](./transport.md)).
|
package/docs/transport.md
CHANGED
|
@@ -48,7 +48,8 @@ Issued developer keys in `X-Aureon-Api-Key` are enough for control-plane identit
|
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
50
|
createAureonClient({
|
|
51
|
-
|
|
51
|
+
// omit network → local mainnet 8788 / 4663
|
|
52
|
+
// network: "testnet" → public host (still 46630)
|
|
52
53
|
apiKey: process.env.AUREON_API_KEY!,
|
|
53
54
|
timeoutMs: 30_000, // per attempt
|
|
54
55
|
maxRetries: 2, // extra attempts after first failure
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
|
-
*
|
|
6
|
+
* AUREON_NETWORK optional; omit for mainnet (4663 / 8788); set testnet for public host (still 46630)
|
|
7
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
7
8
|
*
|
|
8
9
|
* pnpm example:ai-to-objective-to-portfolio
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
createAureonClient,
|
|
13
|
-
|
|
14
|
+
resolveAureonNetworkFromEnv,
|
|
14
15
|
formatWeight,
|
|
15
16
|
isAureonError,
|
|
16
17
|
parseFinancialIntent,
|
|
@@ -54,8 +55,10 @@ async function main(): Promise<void> {
|
|
|
54
55
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
57
59
|
const aureon = createAureonClient({
|
|
58
|
-
|
|
60
|
+
network: resolved.network,
|
|
61
|
+
baseUrl: resolved.baseUrl,
|
|
59
62
|
apiKey,
|
|
60
63
|
});
|
|
61
64
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
createAureonClient,
|
|
14
|
-
|
|
14
|
+
resolveAureonNetworkFromEnv,
|
|
15
15
|
formatAuditTrailLines,
|
|
16
16
|
isAureonError,
|
|
17
17
|
} from "../../src/index.js";
|
|
@@ -22,8 +22,10 @@ async function main(): Promise<void> {
|
|
|
22
22
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
25
26
|
const aureon = createAureonClient({
|
|
26
|
-
|
|
27
|
+
network: resolved.network,
|
|
28
|
+
baseUrl: resolved.baseUrl,
|
|
27
29
|
apiKey,
|
|
28
30
|
});
|
|
29
31
|
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Env:
|
|
7
7
|
* AUREON_API_KEY issued developer key (required)
|
|
8
|
-
*
|
|
8
|
+
* AUREON_NETWORK optional; omit for mainnet (4663 / 8788); set testnet for public host (still 46630)
|
|
9
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
9
10
|
*
|
|
10
11
|
* pnpm example:drift-detect-restore
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
createAureonClient,
|
|
15
|
-
|
|
16
|
+
resolveAureonNetworkFromEnv,
|
|
16
17
|
formatWeight,
|
|
17
18
|
isAureonError,
|
|
18
19
|
type DriftRestoreFlow,
|
|
@@ -75,8 +76,10 @@ async function main(): Promise<void> {
|
|
|
75
76
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
78
80
|
const aureon = createAureonClient({
|
|
79
|
-
|
|
81
|
+
network: resolved.network,
|
|
82
|
+
baseUrl: resolved.baseUrl,
|
|
80
83
|
apiKey,
|
|
81
84
|
});
|
|
82
85
|
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
6
|
* AUREON_WALLET_PRIVATE_KEY 0x… signing key (required)
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* AUREON_NETWORK optional; omit for mainnet 8788 / 4663; testnet = public host (still 46630)
|
|
8
|
+
* AUREON_API_URL optional override
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
10
11
|
*
|
|
11
12
|
* pnpm --filter @buildaureon/sdk example:e2e-policy
|
|
12
13
|
*/
|
|
@@ -25,7 +26,7 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
25
26
|
import {
|
|
26
27
|
createAureonClient,
|
|
27
28
|
createSessionTokenProvider,
|
|
28
|
-
|
|
29
|
+
resolveAureonNetworkFromEnv,
|
|
29
30
|
isAureonError,
|
|
30
31
|
} from "../../src/index.js";
|
|
31
32
|
|
|
@@ -61,11 +62,14 @@ function log(step: string, data?: unknown) {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
async function main() {
|
|
64
|
-
const
|
|
65
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
66
|
+
const baseUrl = resolved.baseUrl;
|
|
67
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID ?? resolved.chainId);
|
|
65
68
|
const rpcUrl =
|
|
66
69
|
process.env.AUREON_RPC_URL?.trim() ||
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
(chainId === 4663
|
|
71
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
72
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
69
73
|
const apiKey = requireEnv("AUREON_API_KEY");
|
|
70
74
|
|
|
71
75
|
const account = privateKeyToAccount(loadKey());
|
|
@@ -73,7 +77,7 @@ async function main() {
|
|
|
73
77
|
const walletClient = createWalletClient({ account, transport: http(rpcUrl) });
|
|
74
78
|
const chain = {
|
|
75
79
|
id: chainId,
|
|
76
|
-
name: "Robinhood Chain Testnet",
|
|
80
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
77
81
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
78
82
|
rpcUrls: { default: { http: [rpcUrl] } },
|
|
79
83
|
} as const;
|
|
@@ -82,6 +86,7 @@ async function main() {
|
|
|
82
86
|
|
|
83
87
|
const session = createSessionTokenProvider(null);
|
|
84
88
|
const aureon = createAureonClient({
|
|
89
|
+
network: resolved.network,
|
|
85
90
|
baseUrl,
|
|
86
91
|
apiKey,
|
|
87
92
|
getAccessToken: session.getAccessToken,
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key
|
|
6
6
|
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* AUREON_NETWORK optional; omit for mainnet 8788 / 4663; testnet = public host (still 46630)
|
|
8
|
+
* AUREON_API_URL optional override
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
import {
|
|
@@ -20,7 +21,7 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
20
21
|
import {
|
|
21
22
|
createAureonClient,
|
|
22
23
|
createSessionTokenProvider,
|
|
23
|
-
|
|
24
|
+
resolveAureonNetworkFromEnv,
|
|
24
25
|
isAureonError,
|
|
25
26
|
} from "../../src/index.js";
|
|
26
27
|
|
|
@@ -36,22 +37,26 @@ if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const account = privateKeyToAccount(key);
|
|
40
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
41
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID || resolved.chainId);
|
|
39
42
|
const rpc =
|
|
40
43
|
process.env.AUREON_RPC_URL?.trim() ||
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
(chainId === 4663
|
|
45
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
46
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
43
47
|
const publicClient = createPublicClient({ transport: http(rpc) });
|
|
44
48
|
const walletClient = createWalletClient({ account, transport: http(rpc) });
|
|
45
49
|
const chain = {
|
|
46
50
|
id: chainId,
|
|
47
|
-
name: "Robinhood Chain Testnet",
|
|
51
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
48
52
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
49
53
|
rpcUrls: { default: { http: [rpc] } },
|
|
50
54
|
} as const;
|
|
51
55
|
|
|
52
56
|
const session = createSessionTokenProvider(null);
|
|
53
57
|
const aureon = createAureonClient({
|
|
54
|
-
|
|
58
|
+
network: resolved.network,
|
|
59
|
+
baseUrl: resolved.baseUrl,
|
|
55
60
|
apiKey: requireEnv("AUREON_API_KEY"),
|
|
56
61
|
getAccessToken: session.getAccessToken,
|
|
57
62
|
});
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key
|
|
6
6
|
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* AUREON_NETWORK optional; omit for mainnet 8788 / 4663; testnet = public host (still 46630)
|
|
8
|
+
* AUREON_API_URL optional override
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
import {
|
|
@@ -20,7 +21,7 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
20
21
|
import {
|
|
21
22
|
createAureonClient,
|
|
22
23
|
createSessionTokenProvider,
|
|
23
|
-
|
|
24
|
+
resolveAureonNetworkFromEnv,
|
|
24
25
|
} from "../../src/index.js";
|
|
25
26
|
|
|
26
27
|
function requireEnv(name: string): string {
|
|
@@ -35,22 +36,26 @@ if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const account = privateKeyToAccount(key);
|
|
39
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
40
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID || resolved.chainId);
|
|
38
41
|
const rpc =
|
|
39
42
|
process.env.AUREON_RPC_URL?.trim() ||
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
(chainId === 4663
|
|
44
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
45
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
42
46
|
const publicClient = createPublicClient({ transport: http(rpc) });
|
|
43
47
|
const walletClient = createWalletClient({ account, transport: http(rpc) });
|
|
44
48
|
const chain = {
|
|
45
49
|
id: chainId,
|
|
46
|
-
name: "Robinhood Chain Testnet",
|
|
50
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
47
51
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
48
52
|
rpcUrls: { default: { http: [rpc] } },
|
|
49
53
|
} as const;
|
|
50
54
|
|
|
51
55
|
const session = createSessionTokenProvider(null);
|
|
52
56
|
const aureon = createAureonClient({
|
|
53
|
-
|
|
57
|
+
network: resolved.network,
|
|
58
|
+
baseUrl: resolved.baseUrl,
|
|
54
59
|
apiKey: requireEnv("AUREON_API_KEY"),
|
|
55
60
|
getAccessToken: session.getAccessToken,
|
|
56
61
|
});
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Env (integrators only — no local repo files):
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
|
-
*
|
|
6
|
+
* AUREON_NETWORK optional; omit for mainnet 8788 / 4663; testnet = public host (still 46630)
|
|
7
|
+
* AUREON_API_URL optional override
|
|
7
8
|
* AUREON_WALLET_PRIVATE_KEY 0x… key used to sign auth + broadcast vault txs (required)
|
|
8
|
-
* AUREON_RPC_URL optional (
|
|
9
|
-
* AUREON_CHAIN_ID optional (
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
10
11
|
*
|
|
11
12
|
* pnpm --filter @buildaureon/sdk example:e2e
|
|
12
13
|
*/
|
|
@@ -21,7 +22,7 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
21
22
|
import {
|
|
22
23
|
createAureonClient,
|
|
23
24
|
createSessionTokenProvider,
|
|
24
|
-
|
|
25
|
+
resolveAureonNetworkFromEnv,
|
|
25
26
|
isAureonError,
|
|
26
27
|
} from "../../src/index.js";
|
|
27
28
|
|
|
@@ -48,12 +49,15 @@ function log(step: string, data?: unknown): void {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
async function main(): Promise<void> {
|
|
51
|
-
const
|
|
52
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
53
|
+
const baseUrl = resolved.baseUrl;
|
|
52
54
|
const apiKey = requireEnv("AUREON_API_KEY");
|
|
55
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID ?? resolved.chainId);
|
|
53
56
|
const rpcUrl =
|
|
54
57
|
process.env.AUREON_RPC_URL?.trim() ||
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
(chainId === 4663
|
|
59
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
60
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
57
61
|
|
|
58
62
|
const account = privateKeyToAccount(loadPrivateKey());
|
|
59
63
|
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
@@ -63,13 +67,14 @@ async function main(): Promise<void> {
|
|
|
63
67
|
});
|
|
64
68
|
const chain = {
|
|
65
69
|
id: chainId,
|
|
66
|
-
name: "Robinhood Chain Testnet",
|
|
70
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
67
71
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
68
72
|
rpcUrls: { default: { http: [rpcUrl] } },
|
|
69
73
|
} as const;
|
|
70
74
|
|
|
71
75
|
const session = createSessionTokenProvider(null);
|
|
72
76
|
const aureon = createAureonClient({
|
|
77
|
+
network: resolved.network,
|
|
73
78
|
baseUrl,
|
|
74
79
|
apiKey,
|
|
75
80
|
getAccessToken: session.getAccessToken,
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
|
-
*
|
|
6
|
+
* AUREON_NETWORK optional; omit for mainnet (4663 / 8788); set testnet for public host (still 46630)
|
|
7
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
7
8
|
*
|
|
8
9
|
* pnpm example:full-aureon-loop
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
createAureonClient,
|
|
13
|
-
|
|
14
|
+
resolveAureonNetworkFromEnv,
|
|
14
15
|
formatWeight,
|
|
15
16
|
isAureonError,
|
|
16
17
|
type FullAureonLoopFlow,
|
|
@@ -64,8 +65,10 @@ async function main(): Promise<void> {
|
|
|
64
65
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
67
69
|
const aureon = createAureonClient({
|
|
68
|
-
|
|
70
|
+
network: resolved.network,
|
|
71
|
+
baseUrl: resolved.baseUrl,
|
|
69
72
|
apiKey,
|
|
70
73
|
});
|
|
71
74
|
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Env:
|
|
8
8
|
* AUREON_API_KEY issued developer key (required)
|
|
9
|
-
*
|
|
9
|
+
* AUREON_NETWORK optional; omit for mainnet (4663 / 8788); set testnet for public host (still 46630)
|
|
10
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
10
11
|
*
|
|
11
12
|
* pnpm example:green-vs-plan
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
createAureonClient,
|
|
16
|
-
|
|
17
|
+
resolveAureonNetworkFromEnv,
|
|
17
18
|
formatWeight,
|
|
18
19
|
isAureonError,
|
|
19
20
|
type AllocationComparisonRow,
|
|
@@ -70,8 +71,10 @@ async function main(): Promise<void> {
|
|
|
70
71
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
73
75
|
const aureon = createAureonClient({
|
|
74
|
-
|
|
76
|
+
network: resolved.network,
|
|
77
|
+
baseUrl: resolved.baseUrl,
|
|
75
78
|
apiKey,
|
|
76
79
|
});
|
|
77
80
|
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
|
-
*
|
|
6
|
+
* AUREON_NETWORK optional; omit for mainnet (4663 / 8788); set testnet for public host (still 46630)
|
|
7
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
7
8
|
*
|
|
8
9
|
* pnpm --filter @buildaureon/sdk example:market
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
createAureonClient,
|
|
13
|
-
|
|
14
|
+
resolveAureonNetworkFromEnv,
|
|
14
15
|
isAureonError,
|
|
15
16
|
} from "../../src/index.js";
|
|
16
17
|
|
|
@@ -20,8 +21,10 @@ async function main(): Promise<void> {
|
|
|
20
21
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
23
25
|
const aureon = createAureonClient({
|
|
24
|
-
|
|
26
|
+
network: resolved.network,
|
|
27
|
+
baseUrl: resolved.baseUrl,
|
|
25
28
|
apiKey,
|
|
26
29
|
});
|
|
27
30
|
|