@buildaureon/sdk 0.1.7 → 0.1.9
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/CHANGELOG.md +71 -0
- package/README.md +673 -655
- package/config/network.json +17 -7
- package/dist/index.d.ts +71 -14
- package/dist/index.js +109 -10
- package/dist/index.js.map +1 -1
- package/docs/architecture.md +210 -206
- package/docs/auth.md +176 -174
- package/docs/client-api.md +788 -782
- package/docs/data-contracts.md +3 -3
- package/docs/error-model.md +217 -217
- package/docs/integration-guide.md +400 -397
- package/docs/receipt-validation.md +66 -63
- package/docs/security.md +120 -120
- package/docs/transport.md +143 -142
- 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 +431 -426
- package/examples/e2e-policy-rebalance/underrun.ts +143 -138
- package/examples/e2e-policy-rebalance/verify-sizing.ts +155 -150
- package/examples/e2e-vault-flow/main.ts +221 -216
- 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 +75 -72
- package/examples/receipt-verification/main.ts +6 -3
- package/examples/sdk-demo-terminal/main.ts +6 -4
- package/package.json +26 -23
|
@@ -1,72 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Quickstart — control-plane calls with an issued developer API key.
|
|
3
|
-
*
|
|
4
|
-
* Env (required for integrators — nothing else):
|
|
5
|
-
* AUREON_API_KEY
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
formatWeight,
|
|
15
|
-
isAureonError,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
console.log("
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
console.log("
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Quickstart — control-plane calls with an issued developer API key.
|
|
3
|
+
*
|
|
4
|
+
* Env (required for integrators — nothing else):
|
|
5
|
+
* AUREON_API_KEY issued key from Developers
|
|
6
|
+
* AUREON_NETWORK optional; omit for official API / testnet 46630; set mainnet for chain 4663
|
|
7
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
8
|
+
*
|
|
9
|
+
* pnpm --filter @buildaureon/sdk example:quickstart
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
createAureonClient,
|
|
14
|
+
formatWeight,
|
|
15
|
+
isAureonError,
|
|
16
|
+
resolveAureonNetworkFromEnv,
|
|
17
|
+
} from "../../src/index.js";
|
|
18
|
+
|
|
19
|
+
async function main(): Promise<void> {
|
|
20
|
+
const apiKey = process.env.AUREON_API_KEY?.trim();
|
|
21
|
+
if (!apiKey) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
"Set AUREON_API_KEY to an issued developer key from the AUREON Developers page."
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
28
|
+
const aureon = createAureonClient({
|
|
29
|
+
network: resolved.network,
|
|
30
|
+
baseUrl: resolved.baseUrl,
|
|
31
|
+
apiKey,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const ping = await aureon.ping();
|
|
35
|
+
console.log("connected", ping);
|
|
36
|
+
|
|
37
|
+
const me = await aureon.me();
|
|
38
|
+
console.log("wallet", me.walletAddress);
|
|
39
|
+
|
|
40
|
+
const synced = await aureon.syncPortfolio();
|
|
41
|
+
console.log("synced", {
|
|
42
|
+
chainId: synced.chainId,
|
|
43
|
+
positions: synced.portfolio.positions.length,
|
|
44
|
+
stableWeight: formatWeight(synced.portfolio.stableWeight),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const vault = await aureon.getVaultStatus();
|
|
48
|
+
console.log("vault", {
|
|
49
|
+
empty: vault.empty,
|
|
50
|
+
canRestore: vault.canRestore,
|
|
51
|
+
totalNotionalUsd: vault.totalNotionalUsd,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const objectives = await aureon.listObjectives();
|
|
55
|
+
console.log(
|
|
56
|
+
"objectives",
|
|
57
|
+
objectives.map((o) => ({
|
|
58
|
+
name: o.name,
|
|
59
|
+
automationMode: o.automationMode,
|
|
60
|
+
}))
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
console.log(
|
|
64
|
+
"hint: empty vault restore is 409. prepare-deposit is unsigned — the user broadcasts when they fund. Agents do not."
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
main().catch((error) => {
|
|
69
|
+
if (isAureonError(error)) {
|
|
70
|
+
console.error(`${error.code}: ${error.message}`);
|
|
71
|
+
} else {
|
|
72
|
+
console.error(error instanceof Error ? error.message : error);
|
|
73
|
+
}
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
});
|
|
@@ -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 official API / testnet 46630; set mainnet for chain 4663
|
|
9
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
9
10
|
*
|
|
10
11
|
* pnpm example:receipt-verification
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
createAureonClient,
|
|
15
|
-
|
|
16
|
+
resolveAureonNetworkFromEnv,
|
|
16
17
|
isAureonError,
|
|
17
18
|
type ReceiptVerificationFlow,
|
|
18
19
|
} from "../../src/index.js";
|
|
@@ -68,8 +69,10 @@ async function main(): Promise<void> {
|
|
|
68
69
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
71
73
|
const aureon = createAureonClient({
|
|
72
|
-
|
|
74
|
+
network: resolved.network,
|
|
75
|
+
baseUrl: resolved.baseUrl,
|
|
73
76
|
apiKey,
|
|
74
77
|
});
|
|
75
78
|
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Env:
|
|
5
5
|
* AUREON_API_KEY issued developer key (required)
|
|
6
|
-
*
|
|
6
|
+
* AUREON_NETWORK optional; omit for official API / testnet 46630; set mainnet for chain 4663
|
|
7
|
+
* AUREON_API_URL optional override (must match network if both set)
|
|
7
8
|
*
|
|
8
9
|
* pnpm --filter @buildaureon/sdk example:sdk-demo-terminal
|
|
9
10
|
* pnpm --filter @buildaureon/sdk example:sdk-demo-terminal -- --create-only
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
|
|
12
13
|
import {
|
|
13
14
|
createAureonClient,
|
|
14
|
-
|
|
15
|
+
resolveAureonNetworkFromEnv,
|
|
15
16
|
formatWeight,
|
|
16
17
|
isAureonError,
|
|
17
18
|
type PortfolioPositionInput,
|
|
@@ -74,7 +75,8 @@ async function main(): Promise<void> {
|
|
|
74
75
|
throw new Error("Set AUREON_API_KEY to an issued developer key.");
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
const
|
|
78
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
79
|
+
const baseUrl = resolved.baseUrl;
|
|
78
80
|
line(
|
|
79
81
|
"meta",
|
|
80
82
|
CREATE_ONLY
|
|
@@ -82,7 +84,7 @@ async function main(): Promise<void> {
|
|
|
82
84
|
: `@buildaureon/sdk · Automatic demo loop · ${baseUrl}`
|
|
83
85
|
);
|
|
84
86
|
|
|
85
|
-
const aureon = createAureonClient({ baseUrl, apiKey });
|
|
87
|
+
const aureon = createAureonClient({ network: resolved.network, baseUrl, apiKey });
|
|
86
88
|
|
|
87
89
|
line("cmd", "aureon.ping()");
|
|
88
90
|
const ping = await aureon.ping();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildaureon/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Official TypeScript SDK for AUREON Financial Compass on Robinhood Chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,33 +15,13 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"README.md",
|
|
18
|
+
"CHANGELOG.md",
|
|
18
19
|
"LICENSE",
|
|
19
20
|
"docs",
|
|
20
21
|
"examples",
|
|
21
22
|
"config",
|
|
22
23
|
"fixtures"
|
|
23
24
|
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
26
|
-
"dev": "tsup --watch",
|
|
27
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
-
"test": "tsx --test tests/**/*.test.ts",
|
|
29
|
-
"bench": "tsx benchmarks/client-throughput.ts",
|
|
30
|
-
"example:quickstart": "tsx examples/quickstart/main.ts",
|
|
31
|
-
"example:market": "tsx examples/market-event/main.ts",
|
|
32
|
-
"example:green-vs-plan": "tsx examples/green-vs-plan/main.ts",
|
|
33
|
-
"example:ai-to-objective-to-portfolio": "tsx examples/ai-to-objective-to-portfolio/main.ts",
|
|
34
|
-
"example:drift-detect-restore": "tsx examples/drift-detect-restore/main.ts",
|
|
35
|
-
"example:receipt-verification": "tsx examples/receipt-verification/main.ts",
|
|
36
|
-
"example:portfolio-watch": "tsx examples/portfolio-watch/main.ts",
|
|
37
|
-
"example:full-aureon-loop": "tsx examples/full-aureon-loop/main.ts",
|
|
38
|
-
"example:audit-trail": "tsx examples/audit-trail/main.ts",
|
|
39
|
-
"example:sdk-demo-terminal": "tsx examples/sdk-demo-terminal/main.ts",
|
|
40
|
-
"example:e2e": "tsx examples/e2e-vault-flow/main.ts",
|
|
41
|
-
"example:e2e-policy": "tsx examples/e2e-policy-rebalance/main.ts",
|
|
42
|
-
"cli": "tsx cli/aureon-cli.ts",
|
|
43
|
-
"prepublishOnly": "pnpm build"
|
|
44
|
-
},
|
|
45
25
|
"keywords": [
|
|
46
26
|
"aureon",
|
|
47
27
|
"robinhood-chain",
|
|
@@ -55,6 +35,9 @@
|
|
|
55
35
|
"url": "https://github.com/buildaureon/aureon-sdk"
|
|
56
36
|
},
|
|
57
37
|
"license": "MIT",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
58
41
|
"engines": {
|
|
59
42
|
"node": ">=20"
|
|
60
43
|
},
|
|
@@ -64,5 +47,25 @@
|
|
|
64
47
|
"tsx": "^4.19.3",
|
|
65
48
|
"typescript": "^5.8.2",
|
|
66
49
|
"viem": "^2.55.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"test": "tsx --test tests/**/*.test.ts",
|
|
56
|
+
"bench": "tsx benchmarks/client-throughput.ts",
|
|
57
|
+
"example:quickstart": "tsx examples/quickstart/main.ts",
|
|
58
|
+
"example:market": "tsx examples/market-event/main.ts",
|
|
59
|
+
"example:green-vs-plan": "tsx examples/green-vs-plan/main.ts",
|
|
60
|
+
"example:ai-to-objective-to-portfolio": "tsx examples/ai-to-objective-to-portfolio/main.ts",
|
|
61
|
+
"example:drift-detect-restore": "tsx examples/drift-detect-restore/main.ts",
|
|
62
|
+
"example:receipt-verification": "tsx examples/receipt-verification/main.ts",
|
|
63
|
+
"example:portfolio-watch": "tsx examples/portfolio-watch/main.ts",
|
|
64
|
+
"example:full-aureon-loop": "tsx examples/full-aureon-loop/main.ts",
|
|
65
|
+
"example:audit-trail": "tsx examples/audit-trail/main.ts",
|
|
66
|
+
"example:sdk-demo-terminal": "tsx examples/sdk-demo-terminal/main.ts",
|
|
67
|
+
"example:e2e": "tsx examples/e2e-vault-flow/main.ts",
|
|
68
|
+
"example:e2e-policy": "tsx examples/e2e-policy-rebalance/main.ts",
|
|
69
|
+
"cli": "tsx cli/aureon-cli.ts"
|
|
67
70
|
}
|
|
68
|
-
}
|
|
71
|
+
}
|