@buildaureon/sdk 0.1.1 → 0.1.2
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 -21
- package/README.md +640 -640
- package/config/network.json +10 -10
- package/dist/index.d.ts +73 -3
- package/dist/index.js +48 -3
- package/dist/index.js.map +1 -1
- package/docs/architecture.md +206 -206
- package/docs/auth.md +174 -174
- package/docs/client-api.md +605 -605
- package/docs/data-contracts.md +635 -635
- package/docs/error-model.md +217 -217
- package/docs/integration-guide.md +257 -257
- package/docs/security.md +120 -120
- package/docs/transport.md +142 -142
- package/examples/market-event/main.ts +65 -65
- package/examples/quickstart/main.ts +72 -72
- package/examples/registry-register/main.ts +44 -0
- package/fixtures/reference-objectives.json +18 -18
- package/fixtures/reference-portfolio.json +10 -10
- package/package.json +61 -61
package/config/network.json
CHANGED
|
@@ -1,10 +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
|
-
}
|
|
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
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,55 @@ interface AureonClientOptions {
|
|
|
57
57
|
retryDelayMs?: number;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @fileoverview Phase 2 ObjectiveRegistry types.
|
|
62
|
+
*/
|
|
63
|
+
type RegistryStatus = {
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
chainId: number;
|
|
66
|
+
contractAddress: string | null;
|
|
67
|
+
explorerBase: string;
|
|
68
|
+
network: string;
|
|
69
|
+
};
|
|
70
|
+
type RegistryRef = {
|
|
71
|
+
objectiveKey: string;
|
|
72
|
+
contractAddress: string;
|
|
73
|
+
};
|
|
74
|
+
type ObjectiveRegistryRecord = {
|
|
75
|
+
objectiveId: string;
|
|
76
|
+
objectiveKey: string;
|
|
77
|
+
configHash: string;
|
|
78
|
+
owner: string;
|
|
79
|
+
status: "active" | "paused" | "cancelled";
|
|
80
|
+
chainId: number;
|
|
81
|
+
contractAddress: string;
|
|
82
|
+
transactionHash: string;
|
|
83
|
+
blockNumber: number | null;
|
|
84
|
+
registeredAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
explorerUrl: string;
|
|
87
|
+
verifiedOnChain: boolean;
|
|
88
|
+
};
|
|
89
|
+
type PrepareRegistryResult = {
|
|
90
|
+
chainId: number;
|
|
91
|
+
contractAddress: string;
|
|
92
|
+
explorerBase: string;
|
|
93
|
+
objectiveId: string;
|
|
94
|
+
objectiveKey: string;
|
|
95
|
+
configHash: string;
|
|
96
|
+
to: string;
|
|
97
|
+
data: string;
|
|
98
|
+
value: "0";
|
|
99
|
+
functionName: "registerObjective";
|
|
100
|
+
};
|
|
101
|
+
type ObjectiveRegistryLookup = {
|
|
102
|
+
registered: false;
|
|
103
|
+
objectiveId: string;
|
|
104
|
+
} | {
|
|
105
|
+
registered: true;
|
|
106
|
+
record: ObjectiveRegistryRecord;
|
|
107
|
+
};
|
|
108
|
+
|
|
60
109
|
/**
|
|
61
110
|
* @fileoverview Execution receipt + restore-plan types.
|
|
62
111
|
*
|
|
@@ -64,6 +113,7 @@ interface AureonClientOptions {
|
|
|
64
113
|
* as a staged capital-book update (`settlement: "staged"`) when the vault
|
|
65
114
|
* path is unavailable. Wrap/unwrap ETH↔WETH is client-side via RestorePlan.
|
|
66
115
|
*/
|
|
116
|
+
|
|
67
117
|
interface ExecutionReceipt {
|
|
68
118
|
id: string;
|
|
69
119
|
objectiveId: string;
|
|
@@ -79,6 +129,7 @@ interface ExecutionReceipt {
|
|
|
79
129
|
* `"staged"`: capital-book restore only (honest non-finality label).
|
|
80
130
|
*/
|
|
81
131
|
settlement?: "staged" | "vault";
|
|
132
|
+
registryRef?: RegistryRef;
|
|
82
133
|
}
|
|
83
134
|
/** Client-side restore action: wrap/unwrap ETH↔WETH or keeper vault swap. */
|
|
84
135
|
type RestorePlanKind = "wrap_eth" | "unwrap_weth" | "vault_swap";
|
|
@@ -113,7 +164,7 @@ declare function pickWorstHealth(records: ObjectiveHealth[]): ObjectiveHealth |
|
|
|
113
164
|
/**
|
|
114
165
|
* @fileoverview Timeline event contracts for append-only operator narratives.
|
|
115
166
|
*/
|
|
116
|
-
type TimelineEventType = "objective_created" | "objective_updated" | "objective_paused" | "objective_resumed" | "health_changed" | "violation_detected" | "evaluation_started" | "execution_started" | "execution_completed" | "market_event_applied" | "objective_restored" | "capital_provisioned" | "capital_cleared" | "capital_synced";
|
|
167
|
+
type TimelineEventType = "objective_created" | "objective_updated" | "objective_paused" | "objective_resumed" | "health_changed" | "violation_detected" | "evaluation_started" | "execution_started" | "execution_completed" | "market_event_applied" | "objective_restored" | "capital_provisioned" | "capital_cleared" | "capital_synced" | "registry_anchored";
|
|
117
168
|
interface TimelineEvent {
|
|
118
169
|
id: string;
|
|
119
170
|
objectiveId: string | null;
|
|
@@ -233,6 +284,8 @@ interface Objective {
|
|
|
233
284
|
updatedAt: string;
|
|
234
285
|
lastEvaluatedAt: string | null;
|
|
235
286
|
lastExecutionId: string | null;
|
|
287
|
+
verifiedOnChain?: boolean;
|
|
288
|
+
configHash?: string;
|
|
236
289
|
}
|
|
237
290
|
/**
|
|
238
291
|
* Input for creating a new objective.
|
|
@@ -599,6 +652,22 @@ declare class AureonClient {
|
|
|
599
652
|
restoreObjective(objectiveId: string): Promise<ExecutionReceipt>;
|
|
600
653
|
/** Lists recent execution receipts. Auth required. */
|
|
601
654
|
listExecutions(objectiveId?: string): Promise<ExecutionReceipt[]>;
|
|
655
|
+
/** Returns Phase 2 ObjectiveRegistry deployment status. Auth required. */
|
|
656
|
+
getRegistryStatus(): Promise<RegistryStatus>;
|
|
657
|
+
/** Returns on-chain registry record for an objective when registered. Auth required. */
|
|
658
|
+
getObjectiveRegistry(objectiveId: string): Promise<ObjectiveRegistryLookup>;
|
|
659
|
+
/**
|
|
660
|
+
* Prepares wallet-signed calldata to register an objective on ObjectiveRegistry.
|
|
661
|
+
* Auth required.
|
|
662
|
+
*/
|
|
663
|
+
prepareObjectiveRegistry(objectiveId: string): Promise<PrepareRegistryResult>;
|
|
664
|
+
/**
|
|
665
|
+
* Confirms an on-chain registration after the wallet broadcast tx.
|
|
666
|
+
* Auth required.
|
|
667
|
+
*/
|
|
668
|
+
confirmObjectiveRegistry(objectiveId: string, transactionHash: string): Promise<{
|
|
669
|
+
record: ObjectiveRegistryRecord;
|
|
670
|
+
}>;
|
|
602
671
|
/** Returns the vault overview for the authenticated wallet. Auth required. */
|
|
603
672
|
getVault(): Promise<VaultOverview>;
|
|
604
673
|
/** Returns compact vault funding status before restore. Auth required. */
|
|
@@ -756,7 +825,7 @@ declare const DEFAULT_API_BASE_URL = "https://api.aureonlabs.network";
|
|
|
756
825
|
/** Local monorepo preview only; not for public docs. */
|
|
757
826
|
declare const LOCAL_API_BASE_URL = "http://127.0.0.1:8787";
|
|
758
827
|
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
759
|
-
declare const SDK_VERSION = "0.1.
|
|
828
|
+
declare const SDK_VERSION = "0.1.2";
|
|
760
829
|
declare const SDK_NAME = "@buildaureon/sdk";
|
|
761
830
|
declare const PRODUCT_NAME = "AUREON";
|
|
762
831
|
declare const PRODUCT_TAGLINE = "Financial Compass for Robinhood Chain";
|
|
@@ -790,6 +859,7 @@ declare const ENDPOINTS: {
|
|
|
790
859
|
readonly authDevLogin: "/auth/dev-login";
|
|
791
860
|
readonly authMe: "/auth/me";
|
|
792
861
|
readonly developerApiKeys: "/developer/api-keys";
|
|
862
|
+
readonly registryStatus: "/registry/status";
|
|
793
863
|
};
|
|
794
864
|
|
|
795
865
|
/**
|
|
@@ -798,4 +868,4 @@ declare const ENDPOINTS: {
|
|
|
798
868
|
type FetchLike = typeof fetch;
|
|
799
869
|
declare function resolveFetch(custom?: FetchLike): FetchLike;
|
|
800
870
|
|
|
801
|
-
export { API_KEY_HEADER, type ApplyMarketEventInput, AureonClient, type AureonClientOptions, AureonConflictError, AureonError, type AureonErrorCode, AureonNetworkError, AureonNotFoundError, AureonTimeoutError, AureonValidationError, type AuthMeResponse, type AuthNonceResponse, type AuthSessionResponse, type CreateObjectiveInput, type CreatedDeveloperApiKey, DEFAULT_API_BASE_URL, DEFAULT_TIMEOUT_MS, type DashboardOverview, type DeveloperApiKey, ENDPOINTS, type ExecutionReceipt, type HealthState, LOCAL_API_BASE_URL, type MarkQuote, type MarkQuoteSource, type MarketEvent, type MarketPreset, OBJECTIVE_KINDS, OBJECTIVE_PRIORITIES, type Objective, type ObjectiveAutomationMode, type ObjectiveHealth, type ObjectiveKind, type ObjectivePolicy, type ObjectivePriority, type ObjectiveStatus, PRODUCT_NAME, PRODUCT_TAGLINE, type PortfolioPosition, type PortfolioPositionInput, type PortfolioSnapshot, type RestorePlan, type RestorePlanKind, type RestoreSuggestion, type RestoreSuggestionAction, SDK_NAME, SDK_VERSION, type SessionTokenProvider, type SyncPortfolioResult, TIMELINE_EVENT_TYPES, type TimelineEvent, type TimelineEventType, type UpdateObjectiveInput, type VaultBalance, type VaultDepositSymbol, type VaultOverview, type VaultPrepareResult, type VaultPreparedStep, type VaultStatus, type VaultToken, type VaultWithdrawSymbol, type WatchdogAlertResult, type WatchdogRefreshResult, assertBaseUrl, buildPolicySummary, createAureonClient, createConsoleLogger, createLocalAureonClient, createSessionTokenProvider, errorFromHttpStatus, formatIsoTime, formatSignedPercent, formatUsd, formatWeight, healthTone, isAureonError, isHealthState, isObjectiveKind, isObjectivePriority, isTimelineEventType, isVaultSettlement, joinUrl, normalizeCreateObjectiveInput, normalizeUpdateObjectiveInput, pickWorstHealth, requestJson, resolveFetch, silentLogger, withQuery };
|
|
871
|
+
export { API_KEY_HEADER, type ApplyMarketEventInput, AureonClient, type AureonClientOptions, AureonConflictError, AureonError, type AureonErrorCode, AureonNetworkError, AureonNotFoundError, AureonTimeoutError, AureonValidationError, type AuthMeResponse, type AuthNonceResponse, type AuthSessionResponse, type CreateObjectiveInput, type CreatedDeveloperApiKey, DEFAULT_API_BASE_URL, DEFAULT_TIMEOUT_MS, type DashboardOverview, type DeveloperApiKey, ENDPOINTS, type ExecutionReceipt, type HealthState, LOCAL_API_BASE_URL, type MarkQuote, type MarkQuoteSource, type MarketEvent, type MarketPreset, OBJECTIVE_KINDS, OBJECTIVE_PRIORITIES, type Objective, type ObjectiveAutomationMode, type ObjectiveHealth, type ObjectiveKind, type ObjectivePolicy, type ObjectivePriority, type ObjectiveRegistryLookup, type ObjectiveRegistryRecord, type ObjectiveStatus, PRODUCT_NAME, PRODUCT_TAGLINE, type PortfolioPosition, type PortfolioPositionInput, type PortfolioSnapshot, type PrepareRegistryResult, type RegistryRef, type RegistryStatus, type RestorePlan, type RestorePlanKind, type RestoreSuggestion, type RestoreSuggestionAction, SDK_NAME, SDK_VERSION, type SessionTokenProvider, type SyncPortfolioResult, TIMELINE_EVENT_TYPES, type TimelineEvent, type TimelineEventType, type UpdateObjectiveInput, type VaultBalance, type VaultDepositSymbol, type VaultOverview, type VaultPrepareResult, type VaultPreparedStep, type VaultStatus, type VaultToken, type VaultWithdrawSymbol, type WatchdogAlertResult, type WatchdogRefreshResult, assertBaseUrl, buildPolicySummary, createAureonClient, createConsoleLogger, createLocalAureonClient, createSessionTokenProvider, errorFromHttpStatus, formatIsoTime, formatSignedPercent, formatUsd, formatWeight, healthTone, isAureonError, isHealthState, isObjectiveKind, isObjectivePriority, isTimelineEventType, isVaultSettlement, joinUrl, normalizeCreateObjectiveInput, normalizeUpdateObjectiveInput, pickWorstHealth, requestJson, resolveFetch, silentLogger, withQuery };
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ function userAgentHeader(version) {
|
|
|
14
14
|
var DEFAULT_API_BASE_URL = "https://api.aureonlabs.network";
|
|
15
15
|
var LOCAL_API_BASE_URL = "http://127.0.0.1:8787";
|
|
16
16
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
17
|
-
var SDK_VERSION = "0.1.
|
|
17
|
+
var SDK_VERSION = "0.1.2";
|
|
18
18
|
var SDK_NAME = "@buildaureon/sdk";
|
|
19
19
|
var PRODUCT_NAME = "AUREON";
|
|
20
20
|
var PRODUCT_TAGLINE = "Financial Compass for Robinhood Chain";
|
|
@@ -44,7 +44,8 @@ var ENDPOINTS = {
|
|
|
44
44
|
authLogout: "/auth/logout",
|
|
45
45
|
authDevLogin: "/auth/dev-login",
|
|
46
46
|
authMe: "/auth/me",
|
|
47
|
-
developerApiKeys: "/developer/api-keys"
|
|
47
|
+
developerApiKeys: "/developer/api-keys",
|
|
48
|
+
registryStatus: "/registry/status"
|
|
48
49
|
};
|
|
49
50
|
function objectivePath(id) {
|
|
50
51
|
return `${ENDPOINTS.objectives}/${encodeURIComponent(id)}`;
|
|
@@ -64,6 +65,15 @@ function objectiveRestorePath(id) {
|
|
|
64
65
|
function developerApiKeyPath(id) {
|
|
65
66
|
return `${ENDPOINTS.developerApiKeys}/${encodeURIComponent(id)}`;
|
|
66
67
|
}
|
|
68
|
+
function registryObjectivePath(id) {
|
|
69
|
+
return `/registry/objectives/${encodeURIComponent(id)}`;
|
|
70
|
+
}
|
|
71
|
+
function registryPreparePath(id) {
|
|
72
|
+
return `${registryObjectivePath(id)}/prepare-register`;
|
|
73
|
+
}
|
|
74
|
+
function registryConfirmPath(id) {
|
|
75
|
+
return `${registryObjectivePath(id)}/confirm`;
|
|
76
|
+
}
|
|
67
77
|
|
|
68
78
|
// src/errors/codes.ts
|
|
69
79
|
var RETRYABLE_CODES = [
|
|
@@ -798,6 +808,40 @@ var AureonClient = class {
|
|
|
798
808
|
);
|
|
799
809
|
return result.executions;
|
|
800
810
|
}
|
|
811
|
+
/** Returns Phase 2 ObjectiveRegistry deployment status. Auth required. */
|
|
812
|
+
async getRegistryStatus() {
|
|
813
|
+
return requestJson(this.transport, ENDPOINTS.registryStatus);
|
|
814
|
+
}
|
|
815
|
+
/** Returns on-chain registry record for an objective when registered. Auth required. */
|
|
816
|
+
async getObjectiveRegistry(objectiveId) {
|
|
817
|
+
assertId(objectiveId, "objective id");
|
|
818
|
+
return requestJson(this.transport, registryObjectivePath(objectiveId));
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Prepares wallet-signed calldata to register an objective on ObjectiveRegistry.
|
|
822
|
+
* Auth required.
|
|
823
|
+
*/
|
|
824
|
+
async prepareObjectiveRegistry(objectiveId) {
|
|
825
|
+
assertId(objectiveId, "objective id");
|
|
826
|
+
return requestJson(this.transport, registryPreparePath(objectiveId), {
|
|
827
|
+
method: "POST"
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Confirms an on-chain registration after the wallet broadcast tx.
|
|
832
|
+
* Auth required.
|
|
833
|
+
*/
|
|
834
|
+
async confirmObjectiveRegistry(objectiveId, transactionHash) {
|
|
835
|
+
assertId(objectiveId, "objective id");
|
|
836
|
+
const hash = transactionHash.trim();
|
|
837
|
+
if (!hash) {
|
|
838
|
+
throw new AureonValidationError("transactionHash is required");
|
|
839
|
+
}
|
|
840
|
+
return requestJson(this.transport, registryConfirmPath(objectiveId), {
|
|
841
|
+
method: "POST",
|
|
842
|
+
body: { transactionHash: hash }
|
|
843
|
+
});
|
|
844
|
+
}
|
|
801
845
|
/** Returns the vault overview for the authenticated wallet. Auth required. */
|
|
802
846
|
async getVault() {
|
|
803
847
|
return requestJson(this.transport, ENDPOINTS.vault);
|
|
@@ -994,7 +1038,8 @@ var TIMELINE_EVENT_TYPES = [
|
|
|
994
1038
|
"objective_restored",
|
|
995
1039
|
"capital_provisioned",
|
|
996
1040
|
"capital_cleared",
|
|
997
|
-
"capital_synced"
|
|
1041
|
+
"capital_synced",
|
|
1042
|
+
"registry_anchored"
|
|
998
1043
|
];
|
|
999
1044
|
function isTimelineEventType(value) {
|
|
1000
1045
|
return TIMELINE_EVENT_TYPES.includes(value);
|