@proof-labs/trading-sdk 4.0.0 → 5.0.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 +137 -6
- package/dist/account-state.d.ts +17 -0
- package/dist/account-state.d.ts.map +1 -0
- package/dist/account-state.js +63 -0
- package/dist/account-state.js.map +1 -0
- package/dist/client.d.ts +112 -31
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +472 -188
- package/dist/client.js.map +1 -1
- package/dist/codec-adapter.d.ts.map +1 -1
- package/dist/codec-adapter.js +11 -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 +26 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +111 -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/financial-state.d.ts +65 -0
- package/dist/financial-state.d.ts.map +1 -0
- package/dist/financial-state.js +345 -0
- package/dist/financial-state.js.map +1 -0
- package/dist/gateway-reads.d.ts +74 -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 +7 -13
- package/dist/governance-query.d.ts.map +1 -1
- package/dist/governance-query.js +131 -70
- 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 +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/market-snapshot.d.ts +11 -0
- package/dist/market-snapshot.d.ts.map +1 -0
- package/dist/market-snapshot.js +325 -0
- package/dist/market-snapshot.js.map +1 -0
- package/dist/oracle-permissions.d.ts +51 -0
- package/dist/oracle-permissions.d.ts.map +1 -0
- package/dist/oracle-permissions.js +191 -0
- package/dist/oracle-permissions.js.map +1 -0
- 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/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 +235 -114
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +14 -5
- 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
|
@@ -33,6 +33,8 @@ export declare const ActionType: {
|
|
|
33
33
|
/** Operator-only: submit a composite-CEX price for the multi-source mark
|
|
34
34
|
* median (BE-31 Phase B). Feeder infrastructure, not a trading action. */
|
|
35
35
|
readonly OracleUpdateComposite: 20;
|
|
36
|
+
/** Quorum-policy source relay; dormant until the engine's oracle gate. */
|
|
37
|
+
readonly SubmitOracleObservation: 45;
|
|
36
38
|
/** Place a market order that crosses immediately. */
|
|
37
39
|
readonly MarketOrder: 4;
|
|
38
40
|
/** Credit USDC to an account (legacy, prefer ConfirmDeposit). */
|
|
@@ -68,10 +70,17 @@ export declare const ActionType: {
|
|
|
68
70
|
readonly ApproveAgent: 12;
|
|
69
71
|
/** Revoke a previously approved agent wallet. */
|
|
70
72
|
readonly RevokeAgent: 13;
|
|
71
|
-
/**
|
|
72
|
-
readonly
|
|
73
|
-
/**
|
|
74
|
-
|
|
73
|
+
/** Resolve an event with a YES/NO outcome (0x27). */
|
|
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;
|
|
75
84
|
/** Update a subset of `MarketConfig` tunables on a live market (admin).
|
|
76
85
|
* Fee tiering, funding-rate cap tightening, position-limit updates
|
|
77
86
|
* without a chain rebase. */
|
|
@@ -562,7 +571,7 @@ export declare enum Branch {
|
|
|
562
571
|
Yes = 1,
|
|
563
572
|
No = 2
|
|
564
573
|
}
|
|
565
|
-
/** Outcome of an
|
|
574
|
+
/** Outcome of an event. */
|
|
566
575
|
export declare enum Outcome {
|
|
567
576
|
Yes = 1,
|
|
568
577
|
No = 2,
|
|
@@ -578,8 +587,8 @@ export declare enum Outcome {
|
|
|
578
587
|
*/
|
|
579
588
|
export type PriceComparison = "GreaterThan" | "LessThan" | "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
580
589
|
/**
|
|
581
|
-
*
|
|
582
|
-
*
|
|
590
|
+
* How an event's YES/NO outcome is determined at settlement. Carried
|
|
591
|
+
* optionally on `CreateEvent`; `undefined`
|
|
583
592
|
* (the wire `nil`) means `RelayerAttested` — the legacy default where
|
|
584
593
|
* the resolver supplies the outcome and the engine trusts it. The two
|
|
585
594
|
* auto-resolve modes derive YES/NO from an on-chain oracle reading and
|
|
@@ -599,46 +608,108 @@ export type EventOracleSource = {
|
|
|
599
608
|
} | {
|
|
600
609
|
kind: "RelayerAttested";
|
|
601
610
|
};
|
|
602
|
-
/**
|
|
603
|
-
|
|
604
|
-
|
|
611
|
+
/**
|
|
612
|
+
* Attach a conditional to an existing event (admin-actions inner tag `0x0a`):
|
|
613
|
+
* the YES conditional book at `childMarketBase` and the NO book at +1, on
|
|
614
|
+
* `underlyingMarket`, recorded on the event's attachment list and settling
|
|
615
|
+
* through the event's two binaries. Governance-only: the embedded `signer`
|
|
616
|
+
* must be zero.
|
|
617
|
+
*/
|
|
618
|
+
export interface AttachConditional {
|
|
619
|
+
eventId: number;
|
|
620
|
+
/** An existing perpetual, not yet attached to this event. */
|
|
605
621
|
underlyingMarket: number;
|
|
622
|
+
/** `childMarketBase` = CPY, +1 = CPN; both ids must be free. */
|
|
606
623
|
childMarketBase: number;
|
|
607
|
-
question: string;
|
|
608
|
-
deadlineMs: bigint;
|
|
609
|
-
resolutionWindowMs: bigint;
|
|
610
624
|
imBps: number;
|
|
611
625
|
mmBps: number;
|
|
612
626
|
takerFeeBps: number;
|
|
613
627
|
makerFeeBps: number;
|
|
614
|
-
fundingIntervalMs: bigint;
|
|
615
|
-
maxFundingRateBps: number;
|
|
616
628
|
signer: Address;
|
|
617
|
-
/**
|
|
618
|
-
*
|
|
619
|
-
|
|
620
|
-
* which preserves the legacy behavior where the resolver supplies the
|
|
621
|
-
* outcome and the engine trusts it. Setting `UnderlyingPriceVsStrike`
|
|
622
|
-
* or `MarketOracle` makes the resolution self-verifying: the engine
|
|
623
|
-
* derives YES/NO from the named oracle's reading and rejects any
|
|
624
|
-
* `ResolveEvent` whose `outcome` doesn't match. `Outcome.Void`
|
|
625
|
-
* overrides the auto-derivation in either auto-resolve mode (operator
|
|
626
|
-
* escape hatch for unresolvable events).
|
|
627
|
-
*/
|
|
628
|
-
oracleSource?: EventOracleSource;
|
|
629
|
-
/** Optional event body text for frontend detail pages. Encodes as "" when
|
|
630
|
-
* absent (matches the engine's `serde(default)`). */
|
|
631
|
-
description?: string;
|
|
632
|
-
/** Optional resolution criteria text. Encodes as "" when absent (matches
|
|
633
|
-
* the engine's `serde(default)`). */
|
|
634
|
-
rules?: string;
|
|
629
|
+
/** Open-interest cap for each of the two conditional books, in the
|
|
630
|
+
* underlying's size scale; `undefined` or `0n` = uncapped (encodes as 0). */
|
|
631
|
+
maxOpenInterest?: bigint;
|
|
635
632
|
}
|
|
636
|
-
/**
|
|
633
|
+
/** Create a derived sub-account under the signing master (0x28). */
|
|
634
|
+
export interface CreateSubAccount {
|
|
635
|
+
/** The master account (20-byte address). */
|
|
636
|
+
owner: Address;
|
|
637
|
+
/** Non-zero id, unique per master. */
|
|
638
|
+
subAccountId: number;
|
|
639
|
+
/** 32-byte display name, zero-padded. */
|
|
640
|
+
name: Uint8Array;
|
|
641
|
+
}
|
|
642
|
+
/** Move balance between a master and one of its sub-accounts (0x29). One
|
|
643
|
+
* side must be the master; the other a derived child. */
|
|
644
|
+
export interface SubAccountTransfer {
|
|
645
|
+
owner: Address;
|
|
646
|
+
from: Address;
|
|
647
|
+
to: Address;
|
|
648
|
+
/** Micro-USDC, greater than zero. */
|
|
649
|
+
amount: bigint;
|
|
650
|
+
}
|
|
651
|
+
/** Acquire the single-holder Solana payout lease on a pending withdrawal
|
|
652
|
+
* (0x2e). `holder` is the claiming watcher's own address. */
|
|
653
|
+
export interface ClaimWithdrawalPayout {
|
|
654
|
+
withdrawalId: bigint;
|
|
655
|
+
holder: Address;
|
|
656
|
+
}
|
|
657
|
+
/** Resolve a standalone event (0x27). YES/NO only — the engine rejects `Void`. */
|
|
637
658
|
export interface ResolveEvent {
|
|
638
|
-
|
|
659
|
+
eventId: number;
|
|
639
660
|
outcome: Outcome;
|
|
640
661
|
signer: Address;
|
|
641
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* Create a standalone event (admin-actions v2 inner tag `0x09`): two
|
|
665
|
+
* prediction-binary books (EBY at `childMarketBase`, EBN at +1) under one
|
|
666
|
+
* `EventInfo`, no underlying perp and no conditional legs. The embedded
|
|
667
|
+
* `signer` must be zero — governance supplies the authorization.
|
|
668
|
+
*/
|
|
669
|
+
export interface CreateEvent {
|
|
670
|
+
eventId: number;
|
|
671
|
+
childMarketBase: number;
|
|
672
|
+
poolId: number;
|
|
673
|
+
question: string;
|
|
674
|
+
settlementMs: bigint;
|
|
675
|
+
resolutionWindowMs: bigint;
|
|
676
|
+
takerFeeBps: number;
|
|
677
|
+
makerFeeBps: number;
|
|
678
|
+
signer: Address;
|
|
679
|
+
/** How YES/NO is determined; `undefined` (wire `nil`) = `RelayerAttested`. */
|
|
680
|
+
oracleSource?: EventOracleSource;
|
|
681
|
+
/** Optional body text; encodes as "" when absent (`serde(default)`). */
|
|
682
|
+
description?: string;
|
|
683
|
+
/** Optional resolution criteria; encodes as "" when absent. */
|
|
684
|
+
rules?: string;
|
|
685
|
+
/** Open-interest cap for each of the event's two binary books, in
|
|
686
|
+
* contracts; `undefined` or `0n` = uncapped (encodes as 0). */
|
|
687
|
+
maxOpenInterest?: bigint;
|
|
688
|
+
}
|
|
689
|
+
/** One conditional attached to an event: the underlying perpetual and the
|
|
690
|
+
* YES/NO conditional books that settle against it. */
|
|
691
|
+
export interface AttachedConditional {
|
|
692
|
+
underlyingMarket: number;
|
|
693
|
+
cpyMarket: number;
|
|
694
|
+
cpnMarket: number;
|
|
695
|
+
}
|
|
696
|
+
/** Stored record for an event — the `get_event` read model: its two binary
|
|
697
|
+
* books and every conditional attached to it. */
|
|
698
|
+
export interface EventInfo {
|
|
699
|
+
eventId: number;
|
|
700
|
+
ebyMarket: number;
|
|
701
|
+
ebnMarket: number;
|
|
702
|
+
question: string;
|
|
703
|
+
settlementMs: bigint;
|
|
704
|
+
resolutionWindowMs: bigint;
|
|
705
|
+
status: EventStatus;
|
|
706
|
+
createdMs: bigint;
|
|
707
|
+
resolvedMs: bigint;
|
|
708
|
+
/** `undefined` (wire `nil`) means `RelayerAttested`. */
|
|
709
|
+
oracleSource?: EventOracleSource;
|
|
710
|
+
/** Every attachment, in attachment order; empty for a binary-only event. */
|
|
711
|
+
attachedConditionals: AttachedConditional[];
|
|
712
|
+
}
|
|
642
713
|
/**
|
|
643
714
|
* Update a subset of `MarketConfig` fields on an existing market.
|
|
644
715
|
* Every tunable is optional; `null`/`undefined` leaves the current
|
|
@@ -754,8 +825,9 @@ export interface UpdateMarketFees {
|
|
|
754
825
|
*/
|
|
755
826
|
maxOpenInterest?: bigint | null;
|
|
756
827
|
}
|
|
757
|
-
/** Lifecycle status of an
|
|
758
|
-
|
|
828
|
+
/** Lifecycle status of an event: `Trading` until its settlement time,
|
|
829
|
+
* `Resolved(outcome)` once settled. */
|
|
830
|
+
export type EventStatus = {
|
|
759
831
|
kind: "Trading";
|
|
760
832
|
} | {
|
|
761
833
|
kind: "PreResolution";
|
|
@@ -763,29 +835,6 @@ export type ImpactMarketStatus = {
|
|
|
763
835
|
kind: "Resolved";
|
|
764
836
|
outcome: Outcome;
|
|
765
837
|
};
|
|
766
|
-
/** On-chain info for an impact-market family. */
|
|
767
|
-
export interface ImpactMarketInfo {
|
|
768
|
-
impactMarketId: number;
|
|
769
|
-
underlyingMarket: number;
|
|
770
|
-
cpyMarket: number;
|
|
771
|
-
cpnMarket: number;
|
|
772
|
-
ebyMarket: number;
|
|
773
|
-
ebnMarket: number;
|
|
774
|
-
question: string;
|
|
775
|
-
deadlineMs: bigint;
|
|
776
|
-
resolutionWindowMs: bigint;
|
|
777
|
-
status: ImpactMarketStatus;
|
|
778
|
-
createdMs: bigint;
|
|
779
|
-
resolvedMs: bigint;
|
|
780
|
-
/** BE-54: how the YES/NO outcome is determined at deadline. `undefined`
|
|
781
|
-
* (older gateways / pre-BE-54 records) means `RelayerAttested`. */
|
|
782
|
-
oracleSource?: EventOracleSource;
|
|
783
|
-
/** Event body text; `""` when the record has none. `undefined` only on
|
|
784
|
-
* gateways older than admin-actions v2 (field not served). */
|
|
785
|
-
description?: string;
|
|
786
|
-
/** Resolution criteria text; same shipping note as `description`. */
|
|
787
|
-
rules?: string;
|
|
788
|
-
}
|
|
789
838
|
/** Pick a per-account override on the initial-margin ratio for one
|
|
790
839
|
* market. Engine takes max(market.imBps, userImBps), so users can
|
|
791
840
|
* deleverage but not exceed the market's risk floor. `userImBps == 0`
|
|
@@ -892,6 +941,12 @@ export type TraderAction = {
|
|
|
892
941
|
} | {
|
|
893
942
|
type: "CancelPositionTriggers";
|
|
894
943
|
data: CancelPositionTriggers;
|
|
944
|
+
} | {
|
|
945
|
+
type: "CreateSubAccount";
|
|
946
|
+
data: CreateSubAccount;
|
|
947
|
+
} | {
|
|
948
|
+
type: "SubAccountTransfer";
|
|
949
|
+
data: SubAccountTransfer;
|
|
895
950
|
};
|
|
896
951
|
/**
|
|
897
952
|
* Operator actions — privileged infrastructure submitted by the operator's
|
|
@@ -903,6 +958,9 @@ export type TraderAction = {
|
|
|
903
958
|
* AGENTS.md / README.md.
|
|
904
959
|
*/
|
|
905
960
|
export type OperatorAction = {
|
|
961
|
+
type: "SubmitOracleObservation";
|
|
962
|
+
data: SubmitOracleObservation;
|
|
963
|
+
} | {
|
|
906
964
|
type: "OracleUpdate";
|
|
907
965
|
data: OracleUpdate;
|
|
908
966
|
} | {
|
|
@@ -935,12 +993,12 @@ export type OperatorAction = {
|
|
|
935
993
|
} | {
|
|
936
994
|
type: "AuthorizeWithdrawal";
|
|
937
995
|
data: AuthorizeWithdrawal;
|
|
938
|
-
} | {
|
|
939
|
-
type: "CreateImpactMarket";
|
|
940
|
-
data: CreateImpactMarket;
|
|
941
996
|
} | {
|
|
942
997
|
type: "ResolveEvent";
|
|
943
998
|
data: ResolveEvent;
|
|
999
|
+
} | {
|
|
1000
|
+
type: "ClaimWithdrawalPayout";
|
|
1001
|
+
data: ClaimWithdrawalPayout;
|
|
944
1002
|
} | {
|
|
945
1003
|
type: "UpdateMarketFees";
|
|
946
1004
|
data: UpdateMarketFees;
|
|
@@ -973,8 +1031,8 @@ export type AdminBatchItem = {
|
|
|
973
1031
|
kind: "CreateMarket";
|
|
974
1032
|
value: CreateMarket;
|
|
975
1033
|
} | {
|
|
976
|
-
kind: "
|
|
977
|
-
value:
|
|
1034
|
+
kind: "AttachConditional";
|
|
1035
|
+
value: AttachConditional;
|
|
978
1036
|
};
|
|
979
1037
|
/**
|
|
980
1038
|
* Governance cancel of every resting order one account holds, optionally
|
|
@@ -989,25 +1047,54 @@ export interface CancelAllOrdersForAccount {
|
|
|
989
1047
|
/** Confine the cancel to one market; omit to sweep every market. */
|
|
990
1048
|
market?: number | null;
|
|
991
1049
|
}
|
|
1050
|
+
/** One operator-authority allowlist an `UpdateAuthoritySet` action targets.
|
|
1051
|
+
* Externally tagged on the wire, so the domain arrives as this bare
|
|
1052
|
+
* string, never a numeric discriminant. `Custody`/`MarketParams`/
|
|
1053
|
+
* `ScheduledOps` are the capability-split sets; `Oracle`/`CexComposite`/
|
|
1054
|
+
* `Relayer` are the genesis-seeded presence sets. */
|
|
1055
|
+
export type AuthorityDomain = "Oracle" | "CexComposite" | "Relayer" | "Custody" | "MarketParams" | "ScheduledOps";
|
|
1056
|
+
/**
|
|
1057
|
+
* Governance addition/removal of members in one privileged authorization
|
|
1058
|
+
* set (inner tag `0x07`). `add` and `remove` are each canonically sorted,
|
|
1059
|
+
* duplicate-free, and disjoint; the engine refuses a proposal that would
|
|
1060
|
+
* leave the domain's net set empty.
|
|
1061
|
+
*/
|
|
1062
|
+
export interface UpdateAuthoritySet {
|
|
1063
|
+
domain: AuthorityDomain;
|
|
1064
|
+
/** Addresses to add to the domain (each a 20-byte address). */
|
|
1065
|
+
add: Address[];
|
|
1066
|
+
/** Addresses to remove from the domain (each a 20-byte address). */
|
|
1067
|
+
remove: Address[];
|
|
1068
|
+
}
|
|
992
1069
|
/**
|
|
993
1070
|
* Closed, typed set of operations executable through the multisig. The
|
|
994
|
-
* embedded `CreateMarket.signer` / `
|
|
1071
|
+
* embedded `CreateMarket.signer` / `AttachConditional.signer` must be
|
|
995
1072
|
* zero — governance supplies the authorization, not the embedded address.
|
|
996
1073
|
*
|
|
997
1074
|
* `Batch` executes its items atomically in order against one overlay:
|
|
998
1075
|
* all succeed or the proposal fails with no partial state. Admitted on
|
|
999
|
-
* chain only once admin-actions v2 activates
|
|
1000
|
-
*
|
|
1076
|
+
* chain only once admin-actions v2 activates; `CreateEvent` and
|
|
1077
|
+
* `AttachConditional` ride the standalone-events activation. The engine
|
|
1078
|
+
* refuses every tag below its activation height.
|
|
1001
1079
|
*/
|
|
1002
1080
|
export type AdminAction = {
|
|
1081
|
+
kind: "CancelAllOrdersForAccount";
|
|
1082
|
+
value: CancelAllOrdersForAccount;
|
|
1083
|
+
} | {
|
|
1084
|
+
kind: "ConfigureOraclePolicy";
|
|
1085
|
+
value: ConfigureOraclePolicy;
|
|
1086
|
+
} | {
|
|
1003
1087
|
kind: "CreateMarket";
|
|
1004
1088
|
value: CreateMarket;
|
|
1005
1089
|
} | {
|
|
1006
1090
|
kind: "UpdateAdminSignerRegistry";
|
|
1007
1091
|
value: UpdateAdminSignerRegistry;
|
|
1008
1092
|
} | {
|
|
1009
|
-
kind: "
|
|
1010
|
-
value:
|
|
1093
|
+
kind: "CreateEvent";
|
|
1094
|
+
value: CreateEvent;
|
|
1095
|
+
} | {
|
|
1096
|
+
kind: "AttachConditional";
|
|
1097
|
+
value: AttachConditional;
|
|
1011
1098
|
} | {
|
|
1012
1099
|
kind: "Batch";
|
|
1013
1100
|
value: AdminBatchItem[];
|
|
@@ -1017,9 +1104,27 @@ export type AdminAction = {
|
|
|
1017
1104
|
} | {
|
|
1018
1105
|
kind: "UnpauseBridge";
|
|
1019
1106
|
} | {
|
|
1020
|
-
kind: "
|
|
1021
|
-
value:
|
|
1107
|
+
kind: "UpdateAuthoritySet";
|
|
1108
|
+
value: UpdateAuthoritySet;
|
|
1022
1109
|
};
|
|
1110
|
+
/** Authenticated relay attestation, not a cryptographic provider-proof verifier.
|
|
1111
|
+
* Price and confidence are integers in the policy's normalized micro unit. */
|
|
1112
|
+
export interface SubmitOracleObservation {
|
|
1113
|
+
market: number;
|
|
1114
|
+
policyVersion: bigint;
|
|
1115
|
+
sourceId: number;
|
|
1116
|
+
publishTimeMs: bigint;
|
|
1117
|
+
priceMicro: bigint;
|
|
1118
|
+
confidenceMicro: bigint | null;
|
|
1119
|
+
evidenceDigest: Uint8Array;
|
|
1120
|
+
signer: Address;
|
|
1121
|
+
}
|
|
1122
|
+
/** The complete canonical policy must be independently decoded and reviewed
|
|
1123
|
+
* before signing. A digest alone is not permission to approve opaque bytes. */
|
|
1124
|
+
export interface ConfigureOraclePolicy {
|
|
1125
|
+
effectiveHeight: bigint;
|
|
1126
|
+
bundle: Uint8Array;
|
|
1127
|
+
}
|
|
1023
1128
|
/**
|
|
1024
1129
|
* Closed set of immediate, loss-reducing single-signer actions. Reverse
|
|
1025
1130
|
* transitions (unpause/resume) are intentionally absent — they require a
|
|
@@ -1450,8 +1555,9 @@ export type ExchangeEvent = OrderPlacedEvent | OrderCancelledEvent | TradeExecut
|
|
|
1450
1555
|
* - `"engine"` — the engine rejected it with an `ExecError` (`code` 1..53/255);
|
|
1451
1556
|
* see {@link TxResult.error} for the decoded name/description.
|
|
1452
1557
|
* - `"transport"` — a gateway/HTTP-level failure (auth, rate-limit, body too
|
|
1453
|
-
* large,
|
|
1454
|
-
*
|
|
1558
|
+
* large, or a structured pre-admission refusal at HTTP
|
|
1559
|
+
* 200/503). `code` is synthetic (1 for HTTP 200), not an
|
|
1560
|
+
* engine code. Unrecognized 5xx responses stay `timeout`.
|
|
1455
1561
|
* - `"timeout"` — no final chain verdict is available yet (`code === -1`):
|
|
1456
1562
|
* either the gateway returned a hash-only ambiguous response
|
|
1457
1563
|
* or inclusion polling expired. The tx may still land.
|
|
@@ -1488,6 +1594,8 @@ export interface TxResult {
|
|
|
1488
1594
|
height?: number;
|
|
1489
1595
|
/** Human-readable log message (populated on error). */
|
|
1490
1596
|
log?: string;
|
|
1597
|
+
/** Optional ABCI diagnostic info, preserved without interpretation. */
|
|
1598
|
+
info?: string;
|
|
1491
1599
|
/** ABCI events emitted by the transaction. */
|
|
1492
1600
|
events?: TxEvent[];
|
|
1493
1601
|
}
|
|
@@ -1836,40 +1944,33 @@ export interface PositionInfo {
|
|
|
1836
1944
|
* trigger placement rather than guess `1`. */
|
|
1837
1945
|
positionEpoch?: bigint;
|
|
1838
1946
|
}
|
|
1839
|
-
/** One entry per active
|
|
1840
|
-
* (
|
|
1841
|
-
* ascending by
|
|
1947
|
+
/** One entry per active event the account touches through a conditional.
|
|
1948
|
+
* Tuple of (eventId, branch) where branch is "Yes" or "No". Ordering is
|
|
1949
|
+
* ascending by eventId (deterministic across nodes).
|
|
1842
1950
|
*
|
|
1843
1951
|
* See AccountInfo.bindingScenario for semantics. */
|
|
1844
1952
|
export interface BindingScenarioEntry {
|
|
1845
|
-
|
|
1953
|
+
eventId: number;
|
|
1846
1954
|
branch: "Yes" | "No";
|
|
1847
1955
|
}
|
|
1848
|
-
/** One
|
|
1849
|
-
*
|
|
1850
|
-
* "equity over time" reconstruction (Jesse's P2 #6).
|
|
1851
|
-
*
|
|
1852
|
-
* Returned by `GET /v1/history/deposits/{address}` and `GET
|
|
1853
|
-
* /v1/history/withdrawals/{address}`, and by the `historyDeposits` /
|
|
1854
|
-
* `historyWithdrawals` InfoRequests. Shipped 2026-04-24. */
|
|
1956
|
+
/** One deposit/withdrawal event from owner- and event-filtered
|
|
1957
|
+
* `/v1/history/account-events` pages. */
|
|
1855
1958
|
export interface HistoryCashFlow {
|
|
1856
|
-
/**
|
|
1857
|
-
kind: "deposit_confirmed" | "withdraw_requested" | "withdrawal_confirmed" | "withdrawal_failed";
|
|
1959
|
+
/** Original engine event kind, including direct relayer credits/debits. */
|
|
1960
|
+
kind: "deposited" | "withdrawn" | "deposit_confirmed" | "withdraw_requested" | "withdrawal_confirmed" | "withdrawal_failed";
|
|
1858
1961
|
/** 20-byte owner address as hex. */
|
|
1859
1962
|
owner: string;
|
|
1860
|
-
/**
|
|
1861
|
-
*
|
|
1862
|
-
*
|
|
1963
|
+
/** Principal amount in micro-USDC. Custody requests/refunds omit fees.
|
|
1964
|
+
* Empty on owner-scoped confirmations from compatible deployments; the
|
|
1965
|
+
* current indexer omits ownerless withdrawal_confirmed events entirely. */
|
|
1863
1966
|
amount: string;
|
|
1864
|
-
/**
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
1867
|
-
* "0" for withdrawal_confirmed (no change) */
|
|
1967
|
+
/** Exact event balance delta: deposit amount, negated direct withdrawal
|
|
1968
|
+
* amount, or "0" on confirmation. Empty on withdrawal request/failure:
|
|
1969
|
+
* their payloads omit the custody fee included in the actual debit/refund. */
|
|
1868
1970
|
signedDelta: string;
|
|
1869
|
-
/** Post-event balance
|
|
1870
|
-
* empty for confirmed (no balance change on that event). */
|
|
1971
|
+
/** Post-event balance when emitted; empty when absent from the event. */
|
|
1871
1972
|
newBalance: string;
|
|
1872
|
-
/** Present on withdrawal events (request, confirmed, failed). */
|
|
1973
|
+
/** Present on custody withdrawal events (request, confirmed, failed). */
|
|
1873
1974
|
withdrawalId: string;
|
|
1874
1975
|
/** Present on deposit_confirmed + withdrawal_confirmed. */
|
|
1875
1976
|
solanaTxSig: string;
|
|
@@ -1892,8 +1993,8 @@ export interface HistoryCashFlow {
|
|
|
1892
1993
|
export interface HistoryResolution {
|
|
1893
1994
|
/** One of "conditional_settled" | "conditional_voided" | "prediction_settled". */
|
|
1894
1995
|
kind: "conditional_settled" | "conditional_voided" | "prediction_settled";
|
|
1895
|
-
/**
|
|
1896
|
-
|
|
1996
|
+
/** Event the resolved position belonged to, as a decimal string. */
|
|
1997
|
+
eventId: string;
|
|
1897
1998
|
/** Child market ID (CPY/CPN or EBY/EBN). */
|
|
1898
1999
|
market: string;
|
|
1899
2000
|
/** 20-byte owner address as hex. */
|
|
@@ -1915,24 +2016,19 @@ export interface HistoryResolution {
|
|
|
1915
2016
|
/** Unix milliseconds. */
|
|
1916
2017
|
timestamp: number;
|
|
1917
2018
|
}
|
|
1918
|
-
/**
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
*
|
|
1922
|
-
* non-zero snapshot for the same `(owner, market, side)` carries the
|
|
1923
|
-
* weighted-average entry price.
|
|
1924
|
-
*
|
|
1925
|
-
* Returned by `GET /v1/history/positions/{address}` and the
|
|
1926
|
-
* `historyPositions` InfoRequest. The HTTP endpoint accepts optional
|
|
1927
|
-
* `?market=&from=&to=&limit=` filters; results are newest-first. */
|
|
2019
|
+
/** Compatibility row from queryHistoryPositions(). A zero size is a closed
|
|
2020
|
+
* position; absent side/entry price become empty strings and block time is
|
|
2021
|
+
* projected to milliseconds. Use queryHistoryPositionsPage() for exact times,
|
|
2022
|
+
* nullable fields and pagination. */
|
|
1928
2023
|
export interface HistoryPositionSnapshot {
|
|
1929
2024
|
/** 20-byte owner address as hex. */
|
|
1930
2025
|
owner: string;
|
|
1931
2026
|
/** Market ID as a decimal string. */
|
|
1932
2027
|
market: string;
|
|
1933
|
-
/** Position side
|
|
2028
|
+
/** Position side as served; empty when a closed position has no side.
|
|
2029
|
+
* Use HistoryPosition for the nullable representation. */
|
|
1934
2030
|
side: string;
|
|
1935
|
-
/**
|
|
2031
|
+
/** Entry price in micro-USDC, or empty when absent on a close. */
|
|
1936
2032
|
entryPrice: string;
|
|
1937
2033
|
/** Absolute position size in contracts. "0" = closed. */
|
|
1938
2034
|
size: string;
|
|
@@ -1941,6 +2037,24 @@ export interface HistoryPositionSnapshot {
|
|
|
1941
2037
|
/** Unix milliseconds. */
|
|
1942
2038
|
timestamp: number;
|
|
1943
2039
|
}
|
|
2040
|
+
/** Indexer position snapshot with exact timestamp and absent close fields retained. */
|
|
2041
|
+
export interface HistoryPosition {
|
|
2042
|
+
owner: string;
|
|
2043
|
+
market: number;
|
|
2044
|
+
side: string | null;
|
|
2045
|
+
/** Micro-USDC decimal text; null when the closed position has no entry price. */
|
|
2046
|
+
entryPrice: string | null;
|
|
2047
|
+
/** Integer contracts as decimal text; zero denotes a closed position. */
|
|
2048
|
+
size: string;
|
|
2049
|
+
blockHeight: number;
|
|
2050
|
+
/** RFC 3339 timestamp, retaining the indexer's fractional-second precision. */
|
|
2051
|
+
blockTime: string;
|
|
2052
|
+
}
|
|
2053
|
+
/** One newest-first page. An empty nextCursor means there are no further rows. */
|
|
2054
|
+
export interface HistoryPositionsPage {
|
|
2055
|
+
positions: HistoryPosition[];
|
|
2056
|
+
nextCursor: string;
|
|
2057
|
+
}
|
|
1944
2058
|
/** One executed fill from `/v1/history/fills/{owner}` (or `/v1/fills`). */
|
|
1945
2059
|
export interface HistoryFill {
|
|
1946
2060
|
/** Unsigned 64-bit fill identifier as a decimal string. NOTE: the indexer
|
|
@@ -1988,7 +2102,7 @@ export interface AccountInfo {
|
|
|
1988
2102
|
/** [5] Margin ratio in basis points (equity / total notional * 10000). */
|
|
1989
2103
|
marginRatioBps: bigint;
|
|
1990
2104
|
/** [6] Resolution scenario that maximizes totalMm — the "binding" outcome.
|
|
1991
|
-
* One entry per active
|
|
2105
|
+
* One entry per active event, ascending by eventId.
|
|
1992
2106
|
* Empty for perp-only accounts. Undefined on responses from gateways
|
|
1993
2107
|
* older than 2026-04-24 (backward compat — the SDK decoder reads
|
|
1994
2108
|
* msgpack arrays by index). See Jesse's P1 #3 in docs/api-scope.md. */
|
|
@@ -2006,8 +2120,8 @@ export interface AccountInfo {
|
|
|
2006
2120
|
}
|
|
2007
2121
|
/** Market kind discriminator. Wire shape mirrors the Rust `MarketKind`
|
|
2008
2122
|
* enum exactly: `"Perp"` is a bare string, the parameterised variants
|
|
2009
|
-
* are `{ ConditionalPerp: [
|
|
2010
|
-
* `{ PredictionBinary: [
|
|
2123
|
+
* are `{ ConditionalPerp: [eventId, branch] }` /
|
|
2124
|
+
* `{ PredictionBinary: [eventId, branch] }` — both keyed by the event. */
|
|
2011
2125
|
export type MarketKind = "Perp" | {
|
|
2012
2126
|
ConditionalPerp: [number, "Yes" | "No"];
|
|
2013
2127
|
} | {
|
|
@@ -2020,6 +2134,13 @@ export type MarkSourceMode = "OracleOnly" | "Median";
|
|
|
2020
2134
|
* field order in exchange-core/src/types.rs.
|
|
2021
2135
|
* Fields after index 7 use `#[serde(default)]` so older on-chain records
|
|
2022
2136
|
* decode cleanly. */
|
|
2137
|
+
export interface MarketsSnapshot {
|
|
2138
|
+
chainId: Uint8Array;
|
|
2139
|
+
height: bigint;
|
|
2140
|
+
markets: MarketConfig[];
|
|
2141
|
+
/** Every event with its binaries and attached conditionals. */
|
|
2142
|
+
events: EventInfo[];
|
|
2143
|
+
}
|
|
2023
2144
|
export interface MarketConfig {
|
|
2024
2145
|
/** [0] Market identifier (unique integer). */
|
|
2025
2146
|
market: number;
|