@proof-labs/trading-sdk 4.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/LICENSE +201 -0
- package/README.md +391 -0
- package/dist/client.d.ts +640 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1730 -0
- package/dist/client.js.map +1 -0
- package/dist/codec-adapter.d.ts +33 -0
- package/dist/codec-adapter.d.ts.map +1 -0
- package/dist/codec-adapter.js +419 -0
- package/dist/codec-adapter.js.map +1 -0
- package/dist/codec.d.ts +137 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +229 -0
- package/dist/codec.js.map +1 -0
- package/dist/crypto.d.ts +78 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +145 -0
- package/dist/crypto.js.map +1 -0
- package/dist/errors.d.ts +122 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +397 -0
- package/dist/errors.js.map +1 -0
- package/dist/governance-query.d.ts +47 -0
- package/dist/governance-query.d.ts.map +1 -0
- package/dist/governance-query.js +525 -0
- package/dist/governance-query.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/testing.d.ts +25 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +22 -0
- package/dist/testing.js.map +1 -0
- package/dist/trigger-history.d.ts +9 -0
- package/dist/trigger-history.d.ts.map +1 -0
- package/dist/trigger-history.js +442 -0
- package/dist/trigger-history.js.map +1 -0
- package/dist/triggers.d.ts +15 -0
- package/dist/triggers.d.ts.map +1 -0
- package/dist/triggers.js +399 -0
- package/dist/triggers.js.map +1 -0
- package/dist/tx-result.d.ts +53 -0
- package/dist/tx-result.d.ts.map +1 -0
- package/dist/tx-result.js +58 -0
- package/dist/tx-result.js.map +1 -0
- package/dist/types.d.ts +2085 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +121 -0
- package/dist/types.js.map +1 -0
- package/dist/wasm/proof_trading_sdk_wasm.d.ts +98 -0
- package/dist/wasm/proof_trading_sdk_wasm.js +698 -0
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm.d.ts +19 -0
- package/dist/wasm-loader.d.ts +42 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.js +95 -0
- package/dist/wasm-loader.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { Outcome } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Typed decoders for the engine's governance READ model — the responses
|
|
4
|
+
* behind `GET /v1/admin/signer-registry`, `GET /v1/proposals`, and
|
|
5
|
+
* `GET /v1/impact_markets`.
|
|
6
|
+
*
|
|
7
|
+
* These mirror engine structs (`exchange-core/src/query.rs`), they do not
|
|
8
|
+
* define them. The engine serializes with `rmp_serde::to_vec` — the COMPACT
|
|
9
|
+
* form — so every struct is a positional array and field ORDER is the wire
|
|
10
|
+
* contract. A decoder that transposes two fields is silently wrong, never
|
|
11
|
+
* loudly wrong, which is why `governance-query.test.ts` pins every function
|
|
12
|
+
* here against golden bytes harvested from the engine's own serializer
|
|
13
|
+
* rather than against hand-written expectations.
|
|
14
|
+
*
|
|
15
|
+
* Four encoding facts these decoders depend on, each confirmed from real
|
|
16
|
+
* engine bytes (not inferred from the struct definitions):
|
|
17
|
+
*
|
|
18
|
+
* 1. `[u8; N]` and `Vec<u8>` serialize as msgpack ARRAYS OF INTEGERS, not
|
|
19
|
+
* as msgpack `bin`. Addresses and hashes therefore arrive as `number[]`
|
|
20
|
+
* and must be rebuilt into `Uint8Array`.
|
|
21
|
+
* 2. A unit enum variant is a bare STRING (`"Pending"`).
|
|
22
|
+
* 3. A struct or newtype enum variant is a single-entry MAP keyed by the
|
|
23
|
+
* variant name (`{ Failed: [4001] }`, `{ CreateMarket: [...] }`); a
|
|
24
|
+
* struct variant's payload is itself a positional array.
|
|
25
|
+
* 4. `Option<T>` is transparent: `None` is nil, `Some(x)` is `x` with no
|
|
26
|
+
* wrapper.
|
|
27
|
+
*
|
|
28
|
+
* Integer widths are decoder-visible: msgpack encodes by MAGNITUDE, so a u64
|
|
29
|
+
* field holding a small value arrives as `number` while a large one arrives
|
|
30
|
+
* as `bigint` (the client decodes with `useBigInt64`). Every u64 is
|
|
31
|
+
* normalized to `bigint` here so a field's TypeScript type never depends on
|
|
32
|
+
* how big its value happened to be — the same normalization the client
|
|
33
|
+
* already applies to `nextCursor`.
|
|
34
|
+
*/
|
|
35
|
+
const U8_MAX = 0xff;
|
|
36
|
+
const U32_MAX = 0xffff_ffff;
|
|
37
|
+
const U64_MAX = (1n << 64n) - 1n;
|
|
38
|
+
function toUnsignedBigInt(value, field, max = U64_MAX) {
|
|
39
|
+
let decoded;
|
|
40
|
+
if (typeof value === "bigint") {
|
|
41
|
+
decoded = value;
|
|
42
|
+
}
|
|
43
|
+
else if (typeof value === "number" && Number.isSafeInteger(value)) {
|
|
44
|
+
decoded = BigInt(value);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new Error(`governance decode: ${field} is not a safe unsigned integer`);
|
|
48
|
+
}
|
|
49
|
+
if (decoded < 0n || decoded > max) {
|
|
50
|
+
throw new Error(`governance decode: ${field} is outside the unsigned integer range 0-${max}`);
|
|
51
|
+
}
|
|
52
|
+
return decoded;
|
|
53
|
+
}
|
|
54
|
+
function toUnsignedNumber(value, field, max) {
|
|
55
|
+
return Number(toUnsignedBigInt(value, field, BigInt(max)));
|
|
56
|
+
}
|
|
57
|
+
const toU8 = (value, field) => toUnsignedNumber(value, field, U8_MAX);
|
|
58
|
+
const toU32 = (value, field) => toUnsignedNumber(value, field, U32_MAX);
|
|
59
|
+
const toU64 = (value, field) => toUnsignedBigInt(value, field);
|
|
60
|
+
/** A 20-byte governance address. */
|
|
61
|
+
const ADDRESS_LEN = 20;
|
|
62
|
+
/** A 32-byte domain-separated commitment. */
|
|
63
|
+
const HASH_LEN = 32;
|
|
64
|
+
/**
|
|
65
|
+
* Rebuild a byte field. See encoding fact 1: these arrive as `number[]`, but
|
|
66
|
+
* a `Uint8Array` is tolerated so a future encoder switch to msgpack `bin`
|
|
67
|
+
* does not break every caller.
|
|
68
|
+
*
|
|
69
|
+
* Validated rather than coerced, and `expectedLen` is mandatory for the
|
|
70
|
+
* fixed-width fields. `Uint8Array.from` is lossy in exactly the way that
|
|
71
|
+
* matters here: it truncates out-of-range values modulo 256 and turns
|
|
72
|
+
* non-numbers into 0, so `[300, -1, "x"]` would silently become a
|
|
73
|
+
* well-formed-looking `[44, 255, 0]`. On this path the byte fields ARE the
|
|
74
|
+
* identities and the commitments a signer approves against — a corrupted
|
|
75
|
+
* address that still renders as a plausible address is worse than a refusal,
|
|
76
|
+
* so a malformed field fails closed here instead of reaching a caller.
|
|
77
|
+
* The engine's own newtypes are fixed-width (`SignerAddress([u8; 20])`);
|
|
78
|
+
* this keeps the mirror as strict as the thing it mirrors.
|
|
79
|
+
*/
|
|
80
|
+
function toBytes(value, field, expectedLen) {
|
|
81
|
+
let bytes;
|
|
82
|
+
if (value instanceof Uint8Array) {
|
|
83
|
+
bytes = value;
|
|
84
|
+
}
|
|
85
|
+
else if (Array.isArray(value)) {
|
|
86
|
+
for (let i = 0; i < value.length; i++) {
|
|
87
|
+
const b = value[i];
|
|
88
|
+
if (typeof b !== "number" || !Number.isInteger(b) || b < 0 || b > 255) {
|
|
89
|
+
throw new Error(`governance decode: ${field}[${i}] is not a byte (0-255 integer)`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
bytes = Uint8Array.from(value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
throw new Error(`governance decode: ${field} is not a byte sequence`);
|
|
96
|
+
}
|
|
97
|
+
if (expectedLen != null && bytes.length !== expectedLen) {
|
|
98
|
+
throw new Error(`governance decode: ${field} is ${bytes.length} bytes, expected ${expectedLen}`);
|
|
99
|
+
}
|
|
100
|
+
return bytes;
|
|
101
|
+
}
|
|
102
|
+
function toArray(value, field) {
|
|
103
|
+
if (Array.isArray(value))
|
|
104
|
+
return value;
|
|
105
|
+
throw new Error(`governance decode: ${field} is not an array`);
|
|
106
|
+
}
|
|
107
|
+
function toTuple(value, field, expectedLength) {
|
|
108
|
+
const fields = toArray(value, field);
|
|
109
|
+
if (fields.length !== expectedLength) {
|
|
110
|
+
throw new Error(`governance decode: ${field} has ${fields.length} fields, expected exactly ${expectedLength}`);
|
|
111
|
+
}
|
|
112
|
+
return fields;
|
|
113
|
+
}
|
|
114
|
+
function toString(value, field) {
|
|
115
|
+
if (typeof value === "string")
|
|
116
|
+
return value;
|
|
117
|
+
throw new Error(`governance decode: ${field} is not a string`);
|
|
118
|
+
}
|
|
119
|
+
/** The single entry of an externally-tagged enum map (encoding fact 3). */
|
|
120
|
+
function variantOf(value, field) {
|
|
121
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
122
|
+
throw new Error(`governance decode: ${field} is not an enum variant`);
|
|
123
|
+
}
|
|
124
|
+
const entries = Object.entries(value);
|
|
125
|
+
if (entries.length !== 1) {
|
|
126
|
+
throw new Error(`governance decode: ${field} has ${entries.length} variant keys, expected exactly 1`);
|
|
127
|
+
}
|
|
128
|
+
const [name, payload] = entries[0];
|
|
129
|
+
return { name, payload };
|
|
130
|
+
}
|
|
131
|
+
/** `CreateMarket` as the engine's 12-field positional payload. Distinct from
|
|
132
|
+
* `decodeMarketConfig` in client.ts: that decodes the STORED market config,
|
|
133
|
+
* this decodes the proposed action. */
|
|
134
|
+
function decodeCreateMarket(value) {
|
|
135
|
+
const raw = toTuple(value, "createMarket", 12);
|
|
136
|
+
return {
|
|
137
|
+
market: toU32(raw[0], "createMarket.market"),
|
|
138
|
+
imBps: toU32(raw[1], "createMarket.imBps"),
|
|
139
|
+
mmBps: toU32(raw[2], "createMarket.mmBps"),
|
|
140
|
+
takerFeeBps: toU32(raw[3], "createMarket.takerFeeBps"),
|
|
141
|
+
makerFeeBps: toU32(raw[4], "createMarket.makerFeeBps"),
|
|
142
|
+
signer: toBytes(raw[5], "createMarket.signer", ADDRESS_LEN),
|
|
143
|
+
fundingIntervalMs: toU64(raw[6], "createMarket.fundingIntervalMs"),
|
|
144
|
+
maxFundingRateBps: toU32(raw[7], "createMarket.maxFundingRateBps"),
|
|
145
|
+
poolId: toU8(raw[8], "createMarket.poolId"),
|
|
146
|
+
szDecimals: toU8(raw[9], "createMarket.szDecimals"),
|
|
147
|
+
ticker: toString(raw[10], "createMarket.ticker"),
|
|
148
|
+
maxOpenInterest: toU64(raw[11], "createMarket.maxOpenInterest"),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function toTupleBetween(value, field, minLength, maxLength) {
|
|
152
|
+
const fields = toArray(value, field);
|
|
153
|
+
if (fields.length < minLength || fields.length > maxLength) {
|
|
154
|
+
throw new Error(`governance decode: ${field} has ${fields.length} fields, expected ` +
|
|
155
|
+
`${minLength}-${maxLength}`);
|
|
156
|
+
}
|
|
157
|
+
return fields;
|
|
158
|
+
}
|
|
159
|
+
const PRICE_COMPARISONS = [
|
|
160
|
+
"GreaterThan",
|
|
161
|
+
"LessThan",
|
|
162
|
+
"GreaterThanOrEqual",
|
|
163
|
+
"LessThanOrEqual",
|
|
164
|
+
];
|
|
165
|
+
function toPriceComparison(value, field) {
|
|
166
|
+
if (typeof value === "string" &&
|
|
167
|
+
PRICE_COMPARISONS.includes(value)) {
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
throw new Error(`governance decode: ${field} is not a known PriceComparison`);
|
|
171
|
+
}
|
|
172
|
+
/** `Option<EventOracleSource>`: `None` is nil (fact 4), the unit variant is a
|
|
173
|
+
* bare string (fact 2), the struct variants are single-entry maps with
|
|
174
|
+
* positional payloads (fact 3). Fails closed on an unknown variant — a
|
|
175
|
+
* resolution mode this build cannot name must never render as one it can.
|
|
176
|
+
* Exported for the client's impact-market read, which carries the same
|
|
177
|
+
* enum in the same compact-rmp form. */
|
|
178
|
+
export function decodeOracleSource(value, field) {
|
|
179
|
+
if (value === null || value === undefined)
|
|
180
|
+
return undefined;
|
|
181
|
+
if (value === "RelayerAttested")
|
|
182
|
+
return { kind: "RelayerAttested" };
|
|
183
|
+
const { name, payload } = variantOf(value, field);
|
|
184
|
+
switch (name) {
|
|
185
|
+
case "UnderlyingPriceVsStrike": {
|
|
186
|
+
const raw = toTuple(payload, field, 2);
|
|
187
|
+
return {
|
|
188
|
+
kind: "UnderlyingPriceVsStrike",
|
|
189
|
+
strikePrice: toU64(raw[0], `${field}.strikePrice`),
|
|
190
|
+
comparison: toPriceComparison(raw[1], `${field}.comparison`),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
case "MarketOracle": {
|
|
194
|
+
const raw = toTuple(payload, field, 3);
|
|
195
|
+
return {
|
|
196
|
+
kind: "MarketOracle",
|
|
197
|
+
market: toU32(raw[0], `${field}.market`),
|
|
198
|
+
strikePrice: toU64(raw[1], `${field}.strikePrice`),
|
|
199
|
+
comparison: toPriceComparison(raw[2], `${field}.comparison`),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
default:
|
|
203
|
+
throw new Error(`governance decode: ${field} has unknown EventOracleSource variant "${name}"`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const OUTCOMES = {
|
|
207
|
+
Yes: Outcome.Yes,
|
|
208
|
+
No: Outcome.No,
|
|
209
|
+
Void: Outcome.Void,
|
|
210
|
+
};
|
|
211
|
+
/** Impact-market lifecycle status: unit variants are bare strings (fact 2);
|
|
212
|
+
* `Resolved(Outcome)` is a single-entry map whose newtype payload is the
|
|
213
|
+
* outcome's variant name — a bare string, no array wrapper (confirmed from
|
|
214
|
+
* engine bytes, not inferred). Fails closed: a status or outcome this build
|
|
215
|
+
* cannot name must never render as one it can — these drive settle/void
|
|
216
|
+
* displays. */
|
|
217
|
+
function decodeImpactStatus(value, field) {
|
|
218
|
+
if (value === "Trading")
|
|
219
|
+
return { kind: "Trading" };
|
|
220
|
+
if (value === "PreResolution")
|
|
221
|
+
return { kind: "PreResolution" };
|
|
222
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
223
|
+
const { name, payload } = variantOf(value, field);
|
|
224
|
+
if (name !== "Resolved") {
|
|
225
|
+
throw new Error(`governance decode: ${field} has unknown ImpactMarketStatus variant "${name}"`);
|
|
226
|
+
}
|
|
227
|
+
const outcome = typeof payload === "string" ? OUTCOMES[payload] : undefined;
|
|
228
|
+
if (outcome === undefined) {
|
|
229
|
+
throw new Error(`governance decode: ${field} has unknown Outcome ${JSON.stringify(payload)}`);
|
|
230
|
+
}
|
|
231
|
+
return { kind: "Resolved", outcome };
|
|
232
|
+
}
|
|
233
|
+
throw new Error(`governance decode: ${field} is not a known ImpactMarketStatus`);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* One `ImpactMarketDisplayInfo` row from `GET /v1/impact_markets` /
|
|
237
|
+
* `/v1/impact_market/{id}` (exchange-core/src/query.rs), as the engine's
|
|
238
|
+
* positional array: 12 required slots, plus trailers shipped incrementally —
|
|
239
|
+
* [12] `oracleSource` (BE-54), [13] `description` and [14] `rules`
|
|
240
|
+
* (admin-actions v2). Older gateways serve shorter tuples; missing trailers
|
|
241
|
+
* stay `undefined` so callers can tell "not served" from "empty". Anything
|
|
242
|
+
* outside the supported 12–15 shapes — including trailing fields — is a
|
|
243
|
+
* refusal, same fail-closed posture as every decoder in this file.
|
|
244
|
+
*/
|
|
245
|
+
export function decodeImpactMarketInfo(value, index) {
|
|
246
|
+
const f = index == null ? "impactMarket" : `impactMarket[${index}]`;
|
|
247
|
+
const raw = toTupleBetween(value, f, 12, 15);
|
|
248
|
+
const info = {
|
|
249
|
+
impactMarketId: toU32(raw[0], `${f}.impactMarketId`),
|
|
250
|
+
underlyingMarket: toU32(raw[1], `${f}.underlyingMarket`),
|
|
251
|
+
cpyMarket: toU32(raw[2], `${f}.cpyMarket`),
|
|
252
|
+
cpnMarket: toU32(raw[3], `${f}.cpnMarket`),
|
|
253
|
+
ebyMarket: toU32(raw[4], `${f}.ebyMarket`),
|
|
254
|
+
ebnMarket: toU32(raw[5], `${f}.ebnMarket`),
|
|
255
|
+
question: toString(raw[6], `${f}.question`),
|
|
256
|
+
deadlineMs: toU64(raw[7], `${f}.deadlineMs`),
|
|
257
|
+
resolutionWindowMs: toU64(raw[8], `${f}.resolutionWindowMs`),
|
|
258
|
+
status: decodeImpactStatus(raw[9], `${f}.status`),
|
|
259
|
+
createdMs: toU64(raw[10], `${f}.createdMs`),
|
|
260
|
+
resolvedMs: toU64(raw[11], `${f}.resolvedMs`),
|
|
261
|
+
};
|
|
262
|
+
if (raw.length > 12) {
|
|
263
|
+
const oracleSource = decodeOracleSource(raw[12], `${f}.oracleSource`);
|
|
264
|
+
if (oracleSource)
|
|
265
|
+
info.oracleSource = oracleSource;
|
|
266
|
+
}
|
|
267
|
+
if (raw.length > 13)
|
|
268
|
+
info.description = toString(raw[13], `${f}.description`);
|
|
269
|
+
if (raw.length > 14)
|
|
270
|
+
info.rules = toString(raw[14], `${f}.rules`);
|
|
271
|
+
return info;
|
|
272
|
+
}
|
|
273
|
+
/** `CreateImpactMarket` as the engine's positional payload: 13 required
|
|
274
|
+
* fields plus three `serde(default)` trailers (oracleSource, description,
|
|
275
|
+
* rules). The engine's decoder tolerates the trailers' absence, so this
|
|
276
|
+
* mirror does too — same tolerance, same defaults. */
|
|
277
|
+
function decodeCreateImpactMarket(value) {
|
|
278
|
+
const f = "createImpactMarket";
|
|
279
|
+
const raw = toTupleBetween(value, f, 13, 16);
|
|
280
|
+
const decoded = {
|
|
281
|
+
impactMarketId: toU32(raw[0], `${f}.impactMarketId`),
|
|
282
|
+
underlyingMarket: toU32(raw[1], `${f}.underlyingMarket`),
|
|
283
|
+
childMarketBase: toU32(raw[2], `${f}.childMarketBase`),
|
|
284
|
+
question: toString(raw[3], `${f}.question`),
|
|
285
|
+
deadlineMs: toU64(raw[4], `${f}.deadlineMs`),
|
|
286
|
+
resolutionWindowMs: toU64(raw[5], `${f}.resolutionWindowMs`),
|
|
287
|
+
imBps: toU32(raw[6], `${f}.imBps`),
|
|
288
|
+
mmBps: toU32(raw[7], `${f}.mmBps`),
|
|
289
|
+
takerFeeBps: toU32(raw[8], `${f}.takerFeeBps`),
|
|
290
|
+
makerFeeBps: toU32(raw[9], `${f}.makerFeeBps`),
|
|
291
|
+
fundingIntervalMs: toU64(raw[10], `${f}.fundingIntervalMs`),
|
|
292
|
+
maxFundingRateBps: toU32(raw[11], `${f}.maxFundingRateBps`),
|
|
293
|
+
signer: toBytes(raw[12], `${f}.signer`, ADDRESS_LEN),
|
|
294
|
+
description: raw.length > 14 ? toString(raw[14], `${f}.description`) : "",
|
|
295
|
+
rules: raw.length > 15 ? toString(raw[15], `${f}.rules`) : "",
|
|
296
|
+
};
|
|
297
|
+
const oracleSource = raw.length > 13
|
|
298
|
+
? decodeOracleSource(raw[13], `${f}.oracleSource`)
|
|
299
|
+
: undefined;
|
|
300
|
+
if (oracleSource)
|
|
301
|
+
decoded.oracleSource = oracleSource;
|
|
302
|
+
return decoded;
|
|
303
|
+
}
|
|
304
|
+
/** One item of a governance `Batch` — the CLOSED market-creation subset.
|
|
305
|
+
* Fails closed on any other variant name: a batch item this build cannot
|
|
306
|
+
* decode must never let the batch around it render as understood. */
|
|
307
|
+
function decodeBatchItem(value, field) {
|
|
308
|
+
const { name, payload } = variantOf(value, field);
|
|
309
|
+
switch (name) {
|
|
310
|
+
case "CreateMarket":
|
|
311
|
+
return { kind: "CreateMarket", value: decodeCreateMarket(payload) };
|
|
312
|
+
case "CreateImpactMarket":
|
|
313
|
+
return {
|
|
314
|
+
kind: "CreateImpactMarket",
|
|
315
|
+
value: decodeCreateImpactMarket(payload),
|
|
316
|
+
};
|
|
317
|
+
default:
|
|
318
|
+
throw new Error(`governance decode: ${field} has unknown AdminBatchItem variant "${name}" — this SDK build cannot render it`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function decodeUpdateRegistry(value) {
|
|
322
|
+
const raw = toTuple(value, "updateRegistry", 2);
|
|
323
|
+
return {
|
|
324
|
+
newThreshold: toU32(raw[0], "updateRegistry.newThreshold"),
|
|
325
|
+
newMembers: toArray(raw[1], "updateRegistry.newMembers").map((m, i) => toBytes(m, `updateRegistry.newMembers[${i}]`, ADDRESS_LEN)),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function decodeCancelAllOrdersForAccount(value) {
|
|
329
|
+
const raw = toTuple(value, "cancelAllOrdersForAccount", 2);
|
|
330
|
+
const market = raw[1];
|
|
331
|
+
return {
|
|
332
|
+
owner: toBytes(raw[0], "cancelAllOrdersForAccount.owner", ADDRESS_LEN),
|
|
333
|
+
market: market === null || market === undefined
|
|
334
|
+
? null
|
|
335
|
+
: toU32(market, "cancelAllOrdersForAccount.market"),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function decodeSetTriggerMarketConfig(value) {
|
|
339
|
+
const raw = toTuple(value, "setTriggerMarketConfig", 7);
|
|
340
|
+
if (typeof raw[2] !== "boolean") {
|
|
341
|
+
throw new Error("governance decode: setTriggerMarketConfig.enabled is not boolean");
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
market: toU32(raw[0], "setTriggerMarketConfig.market"),
|
|
345
|
+
expectedCurrentVersion: raw[1] == null
|
|
346
|
+
? null
|
|
347
|
+
: toU64(raw[1], "setTriggerMarketConfig.expectedCurrentVersion"),
|
|
348
|
+
enabled: raw[2],
|
|
349
|
+
maxTriggerSlippageBps: toU32(raw[3], "setTriggerMarketConfig.maxTriggerSlippageBps"),
|
|
350
|
+
maxMarkAgeMs: toU64(raw[4], "setTriggerMarketConfig.maxMarkAgeMs"),
|
|
351
|
+
maxFuturePublishSkewMs: toU64(raw[5], "setTriggerMarketConfig.maxFuturePublishSkewMs"),
|
|
352
|
+
maxActiveBrackets: toU64(raw[6], "setTriggerMarketConfig.maxActiveBrackets"),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/** `kind` → the engine's `AdminActionType` tag, as a TABLE rather than
|
|
356
|
+
* arithmetic: a new arm added to `decodeAdminAction` without a row here is
|
|
357
|
+
* a compile error (`Record` over the closed union), never a silently
|
|
358
|
+
* inherited neighbour's tag. Mirrors `AdminActionType` in the engine and
|
|
359
|
+
* `action_type()` in the Rust core — 1/2 are v1, 3/4 are admin-actions v2. */
|
|
360
|
+
const ACTION_TAG_BY_KIND = {
|
|
361
|
+
CreateMarket: 1,
|
|
362
|
+
UpdateAdminSignerRegistry: 2,
|
|
363
|
+
CreateImpactMarket: 3,
|
|
364
|
+
Batch: 4,
|
|
365
|
+
SetTriggerMarketConfig: 5,
|
|
366
|
+
UnpauseBridge: 6,
|
|
367
|
+
// 7 is UpdateAuthoritySet, not yet mirrored here (exchange#472).
|
|
368
|
+
CancelAllOrdersForAccount: 8,
|
|
369
|
+
};
|
|
370
|
+
/** The typed inner operation a proposal carries. Fails closed on an unknown
|
|
371
|
+
* variant: an SDK build that does not know an operation must never let a
|
|
372
|
+
* caller render or approve it as though it did. */
|
|
373
|
+
export function decodeAdminAction(value, field = "action") {
|
|
374
|
+
// Unit variants (no fields) arrive as a bare string, not a single-entry map.
|
|
375
|
+
// Only the known unit variant is accepted here; any other bare string falls
|
|
376
|
+
// through to `variantOf`, which rejects it as "not an enum variant".
|
|
377
|
+
if (value === "UnpauseBridge")
|
|
378
|
+
return { kind: "UnpauseBridge" };
|
|
379
|
+
const { name, payload } = variantOf(value, field);
|
|
380
|
+
switch (name) {
|
|
381
|
+
case "CreateMarket":
|
|
382
|
+
return {
|
|
383
|
+
kind: "CreateMarket",
|
|
384
|
+
value: decodeCreateMarket(payload),
|
|
385
|
+
};
|
|
386
|
+
case "UpdateAdminSignerRegistry":
|
|
387
|
+
return {
|
|
388
|
+
kind: "UpdateAdminSignerRegistry",
|
|
389
|
+
value: decodeUpdateRegistry(payload),
|
|
390
|
+
};
|
|
391
|
+
case "CreateImpactMarket":
|
|
392
|
+
return {
|
|
393
|
+
kind: "CreateImpactMarket",
|
|
394
|
+
value: decodeCreateImpactMarket(payload),
|
|
395
|
+
};
|
|
396
|
+
case "Batch":
|
|
397
|
+
return {
|
|
398
|
+
kind: "Batch",
|
|
399
|
+
value: toArray(payload, `${field}.batch`).map((item, i) => decodeBatchItem(item, `${field}.batch[${i}]`)),
|
|
400
|
+
};
|
|
401
|
+
case "SetTriggerMarketConfig":
|
|
402
|
+
return {
|
|
403
|
+
kind: "SetTriggerMarketConfig",
|
|
404
|
+
value: decodeSetTriggerMarketConfig(payload),
|
|
405
|
+
};
|
|
406
|
+
case "CancelAllOrdersForAccount":
|
|
407
|
+
return {
|
|
408
|
+
kind: "CancelAllOrdersForAccount",
|
|
409
|
+
value: decodeCancelAllOrdersForAccount(payload),
|
|
410
|
+
};
|
|
411
|
+
default:
|
|
412
|
+
throw new Error(`governance decode: ${field} has unknown AdminAction variant "${name}" — this SDK build cannot render it`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/** Proposal status. Unit variants are strings, payload variants are
|
|
416
|
+
* single-entry maps whose payload is a positional array (facts 2 and 3). */
|
|
417
|
+
export function decodeProposalStatus(value, field = "status") {
|
|
418
|
+
if (typeof value === "string") {
|
|
419
|
+
if (value === "Pending")
|
|
420
|
+
return { kind: "Pending" };
|
|
421
|
+
if (value === "Executed")
|
|
422
|
+
return { kind: "Executed" };
|
|
423
|
+
throw new Error(`governance decode: ${field} has unknown ProposalStatus "${value}" — this SDK build cannot render it`);
|
|
424
|
+
}
|
|
425
|
+
const { name, payload } = variantOf(value, field);
|
|
426
|
+
switch (name) {
|
|
427
|
+
case "Failed": {
|
|
428
|
+
const fields = toTuple(payload, `${field}.${name}`, 1);
|
|
429
|
+
return {
|
|
430
|
+
kind: "Failed",
|
|
431
|
+
code: toU32(fields[0], `${field}.Failed.code`),
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
case "Rejected": {
|
|
435
|
+
const fields = toTuple(payload, `${field}.${name}`, 1);
|
|
436
|
+
return {
|
|
437
|
+
kind: "Rejected",
|
|
438
|
+
by: toBytes(fields[0], `${field}.Rejected.by`, ADDRESS_LEN),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
case "Expired": {
|
|
442
|
+
const fields = toTuple(payload, `${field}.${name}`, 1);
|
|
443
|
+
const reason = fields[0];
|
|
444
|
+
if (reason !== "Ttl" && reason !== "RegistryChanged") {
|
|
445
|
+
throw new Error(`governance decode: ${field} has unknown ExpiryReason "${String(reason)}"`);
|
|
446
|
+
}
|
|
447
|
+
return { kind: "Expired", reason: reason };
|
|
448
|
+
}
|
|
449
|
+
default:
|
|
450
|
+
throw new Error(`governance decode: ${field} has unknown ProposalStatus variant "${name}" — this SDK build cannot render it`);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* One proposal, as the engine shapes it for display and offline
|
|
455
|
+
* verification (`ProposalDisplayInfo`). `actionCanonicalBytes` is the EXACT
|
|
456
|
+
* stored payload the content hash covers — an approving signer rebuilds
|
|
457
|
+
* their approval from these fields rather than trusting anything a UI
|
|
458
|
+
* rendered, so every field is decoded, none are skipped.
|
|
459
|
+
*/
|
|
460
|
+
export function decodeProposalDisplayInfo(raw, index) {
|
|
461
|
+
// Name the page position in errors: one malformed proposal in a page of
|
|
462
|
+
// fifty is otherwise an unlocatable failure.
|
|
463
|
+
const at = index == null ? "proposal" : `proposal[${index}]`;
|
|
464
|
+
if (!Array.isArray(raw)) {
|
|
465
|
+
throw new Error(`governance decode: ${at} is not an array`);
|
|
466
|
+
}
|
|
467
|
+
const fields = toTuple(raw, at, 15);
|
|
468
|
+
const actionTag = toU8(fields[11], `${at}.actionTag`);
|
|
469
|
+
const action = decodeAdminAction(fields[12], `${at}.action`);
|
|
470
|
+
const expectedActionTag = ACTION_TAG_BY_KIND[action.kind];
|
|
471
|
+
if (actionTag !== expectedActionTag) {
|
|
472
|
+
throw new Error(`governance decode: ${at}.actionTag ${actionTag} does not match ${action.kind} tag ${expectedActionTag}`);
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
proposalId: toU64(fields[0], `${at}.proposalId`),
|
|
476
|
+
statusStored: decodeProposalStatus(fields[1], `${at}.statusStored`),
|
|
477
|
+
statusEffective: decodeProposalStatus(fields[2], `${at}.statusEffective`),
|
|
478
|
+
registryVersion: toU64(fields[3], `${at}.registryVersion`),
|
|
479
|
+
threshold: toU32(fields[4], `${at}.threshold`),
|
|
480
|
+
proposer: toBytes(fields[5], `${at}.proposer`, ADDRESS_LEN),
|
|
481
|
+
approvals: toArray(fields[6], `${at}.approvals`).map((a, i) => toBytes(a, `${at}.approvals[${i}]`, ADDRESS_LEN)),
|
|
482
|
+
rejections: toArray(fields[7], `${at}.rejections`).map((r, i) => toBytes(r, `${at}.rejections[${i}]`, ADDRESS_LEN)),
|
|
483
|
+
createdHeight: toU64(fields[8], `${at}.createdHeight`),
|
|
484
|
+
createdMs: toU64(fields[9], `${at}.createdMs`),
|
|
485
|
+
expiryMs: toU64(fields[10], `${at}.expiryMs`),
|
|
486
|
+
actionTag,
|
|
487
|
+
action,
|
|
488
|
+
// Variable length by nature — it is the stored action payload, whose
|
|
489
|
+
// size depends on the operation. Still element-validated.
|
|
490
|
+
actionCanonicalBytes: toBytes(fields[13], `${at}.actionCanonicalBytes`),
|
|
491
|
+
contentHash: toBytes(fields[14], `${at}.contentHash`, HASH_LEN),
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* The installed signer registry, or `null` when none is seeded.
|
|
496
|
+
*
|
|
497
|
+
* `null` means admin multisig is INACTIVE (fail-closed), which is not the
|
|
498
|
+
* same as an empty roster — callers must treat the two differently, so this
|
|
499
|
+
* takes the already-unwrapped `Option` payload from the client.
|
|
500
|
+
*/
|
|
501
|
+
export function decodeAdminSignerRegistry(raw) {
|
|
502
|
+
if (raw == null)
|
|
503
|
+
return null;
|
|
504
|
+
const fields = toTuple(raw, "registry", 3);
|
|
505
|
+
return {
|
|
506
|
+
version: toU64(fields[0], "registry.version"),
|
|
507
|
+
threshold: toU32(fields[1], "registry.threshold"),
|
|
508
|
+
members: toArray(fields[2], "registry.members").map((m, i) => toBytes(m, `registry.members[${i}]`, ADDRESS_LEN)),
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
/** Decode the engine's one-field `AdminSignerRegistryInfo` envelope. */
|
|
512
|
+
export function decodeAdminSignerRegistryInfo(raw) {
|
|
513
|
+
const fields = toTuple(raw, "registryInfo", 1);
|
|
514
|
+
return decodeAdminSignerRegistry(fields[0]);
|
|
515
|
+
}
|
|
516
|
+
/** Decode and validate the engine's two-field proposal-page envelope. */
|
|
517
|
+
export function decodeProposalPage(raw) {
|
|
518
|
+
const fields = toTuple(raw, "proposalPage", 2);
|
|
519
|
+
const proposals = toArray(fields[0], "proposalPage.items").map((proposal, i) => decodeProposalDisplayInfo(toArray(proposal, `proposalPage.items[${i}]`), i));
|
|
520
|
+
return {
|
|
521
|
+
proposals,
|
|
522
|
+
nextCursor: fields[1] == null ? null : toU64(fields[1], "proposalPage.nextCursor"),
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
//# sourceMappingURL=governance-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance-query.js","sourceRoot":"","sources":["../src/governance-query.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,MAAM,GAAG,IAAI,CAAC;AACpB,MAAM,OAAO,GAAG,WAAW,CAAC;AAC5B,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;AAEjC,SAAS,gBAAgB,CACvB,KAAc,EACd,KAAa,EACb,GAAG,GAAG,OAAO;IAEb,IAAI,OAAe,CAAC;IACp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GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC3D,OAAO,CAAC,CAAC,EAAE,oBAAoB,CAAC,GAAG,EAAE,WAAW,CAAC,CAClD;KACF,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,6BAA6B,CAC3C,GAAY;IAEZ,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IAC/C,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,GAAG,CAC5D,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CACd,yBAAyB,CACvB,OAAO,CAAC,QAAQ,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAC7C,CAAC,CACF,CACJ,CAAC;IACF,OAAO;QACL,SAAS;QACT,UAAU,EACR,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,yBAAyB,CAAC;KACzE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { type Address, Side, TimeInForce, ActionType, type ActionTypeValue, type Action, type TraderAction, type OperatorAction, type PlaceOrder, type CancelOrder, type CancelClientOrder, type CancelAllOrders, type CancelReplaceOrder, type AmendOrder, type AtomicBasketLeg, type AtomicBasketOrder, type ClosePosition, type OracleUpdate, type OracleUpdateComposite, type MarketOrder, type Deposit, type Withdraw, type CreateMarket, type WithdrawRequest, type ConfirmDeposit, type DepositLocator, type ConfirmWithdrawal, type FailWithdrawal, type ConfirmWithdrawalReceipt, type FailWithdrawalReceipt, type AuthorizeWithdrawal, type TriggerLimb, type SetPositionTriggers, type CancelPositionTriggers, type SetTriggerMarketConfig, type BridgeWithdrawalReceipt, type OperatorReceiptProof, type ApproveAgent, type RevokeAgent, type CreateImpactMarket, type EventOracleSource, type PriceComparison, type ResolveEvent, type UpdateMarketFees, type SetUserMarketLeverage, type GovernanceAction, type AdminAction, type AdminBatchItem, type EmergencyAction, type UpdateAdminSignerRegistry, type CancelAllOrdersForAccount, type ProposeAdminAction, type ApproveAdminAction, type RejectAdminAction, type EmergencyAdminAction, type AdminSignerRegistry, type ExpiryReason, type ProposalStatus, type ProposalDisplayInfo, type ProposalPage, type ImpactMarketInfo, type ImpactMarketStatus, Branch, Outcome, type TxResult, type TxOutcome, type TxEvent, type ExchangeEvent, type OrderPlacedEvent, type OrderCancelledEvent, type TradeExecutedEvent, type PositionUpdatedEvent, type PositionClosedEvent, type PriceUpdatedEvent, type FundingAppliedEvent, type FundingSettledEvent, type AccountLiquidatedEvent, type MarketCreatedEvent, type AdlQueueEntry, type Ticker, type Orderbook, type OrderbookLevel, type OpenOrder, type TriggerKind, type TriggerLimbState, type TriggerOutcomeReason, type TriggerEvaluation, type StoredTriggerLimb, type TriggerMarketConfig, type PendingTriggerMarketConfig, type TriggerMarketConfigState, type TriggerMarketConfigInfo, type TriggerEffectiveAvailability, type PositionTriggerBracket, type PositionTriggerInfo, type TriggerStatus, type TriggerHistoryTime, type PositionTriggerHistoryFilters, type TriggerMarketHistoryFilters, type PositionTriggerHistoryEventType, type TriggerMarketHistoryEventType, type TriggerHistoryEventType, type TriggerHistoryPayloadBase, type OwnerTriggerHistoryPayloadBase, type PositionTriggersSetHistoryPayload, type PositionTriggersCancelledHistoryPayload, type PositionTriggersInvalidatedHistoryPayload, type PositionTriggerActivatedHistoryPayload, type PositionTriggerExecutedHistoryPayload, type PositionTriggerDeferredHistoryPayload, type TriggerMarketDeferredHistoryPayload, type TriggerMarketResumedHistoryPayload, type TriggerHistoryEvent, type PositionTriggerHistoryEvent, type TriggerMarketHistoryEvent, type PositionTriggerHistoryPage, type TriggerMarketHistoryPage, type AccountInfo, type PositionInfo, type MarketConfig, type MarkSourceMode, type BindingScenarioEntry, type HistoryCashFlow, type HistoryFill, type HistoryFillsPage, type HistoryResolution, type HistoryPositionSnapshot, type WithdrawalStatus, type WithdrawalRecord, type MarketKind, type FeeTier, type AgentApprovedEvent, type AgentRevokedEvent, type FeesCollectedEvent, } from "./types.js";
|
|
2
|
+
export { MAX_TRIGGER_SLIPPAGE_BPS, validateSetPositionTriggers, validateCancelPositionTriggers, validateSetTriggerMarketConfig, decodePositionTriggerInfos, decodeTriggerMarketConfigInfos, decodeTriggerStatusJson, } from "./triggers.js";
|
|
3
|
+
export { decodePositionTriggerHistoryPage, decodeTriggerMarketHistoryPage, positionTriggerHistorySearchParams, triggerMarketHistorySearchParams, } from "./trigger-history.js";
|
|
4
|
+
export { ENVELOPE_VERSION, encodeSignedTx, signAndEncode, signEnvelopeFromPayload, encodePayloadBytes, decodeTx, decodeSigningMessage, type DecodedSigningMessage, peekActionType, adminProposalContentHash, type AdminProposalContext, } from "./codec.js";
|
|
5
|
+
export { ready } from "./wasm-loader.js";
|
|
6
|
+
export { decodeAdminAction, decodeAdminSignerRegistry, decodeAdminSignerRegistryInfo, decodeProposalPage, decodeProposalDisplayInfo, decodeProposalStatus, } from "./governance-query.js";
|
|
7
|
+
export { fetchChainId } from "./client.js";
|
|
8
|
+
export { type ExecErrorInfo, ExecErrorCode, decodeExecError, execErrorName, } from "./errors.js";
|
|
9
|
+
export { generateKeypair, getPublicKey, pubkeyToOwner, ownerToHex, hexToBytes, bytesToHex, signingMessage, sign, verify, chainIdFromString, UNBOUND_CHAIN_ID, DOMAIN_PREFIX, } from "./crypto.js";
|
|
10
|
+
export { ExchangeClient, type ExchangeClientOptions, type WsStreamOptions, } from "./client.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,IAAI,EACJ,WAAW,EACX,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,K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Ac,EACd,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
export { Side, TimeInForce, ActionType, Branch, Outcome, } from "./types.js";
|
|
3
|
+
export { MAX_TRIGGER_SLIPPAGE_BPS, validateSetPositionTriggers, validateCancelPositionTriggers, validateSetTriggerMarketConfig, decodePositionTriggerInfos, decodeTriggerMarketConfigInfos, decodeTriggerStatusJson, } from "./triggers.js";
|
|
4
|
+
export { decodePositionTriggerHistoryPage, decodeTriggerMarketHistoryPage, positionTriggerHistorySearchParams, triggerMarketHistorySearchParams, } from "./trigger-history.js";
|
|
5
|
+
// Codec
|
|
6
|
+
export { ENVELOPE_VERSION, encodeSignedTx, signAndEncode, signEnvelopeFromPayload, encodePayloadBytes, decodeTx, decodeSigningMessage, peekActionType, adminProposalContentHash, } from "./codec.js";
|
|
7
|
+
// WASM codec/signing core init. `await ready()` once before any codec/signing
|
|
8
|
+
// call (the `ExchangeClient` does this for you). See ADR 0001.
|
|
9
|
+
export { ready } from "./wasm-loader.js";
|
|
10
|
+
// Governance read-model decoders. Exported so a caller holding raw proxy
|
|
11
|
+
// bytes (an offline signer tool reconstructing an approval, say) can decode
|
|
12
|
+
// them with the same pinned implementation the client uses, rather than
|
|
13
|
+
// re-deriving the engine's positional layout by hand.
|
|
14
|
+
export { decodeAdminAction, decodeAdminSignerRegistry, decodeAdminSignerRegistryInfo, decodeProposalPage, decodeProposalDisplayInfo, decodeProposalStatus, } from "./governance-query.js";
|
|
15
|
+
export { fetchChainId } from "./client.js";
|
|
16
|
+
// Error decoder
|
|
17
|
+
export { ExecErrorCode, decodeExecError, execErrorName, } from "./errors.js";
|
|
18
|
+
// Crypto
|
|
19
|
+
export { generateKeypair, getPublicKey, pubkeyToOwner, ownerToHex, hexToBytes, bytesToHex, signingMessage, sign, verify, chainIdFromString, UNBOUND_CHAIN_ID, DOMAIN_PREFIX, } from "./crypto.js";
|
|
20
|
+
// Client
|
|
21
|
+
export { ExchangeClient, } from "./client.js";
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,OAAO,EAEL,IAAI,EACJ,WAAW,EACX,UAAU,EA2DV,MAAM,EACN,OAAO,GAuER,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,EAC1B,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAE9B,QAAQ;AACR,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,EAEpB,cAAc,EACd,wBAAwB,GAEzB,MAAM,YAAY,CAAC;AACpB,8EAA8E;AAC9E,+DAA+D;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,sDAAsD;AACtD,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,gBAAgB;AAChB,OAAO,EAEL,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,SAAS;AACT,OAAO,EACL,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,SAAS;AACT,OAAO,EACL,cAAc,GAGf,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Run one liquidation sweep now (action 0x11). Relayer-signed. */
|
|
2
|
+
export interface RunLiquidationSweep {
|
|
3
|
+
/** 20-byte address of the relayer signer. */
|
|
4
|
+
signer: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
/** Apply one funding tick to `market` now (action 0x12). Relayer-signed. */
|
|
7
|
+
export interface RunFundingTick {
|
|
8
|
+
market: number;
|
|
9
|
+
/** 20-byte address of the relayer signer. */
|
|
10
|
+
signer: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
export declare const TestActionType: {
|
|
13
|
+
readonly RunLiquidationSweep: 17;
|
|
14
|
+
readonly RunFundingTick: 18;
|
|
15
|
+
};
|
|
16
|
+
export type TestAction = {
|
|
17
|
+
type: "RunLiquidationSweep";
|
|
18
|
+
data: RunLiquidationSweep;
|
|
19
|
+
} | {
|
|
20
|
+
type: "RunFundingTick";
|
|
21
|
+
data: RunFundingTick;
|
|
22
|
+
};
|
|
23
|
+
/** Make the test actions encodable and decodable. Idempotent. */
|
|
24
|
+
export declare function registerTestActions(): void;
|
|
25
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAYA,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAErD,iEAAiE;AACjE,wBAAgB,mBAAmB,IAAI,IAAI,CAI1C"}
|