@anywalletkit/protocol-swap2-omniston 0.3.0 → 0.3.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.
- package/README.md +8 -6
- package/dist/{chunk-JVFDD7PV.js → chunk-HOTFZYSW.js} +22 -2
- package/dist/chunk-HOTFZYSW.js.map +1 -0
- package/dist/{chunk-CRYYP6X3.js → chunk-RW4XZWNC.js} +2 -2
- package/dist/index.cjs +21 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider-BBG2zhpu.d.cts +772 -0
- package/dist/provider-BBG2zhpu.d.ts +772 -0
- package/dist/provider.cjs +21 -1
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +2 -652
- package/dist/provider.d.ts +2 -652
- package/dist/provider.js +1 -1
- package/dist/validators.cjs +144 -32
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.d.cts +2 -93
- package/dist/validators.d.ts +2 -93
- package/dist/validators.js +144 -32
- package/dist/validators.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-JVFDD7PV.js.map +0 -1
- /package/dist/{chunk-CRYYP6X3.js.map → chunk-RW4XZWNC.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
omnistonProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HOTFZYSW.js";
|
|
4
4
|
import {
|
|
5
5
|
omniston
|
|
6
6
|
} from "./chunk-QDXFC6BC.js";
|
|
@@ -24,4 +24,4 @@ var OmnistonSwap2Protocol = class extends SingleProviderSwap2 {
|
|
|
24
24
|
export {
|
|
25
25
|
OmnistonSwap2Protocol
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-RW4XZWNC.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1238,7 +1238,27 @@ function omnistonVerifyBuild(hooks) {
|
|
|
1238
1238
|
return async (quote, tx, params) => {
|
|
1239
1239
|
if (tx.bodyBoc === void 0) return null;
|
|
1240
1240
|
if (!params) return "the request this quote answered is unknown";
|
|
1241
|
-
if (quote.providerData?.settlement !== "swap")
|
|
1241
|
+
if (quote.providerData?.settlement !== "swap") {
|
|
1242
|
+
if (params.sourceChain.startsWith("ton:") && params.destChain.startsWith("eip155:")) {
|
|
1243
|
+
if (!hooks.verifyTonEscrowBuild) return "a TON \u2192 EVM escrow body needs verifyTonEscrowBuild (createOmnistonTonValidators)";
|
|
1244
|
+
if (!params.refundAddress) return "the trader's TON address (refundAddress) is unknown";
|
|
1245
|
+
const floor = [quote.minDestAmount, params.minAmountOut ?? "0"].filter((v) => /^\d{1,80}$/.test(v)).map((v) => BigInt(v)).reduce((a, b) => a > b ? a : b, 0n);
|
|
1246
|
+
try {
|
|
1247
|
+
return await hooks.verifyTonEscrowBuild({
|
|
1248
|
+
payloadBocHex: import_buffer2.Buffer.from(tx.bodyBoc, "base64").toString("hex"),
|
|
1249
|
+
ownerAddress: params.refundAddress,
|
|
1250
|
+
inputUnits: quote.sourceAmount,
|
|
1251
|
+
destinationChain: params.destChain,
|
|
1252
|
+
destinationAddress: params.destAddress,
|
|
1253
|
+
outputTokenAddress: params.destToken,
|
|
1254
|
+
minResolverSendsUnits: floor.toString()
|
|
1255
|
+
});
|
|
1256
|
+
} catch {
|
|
1257
|
+
return "the escrow body could not be checked";
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return "only TON swap and TON \u2192 EVM escrow bodies can be checked on the client";
|
|
1261
|
+
}
|
|
1242
1262
|
let steps;
|
|
1243
1263
|
try {
|
|
1244
1264
|
steps = JSON.parse(quote.providerData.routeSteps ?? "");
|