@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,138 +1,143 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Follow-up: force TSLA underweight → Auto should Sell WETH → Buy TSLA.
|
|
3
|
-
*
|
|
4
|
-
* Env:
|
|
5
|
-
* AUREON_API_KEY issued developer key
|
|
6
|
-
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
session.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
await aureon.
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Follow-up: force TSLA underweight → Auto should Sell WETH → Buy TSLA.
|
|
3
|
+
*
|
|
4
|
+
* Env:
|
|
5
|
+
* AUREON_API_KEY issued developer key
|
|
6
|
+
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
+
* AUREON_NETWORK optional; omit for official API / testnet 46630; mainnet = chain 4663
|
|
8
|
+
* AUREON_API_URL optional override
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
createPublicClient,
|
|
15
|
+
createWalletClient,
|
|
16
|
+
http,
|
|
17
|
+
type Address,
|
|
18
|
+
type Hex,
|
|
19
|
+
} from "viem";
|
|
20
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
21
|
+
import {
|
|
22
|
+
createAureonClient,
|
|
23
|
+
createSessionTokenProvider,
|
|
24
|
+
resolveAureonNetworkFromEnv,
|
|
25
|
+
isAureonError,
|
|
26
|
+
} from "../../src/index.js";
|
|
27
|
+
|
|
28
|
+
function requireEnv(name: string): string {
|
|
29
|
+
const value = process.env[name]?.trim();
|
|
30
|
+
if (!value) throw new Error(`Set ${name}`);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const key = requireEnv("AUREON_WALLET_PRIVATE_KEY") as Hex;
|
|
35
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {
|
|
36
|
+
throw new Error("AUREON_WALLET_PRIVATE_KEY must be a 0x-prefixed 32-byte hex key");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const account = privateKeyToAccount(key);
|
|
40
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
41
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID || resolved.chainId);
|
|
42
|
+
const rpc =
|
|
43
|
+
process.env.AUREON_RPC_URL?.trim() ||
|
|
44
|
+
(chainId === 4663
|
|
45
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
46
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
47
|
+
const publicClient = createPublicClient({ transport: http(rpc) });
|
|
48
|
+
const walletClient = createWalletClient({ account, transport: http(rpc) });
|
|
49
|
+
const chain = {
|
|
50
|
+
id: chainId,
|
|
51
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
52
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
53
|
+
rpcUrls: { default: { http: [rpc] } },
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
const session = createSessionTokenProvider(null);
|
|
57
|
+
const aureon = createAureonClient({
|
|
58
|
+
network: resolved.network,
|
|
59
|
+
baseUrl: resolved.baseUrl,
|
|
60
|
+
apiKey: requireEnv("AUREON_API_KEY"),
|
|
61
|
+
getAccessToken: session.getAccessToken,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const { message } = await aureon.getAuthNonce(account.address);
|
|
65
|
+
const signature = await walletClient.signMessage({ account, message });
|
|
66
|
+
session.setToken(
|
|
67
|
+
(
|
|
68
|
+
await aureon.verifyWallet({
|
|
69
|
+
address: account.address,
|
|
70
|
+
message,
|
|
71
|
+
signature,
|
|
72
|
+
})
|
|
73
|
+
).token
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const vault = await aureon.getVault();
|
|
77
|
+
const tsla = vault.balances.find((b) => b.symbol.toUpperCase() === "TSLA");
|
|
78
|
+
console.log(
|
|
79
|
+
"vault before underrun",
|
|
80
|
+
vault.balances.filter((b) => b.quantity > 0).map((b) => ({ s: b.symbol, q: b.quantity }))
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (tsla && tsla.quantity > 0.001) {
|
|
84
|
+
const amt = (tsla.quantity - 0.000001).toFixed(8);
|
|
85
|
+
const prep = await aureon.prepareVaultWithdraw({ symbol: "TSLA", amount: amt });
|
|
86
|
+
for (const step of prep.steps) {
|
|
87
|
+
const hash = await walletClient.sendTransaction({
|
|
88
|
+
account,
|
|
89
|
+
chain,
|
|
90
|
+
to: step.to as Address,
|
|
91
|
+
data: step.data as Hex,
|
|
92
|
+
value: 0n,
|
|
93
|
+
});
|
|
94
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
95
|
+
console.log("withdrew almost all TSLA", hash);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const d = await aureon.prepareVaultDeposit({ symbol: "ETH", amount: "0.0005" });
|
|
100
|
+
for (const step of d.steps) {
|
|
101
|
+
const hash = await walletClient.sendTransaction({
|
|
102
|
+
account,
|
|
103
|
+
chain,
|
|
104
|
+
to: step.to as Address,
|
|
105
|
+
data: step.data as Hex,
|
|
106
|
+
value: BigInt(step.value),
|
|
107
|
+
});
|
|
108
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
109
|
+
console.log("depositETH", hash);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const objs = await aureon.listObjectives();
|
|
113
|
+
const obj = objs.find((o) => o.name.includes("E2E 20% TSLA")) ?? objs[0];
|
|
114
|
+
if (!obj) throw new Error("no objective");
|
|
115
|
+
console.log("using objective", obj.id, obj.name);
|
|
116
|
+
|
|
117
|
+
await aureon.refreshWatchdog();
|
|
118
|
+
const h = (await aureon.getHealth(obj.id))[0]!;
|
|
119
|
+
console.log("health", {
|
|
120
|
+
state: h.state,
|
|
121
|
+
current: h.currentMetric,
|
|
122
|
+
message: h.message,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
const plan = await aureon.getRestorePlan(obj.id);
|
|
127
|
+
console.log("UNDERRUN PLAN", plan.message, {
|
|
128
|
+
kind: plan.kind,
|
|
129
|
+
sell: (plan as { sellSymbol?: string }).sellSymbol,
|
|
130
|
+
buy: (plan as { buySymbol?: string }).buySymbol,
|
|
131
|
+
});
|
|
132
|
+
const receipt = await aureon.restoreObjective(obj.id);
|
|
133
|
+
console.log("UNDERRUN EXEC", receipt.status, receipt.transactionHash);
|
|
134
|
+
await aureon.refreshWatchdog();
|
|
135
|
+
const h2 = (await aureon.getHealth(obj.id))[0]!;
|
|
136
|
+
console.log("health after buy", {
|
|
137
|
+
state: h2.state,
|
|
138
|
+
current: h2.currentMetric,
|
|
139
|
+
message: h2.message,
|
|
140
|
+
});
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.log("plan/exec", isAureonError(e) ? e.message : e);
|
|
143
|
+
}
|
|
@@ -1,150 +1,155 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verify underweight Automatic sizing lands near 20% (not a blow-up fill).
|
|
3
|
-
*
|
|
4
|
-
* Env:
|
|
5
|
-
* AUREON_API_KEY issued developer key
|
|
6
|
-
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
console.log("
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
message:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Verify underweight Automatic sizing lands near 20% (not a blow-up fill).
|
|
3
|
+
*
|
|
4
|
+
* Env:
|
|
5
|
+
* AUREON_API_KEY issued developer key
|
|
6
|
+
* AUREON_WALLET_PRIVATE_KEY 0x… signing key
|
|
7
|
+
* AUREON_NETWORK optional; omit for official API / testnet 46630; mainnet = chain 4663
|
|
8
|
+
* AUREON_API_URL optional override
|
|
9
|
+
* AUREON_RPC_URL optional (defaults from resolved chain)
|
|
10
|
+
* AUREON_CHAIN_ID optional (defaults from resolved network)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
createPublicClient,
|
|
15
|
+
createWalletClient,
|
|
16
|
+
http,
|
|
17
|
+
type Address,
|
|
18
|
+
type Hex,
|
|
19
|
+
} from "viem";
|
|
20
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
21
|
+
import {
|
|
22
|
+
createAureonClient,
|
|
23
|
+
createSessionTokenProvider,
|
|
24
|
+
resolveAureonNetworkFromEnv,
|
|
25
|
+
} from "../../src/index.js";
|
|
26
|
+
|
|
27
|
+
function requireEnv(name: string): string {
|
|
28
|
+
const value = process.env[name]?.trim();
|
|
29
|
+
if (!value) throw new Error(`Set ${name}`);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const key = requireEnv("AUREON_WALLET_PRIVATE_KEY") as Hex;
|
|
34
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(key)) {
|
|
35
|
+
throw new Error("AUREON_WALLET_PRIVATE_KEY must be a 0x-prefixed 32-byte hex key");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const account = privateKeyToAccount(key);
|
|
39
|
+
const resolved = resolveAureonNetworkFromEnv();
|
|
40
|
+
const chainId = Number(process.env.AUREON_CHAIN_ID || resolved.chainId);
|
|
41
|
+
const rpc =
|
|
42
|
+
process.env.AUREON_RPC_URL?.trim() ||
|
|
43
|
+
(chainId === 4663
|
|
44
|
+
? "https://rpc.mainnet.chain.robinhood.com"
|
|
45
|
+
: "https://rpc.testnet.chain.robinhood.com");
|
|
46
|
+
const publicClient = createPublicClient({ transport: http(rpc) });
|
|
47
|
+
const walletClient = createWalletClient({ account, transport: http(rpc) });
|
|
48
|
+
const chain = {
|
|
49
|
+
id: chainId,
|
|
50
|
+
name: chainId === 4663 ? "Robinhood Chain" : "Robinhood Chain Testnet",
|
|
51
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
52
|
+
rpcUrls: { default: { http: [rpc] } },
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
const session = createSessionTokenProvider(null);
|
|
56
|
+
const aureon = createAureonClient({
|
|
57
|
+
network: resolved.network,
|
|
58
|
+
baseUrl: resolved.baseUrl,
|
|
59
|
+
apiKey: requireEnv("AUREON_API_KEY"),
|
|
60
|
+
getAccessToken: session.getAccessToken,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const { message } = await aureon.getAuthNonce(account.address);
|
|
64
|
+
session.setToken(
|
|
65
|
+
(
|
|
66
|
+
await aureon.verifyWallet({
|
|
67
|
+
address: account.address,
|
|
68
|
+
message,
|
|
69
|
+
signature: await walletClient.signMessage({ account, message }),
|
|
70
|
+
})
|
|
71
|
+
).token
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const objective = await aureon.createObjective({
|
|
75
|
+
name: `SizeFix 20% TSLA ${Date.now()}`,
|
|
76
|
+
kind: "balanced_portfolio",
|
|
77
|
+
targetWeight: 0.2,
|
|
78
|
+
tolerance: 0.05,
|
|
79
|
+
targetSymbol: "TSLA",
|
|
80
|
+
priority: "high",
|
|
81
|
+
automationMode: "auto",
|
|
82
|
+
});
|
|
83
|
+
console.log("objective", objective.id);
|
|
84
|
+
|
|
85
|
+
const vault = await aureon.getVault();
|
|
86
|
+
console.log(
|
|
87
|
+
"before",
|
|
88
|
+
vault.balances.filter((b) => b.quantity > 0).map((b) => `${b.symbol}:${b.quantity}`)
|
|
89
|
+
);
|
|
90
|
+
const tsla = vault.balances.find((b) => b.symbol.toUpperCase() === "TSLA");
|
|
91
|
+
if (tsla && tsla.quantity > 0.0001) {
|
|
92
|
+
const amt = Math.max(tsla.quantity - 0.00001, 0).toFixed(8);
|
|
93
|
+
const prep = await aureon.prepareVaultWithdraw({ symbol: "TSLA", amount: amt });
|
|
94
|
+
for (const step of prep.steps) {
|
|
95
|
+
const hash = await walletClient.sendTransaction({
|
|
96
|
+
account,
|
|
97
|
+
chain,
|
|
98
|
+
to: step.to as Address,
|
|
99
|
+
data: step.data as Hex,
|
|
100
|
+
value: 0n,
|
|
101
|
+
});
|
|
102
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
103
|
+
console.log("withdrew TSLA", hash);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const dep = await aureon.prepareVaultDeposit({ symbol: "ETH", amount: "0.0004" });
|
|
108
|
+
for (const step of dep.steps) {
|
|
109
|
+
const hash = await walletClient.sendTransaction({
|
|
110
|
+
account,
|
|
111
|
+
chain,
|
|
112
|
+
to: step.to as Address,
|
|
113
|
+
data: step.data as Hex,
|
|
114
|
+
value: BigInt(step.value),
|
|
115
|
+
});
|
|
116
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
117
|
+
console.log("depositETH", hash);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
await aureon.refreshWatchdog();
|
|
121
|
+
const h1 = (await aureon.getHealth(objective.id))[0]!;
|
|
122
|
+
console.log("health underweight", {
|
|
123
|
+
state: h1.state,
|
|
124
|
+
current: h1.currentMetric,
|
|
125
|
+
message: h1.message,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const plan = await aureon.getRestorePlan(objective.id);
|
|
129
|
+
console.log("plan", {
|
|
130
|
+
message: plan.message,
|
|
131
|
+
amountHuman: plan.amountHuman,
|
|
132
|
+
approxUsd: plan.approxUsd,
|
|
133
|
+
sell: (plan as { sellSymbol?: string }).sellSymbol,
|
|
134
|
+
buy: (plan as { buySymbol?: string }).buySymbol,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const receipt = await aureon.restoreObjective(objective.id);
|
|
138
|
+
console.log("exec", receipt.status, receipt.transactionHash);
|
|
139
|
+
|
|
140
|
+
await aureon.refreshWatchdog();
|
|
141
|
+
const h2 = (await aureon.getHealth(objective.id))[0]!;
|
|
142
|
+
console.log("health after", {
|
|
143
|
+
state: h2.state,
|
|
144
|
+
current: h2.currentMetric,
|
|
145
|
+
message: h2.message,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const weightPct = (h2.currentMetric ?? 0) * 100;
|
|
149
|
+
const ok = weightPct >= 5 && weightPct <= 45;
|
|
150
|
+
console.log(
|
|
151
|
+
ok
|
|
152
|
+
? `PASS sizing : TSLA weight ~${weightPct.toFixed(1)}% (want ~20%)`
|
|
153
|
+
: `FAIL sizing : TSLA weight ~${weightPct.toFixed(1)}% still overshot`
|
|
154
|
+
);
|
|
155
|
+
if (!ok) process.exitCode = 1;
|