@symbiome-forge/cow-sdk-wasm 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (58) hide show
  1. package/README.md +12 -5
  2. package/dist/raw/default-bundler/cow_sdk_wasm.d.ts +57 -0
  3. package/dist/raw/default-bundler/cow_sdk_wasm.js +1 -1
  4. package/dist/raw/default-bundler/cow_sdk_wasm_bg.js +109 -18
  5. package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm +0 -0
  6. package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  7. package/dist/raw/default-module/cow_sdk_wasm.d.ts +57 -0
  8. package/dist/raw/default-module/cow_sdk_wasm.js +109 -18
  9. package/dist/raw/default-module/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  10. package/dist/raw/default-nodejs/cow_sdk_wasm.cjs +110 -18
  11. package/dist/raw/default-nodejs/cow_sdk_wasm.d.ts +57 -0
  12. package/dist/raw/default-nodejs/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  13. package/dist/raw/default-web/cow_sdk_wasm.d.ts +63 -3
  14. package/dist/raw/default-web/cow_sdk_wasm.js +109 -18
  15. package/dist/raw/default-web/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  16. package/dist/raw/orderbook-bundler/cow_sdk_wasm.d.ts +31 -0
  17. package/dist/raw/orderbook-bundler/cow_sdk_wasm.js +1 -1
  18. package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.js +49 -20
  19. package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm +0 -0
  20. package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  21. package/dist/raw/orderbook-module/cow_sdk_wasm.d.ts +31 -0
  22. package/dist/raw/orderbook-module/cow_sdk_wasm.js +49 -20
  23. package/dist/raw/orderbook-module/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  24. package/dist/raw/orderbook-nodejs/cow_sdk_wasm.cjs +50 -20
  25. package/dist/raw/orderbook-nodejs/cow_sdk_wasm.d.ts +31 -0
  26. package/dist/raw/orderbook-nodejs/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  27. package/dist/raw/orderbook-web/cow_sdk_wasm.d.ts +35 -3
  28. package/dist/raw/orderbook-web/cow_sdk_wasm.js +49 -20
  29. package/dist/raw/orderbook-web/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  30. package/dist/raw/signing-bundler/cow_sdk_wasm.d.ts +31 -0
  31. package/dist/raw/signing-bundler/cow_sdk_wasm.js +1 -1
  32. package/dist/raw/signing-bundler/cow_sdk_wasm_bg.js +41 -12
  33. package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm +0 -0
  34. package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  35. package/dist/raw/signing-module/cow_sdk_wasm.d.ts +31 -0
  36. package/dist/raw/signing-module/cow_sdk_wasm.js +41 -12
  37. package/dist/raw/signing-module/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  38. package/dist/raw/signing-nodejs/cow_sdk_wasm.cjs +42 -12
  39. package/dist/raw/signing-nodejs/cow_sdk_wasm.d.ts +31 -0
  40. package/dist/raw/signing-nodejs/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  41. package/dist/raw/signing-web/cow_sdk_wasm.d.ts +35 -3
  42. package/dist/raw/signing-web/cow_sdk_wasm.js +41 -12
  43. package/dist/raw/signing-web/cow_sdk_wasm_bg.wasm.d.ts +4 -3
  44. package/dist/raw/trading-bundler/cow_sdk_wasm.d.ts +57 -0
  45. package/dist/raw/trading-bundler/cow_sdk_wasm.js +1 -1
  46. package/dist/raw/trading-bundler/cow_sdk_wasm_bg.js +109 -18
  47. package/dist/raw/trading-bundler/cow_sdk_wasm_bg.wasm +0 -0
  48. package/dist/raw/trading-bundler/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  49. package/dist/raw/trading-module/cow_sdk_wasm.d.ts +57 -0
  50. package/dist/raw/trading-module/cow_sdk_wasm.js +109 -18
  51. package/dist/raw/trading-module/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  52. package/dist/raw/trading-nodejs/cow_sdk_wasm.cjs +110 -18
  53. package/dist/raw/trading-nodejs/cow_sdk_wasm.d.ts +57 -0
  54. package/dist/raw/trading-nodejs/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  55. package/dist/raw/trading-web/cow_sdk_wasm.d.ts +63 -3
  56. package/dist/raw/trading-web/cow_sdk_wasm.js +109 -18
  57. package/dist/raw/trading-web/cow_sdk_wasm_bg.wasm.d.ts +6 -3
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -42,7 +42,7 @@ runtime entries over one shared wasm binary, so pick the **runtime** by the suff
42
42
 
43
43
  | Import | Surface | Use when |
44
44
  | --- | --- | --- |
45
- | `@symbiome-forge/cow-sdk-wasm/trading` | Full order lifecycle: quote, sign, post, cancel, app-data | A browser dapp, a Node backend, or an edge runtime running order flow — one feature set serves all three; pick the runtime by suffix |
45
+ | `@symbiome-forge/cow-sdk-wasm/trading` | Full order lifecycle: quote, sign, post, cancel, app-data, and native wrap/unwrap | A browser dapp, a Node backend, or an edge runtime running order flow — one feature set serves all three; pick the runtime by suffix |
46
46
  | `@symbiome-forge/cow-sdk-wasm/orderbook` | Orderbook reads, cancellation, and signing — no trading or app-data | A read-focused dapp that does not post orders |
