@anywalletkit/protocol-swap2-omniston 0.2.2 → 0.2.4
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 +11 -0
- package/dist/{chunk-W3AXGSX3.js → chunk-3CGSN2T6.js} +6 -5
- package/dist/chunk-3CGSN2T6.js.map +1 -0
- package/dist/{chunk-K2KBWGNL.js → chunk-FMMBUGYB.js} +2 -2
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/protocol.cjs +5 -4
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +5 -4
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/validators.cjs +36 -34
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.js +6 -4
- package/dist/validators.js.map +1 -1
- package/package.json +10 -7
- package/dist/chunk-W3AXGSX3.js.map +0 -1
- /package/dist/{chunk-K2KBWGNL.js.map → chunk-FMMBUGYB.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
# @anywalletkit/protocol-swap2-omniston
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@anywalletkit/protocol-swap2-omniston)
|
|
4
|
+
|
|
3
5
|
STON.fi Omniston as a swap2 module: TON ↔ TON swaps settled on the STON.fi DEX,
|
|
4
6
|
and TON ↔ EVM and EVM ↔ EVM stable orders settled through HTLC escrows
|
|
5
7
|
(resolver Arbiter), over the Omniston WebSocket RFQ. Standalone through
|
|
6
8
|
`OmnistonSwap2Protocol`, or as one provider of the router.
|
|
7
9
|
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @anywalletkit/protocol-swap2-omniston @anywalletkit/core
|
|
14
|
+
# or: pnpm add @anywalletkit/protocol-swap2-omniston @anywalletkit/core · yarn add @anywalletkit/protocol-swap2-omniston @anywalletkit/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
On npm: [@anywalletkit/protocol-swap2-omniston](https://www.npmjs.com/package/@anywalletkit/protocol-swap2-omniston), published from the [release workflow](https://github.com/ultratestbro/anywalletkit/blob/main/RELEASING.md) with provenance.
|
|
18
|
+
|
|
8
19
|
EVM chains: Ethereum, BNB, Polygon, X Layer, HyperEVM, Robinhood, Base, Plasma,
|
|
9
20
|
Arbitrum, Avalanche. ARC (in Omniston's matrix) waits for the asset catalog;
|
|
10
21
|
TRON needs its own order path and is not wired yet.
|
|
@@ -313,6 +313,7 @@ function sameJetton(a, b) {
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
// src/provider.ts
|
|
316
|
+
import { bigintToNumber } from "@anywalletkit/core";
|
|
316
317
|
var EVM_CASE = {
|
|
317
318
|
1: "ethereum",
|
|
318
319
|
56: "bnb",
|
|
@@ -558,7 +559,7 @@ async function validateEvmToTonOrderExtension(extension, expected) {
|
|
|
558
559
|
cursor += 3;
|
|
559
560
|
const initialRateBump = readBigEndian(getter, cursor, 3);
|
|
560
561
|
cursor += 3;
|
|
561
|
-
const pointCount =
|
|
562
|
+
const pointCount = bigintToNumber(readBigEndian(getter, cursor, 1));
|
|
562
563
|
cursor += 1;
|
|
563
564
|
if (pointCount !== 5) throw new Error("omniston: unsupported EVM auction profile");
|
|
564
565
|
const points = [];
|
|
@@ -574,7 +575,7 @@ async function validateEvmToTonOrderExtension(extension, expected) {
|
|
|
574
575
|
cursor += 2;
|
|
575
576
|
const whitelistDiscount = readBigEndian(getter, cursor, 1);
|
|
576
577
|
cursor += 1;
|
|
577
|
-
const getterWhitelistCount =
|
|
578
|
+
const getterWhitelistCount = bigintToNumber(readBigEndian(getter, cursor, 1));
|
|
578
579
|
cursor += 1;
|
|
579
580
|
if (getterWhitelistCount !== 1 || cursor + getterWhitelistCount * 10 !== getter.length) {
|
|
580
581
|
throw new Error("omniston: malformed EVM amount-getter whitelist");
|
|
@@ -602,7 +603,7 @@ async function validateEvmToTonOrderExtension(extension, expected) {
|
|
|
602
603
|
cursor += 1;
|
|
603
604
|
const allowedTime = readBigEndian(post, cursor, 4);
|
|
604
605
|
cursor += 4;
|
|
605
|
-
const whitelistCount =
|
|
606
|
+
const whitelistCount = bigintToNumber(readBigEndian(post, cursor, 1));
|
|
606
607
|
cursor += 1;
|
|
607
608
|
if (whitelistCount !== 1 || cursor + whitelistCount * 12 + 160 !== post.length) {
|
|
608
609
|
throw new Error("omniston: malformed EVM post-interaction whitelist");
|
|
@@ -1364,7 +1365,7 @@ function omnistonProvider(opts = {}) {
|
|
|
1364
1365
|
const out = BigInt(q.outputUnits);
|
|
1365
1366
|
const floor = requiredMin(q.outputUnits);
|
|
1366
1367
|
if (out < floor) return null;
|
|
1367
|
-
const tightened =
|
|
1368
|
+
const tightened = bigintToNumber((out - floor) * 1000000n / out);
|
|
1368
1369
|
const again = await rfq(Math.max(0, Math.min(tightened, slippagePips)));
|
|
1369
1370
|
const againSwap = again?.settlementData.$case === "swap" ? again.settlementData.value : null;
|
|
1370
1371
|
if (!again || !againSwap) return null;
|
|
@@ -2145,4 +2146,4 @@ export {
|
|
|
2145
2146
|
validateEvmToTonOrderExtension,
|
|
2146
2147
|
omnistonProvider
|
|
2147
2148
|
};
|
|
2148
|
-
//# sourceMappingURL=chunk-
|
|
2149
|
+
//# sourceMappingURL=chunk-3CGSN2T6.js.map
|