@symbiome-forge/cow-sdk-wasm 0.1.0-alpha.1
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 +674 -0
- package/README.md +278 -0
- package/dist/cloudflare/callbacks.cjs +2 -0
- package/dist/cloudflare/callbacks.d.ts +55 -0
- package/dist/cloudflare/callbacks.js +1 -0
- package/dist/cloudflare/envelope.cjs +2 -0
- package/dist/cloudflare/envelope.d.ts +5 -0
- package/dist/cloudflare/envelope.js +1 -0
- package/dist/cloudflare/errors.cjs +150 -0
- package/dist/cloudflare/errors.d.ts +82 -0
- package/dist/cloudflare/errors.js +145 -0
- package/dist/cloudflare/index.cjs +286 -0
- package/dist/cloudflare/index.d.ts +78 -0
- package/dist/cloudflare/index.js +1 -0
- package/dist/cloudflare/index.mjs +223 -0
- package/dist/cloudflare/internal.cjs +127 -0
- package/dist/cloudflare/internal.d.ts +40 -0
- package/dist/cloudflare/internal.js +115 -0
- package/dist/cloudflare/options.cjs +2 -0
- package/dist/cloudflare/options.d.ts +70 -0
- package/dist/cloudflare/options.js +1 -0
- package/dist/cloudflare/raw/cloudflare.cjs +65 -0
- package/dist/cloudflare/raw/cloudflare.d.ts +30 -0
- package/dist/cloudflare/raw/cloudflare.js +29 -0
- package/dist/default/callbacks.cjs +2 -0
- package/dist/default/callbacks.d.ts +55 -0
- package/dist/default/callbacks.js +1 -0
- package/dist/default/envelope.cjs +2 -0
- package/dist/default/envelope.d.ts +5 -0
- package/dist/default/envelope.js +1 -0
- package/dist/default/errors.cjs +150 -0
- package/dist/default/errors.d.ts +82 -0
- package/dist/default/errors.js +145 -0
- package/dist/default/index.cjs +359 -0
- package/dist/default/index.d.ts +94 -0
- package/dist/default/index.js +1 -0
- package/dist/default/index.mjs +295 -0
- package/dist/default/internal.cjs +127 -0
- package/dist/default/internal.d.ts +40 -0
- package/dist/default/internal.js +115 -0
- package/dist/default/options.cjs +2 -0
- package/dist/default/options.d.ts +70 -0
- package/dist/default/options.js +1 -0
- package/dist/default/raw/default.cjs +66 -0
- package/dist/default/raw/default.d.ts +31 -0
- package/dist/default/raw/default.js +30 -0
- package/dist/orderbook/callbacks.cjs +2 -0
- package/dist/orderbook/callbacks.d.ts +55 -0
- package/dist/orderbook/callbacks.js +1 -0
- package/dist/orderbook/envelope.cjs +2 -0
- package/dist/orderbook/envelope.d.ts +5 -0
- package/dist/orderbook/envelope.js +1 -0
- package/dist/orderbook/errors.cjs +150 -0
- package/dist/orderbook/errors.d.ts +82 -0
- package/dist/orderbook/errors.js +145 -0
- package/dist/orderbook/index.cjs +195 -0
- package/dist/orderbook/index.d.ts +57 -0
- package/dist/orderbook/index.js +1 -0
- package/dist/orderbook/index.mjs +139 -0
- package/dist/orderbook/internal.cjs +127 -0
- package/dist/orderbook/internal.d.ts +40 -0
- package/dist/orderbook/internal.js +115 -0
- package/dist/orderbook/options.cjs +2 -0
- package/dist/orderbook/options.d.ts +70 -0
- package/dist/orderbook/options.js +1 -0
- package/dist/orderbook/raw/orderbook.cjs +58 -0
- package/dist/orderbook/raw/orderbook.d.ts +23 -0
- package/dist/orderbook/raw/orderbook.js +22 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm.d.ts +2870 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm.js +2183 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm_bg.wasm.d.ts +65 -0
- package/dist/raw/default-bundler/cow_sdk_wasm.d.ts +2916 -0
- package/dist/raw/default-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.js +2297 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm.d.ts +75 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm.cjs +2330 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm.d.ts +2916 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm_bg.wasm.d.ts +75 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm.d.ts +1876 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.js +1636 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm.d.ts +50 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm.cjs +1661 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm.d.ts +1876 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm_bg.wasm.d.ts +50 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm.d.ts +774 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.js +1059 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm.d.ts +27 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm.cjs +1078 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm.d.ts +774 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm_bg.wasm.d.ts +27 -0
- package/dist/signing/callbacks.cjs +2 -0
- package/dist/signing/callbacks.d.ts +55 -0
- package/dist/signing/callbacks.js +1 -0
- package/dist/signing/envelope.cjs +2 -0
- package/dist/signing/envelope.d.ts +5 -0
- package/dist/signing/envelope.js +1 -0
- package/dist/signing/errors.cjs +150 -0
- package/dist/signing/errors.d.ts +82 -0
- package/dist/signing/errors.js +145 -0
- package/dist/signing/index.cjs +93 -0
- package/dist/signing/index.d.ts +23 -0
- package/dist/signing/index.js +1 -0
- package/dist/signing/index.mjs +44 -0
- package/dist/signing/internal.cjs +127 -0
- package/dist/signing/internal.d.ts +40 -0
- package/dist/signing/internal.js +115 -0
- package/dist/signing/options.cjs +2 -0
- package/dist/signing/options.d.ts +70 -0
- package/dist/signing/options.js +1 -0
- package/dist/signing/raw/signing.cjs +52 -0
- package/dist/signing/raw/signing.d.ts +17 -0
- package/dist/signing/raw/signing.js +16 -0
- package/package.json +112 -0
|
@@ -0,0 +1,2916 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
export interface IpfsClientConfig {
|
|
6
|
+
ipfsUri?: string | null;
|
|
7
|
+
transport?: HttpTransportConfig;
|
|
8
|
+
transportPolicy?: TransportPolicyConfig | null;
|
|
9
|
+
timeoutMs?: number | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export interface OrderBookClientConfig {
|
|
15
|
+
chainId: number;
|
|
16
|
+
env?: string | null;
|
|
17
|
+
apiKey?: string | null;
|
|
18
|
+
transport?: HttpTransportConfig;
|
|
19
|
+
transportPolicy?: TransportPolicyConfig | null;
|
|
20
|
+
timeoutMs?: number | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export interface SubgraphClientConfig {
|
|
26
|
+
chainId: number;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
transport?: HttpTransportConfig;
|
|
29
|
+
transportPolicy?: TransportPolicyConfig | null;
|
|
30
|
+
timeoutMs?: number | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export interface TradingClientConfig {
|
|
36
|
+
chainId: number;
|
|
37
|
+
env?: string | null;
|
|
38
|
+
appCode: string;
|
|
39
|
+
apiKey?: string | null;
|
|
40
|
+
transport?: HttpTransportConfig;
|
|
41
|
+
transportPolicy?: TransportPolicyConfig | null;
|
|
42
|
+
timeoutMs?: number | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
export interface WalletConfig {
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SigningOptions extends SdkClientOptions {
|
|
52
|
+
walletConfig?: WalletConfig;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type TypedDataSignerCallback = (
|
|
56
|
+
envelope: TypedDataEnvelopeDto,
|
|
57
|
+
) => Promise<string> | string;
|
|
58
|
+
|
|
59
|
+
export type Eip1193RequestCallback = (
|
|
60
|
+
request: { method: string; params?: unknown[] },
|
|
61
|
+
) => Promise<unknown> | unknown;
|
|
62
|
+
|
|
63
|
+
export type DigestSignerCallback = (
|
|
64
|
+
digest: string,
|
|
65
|
+
) => Promise<string> | string;
|
|
66
|
+
|
|
67
|
+
export type CowEip1271SignCallback = (
|
|
68
|
+
request: CowEip1271SignRequest,
|
|
69
|
+
) => Promise<string> | string;
|
|
70
|
+
|
|
71
|
+
export type CustomEip1271Callback = CowEip1271SignCallback;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export type ContractReadCallback = (
|
|
76
|
+
request: ContractCallDto,
|
|
77
|
+
) => Promise<string> | string;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
export type CowFetchMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
82
|
+
|
|
83
|
+
export interface CowFetchRequest {
|
|
84
|
+
method: CowFetchMethod;
|
|
85
|
+
url: string;
|
|
86
|
+
headers: Record<string, string>;
|
|
87
|
+
body?: string;
|
|
88
|
+
timeoutMs?: number;
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface CowFetchResponse {
|
|
93
|
+
status: number;
|
|
94
|
+
statusText?: string;
|
|
95
|
+
headers?: Record<string, string>;
|
|
96
|
+
body?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type CowFetchCallback = (
|
|
100
|
+
request: CowFetchRequest,
|
|
101
|
+
) => Promise<CowFetchResponse> | CowFetchResponse;
|
|
102
|
+
|
|
103
|
+
export type HttpTransportConfig =
|
|
104
|
+
| { kind: "callback"; callback: CowFetchCallback };
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
export type Value = unknown;
|
|
109
|
+
export type CowError = WasmError;
|
|
110
|
+
|
|
111
|
+
export interface SdkClientOptions {
|
|
112
|
+
timeoutMs?: number;
|
|
113
|
+
signal?: AbortSignal;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* A decoded `GPv2Settlement` (or inherited `GPv2Signing`) event.
|
|
119
|
+
*
|
|
120
|
+
* Mirrors `cow_sdk_contracts::SettlementEvent`. Addresses and the order UID
|
|
121
|
+
* are lowercase `0x`-prefixed hex; amounts are base-10 atom strings; the
|
|
122
|
+
* interaction `selector` is a `0x`-prefixed 4-byte hex string. The `kind`
|
|
123
|
+
* discriminator distinguishes the variants.
|
|
124
|
+
*/
|
|
125
|
+
export type SettlementEventDto = { kind: "trade"; owner: string; sellToken: string; buyToken: string; sellAmount: string; buyAmount: string; feeAmount: string; orderUid: string } | { kind: "interaction"; target: string; value: string; selector: string } | { kind: "settlement"; solver: string } | { kind: "orderInvalidated"; owner: string; orderUid: string } | { kind: "preSignature"; owner: string; orderUid: string; signed: boolean };
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A decoded eth-flow on-chain order lifecycle event.
|
|
129
|
+
*
|
|
130
|
+
* Mirrors `cow_sdk_contracts::EthFlowEvent`. The placement `order` reuses the
|
|
131
|
+
* canonical [`OrderInput`] shape (its `validTo` is the on-chain clamped value;
|
|
132
|
+
* the trader\'s real expiry travels in the opaque `data` trailer). `signature`
|
|
133
|
+
* and `data` are `0x`-prefixed hex strings carrying the raw on-chain signature
|
|
134
|
+
* payload and the opaque trailing data field; addresses and the order UID are
|
|
135
|
+
* lowercase `0x`-prefixed hex. The `kind` discriminator distinguishes the
|
|
136
|
+
* variants.
|
|
137
|
+
*/
|
|
138
|
+
export type EthFlowEventDto = { kind: "orderPlacement"; sender: string; order: OrderInput; signingScheme: string; signature: string; data: string } | { kind: "orderInvalidation"; orderUid: string } | { kind: "orderRefund"; orderUid: string; refunder: string };
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A single pre/post interaction attached to an order, mirroring
|
|
142
|
+
* `cow_sdk_orderbook::InteractionData`.
|
|
143
|
+
*/
|
|
144
|
+
export interface InteractionDataDto {
|
|
145
|
+
/**
|
|
146
|
+
* Contract address targeted by the interaction.
|
|
147
|
+
*/
|
|
148
|
+
target: string;
|
|
149
|
+
/**
|
|
150
|
+
* Native token value sent with the interaction.
|
|
151
|
+
*/
|
|
152
|
+
value: string;
|
|
153
|
+
/**
|
|
154
|
+
* Hex-encoded calldata forwarded to `target`.
|
|
155
|
+
*/
|
|
156
|
+
callData: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Allowance helper parameters.
|
|
161
|
+
*/
|
|
162
|
+
export interface AllowanceParametersInput {
|
|
163
|
+
/**
|
|
164
|
+
* ERC-20 token address.
|
|
165
|
+
*/
|
|
166
|
+
tokenAddress: string;
|
|
167
|
+
/**
|
|
168
|
+
* Owner whose allowance should be inspected.
|
|
169
|
+
*/
|
|
170
|
+
owner: string;
|
|
171
|
+
/**
|
|
172
|
+
* Optional chain-id override.
|
|
173
|
+
*/
|
|
174
|
+
chainId?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Optional environment override.
|
|
177
|
+
*/
|
|
178
|
+
env?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Optional vault-relayer deployment override.
|
|
181
|
+
*/
|
|
182
|
+
vaultRelayerOverride?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* App-data document input.
|
|
187
|
+
*/
|
|
188
|
+
export interface AppDataDocInput {
|
|
189
|
+
/**
|
|
190
|
+
* Application code.
|
|
191
|
+
*/
|
|
192
|
+
appCode: string;
|
|
193
|
+
/**
|
|
194
|
+
* Metadata object.
|
|
195
|
+
*/
|
|
196
|
+
metadata: Value;
|
|
197
|
+
/**
|
|
198
|
+
* Schema version.
|
|
199
|
+
*/
|
|
200
|
+
version: string;
|
|
201
|
+
/**
|
|
202
|
+
* Optional environment label.
|
|
203
|
+
*/
|
|
204
|
+
environment?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* App-data document output.
|
|
209
|
+
*/
|
|
210
|
+
export interface AppDataDocDto {
|
|
211
|
+
/**
|
|
212
|
+
* App-data document.
|
|
213
|
+
*/
|
|
214
|
+
document: Value;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* App-data document, serialized payload, and digest used by the quote flow,
|
|
219
|
+
* mirroring `cow_sdk_trading::TradingAppDataInfo`.
|
|
220
|
+
*/
|
|
221
|
+
export interface TradingAppDataInfoDto {
|
|
222
|
+
/**
|
|
223
|
+
* Parsed app-data document (arbitrary JSON).
|
|
224
|
+
*/
|
|
225
|
+
doc: Value;
|
|
226
|
+
/**
|
|
227
|
+
* Canonically serialized app-data payload.
|
|
228
|
+
*/
|
|
229
|
+
fullAppData: string;
|
|
230
|
+
/**
|
|
231
|
+
* Keccak-256 digest used in protocol order payloads.
|
|
232
|
+
*/
|
|
233
|
+
appDataKeccak256: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* App-data info output.
|
|
238
|
+
*/
|
|
239
|
+
export interface AppDataInfoDto {
|
|
240
|
+
/**
|
|
241
|
+
* CID representation.
|
|
242
|
+
*/
|
|
243
|
+
cid: string;
|
|
244
|
+
/**
|
|
245
|
+
* Deterministic app-data content.
|
|
246
|
+
*/
|
|
247
|
+
appDataContent: string;
|
|
248
|
+
/**
|
|
249
|
+
* App-data hash.
|
|
250
|
+
*/
|
|
251
|
+
appDataHex: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* App-data validation result.
|
|
256
|
+
*/
|
|
257
|
+
export interface ValidationResultDto {
|
|
258
|
+
/**
|
|
259
|
+
* Whether validation succeeded.
|
|
260
|
+
*/
|
|
261
|
+
success: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Errors when validation failed.
|
|
264
|
+
*/
|
|
265
|
+
errors?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Approval-transaction helper parameters.
|
|
270
|
+
*
|
|
271
|
+
* The chain and environment are taken from the `TradingClient`, matching the
|
|
272
|
+
* other transaction builders; only the token, amount, and an optional
|
|
273
|
+
* vault-relayer deployment override are supplied per call.
|
|
274
|
+
*/
|
|
275
|
+
export interface ApprovalParametersInput {
|
|
276
|
+
/**
|
|
277
|
+
* ERC-20 token address to approve.
|
|
278
|
+
*/
|
|
279
|
+
tokenAddress: string;
|
|
280
|
+
/**
|
|
281
|
+
* Approval amount as a base-unit decimal string.
|
|
282
|
+
*/
|
|
283
|
+
amount: string;
|
|
284
|
+
/**
|
|
285
|
+
* Optional vault-relayer deployment override.
|
|
286
|
+
*/
|
|
287
|
+
vaultRelayerOverride?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Coarse, switchable classification of an orderbook rejection, mirrored for
|
|
292
|
+
* the JS error surface.
|
|
293
|
+
*
|
|
294
|
+
* A consumer can branch on the action a rejection calls for — fix the
|
|
295
|
+
* request, fund the wallet, re-quote, wait, or escalate — without matching
|
|
296
|
+
* every wire tag. The category carries no message or code, so it never
|
|
297
|
+
* re-exposes redacted rejection text.
|
|
298
|
+
*/
|
|
299
|
+
export type OrderBookRejectionCategoryDto = "authorization" | "insufficientFunds" | "invalidOrder" | "notFound" | "conflict" | "unfulfillable" | "server" | "__unknown";
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Competition status for an order, mirroring
|
|
303
|
+
* `cow_sdk_orderbook::CompetitionOrderStatus`.
|
|
304
|
+
*/
|
|
305
|
+
export interface CompetitionOrderStatusDto {
|
|
306
|
+
/**
|
|
307
|
+
* High-level competition status kind (the wire `type` field).
|
|
308
|
+
*/
|
|
309
|
+
type: CompetitionOrderStatusKindDto;
|
|
310
|
+
/**
|
|
311
|
+
* Optional solver execution payload.
|
|
312
|
+
*/
|
|
313
|
+
value?: SolverExecutionDto[];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Competition-status kind for an order, mirroring
|
|
318
|
+
* `cow_sdk_orderbook::CompetitionOrderStatusKind`, whose wire form is the
|
|
319
|
+
* camelCased variant name.
|
|
320
|
+
*/
|
|
321
|
+
export type CompetitionOrderStatusKindDto = "open" | "scheduled" | "active" | "solved" | "executing" | "traded" | "cancelled";
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Contract-read callback request.
|
|
325
|
+
*/
|
|
326
|
+
export interface ContractCallDto {
|
|
327
|
+
/**
|
|
328
|
+
* Target contract address.
|
|
329
|
+
*/
|
|
330
|
+
address: string;
|
|
331
|
+
/**
|
|
332
|
+
* ABI method name.
|
|
333
|
+
*/
|
|
334
|
+
method: string;
|
|
335
|
+
/**
|
|
336
|
+
* JSON ABI fragment.
|
|
337
|
+
*/
|
|
338
|
+
abiJson: string;
|
|
339
|
+
/**
|
|
340
|
+
* JSON-encoded function arguments.
|
|
341
|
+
*/
|
|
342
|
+
argsJson: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Custom EIP-1271 callback request.
|
|
347
|
+
*/
|
|
348
|
+
export interface CowEip1271SignRequest {
|
|
349
|
+
/**
|
|
350
|
+
* Original order input.
|
|
351
|
+
*/
|
|
352
|
+
order: OrderInput;
|
|
353
|
+
/**
|
|
354
|
+
* Typed-data envelope.
|
|
355
|
+
*/
|
|
356
|
+
typedData: TypedDataEnvelopeDto;
|
|
357
|
+
/**
|
|
358
|
+
* Owner or smart-account address.
|
|
359
|
+
*/
|
|
360
|
+
owner: string;
|
|
361
|
+
/**
|
|
362
|
+
* Numeric chain id.
|
|
363
|
+
*/
|
|
364
|
+
chainId: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Deployment address output.
|
|
369
|
+
*/
|
|
370
|
+
export interface DeploymentAddressesDto {
|
|
371
|
+
/**
|
|
372
|
+
* Settlement contract.
|
|
373
|
+
*/
|
|
374
|
+
settlement: string;
|
|
375
|
+
/**
|
|
376
|
+
* Vault relayer contract.
|
|
377
|
+
*/
|
|
378
|
+
vaultRelayer: string;
|
|
379
|
+
/**
|
|
380
|
+
* EthFlow contract.
|
|
381
|
+
*/
|
|
382
|
+
ethFlow: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* EIP-1193 request DTO.
|
|
387
|
+
*/
|
|
388
|
+
export interface Eip1193Request {
|
|
389
|
+
/**
|
|
390
|
+
* Provider method.
|
|
391
|
+
*/
|
|
392
|
+
method: string;
|
|
393
|
+
/**
|
|
394
|
+
* Provider params.
|
|
395
|
+
*/
|
|
396
|
+
params?: Value[];
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Effective trade parameters after SDK defaults and advanced settings were
|
|
401
|
+
* applied, mirroring `cow_sdk_trading::TradeParams`.
|
|
402
|
+
*/
|
|
403
|
+
export interface TradeParametersDto {
|
|
404
|
+
/**
|
|
405
|
+
* Order side.
|
|
406
|
+
*/
|
|
407
|
+
kind: OrderKindDto;
|
|
408
|
+
/**
|
|
409
|
+
* Optional owner override.
|
|
410
|
+
*/
|
|
411
|
+
owner?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Sell-token address.
|
|
414
|
+
*/
|
|
415
|
+
sellToken: string;
|
|
416
|
+
/**
|
|
417
|
+
* Buy-token address.
|
|
418
|
+
*/
|
|
419
|
+
buyToken: string;
|
|
420
|
+
/**
|
|
421
|
+
* Amount interpreted according to `kind`.
|
|
422
|
+
*/
|
|
423
|
+
amount: string;
|
|
424
|
+
/**
|
|
425
|
+
* Optional environment override.
|
|
426
|
+
*/
|
|
427
|
+
env?: CowEnvDto;
|
|
428
|
+
/**
|
|
429
|
+
* Optional settlement-contract overrides keyed by chain id. Typed as
|
|
430
|
+
* `Record` rather than `Map` for runtime alignment (the wire form is a
|
|
431
|
+
* plain JSON object).
|
|
432
|
+
*/
|
|
433
|
+
settlementContractOverride?: Record<string, string>;
|
|
434
|
+
/**
|
|
435
|
+
* Optional `EthFlow`-contract overrides keyed by chain id.
|
|
436
|
+
*/
|
|
437
|
+
ethFlowContractOverride?: Record<string, string>;
|
|
438
|
+
/**
|
|
439
|
+
* Whether partial fills are allowed.
|
|
440
|
+
*/
|
|
441
|
+
partiallyFillable: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Sell-token balance source.
|
|
444
|
+
*/
|
|
445
|
+
sellTokenBalance: TokenBalanceDto;
|
|
446
|
+
/**
|
|
447
|
+
* Buy-token balance destination.
|
|
448
|
+
*/
|
|
449
|
+
buyTokenBalance: TokenBalanceDto;
|
|
450
|
+
/**
|
|
451
|
+
* Optional explicit slippage tolerance in basis points.
|
|
452
|
+
*/
|
|
453
|
+
slippageBps?: number;
|
|
454
|
+
/**
|
|
455
|
+
* Optional receiver override.
|
|
456
|
+
*/
|
|
457
|
+
receiver?: string;
|
|
458
|
+
/**
|
|
459
|
+
* Optional relative validity duration in seconds.
|
|
460
|
+
*/
|
|
461
|
+
validFor?: number;
|
|
462
|
+
/**
|
|
463
|
+
* Optional absolute UNIX expiry timestamp.
|
|
464
|
+
*/
|
|
465
|
+
validTo?: number;
|
|
466
|
+
/**
|
|
467
|
+
* Optional partner-fee metadata.
|
|
468
|
+
*/
|
|
469
|
+
partnerFee?: PartnerFeeDto;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Executed protocol-fee component of a trade, mirroring
|
|
474
|
+
* `cow_sdk_orderbook::ExecutedProtocolFee`.
|
|
475
|
+
*/
|
|
476
|
+
export interface ExecutedProtocolFeeDto {
|
|
477
|
+
/**
|
|
478
|
+
* Fee policy that produced this fee, when services returns it (arbitrary
|
|
479
|
+
* JSON mirroring the upstream policy shape).
|
|
480
|
+
*/
|
|
481
|
+
policy?: Value;
|
|
482
|
+
/**
|
|
483
|
+
* Fee amount taken.
|
|
484
|
+
*/
|
|
485
|
+
amount?: string;
|
|
486
|
+
/**
|
|
487
|
+
* Token in which the fee was taken.
|
|
488
|
+
*/
|
|
489
|
+
token?: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Executed sell and buy amounts for a solver path, mirroring
|
|
494
|
+
* `cow_sdk_orderbook::ExecutedAmounts`.
|
|
495
|
+
*/
|
|
496
|
+
export interface ExecutedAmountsDto {
|
|
497
|
+
/**
|
|
498
|
+
* Executed sell amount in the upstream decimal-string wire shape.
|
|
499
|
+
*/
|
|
500
|
+
sell: string;
|
|
501
|
+
/**
|
|
502
|
+
* Executed buy amount in the upstream decimal-string wire shape.
|
|
503
|
+
*/
|
|
504
|
+
buy: string;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Explicit raw GraphQL query input.
|
|
509
|
+
*/
|
|
510
|
+
export interface SubgraphQueryInput {
|
|
511
|
+
/**
|
|
512
|
+
* Raw GraphQL document.
|
|
513
|
+
*/
|
|
514
|
+
query: string;
|
|
515
|
+
/**
|
|
516
|
+
* Optional GraphQL variables.
|
|
517
|
+
*/
|
|
518
|
+
variables?: Value;
|
|
519
|
+
/**
|
|
520
|
+
* Optional operation name.
|
|
521
|
+
*/
|
|
522
|
+
operationName?: string;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Fee component represented by an amount and a basis-point value.
|
|
527
|
+
*/
|
|
528
|
+
export interface FeeComponentDto {
|
|
529
|
+
/**
|
|
530
|
+
* Fee amount.
|
|
531
|
+
*/
|
|
532
|
+
amount: string;
|
|
533
|
+
/**
|
|
534
|
+
* Fee in basis points.
|
|
535
|
+
*/
|
|
536
|
+
bps: number;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Full app-data document returned by the orderbook app-data endpoint.
|
|
541
|
+
*/
|
|
542
|
+
export interface AppDataObjectDto {
|
|
543
|
+
/**
|
|
544
|
+
* Full serialized app-data payload.
|
|
545
|
+
*/
|
|
546
|
+
fullAppData: string;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Full quote cost breakdown.
|
|
551
|
+
*/
|
|
552
|
+
export interface CostsDto {
|
|
553
|
+
/**
|
|
554
|
+
* Network-fee component.
|
|
555
|
+
*/
|
|
556
|
+
networkFee: NetworkFeeDto;
|
|
557
|
+
/**
|
|
558
|
+
* Partner-fee component.
|
|
559
|
+
*/
|
|
560
|
+
partnerFee: FeeComponentDto;
|
|
561
|
+
/**
|
|
562
|
+
* Protocol-fee component.
|
|
563
|
+
*/
|
|
564
|
+
protocolFee: FeeComponentDto;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Fully resolved quote result produced by trading quote helpers, mirroring
|
|
569
|
+
* `cow_sdk_trading::QuoteResults`.
|
|
570
|
+
*
|
|
571
|
+
* Returned by `getQuote` and accepted by `postSwapOrderFromQuote` unchanged.
|
|
572
|
+
*/
|
|
573
|
+
export interface QuoteResultsDto {
|
|
574
|
+
/**
|
|
575
|
+
* Effective trade parameters after SDK defaults and advanced settings.
|
|
576
|
+
*/
|
|
577
|
+
tradeParameters: TradeParametersDto;
|
|
578
|
+
/**
|
|
579
|
+
* Suggested slippage in basis points after resolution.
|
|
580
|
+
*/
|
|
581
|
+
suggestedSlippageBps: number;
|
|
582
|
+
/**
|
|
583
|
+
* Fee and amount breakdown derived from the orderbook quote.
|
|
584
|
+
*/
|
|
585
|
+
amountsAndCosts: QuoteAmountsAndCostsDto;
|
|
586
|
+
/**
|
|
587
|
+
* Unsigned order payload produced for signing or on-chain submission.
|
|
588
|
+
*/
|
|
589
|
+
orderToSign: OrderDataDto;
|
|
590
|
+
/**
|
|
591
|
+
* Raw orderbook quote response.
|
|
592
|
+
*/
|
|
593
|
+
quoteResponse: OrderQuoteResponseDto;
|
|
594
|
+
/**
|
|
595
|
+
* App-data document, serialized payload, and digest used by the quote flow.
|
|
596
|
+
*/
|
|
597
|
+
appDataInfo: TradingAppDataInfoDto;
|
|
598
|
+
/**
|
|
599
|
+
* Originating orderbook runtime binding captured by the quote flow.
|
|
600
|
+
*/
|
|
601
|
+
orderbookBinding?: OrderBookRuntimeBindingDto;
|
|
602
|
+
/**
|
|
603
|
+
* Typed order-facing EIP-712 envelope kept for consumers.
|
|
604
|
+
*/
|
|
605
|
+
orderTypedData: TypedDataEnvelopeDto;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Generated order UID output.
|
|
610
|
+
*/
|
|
611
|
+
export interface GeneratedOrderUidDto {
|
|
612
|
+
/**
|
|
613
|
+
* Compact order UID.
|
|
614
|
+
*/
|
|
615
|
+
orderUid: string;
|
|
616
|
+
/**
|
|
617
|
+
* Underlying order digest.
|
|
618
|
+
*/
|
|
619
|
+
orderDigest: string;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Generic validated 32-byte hash wrapper for user-domain and contract surfaces.
|
|
624
|
+
*
|
|
625
|
+
* The wire form is the protocol-canonical `0x`-prefixed 66-character
|
|
626
|
+
* lowercase hexadecimal string. The newtype is `#[repr(transparent)]` over
|
|
627
|
+
* [`alloy_primitives::B256`] and forwards `Display`/`Serialize`/
|
|
628
|
+
* `Deserialize` to the inner alloy type, whose canonical defaults already
|
|
629
|
+
* emit the cow lowercase wire form.
|
|
630
|
+
*/
|
|
631
|
+
export type Hash32 = string;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* JS-visible typed error envelope for every wasm export.
|
|
635
|
+
*/
|
|
636
|
+
export type WasmError = { kind: "invalidInput"; schemaVersion: SchemaVersion; message: string; field?: string } | { kind: "unknownEnumValue"; schemaVersion: SchemaVersion; message: string; field: string; value: string } | { kind: "unsupportedChain"; schemaVersion: SchemaVersion; message: string; chainId: number } | { kind: "walletRequest"; schemaVersion: SchemaVersion; method: string; code?: number; message: string } | { kind: "walletTimeout"; schemaVersion: SchemaVersion; message: string; timeoutMs: number } | { kind: "transport"; schemaVersion: SchemaVersion; class: string; message: string; status?: number; headers?: [string, string][]; body?: string } | { kind: "orderbook"; schemaVersion: SchemaVersion; code?: string; category?: OrderBookRejectionCategoryDto; message: string; retryable?: boolean; retryAfterMs?: number } | { kind: "subgraph"; schemaVersion: SchemaVersion; message: string } | { kind: "signing"; schemaVersion: SchemaVersion; message: string } | { kind: "appData"; schemaVersion: SchemaVersion; class?: string; message: string } | { kind: "cancelled"; schemaVersion: SchemaVersion; message: string } | { kind: "internal"; schemaVersion: SchemaVersion; message: string } | { kind: "__unknown"; schemaVersion: SchemaVersion; message: string; raw: Value };
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Jitter strategy accepted by JS client constructors.
|
|
640
|
+
*/
|
|
641
|
+
export type JitterStrategyConfig = "none" | "full" | "equal" | "decorrelated";
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Limit-order parameters accepted by trading posting helpers.
|
|
645
|
+
*/
|
|
646
|
+
export interface LimitTradeParametersInput {
|
|
647
|
+
/**
|
|
648
|
+
* Order side.
|
|
649
|
+
*/
|
|
650
|
+
kind: OrderKindDto;
|
|
651
|
+
/**
|
|
652
|
+
* Optional owner override.
|
|
653
|
+
*/
|
|
654
|
+
owner?: string;
|
|
655
|
+
/**
|
|
656
|
+
* Sell-token address.
|
|
657
|
+
*/
|
|
658
|
+
sellToken: string;
|
|
659
|
+
/**
|
|
660
|
+
* Buy-token address.
|
|
661
|
+
*/
|
|
662
|
+
buyToken: string;
|
|
663
|
+
/**
|
|
664
|
+
* Sell amount before transformations.
|
|
665
|
+
*/
|
|
666
|
+
sellAmount: string;
|
|
667
|
+
/**
|
|
668
|
+
* Buy amount before transformations.
|
|
669
|
+
*/
|
|
670
|
+
buyAmount: string;
|
|
671
|
+
/**
|
|
672
|
+
* Optional quote id.
|
|
673
|
+
*/
|
|
674
|
+
quoteId?: number;
|
|
675
|
+
/**
|
|
676
|
+
* Optional environment override.
|
|
677
|
+
*/
|
|
678
|
+
env?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Optional settlement-contract overrides keyed by chain id.
|
|
681
|
+
*
|
|
682
|
+
* Typed as `Record` rather than `Map` because the runtime
|
|
683
|
+
* serializer emits a plain JavaScript object for `BTreeMap`
|
|
684
|
+
* fields; the override aligns the declaration with the runtime.
|
|
685
|
+
*/
|
|
686
|
+
settlementContractOverride?: Record<string, string>;
|
|
687
|
+
/**
|
|
688
|
+
* Optional `EthFlow` contract overrides keyed by chain id.
|
|
689
|
+
*
|
|
690
|
+
* Typed as `Record` rather than `Map` for the same runtime
|
|
691
|
+
* alignment reason as `settlement_contract_override`.
|
|
692
|
+
*/
|
|
693
|
+
ethFlowContractOverride?: Record<string, string>;
|
|
694
|
+
/**
|
|
695
|
+
* Whether partial fills are allowed.
|
|
696
|
+
*/
|
|
697
|
+
partiallyFillable?: boolean;
|
|
698
|
+
/**
|
|
699
|
+
* Sell-token balance source.
|
|
700
|
+
*/
|
|
701
|
+
sellTokenBalance?: TokenBalanceDto;
|
|
702
|
+
/**
|
|
703
|
+
* Buy-token balance destination.
|
|
704
|
+
*/
|
|
705
|
+
buyTokenBalance?: TokenBalanceDto;
|
|
706
|
+
/**
|
|
707
|
+
* Optional slippage tolerance in basis points.
|
|
708
|
+
*/
|
|
709
|
+
slippageBps?: number;
|
|
710
|
+
/**
|
|
711
|
+
* Optional receiver override.
|
|
712
|
+
*/
|
|
713
|
+
receiver?: string;
|
|
714
|
+
/**
|
|
715
|
+
* Optional relative validity duration.
|
|
716
|
+
*/
|
|
717
|
+
validFor?: number;
|
|
718
|
+
/**
|
|
719
|
+
* Optional absolute UNIX expiry timestamp.
|
|
720
|
+
*/
|
|
721
|
+
validTo?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Optional partner-fee metadata.
|
|
724
|
+
*/
|
|
725
|
+
partnerFee?: PartnerFeeInput;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Native-currency sell transaction bundle.
|
|
730
|
+
*/
|
|
731
|
+
export interface BuiltSellNativeCurrencyTxDto {
|
|
732
|
+
/**
|
|
733
|
+
* Deterministic order UID.
|
|
734
|
+
*/
|
|
735
|
+
orderUid: string;
|
|
736
|
+
/**
|
|
737
|
+
* Transaction request to submit.
|
|
738
|
+
*/
|
|
739
|
+
transaction: TransactionRequestDto;
|
|
740
|
+
/**
|
|
741
|
+
* Unsigned order encoded by the transaction.
|
|
742
|
+
*/
|
|
743
|
+
orderToSign: OrderInput;
|
|
744
|
+
/**
|
|
745
|
+
* Effective order owner.
|
|
746
|
+
*/
|
|
747
|
+
from: string;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Native-price response from the orderbook native-price endpoint, mirroring
|
|
752
|
+
* `cow_sdk_orderbook::NativePriceResponse`.
|
|
753
|
+
*/
|
|
754
|
+
export interface NativePriceResponseDto {
|
|
755
|
+
/**
|
|
756
|
+
* Token price quoted in the chain\'s native asset.
|
|
757
|
+
*/
|
|
758
|
+
price: number;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Network-fee amounts expressed in both quote currencies.
|
|
763
|
+
*/
|
|
764
|
+
export interface NetworkFeeDto {
|
|
765
|
+
/**
|
|
766
|
+
* Network fee expressed in sell-token units.
|
|
767
|
+
*/
|
|
768
|
+
amountInSellCurrency: string;
|
|
769
|
+
/**
|
|
770
|
+
* Network fee expressed in buy-token units.
|
|
771
|
+
*/
|
|
772
|
+
amountInBuyCurrency: string;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* On-chain placement metadata, mirroring
|
|
777
|
+
* `cow_sdk_orderbook::OnchainOrderData`.
|
|
778
|
+
*/
|
|
779
|
+
export interface OnchainOrderDataDto {
|
|
780
|
+
/**
|
|
781
|
+
* Sender address associated with the on-chain placement.
|
|
782
|
+
*/
|
|
783
|
+
sender: string;
|
|
784
|
+
/**
|
|
785
|
+
* Placement error emitted by services, when on-chain placement failed.
|
|
786
|
+
*/
|
|
787
|
+
placementError?: string;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* One typed partner-fee policy object, mirroring
|
|
792
|
+
* `cow_sdk_app_data::PartnerFeePolicy`.
|
|
793
|
+
*/
|
|
794
|
+
export type PartnerFeePolicyDto = { volumeBps: number; recipient: string } | { surplusBps: number; maxVolumeBps: number; recipient: string } | { priceImprovementBps: number; maxVolumeBps: number; recipient: string };
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Order class surfaced by the orderbook API, mirroring
|
|
798
|
+
* `cow_sdk_orderbook::OrderClass`.
|
|
799
|
+
*/
|
|
800
|
+
export type OrderClassDto = "market" | "limit" | "liquidity";
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Order input shared by signing and UID exports.
|
|
804
|
+
*/
|
|
805
|
+
export interface OrderInput {
|
|
806
|
+
/**
|
|
807
|
+
* Sell token address.
|
|
808
|
+
*/
|
|
809
|
+
sellToken: string;
|
|
810
|
+
/**
|
|
811
|
+
* Buy token address.
|
|
812
|
+
*/
|
|
813
|
+
buyToken: string;
|
|
814
|
+
/**
|
|
815
|
+
* Optional receiver.
|
|
816
|
+
*/
|
|
817
|
+
receiver?: string;
|
|
818
|
+
/**
|
|
819
|
+
* Sell amount.
|
|
820
|
+
*/
|
|
821
|
+
sellAmount: string;
|
|
822
|
+
/**
|
|
823
|
+
* Buy amount.
|
|
824
|
+
*/
|
|
825
|
+
buyAmount: string;
|
|
826
|
+
/**
|
|
827
|
+
* Valid-to timestamp.
|
|
828
|
+
*/
|
|
829
|
+
validTo: number;
|
|
830
|
+
/**
|
|
831
|
+
* App-data hash.
|
|
832
|
+
*/
|
|
833
|
+
appData: string;
|
|
834
|
+
/**
|
|
835
|
+
* Fee amount.
|
|
836
|
+
*/
|
|
837
|
+
feeAmount: string;
|
|
838
|
+
/**
|
|
839
|
+
* Order side.
|
|
840
|
+
*/
|
|
841
|
+
kind: OrderKindDto;
|
|
842
|
+
/**
|
|
843
|
+
* Partial fill flag.
|
|
844
|
+
*/
|
|
845
|
+
partiallyFillable: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Sell balance source.
|
|
848
|
+
*/
|
|
849
|
+
sellTokenBalance: TokenBalanceDto;
|
|
850
|
+
/**
|
|
851
|
+
* Buy balance destination.
|
|
852
|
+
*/
|
|
853
|
+
buyTokenBalance: TokenBalanceDto;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Order lifecycle status returned by the orderbook API, mirroring
|
|
858
|
+
* `cow_sdk_orderbook::OrderStatus`.
|
|
859
|
+
*/
|
|
860
|
+
export type OrderStatusDto = "presignaturePending" | "open" | "fulfilled" | "cancelled" | "expired";
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Order returned by the orderbook order endpoints, mirroring
|
|
864
|
+
* `cow_sdk_orderbook::Order` (the enriched order shape, with the normalized
|
|
865
|
+
* `totalFee` folded in).
|
|
866
|
+
*/
|
|
867
|
+
export interface OrderDto {
|
|
868
|
+
/**
|
|
869
|
+
* Sell-token address.
|
|
870
|
+
*/
|
|
871
|
+
sellToken: string;
|
|
872
|
+
/**
|
|
873
|
+
* Buy-token address.
|
|
874
|
+
*/
|
|
875
|
+
buyToken: string;
|
|
876
|
+
/**
|
|
877
|
+
* Optional receiver override.
|
|
878
|
+
*/
|
|
879
|
+
receiver?: string;
|
|
880
|
+
/**
|
|
881
|
+
* Sell amount in the upstream decimal-string wire shape.
|
|
882
|
+
*/
|
|
883
|
+
sellAmount: string;
|
|
884
|
+
/**
|
|
885
|
+
* Buy amount in the upstream decimal-string wire shape.
|
|
886
|
+
*/
|
|
887
|
+
buyAmount: string;
|
|
888
|
+
/**
|
|
889
|
+
* Absolute UNIX expiry timestamp.
|
|
890
|
+
*/
|
|
891
|
+
validTo: number;
|
|
892
|
+
/**
|
|
893
|
+
* App-data hash attached to the order.
|
|
894
|
+
*/
|
|
895
|
+
appData: string;
|
|
896
|
+
/**
|
|
897
|
+
* Optional app-data hash echoed for debugging by the orderbook.
|
|
898
|
+
*/
|
|
899
|
+
appDataHash?: string;
|
|
900
|
+
/**
|
|
901
|
+
* Order-level fee echoed on the orderbook response; always `\"0\"` in
|
|
902
|
+
* practice because services rejects non-zero order-level fees.
|
|
903
|
+
*/
|
|
904
|
+
feeAmount: string;
|
|
905
|
+
/**
|
|
906
|
+
* Strict balance-check flag, present only when the order was created with
|
|
907
|
+
* it set.
|
|
908
|
+
*/
|
|
909
|
+
fullBalanceCheck?: boolean;
|
|
910
|
+
/**
|
|
911
|
+
* Order kind.
|
|
912
|
+
*/
|
|
913
|
+
kind: OrderKindDto;
|
|
914
|
+
/**
|
|
915
|
+
* Whether partial fills are allowed.
|
|
916
|
+
*/
|
|
917
|
+
partiallyFillable: boolean;
|
|
918
|
+
/**
|
|
919
|
+
* Sell-token balance source.
|
|
920
|
+
*/
|
|
921
|
+
sellTokenBalance: TokenBalanceDto;
|
|
922
|
+
/**
|
|
923
|
+
* Buy-token balance destination.
|
|
924
|
+
*/
|
|
925
|
+
buyTokenBalance: TokenBalanceDto;
|
|
926
|
+
/**
|
|
927
|
+
* Signature scheme used for `signature`.
|
|
928
|
+
*/
|
|
929
|
+
signingScheme: SigningSchemeDto;
|
|
930
|
+
/**
|
|
931
|
+
* Raw signature string.
|
|
932
|
+
*/
|
|
933
|
+
signature: string;
|
|
934
|
+
/**
|
|
935
|
+
* Effective owner field returned by the API, when present.
|
|
936
|
+
*/
|
|
937
|
+
from?: string;
|
|
938
|
+
/**
|
|
939
|
+
* Quote id used when the order originated from a quote.
|
|
940
|
+
*/
|
|
941
|
+
quoteId?: number;
|
|
942
|
+
/**
|
|
943
|
+
* Order class.
|
|
944
|
+
*/
|
|
945
|
+
class: OrderClassDto;
|
|
946
|
+
/**
|
|
947
|
+
* Canonical owner surfaced by the orderbook response.
|
|
948
|
+
*/
|
|
949
|
+
owner: string;
|
|
950
|
+
/**
|
|
951
|
+
* Order UID.
|
|
952
|
+
*/
|
|
953
|
+
uid: string;
|
|
954
|
+
/**
|
|
955
|
+
* Creation timestamp string returned by the API.
|
|
956
|
+
*/
|
|
957
|
+
creationDate?: string;
|
|
958
|
+
/**
|
|
959
|
+
* Executed sell amount.
|
|
960
|
+
*/
|
|
961
|
+
executedSellAmount?: string;
|
|
962
|
+
/**
|
|
963
|
+
* Executed sell amount before fees.
|
|
964
|
+
*/
|
|
965
|
+
executedSellAmountBeforeFees?: string;
|
|
966
|
+
/**
|
|
967
|
+
* Executed buy amount.
|
|
968
|
+
*/
|
|
969
|
+
executedBuyAmount?: string;
|
|
970
|
+
/**
|
|
971
|
+
* Executed fee component, when provided.
|
|
972
|
+
*/
|
|
973
|
+
executedFee?: string;
|
|
974
|
+
/**
|
|
975
|
+
* Deprecated legacy executed-fee value, present on older order payloads.
|
|
976
|
+
*/
|
|
977
|
+
executedFeeAmount?: string;
|
|
978
|
+
/**
|
|
979
|
+
* Token in which the executed fee was captured, when returned.
|
|
980
|
+
*/
|
|
981
|
+
executedFeeToken?: string;
|
|
982
|
+
/**
|
|
983
|
+
* Whether the order was invalidated by the protocol.
|
|
984
|
+
*/
|
|
985
|
+
invalidated?: boolean;
|
|
986
|
+
/**
|
|
987
|
+
* Order lifecycle status.
|
|
988
|
+
*/
|
|
989
|
+
status: OrderStatusDto;
|
|
990
|
+
/**
|
|
991
|
+
* Whether services classified the order as a liquidity order.
|
|
992
|
+
*/
|
|
993
|
+
isLiquidityOrder?: boolean;
|
|
994
|
+
/**
|
|
995
|
+
* On-chain user for `EthFlow`-style orders.
|
|
996
|
+
*/
|
|
997
|
+
onchainUser?: string;
|
|
998
|
+
/**
|
|
999
|
+
* `EthFlow`-specific metadata.
|
|
1000
|
+
*/
|
|
1001
|
+
ethflowData?: EthflowDataDto;
|
|
1002
|
+
/**
|
|
1003
|
+
* On-chain placement metadata, when services returns it.
|
|
1004
|
+
*/
|
|
1005
|
+
onchainOrderData?: OnchainOrderDataDto;
|
|
1006
|
+
/**
|
|
1007
|
+
* Full app-data payload, when services returns it.
|
|
1008
|
+
*/
|
|
1009
|
+
fullAppData?: string;
|
|
1010
|
+
/**
|
|
1011
|
+
* Settlement contract address against which the order was signed.
|
|
1012
|
+
*/
|
|
1013
|
+
settlementContract: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* Stored quote metadata for quote-linked orders.
|
|
1016
|
+
*/
|
|
1017
|
+
quote?: StoredOrderQuoteDto;
|
|
1018
|
+
/**
|
|
1019
|
+
* Optional pre and post interactions associated with the order.
|
|
1020
|
+
*/
|
|
1021
|
+
interactions?: OrderInteractionsDto;
|
|
1022
|
+
/**
|
|
1023
|
+
* Total fee normalized by the SDK transform layer.
|
|
1024
|
+
*/
|
|
1025
|
+
totalFee?: string;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Order side accepted by wasm order inputs.
|
|
1030
|
+
*/
|
|
1031
|
+
export type OrderKindDto = "sell" | "buy";
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Order transaction helper parameters.
|
|
1035
|
+
*/
|
|
1036
|
+
export interface OrderTraderParametersInput {
|
|
1037
|
+
/**
|
|
1038
|
+
* Target order UID.
|
|
1039
|
+
*/
|
|
1040
|
+
orderUid: string;
|
|
1041
|
+
/**
|
|
1042
|
+
* Optional chain-id override.
|
|
1043
|
+
*/
|
|
1044
|
+
chainId?: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* Optional environment override.
|
|
1047
|
+
*/
|
|
1048
|
+
env?: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* Optional settlement-contract overrides keyed by chain id.
|
|
1051
|
+
*
|
|
1052
|
+
* Typed as `Record` rather than `Map` because the runtime
|
|
1053
|
+
* serializer emits a plain JavaScript object for `BTreeMap`
|
|
1054
|
+
* fields; the override aligns the declaration with the runtime.
|
|
1055
|
+
*/
|
|
1056
|
+
settlementContractOverride?: Record<string, string>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Optional `EthFlow` contract overrides keyed by chain id.
|
|
1059
|
+
*
|
|
1060
|
+
* Typed as `Record` rather than `Map` for the same runtime
|
|
1061
|
+
* alignment reason as `settlement_contract_override`.
|
|
1062
|
+
*/
|
|
1063
|
+
ethFlowContractOverride?: Record<string, string>;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Orderbook order-creation input.
|
|
1068
|
+
*/
|
|
1069
|
+
export interface OrderCreationInput {
|
|
1070
|
+
/**
|
|
1071
|
+
* Sell-token address.
|
|
1072
|
+
*/
|
|
1073
|
+
sellToken: string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Buy-token address.
|
|
1076
|
+
*/
|
|
1077
|
+
buyToken: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* Optional receiver.
|
|
1080
|
+
*/
|
|
1081
|
+
receiver?: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Sell amount.
|
|
1084
|
+
*/
|
|
1085
|
+
sellAmount: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Buy amount.
|
|
1088
|
+
*/
|
|
1089
|
+
buyAmount: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* Absolute UNIX expiry timestamp.
|
|
1092
|
+
*/
|
|
1093
|
+
validTo: number;
|
|
1094
|
+
/**
|
|
1095
|
+
* Inline app-data payload.
|
|
1096
|
+
*/
|
|
1097
|
+
appData?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* App-data hash.
|
|
1100
|
+
*/
|
|
1101
|
+
appDataHash?: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Order-level fee amount. The orderbook accepts only zero.
|
|
1104
|
+
*/
|
|
1105
|
+
feeAmount?: string;
|
|
1106
|
+
/**
|
|
1107
|
+
* Strict balance-check flag.
|
|
1108
|
+
*/
|
|
1109
|
+
fullBalanceCheck?: boolean;
|
|
1110
|
+
/**
|
|
1111
|
+
* Order side.
|
|
1112
|
+
*/
|
|
1113
|
+
kind: OrderKindDto;
|
|
1114
|
+
/**
|
|
1115
|
+
* Whether partial fills are allowed.
|
|
1116
|
+
*/
|
|
1117
|
+
partiallyFillable?: boolean;
|
|
1118
|
+
/**
|
|
1119
|
+
* Sell-token balance source.
|
|
1120
|
+
*/
|
|
1121
|
+
sellTokenBalance?: TokenBalanceDto;
|
|
1122
|
+
/**
|
|
1123
|
+
* Buy-token balance destination.
|
|
1124
|
+
*/
|
|
1125
|
+
buyTokenBalance?: TokenBalanceDto;
|
|
1126
|
+
/**
|
|
1127
|
+
* Signature scheme.
|
|
1128
|
+
*/
|
|
1129
|
+
signingScheme: string;
|
|
1130
|
+
/**
|
|
1131
|
+
* Raw signature.
|
|
1132
|
+
*/
|
|
1133
|
+
signature: string;
|
|
1134
|
+
/**
|
|
1135
|
+
* Effective owner.
|
|
1136
|
+
*/
|
|
1137
|
+
from: string;
|
|
1138
|
+
/**
|
|
1139
|
+
* Optional quote id.
|
|
1140
|
+
*/
|
|
1141
|
+
quoteId?: number;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Orderbook quote request input.
|
|
1146
|
+
*/
|
|
1147
|
+
export interface OrderQuoteRequestInput {
|
|
1148
|
+
/**
|
|
1149
|
+
* Sell-token address.
|
|
1150
|
+
*/
|
|
1151
|
+
sellToken: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Buy-token address.
|
|
1154
|
+
*/
|
|
1155
|
+
buyToken: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Optional explicit receiver.
|
|
1158
|
+
*/
|
|
1159
|
+
receiver?: string;
|
|
1160
|
+
/**
|
|
1161
|
+
* Quote owner.
|
|
1162
|
+
*/
|
|
1163
|
+
from: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* Quote side.
|
|
1166
|
+
*/
|
|
1167
|
+
kind: OrderKindDto;
|
|
1168
|
+
/**
|
|
1169
|
+
* Sell amount before fee for sell quotes.
|
|
1170
|
+
*/
|
|
1171
|
+
sellAmountBeforeFee?: string;
|
|
1172
|
+
/**
|
|
1173
|
+
* Buy amount after fee for buy quotes.
|
|
1174
|
+
*/
|
|
1175
|
+
buyAmountAfterFee?: string;
|
|
1176
|
+
/**
|
|
1177
|
+
* Relative validity duration in seconds.
|
|
1178
|
+
*/
|
|
1179
|
+
validFor?: number;
|
|
1180
|
+
/**
|
|
1181
|
+
* Absolute UNIX expiry timestamp.
|
|
1182
|
+
*/
|
|
1183
|
+
validTo?: number;
|
|
1184
|
+
/**
|
|
1185
|
+
* Inline app-data payload.
|
|
1186
|
+
*/
|
|
1187
|
+
appData?: string;
|
|
1188
|
+
/**
|
|
1189
|
+
* App-data hash.
|
|
1190
|
+
*/
|
|
1191
|
+
appDataHash?: string;
|
|
1192
|
+
/**
|
|
1193
|
+
* Sell-token balance source.
|
|
1194
|
+
*/
|
|
1195
|
+
sellTokenBalance?: TokenBalanceDto;
|
|
1196
|
+
/**
|
|
1197
|
+
* Buy-token balance destination.
|
|
1198
|
+
*/
|
|
1199
|
+
buyTokenBalance?: TokenBalanceDto;
|
|
1200
|
+
/**
|
|
1201
|
+
* Quote-quality mode.
|
|
1202
|
+
*/
|
|
1203
|
+
priceQuality?: string;
|
|
1204
|
+
/**
|
|
1205
|
+
* Expected signing scheme.
|
|
1206
|
+
*/
|
|
1207
|
+
signingScheme?: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* Whether the eventual order is expected to be on-chain.
|
|
1210
|
+
*/
|
|
1211
|
+
onchainOrder?: boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Optional verification gas limit.
|
|
1214
|
+
*/
|
|
1215
|
+
verificationGasLimit?: number;
|
|
1216
|
+
/**
|
|
1217
|
+
* Optional request timeout in milliseconds.
|
|
1218
|
+
*/
|
|
1219
|
+
timeout?: number;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Originating orderbook runtime binding captured by the quote flow, mirroring
|
|
1224
|
+
* `cow_sdk_orderbook::OrderbookRuntimeBinding`.
|
|
1225
|
+
*/
|
|
1226
|
+
export interface OrderBookRuntimeBindingDto {
|
|
1227
|
+
/**
|
|
1228
|
+
* Chain id fixed by the orderbook client.
|
|
1229
|
+
*/
|
|
1230
|
+
chainId: number;
|
|
1231
|
+
/**
|
|
1232
|
+
* Environment fixed by the orderbook client.
|
|
1233
|
+
*/
|
|
1234
|
+
env: CowEnvDto;
|
|
1235
|
+
/**
|
|
1236
|
+
* Resolved base URL used by the orderbook client when available.
|
|
1237
|
+
*/
|
|
1238
|
+
resolvedBaseUrl?: string;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Pagination options shared by orderbook list helpers.
|
|
1243
|
+
*/
|
|
1244
|
+
export interface PaginationOptions {
|
|
1245
|
+
/**
|
|
1246
|
+
* Pagination offset.
|
|
1247
|
+
*/
|
|
1248
|
+
offset?: number;
|
|
1249
|
+
/**
|
|
1250
|
+
* Pagination limit.
|
|
1251
|
+
*/
|
|
1252
|
+
limit?: number;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Partner-fee input accepted by trading swap parameters.
|
|
1257
|
+
*/
|
|
1258
|
+
export type PartnerFeeInput = PartnerFeePolicyInput | PartnerFeePolicyInput[];
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Partner-fee metadata, mirroring `cow_sdk_app_data::PartnerFee`.
|
|
1262
|
+
*/
|
|
1263
|
+
export type PartnerFeeDto = PartnerFeePolicyDto | PartnerFeePolicyDto[];
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Partner-fee policy input for trading swap parameters.
|
|
1267
|
+
*/
|
|
1268
|
+
export interface PartnerFeePolicyInput {
|
|
1269
|
+
/**
|
|
1270
|
+
* Volume fee in basis points.
|
|
1271
|
+
*/
|
|
1272
|
+
volumeBps?: number;
|
|
1273
|
+
/**
|
|
1274
|
+
* Surplus fee in basis points.
|
|
1275
|
+
*/
|
|
1276
|
+
surplusBps?: number;
|
|
1277
|
+
/**
|
|
1278
|
+
* Price-improvement fee in basis points.
|
|
1279
|
+
*/
|
|
1280
|
+
priceImprovementBps?: number;
|
|
1281
|
+
/**
|
|
1282
|
+
* Maximum volume fee in basis points.
|
|
1283
|
+
*/
|
|
1284
|
+
maxVolumeBps?: number;
|
|
1285
|
+
/**
|
|
1286
|
+
* Fee recipient address.
|
|
1287
|
+
*/
|
|
1288
|
+
recipient: string;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Pre/post interactions associated with an order, mirroring
|
|
1293
|
+
* `cow_sdk_orderbook::OrderInteractions`.
|
|
1294
|
+
*/
|
|
1295
|
+
export interface OrderInteractionsDto {
|
|
1296
|
+
/**
|
|
1297
|
+
* Interactions executed before the order\'s trade.
|
|
1298
|
+
*/
|
|
1299
|
+
pre?: InteractionDataDto[];
|
|
1300
|
+
/**
|
|
1301
|
+
* Interactions executed after the order\'s trade.
|
|
1302
|
+
*/
|
|
1303
|
+
post?: InteractionDataDto[];
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Rate-limiter bucket scope accepted by JS client constructors.
|
|
1308
|
+
*/
|
|
1309
|
+
export type LimiterScopeConfig = "global" | "perHost";
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Raw EVM event log accepted by the on-chain event decoders.
|
|
1313
|
+
*
|
|
1314
|
+
* `topics` carries the indexed log topics as `0x`-prefixed 32-byte hex
|
|
1315
|
+
* strings with topic-0 (the event signature hash) first; `data` is the
|
|
1316
|
+
* ABI-encoded non-indexed payload as a `0x`-prefixed hex string (`\"0x\"` for an
|
|
1317
|
+
* empty payload).
|
|
1318
|
+
*/
|
|
1319
|
+
export interface EventLogInput {
|
|
1320
|
+
/**
|
|
1321
|
+
* Indexed log topics as 0x-prefixed 32-byte hex strings (topic-0 first).
|
|
1322
|
+
*/
|
|
1323
|
+
topics: string[];
|
|
1324
|
+
/**
|
|
1325
|
+
* ABI-encoded non-indexed log data as a 0x-prefixed hex string.
|
|
1326
|
+
*/
|
|
1327
|
+
data: string;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Raw orderbook quote response, mirroring
|
|
1332
|
+
* `cow_sdk_orderbook::OrderQuoteResponse`.
|
|
1333
|
+
*/
|
|
1334
|
+
export interface OrderQuoteResponseDto {
|
|
1335
|
+
/**
|
|
1336
|
+
* Resolved quote payload.
|
|
1337
|
+
*/
|
|
1338
|
+
quote: QuoteDataDto;
|
|
1339
|
+
/**
|
|
1340
|
+
* Effective owner used for the quote, when returned by the API.
|
|
1341
|
+
*/
|
|
1342
|
+
from?: string;
|
|
1343
|
+
/**
|
|
1344
|
+
* Quote price/fee expiry as an ISO-8601 UTC string.
|
|
1345
|
+
*/
|
|
1346
|
+
expiration: string;
|
|
1347
|
+
/**
|
|
1348
|
+
* Quote identifier used when submitting the corresponding order.
|
|
1349
|
+
*/
|
|
1350
|
+
id?: number;
|
|
1351
|
+
/**
|
|
1352
|
+
* Whether the quote was verified by the orderbook.
|
|
1353
|
+
*/
|
|
1354
|
+
verified: boolean;
|
|
1355
|
+
/**
|
|
1356
|
+
* Optional protocol fee basis points for the quote.
|
|
1357
|
+
*/
|
|
1358
|
+
protocolFeeBps?: string;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Request-rate limiter override accepted by JS client constructors.
|
|
1363
|
+
*/
|
|
1364
|
+
export interface RequestRateLimiterConfig {
|
|
1365
|
+
/**
|
|
1366
|
+
* Request tokens granted per interval. Zero disables limiting.
|
|
1367
|
+
*/
|
|
1368
|
+
tokensPerInterval?: number;
|
|
1369
|
+
/**
|
|
1370
|
+
* Limiter interval in milliseconds.
|
|
1371
|
+
*/
|
|
1372
|
+
intervalMs?: number;
|
|
1373
|
+
/**
|
|
1374
|
+
* Bucket scope.
|
|
1375
|
+
*/
|
|
1376
|
+
scope?: LimiterScopeConfig;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Resolved quote payload echoed by the orderbook `/quote` response, mirroring
|
|
1381
|
+
* `cow_sdk_orderbook::QuoteData`.
|
|
1382
|
+
*/
|
|
1383
|
+
export interface QuoteDataDto {
|
|
1384
|
+
/**
|
|
1385
|
+
* Sell-token address.
|
|
1386
|
+
*/
|
|
1387
|
+
sellToken: string;
|
|
1388
|
+
/**
|
|
1389
|
+
* Buy-token address.
|
|
1390
|
+
*/
|
|
1391
|
+
buyToken: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* Optional receiver override.
|
|
1394
|
+
*/
|
|
1395
|
+
receiver?: string;
|
|
1396
|
+
/**
|
|
1397
|
+
* Sell amount in the upstream decimal-string wire shape.
|
|
1398
|
+
*/
|
|
1399
|
+
sellAmount: string;
|
|
1400
|
+
/**
|
|
1401
|
+
* Buy amount in the upstream decimal-string wire shape.
|
|
1402
|
+
*/
|
|
1403
|
+
buyAmount: string;
|
|
1404
|
+
/**
|
|
1405
|
+
* Absolute UNIX expiry timestamp.
|
|
1406
|
+
*/
|
|
1407
|
+
validTo: number;
|
|
1408
|
+
/**
|
|
1409
|
+
* Effective app-data hash derived from the orderbook response.
|
|
1410
|
+
*/
|
|
1411
|
+
appData: string;
|
|
1412
|
+
/**
|
|
1413
|
+
* Explicit app-data hash echoed alongside full app data, when present.
|
|
1414
|
+
*/
|
|
1415
|
+
appDataHash?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* Network-cost amount echoed by the orderbook `/quote` response.
|
|
1418
|
+
*/
|
|
1419
|
+
feeAmount: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* Order kind.
|
|
1422
|
+
*/
|
|
1423
|
+
kind: OrderKindDto;
|
|
1424
|
+
/**
|
|
1425
|
+
* Whether partial fills are allowed.
|
|
1426
|
+
*/
|
|
1427
|
+
partiallyFillable: boolean;
|
|
1428
|
+
/**
|
|
1429
|
+
* Sell-token balance source.
|
|
1430
|
+
*/
|
|
1431
|
+
sellTokenBalance: TokenBalanceDto;
|
|
1432
|
+
/**
|
|
1433
|
+
* Buy-token balance destination.
|
|
1434
|
+
*/
|
|
1435
|
+
buyTokenBalance: TokenBalanceDto;
|
|
1436
|
+
/**
|
|
1437
|
+
* Estimated gas units for the quoted trade; empty for a locally
|
|
1438
|
+
* constructed quote.
|
|
1439
|
+
*/
|
|
1440
|
+
gasAmount?: string;
|
|
1441
|
+
/**
|
|
1442
|
+
* Estimated gas price at quote time (wei per gas unit).
|
|
1443
|
+
*/
|
|
1444
|
+
gasPrice?: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* Sell-token price in native-token atoms per sell-token atom.
|
|
1447
|
+
*/
|
|
1448
|
+
sellTokenPrice?: string;
|
|
1449
|
+
/**
|
|
1450
|
+
* Signing scheme for the quoted order.
|
|
1451
|
+
*/
|
|
1452
|
+
signingScheme: SigningSchemeDto;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* Result returned by a managed trading submission
|
|
1457
|
+
* (`cow_sdk_trading::OrderPostingResult`).
|
|
1458
|
+
*/
|
|
1459
|
+
export interface OrderPostingResultDto {
|
|
1460
|
+
/**
|
|
1461
|
+
* Final order UID.
|
|
1462
|
+
*/
|
|
1463
|
+
orderId: string;
|
|
1464
|
+
/**
|
|
1465
|
+
* Transaction hash when the flow submitted an on-chain transaction directly.
|
|
1466
|
+
*/
|
|
1467
|
+
txHash?: string;
|
|
1468
|
+
/**
|
|
1469
|
+
* Signature scheme used for the posted order.
|
|
1470
|
+
*/
|
|
1471
|
+
signingScheme: SigningSchemeDto;
|
|
1472
|
+
/**
|
|
1473
|
+
* Signature payload sent to the orderbook, or an empty string for
|
|
1474
|
+
* transaction-only flows.
|
|
1475
|
+
*/
|
|
1476
|
+
signature: string;
|
|
1477
|
+
/**
|
|
1478
|
+
* Unsigned order payload used for signing or transaction generation.
|
|
1479
|
+
*/
|
|
1480
|
+
orderToSign: OrderDataDto;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Retry-policy override accepted by JS client constructors.
|
|
1485
|
+
*/
|
|
1486
|
+
export interface RetryPolicyConfig {
|
|
1487
|
+
/**
|
|
1488
|
+
* Maximum attempts, including the initial request.
|
|
1489
|
+
*/
|
|
1490
|
+
maxAttempts?: number;
|
|
1491
|
+
/**
|
|
1492
|
+
* Base exponential-backoff delay in milliseconds.
|
|
1493
|
+
*/
|
|
1494
|
+
baseDelayMs?: number;
|
|
1495
|
+
/**
|
|
1496
|
+
* Maximum exponential-backoff delay in milliseconds.
|
|
1497
|
+
*/
|
|
1498
|
+
maxDelayMs?: number;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Sell/buy amount pair at one quote stage.
|
|
1503
|
+
*/
|
|
1504
|
+
export interface AmountsDto {
|
|
1505
|
+
/**
|
|
1506
|
+
* Sell-side amount.
|
|
1507
|
+
*/
|
|
1508
|
+
sellAmount: string;
|
|
1509
|
+
/**
|
|
1510
|
+
* Buy-side amount.
|
|
1511
|
+
*/
|
|
1512
|
+
buyAmount: string;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Signature scheme carried on posted and returned orders, mirroring
|
|
1517
|
+
* `cow_sdk_orderbook::SigningScheme`, whose wire form is the lowercased
|
|
1518
|
+
* variant name.
|
|
1519
|
+
*/
|
|
1520
|
+
export type SigningSchemeDto = "eip712" | "ethsign" | "eip1271" | "presign";
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Signed order DTO returned by wallet callback exports.
|
|
1524
|
+
*/
|
|
1525
|
+
export interface SignedOrderDto {
|
|
1526
|
+
/**
|
|
1527
|
+
* Compact order UID.
|
|
1528
|
+
*/
|
|
1529
|
+
orderUid: string;
|
|
1530
|
+
/**
|
|
1531
|
+
* Signature payload submitted to the orderbook.
|
|
1532
|
+
*/
|
|
1533
|
+
signature: string;
|
|
1534
|
+
/**
|
|
1535
|
+
* Signing scheme.
|
|
1536
|
+
*/
|
|
1537
|
+
signingScheme: string;
|
|
1538
|
+
/**
|
|
1539
|
+
* Effective owner submitted as `from`.
|
|
1540
|
+
*/
|
|
1541
|
+
from: string;
|
|
1542
|
+
/**
|
|
1543
|
+
* Underlying order digest.
|
|
1544
|
+
*/
|
|
1545
|
+
orderDigest: string;
|
|
1546
|
+
/**
|
|
1547
|
+
* Typed-data envelope used for signing.
|
|
1548
|
+
*/
|
|
1549
|
+
typedData: TypedDataEnvelopeDto;
|
|
1550
|
+
/**
|
|
1551
|
+
* Optional quote id.
|
|
1552
|
+
*/
|
|
1553
|
+
quoteId?: number;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Signed order-cancellation DTO.
|
|
1558
|
+
*/
|
|
1559
|
+
export interface SignedCancellationsInput {
|
|
1560
|
+
/**
|
|
1561
|
+
* Order UIDs to cancel.
|
|
1562
|
+
*/
|
|
1563
|
+
orderUids: string[];
|
|
1564
|
+
/**
|
|
1565
|
+
* Cancellation signature.
|
|
1566
|
+
*/
|
|
1567
|
+
signature: string;
|
|
1568
|
+
/**
|
|
1569
|
+
* ECDSA signing scheme.
|
|
1570
|
+
*/
|
|
1571
|
+
signingScheme: string;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Solver execution entry nested in competition-status responses, mirroring
|
|
1576
|
+
* `cow_sdk_orderbook::SolverExecution`.
|
|
1577
|
+
*/
|
|
1578
|
+
export interface SolverExecutionDto {
|
|
1579
|
+
/**
|
|
1580
|
+
* Solver identifier or address rendered by the API.
|
|
1581
|
+
*/
|
|
1582
|
+
solver: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Executed amounts for this solver path, when present.
|
|
1585
|
+
*/
|
|
1586
|
+
executedAmounts?: ExecutedAmountsDto;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* Stepwise quote amounts and cost components across the quote lifecycle.
|
|
1591
|
+
*/
|
|
1592
|
+
export interface QuoteAmountsAndCostsDto {
|
|
1593
|
+
/**
|
|
1594
|
+
* Whether the source quote was sell-sided.
|
|
1595
|
+
*/
|
|
1596
|
+
isSell: boolean;
|
|
1597
|
+
/**
|
|
1598
|
+
* Cost breakdown for the quote.
|
|
1599
|
+
*/
|
|
1600
|
+
costs: CostsDto;
|
|
1601
|
+
/**
|
|
1602
|
+
* Amounts before all fees.
|
|
1603
|
+
*/
|
|
1604
|
+
beforeAllFees: AmountsDto;
|
|
1605
|
+
/**
|
|
1606
|
+
* Amounts before network costs.
|
|
1607
|
+
*/
|
|
1608
|
+
beforeNetworkCosts: AmountsDto;
|
|
1609
|
+
/**
|
|
1610
|
+
* Amounts after protocol fees.
|
|
1611
|
+
*/
|
|
1612
|
+
afterProtocolFees: AmountsDto;
|
|
1613
|
+
/**
|
|
1614
|
+
* Amounts after network costs.
|
|
1615
|
+
*/
|
|
1616
|
+
afterNetworkCosts: AmountsDto;
|
|
1617
|
+
/**
|
|
1618
|
+
* Amounts after partner fees.
|
|
1619
|
+
*/
|
|
1620
|
+
afterPartnerFees: AmountsDto;
|
|
1621
|
+
/**
|
|
1622
|
+
* Amounts after slippage.
|
|
1623
|
+
*/
|
|
1624
|
+
afterSlippage: AmountsDto;
|
|
1625
|
+
/**
|
|
1626
|
+
* Amounts that should be signed.
|
|
1627
|
+
*/
|
|
1628
|
+
amountsToSign: AmountsDto;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Stored quote metadata for quote-linked orders, mirroring
|
|
1633
|
+
* `cow_sdk_orderbook::StoredOrderQuote`.
|
|
1634
|
+
*/
|
|
1635
|
+
export interface StoredOrderQuoteDto {
|
|
1636
|
+
/**
|
|
1637
|
+
* Estimated gas units required to execute the quoted trade.
|
|
1638
|
+
*/
|
|
1639
|
+
gasAmount: string;
|
|
1640
|
+
/**
|
|
1641
|
+
* Estimated gas price at quote time, in wei per gas unit.
|
|
1642
|
+
*/
|
|
1643
|
+
gasPrice: string;
|
|
1644
|
+
/**
|
|
1645
|
+
* Sell-token price in native-token atoms per sell-token atom.
|
|
1646
|
+
*/
|
|
1647
|
+
sellTokenPrice: string;
|
|
1648
|
+
/**
|
|
1649
|
+
* Quoted sell amount.
|
|
1650
|
+
*/
|
|
1651
|
+
sellAmount: string;
|
|
1652
|
+
/**
|
|
1653
|
+
* Quoted buy amount.
|
|
1654
|
+
*/
|
|
1655
|
+
buyAmount: string;
|
|
1656
|
+
/**
|
|
1657
|
+
* Estimated network fee in sell-token atoms.
|
|
1658
|
+
*/
|
|
1659
|
+
feeAmount: string;
|
|
1660
|
+
/**
|
|
1661
|
+
* Solver address that provided the quote.
|
|
1662
|
+
*/
|
|
1663
|
+
solver: string;
|
|
1664
|
+
/**
|
|
1665
|
+
* Whether the quote was verified through simulation.
|
|
1666
|
+
*/
|
|
1667
|
+
verified: boolean;
|
|
1668
|
+
/**
|
|
1669
|
+
* Additional services-provided quote metadata, when present.
|
|
1670
|
+
*/
|
|
1671
|
+
metadata?: Value;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Token-balance mode accepted by wasm order inputs.
|
|
1676
|
+
*/
|
|
1677
|
+
export type TokenBalanceDto = "erc20" | "external" | "internal";
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Total accumulated surplus for an account, mirroring
|
|
1681
|
+
* `cow_sdk_orderbook::TotalSurplus`.
|
|
1682
|
+
*/
|
|
1683
|
+
export interface TotalSurplusDto {
|
|
1684
|
+
/**
|
|
1685
|
+
* Total surplus in the upstream decimal-string wire shape, when present.
|
|
1686
|
+
*/
|
|
1687
|
+
totalSurplus?: string;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
/**
|
|
1691
|
+
* Trade returned by the orderbook trades endpoint, mirroring
|
|
1692
|
+
* `cow_sdk_orderbook::Trade`.
|
|
1693
|
+
*/
|
|
1694
|
+
export interface TradeDto {
|
|
1695
|
+
/**
|
|
1696
|
+
* Block number containing the trade event.
|
|
1697
|
+
*/
|
|
1698
|
+
blockNumber: number;
|
|
1699
|
+
/**
|
|
1700
|
+
* Log index within the block.
|
|
1701
|
+
*/
|
|
1702
|
+
logIndex: number;
|
|
1703
|
+
/**
|
|
1704
|
+
* Order UID associated with the trade.
|
|
1705
|
+
*/
|
|
1706
|
+
orderUid: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* Owner address.
|
|
1709
|
+
*/
|
|
1710
|
+
owner: string;
|
|
1711
|
+
/**
|
|
1712
|
+
* Sell-token address.
|
|
1713
|
+
*/
|
|
1714
|
+
sellToken: string;
|
|
1715
|
+
/**
|
|
1716
|
+
* Buy-token address.
|
|
1717
|
+
*/
|
|
1718
|
+
buyToken: string;
|
|
1719
|
+
/**
|
|
1720
|
+
* Executed sell amount in the upstream decimal-string wire shape.
|
|
1721
|
+
*/
|
|
1722
|
+
sellAmount: string;
|
|
1723
|
+
/**
|
|
1724
|
+
* Executed sell amount before fees.
|
|
1725
|
+
*/
|
|
1726
|
+
sellAmountBeforeFees?: string;
|
|
1727
|
+
/**
|
|
1728
|
+
* Executed buy amount in the upstream decimal-string wire shape.
|
|
1729
|
+
*/
|
|
1730
|
+
buyAmount: string;
|
|
1731
|
+
/**
|
|
1732
|
+
* Protocol fees executed as part of the trade, when services returns them.
|
|
1733
|
+
*/
|
|
1734
|
+
executedProtocolFees?: ExecutedProtocolFeeDto[];
|
|
1735
|
+
/**
|
|
1736
|
+
* Settlement transaction hash.
|
|
1737
|
+
*/
|
|
1738
|
+
txHash: string | undefined;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/**
|
|
1742
|
+
* Trades query accepted by `OrderBookClient.getTrades`.
|
|
1743
|
+
*/
|
|
1744
|
+
export interface TradesQueryInput {
|
|
1745
|
+
/**
|
|
1746
|
+
* Owner filter. Set exactly one of `owner` or `orderUid`.
|
|
1747
|
+
*/
|
|
1748
|
+
owner?: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Order UID filter. Set exactly one of `owner` or `orderUid`.
|
|
1751
|
+
*/
|
|
1752
|
+
orderUid?: string;
|
|
1753
|
+
/**
|
|
1754
|
+
* Pagination offset.
|
|
1755
|
+
*/
|
|
1756
|
+
offset?: number;
|
|
1757
|
+
/**
|
|
1758
|
+
* Pagination limit.
|
|
1759
|
+
*/
|
|
1760
|
+
limit?: number;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Trading swap-parameter input.
|
|
1765
|
+
*/
|
|
1766
|
+
export interface SwapParametersInput {
|
|
1767
|
+
/**
|
|
1768
|
+
* Order side.
|
|
1769
|
+
*/
|
|
1770
|
+
kind: OrderKindDto;
|
|
1771
|
+
/**
|
|
1772
|
+
* Optional owner override.
|
|
1773
|
+
*/
|
|
1774
|
+
owner?: string;
|
|
1775
|
+
/**
|
|
1776
|
+
* Sell-token address.
|
|
1777
|
+
*/
|
|
1778
|
+
sellToken: string;
|
|
1779
|
+
/**
|
|
1780
|
+
* Buy-token address.
|
|
1781
|
+
*/
|
|
1782
|
+
buyToken: string;
|
|
1783
|
+
/**
|
|
1784
|
+
* Amount interpreted according to `kind`.
|
|
1785
|
+
*/
|
|
1786
|
+
amount: string;
|
|
1787
|
+
/**
|
|
1788
|
+
* Optional environment override.
|
|
1789
|
+
*/
|
|
1790
|
+
env?: string;
|
|
1791
|
+
/**
|
|
1792
|
+
* Whether partial fills are allowed.
|
|
1793
|
+
*/
|
|
1794
|
+
partiallyFillable?: boolean;
|
|
1795
|
+
/**
|
|
1796
|
+
* Sell-token balance source.
|
|
1797
|
+
*/
|
|
1798
|
+
sellTokenBalance?: TokenBalanceDto;
|
|
1799
|
+
/**
|
|
1800
|
+
* Buy-token balance destination.
|
|
1801
|
+
*/
|
|
1802
|
+
buyTokenBalance?: TokenBalanceDto;
|
|
1803
|
+
/**
|
|
1804
|
+
* Optional slippage tolerance in basis points.
|
|
1805
|
+
*/
|
|
1806
|
+
slippageBps?: number;
|
|
1807
|
+
/**
|
|
1808
|
+
* Optional receiver override.
|
|
1809
|
+
*/
|
|
1810
|
+
receiver?: string;
|
|
1811
|
+
/**
|
|
1812
|
+
* Optional relative validity duration.
|
|
1813
|
+
*/
|
|
1814
|
+
validFor?: number;
|
|
1815
|
+
/**
|
|
1816
|
+
* Optional absolute UNIX expiry timestamp.
|
|
1817
|
+
*/
|
|
1818
|
+
validTo?: number;
|
|
1819
|
+
/**
|
|
1820
|
+
* Optional partner-fee metadata.
|
|
1821
|
+
*/
|
|
1822
|
+
partnerFee?: PartnerFeeInput;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* Transaction request DTO returned by transaction builders.
|
|
1827
|
+
*/
|
|
1828
|
+
export interface TransactionRequestDto {
|
|
1829
|
+
/**
|
|
1830
|
+
* Destination address.
|
|
1831
|
+
*/
|
|
1832
|
+
to?: string;
|
|
1833
|
+
/**
|
|
1834
|
+
* Hex-encoded calldata.
|
|
1835
|
+
*/
|
|
1836
|
+
data?: string;
|
|
1837
|
+
/**
|
|
1838
|
+
* Native value.
|
|
1839
|
+
*/
|
|
1840
|
+
value?: string;
|
|
1841
|
+
/**
|
|
1842
|
+
* Gas limit.
|
|
1843
|
+
*/
|
|
1844
|
+
gasLimit?: string;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* Transport-policy override accepted by JS client constructors.
|
|
1849
|
+
*/
|
|
1850
|
+
export interface TransportPolicyConfig {
|
|
1851
|
+
/**
|
|
1852
|
+
* Retry-policy override.
|
|
1853
|
+
*/
|
|
1854
|
+
retryPolicy?: RetryPolicyConfig;
|
|
1855
|
+
/**
|
|
1856
|
+
* Rate-limiter override.
|
|
1857
|
+
*/
|
|
1858
|
+
requestRateLimiter?: RequestRateLimiterConfig;
|
|
1859
|
+
/**
|
|
1860
|
+
* Retry jitter override.
|
|
1861
|
+
*/
|
|
1862
|
+
jitterStrategy?: JitterStrategyConfig;
|
|
1863
|
+
/**
|
|
1864
|
+
* Optional transport user-agent value.
|
|
1865
|
+
*/
|
|
1866
|
+
userAgent?: string;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Typed-data domain DTO.
|
|
1871
|
+
*/
|
|
1872
|
+
export interface TypedDataDomainDto {
|
|
1873
|
+
/**
|
|
1874
|
+
* Domain name.
|
|
1875
|
+
*/
|
|
1876
|
+
name: string;
|
|
1877
|
+
/**
|
|
1878
|
+
* Domain version.
|
|
1879
|
+
*/
|
|
1880
|
+
version: string;
|
|
1881
|
+
/**
|
|
1882
|
+
* Chain id.
|
|
1883
|
+
*/
|
|
1884
|
+
chainId: number;
|
|
1885
|
+
/**
|
|
1886
|
+
* Verifying contract.
|
|
1887
|
+
*/
|
|
1888
|
+
verifyingContract: string;
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* Typed-data envelope DTO.
|
|
1893
|
+
*/
|
|
1894
|
+
export interface TypedDataEnvelopeDto {
|
|
1895
|
+
/**
|
|
1896
|
+
* Domain metadata.
|
|
1897
|
+
*/
|
|
1898
|
+
domain: TypedDataDomainDto;
|
|
1899
|
+
/**
|
|
1900
|
+
* Primary type.
|
|
1901
|
+
*/
|
|
1902
|
+
primaryType: string;
|
|
1903
|
+
/**
|
|
1904
|
+
* Type map.
|
|
1905
|
+
*
|
|
1906
|
+
* Typed as `Record` because the runtime serializer
|
|
1907
|
+
* (`serde_wasm_bindgen::Serializer::json_compatible`) emits a
|
|
1908
|
+
* plain JavaScript object for `BTreeMap` fields. The override
|
|
1909
|
+
* aligns the generated TypeScript declaration with the runtime
|
|
1910
|
+
* shape so the declared type matches the value the wasm boundary
|
|
1911
|
+
* emits byte-for-byte.
|
|
1912
|
+
*/
|
|
1913
|
+
types: Record<string, TypedDataFieldDto[]>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Parsed message body.
|
|
1916
|
+
*/
|
|
1917
|
+
message: Value;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/**
|
|
1921
|
+
* Typed-data field DTO.
|
|
1922
|
+
*/
|
|
1923
|
+
export interface TypedDataFieldDto {
|
|
1924
|
+
/**
|
|
1925
|
+
* Field name.
|
|
1926
|
+
*/
|
|
1927
|
+
name: string;
|
|
1928
|
+
/**
|
|
1929
|
+
* Solidity field type.
|
|
1930
|
+
*/
|
|
1931
|
+
type: string;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* Unsigned order payload (`cow_sdk_core::OrderData`) returned by managed
|
|
1936
|
+
* trading flows.
|
|
1937
|
+
*
|
|
1938
|
+
* Mirrors the signed-order field set. Unlike [`OrderInput`], the `receiver`
|
|
1939
|
+
* is always a concrete address because managed flows resolve it before
|
|
1940
|
+
* signing, so every field is present on the wire.
|
|
1941
|
+
*/
|
|
1942
|
+
export interface OrderDataDto {
|
|
1943
|
+
/**
|
|
1944
|
+
* Sell-token address.
|
|
1945
|
+
*/
|
|
1946
|
+
sellToken: string;
|
|
1947
|
+
/**
|
|
1948
|
+
* Buy-token address.
|
|
1949
|
+
*/
|
|
1950
|
+
buyToken: string;
|
|
1951
|
+
/**
|
|
1952
|
+
* Receiver of the bought tokens.
|
|
1953
|
+
*/
|
|
1954
|
+
receiver: string;
|
|
1955
|
+
/**
|
|
1956
|
+
* Sell amount.
|
|
1957
|
+
*/
|
|
1958
|
+
sellAmount: string;
|
|
1959
|
+
/**
|
|
1960
|
+
* Buy amount.
|
|
1961
|
+
*/
|
|
1962
|
+
buyAmount: string;
|
|
1963
|
+
/**
|
|
1964
|
+
* Valid-to timestamp.
|
|
1965
|
+
*/
|
|
1966
|
+
validTo: number;
|
|
1967
|
+
/**
|
|
1968
|
+
* App-data hash.
|
|
1969
|
+
*/
|
|
1970
|
+
appData: string;
|
|
1971
|
+
/**
|
|
1972
|
+
* Fee amount.
|
|
1973
|
+
*/
|
|
1974
|
+
feeAmount: string;
|
|
1975
|
+
/**
|
|
1976
|
+
* Order side.
|
|
1977
|
+
*/
|
|
1978
|
+
kind: OrderKindDto;
|
|
1979
|
+
/**
|
|
1980
|
+
* Partial-fill flag.
|
|
1981
|
+
*/
|
|
1982
|
+
partiallyFillable: boolean;
|
|
1983
|
+
/**
|
|
1984
|
+
* Sell balance source.
|
|
1985
|
+
*/
|
|
1986
|
+
sellTokenBalance: TokenBalanceDto;
|
|
1987
|
+
/**
|
|
1988
|
+
* Buy balance destination.
|
|
1989
|
+
*/
|
|
1990
|
+
buyTokenBalance: TokenBalanceDto;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Validated 32-byte app-data hash.
|
|
1995
|
+
*
|
|
1996
|
+
* The wire form is the protocol-canonical `0x`-prefixed 66-character
|
|
1997
|
+
* lowercase hexadecimal string. The newtype is `#[repr(transparent)]`
|
|
1998
|
+
* over [`alloy_primitives::B256`], so the in-memory layout is
|
|
1999
|
+
* bit-for-bit identical to the alloy primitive and conversion at the
|
|
2000
|
+
* alloy seam is free at runtime through [`AppDataHash::as_alloy`]
|
|
2001
|
+
* (borrowed), [`AppDataHash::into_alloy`] (owned), or [`From`] /
|
|
2002
|
+
* [`Into`].
|
|
2003
|
+
*
|
|
2004
|
+
* `AppDataHash` forwards [`Serialize`] / [`Deserialize`] to the inner
|
|
2005
|
+
* [`alloy_primitives::B256`] via `#[serde(transparent)]` because the
|
|
2006
|
+
* alloy lowercase 0x-prefixed default already matches the cow wire
|
|
2007
|
+
* form. [`fmt::Display`] is a one-line delegate to the inner primitive
|
|
2008
|
+
* for the same reason.
|
|
2009
|
+
*
|
|
2010
|
+
* Equality, hash, and ordering derive from the packed 32-byte
|
|
2011
|
+
* representation, which is equivalent to the documented
|
|
2012
|
+
* case-insensitive comparison contract because every valid value parses
|
|
2013
|
+
* to the same bytes regardless of input casing.
|
|
2014
|
+
*
|
|
2015
|
+
*
|
|
2016
|
+
*/
|
|
2017
|
+
export type AppDataHash = string;
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* Validated EVM address.
|
|
2021
|
+
*
|
|
2022
|
+
* The wire form is the protocol-canonical `0x`-prefixed 42-character
|
|
2023
|
+
* lowercase hexadecimal string. The newtype is `#[repr(transparent)]` over
|
|
2024
|
+
* [`alloy_primitives::Address`], so the in-memory layout is bit-for-bit
|
|
2025
|
+
* identical to the alloy primitive and conversion at the alloy seam is free
|
|
2026
|
+
* at runtime through [`Address::as_alloy`] (borrowed), [`Address::into_alloy`]
|
|
2027
|
+
* (owned), or [`From`] / [`Into`].
|
|
2028
|
+
*
|
|
2029
|
+
* `Address` carries cow-owned [`fmt::Display`], [`Serialize`], and
|
|
2030
|
+
* [`Deserialize`] impls because alloy\'s default `Display` for
|
|
2031
|
+
* [`alloy_primitives::Address`] emits the EIP-55 mixed-case checksum form,
|
|
2032
|
+
* while the cow protocol wire form is lowercase. The cow `Display` impl
|
|
2033
|
+
* writes `format!(\"{:#x}\", self.0)` which routes through alloy\'s
|
|
2034
|
+
* [`fmt::LowerHex`] impl and emits lowercase 0x-prefixed hex.
|
|
2035
|
+
*
|
|
2036
|
+
* [`PartialEq`], [`Eq`], [`Hash`](std::hash::Hash), [`PartialOrd`], and
|
|
2037
|
+
* [`Ord`] derive from the inner alloy primitive, which compares addresses on
|
|
2038
|
+
* the packed 20-byte representation.
|
|
2039
|
+
*/
|
|
2040
|
+
export type Address = string;
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Validated `CoW` order UID.
|
|
2044
|
+
*
|
|
2045
|
+
* The wire form is the protocol-canonical `0x`-prefixed 114-character
|
|
2046
|
+
* lowercase hexadecimal string. The newtype is `#[repr(transparent)]` over
|
|
2047
|
+
* [`alloy_primitives::FixedBytes<56>`] and forwards `Display`/`Serialize`/
|
|
2048
|
+
* `Deserialize` to the inner alloy type, whose canonical defaults already
|
|
2049
|
+
* emit the cow lowercase wire form.
|
|
2050
|
+
*
|
|
2051
|
+
*
|
|
2052
|
+
*
|
|
2053
|
+
*/
|
|
2054
|
+
export type OrderUid = string;
|
|
2055
|
+
|
|
2056
|
+
/**
|
|
2057
|
+
* Validated hex payload used for calldata and byte blobs.
|
|
2058
|
+
*
|
|
2059
|
+
* The wire form is the protocol-canonical `0x`-prefixed lowercase
|
|
2060
|
+
* hexadecimal string. The newtype is `#[repr(transparent)]` over
|
|
2061
|
+
* [`alloy_primitives::Bytes`] and forwards `Display`/`Serialize`/
|
|
2062
|
+
* `Deserialize` to the inner alloy type, whose canonical defaults already
|
|
2063
|
+
* emit the cow lowercase wire form. Odd-length inputs are left-padded with
|
|
2064
|
+
* one zero nibble during construction so the stored value remains
|
|
2065
|
+
* byte-aligned hex.
|
|
2066
|
+
*/
|
|
2067
|
+
export type HexData = string;
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* Version tag carried by wasm output and error envelopes.
|
|
2071
|
+
*/
|
|
2072
|
+
export type SchemaVersion = "v1" | "__unknown";
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Versioned output envelope.
|
|
2076
|
+
*/
|
|
2077
|
+
export interface WasmEnvelope<T> {
|
|
2078
|
+
/**
|
|
2079
|
+
* Schema version.
|
|
2080
|
+
*/
|
|
2081
|
+
schemaVersion: SchemaVersion;
|
|
2082
|
+
/**
|
|
2083
|
+
* Envelope payload.
|
|
2084
|
+
*/
|
|
2085
|
+
value: T;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* `CoW` Protocol environment, mirroring `cow_sdk_core::CowEnv`.
|
|
2090
|
+
*/
|
|
2091
|
+
export type CowEnvDto = "prod" | "staging";
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* `EthFlow`-specific order metadata, mirroring
|
|
2095
|
+
* `cow_sdk_orderbook::EthflowData`.
|
|
2096
|
+
*/
|
|
2097
|
+
export interface EthflowDataDto {
|
|
2098
|
+
/**
|
|
2099
|
+
* Transaction in which the order was refunded, when present.
|
|
2100
|
+
*/
|
|
2101
|
+
refundTxHash?: string;
|
|
2102
|
+
/**
|
|
2103
|
+
* User-facing validity timestamp for the `EthFlow` order.
|
|
2104
|
+
*/
|
|
2105
|
+
userValidTo: number;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* IPFS app-data client backed by an explicitly configured HTTP transport.
|
|
2111
|
+
*
|
|
2112
|
+
* Construct this client when JavaScript needs to fetch app-data documents by
|
|
2113
|
+
* CID or app-data hash while preserving SDK retry, timeout, and cancellation
|
|
2114
|
+
* behavior.
|
|
2115
|
+
*/
|
|
2116
|
+
export class IpfsClient {
|
|
2117
|
+
free(): void;
|
|
2118
|
+
[Symbol.dispose](): void;
|
|
2119
|
+
/**
|
|
2120
|
+
* Fetches and parses an app-data document by CID.
|
|
2121
|
+
*
|
|
2122
|
+
* The CID is resolved through the configured gateway and transport. The
|
|
2123
|
+
* returned document is normalized into the SDK app-data DTO shape.
|
|
2124
|
+
*
|
|
2125
|
+
* @param cid Canonical IPFS CID for the app-data document.
|
|
2126
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2127
|
+
* @returns A versioned envelope containing the app-data document.
|
|
2128
|
+
* @throws CowError for invalid CID, transport failure, timeout, or parse failure.
|
|
2129
|
+
*/
|
|
2130
|
+
fetchAppDataFromCid(cid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<AppDataDocDto>>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Fetches and parses an app-data document by app-data hash.
|
|
2133
|
+
*
|
|
2134
|
+
* The helper converts the app-data hash to the canonical CID before
|
|
2135
|
+
* fetching through the configured gateway.
|
|
2136
|
+
*
|
|
2137
|
+
* @param appDataHex App-data hash as a `0x`-prefixed hex string.
|
|
2138
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2139
|
+
* @returns A versioned envelope containing the app-data document.
|
|
2140
|
+
* @throws CowError for invalid hash, transport failure, timeout, or parse failure.
|
|
2141
|
+
*/
|
|
2142
|
+
fetchAppDataFromHex(appDataHex: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<AppDataDocDto>>;
|
|
2143
|
+
/**
|
|
2144
|
+
* Creates an IPFS app-data client from a single config object.
|
|
2145
|
+
*
|
|
2146
|
+
* The config must include `transport`. Optional `ipfsUri` overrides the
|
|
2147
|
+
* default gateway base, while timeout, signal, and policy fields become
|
|
2148
|
+
* defaults for method calls.
|
|
2149
|
+
*
|
|
2150
|
+
* @param config IPFS client configuration.
|
|
2151
|
+
* @throws CowError when transport, policy, timeout, or gateway config is invalid.
|
|
2152
|
+
*/
|
|
2153
|
+
constructor(config: IpfsClientConfig);
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Orderbook client backed by an explicitly configured HTTP transport.
|
|
2158
|
+
*
|
|
2159
|
+
* Construct this client when JavaScript needs direct access to quote,
|
|
2160
|
+
* submission, lookup, trade, native-price, app-data, and cancellation orderbook
|
|
2161
|
+
* endpoints. The client owns one callback registration and releases raw wasm
|
|
2162
|
+
* resources through the facade `dispose()` method.
|
|
2163
|
+
*/
|
|
2164
|
+
export class OrderBookClient {
|
|
2165
|
+
free(): void;
|
|
2166
|
+
[Symbol.dispose](): void;
|
|
2167
|
+
/**
|
|
2168
|
+
* Submits signed off-chain order cancellations.
|
|
2169
|
+
*
|
|
2170
|
+
* Build the signed cancellation payload with one of the cancellation
|
|
2171
|
+
* signing helpers, then submit it through the same orderbook runtime
|
|
2172
|
+
* configuration used for order operations.
|
|
2173
|
+
*
|
|
2174
|
+
* @param signed Signed cancellation payload.
|
|
2175
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2176
|
+
* @returns A versioned envelope containing `{ cancelled: true }` on success.
|
|
2177
|
+
* @throws CowError for invalid UID, signature, transport failure, or timeout.
|
|
2178
|
+
*/
|
|
2179
|
+
cancelOrders(signed: SignedCancellationsInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<{ cancelled: true }>>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Fetches the full app-data document registered for an app-data hash.
|
|
2182
|
+
*
|
|
2183
|
+
* Use this to retrieve the canonical app-data payload the orderbook holds
|
|
2184
|
+
* for a given hash, for example to display or re-verify a document
|
|
2185
|
+
* referenced by an order.
|
|
2186
|
+
*
|
|
2187
|
+
* @param appDataHash App-data hash as a `0x`-prefixed 32-byte hex string.
|
|
2188
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2189
|
+
* @returns A versioned envelope containing the app-data document.
|
|
2190
|
+
* @throws CowError for an invalid hash, transport failure, or timeout.
|
|
2191
|
+
*/
|
|
2192
|
+
getAppData(appDataHash: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<AppDataObjectDto>>;
|
|
2193
|
+
/**
|
|
2194
|
+
* Fetches a token's native price from the orderbook API.
|
|
2195
|
+
*
|
|
2196
|
+
* The token must be an EVM address. The returned value follows the
|
|
2197
|
+
* orderbook native-price response shape.
|
|
2198
|
+
*
|
|
2199
|
+
* @param token Token address to price.
|
|
2200
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2201
|
+
* @returns A versioned envelope containing native price data.
|
|
2202
|
+
* @throws CowError for invalid token address, transport failure, or timeout.
|
|
2203
|
+
*/
|
|
2204
|
+
getNativePrice(token: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<NativePriceResponseDto>>;
|
|
2205
|
+
/**
|
|
2206
|
+
* Fetches one order by its canonical order UID.
|
|
2207
|
+
*
|
|
2208
|
+
* The UID must be the full 56-byte CoW order UID encoded as a `0x`-prefixed
|
|
2209
|
+
* string. The response is returned in the orderbook wire DTO shape.
|
|
2210
|
+
*
|
|
2211
|
+
* @param orderUid Full order UID to look up.
|
|
2212
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2213
|
+
* @returns A versioned envelope containing the order response.
|
|
2214
|
+
* @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
|
|
2215
|
+
*/
|
|
2216
|
+
getOrder(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<OrderDto>>;
|
|
2217
|
+
/**
|
|
2218
|
+
* Fetches the live competition status for one order.
|
|
2219
|
+
*
|
|
2220
|
+
* Returns the order's status in the current or most recent solver
|
|
2221
|
+
* competition, including any per-solver executed amounts the service
|
|
2222
|
+
* reports. The UID must be the full 56-byte CoW order UID.
|
|
2223
|
+
*
|
|
2224
|
+
* @param orderUid Full order UID to look up.
|
|
2225
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2226
|
+
* @returns A versioned envelope containing the competition status.
|
|
2227
|
+
* @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
|
|
2228
|
+
*/
|
|
2229
|
+
getOrderCompetitionStatus(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<CompetitionOrderStatusDto>>;
|
|
2230
|
+
/**
|
|
2231
|
+
* Builds the public order-details URL for a UID without any network call.
|
|
2232
|
+
*
|
|
2233
|
+
* @param orderUid Full order UID to link to.
|
|
2234
|
+
* @returns A versioned envelope containing the order-details URL.
|
|
2235
|
+
* @throws CowError for an invalid UID or an unresolved base URL.
|
|
2236
|
+
*/
|
|
2237
|
+
getOrderLink(orderUid: string): WasmEnvelope<string>;
|
|
2238
|
+
/**
|
|
2239
|
+
* Fetches an order by UID, falling back across environments on a 404.
|
|
2240
|
+
*
|
|
2241
|
+
* @param orderUid Full order UID to look up.
|
|
2242
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2243
|
+
* @returns A versioned envelope containing the order response.
|
|
2244
|
+
* @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
|
|
2245
|
+
*/
|
|
2246
|
+
getOrderMultiEnv(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<OrderDto>>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Fetches orders owned by an address with optional pagination.
|
|
2249
|
+
*
|
|
2250
|
+
* The owner address is validated before the request is dispatched. The
|
|
2251
|
+
* response preserves the typed orderbook order shape.
|
|
2252
|
+
*
|
|
2253
|
+
* @param owner Owner address to query.
|
|
2254
|
+
* @param pagination Optional offset and limit.
|
|
2255
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2256
|
+
* @returns A versioned envelope containing matching orders.
|
|
2257
|
+
* @throws CowError for invalid owner, transport failure, timeout, or cancellation.
|
|
2258
|
+
*/
|
|
2259
|
+
getOrders(owner: string, pagination?: PaginationOptions | null, options?: SdkClientOptions | null): Promise<WasmEnvelope<OrderDto[]>>;
|
|
2260
|
+
/**
|
|
2261
|
+
* Fetches a price quote from the orderbook API.
|
|
2262
|
+
*
|
|
2263
|
+
* The request is converted to the typed orderbook quote request and sent
|
|
2264
|
+
* through the configured transport. Per-call options can override the
|
|
2265
|
+
* constructor timeout or attach an `AbortSignal`.
|
|
2266
|
+
*
|
|
2267
|
+
* @param request Quote request DTO.
|
|
2268
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2269
|
+
* @returns A versioned envelope containing the quote response.
|
|
2270
|
+
* @throws CowError for invalid input, transport failure, timeout, or cancellation.
|
|
2271
|
+
*/
|
|
2272
|
+
getQuote(request: OrderQuoteRequestInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<OrderQuoteResponseDto>>;
|
|
2273
|
+
/**
|
|
2274
|
+
* Fetches the total accumulated surplus for an account.
|
|
2275
|
+
*
|
|
2276
|
+
* Returns the lifetime surplus the protocol has captured for the owner
|
|
2277
|
+
* across its settled orders, in the upstream decimal-string wire shape.
|
|
2278
|
+
*
|
|
2279
|
+
* @param owner Owner address to query.
|
|
2280
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2281
|
+
* @returns A versioned envelope containing the total-surplus response.
|
|
2282
|
+
* @throws CowError for invalid owner, transport failure, or timeout.
|
|
2283
|
+
*/
|
|
2284
|
+
getTotalSurplus(owner: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<TotalSurplusDto>>;
|
|
2285
|
+
/**
|
|
2286
|
+
* Fetches trades for exactly one owner address or order UID.
|
|
2287
|
+
*
|
|
2288
|
+
* The query must set one of `owner` or `orderUid`, not both. Optional
|
|
2289
|
+
* pagination fields are forwarded to the orderbook request.
|
|
2290
|
+
*
|
|
2291
|
+
* @param query Trade query DTO.
|
|
2292
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2293
|
+
* @returns A versioned envelope containing matching trades.
|
|
2294
|
+
* @throws CowError when the query is ambiguous or transport fails.
|
|
2295
|
+
*/
|
|
2296
|
+
getTrades(query: TradesQueryInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<TradeDto[]>>;
|
|
2297
|
+
/**
|
|
2298
|
+
* Fetches the orders contained in a settlement transaction.
|
|
2299
|
+
*
|
|
2300
|
+
* @param txHash Settlement transaction hash.
|
|
2301
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2302
|
+
* @returns A versioned envelope containing the settled orders.
|
|
2303
|
+
* @throws CowError for an invalid hash, transport failure, timeout, or cancellation.
|
|
2304
|
+
*/
|
|
2305
|
+
getTxOrders(txHash: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<OrderDto[]>>;
|
|
2306
|
+
/**
|
|
2307
|
+
* Fetches the orderbook service version string.
|
|
2308
|
+
*
|
|
2309
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2310
|
+
* @returns A versioned envelope containing the service version string.
|
|
2311
|
+
* @throws CowError for transport failure, timeout, or cancellation.
|
|
2312
|
+
*/
|
|
2313
|
+
getVersion(options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
2314
|
+
/**
|
|
2315
|
+
* Creates an orderbook client from a single config object.
|
|
2316
|
+
*
|
|
2317
|
+
* The config must include `chainId` and `transport`. The optional
|
|
2318
|
+
* `timeoutMs`, `signal`, and `transportPolicy` fields become defaults for
|
|
2319
|
+
* calls made through this client unless a method call overrides them.
|
|
2320
|
+
*
|
|
2321
|
+
* @param config Orderbook client configuration.
|
|
2322
|
+
* @throws CowError when the chain, environment, transport, or policy is invalid.
|
|
2323
|
+
*/
|
|
2324
|
+
constructor(config: OrderBookClientConfig);
|
|
2325
|
+
/**
|
|
2326
|
+
* Submits a signed order to the orderbook.
|
|
2327
|
+
*
|
|
2328
|
+
* The signed DTO normally comes from a signing helper in the same package.
|
|
2329
|
+
* The SDK reconstructs the typed order creation payload and returns the
|
|
2330
|
+
* order UID assigned by the orderbook service.
|
|
2331
|
+
*
|
|
2332
|
+
* @param signed Signed order DTO including typed data, signature, owner, and scheme.
|
|
2333
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2334
|
+
* @returns A versioned envelope containing the submitted order UID.
|
|
2335
|
+
* @throws CowError for invalid signatures, transport failure, timeout, or rejection.
|
|
2336
|
+
*/
|
|
2337
|
+
sendOrder(signed: SignedOrderDto, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
2338
|
+
/**
|
|
2339
|
+
* Submits a raw order-creation payload to the orderbook.
|
|
2340
|
+
*
|
|
2341
|
+
* Use this method when the host already has a complete orderbook
|
|
2342
|
+
* `OrderCreation` shape and does not need the facade to reconstruct it
|
|
2343
|
+
* from a signed-order DTO.
|
|
2344
|
+
*
|
|
2345
|
+
* @param input Raw order-creation DTO.
|
|
2346
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2347
|
+
* @returns A versioned envelope containing the submitted order UID.
|
|
2348
|
+
* @throws CowError for malformed input, transport failure, timeout, or rejection.
|
|
2349
|
+
*/
|
|
2350
|
+
sendOrderCreation(input: OrderCreationInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
2351
|
+
/**
|
|
2352
|
+
* Uploads the full app-data JSON for a content-addressed app-data hash.
|
|
2353
|
+
*
|
|
2354
|
+
* The SDK enforces the content-addressed-write invariant: the keccak-256
|
|
2355
|
+
* digest of `fullAppData` must equal `appDataHash`, or the call rejects
|
|
2356
|
+
* before any network request. Serialize `fullAppData` with the canonical
|
|
2357
|
+
* app-data writer so the digest matches.
|
|
2358
|
+
*
|
|
2359
|
+
* @param appDataHash App-data hash as a `0x`-prefixed 32-byte hex string.
|
|
2360
|
+
* @param fullAppData Canonically serialized app-data JSON payload.
|
|
2361
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2362
|
+
* @returns A versioned envelope containing `{ uploaded: true }` on success.
|
|
2363
|
+
* @throws CowError for a hash mismatch, invalid hash, transport failure, or timeout.
|
|
2364
|
+
*/
|
|
2365
|
+
uploadAppData(appDataHash: string, fullAppData: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<{ uploaded: true }>>;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Read-only subgraph client backed by an explicitly configured transport.
|
|
2370
|
+
*
|
|
2371
|
+
* Construct this client when JavaScript needs protocol totals, recent volume,
|
|
2372
|
+
* or custom GraphQL query execution through the same transport and policy
|
|
2373
|
+
* model as the orderbook clients.
|
|
2374
|
+
*/
|
|
2375
|
+
export class SubgraphClient {
|
|
2376
|
+
free(): void;
|
|
2377
|
+
[Symbol.dispose](): void;
|
|
2378
|
+
/**
|
|
2379
|
+
* Fetches recent daily volume rows.
|
|
2380
|
+
*
|
|
2381
|
+
* The `days` value controls how many recent daily buckets the subgraph
|
|
2382
|
+
* query requests.
|
|
2383
|
+
*
|
|
2384
|
+
* @param days Number of daily buckets to fetch.
|
|
2385
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2386
|
+
* @returns A versioned envelope containing daily volume rows.
|
|
2387
|
+
* @throws CowError for invalid query shape, transport failure, or timeout.
|
|
2388
|
+
*/
|
|
2389
|
+
getLastDaysVolume(days: number, options?: SdkClientOptions | null): Promise<any>;
|
|
2390
|
+
/**
|
|
2391
|
+
* Fetches recent hourly volume rows.
|
|
2392
|
+
*
|
|
2393
|
+
* The `hours` value controls how many recent hourly buckets the subgraph
|
|
2394
|
+
* query requests.
|
|
2395
|
+
*
|
|
2396
|
+
* @param hours Number of hourly buckets to fetch.
|
|
2397
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2398
|
+
* @returns A versioned envelope containing hourly volume rows.
|
|
2399
|
+
* @throws CowError for invalid query shape, transport failure, or timeout.
|
|
2400
|
+
*/
|
|
2401
|
+
getLastHoursVolume(hours: number, options?: SdkClientOptions | null): Promise<any>;
|
|
2402
|
+
/**
|
|
2403
|
+
* Fetches aggregate protocol totals from the subgraph.
|
|
2404
|
+
*
|
|
2405
|
+
* The request uses the client's configured chain, API key, transport, and
|
|
2406
|
+
* transport policy.
|
|
2407
|
+
*
|
|
2408
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2409
|
+
* @returns A versioned envelope containing aggregate totals.
|
|
2410
|
+
* @throws CowError for transport, cancellation, timeout, or subgraph errors.
|
|
2411
|
+
*/
|
|
2412
|
+
getTotals(options?: SdkClientOptions | null): Promise<any>;
|
|
2413
|
+
/**
|
|
2414
|
+
* Creates a subgraph client from a single config object.
|
|
2415
|
+
*
|
|
2416
|
+
* The config must include `chainId`, `apiKey`, and `transport`. Optional
|
|
2417
|
+
* timeout, signal, and policy fields become client defaults for later
|
|
2418
|
+
* method calls.
|
|
2419
|
+
*
|
|
2420
|
+
* @param config Subgraph client configuration.
|
|
2421
|
+
* @throws CowError when the chain, API key, transport, or policy is invalid.
|
|
2422
|
+
*/
|
|
2423
|
+
constructor(config: SubgraphClientConfig);
|
|
2424
|
+
/**
|
|
2425
|
+
* Runs a caller-provided GraphQL query against the configured subgraph.
|
|
2426
|
+
*
|
|
2427
|
+
* Use this method when the built-in totals or volume helpers are too
|
|
2428
|
+
* narrow. Variables and operation name are forwarded when present.
|
|
2429
|
+
*
|
|
2430
|
+
* @param request GraphQL query, variables, and optional operation name.
|
|
2431
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2432
|
+
* @returns A versioned envelope containing the JSON GraphQL response.
|
|
2433
|
+
* @throws CowError for transport, timeout, cancellation, or GraphQL errors.
|
|
2434
|
+
*/
|
|
2435
|
+
runQuery(request: SubgraphQueryInput, options?: SdkClientOptions | null): Promise<any>;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* High-level trading client backed by an explicitly configured orderbook.
|
|
2440
|
+
*
|
|
2441
|
+
* Construct this client when JavaScript needs quote, sign, post, allowance,
|
|
2442
|
+
* and native-sell helper workflows rather than direct orderbook calls. The
|
|
2443
|
+
* client keeps app-code, chain, environment, transport, and policy defaults.
|
|
2444
|
+
*/
|
|
2445
|
+
export class TradingClient {
|
|
2446
|
+
free(): void;
|
|
2447
|
+
[Symbol.dispose](): void;
|
|
2448
|
+
/**
|
|
2449
|
+
* Builds the ERC-20 approval transaction for the CoW Protocol vault relayer.
|
|
2450
|
+
*
|
|
2451
|
+
* The SDK encodes the unsigned `approve` transaction; the JavaScript host
|
|
2452
|
+
* owns submission through its own wallet. This completes the
|
|
2453
|
+
* read-allowance-then-approve path alongside `getCowProtocolAllowance`.
|
|
2454
|
+
*
|
|
2455
|
+
* @param params Approval parameters DTO (token, amount, optional vault-relayer override).
|
|
2456
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2457
|
+
* @returns A versioned envelope containing the unsigned approval transaction request.
|
|
2458
|
+
* @throws CowError when the token, amount, or vault-relayer override is invalid.
|
|
2459
|
+
*/
|
|
2460
|
+
buildApprovalTx(params: ApprovalParametersInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<TransactionRequestDto>>;
|
|
2461
|
+
/**
|
|
2462
|
+
* Builds the transaction for a native-currency sell order.
|
|
2463
|
+
*
|
|
2464
|
+
* The helper validates that the order sells the native-token sentinel,
|
|
2465
|
+
* resolves the EthFlow deployment, and returns a transaction request for
|
|
2466
|
+
* the host wallet to submit.
|
|
2467
|
+
*
|
|
2468
|
+
* @param order Unsigned native-sell order DTO.
|
|
2469
|
+
* @param quoteId Quote identifier returned by the orderbook.
|
|
2470
|
+
* @param from Transaction sender address.
|
|
2471
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2472
|
+
* @returns A versioned envelope containing order UID and transaction request.
|
|
2473
|
+
* @throws CowError when the order, chain, deployment, or sender is invalid.
|
|
2474
|
+
*/
|
|
2475
|
+
buildSellNativeCurrencyTx(order: OrderInput, quoteId: number, from: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<BuiltSellNativeCurrencyTxDto>>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Reads CoW Protocol allowance through a read-only contract callback.
|
|
2478
|
+
*
|
|
2479
|
+
* The SDK builds the contract call while the JavaScript host performs the
|
|
2480
|
+
* actual chain read. Use this when a TypeScript runtime owns the RPC
|
|
2481
|
+
* provider.
|
|
2482
|
+
*
|
|
2483
|
+
* @param params Allowance parameters DTO.
|
|
2484
|
+
* @param readContractCallback Callback that executes the read-only call.
|
|
2485
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2486
|
+
* @returns A versioned envelope containing the allowance amount string.
|
|
2487
|
+
* @throws CowError for invalid parameters, callback failure, timeout, or cancellation.
|
|
2488
|
+
*/
|
|
2489
|
+
getCowProtocolAllowance(params: AllowanceParametersInput, readContractCallback: ContractReadCallback, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
2490
|
+
/**
|
|
2491
|
+
* Fetches a quote without signing or submitting an order.
|
|
2492
|
+
*
|
|
2493
|
+
* Use this method when a host wants to preview the quote response before
|
|
2494
|
+
* asking a wallet to sign or before constructing a post request.
|
|
2495
|
+
*
|
|
2496
|
+
* @param params Swap parameters DTO.
|
|
2497
|
+
* @param options Optional per-call cancellation and timeout settings.
|
|
2498
|
+
* @returns A versioned envelope containing quote results.
|
|
2499
|
+
* @throws CowError for invalid parameters, transport failure, timeout, or cancellation.
|
|
2500
|
+
*/
|
|
2501
|
+
getQuote(params: SwapParametersInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<QuoteResultsDto>>;
|
|
2502
|
+
/**
|
|
2503
|
+
* Creates a trading client from a single config object.
|
|
2504
|
+
*
|
|
2505
|
+
* The config must include `chainId`, `appCode`, and `transport`. Optional
|
|
2506
|
+
* environment, API key, timeout, signal, and transport policy fields become
|
|
2507
|
+
* defaults for all trading methods.
|
|
2508
|
+
*
|
|
2509
|
+
* @param config Trading client configuration.
|
|
2510
|
+
* @throws CowError when chain, app-code, environment, transport, or policy validation fails.
|
|
2511
|
+
*/
|
|
2512
|
+
constructor(config: TradingClientConfig);
|
|
2513
|
+
/**
|
|
2514
|
+
* Signs and posts a limit order through a typed-data callback.
|
|
2515
|
+
*
|
|
2516
|
+
* This helper follows the native limit-order trading path and lets the SDK
|
|
2517
|
+
* build, sign, and submit the order using the configured orderbook.
|
|
2518
|
+
*
|
|
2519
|
+
* @param params Limit-order parameters DTO.
|
|
2520
|
+
* @param owner Owner address to bind to the order when absent from params.
|
|
2521
|
+
* @param signerCallback Callback that signs the typed-data envelope.
|
|
2522
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2523
|
+
* @returns A versioned envelope containing order posting output.
|
|
2524
|
+
* @throws CowError for invalid input, wallet failure, timeout, or rejection.
|
|
2525
|
+
*/
|
|
2526
|
+
postLimitOrder(params: LimitTradeParametersInput, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<OrderPostingResultDto>>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Quotes, signs, and posts a swap order through a typed-data callback.
|
|
2529
|
+
*
|
|
2530
|
+
* The SDK fetches a quote, builds the order to sign, invokes the callback
|
|
2531
|
+
* with the EIP-712 envelope, posts the signed order, and returns posting
|
|
2532
|
+
* output from the trading workflow.
|
|
2533
|
+
*
|
|
2534
|
+
* @param params Swap parameters DTO.
|
|
2535
|
+
* @param owner Owner address to bind to the order.
|
|
2536
|
+
* @param signerCallback Callback that signs the typed-data envelope.
|
|
2537
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2538
|
+
* @returns A versioned envelope containing order posting output.
|
|
2539
|
+
* @throws CowError for invalid input, quote failure, wallet failure, timeout, or rejection.
|
|
2540
|
+
*/
|
|
2541
|
+
postSwapOrder(params: SwapParametersInput, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<OrderPostingResultDto>>;
|
|
2542
|
+
/**
|
|
2543
|
+
* Signs and posts a previously quoted swap order.
|
|
2544
|
+
*
|
|
2545
|
+
* Use this method when a host has already called `getQuote` and wants to
|
|
2546
|
+
* reuse that quote result for posting without requesting a new quote.
|
|
2547
|
+
*
|
|
2548
|
+
* @param quoteResults Quote result DTO returned by `getQuote`.
|
|
2549
|
+
* @param owner Owner address to bind to the order.
|
|
2550
|
+
* @param signerCallback Callback that signs the typed-data envelope.
|
|
2551
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2552
|
+
* @returns A versioned envelope containing order posting output.
|
|
2553
|
+
* @throws CowError for invalid quote data, wallet failure, timeout, or rejection.
|
|
2554
|
+
*/
|
|
2555
|
+
postSwapOrderFromQuote(quoteResults: QuoteResultsDto, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<OrderPostingResultDto>>;
|
|
2556
|
+
/**
|
|
2557
|
+
* Quotes and posts a swap order with a custom EIP-1271 signature callback.
|
|
2558
|
+
*
|
|
2559
|
+
* Use this method when a smart-account runtime owns final contract
|
|
2560
|
+
* signature production. The SDK still quotes the swap, builds typed data,
|
|
2561
|
+
* posts the signed order, and returns posting output.
|
|
2562
|
+
*
|
|
2563
|
+
* @param params Swap parameters DTO.
|
|
2564
|
+
* @param owner Smart-account owner address.
|
|
2565
|
+
* @param customCallback Callback that returns the final EIP-1271 signature.
|
|
2566
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2567
|
+
* @returns A versioned envelope containing order posting output.
|
|
2568
|
+
* @throws CowError for invalid input, quote failure, callback failure, timeout, or rejection.
|
|
2569
|
+
*/
|
|
2570
|
+
postSwapOrderWithEip1271(params: SwapParametersInput, owner: string, customCallback: CustomEip1271Callback, options?: SigningOptions | null): Promise<WasmEnvelope<OrderPostingResultDto>>;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
/**
|
|
2574
|
+
* Initializes the wasm crate's panic hook once.
|
|
2575
|
+
*/
|
|
2576
|
+
export function __cow_sdk_wasm_init(): void;
|
|
2577
|
+
|
|
2578
|
+
/**
|
|
2579
|
+
* Builds a normalized app-data document without deriving storage metadata.
|
|
2580
|
+
*
|
|
2581
|
+
* This helper is useful when a host wants to inspect or modify the canonical
|
|
2582
|
+
* document shape before separately deriving app-data information.
|
|
2583
|
+
*
|
|
2584
|
+
* @param doc App-data document input accepted by the SDK schema.
|
|
2585
|
+
* @returns A versioned envelope containing the normalized document.
|
|
2586
|
+
* @throws CowError when the input cannot be normalized.
|
|
2587
|
+
*/
|
|
2588
|
+
export function appDataDoc(doc: AppDataDocInput): WasmEnvelope<AppDataDocDto>;
|
|
2589
|
+
|
|
2590
|
+
/**
|
|
2591
|
+
* Converts a `0x`-prefixed app-data hash into the canonical IPFS CID.
|
|
2592
|
+
*
|
|
2593
|
+
* The conversion is pure and uses the same app-data multicodec and multihash
|
|
2594
|
+
* rules as the Rust app-data crate.
|
|
2595
|
+
*
|
|
2596
|
+
* @param appDataHex App-data hash as a `0x`-prefixed hex string.
|
|
2597
|
+
* @returns A versioned envelope containing the CID string.
|
|
2598
|
+
* @throws CowError when the hash is malformed.
|
|
2599
|
+
*/
|
|
2600
|
+
export function appDataHexToCid(appDataHex: string): WasmEnvelope<string>;
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* Builds app-data content and returns its deterministic hash and CID.
|
|
2604
|
+
*
|
|
2605
|
+
* Use this when a JavaScript host wants the SDK to construct the canonical
|
|
2606
|
+
* document and expose the values needed for order submission and storage.
|
|
2607
|
+
*
|
|
2608
|
+
* @param doc App-data document input accepted by the SDK schema.
|
|
2609
|
+
* @returns A versioned envelope containing document, hash, CID, and hex data.
|
|
2610
|
+
* @throws CowError when the document cannot be normalized or hashed.
|
|
2611
|
+
*/
|
|
2612
|
+
export function appDataInfo(doc: AppDataDocInput): WasmEnvelope<AppDataInfoDto>;
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* Builds a settlement cancellation transaction for an order UID.
|
|
2616
|
+
*
|
|
2617
|
+
* The returned transaction request targets the Settlement contract and encodes
|
|
2618
|
+
* `invalidateOrder(bytes)`. The host wallet remains responsible for submitting
|
|
2619
|
+
* and observing the transaction.
|
|
2620
|
+
*
|
|
2621
|
+
* @param params Order UID, chain, environment, and optional deployment override.
|
|
2622
|
+
* @returns A versioned envelope containing the transaction request DTO.
|
|
2623
|
+
* @throws CowError when the chain, deployment, or order UID is invalid.
|
|
2624
|
+
*/
|
|
2625
|
+
export function buildCancelOrderTx(params: OrderTraderParametersInput): WasmEnvelope<TransactionRequestDto>;
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* Builds a settlement pre-sign transaction for an order UID.
|
|
2629
|
+
*
|
|
2630
|
+
* The returned transaction request targets the Settlement contract and encodes
|
|
2631
|
+
* `setPreSignature(bytes,bool)` with the order UID and `true` flag. The host
|
|
2632
|
+
* wallet remains responsible for transaction submission.
|
|
2633
|
+
*
|
|
2634
|
+
* @param params Order UID, chain, environment, and optional deployment override.
|
|
2635
|
+
* @returns A versioned envelope containing the transaction request DTO.
|
|
2636
|
+
* @throws CowError when the chain, deployment, or order UID is invalid.
|
|
2637
|
+
*/
|
|
2638
|
+
export function buildPresignTx(params: OrderTraderParametersInput): WasmEnvelope<TransactionRequestDto>;
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Converts a canonical IPFS CID into a `0x`-prefixed app-data hash.
|
|
2642
|
+
*
|
|
2643
|
+
* Use this helper when an order or metadata path starts from a CID but the
|
|
2644
|
+
* orderbook request needs the app-data hash form.
|
|
2645
|
+
*
|
|
2646
|
+
* @param cid Canonical CID string for an app-data document.
|
|
2647
|
+
* @returns A versioned envelope containing the `0x`-prefixed hash.
|
|
2648
|
+
* @throws CowError when the CID does not match the supported app-data shape.
|
|
2649
|
+
*/
|
|
2650
|
+
export function cidToAppDataHex(cid: string): WasmEnvelope<string>;
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* Computes the canonical order UID and order digest for an unsigned order.
|
|
2654
|
+
*
|
|
2655
|
+
* The UID combines the EIP-712 order digest, owner address, and validity
|
|
2656
|
+
* timestamp using the same packing rules as the native Rust SDK.
|
|
2657
|
+
*
|
|
2658
|
+
* @param input Unsigned order fields to hash and pack.
|
|
2659
|
+
* @param chainId EVM chain id used for the EIP-712 domain.
|
|
2660
|
+
* @param owner Order owner address included in the UID suffix.
|
|
2661
|
+
* @returns A versioned envelope with `orderUid` and `orderDigest`.
|
|
2662
|
+
* @throws CowError when the order, owner, or chain id is invalid.
|
|
2663
|
+
*/
|
|
2664
|
+
export function computeOrderUid(input: OrderInput, chainId: number, owner: string): WasmEnvelope<GeneratedOrderUidDto>;
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Decodes an eth-flow on-chain order lifecycle event log into a typed event.
|
|
2668
|
+
*
|
|
2669
|
+
* Dispatches on the log's topic-0 across the `CoWSwapOnchainOrders`
|
|
2670
|
+
* `OrderPlacement` / `OrderInvalidation` events and the `CoWSwapEthFlow`
|
|
2671
|
+
* `OrderRefund` event. The decode is fail-closed: the topic set and on-chain
|
|
2672
|
+
* signing scheme are validated and every order UID is length-checked, so a
|
|
2673
|
+
* malformed or hostile log returns a typed error rather than panicking.
|
|
2674
|
+
*
|
|
2675
|
+
* @param log Raw log with `topics` (0x-prefixed 32-byte hex, topic-0 first)
|
|
2676
|
+
* and `data` (0x-prefixed hex, `"0x"` when empty).
|
|
2677
|
+
* @returns A versioned envelope containing the decoded eth-flow event.
|
|
2678
|
+
* @throws CowError when the log is malformed or its topic set matches no known
|
|
2679
|
+
* eth-flow lifecycle event.
|
|
2680
|
+
*/
|
|
2681
|
+
export function decodeEthFlowLog(log: EventLogInput): WasmEnvelope<EthFlowEventDto>;
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* Decodes a `GPv2Settlement` event log into a typed settlement event.
|
|
2685
|
+
*
|
|
2686
|
+
* Dispatches on the log's topic-0 across `Trade`, `Interaction`, `Settlement`,
|
|
2687
|
+
* `OrderInvalidated`, and `PreSignature`. The decode is fail-closed: the topic
|
|
2688
|
+
* set is validated before ABI decoding and every order UID is length-checked,
|
|
2689
|
+
* so a malformed or hostile log returns a typed error rather than panicking.
|
|
2690
|
+
*
|
|
2691
|
+
* @param log Raw log with `topics` (0x-prefixed 32-byte hex, topic-0 first)
|
|
2692
|
+
* and `data` (0x-prefixed hex, `"0x"` when empty).
|
|
2693
|
+
* @returns A versioned envelope containing the decoded settlement event.
|
|
2694
|
+
* @throws CowError when the log is malformed or its topic set matches no known
|
|
2695
|
+
* settlement event.
|
|
2696
|
+
*/
|
|
2697
|
+
export function decodeSettlementLog(log: EventLogInput): WasmEnvelope<SettlementEventDto>;
|
|
2698
|
+
|
|
2699
|
+
/**
|
|
2700
|
+
* Returns canonical CoW Protocol deployment addresses for a chain.
|
|
2701
|
+
*
|
|
2702
|
+
* The optional environment selects production or staging deployment data. When
|
|
2703
|
+
* omitted, the helper uses the SDK default environment.
|
|
2704
|
+
*
|
|
2705
|
+
* @param chainId EVM chain id to resolve.
|
|
2706
|
+
* @param env Optional CoW environment name, such as `prod` or `staging`.
|
|
2707
|
+
* @returns Settlement, VaultRelayer, EthFlow, and AllowListAuth addresses.
|
|
2708
|
+
* @throws CowError when the chain or environment is unsupported.
|
|
2709
|
+
*/
|
|
2710
|
+
export function deploymentAddresses(chainId: number, env?: string | null): WasmEnvelope<DeploymentAddressesDto>;
|
|
2711
|
+
|
|
2712
|
+
/**
|
|
2713
|
+
* Computes the CoW Protocol EIP-712 domain separator for a supported chain.
|
|
2714
|
+
*
|
|
2715
|
+
* Use this helper when a JavaScript host needs to compare the domain hash used
|
|
2716
|
+
* by the Rust SDK with another signing stack. The input is an EVM chain id,
|
|
2717
|
+
* not a CoW environment selector.
|
|
2718
|
+
*
|
|
2719
|
+
* @param chainId EVM chain id supported by the deployment registry.
|
|
2720
|
+
* @returns The `0x`-prefixed 32-byte domain separator.
|
|
2721
|
+
* @throws CowError when the chain is not supported.
|
|
2722
|
+
*/
|
|
2723
|
+
export function domainSeparator(chainId: number): string;
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* Encodes a CoW EIP-1271 payload from an ECDSA order signature.
|
|
2727
|
+
*
|
|
2728
|
+
* Use this pure helper when a smart-account flow already has the wrapped ECDSA
|
|
2729
|
+
* signature and needs the contract-signature payload bytes expected by CoW
|
|
2730
|
+
* Protocol order submission.
|
|
2731
|
+
*
|
|
2732
|
+
* @param input Unsigned order used to derive the EIP-1271 payload.
|
|
2733
|
+
* @param ecdsaSignature Wrapped ECDSA signature as a `0x`-prefixed string.
|
|
2734
|
+
* @returns A versioned envelope containing the encoded EIP-1271 payload.
|
|
2735
|
+
* @throws CowError when the order or signature is invalid.
|
|
2736
|
+
*/
|
|
2737
|
+
export function eip1271SignaturePayload(input: OrderInput, ecdsaSignature: string): WasmEnvelope<string>;
|
|
2738
|
+
|
|
2739
|
+
/**
|
|
2740
|
+
* Builds signer-facing EIP-712 typed data for an unsigned order.
|
|
2741
|
+
*
|
|
2742
|
+
* The returned envelope contains the domain, type map, primary type, and
|
|
2743
|
+
* order message that wallet libraries expect for EIP-712 signing. It is
|
|
2744
|
+
* deterministic for the provided order and chain id.
|
|
2745
|
+
*
|
|
2746
|
+
* @param input Unsigned order fields using the facade order DTO shape.
|
|
2747
|
+
* @param chainId EVM chain id used for the EIP-712 domain.
|
|
2748
|
+
* @returns A versioned envelope containing typed-data DTO fields.
|
|
2749
|
+
* @throws CowError when order parsing or chain validation fails.
|
|
2750
|
+
*/
|
|
2751
|
+
export function orderTypedData(input: OrderInput, chainId: number): WasmEnvelope<TypedDataEnvelopeDto>;
|
|
2752
|
+
|
|
2753
|
+
/**
|
|
2754
|
+
* Signs a cancellation digest through an explicit `eth_sign` callback.
|
|
2755
|
+
*
|
|
2756
|
+
* The SDK computes the canonical cancellation digest for the provided UIDs and
|
|
2757
|
+
* passes it to the digest signer callback as a `0x`-prefixed string.
|
|
2758
|
+
*
|
|
2759
|
+
* @param orderUids One or more full order UIDs to cancel.
|
|
2760
|
+
* @param chainId EVM chain id used for the cancellation digest.
|
|
2761
|
+
* @param digestSigner Callback that signs the digest string.
|
|
2762
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2763
|
+
* @returns A versioned envelope containing signed cancellations.
|
|
2764
|
+
* @throws CowError for empty input, invalid UID, callback failure, or timeout.
|
|
2765
|
+
*/
|
|
2766
|
+
export function signCancellationEthSignDigest(orderUids: string[], chainId: number, digestSigner: DigestSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedCancellationsInput>>;
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* Signs cancellation typed data through an EIP-1193 callback.
|
|
2770
|
+
*
|
|
2771
|
+
* The callback receives an `eth_signTypedData_v4` request object. Use this
|
|
2772
|
+
* helper when an injected wallet or wallet client owns typed-data signing.
|
|
2773
|
+
*
|
|
2774
|
+
* @param orderUids One or more full order UIDs to cancel.
|
|
2775
|
+
* @param chainId EVM chain id used for the cancellation domain.
|
|
2776
|
+
* @param owner Owner address included in the EIP-1193 request parameters.
|
|
2777
|
+
* @param requestCallback Callback that executes the EIP-1193 request.
|
|
2778
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2779
|
+
* @returns A versioned envelope containing signed cancellations.
|
|
2780
|
+
* @throws CowError for invalid input, wallet failure, timeout, or cancellation.
|
|
2781
|
+
*/
|
|
2782
|
+
export function signCancellationWithEip1193(orderUids: string[], chainId: number, owner: string, requestCallback: Eip1193RequestCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedCancellationsInput>>;
|
|
2783
|
+
|
|
2784
|
+
/**
|
|
2785
|
+
* Signs cancellation typed data through a typed-data callback.
|
|
2786
|
+
*
|
|
2787
|
+
* The SDK builds the batch cancellation EIP-712 payload for the provided order
|
|
2788
|
+
* UIDs and asks the callback to sign it. The response can be submitted through
|
|
2789
|
+
* `OrderBookClient.cancelOrders`.
|
|
2790
|
+
*
|
|
2791
|
+
* @param orderUids One or more full order UIDs to cancel.
|
|
2792
|
+
* @param chainId EVM chain id used for the cancellation domain.
|
|
2793
|
+
* @param typedDataSigner Callback that signs the typed-data envelope.
|
|
2794
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2795
|
+
* @returns A versioned envelope containing signed cancellations.
|
|
2796
|
+
* @throws CowError for empty input, invalid UID, callback failure, or timeout.
|
|
2797
|
+
*/
|
|
2798
|
+
export function signCancellationWithTypedDataSigner(orderUids: string[], chainId: number, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedCancellationsInput>>;
|
|
2799
|
+
|
|
2800
|
+
/**
|
|
2801
|
+
* Signs an order digest through an explicit `eth_sign` callback.
|
|
2802
|
+
*
|
|
2803
|
+
* The SDK computes the canonical order digest, passes the digest as a
|
|
2804
|
+
* `0x`-prefixed string to the callback, normalizes the signature, and returns
|
|
2805
|
+
* an `ethsign` signed-order DTO.
|
|
2806
|
+
*
|
|
2807
|
+
* @param input Unsigned order fields to sign.
|
|
2808
|
+
* @param chainId EVM chain id used for the digest.
|
|
2809
|
+
* @param owner Owner address used in the generated order UID.
|
|
2810
|
+
* @param digestSigner Callback that signs the digest string.
|
|
2811
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2812
|
+
* @returns A versioned envelope containing the signed order.
|
|
2813
|
+
* @throws CowError for invalid input, callback failure, timeout, or cancellation.
|
|
2814
|
+
*/
|
|
2815
|
+
export function signOrderEthSignDigest(input: OrderInput, chainId: number, owner: string, digestSigner: DigestSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedOrderDto>>;
|
|
2816
|
+
|
|
2817
|
+
/**
|
|
2818
|
+
* Signs an order through a custom EIP-1271 callback.
|
|
2819
|
+
*
|
|
2820
|
+
* Use this method when the JavaScript host owns the smart-account or
|
|
2821
|
+
* account-abstraction client and can return the final contract signature
|
|
2822
|
+
* directly. The SDK still builds typed data and the deterministic order UID.
|
|
2823
|
+
*
|
|
2824
|
+
* @param input Unsigned order to sign.
|
|
2825
|
+
* @param chainId EVM chain id for the EIP-712 domain.
|
|
2826
|
+
* @param owner Smart-account owner address used in the generated order UID.
|
|
2827
|
+
* @param customCallback Callback that returns the final EIP-1271 signature.
|
|
2828
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2829
|
+
* @returns A versioned envelope containing the signed-order DTO.
|
|
2830
|
+
* @throws CowError for invalid input, callback failure, timeout, or cancellation.
|
|
2831
|
+
*/
|
|
2832
|
+
export function signOrderWithCustomEip1271(input: OrderInput, chainId: number, owner: string, customCallback: CustomEip1271Callback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedOrderDto>>;
|
|
2833
|
+
|
|
2834
|
+
/**
|
|
2835
|
+
* Signs an order through an EIP-1193 request callback.
|
|
2836
|
+
*
|
|
2837
|
+
* The callback receives an `eth_signTypedData_v4` request object with owner
|
|
2838
|
+
* address and serialized typed data. This is the bridge for injected wallets
|
|
2839
|
+
* and wallet-client libraries that expose an EIP-1193-style request function.
|
|
2840
|
+
*
|
|
2841
|
+
* @param input Unsigned order fields to sign.
|
|
2842
|
+
* @param chainId EVM chain id used for the EIP-712 domain.
|
|
2843
|
+
* @param owner Owner address used in the wallet request and order UID.
|
|
2844
|
+
* @param requestCallback Callback that executes the EIP-1193 request.
|
|
2845
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2846
|
+
* @returns A versioned envelope containing the signed order.
|
|
2847
|
+
* @throws CowError for invalid input, wallet failure, timeout, or cancellation.
|
|
2848
|
+
*/
|
|
2849
|
+
export function signOrderWithEip1193(input: OrderInput, chainId: number, owner: string, requestCallback: Eip1193RequestCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedOrderDto>>;
|
|
2850
|
+
|
|
2851
|
+
/**
|
|
2852
|
+
* Signs an order through typed-data ECDSA and wraps it as EIP-1271.
|
|
2853
|
+
*
|
|
2854
|
+
* The SDK sends the EIP-712 envelope to the provided typed-data callback,
|
|
2855
|
+
* then converts the returned ECDSA signature into the CoW EIP-1271 payload.
|
|
2856
|
+
* Per-call options may attach cancellation and wallet timeout settings.
|
|
2857
|
+
*
|
|
2858
|
+
* @param input Unsigned order to sign.
|
|
2859
|
+
* @param chainId EVM chain id for the EIP-712 domain.
|
|
2860
|
+
* @param owner Smart-account owner address used in the generated order UID.
|
|
2861
|
+
* @param typedDataSigner Callback that signs the typed-data envelope.
|
|
2862
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2863
|
+
* @returns A versioned envelope containing the signed-order DTO.
|
|
2864
|
+
* @throws CowError for invalid input, callback failure, timeout, or cancellation.
|
|
2865
|
+
*/
|
|
2866
|
+
export function signOrderWithEip1271(input: OrderInput, chainId: number, owner: string, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedOrderDto>>;
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
* Signs an order through a typed-data callback.
|
|
2870
|
+
*
|
|
2871
|
+
* The SDK builds the EIP-712 typed-data envelope, passes it to the callback,
|
|
2872
|
+
* normalizes the returned ECDSA signature, and returns the signed-order DTO
|
|
2873
|
+
* with the canonical order UID and digest.
|
|
2874
|
+
*
|
|
2875
|
+
* @param input Unsigned order fields to sign.
|
|
2876
|
+
* @param chainId EVM chain id used for the EIP-712 domain.
|
|
2877
|
+
* @param owner Owner address used in the generated order UID.
|
|
2878
|
+
* @param typedDataSigner Callback that signs the typed-data envelope.
|
|
2879
|
+
* @param options Optional cancellation, timeout, and wallet timeout settings.
|
|
2880
|
+
* @returns A versioned envelope containing the signed order.
|
|
2881
|
+
* @throws CowError for invalid input, callback failure, timeout, or cancellation.
|
|
2882
|
+
*/
|
|
2883
|
+
export function signOrderWithTypedDataSigner(input: OrderInput, chainId: number, owner: string, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<SignedOrderDto>>;
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
2886
|
+
* Returns the EVM chain ids supported by the SDK deployment registry.
|
|
2887
|
+
*
|
|
2888
|
+
* This is a pure helper and does not perform network I/O. The returned list is
|
|
2889
|
+
* suitable for runtime validation, UI selection, or capability checks before a
|
|
2890
|
+
* client is constructed.
|
|
2891
|
+
*
|
|
2892
|
+
* @returns A typed array of supported EVM chain ids.
|
|
2893
|
+
*/
|
|
2894
|
+
export function supportedChainIds(): Uint32Array;
|
|
2895
|
+
|
|
2896
|
+
/**
|
|
2897
|
+
* Validates an app-data document against the typed metadata contract.
|
|
2898
|
+
*
|
|
2899
|
+
* Validation is local and deterministic. The result reports whether the
|
|
2900
|
+
* document conforms and includes validation details without uploading data.
|
|
2901
|
+
*
|
|
2902
|
+
* @param doc App-data document input to validate.
|
|
2903
|
+
* @returns A versioned envelope containing the validation result.
|
|
2904
|
+
* @throws CowError when the input cannot be converted into a document.
|
|
2905
|
+
*/
|
|
2906
|
+
export function validateAppDataDoc(doc: AppDataDocInput): WasmEnvelope<ValidationResultDto>;
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
* Returns the version of the wasm package runtime.
|
|
2910
|
+
*
|
|
2911
|
+
* The value comes from the Rust package metadata used to build the wasm
|
|
2912
|
+
* artifact and can be included in diagnostics or compatibility checks.
|
|
2913
|
+
*
|
|
2914
|
+
* @returns The semantic version string for this wasm build.
|
|
2915
|
+
*/
|
|
2916
|
+
export function wasmVersion(): string;
|