@reown/walletkit 1.1.2-canary-ca-4 → 1.1.2-canary-ca-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -595,7 +595,7 @@ function logError(f, args) {
595
595
  try {
596
596
  return f.apply(this, args);
597
597
  } catch (e) {
598
- let error = function() {
598
+ const error = function() {
599
599
  try {
600
600
  return e instanceof Error ? `${e.message}
601
601
 
@@ -609,12 +609,11 @@ ${e.stack}` : e.toString();
609
609
  throw e;
610
610
  }
611
611
  }
612
- const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
613
- throw Error("TextDecoder not available");
614
- } };
615
- if (typeof TextDecoder !== "undefined") {
616
- cachedTextDecoder.decode();
617
- }
612
+ const cachedTextDecoder = () => {
613
+ return { decode: (args) => {
614
+ console.error("TextDecoder", args);
615
+ } };
616
+ };
618
617
  function getStringFromWasm0(ptr, len) {
619
618
  ptr = ptr >>> 0;
620
619
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
@@ -696,7 +695,7 @@ function debugString(val) {
696
695
  }
697
696
  if (type == "function") {
698
697
  const name = val.name;
699
- if (typeof name == "string" && name.length > 0) {
698
+ if (typeof name === "string" && name.length > 0) {
700
699
  return `Function(${name})`;
701
700
  } else {
702
701
  return "Function";
@@ -760,23 +759,23 @@ function __wbg_adapter_189(arg0, arg1, arg2, arg3) {
760
759
  }
761
760
  const Currency = Object.freeze({
762
761
  Usd: 0,
763
- "0": "Usd",
762
+ 0: "Usd",
764
763
  Eur: 1,
765
- "1": "Eur",
764
+ 1: "Eur",
766
765
  Gbp: 2,
767
- "2": "Gbp",
766
+ 2: "Gbp",
768
767
  Aud: 3,
769
- "3": "Aud",
768
+ 3: "Aud",
770
769
  Cad: 4,
771
- "4": "Cad",
770
+ 4: "Cad",
772
771
  Inr: 5,
773
- "5": "Inr",
772
+ 5: "Inr",
774
773
  Jpy: 6,
775
- "6": "Jpy",
774
+ 6: "Jpy",
776
775
  Btc: 7,
777
- "7": "Btc",
776
+ 7: "Btc",
778
777
  Eth: 8,
779
- "8": "Eth"
778
+ 8: "Eth"
780
779
  });
781
780
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
782
781
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
@@ -1179,7 +1178,7 @@ function __wbg_get_imports() {
1179
1178
  return logError(function(arg0, arg1) {
1180
1179
  try {
1181
1180
  var state0 = { a: arg0, b: arg1 };
1182
- var cb0 = (arg02, arg12) => {
1181
+ const cb0 = (arg02, arg12) => {
1183
1182
  const a = state0.a;
1184
1183
  state0.a = 0;
1185
1184
  try {
@@ -1209,7 +1208,7 @@ function __wbg_get_imports() {
1209
1208
  };
1210
1209
  imports.wbg.__wbg_new_78feb108b6472713 = function() {
1211
1210
  return logError(function() {
1212
- const ret = new Array();
1211
+ const ret = [];
1213
1212
  return ret;
1214
1213
  }, arguments);
1215
1214
  };
@@ -1553,8 +1552,8 @@ function __wbg_get_imports() {
1553
1552
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1554
1553
  const obj = arg1;
1555
1554
  const ret = typeof obj === "string" ? obj : void 0;
1556
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1557
- var len1 = WASM_VECTOR_LEN;
1555
+ const ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1556
+ const len1 = WASM_VECTOR_LEN;
1558
1557
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1559
1558
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1560
1559
  };
@@ -3807,6 +3806,43 @@ class ChainAbstraction extends IChainAbstraction {
3807
3806
  }
3808
3807
  };
3809
3808
  }
3809
+ } else {
3810
+ if ("error" in result) {
3811
+ switch (result.error) {
3812
+ case "insufficientFunds":
3813
+ throw new Error("INSUFFICIENT_FUNDS");
3814
+ case "noRoutesAvailable":
3815
+ throw new Error("NO_ROUTES_AVAILABLE");
3816
+ case "insufficientGasFunds":
3817
+ throw new Error("INSUFFICIENT_GAS_FUNDS");
3818
+ }
3819
+ }
3820
+ if ("orchestrationId" in result) {
3821
+ routes = {
3822
+ success: {
3823
+ available: {
3824
+ route: result.route,
3825
+ localRouteTotal: result.localRouteTotal,
3826
+ bridge: result.bridge,
3827
+ localBridgeTotal: result.localBridgeTotal,
3828
+ routeResponse: {
3829
+ initialTransaction: result.initialTransaction,
3830
+ orchestrationId: result.orchestrationId,
3831
+ transactions: result.transactions,
3832
+ metadata: result.metadata
3833
+ },
3834
+ initial: result.initial,
3835
+ localTotal: result.localTotal
3836
+ }
3837
+ }
3838
+ };
3839
+ } else {
3840
+ routes = {
3841
+ success: {
3842
+ notRequired: result
3843
+ }
3844
+ };
3845
+ }
3810
3846
  }
3811
3847
  if ("success" in routes && "available" in routes.success) {
3812
3848
  const orchestrationId = routes.success.available.routeResponse.orchestrationId;