47
47
  | `@symbiome-forge/cow-sdk-wasm/signing` | Signing, UID, EIP-1271, deployment, and version helpers — the smallest flavor | A signer service or HSM-facing adapter |
48
48
  | `@symbiome-forge/cow-sdk-wasm` | Everything above plus subgraph analytics and IPFS app-data | General use that needs subgraph or IPFS |
@@ -139,6 +139,13 @@ Selling the native asset is the same shape: `getQuote`, then
139
139
  `buildSellNativeCurrencyTxFromQuote(quote.value, owner)`, which returns the EthFlow
140
140
  transaction request for the wallet to submit.
141
141
 
142
+ Converting between the native asset and its wrapped form is not an order:
143
+ `buildWrapTx(chainId, amount)` and `buildUnwrapTx(chainId, amount)` return the
144
+ WETH deposit/withdraw transaction for the wallet to submit, and
145
+ `wrappedNativeToken(chainId)` resolves the wrapped-native token (address, symbol,
146
+ decimals) for detecting a wrap pair in a swap UI. (Selling native currency to
147
+ trade does not need a manual wrap — eth-flow wraps on-chain.)
148
+
142
149
  ### Cloudflare Worker (edge)
143
150
 
144
151
  Workers cannot compile wasm from bytes at runtime, so the edge build takes the
@@ -230,10 +237,10 @@ current alpha build (gzip is the compressed-transfer figure):
230
237
 
231
238
  | Flavor | Raw wasm | Brotli | Gzip | Release gate |
232
239
  | --- | ---: | ---: | ---: | --- |
233
- | signing | 0.31 MiB | 120 KiB | 142 KiB | 0.9 MiB raw / 300 KiB brotli |
234
- | orderbook | 1.02 MiB | 341 KiB | 447 KiB | 1.5 MiB raw / 500 KiB brotli |
235
- | trading | 1.54 MiB | 490 KiB | 659 KiB | 3.2 MiB raw / 850 KiB brotli |
236
- | default | 1.63 MiB | 513 KiB | 691 KiB | 3.3 MiB raw / 900 KiB brotli |
240
+ | signing | 0.31 MiB | 121 KiB | 144 KiB | 0.9 MiB raw / 300 KiB brotli |
241
+ | orderbook | 1.03 MiB | 341 KiB | 448 KiB | 1.5 MiB raw / 500 KiB brotli |
242
+ | trading | 1.54 MiB | 491 KiB | 661 KiB | 3.2 MiB raw / 850 KiB brotli |
243
+ | default | 1.64 MiB | 514 KiB | 693 KiB | 3.3 MiB raw / 900 KiB brotli |
237
244
 
238
245
  Each flavor emits one wasm binary shared across its bundler, Node, web, and
239
246
  source-phase module targets — the web glue's default URL, the module glue's
@@ -2213,6 +2213,24 @@ export interface WasmEnvelope<T> {
2213
2213
  value: T;
2214
2214
  }
2215
2215
 
2216
+ /**
2217
+ * Wrapped-native token metadata.
2218
+ */
2219
+ export interface WrappedNativeTokenDto {
2220
+ /**
2221
+ * Wrapped-native token contract address.
2222
+ */
2223
+ address: string;
2224
+ /**
2225
+ * Token symbol, such as `WETH` or `WXDAI`.
2226
+ */
2227
+ symbol: string;
2228
+ /**
2229
+ * Token decimals.
2230
+ */
2231
+ decimals: number;
2232
+ }
2233
+
2216
2234
  /**
2217
2235
  * `CoW` Protocol environment, mirroring `cow_sdk_core::CowEnv`.
2218
2236
  */
