ault-sdk-ts 0.0.2-alpha.23 → 0.0.2-alpha.25

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 CHANGED
@@ -637,11 +637,18 @@ interface TxResult {
637
637
  txHash: string; // Transaction hash
638
638
  code: number; // Result code (0 = success)
639
639
  rawLog?: string; // Raw log from transaction
640
- confirmed?: boolean; // true = definitive result, false = timed out, undefined = confirmation lookup unavailable
640
+ confirmed?: boolean; // true = DeliverTx observed; false = broadcast-only or poll timeout; undefined = confirmation lookup unavailable
641
641
  success: boolean; // True only when DeliverTx success was confirmed
642
642
  }
643
643
  ```
644
644
 
645
+ The CLOB order methods (`placeLimitOrder`, `placeMarketOrder`,
646
+ `placeScaleOrder`, `cancelOrders`) default to broadcast-only: they return once
647
+ CheckTx accepts the transaction, so the result has `confirmed: false` and
648
+ `success: false`. Pass `wait: true` to poll for DeliverTx and get back the
649
+ decoded order IDs. See [Market And CLOB
650
+ Transactions](#market-and-clob-transactions).
651
+
645
652
  ### License Transactions
646
653
 
647
654
  ```typescript
@@ -742,23 +749,37 @@ await client.updateOperatorInfo({
742
749
  ```typescript
743
750
  import { base64ToBytes } from "ault-sdk-ts";
744
751
 
745
- // Place a limit order
752
+ const marketId = base64ToBytes("base64MarketId...");
753
+
754
+ // Place a limit order (broadcast-only: returns once CheckTx accepts it).
746
755
  await client.placeLimitOrder({
747
- marketId: 1,
756
+ marketId,
748
757
  isBuy: true,
749
758
  price: "1.5",
750
759
  quantity: "100",
751
760
  lifespan: { seconds: 3600n, nanos: 0 }, // 1 hour
752
761
  });
753
762
 
763
+ // Pass `wait: true` to poll for DeliverTx and read back the order ID.
764
+ const placed = await client.placeLimitOrder({
765
+ marketId,
766
+ isBuy: true,
767
+ price: "1.5",
768
+ quantity: "100",
769
+ lifespan: { seconds: 3600n, nanos: 0 },
770
+ wait: true,
771
+ });
772
+ console.log(placed.orderId);
773
+
754
774
  // Place a market order
755
775
  await client.placeMarketOrder({
756
- marketId: 1,
776
+ marketId,
757
777
  isBuy: true,
758
778
  deposit: "100",
759
779
  });
760
780
 
761
- // Cancel specific orders
781
+ // Cancel specific orders. With `wait: true` the result lists which IDs
782
+ // succeeded and which failed.
762
783
  await client.cancelOrders({ orderIds: [base64ToBytes("base64OrderId...")] });
763
784
 
764
785
  // Create a market
@@ -855,14 +876,18 @@ console.log(client.asAgent === agent); // true
855
876
  ### Place agent-signed orders
856
877
 
857
878
  ```typescript
858
- // Same shape as the wallet-signed equivalents on `client.*`.
859
- await client.asAgent!.placeLimitOrder({
879
+ // Same shape as the wallet-signed equivalents on `client.*`, including the
880
+ // broadcast-only default and the `wait: true` opt-in for a result with the
881
+ // decoded order ID.
882
+ const placed = await client.asAgent!.placeLimitOrder({
860
883
  marketId,
861
884
  isBuy: true,
862
885
  price: "1.0",
863
886
  quantity: "1000000000000000000",
864
887
  lifespan: { seconds: 3600n, nanos: 0 },
888
+ wait: true,
865
889
  });
890
+ console.log(placed.orderId);
866
891
 
867
892
  await client.asAgent!.placeMarketOrder({
868
893
  marketId,
@@ -21,6 +21,12 @@ export interface AgentSignAndBroadcastParams {
21
21
  memo?: string;
22
22
  gasLimit?: string;
23
23
  confirmationTimeoutMs?: number;
24
+ /**
25
+ * When `true` (default), poll for DeliverTx after a successful CheckTx. When
26
+ * `false`, return immediately after CheckTx acceptance with `confirmed: false`.
27
+ * A CheckTx rejection throws in both modes.
28
+ */
29
+ wait?: boolean;
24
30
  timeoutSeconds?: number;
25
31
  timeoutTimestamp?: {
26
32
  seconds: bigint;
@@ -30,9 +36,10 @@ export interface AgentSignAndBroadcastParams {
30
36
  fetchOptions?: FetchWithRetryOptions;
31
37
  cache?: AccountCache;
32
38
  }
33
- export declare function signAndBroadcastAgentTx({ network, keyMaterial, masterAddress, msgs, memo, gasLimit, confirmationTimeoutMs, timeoutSeconds, timeoutTimestamp, fetchFn, fetchOptions, cache, }: AgentSignAndBroadcastParams): Promise<{
39
+ export declare function signAndBroadcastAgentTx({ network, keyMaterial, masterAddress, msgs, memo, gasLimit, confirmationTimeoutMs, wait, timeoutSeconds, timeoutTimestamp, fetchFn, fetchOptions, cache, }: AgentSignAndBroadcastParams): Promise<{
34
40
  txHash: string;
35
- code: 0;
41
+ code: number;
36
42
  rawLog?: string;
37
- confirmed: true;
43
+ data?: string;
44
+ confirmed: boolean;
38
45
  }>;
@@ -1,4 +1,4 @@
1
- import { type GAS_CONSTANTS } from "../../core/network";
1
+ import type { GAS_CONSTANTS } from "../../core/network";
2
2
  import type { AgentClobTxApi } from "../../high-level/types";
3
3
  import type { AgentTxExecutor } from "../tx-executor";
4
4
  export interface AgentClobTxContext {
@@ -3,6 +3,13 @@ import { type NetworkConfig } from "../core/network";
3
3
  import type { AnyEip712Msg } from "../eip712/builder";
4
4
  import type { AgentTxOptions, TxResult } from "../high-level/types";
5
5
  import { type AccountCache } from "../eip712/sign-and-broadcast";
6
+ /**
7
+ * Internal exec options: the public {@link AgentTxOptions} plus the per-call
8
+ * `wait` flag threaded through by the CLOB order methods.
9
+ */
10
+ type AgentExecOptions = AgentTxOptions & {
11
+ wait?: boolean;
12
+ };
6
13
  export interface AgentTxExecutorOptions {
7
14
  /**
8
15
  * Returns the network with the latest manifest URL/eip712 overrides applied.
@@ -27,5 +34,6 @@ export interface AgentTxExecutorOptions {
27
34
  */
28
35
  cache?: AccountCache;
29
36
  }
30
- export type AgentTxExecutor = (msgs: AnyEip712Msg[], txOptions?: AgentTxOptions) => Promise<TxResult>;
37
+ export type AgentTxExecutor = (msgs: AnyEip712Msg[], txOptions?: AgentExecOptions) => Promise<TxResult>;
31
38
  export declare function createAgentTxExecutor(options: AgentTxExecutorOptions): AgentTxExecutor;
39
+ export {};
package/dist/client.d.ts CHANGED
@@ -16,7 +16,7 @@ import { DexWsClient } from "./ws/client";
16
16
  import type { DexWsOptions } from "./ws/types";
17
17
  import { type TokenRegistryApi } from "./rest/tokenregistry";
18
18
  import type { AnyEip712Msg, Eip712TxContext } from "./eip712/builder";
19
- import type { SignAndBroadcastParams } from "./eip712/sign-and-broadcast";
19
+ import type { SignAndBroadcastParams, SignAndBroadcastResult } from "./eip712/sign-and-broadcast";
20
20
  import { EIP712_MSG_TYPES } from "./eip712/registry";
21
21
  import { type SignerInput } from "./eip712/signers";
22
22
  export interface AultClientOptions {
@@ -53,12 +53,7 @@ export interface AultClient {
53
53
  domain: Record<string, unknown>;
54
54
  message: Record<string, unknown>;
55
55
  };
56
- signAndBroadcast: (params: Omit<SignAndBroadcastParams, "network" | "fetchFn">) => Promise<{
57
- txHash: string;
58
- code: number;
59
- rawLog?: string;
60
- confirmed?: boolean;
61
- }>;
56
+ signAndBroadcast: (params: Omit<SignAndBroadcastParams, "network" | "fetchFn">) => Promise<SignAndBroadcastResult>;
62
57
  registry: typeof EIP712_MSG_TYPES;
63
58
  };
64
59
  }
@@ -0,0 +1,22 @@
1
+ import { type GAS_CONSTANTS } from "./network";
2
+ /**
3
+ * Per-op fee-free gas formulas for the CLOB order methods, shared by the
4
+ * high-level (wallet) and agent factories. The formulas are identical across
5
+ * both paths; the only delta is the cancel EIP-712 ante, which is wallet-only
6
+ * (see {@link cancelOrdersGas}). Each takes an explicit `gas` snapshot so a
7
+ * manifest hot-swap is honored on the next call.
8
+ */
9
+ type Gas = typeof GAS_CONSTANTS;
10
+ export declare function limitOrderGas(gas: Gas): string;
11
+ export declare function marketOrderGas(gas: Gas): string;
12
+ export declare function scaleOrderGas(gas: Gas, subOrderCount: number): string;
13
+ /**
14
+ * Cancel gas. `includeAnte` adds the EIP-712 ante on top of the fee-free
15
+ * allowance: cancel's base (`CANCEL_ORDER_BASE`) is the smallest CLOB op, so the
16
+ * fee-free multiplier doesn't absorb the ante the way limit/market/scale do.
17
+ * Wallet (EIP-712) cancels pass `true`; agent cancels are gas-capped and pass
18
+ * `false`. If chain `MinGasLimits` change, revisit whether the other ops also
19
+ * need the ante.
20
+ */
21
+ export declare function cancelOrdersGas(gas: Gas, orderCount: number, includeAnte: boolean): string;
22
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { PlaceOrderResult, PlaceScaleOrderResult, CancelOrdersResult, TxResult } from "../high-level/types";
2
+ type MsgResponse = {
3
+ typeUrl: string;
4
+ value: Uint8Array;
5
+ };
6
+ /**
7
+ * Shared wait/decode plumbing for the CLOB order methods (high-level and
8
+ * agent). Resolves the `wait` default once, runs the broadcast, and either
9
+ * returns the raw {@link TxResult} (broadcast-only) or feeds the committed
10
+ * `msg_responses` to the per-op decoder. Keeps the `wait ?? false` default and
11
+ * the broadcast-vs-decode branch in one place; callers supply the gas/options
12
+ * (which genuinely differ per op) via the `run` thunk.
13
+ */
14
+ export declare function withWaitDecode<R extends TxResult>(wait: boolean | undefined, run: (wait: boolean) => Promise<TxResult>, decode: (msgResponses: MsgResponse[] | undefined, base: TxResult) => R): Promise<TxResult | R>;
15
+ export declare function decodeLimitOrderResult(msgResponses: MsgResponse[] | undefined, base: TxResult): PlaceOrderResult;
16
+ export declare function decodeMarketOrderResult(msgResponses: MsgResponse[] | undefined, base: TxResult): PlaceOrderResult;
17
+ export declare function decodeScaleOrderResult(msgResponses: MsgResponse[] | undefined, base: TxResult): PlaceScaleOrderResult;
18
+ export declare function decodeCancelOrdersResult(msgResponses: MsgResponse[] | undefined, base: TxResult): CancelOrdersResult;
19
+ export {};
@@ -55,6 +55,19 @@ export declare class TxNotConfirmedError extends TxError {
55
55
  export declare class TxConfirmationUnavailableError extends TxError {
56
56
  constructor(params: TxErrorParams);
57
57
  }
58
+ /**
59
+ * Thrown in wait mode when the tx committed successfully (DeliverTx code 0) but
60
+ * the expected per-message response was missing from `tx_response.data` — e.g. a
61
+ * lagging LCD node that returns a confirmed tx without `data`. Distinct from
62
+ * `TxError` so callers can tell "the order failed" from "the order succeeded but
63
+ * I could not decode its id". The tx is on-chain; re-query by `txHash` to recover
64
+ * the response.
65
+ */
66
+ export declare class MissingMsgResponseError extends Error {
67
+ txHash?: string;
68
+ typeUrl: string;
69
+ constructor(typeUrl: string, txHash?: string);
70
+ }
58
71
  /**
59
72
  * Thrown by `withdrawRewards` when a mid-loop tx fails AFTER one or more
60
73
  * validators have already been withdrawn on-chain. Carries the txs that
@@ -58,13 +58,14 @@ export declare const GAS_CONSTANTS: {
58
58
  readonly APPROVE_BUILDER: 81000;
59
59
  readonly REVOKE_BUILDER: 57000;
60
60
  readonly SET_REFERRAL_CODE: 76000;
61
- readonly SET_REFERRAL: 90000;
61
+ readonly SET_REFERRAL: 80000;
62
62
  readonly LIMIT_ORDER: 125000;
63
63
  readonly MARKET_ORDER: 119000;
64
64
  readonly SCALE_ORDER_BASE: 115000;
65
65
  readonly SCALE_ORDER_PER_SUB: 13000;
66
66
  readonly CANCEL_ORDER_BASE: 50000;
67
- readonly CANCEL_ORDER_PER_ID: 19000;
67
+ readonly CANCEL_ORDER_PER_ID: 13000;
68
+ readonly MODIFY_ORDER_PER_ID: 113000;
68
69
  readonly OPEN_ACCOUNT: 96000;
69
70
  readonly DELEGATE: 220000;
70
71
  readonly UNDELEGATE: 220000;
@@ -33,6 +33,7 @@ export declare function _resetIndexingCache(): void;
33
33
  export declare function pollTxInclusion(network: NetworkConfig, txHash: string, fetchFn?: FetchFn, fetchOptions?: FetchWithRetryOptions, timeoutMs?: number, intervalMs?: number): Promise<{
34
34
  code: number;
35
35
  rawLog?: string;
36
+ data?: string;
36
37
  confirmed: boolean | undefined;
37
38
  }>;
38
39
  export interface SignAndBroadcastParams {
@@ -45,6 +46,13 @@ export interface SignAndBroadcastParams {
45
46
  feeDenom?: string;
46
47
  feeAmount?: string;
47
48
  confirmationTimeoutMs?: number;
49
+ /**
50
+ * When `true` (default), poll for DeliverTx after a successful CheckTx and
51
+ * return the committed result (throwing on any non-success). When `false`,
52
+ * return immediately after CheckTx acceptance with `confirmed: false` — the
53
+ * caller takes on confirmation. A CheckTx rejection throws in both modes.
54
+ */
55
+ wait?: boolean;
48
56
  fetchFn?: FetchFn;
49
57
  fetchOptions?: import("../core/http").FetchWithRetryOptions;
50
58
  cache?: AccountCache;
@@ -56,9 +64,16 @@ export interface SignAndBroadcastParams {
56
64
  */
57
65
  feeMarketCache?: FeeMarketCache;
58
66
  }
59
- export declare function signAndBroadcastEip712({ network, signerAddress, signer, msgs, memo, gasLimit, feeDenom, feeAmount, confirmationTimeoutMs, fetchFn, fetchOptions, cache, feeMarketCache, }: SignAndBroadcastParams): Promise<{
67
+ /**
68
+ * Result of {@link signAndBroadcastEip712}. `data` carries the hex-encoded
69
+ * `TxMsgData` (per-message responses such as orderId), populated only when
70
+ * `wait` was true and the tx committed.
71
+ */
72
+ export interface SignAndBroadcastResult {
60
73
  txHash: string;
61
- code: 0;
74
+ code: number;
62
75
  rawLog?: string;
63
- confirmed: true;
64
- }>;
76
+ data?: string;
77
+ confirmed: boolean;
78
+ }
79
+ export declare function signAndBroadcastEip712({ network, signerAddress, signer, msgs, memo, gasLimit, feeDenom, feeAmount, confirmationTimeoutMs, wait, fetchFn, fetchOptions, cache, feeMarketCache, }: SignAndBroadcastParams): Promise<SignAndBroadcastResult>;
@@ -5,6 +5,14 @@ import type { AnyEip712Msg } from "../eip712/builder";
5
5
  import type { AultSigner } from "../eip712/signers";
6
6
  import { type FeeMarketCache } from "../rest/feemarket";
7
7
  import type { TxOptions, TxResult } from "./types";
8
+ /**
9
+ * Internal exec options: the public {@link TxOptions} plus the per-call `wait`
10
+ * flag. `wait` is not part of `TxOptions` — only the CLOB order methods expose
11
+ * it, and they thread it through here.
12
+ */
13
+ type ExecOptions = TxOptions & {
14
+ wait?: boolean;
15
+ };
8
16
  interface TxExecutorOptions {
9
17
  /**
10
18
  * Returns the network with the latest manifest URL/eip712 overrides applied.
@@ -25,6 +33,6 @@ interface TxExecutorOptions {
25
33
  /** Optional shared fee-market cache. */
26
34
  feeMarketCache?: FeeMarketCache;
27
35
  }
28
- export type TxExecutor = (msgs: AnyEip712Msg[], txOptions?: TxOptions) => Promise<TxResult>;
36
+ export type TxExecutor = (msgs: AnyEip712Msg[], txOptions?: ExecOptions) => Promise<TxResult>;
29
37
  export declare function createTxExecutor(options: TxExecutorOptions): TxExecutor;
30
38
  export {};
@@ -26,6 +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 { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
29
30
  import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
30
31
  import type { BigIntLike } from "../core/address";
31
32
  export type { BigIntLike };
@@ -106,21 +107,70 @@ export interface TxResult {
106
107
  * upper-case the value; for EVM JSON-RPC prefix it with `0x`.
107
108
  */
108
109
  txHash: string;
109
- /** Result code (0 = success). When `confirmed` is false this is -1 (poll timed out). */
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
+ */
110
118
  code: number;
111
119
  /** Raw log from the transaction */
112
120
  rawLog?: string;
113
121
  /**
114
122
  * Whether the transaction outcome is definitively known.
115
- * - `true` -- definitive result: CheckTx rejection, or DeliverTx result observed via polling.
116
- * - `false` -- tx was broadcast and polling timed out; outcome unknown. Use txHash to query later.
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.
117
127
  * - `undefined` -- tx was broadcast but confirmation lookup was unavailable.
118
128
  * The `code` field reflects the CheckTx result only.
119
129
  */
120
130
  confirmed?: boolean;
121
131
  /** Whether the transaction was definitively successful on-chain. */
122
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
+ }>;
123
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
+ };
124
174
  export interface LicenseTxApi {
125
175
  mintLicense(params: {
126
176
  to: string;
@@ -287,41 +337,75 @@ export interface MarketTxApi {
287
337
  params: MarketParams;
288
338
  } & TxOptions): Promise<TxResult>;
289
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
+ };
290
374
  export interface ClobTxApi {
291
- placeLimitOrder(params: {
292
- marketId: Uint8Array;
293
- isBuy: boolean;
294
- price: string;
295
- quantity: string;
296
- deadline: Date;
297
- postOnly?: boolean;
298
- builderAddress?: string;
299
- builderFeeRate?: string;
300
- } & TxOptions): Promise<TxResult>;
301
- placeMarketOrder(params: {
302
- marketId: Uint8Array;
303
- isBuy: boolean;
304
- deposit: string;
305
- worstPrice?: string;
306
- priceTolerance?: string;
307
- builderAddress?: string;
308
- builderFeeRate?: string;
309
- } & 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>;
310
389
  cancelOrders(params: {
311
390
  orderIds: Uint8Array[];
391
+ } & {
392
+ wait: true;
393
+ } & TxOptions): Promise<CancelOrdersResult>;
394
+ cancelOrders(params: {
395
+ orderIds: Uint8Array[];
396
+ } & {
397
+ wait?: false;
312
398
  } & TxOptions): Promise<TxResult>;
313
- placeScaleOrder(params: {
314
- marketId: Uint8Array;
315
- isBuy: boolean;
316
- lowPrice: string;
317
- highPrice: string;
318
- totalQuantity: string;
319
- weights: number[];
320
- deadline: Date;
321
- postOnly?: boolean;
322
- builderAddress?: string;
323
- builderFeeRate?: string;
324
- } & 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>;
325
409
  updateClobParams(params: {
326
410
  params: ClobParams;
327
411
  } & TxOptions): Promise<TxResult>;
@@ -435,40 +519,40 @@ export interface AgentTxOptions extends TxOptions {
435
519
  timeoutSeconds?: number;
436
520
  }
437
521
  export interface AgentClobTxApi {
438
- placeLimitOrder(params: {
439
- marketId: Uint8Array;
440
- isBuy: boolean;
441
- price: string;
442
- quantity: string;
443
- deadline: Date;
444
- postOnly?: boolean;
445
- builderAddress?: string;
446
- builderFeeRate?: string;
522
+ placeLimitOrder(params: LimitOrderParams & {
523
+ wait: true;
524
+ } & AgentTxOptions): Promise<PlaceOrderResult>;
525
+ placeLimitOrder(params: LimitOrderParams & {
526
+ wait?: false;
447
527
  } & AgentTxOptions): Promise<TxResult>;
448
- placeMarketOrder(params: {
449
- marketId: Uint8Array;
450
- isBuy: boolean;
451
- deposit: string;
452
- worstPrice?: string;
453
- priceTolerance?: string;
454
- builderAddress?: string;
455
- 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;
456
534
  } & AgentTxOptions): Promise<TxResult>;
535
+ placeMarketOrder(params: MarketOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceOrderResult>;
457
536
  cancelOrders(params: {
458
537
  orderIds: Uint8Array[];
538
+ } & {
539
+ wait: true;
540
+ } & AgentTxOptions): Promise<CancelOrdersResult>;
541
+ cancelOrders(params: {
542
+ orderIds: Uint8Array[];
543
+ } & {
544
+ wait?: false;
459
545
  } & AgentTxOptions): Promise<TxResult>;
460
- placeScaleOrder(params: {
461
- marketId: Uint8Array;
462
- isBuy: boolean;
463
- lowPrice: string;
464
- highPrice: string;
465
- totalQuantity: string;
466
- weights: number[];
467
- deadline: Date;
468
- postOnly?: boolean;
469
- builderAddress?: string;
470
- 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;
471
554
  } & AgentTxOptions): Promise<TxResult>;
555
+ placeScaleOrder(params: ScaleOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceScaleOrderResult>;
472
556
  }
473
557
  /**
474
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";