@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
package/README.md
CHANGED
|
@@ -34,12 +34,14 @@ Every route is fail-closed until its allowlists and validators are configured:
|
|
|
34
34
|
wallets, pTON wallet ownership and DeDust pool pairs on chain.
|
|
35
35
|
`tonSwapPayloadCheck: "report"` traces `ton-swap-payload <reason>` instead
|
|
36
36
|
of refusing (default `"enforce"`).
|
|
37
|
-
Behind `remoteProvider`, the app checks the built
|
|
38
|
-
`remoteProvider({name: "omniston", baseUrl, verifyBuild: omnistonVerifyBuild({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
validators
|
|
42
|
-
|
|
37
|
+
Behind `remoteProvider`, the app checks the built body itself:
|
|
38
|
+
`remoteProvider({name: "omniston", baseUrl, verifyBuild: omnistonVerifyBuild({...createOmnistonTonValidators()})})`.
|
|
39
|
+
A TON → TON swap body is opened with `checkTonSwapPayload` against the app's own request (receiver,
|
|
40
|
+
refund, on-chain minimum, input; the quote carries `routeSteps`) and the DEX it pays is confirmed with
|
|
41
|
+
the app's validators. A TON → EVM escrow body goes to `verifyTonEscrowBuild`: the jetton amount, the
|
|
42
|
+
trader as owner, the destination chain, address and token and the quote's minimum delivery come from
|
|
43
|
+
the app, the protocol contract from `trustedProtocolAddresses`, and the escrow code, authority key and
|
|
44
|
+
timelocks are the audited ones. Without `verifyBuild` the engine refuses remote cell bodies.
|
|
43
45
|
- **TON → EVM** (HTLC order, the wallet pays a jetton escrow): factory
|
|
44
46
|
allowlisted on both chains, `validateTonJettonWallet`,
|
|
45
47
|
`validateTonEscrowPayload`, `validateEvmOutputPosition`.
|
|
@@ -1112,7 +1112,27 @@ function omnistonVerifyBuild(hooks) {
|
|
|
1112
1112
|
return async (quote, tx, params) => {
|
|
1113
1113
|
if (tx.bodyBoc === void 0) return null;
|
|
1114
1114
|
if (!params) return "the request this quote answered is unknown";
|
|
1115
|
-
if (quote.providerData?.settlement !== "swap")
|
|
1115
|
+
if (quote.providerData?.settlement !== "swap") {
|
|
1116
|
+
if (params.sourceChain.startsWith("ton:") && params.destChain.startsWith("eip155:")) {
|
|
1117
|
+
if (!hooks.verifyTonEscrowBuild) return "a TON \u2192 EVM escrow body needs verifyTonEscrowBuild (createOmnistonTonValidators)";
|
|
1118
|
+
if (!params.refundAddress) return "the trader's TON address (refundAddress) is unknown";
|
|
1119
|
+
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);
|
|
1120
|
+
try {
|
|
1121
|
+
return await hooks.verifyTonEscrowBuild({
|
|
1122
|
+
payloadBocHex: Buffer2.from(tx.bodyBoc, "base64").toString("hex"),
|
|
1123
|
+
ownerAddress: params.refundAddress,
|
|
1124
|
+
inputUnits: quote.sourceAmount,
|
|
1125
|
+
destinationChain: params.destChain,
|
|
1126
|
+
destinationAddress: params.destAddress,
|
|
1127
|
+
outputTokenAddress: params.destToken,
|
|
1128
|
+
minResolverSendsUnits: floor.toString()
|
|
1129
|
+
});
|
|
1130
|
+
} catch {
|
|
1131
|
+
return "the escrow body could not be checked";
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return "only TON swap and TON \u2192 EVM escrow bodies can be checked on the client";
|
|
1135
|
+
}
|
|
1116
1136
|
let steps;
|
|
1117
1137
|
try {
|
|
1118
1138
|
steps = JSON.parse(quote.providerData.routeSteps ?? "");
|
|
@@ -2253,4 +2273,4 @@ export {
|
|
|
2253
2273
|
omnistonVerifyBuild,
|
|
2254
2274
|
omnistonProvider
|
|
2255
2275
|
};
|
|
2256
|
-
//# sourceMappingURL=chunk-
|
|
2276
|
+
//# sourceMappingURL=chunk-HOTFZYSW.js.map
|