ault-sdk-ts 0.0.2-alpha.8 → 0.1.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 +375 -50
- package/dist/agent/attach.d.ts +26 -0
- package/dist/agent/sign-and-broadcast.d.ts +9 -2
- package/dist/agent/tx/clob.d.ts +8 -1
- package/dist/agent/tx-executor.d.ts +24 -2
- package/dist/client.d.ts +6 -7
- package/dist/core/clob-gas.d.ts +28 -0
- package/dist/core/clob-msgs.d.ts +31 -5
- package/dist/core/clob-responses.d.ts +20 -0
- package/dist/core/cloid.d.ts +4 -0
- package/dist/core/errors.d.ts +79 -0
- package/dist/core/manifest-fetcher.d.ts +12 -0
- package/dist/core/manifest-resolver.d.ts +121 -0
- package/dist/core/manifest-types.d.ts +102 -0
- package/dist/core/network.d.ts +42 -13
- package/dist/eip712/msg.generated.d.ts +26 -10
- package/dist/eip712/registry.d.ts +2 -0
- package/dist/eip712/sign-and-broadcast.d.ts +27 -3
- package/dist/high-level/cloid-lookup.d.ts +9 -0
- package/dist/high-level/create-client.d.ts +15 -11
- package/dist/high-level/tx/accountx.d.ts +3 -0
- package/dist/high-level/tx/agent.d.ts +1 -1
- package/dist/high-level/tx/clob.d.ts +1 -1
- package/dist/high-level/tx/context.d.ts +8 -0
- package/dist/high-level/tx/license.d.ts +1 -1
- package/dist/high-level/tx/miner.d.ts +1 -1
- package/dist/high-level/tx/reward.d.ts +1 -1
- package/dist/high-level/tx/staking.d.ts +1 -1
- package/dist/high-level/tx-executor.d.ts +23 -3
- package/dist/high-level/types.d.ts +356 -100
- package/dist/high-level-client.d.ts +1 -1
- package/dist/index.cjs +16101 -7908
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +15860 -7678
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/accountx/v1/genesis.d.ts +38 -0
- package/dist/proto/gen/ault/accountx/v1/params.d.ts +32 -0
- package/dist/proto/gen/ault/accountx/v1/query.d.ts +88 -0
- package/dist/proto/gen/ault/accountx/v1/tx.d.ts +52 -0
- package/dist/proto/gen/ault/agent/v1/tx.d.ts +4 -5
- package/dist/proto/gen/ault/authority/v1/authority.d.ts +2 -0
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +6 -5
- package/dist/proto/gen/ault/clob/v1/query.d.ts +14 -0
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +30 -3
- package/dist/proto/gen/ault/common/v1/system.d.ts +31 -0
- package/dist/proto/gen/ault/license/v1/genesis.d.ts +1 -26
- package/dist/proto/gen/ault/license/v1/license.d.ts +0 -26
- 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/systemtx/v1/genesis.d.ts +37 -0
- 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 -16
- package/dist/proto/gen/cosmos/bank/v1beta1/bank.d.ts +119 -0
- package/dist/proto/gen/cosmos/bank/v1beta1/query.d.ts +264 -0
- package/dist/proto/gen/cosmos/distribution/v1beta1/query.d.ts +203 -0
- package/dist/proto/gen/cosmos/query/v1/query.d.ts +1 -0
- package/dist/proto/gen/cosmos/staking/v1beta1/query.d.ts +275 -0
- package/dist/proto/gen/google/api/http.d.ts +20 -28
- package/dist/proto/gen/tendermint/abci/types.d.ts +23 -0
- package/dist/proto/tx-decode.d.ts +18 -0
- package/dist/rest/accountx.d.ts +8 -0
- package/dist/rest/bank.d.ts +15 -0
- package/dist/rest/clob.d.ts +9 -1
- package/dist/rest/context.d.ts +4 -4
- package/dist/rest/dex-types.generated.d.ts +363 -120
- package/dist/rest/dex.d.ts +6 -0
- package/dist/rest/dex.generated.d.ts +599 -83
- package/dist/rest/feemarket.d.ts +114 -0
- package/dist/rest/license.d.ts +21 -59
- package/dist/rest/miner.d.ts +16 -46
- package/dist/rest/portfolio.d.ts +103 -0
- package/dist/rest/staking.d.ts +14 -28
- package/dist/rest/tokenregistry.d.ts +3 -1
- package/dist/rest/types.d.ts +82 -858
- package/dist/utils/address.d.ts +2 -0
- package/dist/utils/opaque-id.d.ts +25 -0
- package/dist/utils/tx-hash.d.ts +1 -0
- package/dist/ws/client.d.ts +45 -5
- package/dist/ws/types.d.ts +377 -34
- package/package.json +2 -1
- package/dist/agent/create-agent-client.d.ts +0 -3
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { NetworkConfig } from "../core/network";
|
|
2
|
+
import type { ModifyOrderEntry } from "../core/clob-msgs";
|
|
2
3
|
import type { FetchWithRetryOptions, FetchFn } from "../core/http";
|
|
3
4
|
import type { AultClient } from "../client";
|
|
5
|
+
import type { ManifestResolver } from "../core/manifest-resolver";
|
|
6
|
+
import type { Manifest } from "../core/manifest-types";
|
|
7
|
+
import type { AccountxApi } from "../rest/accountx";
|
|
4
8
|
import type { AgentApi } from "../rest/agent";
|
|
5
9
|
import type { AuthorityApi, AuthorityRoleInput } from "../rest/authority";
|
|
10
|
+
import type { BankApi } from "../rest/bank";
|
|
6
11
|
import type { ClobApi } from "../rest/clob";
|
|
7
12
|
import type { LicenseApi } from "../rest/license";
|
|
8
13
|
import type { MarketApi } from "../rest/market";
|
|
@@ -11,9 +16,12 @@ import type { RateLimitApi } from "../rest/ratelimit";
|
|
|
11
16
|
import type { RewardApi } from "../rest/reward";
|
|
12
17
|
import type { StakingApi } from "../rest/staking";
|
|
13
18
|
import type { TokenRegistryApi } from "../rest/tokenregistry";
|
|
14
|
-
import type {
|
|
19
|
+
import type { OrderResponse as ChainOrderResponse } from "../proto/gen/ault/clob/v1/query";
|
|
20
|
+
import type { OrderResponse as DexOrderResponse } from "../rest/dex.generated";
|
|
21
|
+
import type { License } from "../proto/gen/ault/license/v1/license";
|
|
15
22
|
import type { Params as AgentParams } from "../proto/gen/ault/agent/v1/params";
|
|
16
23
|
import type { Role } from "../proto/gen/ault/authority/v1/authority";
|
|
24
|
+
import type { Params as AccountxParams } from "../proto/gen/ault/accountx/v1/params";
|
|
17
25
|
import type { Params as ClobParams } from "../proto/gen/ault/clob/v1/params";
|
|
18
26
|
import type { Params as LicenseChainParams } from "../proto/gen/ault/license/v1/license";
|
|
19
27
|
import type { Params as MarketParams } from "../proto/gen/ault/market/v1/params";
|
|
@@ -21,8 +29,9 @@ import type { MarketType } from "../proto/gen/ault/market/v1/market";
|
|
|
21
29
|
import type { Params as MinerChainParams } from "../proto/gen/ault/miner/v1/miner";
|
|
22
30
|
import type { Params as RateLimitParams } from "../proto/gen/ault/ratelimit/v1/params";
|
|
23
31
|
import type { Params as RewardParams } from "../proto/gen/ault/reward/v1/reward";
|
|
32
|
+
import type { TransferLimitConfig } from "../proto/gen/ault/tokenregistry/v1/tokenregistry";
|
|
24
33
|
import type { Any as ProtoAny } from "../proto/gen/google/protobuf/any";
|
|
25
|
-
import type {
|
|
34
|
+
import type { Coin } from "../proto/gen/cosmos/base/v1beta1/coin";
|
|
26
35
|
import type { Eip1193ProviderLike, EthersSignerLike, PrivySignTypedDataLike, SignerInput, ViemWalletLike } from "../eip712/signers";
|
|
27
36
|
import type { BigIntLike } from "../core/address";
|
|
28
37
|
export type { BigIntLike };
|
|
@@ -35,6 +44,7 @@ export type MarketUpdateInput = {
|
|
|
35
44
|
/** Common transaction options available on all methods */
|
|
36
45
|
export interface TxOptions {
|
|
37
46
|
gasLimit?: string;
|
|
47
|
+
feeDenom?: string;
|
|
38
48
|
feeAmount?: string;
|
|
39
49
|
memo?: string;
|
|
40
50
|
confirmationTimeoutMs?: number;
|
|
@@ -82,28 +92,106 @@ export interface ClientOptions {
|
|
|
82
92
|
defaultMemo?: string;
|
|
83
93
|
/** Optional: default time to wait for DeliverTx confirmation before returning a provisional result */
|
|
84
94
|
defaultConfirmationTimeoutMs?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Optional sparse manifest applied on top of the fetched manifest and the
|
|
97
|
+
* embedded baseline. Frozen for the lifetime of the client; not affected
|
|
98
|
+
* by background refreshes. The caller's reference is deep-cloned at
|
|
99
|
+
* construction so post-`createClient` mutation does not poison resolver
|
|
100
|
+
* state. Throws synchronously at `createClient` time if the value does not
|
|
101
|
+
* validate against `ManifestSchema`.
|
|
102
|
+
*/
|
|
103
|
+
manifestOverride?: Manifest;
|
|
85
104
|
}
|
|
86
105
|
/**
|
|
87
106
|
* Result of a transaction.
|
|
88
107
|
*/
|
|
89
108
|
export interface TxResult {
|
|
90
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Transaction hash in canonical SDK form: lower-case hex without a `0x`
|
|
111
|
+
* prefix (32 bytes = 64 hex characters). For Tendermint REST/CLI queries
|
|
112
|
+
* upper-case the value; for EVM JSON-RPC prefix it with `0x`.
|
|
113
|
+
*/
|
|
91
114
|
txHash: string;
|
|
92
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Result code (0 = success). On the values the CLOB order methods return,
|
|
117
|
+
* this is always `0`: broadcast-only sends report the accepted CheckTx code
|
|
118
|
+
* (`0`), and wait-mode sends only return on DeliverTx success (`0`).
|
|
119
|
+
* Non-success wait-mode outcomes throw rather than return, so the code never
|
|
120
|
+
* surfaces here. (Other callers that resolve on a poll timeout may still see
|
|
121
|
+
* `-1`.)
|
|
122
|
+
*/
|
|
93
123
|
code: number;
|
|
94
124
|
/** Raw log from the transaction */
|
|
95
125
|
rawLog?: string;
|
|
96
126
|
/**
|
|
97
127
|
* Whether the transaction outcome is definitively known.
|
|
98
|
-
* - `true` -- definitive result:
|
|
99
|
-
* - `false` --
|
|
128
|
+
* - `true` -- definitive result: DeliverTx result observed via polling (wait mode).
|
|
129
|
+
* - `false` -- either broadcast-only mode (CheckTx accepted, DeliverTx
|
|
130
|
+
* intentionally not awaited — the normal success case for `wait: false`),
|
|
131
|
+
* or a poll timeout where the outcome is unknown. Use txHash to query later.
|
|
100
132
|
* - `undefined` -- tx was broadcast but confirmation lookup was unavailable.
|
|
101
133
|
* The `code` field reflects the CheckTx result only.
|
|
102
134
|
*/
|
|
103
135
|
confirmed?: boolean;
|
|
104
136
|
/** Whether the transaction was definitively successful on-chain. */
|
|
105
137
|
success: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Decoded `msg_responses` from the committed tx (`tx_response.data`). Only
|
|
140
|
+
* populated when DeliverTx was awaited (`wait: true`); broadcast-only calls
|
|
141
|
+
* return before block inclusion and so carry no responses. Additive — does
|
|
142
|
+
* not change existing call shapes.
|
|
143
|
+
*/
|
|
144
|
+
msgResponses?: Array<{
|
|
145
|
+
typeUrl: string;
|
|
146
|
+
value: Uint8Array;
|
|
147
|
+
}>;
|
|
106
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Per-order broadcast flag. Order methods (`placeLimitOrder`, `placeMarketOrder`,
|
|
151
|
+
* `placeScaleOrder`, `cancelOrders`) default to broadcast-only (`wait: false`):
|
|
152
|
+
* they return once CheckTx accepts the tx, without polling for DeliverTx. Pass
|
|
153
|
+
* `wait: true` to poll for block inclusion and receive the rich result
|
|
154
|
+
* (`orderId`, etc.). A CheckTx rejection still throws in both modes.
|
|
155
|
+
*/
|
|
156
|
+
export interface OrderWaitOption {
|
|
157
|
+
/** Wait for DeliverTx (poll for inclusion) and return the rich result. Default `false`. */
|
|
158
|
+
wait?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** Limit/market order result when `wait: true`. `cloid` is hex, set only when the order carried one. */
|
|
161
|
+
export type PlaceOrderResult = TxResult & {
|
|
162
|
+
orderId: string;
|
|
163
|
+
cloid?: string;
|
|
164
|
+
escrowedAmount?: Coin;
|
|
165
|
+
};
|
|
166
|
+
/** Scale order result when `wait: true`. */
|
|
167
|
+
export type PlaceScaleOrderResult = TxResult & {
|
|
168
|
+
orders: Array<{
|
|
169
|
+
orderId: string;
|
|
170
|
+
price: string;
|
|
171
|
+
quantity: string;
|
|
172
|
+
}>;
|
|
173
|
+
escrowedAmount?: Coin;
|
|
174
|
+
};
|
|
175
|
+
/** Cancel result when `wait: true`. `succeeded`/`failed` are hex ids (8-byte cloid or 16-byte order id). */
|
|
176
|
+
export type CancelOrdersResult = TxResult & {
|
|
177
|
+
succeeded: string[];
|
|
178
|
+
failed: string[];
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Modify result when `wait: true`. Ids are 16-byte chain order ids in hex.
|
|
182
|
+
* `newOrderId` equals `oldOrderId` on an in-place amend, differs on a replace,
|
|
183
|
+
* and is absent when the chain canceled instead (new quantity at or below
|
|
184
|
+
* filled). `cloid` follows the order to its replacement. `failed` echoes the
|
|
185
|
+
* request's refs (8-byte cloid or 16-byte order id, hex).
|
|
186
|
+
*/
|
|
187
|
+
export type ModifyOrdersResult = TxResult & {
|
|
188
|
+
succeeded: Array<{
|
|
189
|
+
oldOrderId: string;
|
|
190
|
+
newOrderId?: string;
|
|
191
|
+
cloid?: string;
|
|
192
|
+
}>;
|
|
193
|
+
failed: string[];
|
|
194
|
+
};
|
|
107
195
|
export interface LicenseTxApi {
|
|
108
196
|
mintLicense(params: {
|
|
109
197
|
to: string;
|
|
@@ -206,7 +294,12 @@ export interface AgentTxApi {
|
|
|
206
294
|
approveAgent(params: {
|
|
207
295
|
agentPubkey: ProtoAny;
|
|
208
296
|
name?: string;
|
|
209
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Absolute time at which the agent authorization expires. When omitted
|
|
299
|
+
* the chain uses block_time + params.default_expiry; cannot exceed
|
|
300
|
+
* block_time + params.max_expiry.
|
|
301
|
+
*/
|
|
302
|
+
expiresAt?: Date;
|
|
210
303
|
} & TxOptions): Promise<TxResult>;
|
|
211
304
|
revokeAgent(params: {
|
|
212
305
|
agentAddress: string;
|
|
@@ -215,6 +308,27 @@ export interface AgentTxApi {
|
|
|
215
308
|
params: AgentParams;
|
|
216
309
|
} & TxOptions): Promise<TxResult>;
|
|
217
310
|
}
|
|
311
|
+
export interface AccountxTxApi {
|
|
312
|
+
/**
|
|
313
|
+
* Register an account for fee-free transactions on the chain. Required
|
|
314
|
+
* before any subsequent fee-free EIP-712 or agent tx; without it the
|
|
315
|
+
* chain rejects the next tx with
|
|
316
|
+
* "account is not opened for fee-free transactions".
|
|
317
|
+
*
|
|
318
|
+
* `account` defaults to the signer's own address. `feeDenom` selects the
|
|
319
|
+
* opening-fee denomination from the chain's `accountx.params.allowed_fees`
|
|
320
|
+
* list and is also used as the transaction fee denom for this call. The
|
|
321
|
+
* opening tx itself pays a real fee, so callers should pass the matching
|
|
322
|
+
* `feeAmount` from the selected allowed fee.
|
|
323
|
+
*/
|
|
324
|
+
openAccount(params: {
|
|
325
|
+
feeDenom: string;
|
|
326
|
+
account?: string;
|
|
327
|
+
} & TxOptions): Promise<TxResult>;
|
|
328
|
+
updateAccountxParams(params: {
|
|
329
|
+
params: AccountxParams;
|
|
330
|
+
} & TxOptions): Promise<TxResult>;
|
|
331
|
+
}
|
|
218
332
|
export interface AuthorityTxApi {
|
|
219
333
|
grantRole(params: {
|
|
220
334
|
role: AuthorityRoleInput;
|
|
@@ -247,41 +361,97 @@ export interface MarketTxApi {
|
|
|
247
361
|
params: MarketParams;
|
|
248
362
|
} & TxOptions): Promise<TxResult>;
|
|
249
363
|
}
|
|
364
|
+
export type LimitOrderParams = {
|
|
365
|
+
marketId: Uint8Array;
|
|
366
|
+
isBuy: boolean;
|
|
367
|
+
price: string;
|
|
368
|
+
quantity: string;
|
|
369
|
+
deadline: Date;
|
|
370
|
+
postOnly?: boolean;
|
|
371
|
+
builderAddress?: string;
|
|
372
|
+
builderFeeRate?: string;
|
|
373
|
+
/** Optional 8-byte client order id. Omitted from the signed payload when absent. */
|
|
374
|
+
cloid?: Uint8Array;
|
|
375
|
+
};
|
|
376
|
+
export type MarketOrderParams = {
|
|
377
|
+
marketId: Uint8Array;
|
|
378
|
+
isBuy: boolean;
|
|
379
|
+
deposit: string;
|
|
380
|
+
worstPrice?: string;
|
|
381
|
+
priceTolerance?: string;
|
|
382
|
+
builderAddress?: string;
|
|
383
|
+
builderFeeRate?: string;
|
|
384
|
+
/** Optional 8-byte client order id. Omitted from the signed payload when absent. */
|
|
385
|
+
cloid?: Uint8Array;
|
|
386
|
+
};
|
|
387
|
+
export type ScaleOrderParams = {
|
|
388
|
+
marketId: Uint8Array;
|
|
389
|
+
isBuy: boolean;
|
|
390
|
+
lowPrice: string;
|
|
391
|
+
highPrice: string;
|
|
392
|
+
totalQuantity: string;
|
|
393
|
+
weights: number[];
|
|
394
|
+
deadline: Date;
|
|
395
|
+
postOnly?: boolean;
|
|
396
|
+
builderAddress?: string;
|
|
397
|
+
builderFeeRate?: string;
|
|
398
|
+
};
|
|
399
|
+
/** Each entry may be an 8-byte cloid or a 16-byte chain order_id; the chain accepts both. */
|
|
400
|
+
export type CancelOrdersParams = {
|
|
401
|
+
orderIds: Uint8Array[];
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Batch order modification. Each `orderId` may be an 8-byte cloid or a 16-byte
|
|
405
|
+
* chain order id; at least one of `newPrice`/`newQuantity` must be set per
|
|
406
|
+
* entry, and an omitted field keeps the order's current value. Wallet (EIP-712)
|
|
407
|
+
* batches must be shape-uniform — every entry sets the same combination of
|
|
408
|
+
* fields; agent-signed batches (raw proto) have no such limit.
|
|
409
|
+
*/
|
|
410
|
+
export type ModifyOrdersParams = {
|
|
411
|
+
orders: ModifyOrderEntry[];
|
|
412
|
+
};
|
|
250
413
|
export interface ClobTxApi {
|
|
251
|
-
placeLimitOrder(params: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
} & TxOptions): Promise<
|
|
261
|
-
placeMarketOrder(params: {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
worstPrice?: string;
|
|
266
|
-
priceTolerance?: string;
|
|
267
|
-
builderAddress?: string;
|
|
268
|
-
builderFeeRate?: string;
|
|
269
|
-
} & TxOptions): Promise<TxResult>;
|
|
414
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
415
|
+
wait: true;
|
|
416
|
+
} & TxOptions): Promise<PlaceOrderResult>;
|
|
417
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
418
|
+
wait?: false;
|
|
419
|
+
} & TxOptions): Promise<TxResult>;
|
|
420
|
+
placeLimitOrder(params: LimitOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
421
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
422
|
+
wait: true;
|
|
423
|
+
} & TxOptions): Promise<PlaceOrderResult>;
|
|
424
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
425
|
+
wait?: false;
|
|
426
|
+
} & TxOptions): Promise<TxResult>;
|
|
427
|
+
placeMarketOrder(params: MarketOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
270
428
|
cancelOrders(params: {
|
|
271
429
|
orderIds: Uint8Array[];
|
|
430
|
+
} & {
|
|
431
|
+
wait: true;
|
|
432
|
+
} & TxOptions): Promise<CancelOrdersResult>;
|
|
433
|
+
cancelOrders(params: {
|
|
434
|
+
orderIds: Uint8Array[];
|
|
435
|
+
} & {
|
|
436
|
+
wait?: false;
|
|
272
437
|
} & TxOptions): Promise<TxResult>;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
438
|
+
cancelOrders(params: {
|
|
439
|
+
orderIds: Uint8Array[];
|
|
440
|
+
} & OrderWaitOption & TxOptions): Promise<TxResult | CancelOrdersResult>;
|
|
441
|
+
modifyOrders(params: ModifyOrdersParams & {
|
|
442
|
+
wait: true;
|
|
443
|
+
} & TxOptions): Promise<ModifyOrdersResult>;
|
|
444
|
+
modifyOrders(params: ModifyOrdersParams & {
|
|
445
|
+
wait?: false;
|
|
446
|
+
} & TxOptions): Promise<TxResult>;
|
|
447
|
+
modifyOrders(params: ModifyOrdersParams & OrderWaitOption & TxOptions): Promise<TxResult | ModifyOrdersResult>;
|
|
448
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
449
|
+
wait: true;
|
|
450
|
+
} & TxOptions): Promise<PlaceScaleOrderResult>;
|
|
451
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
452
|
+
wait?: false;
|
|
453
|
+
} & TxOptions): Promise<TxResult>;
|
|
454
|
+
placeScaleOrder(params: ScaleOrderParams & OrderWaitOption & TxOptions): Promise<TxResult | PlaceScaleOrderResult>;
|
|
285
455
|
updateClobParams(params: {
|
|
286
456
|
params: ClobParams;
|
|
287
457
|
} & TxOptions): Promise<TxResult>;
|
|
@@ -341,9 +511,20 @@ export interface StakingTxApi {
|
|
|
341
511
|
amount: string;
|
|
342
512
|
};
|
|
343
513
|
} & TxOptions): Promise<TxResult>;
|
|
514
|
+
/**
|
|
515
|
+
* Issues one `MsgWithdrawDelegatorReward` per validator as an independent,
|
|
516
|
+
* sequentially signed tx. The chain rejects EIP-712 transactions that pack
|
|
517
|
+
* multiple Cosmos messages (`sdk/18: expected exactly 1 message, got N`),
|
|
518
|
+
* so bundling is unsafe; each validator must travel in its own tx.
|
|
519
|
+
*
|
|
520
|
+
* On full success returns one `TxResult` per validator in the order the
|
|
521
|
+
* caller supplied them. If any tx fails, throws `WithdrawRewardsPartialError`
|
|
522
|
+
* carrying the validator that failed and the txs that already committed.
|
|
523
|
+
* Subsequent validators are not attempted.
|
|
524
|
+
*/
|
|
344
525
|
withdrawRewards(params: {
|
|
345
526
|
validatorAddresses: string[];
|
|
346
|
-
} & TxOptions): Promise<TxResult>;
|
|
527
|
+
} & TxOptions): Promise<TxResult[]>;
|
|
347
528
|
}
|
|
348
529
|
export interface TokenRegistryTxApi {
|
|
349
530
|
enableTokenRegistryTransfers(params?: TxOptions): Promise<TxResult>;
|
|
@@ -358,7 +539,16 @@ export interface TokenRegistryTxApi {
|
|
|
358
539
|
disableTokenPair(params: {
|
|
359
540
|
erc20Address: string;
|
|
360
541
|
} & TxOptions): Promise<TxResult>;
|
|
361
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Set the transfer rate limit for a registered token pair. `registerTokenPair`
|
|
544
|
+
* writes a zero (unlimited) config; this is the follow-up to tighten it.
|
|
545
|
+
*/
|
|
546
|
+
setTransferLimit(params: {
|
|
547
|
+
erc20Address: string;
|
|
548
|
+
transferLimit: TransferLimitConfig;
|
|
549
|
+
} & TxOptions): Promise<TxResult>;
|
|
550
|
+
/** Remove the transfer rate limit for a registered token pair. */
|
|
551
|
+
removeTransferLimit(params: {
|
|
362
552
|
erc20Address: string;
|
|
363
553
|
} & TxOptions): Promise<TxResult>;
|
|
364
554
|
}
|
|
@@ -383,19 +573,121 @@ export interface ParallelQueryApi {
|
|
|
383
573
|
getLicenseDelegationsParallel(licenseIds: string[]): Promise<LicenseDelegationStatus[]>;
|
|
384
574
|
analyzeLicenses(owner: string): Promise<LicenseAnalysis>;
|
|
385
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Result of a chain-first cloid lookup ({@link CloidLookupApi.findOrderByCloid}).
|
|
578
|
+
* The two read surfaces return different shapes, so the source is tagged:
|
|
579
|
+
*
|
|
580
|
+
* - `source: "chain"` — live order from the node's CLOB state; `order` is the chain
|
|
581
|
+
* proto {@link ChainOrderResponse}.
|
|
582
|
+
* - `source: "dex"` — chain had no live match, answered by the indexed dex-api;
|
|
583
|
+
* `order` is the dex REST {@link DexOrderResponse} DTO (`clientOrderId` is hex).
|
|
584
|
+
* - `source: "none"` — neither leg found an order for this cloid.
|
|
585
|
+
*/
|
|
586
|
+
export type CloidOrder = {
|
|
587
|
+
source: "chain";
|
|
588
|
+
order: ChainOrderResponse;
|
|
589
|
+
} | {
|
|
590
|
+
source: "dex";
|
|
591
|
+
order: DexOrderResponse;
|
|
592
|
+
} | {
|
|
593
|
+
source: "none";
|
|
594
|
+
order: null;
|
|
595
|
+
};
|
|
596
|
+
export interface CloidLookupApi {
|
|
597
|
+
/**
|
|
598
|
+
* Look up an order by its `(orderer, cloid)` pair, chain-first with a dex-api
|
|
599
|
+
* fallback. See {@link CloidOrder} for the tagged, source-dependent result shape.
|
|
600
|
+
*
|
|
601
|
+
* @param orderer Account address (bech32 or 0x-hex).
|
|
602
|
+
* @param cloid 8-byte client order id as raw bytes, or its bare-hex string form.
|
|
603
|
+
*/
|
|
604
|
+
findOrderByCloid(orderer: string, cloid: Uint8Array | string): Promise<CloidOrder>;
|
|
605
|
+
}
|
|
606
|
+
export interface AgentTxOptions extends TxOptions {
|
|
607
|
+
timeoutSeconds?: number;
|
|
608
|
+
}
|
|
609
|
+
export interface AgentClobTxApi {
|
|
610
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
611
|
+
wait: true;
|
|
612
|
+
} & AgentTxOptions): Promise<PlaceOrderResult>;
|
|
613
|
+
placeLimitOrder(params: LimitOrderParams & {
|
|
614
|
+
wait?: false;
|
|
615
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
616
|
+
placeLimitOrder(params: LimitOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
617
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
618
|
+
wait: true;
|
|
619
|
+
} & AgentTxOptions): Promise<PlaceOrderResult>;
|
|
620
|
+
placeMarketOrder(params: MarketOrderParams & {
|
|
621
|
+
wait?: false;
|
|
622
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
623
|
+
placeMarketOrder(params: MarketOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceOrderResult>;
|
|
624
|
+
cancelOrders(params: {
|
|
625
|
+
orderIds: Uint8Array[];
|
|
626
|
+
} & {
|
|
627
|
+
wait: true;
|
|
628
|
+
} & AgentTxOptions): Promise<CancelOrdersResult>;
|
|
629
|
+
cancelOrders(params: {
|
|
630
|
+
orderIds: Uint8Array[];
|
|
631
|
+
} & {
|
|
632
|
+
wait?: false;
|
|
633
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
634
|
+
cancelOrders(params: {
|
|
635
|
+
orderIds: Uint8Array[];
|
|
636
|
+
} & OrderWaitOption & AgentTxOptions): Promise<TxResult | CancelOrdersResult>;
|
|
637
|
+
modifyOrders(params: ModifyOrdersParams & {
|
|
638
|
+
wait: true;
|
|
639
|
+
} & AgentTxOptions): Promise<ModifyOrdersResult>;
|
|
640
|
+
modifyOrders(params: ModifyOrdersParams & {
|
|
641
|
+
wait?: false;
|
|
642
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
643
|
+
modifyOrders(params: ModifyOrdersParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | ModifyOrdersResult>;
|
|
644
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
645
|
+
wait: true;
|
|
646
|
+
} & AgentTxOptions): Promise<PlaceScaleOrderResult>;
|
|
647
|
+
placeScaleOrder(params: ScaleOrderParams & {
|
|
648
|
+
wait?: false;
|
|
649
|
+
} & AgentTxOptions): Promise<TxResult>;
|
|
650
|
+
placeScaleOrder(params: ScaleOrderParams & OrderWaitOption & AgentTxOptions): Promise<TxResult | PlaceScaleOrderResult>;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Agent identity + agent-signed CLOB tx surface attached to a `Client`.
|
|
654
|
+
* `client.asAgent` is non-null only after `client.attachAgent(...)`.
|
|
655
|
+
*/
|
|
656
|
+
export interface AgentSurface extends AgentClobTxApi {
|
|
657
|
+
/** Agent address (bech32). */
|
|
658
|
+
readonly address: string;
|
|
659
|
+
/** Master address — same as `client.address`. */
|
|
660
|
+
readonly masterAddress: string;
|
|
661
|
+
}
|
|
662
|
+
export interface AttachAgentOptions {
|
|
663
|
+
/** Hex-encoded agent private key (with or without `0x`). */
|
|
664
|
+
agentPrivateKey: string;
|
|
665
|
+
/** Optional default per-tx broadcast timeout. Default: `AGENT_DEFAULTS.TIMEOUT_SECONDS`. */
|
|
666
|
+
defaultTimeoutSeconds?: number;
|
|
667
|
+
/** Optional default gas limit for agent txs. Default: `AGENT_DEFAULTS.GAS_LIMIT`. */
|
|
668
|
+
defaultGasLimit?: string;
|
|
669
|
+
/** Optional default memo. */
|
|
670
|
+
defaultMemo?: string;
|
|
671
|
+
/** Optional confirmation polling timeout. */
|
|
672
|
+
defaultConfirmationTimeoutMs?: number;
|
|
673
|
+
}
|
|
386
674
|
/**
|
|
387
675
|
* High-level client interface for the Ault SDK.
|
|
388
676
|
* Provides simplified methods for common operations.
|
|
389
677
|
*/
|
|
390
|
-
export interface Client extends AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi {
|
|
678
|
+
export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi, CloidLookupApi {
|
|
391
679
|
/** Network configuration */
|
|
392
680
|
readonly network: NetworkConfig;
|
|
393
681
|
/** Signer address in Ault bech32 format */
|
|
394
682
|
readonly address: string;
|
|
683
|
+
/** Accountx module queries (fee-free account registration). */
|
|
684
|
+
readonly accountx: AccountxApi;
|
|
395
685
|
/** Agent module queries */
|
|
396
686
|
readonly agent: AgentApi;
|
|
397
687
|
/** Authority module queries */
|
|
398
688
|
readonly authority: AuthorityApi;
|
|
689
|
+
/** Bank module queries (proto-canonical Coin amounts as strings). */
|
|
690
|
+
readonly bank: BankApi;
|
|
399
691
|
/** CLOB module queries */
|
|
400
692
|
readonly clob: ClobApi;
|
|
401
693
|
/** License module queries */
|
|
@@ -412,66 +704,30 @@ export interface Client extends AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTx
|
|
|
412
704
|
readonly staking: StakingApi;
|
|
413
705
|
/** Token registry module queries */
|
|
414
706
|
readonly tokenregistry: TokenRegistryApi;
|
|
707
|
+
/**
|
|
708
|
+
* Agent-signed tx surface. Null until `attachAgent` is called; cleared by
|
|
709
|
+
* `detachAgent`. The reference changes on attach/detach — consumers
|
|
710
|
+
* caching the value should re-read after either call.
|
|
711
|
+
*/
|
|
712
|
+
asAgent: AgentSurface | null;
|
|
713
|
+
/**
|
|
714
|
+
* Attach an agent identity to this client. Replaces any previously attached
|
|
715
|
+
* agent. The new surface is also written to `client.asAgent`. Reuses the
|
|
716
|
+
* client's manifest resolver and master account-info cache, so no new
|
|
717
|
+
* manifest fetch or account RPC is issued.
|
|
718
|
+
*/
|
|
719
|
+
attachAgent(options: AttachAgentOptions): AgentSurface;
|
|
720
|
+
/** Detach the current agent identity. `client.asAgent` becomes null. No-op if no agent attached. */
|
|
721
|
+
detachAgent(): void;
|
|
415
722
|
/** Access to the underlying low-level client for advanced use cases. */
|
|
416
723
|
readonly _lowLevel: AultClient;
|
|
724
|
+
/** Access to the underlying manifest resolver. Stable, advanced use only. */
|
|
725
|
+
readonly _resolver: ManifestResolver;
|
|
726
|
+
/**
|
|
727
|
+
* Releases resources held by the client (background manifest refresh timer).
|
|
728
|
+
* Call this when the client is no longer needed (e.g. app teardown, signout)
|
|
729
|
+
* to avoid leaking timers in long-lived processes.
|
|
730
|
+
*/
|
|
731
|
+
dispose(): void;
|
|
417
732
|
}
|
|
418
733
|
export type { RewardParams, Role, ProtoAny };
|
|
419
|
-
export interface AgentClientOptions {
|
|
420
|
-
network: NetworkConfig;
|
|
421
|
-
masterAddress: string;
|
|
422
|
-
agentPrivateKey: string;
|
|
423
|
-
fetchFn?: FetchFn;
|
|
424
|
-
fetchOptions?: FetchWithRetryOptions;
|
|
425
|
-
defaultGasLimit?: string;
|
|
426
|
-
defaultMemo?: string;
|
|
427
|
-
defaultConfirmationTimeoutMs?: number;
|
|
428
|
-
defaultTimeoutSeconds?: number;
|
|
429
|
-
}
|
|
430
|
-
export interface AgentTxOptions extends TxOptions {
|
|
431
|
-
timeoutSeconds?: number;
|
|
432
|
-
}
|
|
433
|
-
export interface AgentClobTxApi {
|
|
434
|
-
placeLimitOrder(params: {
|
|
435
|
-
marketId: Uint8Array;
|
|
436
|
-
isBuy: boolean;
|
|
437
|
-
price: string;
|
|
438
|
-
quantity: string;
|
|
439
|
-
lifespan: Duration;
|
|
440
|
-
postOnly?: boolean;
|
|
441
|
-
builderAddress?: string;
|
|
442
|
-
builderFeeRate?: string;
|
|
443
|
-
} & AgentTxOptions): Promise<TxResult>;
|
|
444
|
-
placeMarketOrder(params: {
|
|
445
|
-
marketId: Uint8Array;
|
|
446
|
-
isBuy: boolean;
|
|
447
|
-
deposit: string;
|
|
448
|
-
worstPrice?: string;
|
|
449
|
-
priceTolerance?: string;
|
|
450
|
-
builderAddress?: string;
|
|
451
|
-
builderFeeRate?: string;
|
|
452
|
-
} & AgentTxOptions): Promise<TxResult>;
|
|
453
|
-
cancelOrders(params: {
|
|
454
|
-
orderIds: Uint8Array[];
|
|
455
|
-
} & AgentTxOptions): Promise<TxResult>;
|
|
456
|
-
placeScaleOrder(params: {
|
|
457
|
-
marketId: Uint8Array;
|
|
458
|
-
isBuy: boolean;
|
|
459
|
-
lowPrice: string;
|
|
460
|
-
highPrice: string;
|
|
461
|
-
totalQuantity: string;
|
|
462
|
-
weights: number[];
|
|
463
|
-
lifespan: Duration;
|
|
464
|
-
postOnly?: boolean;
|
|
465
|
-
builderAddress?: string;
|
|
466
|
-
builderFeeRate?: string;
|
|
467
|
-
} & AgentTxOptions): Promise<TxResult>;
|
|
468
|
-
}
|
|
469
|
-
export interface AgentClient extends AgentClobTxApi {
|
|
470
|
-
readonly network: NetworkConfig;
|
|
471
|
-
readonly masterAddress: string;
|
|
472
|
-
readonly agentAddress: string;
|
|
473
|
-
readonly agent: AgentApi;
|
|
474
|
-
readonly clob: ClobApi;
|
|
475
|
-
readonly market: MarketApi;
|
|
476
|
-
readonly _lowLevel: AultClient;
|
|
477
|
-
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { Client, ClientOptions, FlexibleSignerInput, TxResult } from "./high-level/types";
|
|
1
|
+
export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, TxOptions, OrderWaitOption, PlaceOrderResult, PlaceScaleOrderResult, CancelOrdersResult, ModifyOrdersParams, ModifyOrdersResult, CloidOrder, CloidLookupApi, } from "./high-level/types";
|
|
2
2
|
export { createClient } from "./high-level/create-client";
|