@anywalletkit/protocol-swap2-omniston 0.5.3 → 0.5.5
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 +125 -12
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.d.cts +41 -4
- package/dist/validators.d.ts +41 -4
- package/dist/validators.js +88 -12
- package/dist/validators.js.map +1 -1
- package/package.json +6 -6
- 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/README.md
CHANGED
|
@@ -117,6 +117,68 @@ resolver's calldata AND to derive, through the trusted factory's
|
|
|
117
117
|
escrow address the factory announced; a decoy tuple or hidden immutables fail
|
|
118
118
|
closed.
|
|
119
119
|
|
|
120
|
+
### Trusted TON contracts
|
|
121
|
+
|
|
122
|
+
TON ↔ EVM orders settle through Omniston's TON Escrow Minter. The audited
|
|
123
|
+
table (`AUDITED_OMNISTON_SETTLEMENT_CONTRACTS["ton:-239"]`) and the position
|
|
124
|
+
pin (`DEFAULT_OMNISTON_TON_CODE_HASHES.position`) trust rev2 only:
|
|
125
|
+
|
|
126
|
+
| Minter | Code | Positions it deploys (EVM → TON) | Quoted | Trusted by default |
|
|
127
|
+
|---|---|---|---|---|
|
|
128
|
+
| `EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA` (rev2) | `9737943f…` | `eb503578…` | since 2026-11-10 | yes |
|
|
129
|
+
| `EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ` (rev1) | `f91c43d3…` | `e4d5115a…` | until 2026-11-10 (a few orders on 2026-11-12) | no (0.5.4 and older: yes) |
|
|
130
|
+
|
|
131
|
+
Omniston's quotes moved to rev2 on 2026-11-10. rev2 checks the escrow and
|
|
132
|
+
execution code of every order against a whitelist built into the contract;
|
|
133
|
+
rev1 has no such whitelist. So a quote or a build that names rev1 is refused
|
|
134
|
+
with its address in the reason ("untrusted TON settlement contract
|
|
135
|
+
EQAbWJ3Y…", "the escrow transfer pays EQAbWJ3Y…, not an Omniston protocol
|
|
136
|
+
contract this app trusts"), and a rev1 output position fails
|
|
137
|
+
`position-code-hash`. Both minters stay in `OMNISTON_ESCROWS`, which
|
|
138
|
+
recognizes history and grants no trust (see Activity).
|
|
139
|
+
|
|
140
|
+
Orders already on rev1 need nothing from the trusted table:
|
|
141
|
+
|
|
142
|
+
- History: `describeActivity` still tags rev1 orders (`OMNISTON_ESCROWS`).
|
|
143
|
+
- Tracking: `trackIntent` reads no trust table. Every disclosure check
|
|
144
|
+
refuses a quote older than 6 hours, and the provider drops a quote context
|
|
145
|
+
after 6 hours, so a rev1 order quoted before Omniston's switch
|
|
146
|
+
(2026-11-10 ~19:00Z) can no longer be closed by any version. An order that
|
|
147
|
+
is not closed is cancelled after its timelocks, and the input goes back.
|
|
148
|
+
- An order in flight while you upgrade: a TON → EVM order on rev1 still
|
|
149
|
+
completes (its disclosure checks only the EVM side). An EVM → TON order
|
|
150
|
+
quoted on rev1 less than 6 hours before you deploy the new version fails
|
|
151
|
+
`position-code-hash`, keeps its secret and is cancelled after its
|
|
152
|
+
timelocks. To let it complete, pin both position codes until 6 hours after
|
|
153
|
+
the deploy:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const ton = createOmnistonTonValidators({
|
|
157
|
+
positionCodeHashes: [
|
|
158
|
+
"eb503578b4d9cd791c9c0ecd0da6da4064aae2bcb19d3c924d4001c493386bc5", // rev2 positions
|
|
159
|
+
"e4d5115a321ade7b827e38fb522c20d2f2cd46e4c6b0b5f7dd8b6b096792d77b", // rev1 positions, in-flight orders only
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This pin trusts no new order: the provider takes the minter from the
|
|
165
|
+
quote, a new quote must name a trusted minter, and a position counts only
|
|
166
|
+
when that minter deployed it.
|
|
167
|
+
|
|
168
|
+
Putting rev1 back into `trustedSettlementContracts` or
|
|
169
|
+
`trustedProtocolAddresses` is something else: it trusts rev1 again for new
|
|
170
|
+
quotes and builds, and it does not help close an old order.
|
|
171
|
+
|
|
172
|
+
The provider compares TON addresses as strings, so a table of your own must
|
|
173
|
+
spell them exactly as above; it replaces the built-in table, so it must list
|
|
174
|
+
every network, with rev2 (not rev1) under `ton:-239`. A new minter is a new
|
|
175
|
+
trust decision: its address goes into the settlement table and the code of
|
|
176
|
+
its positions into `DEFAULT_OMNISTON_TON_CODE_HASHES.position`
|
|
177
|
+
(`positionCodeHashes`), in the same release. With the address alone, EVM →
|
|
178
|
+
TON orders fill and then fail the check before the secret is disclosed. The
|
|
179
|
+
minters are admin-upgradable after a 7-day delay; the module watch reads the
|
|
180
|
+
code and data of every trusted minter daily.
|
|
181
|
+
|
|
120
182
|
## Activity
|
|
121
183
|
|
|
122
184
|
`describeActivity(tx, ctx)` recognizes TON-side transactions by their
|
|
@@ -126,10 +188,16 @@ at the destination contract and both sides of every transfer:
|
|
|
126
188
|
- STON.fi DEX router (`STONFI_ROUTERS` in `src/activity.ts`; v2.2
|
|
127
189
|
`EQCS4UEa…cN3` is what the wallet's swaps hit, v1 kept for older history) →
|
|
128
190
|
`swap`, "Swapped GRAM → USD₮" / "Swapped USD₮ → GRAM", subtitle "STON.fi · TON".
|
|
129
|
-
- Omniston HTLC escrow (`OMNISTON_ESCROWS`, the Escrow
|
|
130
|
-
`EQAbWJ3Y…mrZ`
|
|
131
|
-
|
|
132
|
-
|
|
191
|
+
- Omniston HTLC escrow (`OMNISTON_ESCROWS`, the Escrow Minters a quote names as
|
|
192
|
+
`srcProtocolContractAddress`: `EQAbWJ3Y…mrZ` until 2026-11-10, `EQDybO88…9IA`
|
|
193
|
+
since; both stay listed for history, though only rev2 is trusted for new
|
|
194
|
+
orders) → `bridge`, "Bridged USD₮", subtitle "Omniston · STON.fi". The EVM
|
|
195
|
+
leg is paid by the resolver and is not recognizable offline. A refund
|
|
196
|
+
backstop that looks for the input coming back from a minter should read this
|
|
197
|
+
list too, not only the trusted table: the trusted table no longer has rev1,
|
|
198
|
+
and a table of your own may hold a minter this list does not. It is
|
|
199
|
+
exported by the package root (`@anywalletkit/protocol-swap2-omniston`),
|
|
200
|
+
not by `/validators`.
|
|
133
201
|
|
|
134
202
|
EVM → TON: the EVM leg is an off-chain signature (no transaction to
|
|
135
203
|
recognize); the delivery is a jetton transfer from the same escrow contract and
|
package/dist/activity.cjs
CHANGED
|
@@ -33,7 +33,10 @@ var STONFI_ROUTERS = [
|
|
|
33
33
|
"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3",
|
|
34
34
|
"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt"
|
|
35
35
|
];
|
|
36
|
-
var OMNISTON_ESCROWS = [
|
|
36
|
+
var OMNISTON_ESCROWS = [
|
|
37
|
+
"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ",
|
|
38
|
+
"EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA"
|
|
39
|
+
];
|
|
37
40
|
function raw(address) {
|
|
38
41
|
if (!address) return null;
|
|
39
42
|
try {
|
package/dist/activity.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/activity.ts"],"sourcesContent":["/**\n * Activity recognition for Omniston on TON.\n *\n * Same-chain swaps settle through the STON.fi DEX router (the wallet pays TON /\n * a jetton to the router and the output jetton or TON comes back) → `swap`.\n * TON → EVM orders lock the input in the Omniston HTLC escrow (\"Omniston Escrow\n * Minter\", the `srcProtocolContractAddress` of every live quote) → `bridge`;\n * the EVM leg is paid by the resolver and is not recognizable offline.\n * Addresses are compared in raw form, so friendly (EQ…/UQ…) and raw (0:…)\n * notations all match.\n */\nimport {Address} from \"@ton/core\";\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {describeSwapLike} from \"@anywalletkit/protocol-swap2-core/activity\";\n\nexport const OMNISTON_MODULE = \"@anywalletkit/protocol-swap2-omniston\";\n\n/** STON.fi DEX routers (tonapi \"STON.fi DEX\"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */\nexport const STONFI_ROUTERS: readonly string[] = [\n \"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3\",\n \"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt\",\n];\n
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts"],"sourcesContent":["/**\n * Activity recognition for Omniston on TON.\n *\n * Same-chain swaps settle through the STON.fi DEX router (the wallet pays TON /\n * a jetton to the router and the output jetton or TON comes back) → `swap`.\n * TON → EVM orders lock the input in the Omniston HTLC escrow (\"Omniston Escrow\n * Minter\", the `srcProtocolContractAddress` of every live quote) → `bridge`;\n * the EVM leg is paid by the resolver and is not recognizable offline.\n * Addresses are compared in raw form, so friendly (EQ…/UQ…) and raw (0:…)\n * notations all match.\n */\nimport {Address} from \"@ton/core\";\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {describeSwapLike} from \"@anywalletkit/protocol-swap2-core/activity\";\n\nexport const OMNISTON_MODULE = \"@anywalletkit/protocol-swap2-omniston\";\n\n/** STON.fi DEX routers (tonapi \"STON.fi DEX\"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */\nexport const STONFI_ROUTERS: readonly string[] = [\n \"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3\",\n \"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt\",\n];\n/**\n * Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders.\n * Every minter that ever held an order stays here: this list recognizes history (activity, and a refund from a\n * minter back to the trader), it grants no trust. New orders follow `AUDITED_OMNISTON_SETTLEMENT_CONTRACTS`, which\n * lists only rev2 in the releases after 0.5.4. Quotes named EQAbWJ3Y… (rev1) until 2026-11-10, EQDybO88… (rev2)\n * since 2026-11-10 ~19:00Z. Exported by the package root only, not by `/validators`.\n */\nexport const OMNISTON_ESCROWS: readonly string[] = [\n \"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ\",\n \"EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA\",\n];\n\nfunction raw(address: string | null | undefined): string | null {\n if (!address) return null;\n try {\n return Address.parse(address).toRawString();\n } catch {\n return null;\n }\n}\n\nconst ROUTER_RAW = new Set(STONFI_ROUTERS.map((a) => raw(a)!));\nconst ESCROW_RAW = new Set(OMNISTON_ESCROWS.map((a) => raw(a)!));\n\n/** Every non-own party of the transaction in raw form: the destination contract and each transfer's other side. */\nfunction counterparties(tx: ChainTx, own: Set<string>): string[] {\n const ownRaw = new Set<string>();\n for (const a of own) {\n const r = raw(a);\n if (r) ownRaw.add(r);\n }\n const out = new Set<string>();\n const add = (a: string | null | undefined) => {\n const r = raw(a);\n if (r && !ownRaw.has(r)) out.add(r);\n };\n add(tx.call?.to);\n add(tx.to);\n for (const t of tx.transfers) {\n add(t.from);\n add(t.to);\n }\n return [...out];\n}\n\nexport function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n if (!tx.chain.startsWith(\"ton:\")) return null;\n const parties = counterparties(tx, ctx.own);\n const escrow = parties.find((p) => ESCROW_RAW.has(p));\n if (escrow) {\n return describeSwapLike(tx, ctx, {protocol: OMNISTON_MODULE, subtitle: \"Omniston · STON.fi\", kind: \"bridge\", counterparty: tx.call?.to ?? tx.to ?? escrow});\n }\n const router = parties.find((p) => ROUTER_RAW.has(p));\n if (router) {\n return describeSwapLike(tx, ctx, {protocol: OMNISTON_MODULE, subtitle: \"STON.fi · TON\", kind: \"swap\", counterparty: tx.call?.to ?? tx.to ?? router});\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,kBAAsB;AAEtB,sBAA+B;AAExB,IAAM,kBAAkB;AAGxB,IAAM,iBAAoC;AAAA,EAC/C;AAAA,EACA;AACF;AAQO,IAAM,mBAAsC;AAAA,EACjD;AAAA,EACA;AACF;AAEA,SAAS,IAAI,SAAmD;AAC9D,MAAI,CAAC,QAAS,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O,kCAAiB,IAAI,KAAK,EAAC,UAAU,iBAAiB,UAAU,oBAAiB,MAAM,QAAQ,cAAc,GAAG,MAAM,MAAM,GAAG,MAAM,OAAM,CAAC;AAAA,EACrJ;AACA,SAAO;AACT;","names":[]}
|
package/dist/activity.d.cts
CHANGED
|
@@ -3,7 +3,13 @@ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/co
|
|
|
3
3
|
declare const OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
4
4
|
/** STON.fi DEX routers (tonapi "STON.fi DEX"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */
|
|
5
5
|
declare const STONFI_ROUTERS: readonly string[];
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders.
|
|
8
|
+
* Every minter that ever held an order stays here: this list recognizes history (activity, and a refund from a
|
|
9
|
+
* minter back to the trader), it grants no trust. New orders follow `AUDITED_OMNISTON_SETTLEMENT_CONTRACTS`, which
|
|
10
|
+
* lists only rev2 in the releases after 0.5.4. Quotes named EQAbWJ3Y… (rev1) until 2026-11-10, EQDybO88… (rev2)
|
|
11
|
+
* since 2026-11-10 ~19:00Z. Exported by the package root only, not by `/validators`.
|
|
12
|
+
*/
|
|
7
13
|
declare const OMNISTON_ESCROWS: readonly string[];
|
|
8
14
|
declare function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
9
15
|
|
package/dist/activity.d.ts
CHANGED
|
@@ -3,7 +3,13 @@ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/co
|
|
|
3
3
|
declare const OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
4
4
|
/** STON.fi DEX routers (tonapi "STON.fi DEX"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */
|
|
5
5
|
declare const STONFI_ROUTERS: readonly string[];
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders.
|
|
8
|
+
* Every minter that ever held an order stays here: this list recognizes history (activity, and a refund from a
|
|
9
|
+
* minter back to the trader), it grants no trust. New orders follow `AUDITED_OMNISTON_SETTLEMENT_CONTRACTS`, which
|
|
10
|
+
* lists only rev2 in the releases after 0.5.4. Quotes named EQAbWJ3Y… (rev1) until 2026-11-10, EQDybO88… (rev2)
|
|
11
|
+
* since 2026-11-10 ~19:00Z. Exported by the package root only, not by `/validators`.
|
|
12
|
+
*/
|
|
7
13
|
declare const OMNISTON_ESCROWS: readonly string[];
|
|
8
14
|
declare function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
9
15
|
|
package/dist/activity.js
CHANGED
|
@@ -6,7 +6,10 @@ var STONFI_ROUTERS = [
|
|
|
6
6
|
"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3",
|
|
7
7
|
"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt"
|
|
8
8
|
];
|
|
9
|
-
var OMNISTON_ESCROWS = [
|
|
9
|
+
var OMNISTON_ESCROWS = [
|
|
10
|
+
"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ",
|
|
11
|
+
"EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA"
|
|
12
|
+
];
|
|
10
13
|
function raw(address) {
|
|
11
14
|
if (!address) return null;
|
|
12
15
|
try {
|
|
@@ -56,4 +59,4 @@ export {
|
|
|
56
59
|
OMNISTON_ESCROWS,
|
|
57
60
|
describeOmnistonActivity
|
|
58
61
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-ENAEOF7N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts"],"sourcesContent":["/**\n * Activity recognition for Omniston on TON.\n *\n * Same-chain swaps settle through the STON.fi DEX router (the wallet pays TON /\n * a jetton to the router and the output jetton or TON comes back) → `swap`.\n * TON → EVM orders lock the input in the Omniston HTLC escrow (\"Omniston Escrow\n * Minter\", the `srcProtocolContractAddress` of every live quote) → `bridge`;\n * the EVM leg is paid by the resolver and is not recognizable offline.\n * Addresses are compared in raw form, so friendly (EQ…/UQ…) and raw (0:…)\n * notations all match.\n */\nimport {Address} from \"@ton/core\";\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {describeSwapLike} from \"@anywalletkit/protocol-swap2-core/activity\";\n\nexport const OMNISTON_MODULE = \"@anywalletkit/protocol-swap2-omniston\";\n\n/** STON.fi DEX routers (tonapi \"STON.fi DEX\"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */\nexport const STONFI_ROUTERS: readonly string[] = [\n \"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3\",\n \"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt\",\n];\n/**\n * Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders.\n * Every minter that ever held an order stays here: this list recognizes history (activity, and a refund from a\n * minter back to the trader), it grants no trust. New orders follow `AUDITED_OMNISTON_SETTLEMENT_CONTRACTS`, which\n * lists only rev2 in the releases after 0.5.4. Quotes named EQAbWJ3Y… (rev1) until 2026-11-10, EQDybO88… (rev2)\n * since 2026-11-10 ~19:00Z. Exported by the package root only, not by `/validators`.\n */\nexport const OMNISTON_ESCROWS: readonly string[] = [\n \"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ\",\n \"EQDybO88l2lrrAmALRUqpmgEE_tuxk510F4Yd4xjbQZxC9IA\",\n];\n\nfunction raw(address: string | null | undefined): string | null {\n if (!address) return null;\n try {\n return Address.parse(address).toRawString();\n } catch {\n return null;\n }\n}\n\nconst ROUTER_RAW = new Set(STONFI_ROUTERS.map((a) => raw(a)!));\nconst ESCROW_RAW = new Set(OMNISTON_ESCROWS.map((a) => raw(a)!));\n\n/** Every non-own party of the transaction in raw form: the destination contract and each transfer's other side. */\nfunction counterparties(tx: ChainTx, own: Set<string>): string[] {\n const ownRaw = new Set<string>();\n for (const a of own) {\n const r = raw(a);\n if (r) ownRaw.add(r);\n }\n const out = new Set<string>();\n const add = (a: string | null | undefined) => {\n const r = raw(a);\n if (r && !ownRaw.has(r)) out.add(r);\n };\n add(tx.call?.to);\n add(tx.to);\n for (const t of tx.transfers) {\n add(t.from);\n add(t.to);\n }\n return [...out];\n}\n\nexport function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n if (!tx.chain.startsWith(\"ton:\")) return null;\n const parties = counterparties(tx, ctx.own);\n const escrow = parties.find((p) => ESCROW_RAW.has(p));\n if (escrow) {\n return describeSwapLike(tx, ctx, {protocol: OMNISTON_MODULE, subtitle: \"Omniston · STON.fi\", kind: \"bridge\", counterparty: tx.call?.to ?? tx.to ?? escrow});\n }\n const router = parties.find((p) => ROUTER_RAW.has(p));\n if (router) {\n return describeSwapLike(tx, ctx, {protocol: OMNISTON_MODULE, subtitle: \"STON.fi · TON\", kind: \"swap\", counterparty: tx.call?.to ?? tx.to ?? router});\n }\n return null;\n}\n"],"mappings":";AAWA,SAAQ,eAAc;AAEtB,SAAQ,wBAAuB;AAExB,IAAM,kBAAkB;AAGxB,IAAM,iBAAoC;AAAA,EAC/C;AAAA,EACA;AACF;AAQO,IAAM,mBAAsC;AAAA,EACjD;AAAA,EACA;AACF;AAEA,SAAS,IAAI,SAAmD;AAC9D,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI;AACF,WAAO,QAAQ,MAAM,OAAO,EAAE,YAAY;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAM,aAAa,IAAI,IAA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,SAAO;AACT;","names":[]}
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-QDXFC6BC.js";
|
|
4
4
|
import {
|
|
5
5
|
describeOmnistonActivity
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ENAEOF7N.js";
|
|
7
7
|
import {
|
|
8
8
|
AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS,
|
|
9
9
|
AUDITED_OMNISTON_SETTLEMENT_CONTRACTS
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IDRZHWWL.js";
|
|
11
11
|
|
|
12
12
|
// src/provider.ts
|
|
13
13
|
import { Address as TonAddress, Cell as TonCell } from "@ton/core";
|
|
@@ -1853,6 +1853,9 @@ function omnistonProvider(opts = {}) {
|
|
|
1853
1853
|
const inputToken = assetContract(q.inputAsset);
|
|
1854
1854
|
const outputToken = assetContract(q.outputAsset);
|
|
1855
1855
|
const destChainId = tonDest ? null : evmRef(destChain);
|
|
1856
|
+
if (factory?.chain.$case === destCase && !isTrusted(destChain, factory.chain.value)) {
|
|
1857
|
+
throw new Error(`omniston: untrusted ${destChain} settlement contract ${factory.chain.value}`);
|
|
1858
|
+
}
|
|
1856
1859
|
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");
|
|
1857
1860
|
const { secrets, created } = await secretsFor(ref, q, 1);
|
|
1858
1861
|
const hashes = secrets.map((secret) => hashlock(secret, settlement.htlcHashingFunction));
|
|
@@ -2097,6 +2100,10 @@ function omnistonProvider(opts = {}) {
|
|
|
2097
2100
|
const destCase = q.outputAsset.chain.$case;
|
|
2098
2101
|
const traderDst = destCase === "ton" ? null : { chain: { $case: destCase, value: getAddress(ref.dest) } };
|
|
2099
2102
|
if (!traderDst) throw new Error("omniston: TON-destination orders are not supported");
|
|
2103
|
+
const minter = q.settlementData.value.srcProtocolContractAddress;
|
|
2104
|
+
if (minter.chain.$case !== "ton" || !isTrusted(srcChain, minter.chain.value)) {
|
|
2105
|
+
throw new Error(`omniston: untrusted TON settlement contract ${minter.chain.value}`);
|
|
2106
|
+
}
|
|
2100
2107
|
const settlement = q.settlementData;
|
|
2101
2108
|
const hashingFunction = settlement.$case === "order" ? settlement.value.htlcHashingFunction : void 0;
|
|
2102
2109
|
const { secrets, created } = await secretsFor(ref, q, maxExecutions);
|
|
@@ -2425,4 +2432,4 @@ export {
|
|
|
2425
2432
|
omnistonVerifyBuild,
|
|
2426
2433
|
omnistonProvider
|
|
2427
2434
|
};
|
|
2428
|
-
//# sourceMappingURL=chunk-
|
|
2435
|
+
//# sourceMappingURL=chunk-FDSTD34Z.js.map
|