@anywalletkit/protocol-swap2-omniston 0.5.4 → 0.5.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/README.md +72 -4
- package/dist/activity.cjs +4 -1
- package/dist/activity.cjs.map +1 -1
- package/dist/activity.d.cts +7 -1
- package/dist/activity.d.ts +7 -1
- package/dist/activity.js +1 -1
- package/dist/{chunk-AIWAM7BS.js → chunk-ENAEOF7N.js} +5 -2
- package/dist/chunk-ENAEOF7N.js.map +1 -0
- package/dist/{chunk-4JOTKQOT.js → chunk-FDSTD34Z.js} +10 -3
- package/dist/{chunk-4JOTKQOT.js.map → chunk-FDSTD34Z.js.map} +1 -1
- package/dist/chunk-IDRZHWWL.js +74 -0
- package/dist/chunk-IDRZHWWL.js.map +1 -0
- package/dist/{chunk-2E6CVWD6.js → chunk-IX4NF2J7.js} +2 -2
- package/dist/index.cjs +49 -2
- 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 +4 -4
- package/dist/protocol.cjs +11 -1
- 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 +4 -4
- package/dist/{provider-CcCZB-Cj.d.cts → provider-BQzNkVvW.d.cts} +18 -2
- package/dist/{provider-CcCZB-Cj.d.ts → provider-BQzNkVvW.d.ts} +18 -2
- package/dist/provider.cjs +49 -2
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +3 -3
- package/dist/validators.cjs +56 -3
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.d.cts +1 -1
- package/dist/validators.d.ts +1 -1
- package/dist/validators.js +19 -3
- package/dist/validators.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-AIWAM7BS.js.map +0 -1
- package/dist/chunk-JWYDIW4V.js +0 -37
- package/dist/chunk-JWYDIW4V.js.map +0 -1
- /package/dist/{chunk-2E6CVWD6.js.map → chunk-IX4NF2J7.js.map} +0 -0
package/dist/protocol.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _anywalletkit_protocol_swap2_core_types from '@anywalletkit/protocol-swap2-core/types';
|
|
2
2
|
import { SingleProviderSwap2 } from '@anywalletkit/protocol-swap2-core/swap2/single';
|
|
3
3
|
import { Swap2EngineConfig, Swap2Account } from '@anywalletkit/protocol-swap2-core/swap2/base';
|
|
4
|
-
import { b as OmnistonProviderOptions } from './provider-
|
|
4
|
+
import { b as OmnistonProviderOptions } from './provider-BQzNkVvW.cjs';
|
|
5
5
|
|
|
6
6
|
interface OmnistonSwap2Config extends Swap2EngineConfig, OmnistonProviderOptions {
|
|
7
7
|
}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _anywalletkit_protocol_swap2_core_types from '@anywalletkit/protocol-swap2-core/types';
|
|
2
2
|
import { SingleProviderSwap2 } from '@anywalletkit/protocol-swap2-core/swap2/single';
|
|
3
3
|
import { Swap2EngineConfig, Swap2Account } from '@anywalletkit/protocol-swap2-core/swap2/base';
|
|
4
|
-
import { b as OmnistonProviderOptions } from './provider-
|
|
4
|
+
import { b as OmnistonProviderOptions } from './provider-BQzNkVvW.js';
|
|
5
5
|
|
|
6
6
|
interface OmnistonSwap2Config extends Swap2EngineConfig, OmnistonProviderOptions {
|
|
7
7
|
}
|
package/dist/protocol.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OmnistonSwap2Protocol
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IX4NF2J7.js";
|
|
4
|
+
import "./chunk-FDSTD34Z.js";
|
|
5
5
|
import "./chunk-QDXFC6BC.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ENAEOF7N.js";
|
|
7
|
+
import "./chunk-IDRZHWWL.js";
|
|
8
8
|
export {
|
|
9
9
|
OmnistonSwap2Protocol
|
|
10
10
|
};
|
|
@@ -14,8 +14,24 @@ declare const DEFAULT_OMNISTON_TON_CODE_HASHES: {
|
|
|
14
14
|
readonly authorityKeys: readonly ["ed210da12aa96ea42de4f2f61dc172bbaa3da86051a1b2a6f342f69a777d2770"];
|
|
15
15
|
/** EVM→TON output position: the contract the factory deploys for the
|
|
16
16
|
* resolver's jetton lock (observed on every resolver-created position,
|
|
17
|
-
* 2026-10-15/16), and the escrow code cell it carries in its state.
|
|
18
|
-
|
|
17
|
+
* 2026-10-15/16), and the escrow code cell it carries in its state.
|
|
18
|
+
* A position counts only when a trusted factory itself sent its deploy
|
|
19
|
+
* message, and a minter deploys only the position code stored in its own
|
|
20
|
+
* data, so this list follows the trusted minters in
|
|
21
|
+
* AUDITED_OMNISTON_SETTLEMENT_CONTRACTS["ton:-239"]:
|
|
22
|
+
* - eb503578…: positions of the rev2 Escrow Minter EQDybO88… (the position
|
|
23
|
+
* code stored in its data; reviewed 2026-11-12). The diff to rev1's
|
|
24
|
+
* e4d5115a… is 13 sub-VM calls in another mode (RUNVMX 20 -> 276) and 2
|
|
25
|
+
* escrow-code whitelist checks. The state layout is the same, and live
|
|
26
|
+
* and settled rev2 positions pass every check of
|
|
27
|
+
* validateTonOutputPosition.
|
|
28
|
+
* - e4d5115a… (positions of the rev1 minter EQAbWJ3Y…) left the default
|
|
29
|
+
* with rev1 on 2026-11-12. Only an EVM -> TON order quoted on rev1 less
|
|
30
|
+
* than 6 h before an app upgrades can still need it (positionCodeHashes
|
|
31
|
+
* with both codes, until those 6 h are over). That pin alone trusts no
|
|
32
|
+
* new order: a new quote must name a trusted minter, and a position
|
|
33
|
+
* counts only when the minter its quote named deployed it. */
|
|
34
|
+
readonly position: readonly ["eb503578b4d9cd791c9c0ecd0da6da4064aae2bcb19d3c924d4001c493386bc5"];
|
|
19
35
|
readonly outputEscrow: readonly ["d30423575384773abaad8d3c6f763898afa3d57a5693005904b7c61e95cee630"];
|
|
20
36
|
};
|
|
21
37
|
/** Upper bound on the exclusivity window the escrow config may carry. It is
|
|
@@ -14,8 +14,24 @@ declare const DEFAULT_OMNISTON_TON_CODE_HASHES: {
|
|
|
14
14
|
readonly authorityKeys: readonly ["ed210da12aa96ea42de4f2f61dc172bbaa3da86051a1b2a6f342f69a777d2770"];
|
|
15
15
|
/** EVM→TON output position: the contract the factory deploys for the
|
|
16
16
|
* resolver's jetton lock (observed on every resolver-created position,
|
|
17
|
-
* 2026-10-15/16), and the escrow code cell it carries in its state.
|
|
18
|
-
|
|
17
|
+
* 2026-10-15/16), and the escrow code cell it carries in its state.
|
|
18
|
+
* A position counts only when a trusted factory itself sent its deploy
|
|
19
|
+
* message, and a minter deploys only the position code stored in its own
|
|
20
|
+
* data, so this list follows the trusted minters in
|
|
21
|
+
* AUDITED_OMNISTON_SETTLEMENT_CONTRACTS["ton:-239"]:
|
|
22
|
+
* - eb503578…: positions of the rev2 Escrow Minter EQDybO88… (the position
|
|
23
|
+
* code stored in its data; reviewed 2026-11-12). The diff to rev1's
|
|
24
|
+
* e4d5115a… is 13 sub-VM calls in another mode (RUNVMX 20 -> 276) and 2
|
|
25
|
+
* escrow-code whitelist checks. The state layout is the same, and live
|
|
26
|
+
* and settled rev2 positions pass every check of
|
|
27
|
+
* validateTonOutputPosition.
|
|
28
|
+
* - e4d5115a… (positions of the rev1 minter EQAbWJ3Y…) left the default
|
|
29
|
+
* with rev1 on 2026-11-12. Only an EVM -> TON order quoted on rev1 less
|
|
30
|
+
* than 6 h before an app upgrades can still need it (positionCodeHashes
|
|
31
|
+
* with both codes, until those 6 h are over). That pin alone trusts no
|
|
32
|
+
* new order: a new quote must name a trusted minter, and a position
|
|
33
|
+
* counts only when the minter its quote named deployed it. */
|
|
34
|
+
readonly position: readonly ["eb503578b4d9cd791c9c0ecd0da6da4064aae2bcb19d3c924d4001c493386bc5"];
|
|
19
35
|
readonly outputEscrow: readonly ["d30423575384773abaad8d3c6f763898afa3d57a5693005904b7c61e95cee630"];
|
|
20
36
|
};
|
|
21
37
|
/** Upper bound on the exclusivity window the escrow config may carry. It is
|
package/dist/provider.cjs
CHANGED
|
@@ -53,7 +53,10 @@ var STONFI_ROUTERS = [
|
|
|
53
53
|
"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3",
|
|
54
54
|
"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt"
|
|
55
55
|
];
|
|
56
|
-
var OMNISTON_ESCROWS = [
|
|
56
|
+
var OMNISTON_ESCROWS = [
|
|
57
|
+
"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ",
|
|
58
|
+
"EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA"
|
|
59
|
+
];
|
|
57
60
|
function raw(address) {
|
|
58
61
|
if (!address) return null;
|
|
59
62
|
try {
|
|
@@ -431,7 +434,44 @@ function sameJetton(a, b) {
|
|
|
431
434
|
|
|
432
435
|
// src/validators/settlement.ts
|
|
433
436
|
var AUDITED_OMNISTON_SETTLEMENT_CONTRACTS = {
|
|
434
|
-
|
|
437
|
+
// The TON Escrow Minter a new TON <-> EVM order may name. The provider
|
|
438
|
+
// compares TON addresses as these exact strings, so it is kept in the form
|
|
439
|
+
// Omniston's quotes use.
|
|
440
|
+
// - EQDybO88… (code 9737943f…, "rev2"): Omniston's TON <-> EVM quotes name it
|
|
441
|
+
// since 2026-11-10 ~19:00Z. Reviewed 2026-11-12, read-only:
|
|
442
|
+
// - Deploy tx fkabfHcN8DcrqQyazmlB+UprljBDeEkvFlgaVOi905g=
|
|
443
|
+
// (2026-11-10 18:47:06Z). Code and data still equal that StateInit:
|
|
444
|
+
// no upgrade since, none pending (no pendingCode, upgradeAfter 0).
|
|
445
|
+
// - Same admin (0:408fff62…) as rev1; it is also the admin_address of the
|
|
446
|
+
// STON.fi DEX v2 routers api.ston.fi lists. Deployed from the same
|
|
447
|
+
// wallet as rev1 (a weak signal on TON: anyone can send a StateInit).
|
|
448
|
+
// - The bytecode diff to rev1: escrow / execution code must be in an
|
|
449
|
+
// embedded whitelist (9e77…, f6ed…, d304…, pinned in ton.ts, plus 9fe4…
|
|
450
|
+
// for TON <-> TON, which the SDK does not pin), the escrow sub-VM must
|
|
451
|
+
// return one value, and a failed position deploy now credits the amount
|
|
452
|
+
// back to the same account contract instead of aborting (the only new
|
|
453
|
+
// path that moves value; no real message has used it). Fees, timelocks,
|
|
454
|
+
// payouts, admin and the 7-day upgrade delay are unchanged. Replayed
|
|
455
|
+
// through both codes, the real traffic of both minters (~42k
|
|
456
|
+
// transactions) and of ~1,070 of their positions gave the same outputs.
|
|
457
|
+
// - It deploys positions with code eb503578…, the only code in
|
|
458
|
+
// DEFAULT_OMNISTON_TON_CODE_HASHES.position. The address and that pin
|
|
459
|
+
// go together: without the pin every EVM -> TON order on this minter
|
|
460
|
+
// fills and then fails the disclosure check.
|
|
461
|
+
// - EQAbWJ3Y… (code f91c43d3…, "rev1", deployed 2026-06-09) is no longer
|
|
462
|
+
// trusted by default (2026-11-12). Omniston's quotes moved to rev2 on
|
|
463
|
+
// 2026-11-10 (rev1 still took a few orders on 2026-11-12), and rev1 lacks the escrow-code whitelist rev2 added: on
|
|
464
|
+
// rev1 only the SDK's own pins check the escrow and execution code an
|
|
465
|
+
// order carries. A quote that names rev1 is refused with its address
|
|
466
|
+
// in the reason, and so is building one cached under an older table; its positions (code e4d5115a…) fail
|
|
467
|
+
// position-code-hash. It stays in OMNISTON_ESCROWS (activity.ts), which
|
|
468
|
+
// recognizes history and grants no trust. Old orders need nothing from
|
|
469
|
+
// this table: trackIntent reads no trust table, and every disclosure
|
|
470
|
+
// check refuses a quote older than 6 h, so a rev1 order quoted before
|
|
471
|
+
// the switch cannot be closed by any version. Listing rev1 here or in
|
|
472
|
+
// trustedProtocolAddresses trusts it again for NEW orders; it does not
|
|
473
|
+
// help close an old one.
|
|
474
|
+
"ton:-239": ["EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA"],
|
|
435
475
|
"eip155:1": ["0xafCF681272AF10959736f45616eeCBC22D7095E2"],
|
|
436
476
|
"eip155:56": ["0xafCF681272AF10959736f45616eeCBC22D7095E2"],
|
|
437
477
|
"eip155:137": ["0x41A392062A4307a6961d48e30FF20bF6823715B8"],
|
|
@@ -1998,6 +2038,9 @@ function omnistonProvider(opts = {}) {
|
|
|
1998
2038
|
const inputToken = assetContract(q.inputAsset);
|
|
1999
2039
|
const outputToken = assetContract(q.outputAsset);
|
|
2000
2040
|
const destChainId = tonDest ? null : evmRef2(destChain);
|
|
2041
|
+
if (factory?.chain.$case === destCase && !isTrusted(destChain, factory.chain.value)) {
|
|
2042
|
+
throw new Error(`omniston: untrusted ${destChain} settlement contract ${factory.chain.value}`);
|
|
2043
|
+
}
|
|
2001
2044
|
if (protocol.chain.$case !== srcCase || !isTrustedOrderProtocol(srcChain, protocol.chain.value) || resolver?.chain.$case !== srcCase || !validEvmAddress(resolver.chain.value) || factory?.chain.$case !== destCase || !isTrusted(destChain, factory.chain.value) || !inputToken || !outputToken || !Number.isSafeInteger(settlement.protocolFeePips) || !tonDest && (destChainId === null || !validEvmAddress(outputToken) || !isPositiveInteger(settlement.dstSecurityDepositUnits ?? ""))) throw new Error("omniston: incomplete EVM order settlement binding in quote");
|
|
2002
2045
|
const { secrets, created } = await secretsFor(ref, q, 1);
|
|
2003
2046
|
const hashes = secrets.map((secret) => hashlock(secret, settlement.htlcHashingFunction));
|
|
@@ -2242,6 +2285,10 @@ function omnistonProvider(opts = {}) {
|
|
|
2242
2285
|
const destCase = q.outputAsset.chain.$case;
|
|
2243
2286
|
const traderDst = destCase === "ton" ? null : { chain: { $case: destCase, value: (0, import_viem.getAddress)(ref.dest) } };
|
|
2244
2287
|
if (!traderDst) throw new Error("omniston: TON-destination orders are not supported");
|
|
2288
|
+
const minter = q.settlementData.value.srcProtocolContractAddress;
|
|
2289
|
+
if (minter.chain.$case !== "ton" || !isTrusted(srcChain, minter.chain.value)) {
|
|
2290
|
+
throw new Error(`omniston: untrusted TON settlement contract ${minter.chain.value}`);
|
|
2291
|
+
}
|
|
2245
2292
|
const settlement = q.settlementData;
|
|
2246
2293
|
const hashingFunction = settlement.$case === "order" ? settlement.value.htlcHashingFunction : void 0;
|
|
2247
2294
|
const { secrets, created } = await secretsFor(ref, q, maxExecutions);
|