@proof-labs/trading-sdk 4.2.0 → 5.1.0
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 +66 -10
- package/dist/client.d.ts +111 -41
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +431 -205
- package/dist/client.js.map +1 -1
- package/dist/codec-adapter.d.ts.map +1 -1
- package/dist/codec-adapter.js +20 -4
- package/dist/codec-adapter.js.map +1 -1
- package/dist/crypto.d.ts +20 -0
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +39 -0
- package/dist/crypto.js.map +1 -1
- package/dist/errors.d.ts +30 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +123 -15
- package/dist/errors.js.map +1 -1
- package/dist/feed-types.d.ts +76 -0
- package/dist/feed-types.d.ts.map +1 -0
- package/dist/feed-types.js +2 -0
- package/dist/feed-types.js.map +1 -0
- package/dist/feed.d.ts +158 -0
- package/dist/feed.d.ts.map +1 -0
- package/dist/feed.js +474 -0
- package/dist/feed.js.map +1 -0
- package/dist/gateway-reads.d.ts +110 -0
- package/dist/gateway-reads.d.ts.map +1 -0
- package/dist/gateway-reads.js +91 -0
- package/dist/gateway-reads.js.map +1 -0
- package/dist/governance-query.d.ts +6 -16
- package/dist/governance-query.d.ts.map +1 -1
- package/dist/governance-query.js +101 -93
- package/dist/governance-query.js.map +1 -1
- package/dist/history.d.ts +17 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +150 -0
- package/dist/history.js.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/market-snapshot.d.ts.map +1 -1
- package/dist/market-snapshot.js +4 -5
- package/dist/market-snapshot.js.map +1 -1
- package/dist/oracle-guards.d.ts +5 -0
- package/dist/oracle-guards.d.ts.map +1 -0
- package/dist/oracle-guards.js +27 -0
- package/dist/oracle-guards.js.map +1 -0
- package/dist/oracle-permissions.d.ts +13 -0
- package/dist/oracle-permissions.d.ts.map +1 -1
- package/dist/oracle-permissions.js +44 -1
- package/dist/oracle-permissions.js.map +1 -1
- package/dist/oracle-price-history.d.ts +30 -0
- package/dist/oracle-price-history.d.ts.map +1 -0
- package/dist/oracle-price-history.js +108 -0
- package/dist/oracle-price-history.js.map +1 -0
- package/dist/portfolio-history.d.ts +21 -0
- package/dist/portfolio-history.d.ts.map +1 -0
- package/dist/portfolio-history.js +49 -0
- package/dist/portfolio-history.js.map +1 -0
- package/dist/triggers.d.ts +26 -2
- package/dist/triggers.d.ts.map +1 -1
- package/dist/triggers.js +38 -6
- package/dist/triggers.js.map +1 -1
- package/dist/tx-result.d.ts +6 -0
- package/dist/tx-result.d.ts.map +1 -1
- package/dist/tx-result.js +42 -0
- package/dist/tx-result.js.map +1 -1
- package/dist/types.d.ts +206 -135
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -7
- package/dist/types.js.map +1 -1
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
- package/package.json +5 -1
package/dist/types.d.ts
CHANGED
|
@@ -70,13 +70,17 @@ export declare const ActionType: {
|
|
|
70
70
|
readonly ApproveAgent: 12;
|
|
71
71
|
/** Revoke a previously approved agent wallet. */
|
|
72
72
|
readonly RevokeAgent: 13;
|
|
73
|
-
/**
|
|
74
|
-
readonly CreateImpactMarket: 14;
|
|
75
|
-
/** Resolve an impact-market family with an outcome (admin). DEC-149: was
|
|
76
|
-
* `ResolveEvent`; the standalone-event resolve is `ResolveEvent` (0x27). */
|
|
77
|
-
readonly ResolveImpactMarket: 15;
|
|
78
|
-
/** Resolve a standalone event with a YES/NO outcome (0x27, DEC-149). */
|
|
73
|
+
/** Resolve an event with a YES/NO outcome (0x27). */
|
|
79
74
|
readonly ResolveEvent: 39;
|
|
75
|
+
/** Create a derived sub-account under the signing master (0x28). Dormant
|
|
76
|
+
* behind the sub-account activation: refused as `SubAccountsInactive`. */
|
|
77
|
+
readonly CreateSubAccount: 40;
|
|
78
|
+
/** Move balance between a master and one of its sub-accounts (0x29);
|
|
79
|
+
* dormant like `CreateSubAccount`. */
|
|
80
|
+
readonly SubAccountTransfer: 41;
|
|
81
|
+
/** Acquire the single-holder Solana payout lease on a pending withdrawal
|
|
82
|
+
* (0x2e). Custody-authorized watchers only. */
|
|
83
|
+
readonly ClaimWithdrawalPayout: 46;
|
|
80
84
|
/** Update a subset of `MarketConfig` tunables on a live market (admin).
|
|
81
85
|
* Fee tiering, funding-rate cap tightening, position-limit updates
|
|
82
86
|
* without a chain rebase. */
|
|
@@ -139,6 +143,16 @@ export interface PlaceOrder {
|
|
|
139
143
|
* visible crossing book can fill the whole order immediately.
|
|
140
144
|
*/
|
|
141
145
|
timeInForce?: TimeInForce;
|
|
146
|
+
/**
|
|
147
|
+
* Optional whole-position SL/TP bracket attached at placement time
|
|
148
|
+
* (pre-fill trigger). Installed on the position resulting from this
|
|
149
|
+
* order's first fill; discarded if the order terminates without filling.
|
|
150
|
+
* Encodes as the trailing `stop_loss`/`take_profit` wire fields (nil
|
|
151
|
+
* when absent) added by proof-wire 2.1.0.
|
|
152
|
+
*/
|
|
153
|
+
stopLoss?: TriggerLimb | null;
|
|
154
|
+
/** Optional take-profit limb; see {@link PlaceOrder.stopLoss}. */
|
|
155
|
+
takeProfit?: TriggerLimb | null;
|
|
142
156
|
}
|
|
143
157
|
/** Cancel an existing resting order by its engine-assigned ID. */
|
|
144
158
|
export interface CancelOrder {
|
|
@@ -185,6 +199,15 @@ export interface CancelReplaceOrder {
|
|
|
185
199
|
reduceOnly?: boolean;
|
|
186
200
|
/** Replacement time-in-force policy. Defaults to GTC. */
|
|
187
201
|
timeInForce?: TimeInForce;
|
|
202
|
+
/**
|
|
203
|
+
* Optional whole-position SL/TP bracket for the replacement order
|
|
204
|
+
* (pre-fill trigger; see {@link PlaceOrder.stopLoss}). The replaced
|
|
205
|
+
* order's pending payload is always discarded — replacement is a full
|
|
206
|
+
* payload replacement.
|
|
207
|
+
*/
|
|
208
|
+
stopLoss?: TriggerLimb | null;
|
|
209
|
+
/** Optional take-profit limb; see {@link CancelReplaceOrder.stopLoss}. */
|
|
210
|
+
takeProfit?: TriggerLimb | null;
|
|
188
211
|
}
|
|
189
212
|
/** Amend a resting order without changing its exchange order ID. */
|
|
190
213
|
export interface AmendOrder {
|
|
@@ -256,6 +279,15 @@ export interface MarketOrder {
|
|
|
256
279
|
quantity: bigint;
|
|
257
280
|
/** Optional client-assigned order ID for tracking. */
|
|
258
281
|
clientOrderId?: bigint | null;
|
|
282
|
+
/**
|
|
283
|
+
* Optional whole-position SL/TP bracket attached at placement time
|
|
284
|
+
* (pre-fill trigger; see {@link PlaceOrder.stopLoss}). A market order
|
|
285
|
+
* has no limit price, so the bracket's placement mark is the current
|
|
286
|
+
* mark. Encodes as the trailing wire fields added by proof-wire 2.1.0.
|
|
287
|
+
*/
|
|
288
|
+
stopLoss?: TriggerLimb | null;
|
|
289
|
+
/** Optional take-profit limb; see {@link MarketOrder.stopLoss}. */
|
|
290
|
+
takeProfit?: TriggerLimb | null;
|
|
259
291
|
}
|
|
260
292
|
/**
|
|
261
293
|
* Credit USDC to an account (dev/bootstrap action).
|
|
@@ -567,7 +599,7 @@ export declare enum Branch {
|
|
|
567
599
|
Yes = 1,
|
|
568
600
|
No = 2
|
|
569
601
|
}
|
|
570
|
-
/** Outcome of an
|
|
602
|
+
/** Outcome of an event. */
|
|
571
603
|
export declare enum Outcome {
|
|
572
604
|
Yes = 1,
|
|
573
605
|
No = 2,
|
|
@@ -583,8 +615,8 @@ export declare enum Outcome {
|
|
|
583
615
|
*/
|
|
584
616
|
export type PriceComparison = "GreaterThan" | "LessThan" | "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
585
617
|
/**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
618
|
+
* How an event's YES/NO outcome is determined at settlement. Carried
|
|
619
|
+
* optionally on `CreateEvent`; `undefined`
|
|
588
620
|
* (the wire `nil`) means `RelayerAttested` — the legacy default where
|
|
589
621
|
* the resolver supplies the outcome and the engine trusts it. The two
|
|
590
622
|
* auto-resolve modes derive YES/NO from an on-chain oracle reading and
|
|
@@ -604,45 +636,51 @@ export type EventOracleSource = {
|
|
|
604
636
|
} | {
|
|
605
637
|
kind: "RelayerAttested";
|
|
606
638
|
};
|
|
607
|
-
/**
|
|
608
|
-
|
|
609
|
-
|
|
639
|
+
/**
|
|
640
|
+
* Attach a conditional to an existing event (admin-actions inner tag `0x0a`):
|
|
641
|
+
* the YES conditional book at `childMarketBase` and the NO book at +1, on
|
|
642
|
+
* `underlyingMarket`, recorded on the event's attachment list and settling
|
|
643
|
+
* through the event's two binaries. Governance-only: the embedded `signer`
|
|
644
|
+
* must be zero.
|
|
645
|
+
*/
|
|
646
|
+
export interface AttachConditional {
|
|
647
|
+
eventId: number;
|
|
648
|
+
/** An existing perpetual, not yet attached to this event. */
|
|
610
649
|
underlyingMarket: number;
|
|
650
|
+
/** `childMarketBase` = CPY, +1 = CPN; both ids must be free. */
|
|
611
651
|
childMarketBase: number;
|
|
612
|
-
question: string;
|
|
613
|
-
deadlineMs: bigint;
|
|
614
|
-
resolutionWindowMs: bigint;
|
|
615
652
|
imBps: number;
|
|
616
653
|
mmBps: number;
|
|
617
654
|
takerFeeBps: number;
|
|
618
655
|
makerFeeBps: number;
|
|
619
|
-
fundingIntervalMs: bigint;
|
|
620
|
-
maxFundingRateBps: number;
|
|
621
656
|
signer: Address;
|
|
622
|
-
/**
|
|
623
|
-
*
|
|
624
|
-
|
|
625
|
-
* which preserves the legacy behavior where the resolver supplies the
|
|
626
|
-
* outcome and the engine trusts it. Setting `UnderlyingPriceVsStrike`
|
|
627
|
-
* or `MarketOracle` makes the resolution self-verifying: the engine
|
|
628
|
-
* derives YES/NO from the named oracle's reading and rejects any
|
|
629
|
-
* `ResolveEvent` whose `outcome` doesn't match. `Outcome.Void`
|
|
630
|
-
* overrides the auto-derivation in either auto-resolve mode (operator
|
|
631
|
-
* escape hatch for unresolvable events).
|
|
632
|
-
*/
|
|
633
|
-
oracleSource?: EventOracleSource;
|
|
634
|
-
/** Optional event body text for frontend detail pages. Encodes as "" when
|
|
635
|
-
* absent (matches the engine's `serde(default)`). */
|
|
636
|
-
description?: string;
|
|
637
|
-
/** Optional resolution criteria text. Encodes as "" when absent (matches
|
|
638
|
-
* the engine's `serde(default)`). */
|
|
639
|
-
rules?: string;
|
|
657
|
+
/** Open-interest cap for each of the two conditional books, in the
|
|
658
|
+
* underlying's size scale; `undefined` or `0n` = uncapped (encodes as 0). */
|
|
659
|
+
maxOpenInterest?: bigint;
|
|
640
660
|
}
|
|
641
|
-
/**
|
|
642
|
-
export interface
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
661
|
+
/** Create a derived sub-account under the signing master (0x28). */
|
|
662
|
+
export interface CreateSubAccount {
|
|
663
|
+
/** The master account (20-byte address). */
|
|
664
|
+
owner: Address;
|
|
665
|
+
/** Non-zero id, unique per master. */
|
|
666
|
+
subAccountId: number;
|
|
667
|
+
/** 32-byte display name, zero-padded. */
|
|
668
|
+
name: Uint8Array;
|
|
669
|
+
}
|
|
670
|
+
/** Move balance between a master and one of its sub-accounts (0x29). One
|
|
671
|
+
* side must be the master; the other a derived child. */
|
|
672
|
+
export interface SubAccountTransfer {
|
|
673
|
+
owner: Address;
|
|
674
|
+
from: Address;
|
|
675
|
+
to: Address;
|
|
676
|
+
/** Micro-USDC, greater than zero. */
|
|
677
|
+
amount: bigint;
|
|
678
|
+
}
|
|
679
|
+
/** Acquire the single-holder Solana payout lease on a pending withdrawal
|
|
680
|
+
* (0x2e). `holder` is the claiming watcher's own address. */
|
|
681
|
+
export interface ClaimWithdrawalPayout {
|
|
682
|
+
withdrawalId: bigint;
|
|
683
|
+
holder: Address;
|
|
646
684
|
}
|
|
647
685
|
/** Resolve a standalone event (0x27). YES/NO only — the engine rejects `Void`. */
|
|
648
686
|
export interface ResolveEvent {
|
|
@@ -672,8 +710,19 @@ export interface CreateEvent {
|
|
|
672
710
|
description?: string;
|
|
673
711
|
/** Optional resolution criteria; encodes as "" when absent. */
|
|
674
712
|
rules?: string;
|
|
713
|
+
/** Open-interest cap for each of the event's two binary books, in
|
|
714
|
+
* contracts; `undefined` or `0n` = uncapped (encodes as 0). */
|
|
715
|
+
maxOpenInterest?: bigint;
|
|
716
|
+
}
|
|
717
|
+
/** One conditional attached to an event: the underlying perpetual and the
|
|
718
|
+
* YES/NO conditional books that settle against it. */
|
|
719
|
+
export interface AttachedConditional {
|
|
720
|
+
underlyingMarket: number;
|
|
721
|
+
cpyMarket: number;
|
|
722
|
+
cpnMarket: number;
|
|
675
723
|
}
|
|
676
|
-
/** Stored record for
|
|
724
|
+
/** Stored record for an event — the `get_event` read model: its two binary
|
|
725
|
+
* books and every conditional attached to it. */
|
|
677
726
|
export interface EventInfo {
|
|
678
727
|
eventId: number;
|
|
679
728
|
ebyMarket: number;
|
|
@@ -681,11 +730,13 @@ export interface EventInfo {
|
|
|
681
730
|
question: string;
|
|
682
731
|
settlementMs: bigint;
|
|
683
732
|
resolutionWindowMs: bigint;
|
|
684
|
-
status:
|
|
733
|
+
status: EventStatus;
|
|
685
734
|
createdMs: bigint;
|
|
686
735
|
resolvedMs: bigint;
|
|
687
736
|
/** `undefined` (wire `nil`) means `RelayerAttested`. */
|
|
688
737
|
oracleSource?: EventOracleSource;
|
|
738
|
+
/** Every attachment, in attachment order; empty for a binary-only event. */
|
|
739
|
+
attachedConditionals: AttachedConditional[];
|
|
689
740
|
}
|
|
690
741
|
/**
|
|
691
742
|
* Update a subset of `MarketConfig` fields on an existing market.
|
|
@@ -802,8 +853,9 @@ export interface UpdateMarketFees {
|
|
|
802
853
|
*/
|
|
803
854
|
maxOpenInterest?: bigint | null;
|
|
804
855
|
}
|
|
805
|
-
/** Lifecycle status of an
|
|
806
|
-
|
|
856
|
+
/** Lifecycle status of an event: `Trading` until its settlement time,
|
|
857
|
+
* `Resolved(outcome)` once settled. */
|
|
858
|
+
export type EventStatus = {
|
|
807
859
|
kind: "Trading";
|
|
808
860
|
} | {
|
|
809
861
|
kind: "PreResolution";
|
|
@@ -811,29 +863,6 @@ export type ImpactMarketStatus = {
|
|
|
811
863
|
kind: "Resolved";
|
|
812
864
|
outcome: Outcome;
|
|
813
865
|
};
|
|
814
|
-
/** On-chain info for an impact-market family. */
|
|
815
|
-
export interface ImpactMarketInfo {
|
|
816
|
-
impactMarketId: number;
|
|
817
|
-
underlyingMarket: number;
|
|
818
|
-
cpyMarket: number;
|
|
819
|
-
cpnMarket: number;
|
|
820
|
-
ebyMarket: number;
|
|
821
|
-
ebnMarket: number;
|
|
822
|
-
question: string;
|
|
823
|
-
deadlineMs: bigint;
|
|
824
|
-
resolutionWindowMs: bigint;
|
|
825
|
-
status: ImpactMarketStatus;
|
|
826
|
-
createdMs: bigint;
|
|
827
|
-
resolvedMs: bigint;
|
|
828
|
-
/** BE-54: how the YES/NO outcome is determined at deadline. `undefined`
|
|
829
|
-
* (older gateways / pre-BE-54 records) means `RelayerAttested`. */
|
|
830
|
-
oracleSource?: EventOracleSource;
|
|
831
|
-
/** Event body text; `""` when the record has none. `undefined` only on
|
|
832
|
-
* gateways older than admin-actions v2 (field not served). */
|
|
833
|
-
description?: string;
|
|
834
|
-
/** Resolution criteria text; same shipping note as `description`. */
|
|
835
|
-
rules?: string;
|
|
836
|
-
}
|
|
837
866
|
/** Pick a per-account override on the initial-margin ratio for one
|
|
838
867
|
* market. Engine takes max(market.imBps, userImBps), so users can
|
|
839
868
|
* deleverage but not exceed the market's risk floor. `userImBps == 0`
|
|
@@ -940,6 +969,12 @@ export type TraderAction = {
|
|
|
940
969
|
} | {
|
|
941
970
|
type: "CancelPositionTriggers";
|
|
942
971
|
data: CancelPositionTriggers;
|
|
972
|
+
} | {
|
|
973
|
+
type: "CreateSubAccount";
|
|
974
|
+
data: CreateSubAccount;
|
|
975
|
+
} | {
|
|
976
|
+
type: "SubAccountTransfer";
|
|
977
|
+
data: SubAccountTransfer;
|
|
943
978
|
};
|
|
944
979
|
/**
|
|
945
980
|
* Operator actions — privileged infrastructure submitted by the operator's
|
|
@@ -986,15 +1021,12 @@ export type OperatorAction = {
|
|
|
986
1021
|
} | {
|
|
987
1022
|
type: "AuthorizeWithdrawal";
|
|
988
1023
|
data: AuthorizeWithdrawal;
|
|
989
|
-
} | {
|
|
990
|
-
type: "CreateImpactMarket";
|
|
991
|
-
data: CreateImpactMarket;
|
|
992
|
-
} | {
|
|
993
|
-
type: "ResolveImpactMarket";
|
|
994
|
-
data: ResolveImpactMarket;
|
|
995
1024
|
} | {
|
|
996
1025
|
type: "ResolveEvent";
|
|
997
1026
|
data: ResolveEvent;
|
|
1027
|
+
} | {
|
|
1028
|
+
type: "ClaimWithdrawalPayout";
|
|
1029
|
+
data: ClaimWithdrawalPayout;
|
|
998
1030
|
} | {
|
|
999
1031
|
type: "UpdateMarketFees";
|
|
1000
1032
|
data: UpdateMarketFees;
|
|
@@ -1027,11 +1059,8 @@ export type AdminBatchItem = {
|
|
|
1027
1059
|
kind: "CreateMarket";
|
|
1028
1060
|
value: CreateMarket;
|
|
1029
1061
|
} | {
|
|
1030
|
-
kind: "
|
|
1031
|
-
value:
|
|
1032
|
-
} | {
|
|
1033
|
-
kind: "CreateEvent";
|
|
1034
|
-
value: CreateEvent;
|
|
1062
|
+
kind: "AttachConditional";
|
|
1063
|
+
value: AttachConditional;
|
|
1035
1064
|
};
|
|
1036
1065
|
/**
|
|
1037
1066
|
* Governance cancel of every resting order one account holds, optionally
|
|
@@ -1046,17 +1075,49 @@ export interface CancelAllOrdersForAccount {
|
|
|
1046
1075
|
/** Confine the cancel to one market; omit to sweep every market. */
|
|
1047
1076
|
market?: number | null;
|
|
1048
1077
|
}
|
|
1078
|
+
/** One operator-authority allowlist an `UpdateAuthoritySet` action targets.
|
|
1079
|
+
* Externally tagged on the wire, so the domain arrives as this bare
|
|
1080
|
+
* string, never a numeric discriminant. `Custody`/`MarketParams`/
|
|
1081
|
+
* `ScheduledOps` are the capability-split sets; `Oracle`/`CexComposite`/
|
|
1082
|
+
* `Relayer` are the genesis-seeded presence sets. */
|
|
1083
|
+
export type AuthorityDomain = "Oracle" | "CexComposite" | "Relayer" | "Custody" | "MarketParams" | "ScheduledOps";
|
|
1084
|
+
/**
|
|
1085
|
+
* Governance addition/removal of members in one privileged authorization
|
|
1086
|
+
* set (inner tag `0x07`). `add` and `remove` are each canonically sorted,
|
|
1087
|
+
* duplicate-free, and disjoint; the engine refuses a proposal that would
|
|
1088
|
+
* leave the domain's net set empty.
|
|
1089
|
+
*/
|
|
1090
|
+
export interface UpdateAuthoritySet {
|
|
1091
|
+
domain: AuthorityDomain;
|
|
1092
|
+
/** Addresses to add to the domain (each a 20-byte address). */
|
|
1093
|
+
add: Address[];
|
|
1094
|
+
/** Addresses to remove from the domain (each a 20-byte address). */
|
|
1095
|
+
remove: Address[];
|
|
1096
|
+
}
|
|
1097
|
+
/** Update oracle safety bounds through multisig governance (inner tag 13).
|
|
1098
|
+
* Omitted/null fields stay unchanged; clearing either guard is not permitted. */
|
|
1099
|
+
export interface SetOracleGuards {
|
|
1100
|
+
market: number;
|
|
1101
|
+
/** Positive u64 milliseconds; omit to leave unchanged. */
|
|
1102
|
+
markPriceMaxOracleAgeMs?: bigint | null;
|
|
1103
|
+
/** Integer basis points in 1..=10_000; omit to leave unchanged. */
|
|
1104
|
+
maxOracleDeviationBps?: number | null;
|
|
1105
|
+
}
|
|
1049
1106
|
/**
|
|
1050
1107
|
* Closed, typed set of operations executable through the multisig. The
|
|
1051
|
-
* embedded `CreateMarket.signer` / `
|
|
1108
|
+
* embedded `CreateMarket.signer` / `AttachConditional.signer` must be
|
|
1052
1109
|
* zero — governance supplies the authorization, not the embedded address.
|
|
1053
1110
|
*
|
|
1054
1111
|
* `Batch` executes its items atomically in order against one overlay:
|
|
1055
1112
|
* all succeed or the proposal fails with no partial state. Admitted on
|
|
1056
|
-
* chain only once admin-actions v2 activates
|
|
1057
|
-
*
|
|
1113
|
+
* chain only once admin-actions v2 activates; `CreateEvent` and
|
|
1114
|
+
* `AttachConditional` ride the standalone-events activation. The engine
|
|
1115
|
+
* refuses every tag below its activation height.
|
|
1058
1116
|
*/
|
|
1059
1117
|
export type AdminAction = {
|
|
1118
|
+
kind: "SetOracleGuards";
|
|
1119
|
+
value: SetOracleGuards;
|
|
1120
|
+
} | {
|
|
1060
1121
|
kind: "CancelAllOrdersForAccount";
|
|
1061
1122
|
value: CancelAllOrdersForAccount;
|
|
1062
1123
|
} | {
|
|
@@ -1068,12 +1129,12 @@ export type AdminAction = {
|
|
|
1068
1129
|
} | {
|
|
1069
1130
|
kind: "UpdateAdminSignerRegistry";
|
|
1070
1131
|
value: UpdateAdminSignerRegistry;
|
|
1071
|
-
} | {
|
|
1072
|
-
kind: "CreateImpactMarket";
|
|
1073
|
-
value: CreateImpactMarket;
|
|
1074
1132
|
} | {
|
|
1075
1133
|
kind: "CreateEvent";
|
|
1076
1134
|
value: CreateEvent;
|
|
1135
|
+
} | {
|
|
1136
|
+
kind: "AttachConditional";
|
|
1137
|
+
value: AttachConditional;
|
|
1077
1138
|
} | {
|
|
1078
1139
|
kind: "Batch";
|
|
1079
1140
|
value: AdminBatchItem[];
|
|
@@ -1083,14 +1144,9 @@ export type AdminAction = {
|
|
|
1083
1144
|
} | {
|
|
1084
1145
|
kind: "UnpauseBridge";
|
|
1085
1146
|
} | {
|
|
1086
|
-
kind: "
|
|
1087
|
-
value:
|
|
1147
|
+
kind: "UpdateAuthoritySet";
|
|
1148
|
+
value: UpdateAuthoritySet;
|
|
1088
1149
|
};
|
|
1089
|
-
/** Governance cancel of a wallet's resting orders, optionally one market (tag 8). */
|
|
1090
|
-
export interface CancelAllOrdersForAccount {
|
|
1091
|
-
owner: Address;
|
|
1092
|
-
market?: number | null;
|
|
1093
|
-
}
|
|
1094
1150
|
/** Authenticated relay attestation, not a cryptographic provider-proof verifier.
|
|
1095
1151
|
* Price and confidence are integers in the policy's normalized micro unit. */
|
|
1096
1152
|
export interface SubmitOracleObservation {
|
|
@@ -1539,8 +1595,9 @@ export type ExchangeEvent = OrderPlacedEvent | OrderCancelledEvent | TradeExecut
|
|
|
1539
1595
|
* - `"engine"` — the engine rejected it with an `ExecError` (`code` 1..53/255);
|
|
1540
1596
|
* see {@link TxResult.error} for the decoded name/description.
|
|
1541
1597
|
* - `"transport"` — a gateway/HTTP-level failure (auth, rate-limit, body too
|
|
1542
|
-
* large,
|
|
1543
|
-
*
|
|
1598
|
+
* large, or a structured pre-admission refusal at HTTP
|
|
1599
|
+
* 200/503). `code` is synthetic (1 for HTTP 200), not an
|
|
1600
|
+
* engine code. Unrecognized 5xx responses stay `timeout`.
|
|
1544
1601
|
* - `"timeout"` — no final chain verdict is available yet (`code === -1`):
|
|
1545
1602
|
* either the gateway returned a hash-only ambiguous response
|
|
1546
1603
|
* or inclusion polling expired. The tx may still land.
|
|
@@ -1577,6 +1634,8 @@ export interface TxResult {
|
|
|
1577
1634
|
height?: number;
|
|
1578
1635
|
/** Human-readable log message (populated on error). */
|
|
1579
1636
|
log?: string;
|
|
1637
|
+
/** Optional ABCI diagnostic info, preserved without interpretation. */
|
|
1638
|
+
info?: string;
|
|
1580
1639
|
/** ABCI events emitted by the transaction. */
|
|
1581
1640
|
events?: TxEvent[];
|
|
1582
1641
|
}
|
|
@@ -1706,7 +1765,12 @@ export interface PositionTriggerInfo {
|
|
|
1706
1765
|
marketConfig: TriggerMarketConfig | null;
|
|
1707
1766
|
availability: TriggerEffectiveAvailability;
|
|
1708
1767
|
}
|
|
1709
|
-
/** Next-height admission predicate returned by `GET /v1/triggers/status`.
|
|
1768
|
+
/** Next-height admission predicate returned by `GET /v1/triggers/status`.
|
|
1769
|
+
*
|
|
1770
|
+
* @deprecated `GET /v1/triggers/status` is deleted upstream (exchange#619,
|
|
1771
|
+
* genesis-first; api-gateway#175, gateway 4.0.0). Trigger actions are
|
|
1772
|
+
* permanently active, so there is nothing to read. It will be removed in the
|
|
1773
|
+
* next major version. */
|
|
1710
1774
|
export interface TriggerStatus {
|
|
1711
1775
|
finalizedHeight: bigint;
|
|
1712
1776
|
admissionHeight: bigint;
|
|
@@ -1925,40 +1989,33 @@ export interface PositionInfo {
|
|
|
1925
1989
|
* trigger placement rather than guess `1`. */
|
|
1926
1990
|
positionEpoch?: bigint;
|
|
1927
1991
|
}
|
|
1928
|
-
/** One entry per active
|
|
1929
|
-
* (
|
|
1930
|
-
* ascending by
|
|
1992
|
+
/** One entry per active event the account touches through a conditional.
|
|
1993
|
+
* Tuple of (eventId, branch) where branch is "Yes" or "No". Ordering is
|
|
1994
|
+
* ascending by eventId (deterministic across nodes).
|
|
1931
1995
|
*
|
|
1932
1996
|
* See AccountInfo.bindingScenario for semantics. */
|
|
1933
1997
|
export interface BindingScenarioEntry {
|
|
1934
|
-
|
|
1998
|
+
eventId: number;
|
|
1935
1999
|
branch: "Yes" | "No";
|
|
1936
2000
|
}
|
|
1937
|
-
/** One
|
|
1938
|
-
*
|
|
1939
|
-
* "equity over time" reconstruction (Jesse's P2 #6).
|
|
1940
|
-
*
|
|
1941
|
-
* Returned by `GET /v1/history/deposits/{address}` and `GET
|
|
1942
|
-
* /v1/history/withdrawals/{address}`, and by the `historyDeposits` /
|
|
1943
|
-
* `historyWithdrawals` InfoRequests. Shipped 2026-04-24. */
|
|
2001
|
+
/** One deposit/withdrawal event from owner- and event-filtered
|
|
2002
|
+
* `/v1/history/account-events` pages. */
|
|
1944
2003
|
export interface HistoryCashFlow {
|
|
1945
|
-
/**
|
|
1946
|
-
kind: "deposit_confirmed" | "withdraw_requested" | "withdrawal_confirmed" | "withdrawal_failed";
|
|
2004
|
+
/** Original engine event kind, including direct relayer credits/debits. */
|
|
2005
|
+
kind: "deposited" | "withdrawn" | "deposit_confirmed" | "withdraw_requested" | "withdrawal_confirmed" | "withdrawal_failed";
|
|
1947
2006
|
/** 20-byte owner address as hex. */
|
|
1948
2007
|
owner: string;
|
|
1949
|
-
/**
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
2008
|
+
/** Principal amount in micro-USDC. Custody requests/refunds omit fees.
|
|
2009
|
+
* Empty on owner-scoped confirmations from compatible deployments; the
|
|
2010
|
+
* current indexer omits ownerless withdrawal_confirmed events entirely. */
|
|
1952
2011
|
amount: string;
|
|
1953
|
-
/**
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
1956
|
-
* "0" for withdrawal_confirmed (no change) */
|
|
2012
|
+
/** Exact event balance delta: deposit amount, negated direct withdrawal
|
|
2013
|
+
* amount, or "0" on confirmation. Empty on withdrawal request/failure:
|
|
2014
|
+
* their payloads omit the custody fee included in the actual debit/refund. */
|
|
1957
2015
|
signedDelta: string;
|
|
1958
|
-
/** Post-event balance
|
|
1959
|
-
* empty for confirmed (no balance change on that event). */
|
|
2016
|
+
/** Post-event balance when emitted; empty when absent from the event. */
|
|
1960
2017
|
newBalance: string;
|
|
1961
|
-
/** Present on withdrawal events (request, confirmed, failed). */
|
|
2018
|
+
/** Present on custody withdrawal events (request, confirmed, failed). */
|
|
1962
2019
|
withdrawalId: string;
|
|
1963
2020
|
/** Present on deposit_confirmed + withdrawal_confirmed. */
|
|
1964
2021
|
solanaTxSig: string;
|
|
@@ -1981,8 +2038,8 @@ export interface HistoryCashFlow {
|
|
|
1981
2038
|
export interface HistoryResolution {
|
|
1982
2039
|
/** One of "conditional_settled" | "conditional_voided" | "prediction_settled". */
|
|
1983
2040
|
kind: "conditional_settled" | "conditional_voided" | "prediction_settled";
|
|
1984
|
-
/**
|
|
1985
|
-
|
|
2041
|
+
/** Event the resolved position belonged to, as a decimal string. */
|
|
2042
|
+
eventId: string;
|
|
1986
2043
|
/** Child market ID (CPY/CPN or EBY/EBN). */
|
|
1987
2044
|
market: string;
|
|
1988
2045
|
/** 20-byte owner address as hex. */
|
|
@@ -2004,24 +2061,19 @@ export interface HistoryResolution {
|
|
|
2004
2061
|
/** Unix milliseconds. */
|
|
2005
2062
|
timestamp: number;
|
|
2006
2063
|
}
|
|
2007
|
-
/**
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
* non-zero snapshot for the same `(owner, market, side)` carries the
|
|
2012
|
-
* weighted-average entry price.
|
|
2013
|
-
*
|
|
2014
|
-
* Returned by `GET /v1/history/positions/{address}` and the
|
|
2015
|
-
* `historyPositions` InfoRequest. The HTTP endpoint accepts optional
|
|
2016
|
-
* `?market=&from=&to=&limit=` filters; results are newest-first. */
|
|
2064
|
+
/** Compatibility row from queryHistoryPositions(). A zero size is a closed
|
|
2065
|
+
* position; absent side/entry price become empty strings and block time is
|
|
2066
|
+
* projected to milliseconds. Use queryHistoryPositionsPage() for exact times,
|
|
2067
|
+
* nullable fields and pagination. */
|
|
2017
2068
|
export interface HistoryPositionSnapshot {
|
|
2018
2069
|
/** 20-byte owner address as hex. */
|
|
2019
2070
|
owner: string;
|
|
2020
2071
|
/** Market ID as a decimal string. */
|
|
2021
2072
|
market: string;
|
|
2022
|
-
/** Position side
|
|
2073
|
+
/** Position side as served; empty when a closed position has no side.
|
|
2074
|
+
* Use HistoryPosition for the nullable representation. */
|
|
2023
2075
|
side: string;
|
|
2024
|
-
/**
|
|
2076
|
+
/** Entry price in micro-USDC, or empty when absent on a close. */
|
|
2025
2077
|
entryPrice: string;
|
|
2026
2078
|
/** Absolute position size in contracts. "0" = closed. */
|
|
2027
2079
|
size: string;
|
|
@@ -2030,6 +2082,24 @@ export interface HistoryPositionSnapshot {
|
|
|
2030
2082
|
/** Unix milliseconds. */
|
|
2031
2083
|
timestamp: number;
|
|
2032
2084
|
}
|
|
2085
|
+
/** Indexer position snapshot with exact timestamp and absent close fields retained. */
|
|
2086
|
+
export interface HistoryPosition {
|
|
2087
|
+
owner: string;
|
|
2088
|
+
market: number;
|
|
2089
|
+
side: string | null;
|
|
2090
|
+
/** Micro-USDC decimal text; null when the closed position has no entry price. */
|
|
2091
|
+
entryPrice: string | null;
|
|
2092
|
+
/** Integer contracts as decimal text; zero denotes a closed position. */
|
|
2093
|
+
size: string;
|
|
2094
|
+
blockHeight: number;
|
|
2095
|
+
/** RFC 3339 timestamp, retaining the indexer's fractional-second precision. */
|
|
2096
|
+
blockTime: string;
|
|
2097
|
+
}
|
|
2098
|
+
/** One newest-first page. An empty nextCursor means there are no further rows. */
|
|
2099
|
+
export interface HistoryPositionsPage {
|
|
2100
|
+
positions: HistoryPosition[];
|
|
2101
|
+
nextCursor: string;
|
|
2102
|
+
}
|
|
2033
2103
|
/** One executed fill from `/v1/history/fills/{owner}` (or `/v1/fills`). */
|
|
2034
2104
|
export interface HistoryFill {
|
|
2035
2105
|
/** Unsigned 64-bit fill identifier as a decimal string. NOTE: the indexer
|
|
@@ -2077,7 +2147,7 @@ export interface AccountInfo {
|
|
|
2077
2147
|
/** [5] Margin ratio in basis points (equity / total notional * 10000). */
|
|
2078
2148
|
marginRatioBps: bigint;
|
|
2079
2149
|
/** [6] Resolution scenario that maximizes totalMm — the "binding" outcome.
|
|
2080
|
-
* One entry per active
|
|
2150
|
+
* One entry per active event, ascending by eventId.
|
|
2081
2151
|
* Empty for perp-only accounts. Undefined on responses from gateways
|
|
2082
2152
|
* older than 2026-04-24 (backward compat — the SDK decoder reads
|
|
2083
2153
|
* msgpack arrays by index). See Jesse's P1 #3 in docs/api-scope.md. */
|
|
@@ -2095,8 +2165,8 @@ export interface AccountInfo {
|
|
|
2095
2165
|
}
|
|
2096
2166
|
/** Market kind discriminator. Wire shape mirrors the Rust `MarketKind`
|
|
2097
2167
|
* enum exactly: `"Perp"` is a bare string, the parameterised variants
|
|
2098
|
-
* are `{ ConditionalPerp: [
|
|
2099
|
-
* `{ PredictionBinary: [
|
|
2168
|
+
* are `{ ConditionalPerp: [eventId, branch] }` /
|
|
2169
|
+
* `{ PredictionBinary: [eventId, branch] }` — both keyed by the event. */
|
|
2100
2170
|
export type MarketKind = "Perp" | {
|
|
2101
2171
|
ConditionalPerp: [number, "Yes" | "No"];
|
|
2102
2172
|
} | {
|
|
@@ -2113,7 +2183,8 @@ export interface MarketsSnapshot {
|
|
|
2113
2183
|
chainId: Uint8Array;
|
|
2114
2184
|
height: bigint;
|
|
2115
2185
|
markets: MarketConfig[];
|
|
2116
|
-
|
|
2186
|
+
/** Every event with its binaries and attached conditionals. */
|
|
2187
|
+
events: EventInfo[];
|
|
2117
2188
|
}
|
|
2118
2189
|
export interface MarketConfig {
|
|
2119
2190
|
/** [0] Market identifier (unique integer). */
|