@@ -2657,6 +2675,32 @@ export class TradingClient {
2657
2675
  * @throws CowError when the quote is not a native-currency sell, lacks a quote id, or the chain, deployment, or sender is invalid.
2658
2676
  */
2659
2677
  buildSellNativeCurrencyTxFromQuote(quoteResults: QuoteResultsDto, from: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<BuiltSellNativeCurrencyTxDto>>;
2678
+ /**
2679
+ * Builds the transaction that unwraps the wrapped-native token back into
2680
+ * native currency (for example WETH into ETH) on this client's chain.
2681
+ *
2682
+ * `withdraw` burns the caller's own wrapped-native balance, so no token
2683
+ * approval is required. Submit the returned request with the host wallet.
2684
+ *
2685
+ * @param amount Amount of the wrapped-native token to unwrap, in wei as a decimal string.
2686
+ * @returns A versioned envelope containing the unsigned unwrap transaction request.
2687
+ * @throws CowError when the chain is unsupported or the amount is invalid.
2688
+ */
2689
+ buildUnwrapTx(amount: string): WasmEnvelope<TransactionRequestDto>;
2690
+ /**
2691
+ * Builds the transaction that wraps native currency into its wrapped-native
2692
+ * token (for example ETH into WETH) on this client's chain.
2693
+ *
2694
+ * The target wrapped-native address is resolved from the chain; submit the
2695
+ * returned request with the host wallet. Selling native currency through CoW
2696
+ * Protocol does not require a manual wrap — the eth-flow path wraps on-chain
2697
+ * during order creation — so use this for standalone wrap and treasury flows.
2698
+ *
2699
+ * @param amount Amount of native currency to wrap, in wei as a decimal string.
2700
+ * @returns A versioned envelope containing the unsigned wrap transaction request.
2701
+ * @throws CowError when the chain is unsupported or the amount is invalid.
2702
+ */
2703
+ buildWrapTx(amount: string): WasmEnvelope<TransactionRequestDto>;
2660
2704
  /**
2661
2705
  * Reads CoW Protocol allowance through a read-only contract callback.
2662
2706
  *
@@ -3111,3 +3155,16 @@ export function validateAppDataDoc(doc: AppDataDocInput): WasmEnvelope<Validatio
3111
3155
  * @returns The semantic version string for this wasm build.
3112
3156
  */
3113
3157
  export function wasmVersion(): string;
3158
+
3159
+ /**
3160
+ * Returns wrapped-native token metadata for a chain.
3161
+ *
3162
+ * Use this to recognise a wrap pair in a swap UI — compare a selected token's
3163
+ * address against the returned address — or to display the wrapped-native
3164
+ * token. This is a pure lookup and performs no network I/O.
3165
+ *
3166
+ * @param chainId EVM chain id to resolve.
3167
+ * @returns The wrapped-native token address, symbol, and decimals.
3168
+ * @throws CowError when the chain is not supported.
3169
+ */
3170
+ export function wrappedNativeToken(chainId: number): WasmEnvelope<WrappedNativeTokenDto>;
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./cow_sdk_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- IpfsClient, OrderBookClient, SubgraphClient, TradingClient, __cow_sdk_wasm_init, appDataDoc, appDataHexToCid, appDataInfo, buildCancelOrderTx, buildPresignTx, cidToAppDataHex, computeOrderUid, decodeEthFlowLog, decodeSettlementLog, deploymentAddresses, domainSeparator, eip1271SignaturePayload, orderTypedData, signCancellationEthSignDigest, signCancellationWithEip1193, signCancellationWithTypedDataSigner, signOrderEthSignDigest, signOrderWithCustomEip1271, signOrderWithEip1193, signOrderWithEip1271, signOrderWithTypedDataSigner, supportedChainIds, validateAppDataDoc, wasmVersion
8
+ IpfsClient, OrderBookClient, SubgraphClient, TradingClient, __cow_sdk_wasm_init, appDataDoc, appDataHexToCid, appDataInfo, buildCancelOrderTx, buildPresignTx, cidToAppDataHex, computeOrderUid, decodeEthFlowLog, decodeSettlementLog, deploymentAddresses, domainSeparator, eip1271SignaturePayload, orderTypedData, signCancellationEthSignDigest, signCancellationWithEip1193, signCancellationWithTypedDataSigner, signOrderEthSignDigest, signOrderWithCustomEip1271, signOrderWithEip1193, signOrderWithEip1271, signOrderWithTypedDataSigner, supportedChainIds, validateAppDataDoc, wasmVersion, wrappedNativeToken
9
9
  } from "./cow_sdk_wasm_bg.js";
@@ -714,6 +714,68 @@ export class TradingClient {
714
714
  const ret = wasm.tradingclient_buildSellNativeCurrencyTxFromQuote(this.__wbg_ptr, addHeapObject(quoteResults), ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
715
715
  return takeObject(ret);
716
716
  }
717
+ /**
718
+ * Builds the transaction that unwraps the wrapped-native token back into
719
+ * native currency (for example WETH into ETH) on this client's chain.
720
+ *
721
+ * `withdraw` burns the caller's own wrapped-native balance, so no token
722
+ * approval is required. Submit the returned request with the host wallet.
723
+ *
724
+ * @param amount Amount of the wrapped-native token to unwrap, in wei as a decimal string.
725
+ * @returns A versioned envelope containing the unsigned unwrap transaction request.
726
+ * @throws CowError when the chain is unsupported or the amount is invalid.
727
+ * @param {string} amount
728
+ * @returns {WasmEnvelope<TransactionRequestDto>}
729
+ */
730
+ buildUnwrapTx(amount) {
731
+ try {
732
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
733
+ const ptr0 = passStringToWasm0(amount, wasm.__wbindgen_export, wasm.__wbindgen_export2);
734
+ const len0 = WASM_VECTOR_LEN;
735
+ wasm.tradingclient_buildUnwrapTx(retptr, this.__wbg_ptr, ptr0, len0);
736
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
737
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
738
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
739
+ if (r2) {
740
+ throw takeObject(r1);
741
+ }
742
+ return takeObject(r0);
743
+ } finally {
744
+ wasm.__wbindgen_add_to_stack_pointer(16);
745
+ }
746
+ }
747
+ /**
748
+ * Builds the transaction that wraps native currency into its wrapped-native
749
+ * token (for example ETH into WETH) on this client's chain.
750
+ *
751
+ * The target wrapped-native address is resolved from the chain; submit the
752
+ * returned request with the host wallet. Selling native currency through CoW
753
+ * Protocol does not require a manual wrap — the eth-flow path wraps on-chain
754
+ * during order creation — so use this for standalone wrap and treasury flows.
755
+ *
756
+ * @param amount Amount of native currency to wrap, in wei as a decimal string.
757
+ * @returns A versioned envelope containing the unsigned wrap transaction request.
758
+ * @throws CowError when the chain is unsupported or the amount is invalid.
759
+ * @param {string} amount
760
+ * @returns {WasmEnvelope<TransactionRequestDto>}
761
+ */
762
+ buildWrapTx(amount) {
763
+ try {
764
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
765
+ const ptr0 = passStringToWasm0(amount, wasm.__wbindgen_export, wasm.__wbindgen_export2);
766
+ const len0 = WASM_VECTOR_LEN;
767
+ wasm.tradingclient_buildWrapTx(retptr, this.__wbg_ptr, ptr0, len0);
768
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
769
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
770
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
771
+ if (r2) {
772
+ throw takeObject(r1);
773
+ }
774
+ return takeObject(r0);
775
+ } finally {
776
+ wasm.__wbindgen_add_to_stack_pointer(16);
777
+ }
778
+ }
717
779
  /**
718
780
  * Reads CoW Protocol allowance through a read-only contract callback.
719
781
  *
@@ -1606,6 +1668,35 @@ export function wasmVersion() {
1606
1668
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1607
1669
  }
1608
1670
  }
1671
+
1672
+ /**
1673
+ * Returns wrapped-native token metadata for a chain.
1674
+ *
1675
+ * Use this to recognise a wrap pair in a swap UI — compare a selected token's
1676
+ * address against the returned address — or to display the wrapped-native
1677
+ * token. This is a pure lookup and performs no network I/O.
1678
+ *
1679
+ * @param chainId EVM chain id to resolve.
1680
+ * @returns The wrapped-native token address, symbol, and decimals.
1681
+ * @throws CowError when the chain is not supported.
1682
+ * @param {number} chainId
1683
+ * @returns {WasmEnvelope<WrappedNativeTokenDto>}
1684
+ */
1685
+ export function wrappedNativeToken(chainId) {
1686
+ try {
1687
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1688
+ wasm.wrappedNativeToken(retptr, chainId);
1689
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1690
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1691
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1692
+ if (r2) {
1693
+ throw takeObject(r1);
1694
+ }
1695
+ return takeObject(r0);
1696
+ } finally {
1697
+ wasm.__wbindgen_add_to_stack_pointer(16);
1698
+ }
1699
+ }
1609
1700
  export function __wbg_Error_fdd633d4bb5dd76a(arg0, arg1) {
1610
1701
  const ret = Error(getStringFromWasm0(arg0, arg1));
1611
1702
  return addHeapObject(ret);
@@ -1699,7 +1790,7 @@ export function __wbg__wbg_cb_unref_33c39e13d73b25f6(arg0) {
1699
1790
  export function __wbg_abort_6e6ea7d259504afc(arg0) {
1700
1791
  getObject(arg0).abort();
1701
1792
  }
1702
- export function __wbg_abort_f619679fd0640f2b(arg0) {
1793
+ export function __wbg_abort_9edc722d54ab72ff(arg0) {
1703
1794
  getObject(arg0).abort();
1704
1795
  }
1705
1796
  export function __wbg_aborted_4d4114700dc4c251(arg0) {
@@ -1721,7 +1812,7 @@ export function __wbg_clearTimeout_3629d6209dfcc46e(arg0) {
1721
1812
  const ret = clearTimeout(takeObject(arg0));
1722
1813
  return addHeapObject(ret);
1723
1814
  }
1724
- export function __wbg_clearTimeout_49efa3504516becc(arg0) {
1815
+ export function __wbg_clearTimeout_82be620da651c4df(arg0) {
1725
1816
  globalThis.clearTimeout(getObject(arg0));
1726
1817
  }
1727
1818
  export function __wbg_done_b62d4a7d2286852a(arg0) {
@@ -1855,6 +1946,10 @@ export function __wbg_new_10e2f2ad134f940f() { return handleError(function () {
1855
1946
  const ret = new Headers();
1856
1947
  return addHeapObject(ret);
1857
1948
  }, arguments); }
1949
+ export function __wbg_new_1510932000003026() {
1950
+ const ret = new globalThis.AbortController();
1951
+ return addHeapObject(ret);
1952
+ }
1858
1953
  export function __wbg_new_227d7c05414eb861() {
1859
1954
  const ret = new Error();
1860
1955
  return addHeapObject(ret);
@@ -1875,10 +1970,6 @@ export function __wbg_new_51233fa2a760b272() { return handleError(function () {
1875
1970
  const ret = new AbortController();
1876
1971
  return addHeapObject(ret);
1877
1972
  }, arguments); }
1878
- export function __wbg_new_5432766ec31f2ed7() {
1879
- const ret = new globalThis.AbortController();
1880
- return addHeapObject(ret);
1881
- }
1882
1973
  export function __wbg_new_81880fb5002cb255(arg0) {
1883
1974
  const ret = new Uint8Array(getObject(arg0));
1884
1975
  return addHeapObject(ret);
@@ -1890,7 +1981,7 @@ export function __wbg_new_f85beb941dc6d8aa(arg0, arg1) {
1890
1981
  const a = state0.a;
1891
1982
  state0.a = 0;
1892
1983
  try {
1893
- return __wasm_bindgen_func_elem_6683(a, state0.b, arg0, arg1);
1984
+ return __wasm_bindgen_func_elem_6708(a, state0.b, arg0, arg1);
1894
1985
  } finally {
1895
1986
  state0.a = a;
1896
1987
  }
@@ -1908,7 +1999,7 @@ export function __wbg_new_typed_00a409eb4ec4f2d9(arg0, arg1) {
1908
1999
  const a = state0.a;
1909
2000
  state0.a = 0;
1910
2001
  try {
1911
- return __wasm_bindgen_func_elem_6683(a, state0.b, arg0, arg1);
2002
+ return __wasm_bindgen_func_elem_6708(a, state0.b, arg0, arg1);
1912
2003
  } finally {
1913
2004
  state0.a = a;
1914
2005
  }
@@ -1972,7 +2063,7 @@ export function __wbg_setTimeout_56bcdccbad22fd44() { return handleError(functio
1972
2063
  const ret = setTimeout(getObject(arg0), arg1);
1973
2064
  return addHeapObject(ret);
1974
2065
  }, arguments); }
1975
- export function __wbg_setTimeout_76a6e38229b3e5ac(arg0, arg1) {
2066
+ export function __wbg_setTimeout_dec17a70d41e79bd(arg0, arg1) {
1976
2067
  const ret = globalThis.setTimeout(getObject(arg0), arg1 >>> 0);
1977
2068
  return addHeapObject(ret);
1978
2069
  }
@@ -2009,7 +2100,7 @@ export function __wbg_signal_4d9d567be73ea52c(arg0) {
2009
2100
  const ret = getObject(arg0).signal;
2010
2101
  return addHeapObject(ret);
2011
2102
  }
2012
- export function __wbg_signal_b4933a5cf1e85298(arg0) {
2103
+ export function __wbg_signal_c0efe2346fd88fa1(arg0) {
2013
2104
  const ret = getObject(arg0).signal;
2014
2105
  return addHeapObject(ret);
2015
2106
  }
@@ -2061,12 +2152,12 @@ export function __wbg_warn_cd671287bc02594a(arg0) {
2061
2152
  }
2062
2153
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
2063
2154
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 652, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2064
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6674);
2155
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6699);
2065
2156
  return addHeapObject(ret);
2066
2157
  }
2067
2158
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
2068
2159
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 644, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2069
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6594);
2160
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6619);
2070
2161
  return addHeapObject(ret);
2071
2162
  }
2072
2163
  export function __wbindgen_cast_0000000000000003(arg0) {
@@ -2096,14 +2187,14 @@ export function __wbindgen_object_clone_ref(arg0) {
2096
2187
  export function __wbindgen_object_drop_ref(arg0) {
2097
2188
  takeObject(arg0);
2098
2189
  }
2099
- function __wasm_bindgen_func_elem_6594(arg0, arg1) {
2100
- wasm.__wasm_bindgen_func_elem_6594(arg0, arg1);
2190
+ function __wasm_bindgen_func_elem_6619(arg0, arg1) {
2191
+ wasm.__wasm_bindgen_func_elem_6619(arg0, arg1);
2101
2192
  }
2102
2193
 
2103
- function __wasm_bindgen_func_elem_6674(arg0, arg1, arg2) {
2194
+ function __wasm_bindgen_func_elem_6699(arg0, arg1, arg2) {
2104
2195
  try {
2105
2196
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2106
- wasm.__wasm_bindgen_func_elem_6674(retptr, arg0, arg1, addHeapObject(arg2));
2197
+ wasm.__wasm_bindgen_func_elem_6699(retptr, arg0, arg1, addHeapObject(arg2));
2107
2198
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2108
2199
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2109
2200
  if (r1) {
@@ -2114,8 +2205,8 @@ function __wasm_bindgen_func_elem_6674(arg0, arg1, arg2) {
2114
2205
  }
2115
2206
  }
2116
2207
 
2117
- function __wasm_bindgen_func_elem_6683(arg0, arg1, arg2, arg3) {
2118
- wasm.__wasm_bindgen_func_elem_6683(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2208
+ function __wasm_bindgen_func_elem_6708(arg0, arg1, arg2, arg3) {
2209
+ wasm.__wasm_bindgen_func_elem_6708(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2119
2210
  }
2120
2211
 
2121
2212
  const IpfsClientFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -58,6 +58,8 @@ export const supportedChainIds: (a: number) => void;
58
58
  export const tradingclient_buildApprovalTx: (a: number, b: number, c: number) => number;
59
59
  export const tradingclient_buildSellNativeCurrencyTx: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
60
60
  export const tradingclient_buildSellNativeCurrencyTxFromQuote: (a: number, b: number, c: number, d: number, e: number) => number;
61
+ export const tradingclient_buildUnwrapTx: (a: number, b: number, c: number, d: number) => void;
62
+ export const tradingclient_buildWrapTx: (a: number, b: number, c: number, d: number) => void;
61
63
  export const tradingclient_getCowProtocolAllowance: (a: number, b: number, c: number, d: number) => number;
62
64
  export const tradingclient_getQuote: (a: number, b: number, c: number) => number;
63
65
  export const tradingclient_new: (a: number, b: number) => void;
@@ -67,9 +69,10 @@ export const tradingclient_postSwapOrderFromQuote: (a: number, b: number, c: num
67
69
  export const tradingclient_postSwapOrderWithEip1271: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
68
70
  export const validateAppDataDoc: (a: number, b: number) => void;
69
71
  export const wasmVersion: (a: number) => void;
70
- export const __wasm_bindgen_func_elem_6674: (a: number, b: number, c: number, d: number) => void;
71
- export const __wasm_bindgen_func_elem_6683: (a: number, b: number, c: number, d: number) => void;
72
- export const __wasm_bindgen_func_elem_6594: (a: number, b: number) => void;
72
+ export const wrappedNativeToken: (a: number, b: number) => void;
73
+ export const __wasm_bindgen_func_elem_6699: (a: number, b: number, c: number, d: number) => void;
74
+ export const __wasm_bindgen_func_elem_6708: (a: number, b: number, c: number, d: number) => void;
75
+ export const __wasm_bindgen_func_elem_6619: (a: number, b: number) => void;
73
76
  export const __wbindgen_export: (a: number, b: number) => number;
74
77
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
75
78
  export const __wbindgen_export3: (a: number) => void;
@@ -2213,6 +2213,24 @@ export interface WasmEnvelope<T> {
2213
2213
  value: T;
2214
2214
  }
2215
2215
 
2216
+ /**
2217
+ * Wrapped-native token metadata.
2218
+ */
2219
+ export interface WrappedNativeTokenDto {
2220
+ /**
2221
+ * Wrapped-native token contract address.
2222
+ */
2223
+ address: string;
2224
+ /**
2225
+ * Token symbol, such as `WETH` or `WXDAI`.
2226
+ */
2227
+ symbol: string;
2228
+ /**
2229
+ * Token decimals.
2230
+ */
2231
+ decimals: number;
2232
+ }
2233
+
2216
2234
  /**
2217
2235
  * `CoW` Protocol environment, mirroring `cow_sdk_core::CowEnv`.
2218
2236
  */
@@ -2657,6 +2675,32 @@ export class TradingClient {
2657
2675
  * @throws CowError when the quote is not a native-currency sell, lacks a quote id, or the chain, deployment, or sender is invalid.
2658
2676
  */
2659
2677
  buildSellNativeCurrencyTxFromQuote(quoteResults: QuoteResultsDto, from: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<BuiltSellNativeCurrencyTxDto>>;
2678
+ /**
2679
+ * Builds the transaction that unwraps the wrapped-native token back into
2680
+ * native currency (for example WETH into ETH) on this client's chain.
2681
+ *
2682
+ * `withdraw` burns the caller's own wrapped-native balance, so no token
2683
+ * approval is required. Submit the returned request with the host wallet.
2684
+ *
2685
+ * @param amount Amount of the wrapped-native token to unwrap, in wei as a decimal string.
2686
+ * @returns A versioned envelope containing the unsigned unwrap transaction request.
2687
+ * @throws CowError when the chain is unsupported or the amount is invalid.
2688
+ */
2689
+ buildUnwrapTx(amount: string): WasmEnvelope<TransactionRequestDto>;
2690
+ /**
2691
+ * Builds the transaction that wraps native currency into its wrapped-native
2692
+ * token (for example ETH into WETH) on this client's chain.
2693
+ *
2694
+ * The target wrapped-native address is resolved from the chain; submit the
2695
+ * returned request with the host wallet. Selling native currency through CoW
2696
+ * Protocol does not require a manual wrap — the eth-flow path wraps on-chain
2697
+ * during order creation — so use this for standalone wrap and treasury flows.
2698
+ *
2699
+ * @param amount Amount of native currency to wrap, in wei as a decimal string.
2700
+ * @returns A versioned envelope containing the unsigned wrap transaction request.
2701
+ * @throws CowError when the chain is unsupported or the amount is invalid.
2702
+ */
2703
+ buildWrapTx(amount: string): WasmEnvelope<TransactionRequestDto>;
2660
2704
  /**
2661
2705
  * Reads CoW Protocol allowance through a read-only contract callback.
2662
2706
  *
@@ -3111,3 +3155,16 @@ export function validateAppDataDoc(doc: AppDataDocInput): WasmEnvelope<Validatio
3111
3155
  * @returns The semantic version string for this wasm build.
3112
3156
  */
3113
3157
  export function wasmVersion(): string;
3158
+
3159
+ /**
3160
+ * Returns wrapped-native token metadata for a chain.
3161
+ *
3162
+ * Use this to recognise a wrap pair in a swap UI — compare a selected token's
3163
+ * address against the returned address — or to display the wrapped-native
3164
+ * token. This is a pure lookup and performs no network I/O.
3165
+ *
3166
+ * @param chainId EVM chain id to resolve.
3167
+ * @returns The wrapped-native token address, symbol, and decimals.
3168
+ * @throws CowError when the chain is not supported.
3169
+ */
3170
+ export function wrappedNativeToken(chainId: number): WasmEnvelope<WrappedNativeTokenDto>;
@@ -718,6 +718,68 @@ export class TradingClient {
718
718
  const ret = wasm.tradingclient_buildSellNativeCurrencyTxFromQuote(this.__wbg_ptr, addHeapObject(quoteResults), ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
719
719
  return takeObject(ret);
720
720
  }
721
+ /**
722
+ * Builds the transaction that unwraps the wrapped-native token back into
723
+ * native currency (for example WETH into ETH) on this client's chain.
724
+ *
725
+ * `withdraw` burns the caller's own wrapped-native balance, so no token
726
+ * approval is required. Submit the returned request with the host wallet.
727
+ *
728
+ * @param amount Amount of the wrapped-native token to unwrap, in wei as a decimal string.
729
+ * @returns A versioned envelope containing the unsigned unwrap transaction request.
730
+ * @throws CowError when the chain is unsupported or the amount is invalid.
731
+ * @param {string} amount
732
+ * @returns {WasmEnvelope<TransactionRequestDto>}
733
+ */
734
+ buildUnwrapTx(amount) {
735
+ try {
736
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
737
+ const ptr0 = passStringToWasm0(amount, wasm.__wbindgen_export, wasm.__wbindgen_export2);
738
+ const len0 = WASM_VECTOR_LEN;
739
+ wasm.tradingclient_buildUnwrapTx(retptr, this.__wbg_ptr, ptr0, len0);
740
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
741
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
742
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
743
+ if (r2) {
744
+ throw takeObject(r1);
745
+ }
746
+ return takeObject(r0);
747
+ } finally {
748
+ wasm.__wbindgen_add_to_stack_pointer(16);
749
+ }
750
+ }
751
+ /**
752
+ * Builds the transaction that wraps native currency into its wrapped-native
753
+ * token (for example ETH into WETH) on this client's chain.
754
+ *
755
+ * The target wrapped-native address is resolved from the chain; submit the
756
+ * returned request with the host wallet. Selling native currency through CoW
757
+ * Protocol does not require a manual wrap — the eth-flow path wraps on-chain
758
+ * during order creation — so use this for standalone wrap and treasury flows.
759
+ *
760
+ * @param amount Amount of native currency to wrap, in wei as a decimal string.
761
+ * @returns A versioned envelope containing the unsigned wrap transaction request.
762
+ * @throws CowError when the chain is unsupported or the amount is invalid.
763
+ * @param {string} amount
764
+ * @returns {WasmEnvelope<TransactionRequestDto>}
765
+ */
766
+ buildWrapTx(amount) {
767
+ try {
768
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
769
+ const ptr0 = passStringToWasm0(amount, wasm.__wbindgen_export, wasm.__wbindgen_export2);
770
+ const len0 = WASM_VECTOR_LEN;
771
+ wasm.tradingclient_buildWrapTx(retptr, this.__wbg_ptr, ptr0, len0);
772
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
773
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
774
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
775
+ if (r2) {
776
+ throw takeObject(r1);
777
+ }
778
+ return takeObject(r0);
779
+ } finally {
780
+ wasm.__wbindgen_add_to_stack_pointer(16);
781
+ }
782
+ }
721
783
  /**
722
784
  * Reads CoW Protocol allowance through a read-only contract callback.
723
785
  *
@@ -1610,6 +1672,35 @@ export function wasmVersion() {
1610
1672
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1611
1673
  }
1612
1674
  }
1675
+
1676
+ /**
1677
+ * Returns wrapped-native token metadata for a chain.
1678
+ *
1679
+ * Use this to recognise a wrap pair in a swap UI — compare a selected token's
1680
+ * address against the returned address — or to display the wrapped-native
1681
+ * token. This is a pure lookup and performs no network I/O.
1682
+ *
1683
+ * @param chainId EVM chain id to resolve.
1684
+ * @returns The wrapped-native token address, symbol, and decimals.
1685
+ * @throws CowError when the chain is not supported.
1686
+ * @param {number} chainId
1687
+ * @returns {WasmEnvelope<WrappedNativeTokenDto>}
1688
+ */
1689
+ export function wrappedNativeToken(chainId) {
1690
+ try {
1691
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1692
+ wasm.wrappedNativeToken(retptr, chainId);
1693
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1694
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1695
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1696
+ if (r2) {
1697
+ throw takeObject(r1);
1698
+ }
1699
+ return takeObject(r0);
1700
+ } finally {
1701
+ wasm.__wbindgen_add_to_stack_pointer(16);
1702
+ }
1703
+ }
1613
1704
  function __wbg_get_imports() {
1614
1705
  const import0 = {
1615
1706
  __proto__: null,
@@ -1706,7 +1797,7 @@ function __wbg_get_imports() {
1706
1797
  __wbg_abort_6e6ea7d259504afc: function(arg0) {
1707
1798
  getObject(arg0).abort();
1708
1799
  },
1709
- __wbg_abort_f619679fd0640f2b: function(arg0) {
1800
+ __wbg_abort_9edc722d54ab72ff: function(arg0) {
1710
1801
  getObject(arg0).abort();
1711
1802
  },
1712
1803
  __wbg_aborted_4d4114700dc4c251: function(arg0) {
@@ -1728,7 +1819,7 @@ function __wbg_get_imports() {
1728
1819
  const ret = clearTimeout(takeObject(arg0));
1729
1820
  return addHeapObject(ret);
1730
1821
  },
1731
- __wbg_clearTimeout_49efa3504516becc: function(arg0) {
1822
+ __wbg_clearTimeout_82be620da651c4df: function(arg0) {
1732
1823
  globalThis.clearTimeout(getObject(arg0));
1733
1824
  },
1734
1825
  __wbg_done_b62d4a7d2286852a: function(arg0) {
@@ -1862,6 +1953,10 @@ function __wbg_get_imports() {
1862
1953
  const ret = new Headers();
1863
1954
  return addHeapObject(ret);
1864
1955
  }, arguments); },
1956
+ __wbg_new_1510932000003026: function() {
1957
+ const ret = new globalThis.AbortController();
1958
+ return addHeapObject(ret);
1959
+ },
1865
1960
  __wbg_new_227d7c05414eb861: function() {
1866
1961
  const ret = new Error();
1867
1962
  return addHeapObject(ret);
@@ -1882,10 +1977,6 @@ function __wbg_get_imports() {
1882
1977
  const ret = new AbortController();
1883
1978
  return addHeapObject(ret);
1884
1979
  }, arguments); },
1885
- __wbg_new_5432766ec31f2ed7: function() {
1886
- const ret = new globalThis.AbortController();
1887
- return addHeapObject(ret);
1888
- },
1889
1980
  __wbg_new_81880fb5002cb255: function(arg0) {
1890
1981
  const ret = new Uint8Array(getObject(arg0));
1891
1982
  return addHeapObject(ret);
@@ -1897,7 +1988,7 @@ function __wbg_get_imports() {
1897
1988
  const a = state0.a;
1898
1989
  state0.a = 0;
1899
1990
  try {
1900
- return __wasm_bindgen_func_elem_6683(a, state0.b, arg0, arg1);
1991
+ return __wasm_bindgen_func_elem_6708(a, state0.b, arg0, arg1);
1901
1992
  } finally {
1902
1993
  state0.a = a;
1903
1994
  }
@@ -1915,7 +2006,7 @@ function __wbg_get_imports() {
1915
2006
  const a = state0.a;
1916
2007
  state0.a = 0;
1917
2008
  try {
1918
- return __wasm_bindgen_func_elem_6683(a, state0.b, arg0, arg1);
2009
+ return __wasm_bindgen_func_elem_6708(a, state0.b, arg0, arg1);
1919
2010
  } finally {
1920
2011
  state0.a = a;
1921
2012
  }
@@ -1979,7 +2070,7 @@ function __wbg_get_imports() {
1979
2070
  const ret = setTimeout(getObject(arg0), arg1);
1980
2071
  return addHeapObject(ret);
1981
2072
  }, arguments); },
1982
- __wbg_setTimeout_76a6e38229b3e5ac: function(arg0, arg1) {
2073
+ __wbg_setTimeout_dec17a70d41e79bd: function(arg0, arg1) {
1983
2074
  const ret = globalThis.setTimeout(getObject(arg0), arg1 >>> 0);
1984
2075
  return addHeapObject(ret);
1985
2076
  },
@@ -2016,7 +2107,7 @@ function __wbg_get_imports() {
2016
2107
  const ret = getObject(arg0).signal;
2017
2108
  return addHeapObject(ret);
2018
2109
  },
2019
- __wbg_signal_b4933a5cf1e85298: function(arg0) {
2110
+ __wbg_signal_c0efe2346fd88fa1: function(arg0) {
2020
2111
  const ret = getObject(arg0).signal;
2021
2112
  return addHeapObject(ret);
2022
2113
  },
@@ -2068,12 +2159,12 @@ function __wbg_get_imports() {
2068
2159
  },
2069
2160
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2070
2161
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 652, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2071
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6674);
2162
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6699);
2072
2163
  return addHeapObject(ret);
2073
2164
  },
2074
2165
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2075
2166
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 644, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2076
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6594);
2167
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_6619);
2077
2168
  return addHeapObject(ret);
2078
2169
  },
2079
2170
  __wbindgen_cast_0000000000000003: function(arg0) {
@@ -2110,14 +2201,14 @@ function __wbg_get_imports() {
2110
2201
  };
2111
2202
  }
2112
2203
 
2113
- function __wasm_bindgen_func_elem_6594(arg0, arg1) {
2114
- wasm.__wasm_bindgen_func_elem_6594(arg0, arg1);
2204
+ function __wasm_bindgen_func_elem_6619(arg0, arg1) {
2205
+ wasm.__wasm_bindgen_func_elem_6619(arg0, arg1);
2115
2206
  }
2116
2207
 
2117
- function __wasm_bindgen_func_elem_6674(arg0, arg1, arg2) {
2208
+ function __wasm_bindgen_func_elem_6699(arg0, arg1, arg2) {
2118
2209
  try {
2119
2210
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2120
- wasm.__wasm_bindgen_func_elem_6674(retptr, arg0, arg1, addHeapObject(arg2));
2211
+ wasm.__wasm_bindgen_func_elem_6699(retptr, arg0, arg1, addHeapObject(arg2));
2121
2212
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2122
2213
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2123
2214
  if (r1) {
@@ -2128,8 +2219,8 @@ function __wasm_bindgen_func_elem_6674(arg0, arg1, arg2) {
2128
2219
  }
2129
2220
  }
2130
2221
 
2131
- function __wasm_bindgen_func_elem_6683(arg0, arg1, arg2, arg3) {
2132
- wasm.__wasm_bindgen_func_elem_6683(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2222
+ function __wasm_bindgen_func_elem_6708(arg0, arg1, arg2, arg3) {
2223
+ wasm.__wasm_bindgen_func_elem_6708(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2133
2224
  }
2134
2225
 
2135
2226
  const IpfsClientFinalization = (typeof FinalizationRegistry === 'undefined')