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