@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,1636 @@
1
+ /**
2
+ * Orderbook client backed by an explicitly configured HTTP transport.
3
+ *
4
+ * Construct this client when JavaScript needs direct access to quote,
5
+ * submission, lookup, trade, native-price, app-data, and cancellation orderbook
6
+ * endpoints. The client owns one callback registration and releases raw wasm
7
+ * resources through the facade `dispose()` method.
8
+ */
9
+ export class OrderBookClient {
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ OrderBookClientFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_orderbookclient_free(ptr, 0);
19
+ }
20
+ /**
21
+ * Submits signed off-chain order cancellations.
22
+ *
23
+ * Build the signed cancellation payload with one of the cancellation
24
+ * signing helpers, then submit it through the same orderbook runtime
25
+ * configuration used for order operations.
26
+ *
27
+ * @param signed Signed cancellation payload.
28
+ * @param options Optional per-call cancellation and timeout settings.
29
+ * @returns A versioned envelope containing `{ cancelled: true }` on success.
30
+ * @throws CowError for invalid UID, signature, transport failure, or timeout.
31
+ * @param {SignedCancellationsInput} signed
32
+ * @param {SdkClientOptions | null} [options]
33
+ * @returns {WasmEnvelope<{ cancelled: true }>}
34
+ */
35
+ cancelOrders(signed, options) {
36
+ const ret = wasm.orderbookclient_cancelOrders(this.__wbg_ptr, addHeapObject(signed), isLikeNone(options) ? 0 : addHeapObject(options));
37
+ return takeObject(ret);
38
+ }
39
+ /**
40
+ * Fetches the full app-data document registered for an app-data hash.
41
+ *
42
+ * Use this to retrieve the canonical app-data payload the orderbook holds
43
+ * for a given hash, for example to display or re-verify a document
44
+ * referenced by an order.
45
+ *
46
+ * @param appDataHash App-data hash as a `0x`-prefixed 32-byte hex string.
47
+ * @param options Optional per-call cancellation and timeout settings.
48
+ * @returns A versioned envelope containing the app-data document.
49
+ * @throws CowError for an invalid hash, transport failure, or timeout.
50
+ * @param {string} appDataHash
51
+ * @param {SdkClientOptions | null} [options]
52
+ * @returns {WasmEnvelope<AppDataObjectDto>}
53
+ */
54
+ getAppData(appDataHash, options) {
55
+ const ptr0 = passStringToWasm0(appDataHash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
56
+ const len0 = WASM_VECTOR_LEN;
57
+ const ret = wasm.orderbookclient_getAppData(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
58
+ return takeObject(ret);
59
+ }
60
+ /**
61
+ * Fetches a token's native price from the orderbook API.
62
+ *
63
+ * The token must be an EVM address. The returned value follows the
64
+ * orderbook native-price response shape.
65
+ *
66
+ * @param token Token address to price.
67
+ * @param options Optional per-call cancellation and timeout settings.
68
+ * @returns A versioned envelope containing native price data.
69
+ * @throws CowError for invalid token address, transport failure, or timeout.
70
+ * @param {string} token
71
+ * @param {SdkClientOptions | null} [options]
72
+ * @returns {WasmEnvelope<NativePriceResponseDto>}
73
+ */
74
+ getNativePrice(token, options) {
75
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
76
+ const len0 = WASM_VECTOR_LEN;
77
+ const ret = wasm.orderbookclient_getNativePrice(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
78
+ return takeObject(ret);
79
+ }
80
+ /**
81
+ * Fetches one order by its canonical order UID.
82
+ *
83
+ * The UID must be the full 56-byte CoW order UID encoded as a `0x`-prefixed
84
+ * string. The response is returned in the orderbook wire DTO shape.
85
+ *
86
+ * @param orderUid Full order UID to look up.
87
+ * @param options Optional per-call cancellation and timeout settings.
88
+ * @returns A versioned envelope containing the order response.
89
+ * @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
90
+ * @param {string} orderUid
91
+ * @param {SdkClientOptions | null} [options]
92
+ * @returns {WasmEnvelope<OrderDto>}
93
+ */
94
+ getOrder(orderUid, options) {
95
+ const ptr0 = passStringToWasm0(orderUid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
96
+ const len0 = WASM_VECTOR_LEN;
97
+ const ret = wasm.orderbookclient_getOrder(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
98
+ return takeObject(ret);
99
+ }
100
+ /**
101
+ * Fetches the live competition status for one order.
102
+ *
103
+ * Returns the order's status in the current or most recent solver
104
+ * competition, including any per-solver executed amounts the service
105
+ * reports. The UID must be the full 56-byte CoW order UID.
106
+ *
107
+ * @param orderUid Full order UID to look up.
108
+ * @param options Optional per-call cancellation and timeout settings.
109
+ * @returns A versioned envelope containing the competition status.
110
+ * @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
111
+ * @param {string} orderUid
112
+ * @param {SdkClientOptions | null} [options]
113
+ * @returns {WasmEnvelope<CompetitionOrderStatusDto>}
114
+ */
115
+ getOrderCompetitionStatus(orderUid, options) {
116
+ const ptr0 = passStringToWasm0(orderUid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
117
+ const len0 = WASM_VECTOR_LEN;
118
+ const ret = wasm.orderbookclient_getOrderCompetitionStatus(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
119
+ return takeObject(ret);
120
+ }
121
+ /**
122
+ * Builds the public order-details URL for a UID without any network call.
123
+ *
124
+ * @param orderUid Full order UID to link to.
125
+ * @returns A versioned envelope containing the order-details URL.
126
+ * @throws CowError for an invalid UID or an unresolved base URL.
127
+ * @param {string} orderUid
128
+ * @returns {WasmEnvelope<string>}
129
+ */
130
+ getOrderLink(orderUid) {
131
+ try {
132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
+ const ptr0 = passStringToWasm0(orderUid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ wasm.orderbookclient_getOrderLink(retptr, this.__wbg_ptr, ptr0, len0);
136
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
137
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
138
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
139
+ if (r2) {
140
+ throw takeObject(r1);
141
+ }
142
+ return takeObject(r0);
143
+ } finally {
144
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
+ }
146
+ }
147
+ /**
148
+ * Fetches an order by UID, falling back across environments on a 404.
149
+ *
150
+ * @param orderUid Full order UID to look up.
151
+ * @param options Optional per-call cancellation and timeout settings.
152
+ * @returns A versioned envelope containing the order response.
153
+ * @throws CowError for invalid UID, not-found responses, transport failure, or timeout.
154
+ * @param {string} orderUid
155
+ * @param {SdkClientOptions | null} [options]
156
+ * @returns {WasmEnvelope<OrderDto>}
157
+ */
158
+ getOrderMultiEnv(orderUid, options) {
159
+ const ptr0 = passStringToWasm0(orderUid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ret = wasm.orderbookclient_getOrderMultiEnv(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
162
+ return takeObject(ret);
163
+ }
164
+ /**
165
+ * Fetches orders owned by an address with optional pagination.
166
+ *
167
+ * The owner address is validated before the request is dispatched. The
168
+ * response preserves the typed orderbook order shape.
169
+ *
170
+ * @param owner Owner address to query.
171
+ * @param pagination Optional offset and limit.
172
+ * @param options Optional per-call cancellation and timeout settings.
173
+ * @returns A versioned envelope containing matching orders.
174
+ * @throws CowError for invalid owner, transport failure, timeout, or cancellation.
175
+ * @param {string} owner
176
+ * @param {PaginationOptions | null} [pagination]
177
+ * @param {SdkClientOptions | null} [options]
178
+ * @returns {WasmEnvelope<OrderDto[]>}
179
+ */
180
+ getOrders(owner, pagination, options) {
181
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
182
+ const len0 = WASM_VECTOR_LEN;
183
+ const ret = wasm.orderbookclient_getOrders(this.__wbg_ptr, ptr0, len0, isLikeNone(pagination) ? 0 : addHeapObject(pagination), isLikeNone(options) ? 0 : addHeapObject(options));
184
+ return takeObject(ret);
185
+ }
186
+ /**
187
+ * Fetches a price quote from the orderbook API.
188
+ *
189
+ * The request is converted to the typed orderbook quote request and sent
190
+ * through the configured transport. Per-call options can override the
191
+ * constructor timeout or attach an `AbortSignal`.
192
+ *
193
+ * @param request Quote request DTO.
194
+ * @param options Optional per-call cancellation and timeout settings.
195
+ * @returns A versioned envelope containing the quote response.
196
+ * @throws CowError for invalid input, transport failure, timeout, or cancellation.
197
+ * @param {OrderQuoteRequestInput} request
198
+ * @param {SdkClientOptions | null} [options]
199
+ * @returns {WasmEnvelope<OrderQuoteResponseDto>}
200
+ */
201
+ getQuote(request, options) {
202
+ const ret = wasm.orderbookclient_getQuote(this.__wbg_ptr, addHeapObject(request), isLikeNone(options) ? 0 : addHeapObject(options));
203
+ return takeObject(ret);
204
+ }
205
+ /**
206
+ * Fetches the total accumulated surplus for an account.
207
+ *
208
+ * Returns the lifetime surplus the protocol has captured for the owner
209
+ * across its settled orders, in the upstream decimal-string wire shape.
210
+ *
211
+ * @param owner Owner address to query.
212
+ * @param options Optional per-call cancellation and timeout settings.
213
+ * @returns A versioned envelope containing the total-surplus response.
214
+ * @throws CowError for invalid owner, transport failure, or timeout.
215
+ * @param {string} owner
216
+ * @param {SdkClientOptions | null} [options]
217
+ * @returns {WasmEnvelope<TotalSurplusDto>}
218
+ */
219
+ getTotalSurplus(owner, options) {
220
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
221
+ const len0 = WASM_VECTOR_LEN;
222
+ const ret = wasm.orderbookclient_getTotalSurplus(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
223
+ return takeObject(ret);
224
+ }
225
+ /**
226
+ * Fetches trades for exactly one owner address or order UID.
227
+ *
228
+ * The query must set one of `owner` or `orderUid`, not both. Optional
229
+ * pagination fields are forwarded to the orderbook request.
230
+ *
231
+ * @param query Trade query DTO.
232
+ * @param options Optional per-call cancellation and timeout settings.
233
+ * @returns A versioned envelope containing matching trades.
234
+ * @throws CowError when the query is ambiguous or transport fails.
235
+ * @param {TradesQueryInput} query
236
+ * @param {SdkClientOptions | null} [options]
237
+ * @returns {WasmEnvelope<TradeDto[]>}
238
+ */
239
+ getTrades(query, options) {
240
+ const ret = wasm.orderbookclient_getTrades(this.__wbg_ptr, addHeapObject(query), isLikeNone(options) ? 0 : addHeapObject(options));
241
+ return takeObject(ret);
242
+ }
243
+ /**
244
+ * Fetches the orders contained in a settlement transaction.
245
+ *
246
+ * @param txHash Settlement transaction hash.
247
+ * @param options Optional per-call cancellation and timeout settings.
248
+ * @returns A versioned envelope containing the settled orders.
249
+ * @throws CowError for an invalid hash, transport failure, timeout, or cancellation.
250
+ * @param {string} txHash
251
+ * @param {SdkClientOptions | null} [options]
252
+ * @returns {WasmEnvelope<OrderDto[]>}
253
+ */
254
+ getTxOrders(txHash, options) {
255
+ const ptr0 = passStringToWasm0(txHash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.orderbookclient_getTxOrders(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
258
+ return takeObject(ret);
259
+ }
260
+ /**
261
+ * Fetches the orderbook service version string.
262
+ *
263
+ * @param options Optional per-call cancellation and timeout settings.
264
+ * @returns A versioned envelope containing the service version string.
265
+ * @throws CowError for transport failure, timeout, or cancellation.
266
+ * @param {SdkClientOptions | null} [options]
267
+ * @returns {WasmEnvelope<string>}
268
+ */
269
+ getVersion(options) {
270
+ const ret = wasm.orderbookclient_getVersion(this.__wbg_ptr, isLikeNone(options) ? 0 : addHeapObject(options));
271
+ return takeObject(ret);
272
+ }
273
+ /**
274
+ * Creates an orderbook client from a single config object.
275
+ *
276
+ * The config must include `chainId` and `transport`. The optional
277
+ * `timeoutMs`, `signal`, and `transportPolicy` fields become defaults for
278
+ * calls made through this client unless a method call overrides them.
279
+ *
280
+ * @param config Orderbook client configuration.
281
+ * @throws CowError when the chain, environment, transport, or policy is invalid.
282
+ * @param {OrderBookClientConfig} config
283
+ */
284
+ constructor(config) {
285
+ try {
286
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
+ wasm.orderbookclient_new(retptr, addHeapObject(config));
288
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
289
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
290
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
291
+ if (r2) {
292
+ throw takeObject(r1);
293
+ }
294
+ this.__wbg_ptr = r0;
295
+ OrderBookClientFinalization.register(this, this.__wbg_ptr, this);
296
+ return this;
297
+ } finally {
298
+ wasm.__wbindgen_add_to_stack_pointer(16);
299
+ }
300
+ }
301
+ /**
302
+ * Submits a signed order to the orderbook.
303
+ *
304
+ * The signed DTO normally comes from a signing helper in the same package.
305
+ * The SDK reconstructs the typed order creation payload and returns the
306
+ * order UID assigned by the orderbook service.
307
+ *
308
+ * @param signed Signed order DTO including typed data, signature, owner, and scheme.
309
+ * @param options Optional per-call cancellation and timeout settings.
310
+ * @returns A versioned envelope containing the submitted order UID.
311
+ * @throws CowError for invalid signatures, transport failure, timeout, or rejection.
312
+ * @param {SignedOrderDto} signed
313
+ * @param {SdkClientOptions | null} [options]
314
+ * @returns {WasmEnvelope<string>}
315
+ */
316
+ sendOrder(signed, options) {
317
+ const ret = wasm.orderbookclient_sendOrder(this.__wbg_ptr, addHeapObject(signed), isLikeNone(options) ? 0 : addHeapObject(options));
318
+ return takeObject(ret);
319
+ }
320
+ /**
321
+ * Submits a raw order-creation payload to the orderbook.
322
+ *
323
+ * Use this method when the host already has a complete orderbook
324
+ * `OrderCreation` shape and does not need the facade to reconstruct it
325
+ * from a signed-order DTO.
326
+ *
327
+ * @param input Raw order-creation DTO.
328
+ * @param options Optional per-call cancellation and timeout settings.
329
+ * @returns A versioned envelope containing the submitted order UID.
330
+ * @throws CowError for malformed input, transport failure, timeout, or rejection.
331
+ * @param {OrderCreationInput} input
332
+ * @param {SdkClientOptions | null} [options]
333
+ * @returns {WasmEnvelope<string>}
334
+ */
335
+ sendOrderCreation(input, options) {
336
+ const ret = wasm.orderbookclient_sendOrderCreation(this.__wbg_ptr, addHeapObject(input), isLikeNone(options) ? 0 : addHeapObject(options));
337
+ return takeObject(ret);
338
+ }
339
+ /**
340
+ * Uploads the full app-data JSON for a content-addressed app-data hash.
341
+ *
342
+ * The SDK enforces the content-addressed-write invariant: the keccak-256
343
+ * digest of `fullAppData` must equal `appDataHash`, or the call rejects
344
+ * before any network request. Serialize `fullAppData` with the canonical
345
+ * app-data writer so the digest matches.
346
+ *
347
+ * @param appDataHash App-data hash as a `0x`-prefixed 32-byte hex string.
348
+ * @param fullAppData Canonically serialized app-data JSON payload.
349
+ * @param options Optional per-call cancellation and timeout settings.
350
+ * @returns A versioned envelope containing `{ uploaded: true }` on success.
351
+ * @throws CowError for a hash mismatch, invalid hash, transport failure, or timeout.
352
+ * @param {string} appDataHash
353
+ * @param {string} fullAppData
354
+ * @param {SdkClientOptions | null} [options]
355
+ * @returns {WasmEnvelope<{ uploaded: true }>}
356
+ */
357
+ uploadAppData(appDataHash, fullAppData, options) {
358
+ const ptr0 = passStringToWasm0(appDataHash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ptr1 = passStringToWasm0(fullAppData, wasm.__wbindgen_export, wasm.__wbindgen_export2);
361
+ const len1 = WASM_VECTOR_LEN;
362
+ const ret = wasm.orderbookclient_uploadAppData(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(options) ? 0 : addHeapObject(options));
363
+ return takeObject(ret);
364
+ }
365
+ }
366
+ if (Symbol.dispose) OrderBookClient.prototype[Symbol.dispose] = OrderBookClient.prototype.free;
367
+
368
+ /**
369
+ * Initializes the wasm crate's panic hook once.
370
+ */
371
+ export function __cow_sdk_wasm_init() {
372
+ wasm.__cow_sdk_wasm_init();
373
+ }
374
+
375
+ /**
376
+ * Builds a settlement cancellation transaction for an order UID.
377
+ *
378
+ * The returned transaction request targets the Settlement contract and encodes
379
+ * `invalidateOrder(bytes)`. The host wallet remains responsible for submitting
380
+ * and observing the transaction.
381
+ *
382
+ * @param params Order UID, chain, environment, and optional deployment override.
383
+ * @returns A versioned envelope containing the transaction request DTO.
384
+ * @throws CowError when the chain, deployment, or order UID is invalid.
385
+ * @param {OrderTraderParametersInput} params
386
+ * @returns {WasmEnvelope<TransactionRequestDto>}
387
+ */
388
+ export function buildCancelOrderTx(params) {
389
+ try {
390
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
391
+ wasm.buildCancelOrderTx(retptr, addHeapObject(params));
392
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
395
+ if (r2) {
396
+ throw takeObject(r1);
397
+ }
398
+ return takeObject(r0);
399
+ } finally {
400
+ wasm.__wbindgen_add_to_stack_pointer(16);
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Builds a settlement pre-sign transaction for an order UID.
406
+ *
407
+ * The returned transaction request targets the Settlement contract and encodes
408
+ * `setPreSignature(bytes,bool)` with the order UID and `true` flag. The host
409
+ * wallet remains responsible for transaction submission.
410
+ *
411
+ * @param params Order UID, chain, environment, and optional deployment override.
412
+ * @returns A versioned envelope containing the transaction request DTO.
413
+ * @throws CowError when the chain, deployment, or order UID is invalid.
414
+ * @param {OrderTraderParametersInput} params
415
+ * @returns {WasmEnvelope<TransactionRequestDto>}
416
+ */
417
+ export function buildPresignTx(params) {
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ wasm.buildPresignTx(retptr, addHeapObject(params));
421
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
422
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
423
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
424
+ if (r2) {
425
+ throw takeObject(r1);
426
+ }
427
+ return takeObject(r0);
428
+ } finally {
429
+ wasm.__wbindgen_add_to_stack_pointer(16);
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Computes the canonical order UID and order digest for an unsigned order.
435
+ *
436
+ * The UID combines the EIP-712 order digest, owner address, and validity
437
+ * timestamp using the same packing rules as the native Rust SDK.
438
+ *
439
+ * @param input Unsigned order fields to hash and pack.
440
+ * @param chainId EVM chain id used for the EIP-712 domain.
441
+ * @param owner Order owner address included in the UID suffix.
442
+ * @returns A versioned envelope with `orderUid` and `orderDigest`.
443
+ * @throws CowError when the order, owner, or chain id is invalid.
444
+ * @param {OrderInput} input
445
+ * @param {number} chainId
446
+ * @param {string} owner
447
+ * @returns {WasmEnvelope<GeneratedOrderUidDto>}
448
+ */
449
+ export function computeOrderUid(input, chainId, owner) {
450
+ try {
451
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
452
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
453
+ const len0 = WASM_VECTOR_LEN;
454
+ wasm.computeOrderUid(retptr, addHeapObject(input), chainId, ptr0, len0);
455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
457
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
458
+ if (r2) {
459
+ throw takeObject(r1);
460
+ }
461
+ return takeObject(r0);
462
+ } finally {
463
+ wasm.__wbindgen_add_to_stack_pointer(16);
464
+ }
465
+ }
466
+
467
+ /**
468
+ * Decodes an eth-flow on-chain order lifecycle event log into a typed event.
469
+ *
470
+ * Dispatches on the log's topic-0 across the `CoWSwapOnchainOrders`
471
+ * `OrderPlacement` / `OrderInvalidation` events and the `CoWSwapEthFlow`
472
+ * `OrderRefund` event. The decode is fail-closed: the topic set and on-chain
473
+ * signing scheme are validated and every order UID is length-checked, so a
474
+ * malformed or hostile log returns a typed error rather than panicking.
475
+ *
476
+ * @param log Raw log with `topics` (0x-prefixed 32-byte hex, topic-0 first)
477
+ * and `data` (0x-prefixed hex, `"0x"` when empty).
478
+ * @returns A versioned envelope containing the decoded eth-flow event.
479
+ * @throws CowError when the log is malformed or its topic set matches no known
480
+ * eth-flow lifecycle event.
481
+ * @param {EventLogInput} log
482
+ * @returns {WasmEnvelope<EthFlowEventDto>}
483
+ */
484
+ export function decodeEthFlowLog(log) {
485
+ try {
486
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
487
+ wasm.decodeEthFlowLog(retptr, addHeapObject(log));
488
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
489
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
490
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
491
+ if (r2) {
492
+ throw takeObject(r1);
493
+ }
494
+ return takeObject(r0);
495
+ } finally {
496
+ wasm.__wbindgen_add_to_stack_pointer(16);
497
+ }
498
+ }
499
+
500
+ /**
501
+ * Decodes a `GPv2Settlement` event log into a typed settlement event.
502
+ *
503
+ * Dispatches on the log's topic-0 across `Trade`, `Interaction`, `Settlement`,
504
+ * `OrderInvalidated`, and `PreSignature`. The decode is fail-closed: the topic
505
+ * set is validated before ABI decoding and every order UID is length-checked,
506
+ * so a malformed or hostile log returns a typed error rather than panicking.
507
+ *
508
+ * @param log Raw log with `topics` (0x-prefixed 32-byte hex, topic-0 first)
509
+ * and `data` (0x-prefixed hex, `"0x"` when empty).
510
+ * @returns A versioned envelope containing the decoded settlement event.
511
+ * @throws CowError when the log is malformed or its topic set matches no known
512
+ * settlement event.
513
+ * @param {EventLogInput} log
514
+ * @returns {WasmEnvelope<SettlementEventDto>}
515
+ */
516
+ export function decodeSettlementLog(log) {
517
+ try {
518
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
519
+ wasm.decodeSettlementLog(retptr, addHeapObject(log));
520
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
521
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
522
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
523
+ if (r2) {
524
+ throw takeObject(r1);
525
+ }
526
+ return takeObject(r0);
527
+ } finally {
528
+ wasm.__wbindgen_add_to_stack_pointer(16);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Returns canonical CoW Protocol deployment addresses for a chain.
534
+ *
535
+ * The optional environment selects production or staging deployment data. When
536
+ * omitted, the helper uses the SDK default environment.
537
+ *
538
+ * @param chainId EVM chain id to resolve.
539
+ * @param env Optional CoW environment name, such as `prod` or `staging`.
540
+ * @returns Settlement, VaultRelayer, EthFlow, and AllowListAuth addresses.
541
+ * @throws CowError when the chain or environment is unsupported.
542
+ * @param {number} chainId
543
+ * @param {string | null} [env]
544
+ * @returns {WasmEnvelope<DeploymentAddressesDto>}
545
+ */
546
+ export function deploymentAddresses(chainId, env) {
547
+ try {
548
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
549
+ var ptr0 = isLikeNone(env) ? 0 : passStringToWasm0(env, wasm.__wbindgen_export, wasm.__wbindgen_export2);
550
+ var len0 = WASM_VECTOR_LEN;
551
+ wasm.deploymentAddresses(retptr, chainId, ptr0, len0);
552
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
553
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
554
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
555
+ if (r2) {
556
+ throw takeObject(r1);
557
+ }
558
+ return takeObject(r0);
559
+ } finally {
560
+ wasm.__wbindgen_add_to_stack_pointer(16);
561
+ }
562
+ }
563
+
564
+ /**
565
+ * Computes the CoW Protocol EIP-712 domain separator for a supported chain.
566
+ *
567
+ * Use this helper when a JavaScript host needs to compare the domain hash used
568
+ * by the Rust SDK with another signing stack. The input is an EVM chain id,
569
+ * not a CoW environment selector.
570
+ *
571
+ * @param chainId EVM chain id supported by the deployment registry.
572
+ * @returns The `0x`-prefixed 32-byte domain separator.
573
+ * @throws CowError when the chain is not supported.
574
+ * @param {number} chainId
575
+ * @returns {string}
576
+ */
577
+ export function domainSeparator(chainId) {
578
+ let deferred2_0;
579
+ let deferred2_1;
580
+ try {
581
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
582
+ wasm.domainSeparator(retptr, chainId);
583
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
584
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
585
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
586
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
587
+ var ptr1 = r0;
588
+ var len1 = r1;
589
+ if (r3) {
590
+ ptr1 = 0; len1 = 0;
591
+ throw takeObject(r2);
592
+ }
593
+ deferred2_0 = ptr1;
594
+ deferred2_1 = len1;
595
+ return getStringFromWasm0(ptr1, len1);
596
+ } finally {
597
+ wasm.__wbindgen_add_to_stack_pointer(16);
598
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
599
+ }
600
+ }
601
+
602
+ /**
603
+ * Encodes a CoW EIP-1271 payload from an ECDSA order signature.
604
+ *
605
+ * Use this pure helper when a smart-account flow already has the wrapped ECDSA
606
+ * signature and needs the contract-signature payload bytes expected by CoW
607
+ * Protocol order submission.
608
+ *
609
+ * @param input Unsigned order used to derive the EIP-1271 payload.
610
+ * @param ecdsaSignature Wrapped ECDSA signature as a `0x`-prefixed string.
611
+ * @returns A versioned envelope containing the encoded EIP-1271 payload.
612
+ * @throws CowError when the order or signature is invalid.
613
+ * @param {OrderInput} input
614
+ * @param {string} ecdsaSignature
615
+ * @returns {WasmEnvelope<string>}
616
+ */
617
+ export function eip1271SignaturePayload(input, ecdsaSignature) {
618
+ try {
619
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
620
+ const ptr0 = passStringToWasm0(ecdsaSignature, wasm.__wbindgen_export, wasm.__wbindgen_export2);
621
+ const len0 = WASM_VECTOR_LEN;
622
+ wasm.eip1271SignaturePayload(retptr, addHeapObject(input), ptr0, len0);
623
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
624
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
625
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
626
+ if (r2) {
627
+ throw takeObject(r1);
628
+ }
629
+ return takeObject(r0);
630
+ } finally {
631
+ wasm.__wbindgen_add_to_stack_pointer(16);
632
+ }
633
+ }
634
+
635
+ /**
636
+ * Builds signer-facing EIP-712 typed data for an unsigned order.
637
+ *
638
+ * The returned envelope contains the domain, type map, primary type, and
639
+ * order message that wallet libraries expect for EIP-712 signing. It is
640
+ * deterministic for the provided order and chain id.
641
+ *
642
+ * @param input Unsigned order fields using the facade order DTO shape.
643
+ * @param chainId EVM chain id used for the EIP-712 domain.
644
+ * @returns A versioned envelope containing typed-data DTO fields.
645
+ * @throws CowError when order parsing or chain validation fails.
646
+ * @param {OrderInput} input
647
+ * @param {number} chainId
648
+ * @returns {WasmEnvelope<TypedDataEnvelopeDto>}
649
+ */
650
+ export function orderTypedData(input, chainId) {
651
+ try {
652
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
653
+ wasm.orderTypedData(retptr, addHeapObject(input), chainId);
654
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
655
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
656
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
657
+ if (r2) {
658
+ throw takeObject(r1);
659
+ }
660
+ return takeObject(r0);
661
+ } finally {
662
+ wasm.__wbindgen_add_to_stack_pointer(16);
663
+ }
664
+ }
665
+
666
+ /**
667
+ * Signs a cancellation digest through an explicit `eth_sign` callback.
668
+ *
669
+ * The SDK computes the canonical cancellation digest for the provided UIDs and
670
+ * passes it to the digest signer callback as a `0x`-prefixed string.
671
+ *
672
+ * @param orderUids One or more full order UIDs to cancel.
673
+ * @param chainId EVM chain id used for the cancellation digest.
674
+ * @param digestSigner Callback that signs the digest string.
675
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
676
+ * @returns A versioned envelope containing signed cancellations.
677
+ * @throws CowError for empty input, invalid UID, callback failure, or timeout.
678
+ * @param {string[]} orderUids
679
+ * @param {number} chainId
680
+ * @param {DigestSignerCallback} digestSigner
681
+ * @param {SigningOptions | null} [options]
682
+ * @returns {WasmEnvelope<SignedCancellationsInput>}
683
+ */
684
+ export function signCancellationEthSignDigest(orderUids, chainId, digestSigner, options) {
685
+ const ptr0 = passArrayJsValueToWasm0(orderUids, wasm.__wbindgen_export);
686
+ const len0 = WASM_VECTOR_LEN;
687
+ const ret = wasm.signCancellationEthSignDigest(ptr0, len0, chainId, addHeapObject(digestSigner), isLikeNone(options) ? 0 : addHeapObject(options));
688
+ return takeObject(ret);
689
+ }
690
+
691
+ /**
692
+ * Signs cancellation typed data through an EIP-1193 callback.
693
+ *
694
+ * The callback receives an `eth_signTypedData_v4` request object. Use this
695
+ * helper when an injected wallet or wallet client owns typed-data signing.
696
+ *
697
+ * @param orderUids One or more full order UIDs to cancel.
698
+ * @param chainId EVM chain id used for the cancellation domain.
699
+ * @param owner Owner address included in the EIP-1193 request parameters.
700
+ * @param requestCallback Callback that executes the EIP-1193 request.
701
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
702
+ * @returns A versioned envelope containing signed cancellations.
703
+ * @throws CowError for invalid input, wallet failure, timeout, or cancellation.
704
+ * @param {string[]} orderUids
705
+ * @param {number} chainId
706
+ * @param {string} owner
707
+ * @param {Eip1193RequestCallback} requestCallback
708
+ * @param {SigningOptions | null} [options]
709
+ * @returns {WasmEnvelope<SignedCancellationsInput>}
710
+ */
711
+ export function signCancellationWithEip1193(orderUids, chainId, owner, requestCallback, options) {
712
+ const ptr0 = passArrayJsValueToWasm0(orderUids, wasm.__wbindgen_export);
713
+ const len0 = WASM_VECTOR_LEN;
714
+ const ptr1 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
715
+ const len1 = WASM_VECTOR_LEN;
716
+ const ret = wasm.signCancellationWithEip1193(ptr0, len0, chainId, ptr1, len1, addHeapObject(requestCallback), isLikeNone(options) ? 0 : addHeapObject(options));
717
+ return takeObject(ret);
718
+ }
719
+
720
+ /**
721
+ * Signs cancellation typed data through a typed-data callback.
722
+ *
723
+ * The SDK builds the batch cancellation EIP-712 payload for the provided order
724
+ * UIDs and asks the callback to sign it. The response can be submitted through
725
+ * `OrderBookClient.cancelOrders`.
726
+ *
727
+ * @param orderUids One or more full order UIDs to cancel.
728
+ * @param chainId EVM chain id used for the cancellation domain.
729
+ * @param typedDataSigner Callback that signs the typed-data envelope.
730
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
731
+ * @returns A versioned envelope containing signed cancellations.
732
+ * @throws CowError for empty input, invalid UID, callback failure, or timeout.
733
+ * @param {string[]} orderUids
734
+ * @param {number} chainId
735
+ * @param {TypedDataSignerCallback} typedDataSigner
736
+ * @param {SigningOptions | null} [options]
737
+ * @returns {WasmEnvelope<SignedCancellationsInput>}
738
+ */
739
+ export function signCancellationWithTypedDataSigner(orderUids, chainId, typedDataSigner, options) {
740
+ const ptr0 = passArrayJsValueToWasm0(orderUids, wasm.__wbindgen_export);
741
+ const len0 = WASM_VECTOR_LEN;
742
+ const ret = wasm.signCancellationWithTypedDataSigner(ptr0, len0, chainId, addHeapObject(typedDataSigner), isLikeNone(options) ? 0 : addHeapObject(options));
743
+ return takeObject(ret);
744
+ }
745
+
746
+ /**
747
+ * Signs an order digest through an explicit `eth_sign` callback.
748
+ *
749
+ * The SDK computes the canonical order digest, passes the digest as a
750
+ * `0x`-prefixed string to the callback, normalizes the signature, and returns
751
+ * an `ethsign` signed-order DTO.
752
+ *
753
+ * @param input Unsigned order fields to sign.
754
+ * @param chainId EVM chain id used for the digest.
755
+ * @param owner Owner address used in the generated order UID.
756
+ * @param digestSigner Callback that signs the digest string.
757
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
758
+ * @returns A versioned envelope containing the signed order.
759
+ * @throws CowError for invalid input, callback failure, timeout, or cancellation.
760
+ * @param {OrderInput} input
761
+ * @param {number} chainId
762
+ * @param {string} owner
763
+ * @param {DigestSignerCallback} digestSigner
764
+ * @param {SigningOptions | null} [options]
765
+ * @returns {WasmEnvelope<SignedOrderDto>}
766
+ */
767
+ export function signOrderEthSignDigest(input, chainId, owner, digestSigner, options) {
768
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
769
+ const len0 = WASM_VECTOR_LEN;
770
+ const ret = wasm.signOrderEthSignDigest(addHeapObject(input), chainId, ptr0, len0, addHeapObject(digestSigner), isLikeNone(options) ? 0 : addHeapObject(options));
771
+ return takeObject(ret);
772
+ }
773
+
774
+ /**
775
+ * Signs an order through a custom EIP-1271 callback.
776
+ *
777
+ * Use this method when the JavaScript host owns the smart-account or
778
+ * account-abstraction client and can return the final contract signature
779
+ * directly. The SDK still builds typed data and the deterministic order UID.
780
+ *
781
+ * @param input Unsigned order to sign.
782
+ * @param chainId EVM chain id for the EIP-712 domain.
783
+ * @param owner Smart-account owner address used in the generated order UID.
784
+ * @param customCallback Callback that returns the final EIP-1271 signature.
785
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
786
+ * @returns A versioned envelope containing the signed-order DTO.
787
+ * @throws CowError for invalid input, callback failure, timeout, or cancellation.
788
+ * @param {OrderInput} input
789
+ * @param {number} chainId
790
+ * @param {string} owner
791
+ * @param {CustomEip1271Callback} customCallback
792
+ * @param {SigningOptions | null} [options]
793
+ * @returns {WasmEnvelope<SignedOrderDto>}
794
+ */
795
+ export function signOrderWithCustomEip1271(input, chainId, owner, customCallback, options) {
796
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
797
+ const len0 = WASM_VECTOR_LEN;
798
+ const ret = wasm.signOrderWithCustomEip1271(addHeapObject(input), chainId, ptr0, len0, addHeapObject(customCallback), isLikeNone(options) ? 0 : addHeapObject(options));
799
+ return takeObject(ret);
800
+ }
801
+
802
+ /**
803
+ * Signs an order through an EIP-1193 request callback.
804
+ *
805
+ * The callback receives an `eth_signTypedData_v4` request object with owner
806
+ * address and serialized typed data. This is the bridge for injected wallets
807
+ * and wallet-client libraries that expose an EIP-1193-style request function.
808
+ *
809
+ * @param input Unsigned order fields to sign.
810
+ * @param chainId EVM chain id used for the EIP-712 domain.
811
+ * @param owner Owner address used in the wallet request and order UID.
812
+ * @param requestCallback Callback that executes the EIP-1193 request.
813
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
814
+ * @returns A versioned envelope containing the signed order.
815
+ * @throws CowError for invalid input, wallet failure, timeout, or cancellation.
816
+ * @param {OrderInput} input
817
+ * @param {number} chainId
818
+ * @param {string} owner
819
+ * @param {Eip1193RequestCallback} requestCallback
820
+ * @param {SigningOptions | null} [options]
821
+ * @returns {WasmEnvelope<SignedOrderDto>}
822
+ */
823
+ export function signOrderWithEip1193(input, chainId, owner, requestCallback, options) {
824
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
825
+ const len0 = WASM_VECTOR_LEN;
826
+ const ret = wasm.signOrderWithEip1193(addHeapObject(input), chainId, ptr0, len0, addHeapObject(requestCallback), isLikeNone(options) ? 0 : addHeapObject(options));
827
+ return takeObject(ret);
828
+ }
829
+
830
+ /**
831
+ * Signs an order through typed-data ECDSA and wraps it as EIP-1271.
832
+ *
833
+ * The SDK sends the EIP-712 envelope to the provided typed-data callback,
834
+ * then converts the returned ECDSA signature into the CoW EIP-1271 payload.
835
+ * Per-call options may attach cancellation and wallet timeout settings.
836
+ *
837
+ * @param input Unsigned order to sign.
838
+ * @param chainId EVM chain id for the EIP-712 domain.
839
+ * @param owner Smart-account owner address used in the generated order UID.
840
+ * @param typedDataSigner Callback that signs the typed-data envelope.
841
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
842
+ * @returns A versioned envelope containing the signed-order DTO.
843
+ * @throws CowError for invalid input, callback failure, timeout, or cancellation.
844
+ * @param {OrderInput} input
845
+ * @param {number} chainId
846
+ * @param {string} owner
847
+ * @param {TypedDataSignerCallback} typedDataSigner
848
+ * @param {SigningOptions | null} [options]
849
+ * @returns {WasmEnvelope<SignedOrderDto>}
850
+ */
851
+ export function signOrderWithEip1271(input, chainId, owner, typedDataSigner, options) {
852
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
853
+ const len0 = WASM_VECTOR_LEN;
854
+ const ret = wasm.signOrderWithEip1271(addHeapObject(input), chainId, ptr0, len0, addHeapObject(typedDataSigner), isLikeNone(options) ? 0 : addHeapObject(options));
855
+ return takeObject(ret);
856
+ }
857
+
858
+ /**
859
+ * Signs an order through a typed-data callback.
860
+ *
861
+ * The SDK builds the EIP-712 typed-data envelope, passes it to the callback,
862
+ * normalizes the returned ECDSA signature, and returns the signed-order DTO
863
+ * with the canonical order UID and digest.
864
+ *
865
+ * @param input Unsigned order fields to sign.
866
+ * @param chainId EVM chain id used for the EIP-712 domain.
867
+ * @param owner Owner address used in the generated order UID.
868
+ * @param typedDataSigner Callback that signs the typed-data envelope.
869
+ * @param options Optional cancellation, timeout, and wallet timeout settings.
870
+ * @returns A versioned envelope containing the signed order.
871
+ * @throws CowError for invalid input, callback failure, timeout, or cancellation.
872
+ * @param {OrderInput} input
873
+ * @param {number} chainId
874
+ * @param {string} owner
875
+ * @param {TypedDataSignerCallback} typedDataSigner
876
+ * @param {SigningOptions | null} [options]
877
+ * @returns {WasmEnvelope<SignedOrderDto>}
878
+ */
879
+ export function signOrderWithTypedDataSigner(input, chainId, owner, typedDataSigner, options) {
880
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
881
+ const len0 = WASM_VECTOR_LEN;
882
+ const ret = wasm.signOrderWithTypedDataSigner(addHeapObject(input), chainId, ptr0, len0, addHeapObject(typedDataSigner), isLikeNone(options) ? 0 : addHeapObject(options));
883
+ return takeObject(ret);
884
+ }
885
+
886
+ /**
887
+ * Returns the EVM chain ids supported by the SDK deployment registry.
888
+ *
889
+ * This is a pure helper and does not perform network I/O. The returned list is
890
+ * suitable for runtime validation, UI selection, or capability checks before a
891
+ * client is constructed.
892
+ *
893
+ * @returns A typed array of supported EVM chain ids.
894
+ * @returns {Uint32Array}
895
+ */
896
+ export function supportedChainIds() {
897
+ try {
898
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
899
+ wasm.supportedChainIds(retptr);
900
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
901
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
902
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
903
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
904
+ return v1;
905
+ } finally {
906
+ wasm.__wbindgen_add_to_stack_pointer(16);
907
+ }
908
+ }
909
+
910
+ /**
911
+ * Returns the version of the wasm package runtime.
912
+ *
913
+ * The value comes from the Rust package metadata used to build the wasm
914
+ * artifact and can be included in diagnostics or compatibility checks.
915
+ *
916
+ * @returns The semantic version string for this wasm build.
917
+ * @returns {string}
918
+ */
919
+ export function wasmVersion() {
920
+ let deferred1_0;
921
+ let deferred1_1;
922
+ try {
923
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
924
+ wasm.wasmVersion(retptr);
925
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
926
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
927
+ deferred1_0 = r0;
928
+ deferred1_1 = r1;
929
+ return getStringFromWasm0(r0, r1);
930
+ } finally {
931
+ wasm.__wbindgen_add_to_stack_pointer(16);
932
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
933
+ }
934
+ }
935
+ export function __wbg_Error_fdd633d4bb5dd76a(arg0, arg1) {
936
+ const ret = Error(getStringFromWasm0(arg0, arg1));
937
+ return addHeapObject(ret);
938
+ }
939
+ export function __wbg_Number_c4bdf66bb78f7977(arg0) {
940
+ const ret = Number(getObject(arg0));
941
+ return ret;
942
+ }
943
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
944
+ const ret = String(getObject(arg1));
945
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
946
+ const len1 = WASM_VECTOR_LEN;
947
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
948
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
949
+ }
950
+ export function __wbg___wbindgen_bigint_get_as_i64_d9e915702856f831(arg0, arg1) {
951
+ const v = getObject(arg1);
952
+ const ret = typeof(v) === 'bigint' ? v : undefined;
953
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
954
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
955
+ }
956
+ export function __wbg___wbindgen_boolean_get_edaed31a367ce1bd(arg0) {
957
+ const v = getObject(arg0);
958
+ const ret = typeof(v) === 'boolean' ? v : undefined;
959
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
960
+ }
961
+ export function __wbg___wbindgen_debug_string_8a447059637473e2(arg0, arg1) {
962
+ const ret = debugString(getObject(arg1));
963
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
964
+ const len1 = WASM_VECTOR_LEN;
965
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
966
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
967
+ }
968
+ export function __wbg___wbindgen_in_4990f46af709e33c(arg0, arg1) {
969
+ const ret = getObject(arg0) in getObject(arg1);
970
+ return ret;
971
+ }
972
+ export function __wbg___wbindgen_is_bigint_90b5ccfe67c78460(arg0) {
973
+ const ret = typeof(getObject(arg0)) === 'bigint';
974
+ return ret;
975
+ }
976
+ export function __wbg___wbindgen_is_function_acc5528be2b923f2(arg0) {
977
+ const ret = typeof(getObject(arg0)) === 'function';
978
+ return ret;
979
+ }
980
+ export function __wbg___wbindgen_is_null_6d937fbfb6478470(arg0) {
981
+ const ret = getObject(arg0) === null;
982
+ return ret;
983
+ }
984
+ export function __wbg___wbindgen_is_object_0beba4a1980d3eea(arg0) {
985
+ const val = getObject(arg0);
986
+ const ret = typeof(val) === 'object' && val !== null;
987
+ return ret;
988
+ }
989
+ export function __wbg___wbindgen_is_string_1fca8072260dd261(arg0) {
990
+ const ret = typeof(getObject(arg0)) === 'string';
991
+ return ret;
992
+ }
993
+ export function __wbg___wbindgen_is_undefined_721f8decd50c87a3(arg0) {
994
+ const ret = getObject(arg0) === undefined;
995
+ return ret;
996
+ }
997
+ export function __wbg___wbindgen_jsval_eq_4e8c38722cb8ff51(arg0, arg1) {
998
+ const ret = getObject(arg0) === getObject(arg1);
999
+ return ret;
1000
+ }
1001
+ export function __wbg___wbindgen_jsval_loose_eq_4b9aba9e5b3c4582(arg0, arg1) {
1002
+ const ret = getObject(arg0) == getObject(arg1);
1003
+ return ret;
1004
+ }
1005
+ export function __wbg___wbindgen_number_get_1cc01dd708740256(arg0, arg1) {
1006
+ const obj = getObject(arg1);
1007
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1008
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1009
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1010
+ }
1011
+ export function __wbg___wbindgen_string_get_71bb4348194e31f0(arg0, arg1) {
1012
+ const obj = getObject(arg1);
1013
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1014
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1015
+ var len1 = WASM_VECTOR_LEN;
1016
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1017
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1018
+ }
1019
+ export function __wbg___wbindgen_throw_ea4887a5f8f9a9db(arg0, arg1) {
1020
+ throw new Error(getStringFromWasm0(arg0, arg1));
1021
+ }
1022
+ export function __wbg__wbg_cb_unref_33c39e13d73b25f6(arg0) {
1023
+ getObject(arg0)._wbg_cb_unref();
1024
+ }
1025
+ export function __wbg_abort_413b060ce2cedffd(arg0) {
1026
+ getObject(arg0).abort();
1027
+ }
1028
+ export function __wbg_aborted_4d4114700dc4c251(arg0) {
1029
+ const ret = getObject(arg0).aborted;
1030
+ return ret;
1031
+ }
1032
+ export function __wbg_addEventListener_ea90bc131475777e() { return handleError(function (arg0, arg1, arg2, arg3) {
1033
+ getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
1034
+ }, arguments); }
1035
+ export function __wbg_call_5575218572ead796() { return handleError(function (arg0, arg1, arg2) {
1036
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1037
+ return addHeapObject(ret);
1038
+ }, arguments); }
1039
+ export function __wbg_call_8e98ed2f3c86c4b5() { return handleError(function (arg0, arg1) {
1040
+ const ret = getObject(arg0).call(getObject(arg1));
1041
+ return addHeapObject(ret);
1042
+ }, arguments); }
1043
+ export function __wbg_clearTimeout_323d72e2c87b37b4(arg0) {
1044
+ globalThis.clearTimeout(getObject(arg0));
1045
+ }
1046
+ export function __wbg_clearTimeout_3629d6209dfcc46e(arg0) {
1047
+ const ret = clearTimeout(takeObject(arg0));
1048
+ return addHeapObject(ret);
1049
+ }
1050
+ export function __wbg_done_b62d4a7d2286852a(arg0) {
1051
+ const ret = getObject(arg0).done;
1052
+ return ret;
1053
+ }
1054
+ export function __wbg_entries_c261c3fa1f281256(arg0) {
1055
+ const ret = Object.entries(getObject(arg0));
1056
+ return addHeapObject(ret);
1057
+ }
1058
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
1059
+ let deferred0_0;
1060
+ let deferred0_1;
1061
+ try {
1062
+ deferred0_0 = arg0;
1063
+ deferred0_1 = arg1;
1064
+ console.error(getStringFromWasm0(arg0, arg1));
1065
+ } finally {
1066
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1067
+ }
1068
+ }
1069
+ export function __wbg_get_197a3fe98f169e38(arg0, arg1) {
1070
+ const ret = getObject(arg0)[arg1 >>> 0];
1071
+ return addHeapObject(ret);
1072
+ }
1073
+ export function __wbg_get_9a29be2cb383ed9a() { return handleError(function (arg0, arg1) {
1074
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1075
+ return addHeapObject(ret);
1076
+ }, arguments); }
1077
+ export function __wbg_get_dddb90ff5d27a080() { return handleError(function (arg0, arg1) {
1078
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1079
+ return addHeapObject(ret);
1080
+ }, arguments); }
1081
+ export function __wbg_get_unchecked_54a4374c38e08460(arg0, arg1) {
1082
+ const ret = getObject(arg0)[arg1 >>> 0];
1083
+ return addHeapObject(ret);
1084
+ }
1085
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
1086
+ const ret = getObject(arg0)[getObject(arg1)];
1087
+ return addHeapObject(ret);
1088
+ }
1089
+ export function __wbg_instanceof_AbortSignal_4bebac9f7add3026(arg0) {
1090
+ let result;
1091
+ try {
1092
+ result = getObject(arg0) instanceof AbortSignal;
1093
+ } catch (_) {
1094
+ result = false;
1095
+ }
1096
+ const ret = result;
1097
+ return ret;
1098
+ }
1099
+ export function __wbg_instanceof_ArrayBuffer_2a7bb09fee70c2da(arg0) {
1100
+ let result;
1101
+ try {
1102
+ result = getObject(arg0) instanceof ArrayBuffer;
1103
+ } catch (_) {
1104
+ result = false;
1105
+ }
1106
+ const ret = result;
1107
+ return ret;
1108
+ }
1109
+ export function __wbg_instanceof_Map_afa18d5840c04c15(arg0) {
1110
+ let result;
1111
+ try {
1112
+ result = getObject(arg0) instanceof Map;
1113
+ } catch (_) {
1114
+ result = false;
1115
+ }
1116
+ const ret = result;
1117
+ return ret;
1118
+ }
1119
+ export function __wbg_instanceof_Uint8Array_f080092dc70f5d58(arg0) {
1120
+ let result;
1121
+ try {
1122
+ result = getObject(arg0) instanceof Uint8Array;
1123
+ } catch (_) {
1124
+ result = false;
1125
+ }
1126
+ const ret = result;
1127
+ return ret;
1128
+ }
1129
+ export function __wbg_isArray_145a34fd0a38d37b(arg0) {
1130
+ const ret = Array.isArray(getObject(arg0));
1131
+ return ret;
1132
+ }
1133
+ export function __wbg_isSafeInteger_a3389a198582f5f6(arg0) {
1134
+ const ret = Number.isSafeInteger(getObject(arg0));
1135
+ return ret;
1136
+ }
1137
+ export function __wbg_iterator_cc47ba25a2be735a() {
1138
+ const ret = Symbol.iterator;
1139
+ return addHeapObject(ret);
1140
+ }
1141
+ export function __wbg_length_589238bdcf171f0e(arg0) {
1142
+ const ret = getObject(arg0).length;
1143
+ return ret;
1144
+ }
1145
+ export function __wbg_length_c6054974c0a6cdb9(arg0) {
1146
+ const ret = getObject(arg0).length;
1147
+ return ret;
1148
+ }
1149
+ export function __wbg_new_0d0108049d844421() {
1150
+ const ret = new globalThis.AbortController();
1151
+ return addHeapObject(ret);
1152
+ }
1153
+ export function __wbg_new_227d7c05414eb861() {
1154
+ const ret = new Error();
1155
+ return addHeapObject(ret);
1156
+ }
1157
+ export function __wbg_new_2e117a478906f062() {
1158
+ const ret = new Object();
1159
+ return addHeapObject(ret);
1160
+ }
1161
+ export function __wbg_new_3444eb7412549f0b() {
1162
+ const ret = new Map();
1163
+ return addHeapObject(ret);
1164
+ }
1165
+ export function __wbg_new_36e147a8ced3c6e0() {
1166
+ const ret = new Array();
1167
+ return addHeapObject(ret);
1168
+ }
1169
+ export function __wbg_new_81880fb5002cb255(arg0) {
1170
+ const ret = new Uint8Array(getObject(arg0));
1171
+ return addHeapObject(ret);
1172
+ }
1173
+ export function __wbg_new_f85beb941dc6d8aa(arg0, arg1) {
1174
+ try {
1175
+ var state0 = {a: arg0, b: arg1};
1176
+ var cb0 = (arg0, arg1) => {
1177
+ const a = state0.a;
1178
+ state0.a = 0;
1179
+ try {
1180
+ return __wasm_bindgen_func_elem_4110(a, state0.b, arg0, arg1);
1181
+ } finally {
1182
+ state0.a = a;
1183
+ }
1184
+ };
1185
+ const ret = new Promise(cb0);
1186
+ return addHeapObject(ret);
1187
+ } finally {
1188
+ state0.a = 0;
1189
+ }
1190
+ }
1191
+ export function __wbg_new_typed_00a409eb4ec4f2d9(arg0, arg1) {
1192
+ try {
1193
+ var state0 = {a: arg0, b: arg1};
1194
+ var cb0 = (arg0, arg1) => {
1195
+ const a = state0.a;
1196
+ state0.a = 0;
1197
+ try {
1198
+ return __wasm_bindgen_func_elem_4110(a, state0.b, arg0, arg1);
1199
+ } finally {
1200
+ state0.a = a;
1201
+ }
1202
+ };
1203
+ const ret = new Promise(cb0);
1204
+ return addHeapObject(ret);
1205
+ } finally {
1206
+ state0.a = 0;
1207
+ }
1208
+ }
1209
+ export function __wbg_next_0c4066e251d2eff9() { return handleError(function (arg0) {
1210
+ const ret = getObject(arg0).next();
1211
+ return addHeapObject(ret);
1212
+ }, arguments); }
1213
+ export function __wbg_next_402fa10b59ab20c3(arg0) {
1214
+ const ret = getObject(arg0).next;
1215
+ return addHeapObject(ret);
1216
+ }
1217
+ export function __wbg_now_d2e0afbad4edbe82() {
1218
+ const ret = Date.now();
1219
+ return ret;
1220
+ }
1221
+ export function __wbg_now_e7c6795a7f81e10f(arg0) {
1222
+ const ret = getObject(arg0).now();
1223
+ return ret;
1224
+ }
1225
+ export function __wbg_performance_3fcf6e32a7e1ed0a(arg0) {
1226
+ const ret = getObject(arg0).performance;
1227
+ return addHeapObject(ret);
1228
+ }
1229
+ export function __wbg_prototypesetcall_d721637c7ca66eb8(arg0, arg1, arg2) {
1230
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1231
+ }
1232
+ export function __wbg_push_f724b5db8acf89d2(arg0, arg1) {
1233
+ const ret = getObject(arg0).push(getObject(arg1));
1234
+ return ret;
1235
+ }
1236
+ export function __wbg_queueMicrotask_1c9b3800e321a967(arg0) {
1237
+ const ret = getObject(arg0).queueMicrotask;
1238
+ return addHeapObject(ret);
1239
+ }
1240
+ export function __wbg_queueMicrotask_311744e534a929a3(arg0) {
1241
+ queueMicrotask(getObject(arg0));
1242
+ }
1243
+ export function __wbg_race_27bed3574f107c6d(arg0) {
1244
+ const ret = Promise.race(getObject(arg0));
1245
+ return addHeapObject(ret);
1246
+ }
1247
+ export function __wbg_removeEventListener_c6782a9c30557d31() { return handleError(function (arg0, arg1, arg2, arg3) {
1248
+ getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
1249
+ }, arguments); }
1250
+ export function __wbg_resolve_d82363d90af6928a(arg0) {
1251
+ const ret = Promise.resolve(getObject(arg0));
1252
+ return addHeapObject(ret);
1253
+ }
1254
+ export function __wbg_setTimeout_56bcdccbad22fd44() { return handleError(function (arg0, arg1) {
1255
+ const ret = setTimeout(getObject(arg0), arg1);
1256
+ return addHeapObject(ret);
1257
+ }, arguments); }
1258
+ export function __wbg_setTimeout_63c2e8b855bb48ad(arg0, arg1) {
1259
+ const ret = globalThis.setTimeout(getObject(arg0), arg1 >>> 0);
1260
+ return addHeapObject(ret);
1261
+ }
1262
+ export function __wbg_set_4564f7dc44fcb0c9() { return handleError(function (arg0, arg1, arg2) {
1263
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1264
+ return ret;
1265
+ }, arguments); }
1266
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
1267
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1268
+ }
1269
+ export function __wbg_set_9a1d61e17de7054c(arg0, arg1, arg2) {
1270
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1271
+ return addHeapObject(ret);
1272
+ }
1273
+ export function __wbg_set_dc601f4a69da0bc2(arg0, arg1, arg2) {
1274
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1275
+ }
1276
+ export function __wbg_signal_4c9d3f39f4095986(arg0) {
1277
+ const ret = getObject(arg0).signal;
1278
+ return addHeapObject(ret);
1279
+ }
1280
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
1281
+ const ret = getObject(arg1).stack;
1282
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1283
+ const len1 = WASM_VECTOR_LEN;
1284
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1285
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1286
+ }
1287
+ export function __wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938() {
1288
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1289
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1290
+ }
1291
+ export function __wbg_static_accessor_GLOBAL_ce44e66a4935da8c() {
1292
+ const ret = typeof global === 'undefined' ? null : global;
1293
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1294
+ }
1295
+ export function __wbg_static_accessor_SELF_44f6e0cb5e67cdad() {
1296
+ const ret = typeof self === 'undefined' ? null : self;
1297
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1298
+ }
1299
+ export function __wbg_static_accessor_WINDOW_168f178805d978fe() {
1300
+ const ret = typeof window === 'undefined' ? null : window;
1301
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1302
+ }
1303
+ export function __wbg_then_05edfc8a4fea5106(arg0, arg1, arg2) {
1304
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1305
+ return addHeapObject(ret);
1306
+ }
1307
+ export function __wbg_then_591b6b3a75ee817a(arg0, arg1) {
1308
+ const ret = getObject(arg0).then(getObject(arg1));
1309
+ return addHeapObject(ret);
1310
+ }
1311
+ export function __wbg_value_49f783bb59765962(arg0) {
1312
+ const ret = getObject(arg0).value;
1313
+ return addHeapObject(ret);
1314
+ }
1315
+ export function __wbg_warn_cd671287bc02594a(arg0) {
1316
+ console.warn(getObject(arg0));
1317
+ }
1318
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
1319
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1320
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4101);
1321
+ return addHeapObject(ret);
1322
+ }
1323
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
1324
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 358, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1325
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4021);
1326
+ return addHeapObject(ret);
1327
+ }
1328
+ export function __wbindgen_cast_0000000000000003(arg0) {
1329
+ // Cast intrinsic for `F64 -> Externref`.
1330
+ const ret = arg0;
1331
+ return addHeapObject(ret);
1332
+ }
1333
+ export function __wbindgen_cast_0000000000000004(arg0) {
1334
+ // Cast intrinsic for `I64 -> Externref`.
1335
+ const ret = arg0;
1336
+ return addHeapObject(ret);
1337
+ }
1338
+ export function __wbindgen_cast_0000000000000005(arg0, arg1) {
1339
+ // Cast intrinsic for `Ref(String) -> Externref`.
1340
+ const ret = getStringFromWasm0(arg0, arg1);
1341
+ return addHeapObject(ret);
1342
+ }
1343
+ export function __wbindgen_cast_0000000000000006(arg0) {
1344
+ // Cast intrinsic for `U64 -> Externref`.
1345
+ const ret = BigInt.asUintN(64, arg0);
1346
+ return addHeapObject(ret);
1347
+ }
1348
+ export function __wbindgen_object_clone_ref(arg0) {
1349
+ const ret = getObject(arg0);
1350
+ return addHeapObject(ret);
1351
+ }
1352
+ export function __wbindgen_object_drop_ref(arg0) {
1353
+ takeObject(arg0);
1354
+ }
1355
+ function __wasm_bindgen_func_elem_4021(arg0, arg1) {
1356
+ wasm.__wasm_bindgen_func_elem_4021(arg0, arg1);
1357
+ }
1358
+
1359
+ function __wasm_bindgen_func_elem_4101(arg0, arg1, arg2) {
1360
+ try {
1361
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1362
+ wasm.__wasm_bindgen_func_elem_4101(retptr, arg0, arg1, addHeapObject(arg2));
1363
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1364
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1365
+ if (r1) {
1366
+ throw takeObject(r0);
1367
+ }
1368
+ } finally {
1369
+ wasm.__wbindgen_add_to_stack_pointer(16);
1370
+ }
1371
+ }
1372
+
1373
+ function __wasm_bindgen_func_elem_4110(arg0, arg1, arg2, arg3) {
1374
+ wasm.__wasm_bindgen_func_elem_4110(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1375
+ }
1376
+
1377
+ const OrderBookClientFinalization = (typeof FinalizationRegistry === 'undefined')
1378
+ ? { register: () => {}, unregister: () => {} }
1379
+ : new FinalizationRegistry(ptr => wasm.__wbg_orderbookclient_free(ptr, 1));
1380
+
1381
+ function addHeapObject(obj) {
1382
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1383
+ const idx = heap_next;
1384
+ heap_next = heap[idx];
1385
+
1386
+ heap[idx] = obj;
1387
+ return idx;
1388
+ }
1389
+
1390
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1391
+ ? { register: () => {}, unregister: () => {} }
1392
+ : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
1393
+
1394
+ function debugString(val) {
1395
+ // primitive types
1396
+ const type = typeof val;
1397
+ if (type == 'number' || type == 'boolean' || val == null) {
1398
+ return `${val}`;
1399
+ }
1400
+ if (type == 'string') {
1401
+ return `"${val}"`;
1402
+ }
1403
+ if (type == 'symbol') {
1404
+ const description = val.description;
1405
+ if (description == null) {
1406
+ return 'Symbol';
1407
+ } else {
1408
+ return `Symbol(${description})`;
1409
+ }
1410
+ }
1411
+ if (type == 'function') {
1412
+ const name = val.name;
1413
+ if (typeof name == 'string' && name.length > 0) {
1414
+ return `Function(${name})`;
1415
+ } else {
1416
+ return 'Function';
1417
+ }
1418
+ }
1419
+ // objects
1420
+ if (Array.isArray(val)) {
1421
+ const length = val.length;
1422
+ let debug = '[';
1423
+ if (length > 0) {
1424
+ debug += debugString(val[0]);
1425
+ }
1426
+ for(let i = 1; i < length; i++) {
1427
+ debug += ', ' + debugString(val[i]);
1428
+ }
1429
+ debug += ']';
1430
+ return debug;
1431
+ }
1432
+ // Test for built-in
1433
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1434
+ let className;
1435
+ if (builtInMatches && builtInMatches.length > 1) {
1436
+ className = builtInMatches[1];
1437
+ } else {
1438
+ // Failed to match the standard '[object ClassName]'
1439
+ return toString.call(val);
1440
+ }
1441
+ if (className == 'Object') {
1442
+ // we're a user defined class or Object
1443
+ // JSON.stringify avoids problems with cycles, and is generally much
1444
+ // easier than looping through ownProperties of `val`.
1445
+ try {
1446
+ return 'Object(' + JSON.stringify(val) + ')';
1447
+ } catch (_) {
1448
+ return 'Object';
1449
+ }
1450
+ }
1451
+ // errors
1452
+ if (val instanceof Error) {
1453
+ return `${val.name}: ${val.message}\n${val.stack}`;
1454
+ }
1455
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1456
+ return className;
1457
+ }
1458
+
1459
+ function dropObject(idx) {
1460
+ if (idx < 1028) return;
1461
+ heap[idx] = heap_next;
1462
+ heap_next = idx;
1463
+ }
1464
+
1465
+ function getArrayU32FromWasm0(ptr, len) {
1466
+ ptr = ptr >>> 0;
1467
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1468
+ }
1469
+
1470
+ function getArrayU8FromWasm0(ptr, len) {
1471
+ ptr = ptr >>> 0;
1472
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1473
+ }
1474
+
1475
+ let cachedDataViewMemory0 = null;
1476
+ function getDataViewMemory0() {
1477
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1478
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1479
+ }
1480
+ return cachedDataViewMemory0;
1481
+ }
1482
+
1483
+ function getStringFromWasm0(ptr, len) {
1484
+ return decodeText(ptr >>> 0, len);
1485
+ }
1486
+
1487
+ let cachedUint32ArrayMemory0 = null;
1488
+ function getUint32ArrayMemory0() {
1489
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1490
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1491
+ }
1492
+ return cachedUint32ArrayMemory0;
1493
+ }
1494
+
1495
+ let cachedUint8ArrayMemory0 = null;
1496
+ function getUint8ArrayMemory0() {
1497
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1498
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1499
+ }
1500
+ return cachedUint8ArrayMemory0;
1501
+ }
1502
+
1503
+ function getObject(idx) { return heap[idx]; }
1504
+
1505
+ function handleError(f, args) {
1506
+ try {
1507
+ return f.apply(this, args);
1508
+ } catch (e) {
1509
+ wasm.__wbindgen_export3(addHeapObject(e));
1510
+ }
1511
+ }
1512
+
1513
+ let heap = new Array(1024).fill(undefined);
1514
+ heap.push(undefined, null, true, false);
1515
+
1516
+ let heap_next = heap.length;
1517
+
1518
+ function isLikeNone(x) {
1519
+ return x === undefined || x === null;
1520
+ }
1521
+
1522
+ function makeMutClosure(arg0, arg1, f) {
1523
+ const state = { a: arg0, b: arg1, cnt: 1 };
1524
+ const real = (...args) => {
1525
+
1526
+ // First up with a closure we increment the internal reference
1527
+ // count. This ensures that the Rust closure environment won't
1528
+ // be deallocated while we're invoking it.
1529
+ state.cnt++;
1530
+ const a = state.a;
1531
+ state.a = 0;
1532
+ try {
1533
+ return f(a, state.b, ...args);
1534
+ } finally {
1535
+ state.a = a;
1536
+ real._wbg_cb_unref();
1537
+ }
1538
+ };
1539
+ real._wbg_cb_unref = () => {
1540
+ if (--state.cnt === 0) {
1541
+ wasm.__wbindgen_export5(state.a, state.b);
1542
+ state.a = 0;
1543
+ CLOSURE_DTORS.unregister(state);
1544
+ }
1545
+ };
1546
+ CLOSURE_DTORS.register(real, state, state);
1547
+ return real;
1548
+ }
1549
+
1550
+ function passArrayJsValueToWasm0(array, malloc) {
1551
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1552
+ const mem = getDataViewMemory0();
1553
+ for (let i = 0; i < array.length; i++) {
1554
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1555
+ }
1556
+ WASM_VECTOR_LEN = array.length;
1557
+ return ptr;
1558
+ }
1559
+
1560
+ function passStringToWasm0(arg, malloc, realloc) {
1561
+ if (realloc === undefined) {
1562
+ const buf = cachedTextEncoder.encode(arg);
1563
+ const ptr = malloc(buf.length, 1) >>> 0;
1564
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1565
+ WASM_VECTOR_LEN = buf.length;
1566
+ return ptr;
1567
+ }
1568
+
1569
+ let len = arg.length;
1570
+ let ptr = malloc(len, 1) >>> 0;
1571
+
1572
+ const mem = getUint8ArrayMemory0();
1573
+
1574
+ let offset = 0;
1575
+
1576
+ for (; offset < len; offset++) {
1577
+ const code = arg.charCodeAt(offset);
1578
+ if (code > 0x7F) break;
1579
+ mem[ptr + offset] = code;
1580
+ }
1581
+ if (offset !== len) {
1582
+ if (offset !== 0) {
1583
+ arg = arg.slice(offset);
1584
+ }
1585
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1586
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1587
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1588
+
1589
+ offset += ret.written;
1590
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1591
+ }
1592
+
1593
+ WASM_VECTOR_LEN = offset;
1594
+ return ptr;
1595
+ }
1596
+
1597
+ function takeObject(idx) {
1598
+ const ret = getObject(idx);
1599
+ dropObject(idx);
1600
+ return ret;
1601
+ }
1602
+
1603
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1604
+ cachedTextDecoder.decode();
1605
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1606
+ let numBytesDecoded = 0;
1607
+ function decodeText(ptr, len) {
1608
+ numBytesDecoded += len;
1609
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1610
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1611
+ cachedTextDecoder.decode();
1612
+ numBytesDecoded = len;
1613
+ }
1614
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1615
+ }
1616
+
1617
+ const cachedTextEncoder = new TextEncoder();
1618
+
1619
+ if (!('encodeInto' in cachedTextEncoder)) {
1620
+ cachedTextEncoder.encodeInto = function (arg, view) {
1621
+ const buf = cachedTextEncoder.encode(arg);
1622
+ view.set(buf);
1623
+ return {
1624
+ read: arg.length,
1625
+ written: buf.length
1626
+ };
1627
+ };
1628
+ }
1629
+
1630
+ let WASM_VECTOR_LEN = 0;
1631
+
1632
+
1633
+ let wasm;
1634
+ export function __wbg_set_wasm(val) {
1635
+ wasm = val;
1636
+ }