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