@proof-labs/trading-sdk 10.1.0 → 11.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/dist/abci-event.d.ts +33 -0
- package/dist/abci-event.d.ts.map +1 -0
- package/dist/abci-event.js +93 -0
- package/dist/abci-event.js.map +1 -0
- package/dist/codec-adapter.d.ts.map +1 -1
- package/dist/codec-adapter.js +19 -2
- package/dist/codec-adapter.js.map +1 -1
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -1
- package/dist/governance-query.d.ts.map +1 -1
- package/dist/governance-query.js +3 -0
- package/dist/governance-query.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/liquidation-events.d.ts +4 -7
- package/dist/liquidation-events.d.ts.map +1 -1
- package/dist/liquidation-events.js +10 -95
- package/dist/liquidation-events.js.map +1 -1
- package/dist/types.d.ts +71 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/dist/void-events.d.ts +34 -0
- package/dist/void-events.d.ts.map +1 -0
- package/dist/void-events.js +41 -0
- package/dist/void-events.js.map +1 -0
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed decoders for the engine's Void events, from the string attributes of
|
|
3
|
+
* one ABCI event, with the conventions of `decodeLiquidationEvent`.
|
|
4
|
+
*/
|
|
5
|
+
import { type AbciEventInput } from "./abci-event.js";
|
|
6
|
+
/** The admin quorum voided an event at `yesPrice`. */
|
|
7
|
+
export interface EventVoidedEvent {
|
|
8
|
+
type: "EventVoided";
|
|
9
|
+
eventId: number;
|
|
10
|
+
/** Micro-USDC per share, `0..=1_000_000`. */
|
|
11
|
+
yesPrice: bigint;
|
|
12
|
+
timestampMs: bigint;
|
|
13
|
+
proposalId: bigint;
|
|
14
|
+
}
|
|
15
|
+
/** A conditional position settled in cash on Void: its payoff at
|
|
16
|
+
* `settlementPrice`, weighted by `branchWeight` per `1_000_000`. */
|
|
17
|
+
export interface ConditionalVoidSettledEvent {
|
|
18
|
+
type: "ConditionalVoidSettled";
|
|
19
|
+
eventId: number;
|
|
20
|
+
market: number;
|
|
21
|
+
owner: string;
|
|
22
|
+
side: "buy" | "sell";
|
|
23
|
+
size: bigint;
|
|
24
|
+
entryPrice: bigint;
|
|
25
|
+
settlementPrice: bigint;
|
|
26
|
+
branchWeight: bigint;
|
|
27
|
+
/** Signed. */
|
|
28
|
+
realizedPnl: bigint;
|
|
29
|
+
}
|
|
30
|
+
export type VoidSettlementEvent = EventVoidedEvent | ConditionalVoidSettledEvent;
|
|
31
|
+
/** Decode `event_voided` or `conditional_void_settled`; `null` for any
|
|
32
|
+
* other event type. */
|
|
33
|
+
export declare function decodeVoidSettlementEvent(event: AbciEventInput): VoidSettlementEvent | null;
|
|
34
|
+
//# sourceMappingURL=void-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"void-events.d.ts","sourceRoot":"","sources":["../src/void-events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAElE,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;qEACqE;AACrE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,mBAAmB,GAC7B,gBAAgB,GAAG,2BAA2B,CAAC;AAgCjD;wBACwB;AACxB,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,cAAc,GACpB,mBAAmB,GAAG,IAAI,CAK5B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed decoders for the engine's Void events, from the string attributes of
|
|
3
|
+
* one ABCI event, with the conventions of `decodeLiquidationEvent`.
|
|
4
|
+
*/
|
|
5
|
+
import { Attributes } from "./abci-event.js";
|
|
6
|
+
function eventVoided(a) {
|
|
7
|
+
return {
|
|
8
|
+
type: "EventVoided",
|
|
9
|
+
eventId: a.u32("event_id"),
|
|
10
|
+
yesPrice: a.u64("yes_price"),
|
|
11
|
+
timestampMs: a.u64("timestamp_ms"),
|
|
12
|
+
proposalId: a.u64("proposal_id"),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function conditionalVoidSettled(a) {
|
|
16
|
+
return {
|
|
17
|
+
type: "ConditionalVoidSettled",
|
|
18
|
+
eventId: a.u32("event_id"),
|
|
19
|
+
market: a.u32("market"),
|
|
20
|
+
owner: a.owner("owner"),
|
|
21
|
+
side: a.oneOf("side", ["buy", "sell"]),
|
|
22
|
+
size: a.u64("size"),
|
|
23
|
+
entryPrice: a.u64("entry_price"),
|
|
24
|
+
settlementPrice: a.u64("settlement_price"),
|
|
25
|
+
branchWeight: a.u64("branch_weight"),
|
|
26
|
+
realizedPnl: a.i64("realized_pnl"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const DECODERS = {
|
|
30
|
+
event_voided: eventVoided,
|
|
31
|
+
conditional_void_settled: conditionalVoidSettled,
|
|
32
|
+
};
|
|
33
|
+
/** Decode `event_voided` or `conditional_void_settled`; `null` for any
|
|
34
|
+
* other event type. */
|
|
35
|
+
export function decodeVoidSettlementEvent(event) {
|
|
36
|
+
const decode = Object.hasOwn(DECODERS, event.type)
|
|
37
|
+
? DECODERS[event.type]
|
|
38
|
+
: undefined;
|
|
39
|
+
return decode ? decode(new Attributes(event.type, event.attributes)) : null;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=void-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"void-events.js","sourceRoot":"","sources":["../src/void-events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AA+BlE,SAAS,WAAW,CAAC,CAAa;IAChC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;QAC1B,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC;QAC5B,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC;QAClC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC;KACjC,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,CAAa;IAC3C,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;QAC1B,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACvB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;QAC/C,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,CAAC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