ault-sdk-ts 0.0.2-alpha.22 → 0.0.2-alpha.24
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 +32 -7
- package/dist/agent/sign-and-broadcast.d.ts +10 -3
- package/dist/agent/tx/clob.d.ts +1 -1
- package/dist/agent/tx-executor.d.ts +9 -1
- package/dist/client.d.ts +2 -7
- package/dist/core/clob-gas.d.ts +22 -0
- package/dist/core/clob-msgs.d.ts +2 -3
- package/dist/core/clob-responses.d.ts +19 -0
- package/dist/core/errors.d.ts +13 -0
- package/dist/eip712/msg.generated.d.ts +10 -4
- package/dist/eip712/registry.d.ts +2 -0
- package/dist/eip712/sign-and-broadcast.d.ts +19 -4
- package/dist/high-level/tx-executor.d.ts +9 -1
- package/dist/high-level/types.d.ts +152 -64
- package/dist/high-level-client.d.ts +1 -1
- package/dist/index.cjs +1441 -624
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1438 -622
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/accountx/v1/query.d.ts +32 -0
- package/dist/proto/gen/ault/agent/v1/tx.d.ts +4 -5
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +0 -7
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +25 -3
- package/dist/proto/gen/ault/license/v1/genesis.d.ts +1 -26
- package/dist/proto/gen/ault/license/v1/license.d.ts +0 -14
- package/dist/proto/gen/ault/license/v1/query.d.ts +44 -18
- package/dist/proto/gen/ault/market/v1/market.d.ts +1 -0
- package/dist/proto/gen/ault/market/v1/tx.d.ts +9 -0
- package/dist/proto/gen/ault/miner/v1/genesis.d.ts +52 -84
- package/dist/proto/gen/ault/miner/v1/miner.d.ts +10 -45
- package/dist/proto/gen/ault/miner/v1/query.d.ts +0 -13
- package/dist/proto/gen/ault/spot/v1/genesis.d.ts +2 -2
- package/dist/proto/gen/ault/spot/v1/order.d.ts +12 -4
- package/dist/proto/gen/ault/tokenregistry/v1/genesis.d.ts +3 -3
- package/dist/proto/gen/ault/tokenregistry/v1/query.d.ts +2 -2
- package/dist/proto/gen/ault/tokenregistry/v1/tokenregistry.d.ts +24 -15
- package/dist/proto/gen/ault/tokenregistry/v1/tx.d.ts +1 -1
- package/dist/proto/tx-decode.d.ts +18 -0
- package/dist/rest/dex-types.generated.d.ts +12 -27
- package/dist/rest/dex.generated.d.ts +24 -52
- package/dist/rest/license.d.ts +1 -2
- package/dist/rest/types.d.ts +1 -2
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ import type { Params as MinerChainParams } from "../proto/gen/ault/miner/v1/mine
|
|
|
26
26
|
import type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
|
|
27
27
|
import type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
|
|
28
28
|
import type { Any as ProtoAny } from "../proto/gen/google/protobuf/any";
|
|
29
|
-
import type {
|
|
29
|
+
import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
|
|
30
30
|
import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
|
|
31
31
|
import type { BigIntLike } from "../core/address";
|
|
32
32
|
export type { BigIntLike };
|
|
@@ -107,21 +107,70 @@ export interface TxResult {
|
|
|
107
107
|
* upper-case the value; for EVM JSON-RPC prefix it with `0x`.
|
|
108
108
|
*/
|
|
109
109
|
txHash: string;
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Result code (0 = success). On the values the CLOB order methods return,
|
|
112
|
+
* this is always `0`: broadcast-only sends report the accepted CheckTx code
|
|
113
|
+
* (`0`), and wait-mode sends only return on DeliverTx success (`0`).
|
|
114
|
+
* Non-success wait-mode outcomes throw rather than return, so the code never
|
|
115
|
+
* surfaces here. (Other callers that resolve on a poll timeout may still see
|
|
116
|
+
* `-1`.)
|
|
117
|
+
*/
|
|
111
118
|
code: number;
|
|
112
119
|
/** Raw log from the transaction */
|
|
113
120
|
rawLog?: string;
|
|
114
121
|
/**
|
|
115
122
|
* Whether the transaction outcome is definitively known.
|
|
116
|
-
* - `true` -- definitive result:
|
|
117
|
-
* - `false` --
|
|
123
|
+
* - `true` -- definitive result: DeliverTx result observed via polling (wait mode).
|
|
124
|
+
* - `false` -- either broadcast-only mode (CheckTx accepted, DeliverTx
|
|
125
|
+
* intentionally not awaited — the normal success case for `wait: false`),
|
|
126
|
+
* or a poll timeout where the outcome is unknown. Use txHash to query later.
|
|
118
127
|
* - `undefined` -- tx was broadcast but confirmation lookup was unavailable.
|
|
119
128
|
* The `code` field reflects the CheckTx result only.
|
|
120
129
|
*/
|
|
121
130
|
confirmed?: boolean;
|
|
122
131
|
/** Whether the transaction was definitively successful on-chain. */
|
|
123
132
|
success: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Decoded `msg_responses` from the committed tx (`tx_response.data`). Only
|
|
135
|
+
* populated when DeliverTx was awaited (`wait: true`); broadcast-only calls
|
|
136
|
+
* return before block inclusion and so carry no responses. Additive — does
|
|
137
|
+
* not change existing call shapes.
|
|
138
|
+
*/
|
|
139
|
+
msgResponses?: Array<{
|
|
140
|
+
typeUrl: string;
|
|
141
|
+
value: Uint8Array;
|
|
142
|
+
}>;
|
|
124
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Per-order broadcast flag. Order methods (`placeLimitOrder`, `placeMarketOrder`,
|
|
146
|
+
* `placeScaleOrder`, `cancelOrders`) default to broadcast-only (`wait: false`):
|
|
147
|
+
* they return once CheckTx accepts the tx, without polling for DeliverTx. Pass
|
|
148
|
+
* `wait: true` to poll for block inclusion and receive the rich result
|
|
149
|
+
* (`orderId`, etc.). A CheckTx rejection still throws in both modes.
|
|
150
|
+
*/
|
|
151
|
+
export interface OrderWaitOption {
|
|
152
|
+
/** Wait for DeliverTx (poll for inclusion) and return the rich result. Default `false`. */
|
|
153
|
+
wait?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** Limit/market order result when `wait: true`. */
|
|
156
|
+
export type PlaceOrderResult = TxResult & {
|
|
157
|
+
orderId: string;
|
|
158
|
+
escrowedAmount?: Coin;
|
|
159
|
+
};
|
|
160
|
+
/** Scale order result when `wait: true`. */
|
|
161
|
+
export type PlaceScaleOrderResult = TxResult & {
|
|
162
|
+
orders: Array<{
|
|
163
|
+
orderId: string;
|
|
164
|
+
price: string;
|
|
165
|
+
quantity: string;
|
|
166
|
+
}>;
|
|
167
|
+
escrowedAmount?: Coin;
|
|
168
|
+
};
|
|
169
|
+
/** Cancel result when `wait: true`. `succeeded`/`failed` are order ids in hex. */
|
|
170
|
+
export type CancelOrdersResult = TxResult & {
|
|
171
|
+
succeeded: string[];
|
|
172
|
+
failed: string[];
|
|
173
|
+
};
|
|
125
174
|
export interface LicenseTxApi {
|
|
126
175
|
mintLicense(params: {
|
|
127
176
|
to: string;
|
|
@@ -224,7 +273,12 @@ export interface AgentTxApi {
|
|
|
224
273
|
approveAgent(params: {
|
|
225
274
|
agentPubkey: ProtoAny;
|
|
226
275
|
name?: string;
|
|
227
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Absolute time at which the agent authorization expires. When omitted
|
|
278
|
+
* the chain uses block_time + params.default_expiry; cannot exceed
|
|
279
|
+
* block_time + params.max_expiry.
|
|
280
|
+
*/
|
|
281
|
+
expiresAt?: Date;
|
|
228
282
|
} & TxOptions): Promise<TxResult>;
|
|
229
283
|
revokeAgent(params: {
|
|
230
284
|
agentAddress: string;
|
|
@@ -283,41 +337,75 @@ export interface MarketTxApi {
|
|
|
283
337
|
params: MarketParams;
|
|
284
338
|
} & TxOptions): Promise<TxResult>;
|
|
285
339
|
}
|
|
340
|
+
export type LimitOrderParams = {
|
|
341
|
+
marketId: Uint8Array;
|
|
342
|
+
isBuy: boolean;
|
|
343
|
+
price: string;
|
|
344
|
+
quantity: string;
|
|
345
|
+
deadline: Date;
|
|
346
|
+
postOnly?: boolean;
|
|
347
|
+
builderAddress?: string;
|
|
348
|
+
builderFeeRate?: string;
|
|
349
|
+
};
|
|
350
|
+
export type MarketOrderParams = {
|
|
351
|
+
marketId: Uint8Array;
|
|
352
|
+
isBuy: boolean;
|
|
353
|
+
deposit: string;
|
|
354
|
+
worstPrice?: string;
|
|
355
|
+
priceTolerance?: string;
|
|
356
|
+
builderAddress?: string;
|
|
357
|
+
builderFeeRate?: string;
|
|
358
|
+
};
|
|
359
|
+
export type ScaleOrderParams = {
|
|
360
|
+
marketId: Uint8Array;
|
|
361
|
+
isBuy: boolean;
|
|
362
|
+
lowPrice: string;
|
|
363
|
+
highPrice: string;
|
|
364
|
+
totalQuantity: string;
|
|
365
|
+
weights: number[];
|
|
366
|
+
deadline: Date;
|
|
367
|
+
postOnly?: boolean;
|
|
368
|
+
builderAddress?: string;
|
|
369
|
+
builderFeeRate?: string;
|
|
370
|
+
};
|
|
371
|
+
export type CancelOrdersParams = {
|
|
372
|
+
orderIds: Uint8Array[];
|
|
373
|
+
};
|
|
286
374
|
export interface ClobTxApi {
|
|
287
|
-
placeLimitOrder(params: {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
} & TxOptions): Promise<
|
|
297
|
-
placeMarketOrder(params: {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
worstPrice?: string;
|
|
302
|
-
priceTolerance?: string;
|
|
303
|
-
builderAddress?: string;
|
|
304
|
-
builderFeeRate?: string;
|
|
305
|
-
} & TxOptions): Promise<TxResult>;
|
|
375
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
376
|
+
wait: true;
|
|
377
|
+
} & TxOptions): Promise<PlaceOrderResult>;
|
|
378
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
379
|
+
wait?: false;
|
|
380
|
+
} & TxOptions): Promise<TxResult>;
|
|
381
|
+
placeLimitOrder(params: LimitOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
382
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
383
|
+
wait: true;
|
|
384
|
+
} & TxOptions): Promise<PlaceOrderResult>;
|
|
385
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
386
|
+
wait?: false;
|
|
387
|
+
} & TxOptions): Promise<TxResult>;
|
|
388
|
+
placeMarketOrder(params: MarketOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
306
389
|
cancelOrders(params: {
|
|
307
390
|
orderIds: Uint8Array[];
|
|
391
|
+
} & {
|
|
392
|
+
wait: true;
|
|
393
|
+
} & TxOptions): Promise<CancelOrdersResult>;
|
|
394
|
+
cancelOrders(params: {
|
|
395
|
+
orderIds: Uint8Array[];
|
|
396
|
+
} & {
|
|
397
|
+
wait?: false;
|
|
308
398
|
} & TxOptions): Promise<TxResult>;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
builderFeeRate?: string;
|
|
320
|
-
} & TxOptions): Promise<TxResult>;
|
|
399
|
+
cancelOrders(params: {
|
|
400
|
+
orderIds: Uint8Array[];
|
|
401
|
+
} & OrderWaitOption & TxOptions): Promise<TxResult | CancelOrdersResult>;
|
|
402
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
403
|
+
wait: true;
|
|
404
|
+
} & TxOptions): Promise<PlaceScaleOrderResult>;
|
|
405
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
406
|
+
wait?: false;
|
|
407
|
+
} & TxOptions): Promise<TxResult>;
|
|
408
|
+
placeScaleOrder(params: ScaleOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceScaleOrderResult>;
|
|
321
409
|
updateClobParams(params: {
|
|
322
410
|
params: ClobParams;
|
|
323
411
|
} & TxOptions): Promise<TxResult>;
|
|
@@ -431,40 +519,40 @@ export interface AgentTxOptions extends TxOptions {
|
|
|
431
519
|
timeoutSeconds?: number;
|
|
432
520
|
}
|
|
433
521
|
export interface AgentClobTxApi {
|
|
434
|
-
placeLimitOrder(params: {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
lifespan: Duration;
|
|
440
|
-
postOnly?: boolean;
|
|
441
|
-
builderAddress?: string;
|
|
442
|
-
builderFeeRate?: string;
|
|
522
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
523
|
+
wait: true;
|
|
524
|
+
} & AgentTxOptions): Promise<PlaceOrderResult>;
|
|
525
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
526
|
+
wait?: false;
|
|
443
527
|
} & AgentTxOptions): Promise<TxResult>;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
builderAddress?: string;
|
|
451
|
-
builderFeeRate?: string;
|
|
528
|
+
placeLimitOrder(params: LimitOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
529
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
530
|
+
wait: true;
|
|
531
|
+
} & AgentTxOptions): Promise<PlaceOrderResult>;
|
|
532
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
533
|
+
wait?: false;
|
|
452
534
|
} & AgentTxOptions): Promise<TxResult>;
|
|
535
|
+
placeMarketOrder(params: MarketOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
453
536
|
cancelOrders(params: {
|
|
454
537
|
orderIds: Uint8Array[];
|
|
538
|
+
} & {
|
|
539
|
+
wait: true;
|
|
540
|
+
} & AgentTxOptions): Promise<CancelOrdersResult>;
|
|
541
|
+
cancelOrders(params: {
|
|
542
|
+
orderIds: Uint8Array[];
|
|
543
|
+
} & {
|
|
544
|
+
wait?: false;
|
|
455
545
|
} & AgentTxOptions): Promise<TxResult>;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
postOnly?: boolean;
|
|
465
|
-
builderAddress?: string;
|
|
466
|
-
builderFeeRate?: string;
|
|
546
|
+
cancelOrders(params: {
|
|
547
|
+
orderIds: Uint8Array[];
|
|
548
|
+
} & OrderWaitOption & AgentTxOptions): Promise<TxResult | CancelOrdersResult>;
|
|
549
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
550
|
+
wait: true;
|
|
551
|
+
} & AgentTxOptions): Promise<PlaceScaleOrderResult>;
|
|
552
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
553
|
+
wait?: false;
|
|
467
554
|
} & AgentTxOptions): Promise<TxResult>;
|
|
555
|
+
placeScaleOrder(params: ScaleOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceScaleOrderResult>;
|
|
468
556
|
}
|
|
469
557
|
/**
|
|
470
558
|
* Agent identity + agent-signed CLOB tx surface attached to a `Client`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, } from "./high-level/types";
|
|
1
|
+
export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, TxOptions, OrderWaitOption, PlaceOrderResult, PlaceScaleOrderResult, CancelOrdersResult, } from "./high-level/types";
|
|
2
2
|
export { createClient } from "./high-level/create-client";
|