@buildaureon/sdk 0.1.0 → 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.
@@ -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
@@ -19,8 +19,10 @@ interface AureonClientOptions {
19
19
  baseUrl?: string;
20
20
  /**
21
21
  * Product API key sent as `X-Aureon-Api-Key` on every request.
22
- * Required for SDK / CLI / code when keys are enforced and there is no
23
- * wallet Bearer yet. The operator utility uses wallet Bearer only.
22
+ * Operator-issued keys (from the Developers console) also identify the
23
+ * bound wallet for control-plane calls no Bearer required.
24
+ * Env bootstrap keys unlock product access only; they do not set identity.
25
+ * The operator utility uses wallet Bearer only.
24
26
  */
25
27
  apiKey?: string | null;
26
28
  /**
@@ -55,6 +57,55 @@ interface AureonClientOptions {
55
57
  retryDelayMs?: number;
56
58
  }
57
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
+
58
109
  /**
59
110
  * @fileoverview Execution receipt + restore-plan types.
60
111
  *
@@ -62,6 +113,7 @@ interface AureonClientOptions {
62
113
  * as a staged capital-book update (`settlement: "staged"`) when the vault
63
114
  * path is unavailable. Wrap/unwrap ETH↔WETH is client-side via RestorePlan.
64
115
  */
116
+
65
117
  interface ExecutionReceipt {
66
118
  id: string;
67
119
  objectiveId: string;
@@ -77,6 +129,7 @@ interface ExecutionReceipt {
77
129
  * `"staged"`: capital-book restore only (honest non-finality label).
78
130
  */
79
131
  settlement?: "staged" | "vault";
132
+ registryRef?: RegistryRef;
80
133
  }
81
134
  /** Client-side restore action: wrap/unwrap ETH↔WETH or keeper vault swap. */
82
135
  type RestorePlanKind = "wrap_eth" | "unwrap_weth" | "vault_swap";
@@ -111,7 +164,7 @@ declare function pickWorstHealth(records: ObjectiveHealth[]): ObjectiveHealth |
111
164
  /**
112
165
  * @fileoverview Timeline event contracts for append-only operator narratives.
113
166
  */
114
- 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";
115
168
  interface TimelineEvent {
116
169
  id: string;
117
170
  objectiveId: string | null;
@@ -231,6 +284,8 @@ interface Objective {
231
284
  updatedAt: string;
232
285
  lastEvaluatedAt: string | null;
233
286
  lastExecutionId: string | null;
287
+ verifiedOnChain?: boolean;
288
+ configHash?: string;
234
289
  }
235
290
  /**
236
291
  * Input for creating a new objective.
@@ -262,7 +317,11 @@ interface UpdateObjectiveInput {
262
317
  tolerance?: number;
263
318
  maxRiskScore?: number;
264
319
  reinvestRatio?: number;
265
- targetSymbol?: string | null;
320
+ /**
321
+ * @deprecated Rejected on update; target token is fixed at create.
322
+ * Recreate the objective to track a different holding.
323
+ */
324
+ targetSymbol?: never;
266
325
  /**
267
326
  * @deprecated Rejected on update; mode is fixed at create to avoid restore-flow issues.
268
327
  * Recreate the objective to switch Manual ↔ Automatic.
@@ -423,8 +482,10 @@ interface WatchdogRefreshResult {
423
482
  /**
424
483
  * @fileoverview AureonClient: primary entry point for @buildaureon/sdk.
425
484
  *
426
- * Typed HTTP client for the hosted AUREON API. Wallet Bearer sessions identify
427
- * the operator; `apiKey` (`X-Aureon-Api-Key`) unlocks product access.
485
+ * Typed HTTP client for the hosted AUREON API. Operator-issued API keys
486
+ * (`X-Aureon-Api-Key`) identify the bound wallet for control-plane calls;
487
+ * optional wallet Bearer sessions also work (Bearer wins when both are sent).
488
+ * Env bootstrap keys unlock product access only.
428
489
  *
429
490
  * Objectives default to Automatic automation mode. Vault deposit and withdraw
430
491
  * are prepare-calldata steps for wallet signing; not server-side broadcasts.
@@ -492,6 +553,7 @@ declare class AureonClient {
492
553
  address: string;
493
554
  message: string;
494
555
  signature: string;
556
+ inviteCode?: string;
495
557
  }): Promise<AuthSessionResponse>;
496
558
  /**
497
559
  * Local preview login without a wallet signature.
@@ -518,7 +580,7 @@ declare class AureonClient {
518
580
  getObjective(id: string): Promise<Objective>;
519
581
  /**
520
582
  * Applies a partial update to an objective policy or metadata.
521
- * Does **not** accept `automationMode` (mode is locked at create).
583
+ * Does **not** accept `automationMode` or `targetSymbol` (both locked at create).
522
584
  * Auth required.
523
585
  */
524
586
  updateObjective(id: string, input: UpdateObjectiveInput): Promise<Objective>;
@@ -590,6 +652,22 @@ declare class AureonClient {
590
652
  restoreObjective(objectiveId: string): Promise<ExecutionReceipt>;
591
653
  /** Lists recent execution receipts. Auth required. */
592
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
+ }>;
593
671
  /** Returns the vault overview for the authenticated wallet. Auth required. */
594
672
  getVault(): Promise<VaultOverview>;
595
673
  /** Returns compact vault funding status before restore. Auth required. */
@@ -747,7 +825,7 @@ declare const DEFAULT_API_BASE_URL = "https://api.aureonlabs.network";
747
825
  /** Local monorepo preview only; not for public docs. */
748
826
  declare const LOCAL_API_BASE_URL = "http://127.0.0.1:8787";
749
827
  declare const DEFAULT_TIMEOUT_MS = 30000;
750
- declare const SDK_VERSION = "0.1.0";
828
+ declare const SDK_VERSION = "0.1.2";
751
829
  declare const SDK_NAME = "@buildaureon/sdk";
752
830
  declare const PRODUCT_NAME = "AUREON";
753
831
  declare const PRODUCT_TAGLINE = "Financial Compass for Robinhood Chain";
@@ -781,6 +859,7 @@ declare const ENDPOINTS: {
781
859
  readonly authDevLogin: "/auth/dev-login";
782
860
  readonly authMe: "/auth/me";
783
861
  readonly developerApiKeys: "/developer/api-keys";
862
+ readonly registryStatus: "/registry/status";
784
863
  };
785
864
 
786
865
  /**
@@ -789,4 +868,4 @@ declare const ENDPOINTS: {
789
868
  type FetchLike = typeof fetch;
790
869
  declare function resolveFetch(custom?: FetchLike): FetchLike;
791
870
 
792
- 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.0";
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 = [
@@ -508,6 +518,11 @@ function normalizeUpdateObjectiveInput(input) {
508
518
  "automationMode cannot be changed after create: recreate the objective instead"
509
519
  );
510
520
  }
521
+ if (input.targetSymbol !== void 0) {
522
+ throw new AureonValidationError(
523
+ "targetSymbol cannot be changed after create: recreate the objective instead"
524
+ );
525
+ }
511
526
  return next;
512
527
  }
513
528
  function assertId(value, label) {
@@ -570,6 +585,7 @@ var AureonClient = class {
570
585
  const address = input.address?.trim();
571
586
  const message = input.message?.trim();
572
587
  const signature = input.signature?.trim();
588
+ const inviteCode = input.inviteCode?.trim();
573
589
  if (!address || !message || !signature) {
574
590
  throw new AureonValidationError(
575
591
  "address, message, and signature are required"
@@ -577,7 +593,7 @@ var AureonClient = class {
577
593
  }
578
594
  return requestJson(this.transport, ENDPOINTS.authVerify, {
579
595
  method: "POST",
580
- body: { address, message, signature }
596
+ body: { address, message, signature, inviteCode }
581
597
  });
582
598
  }
583
599
  /**
@@ -628,7 +644,7 @@ var AureonClient = class {
628
644
  }
629
645
  /**
630
646
  * Applies a partial update to an objective policy or metadata.
631
- * Does **not** accept `automationMode` (mode is locked at create).
647
+ * Does **not** accept `automationMode` or `targetSymbol` (both locked at create).
632
648
  * Auth required.
633
649
  */
634
650
  async updateObjective(id, input) {
@@ -792,6 +808,40 @@ var AureonClient = class {
792
808
  );
793
809
  return result.executions;
794
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
+ }
795
845
  /** Returns the vault overview for the authenticated wallet. Auth required. */
796
846
  async getVault() {
797
847
  return requestJson(this.transport, ENDPOINTS.vault);
@@ -988,7 +1038,8 @@ var TIMELINE_EVENT_TYPES = [
988
1038
  "objective_restored",
989
1039
  "capital_provisioned",
990
1040
  "capital_cleared",
991
- "capital_synced"
1041
+ "capital_synced",
1042
+ "registry_anchored"
992
1043
  ];
993
1044
  function isTimelineEventType(value) {
994
1045
  return TIMELINE_EVENT_TYPES.includes(value);