@use-glyph/sdk-react 2.0.12 → 2.0.13
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/glyph-widget.umd.js +28 -28
- package/dist/glyph-widget.umd.js.map +1 -1
- package/dist/index.js +26 -11
- package/dist/index.js.map +1 -1
- package/dist/types/hooks/useRelayExecute.d.ts +1 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33521,6 +33521,8 @@ const uR = (e) => {
|
|
|
33521
33521
|
l(f.transaction.hash);
|
|
33522
33522
|
}
|
|
33523
33523
|
});
|
|
33524
|
+
if (h.status === "reverted")
|
|
33525
|
+
throw new Error("Execution reverted");
|
|
33524
33526
|
return console.debug(!!h.transactionHash), h;
|
|
33525
33527
|
},
|
|
33526
33528
|
switchChain: async (o) => {
|
|
@@ -33542,23 +33544,36 @@ const uR = (e) => {
|
|
|
33542
33544
|
throw Wn(jr, Nt.NO_GLYPHAPIFETCH);
|
|
33543
33545
|
let l = null;
|
|
33544
33546
|
try {
|
|
33545
|
-
const
|
|
33547
|
+
const b = await t("/api/widget/swap/quote", {
|
|
33546
33548
|
method: "POST",
|
|
33547
33549
|
body: JSON.stringify({ ...s.request?.data })
|
|
33548
33550
|
});
|
|
33549
|
-
if (!
|
|
33550
|
-
i && i !== e && (console.log("Switching chain from", e, "to", i), await a.switchChain(i)), l = await
|
|
33551
|
-
} catch (
|
|
33552
|
-
throw console.error(
|
|
33551
|
+
if (!b.ok) throw { code: jr, message: Nt.NO_FINAL_QUOTE };
|
|
33552
|
+
i && i !== e && (console.log("Switching chain from", e, "to", i), await a.switchChain(i)), l = await b.json();
|
|
33553
|
+
} catch (b) {
|
|
33554
|
+
throw console.error(b), Wn(jr, Nt.NO_FINAL_QUOTE);
|
|
33553
33555
|
}
|
|
33554
33556
|
const { id: u, quote: p } = l;
|
|
33555
33557
|
o?.(p);
|
|
33556
|
-
|
|
33557
|
-
|
|
33558
|
-
|
|
33559
|
-
|
|
33560
|
-
|
|
33561
|
-
|
|
33558
|
+
let d;
|
|
33559
|
+
try {
|
|
33560
|
+
d = await ut.actions.execute({
|
|
33561
|
+
quote: p,
|
|
33562
|
+
wallet: a
|
|
33563
|
+
});
|
|
33564
|
+
} catch (b) {
|
|
33565
|
+
throw console.debug("error while executing", b), await r(u), b;
|
|
33566
|
+
}
|
|
33567
|
+
const h = d?.status ?? d?.state, f = d?.error ?? d?.reason ?? d?.message, y = /* @__PURE__ */ new Set(["error", "failed", "failure", "reverted"]);
|
|
33568
|
+
if (y.has(String(h).toLowerCase()) || d?.ok === !1)
|
|
33569
|
+
throw console.debug(
|
|
33570
|
+
"failedStatuses",
|
|
33571
|
+
y,
|
|
33572
|
+
"resultStatus",
|
|
33573
|
+
h,
|
|
33574
|
+
"resultError",
|
|
33575
|
+
f
|
|
33576
|
+
), await r(u), new Error(typeof f == "string" ? f : "Relay execution failed");
|
|
33562
33577
|
return { requestId: p?.steps?.[0]?.requestId, txnId: u, result: d };
|
|
33563
33578
|
}
|
|
33564
33579
|
});
|