@anywalletkit/protocol-swap2-omniston 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +94 -2
- package/dist/activity.cjs +79 -0
- package/dist/activity.cjs.map +1 -0
- package/dist/activity.d.cts +10 -0
- package/dist/activity.d.ts +10 -0
- package/dist/activity.js +13 -0
- package/dist/activity.js.map +1 -0
- package/dist/chunk-AIWAM7BS.js +59 -0
- package/dist/chunk-AIWAM7BS.js.map +1 -0
- package/dist/chunk-K2KBWGNL.js +27 -0
- package/dist/chunk-K2KBWGNL.js.map +1 -0
- package/dist/chunk-QDXFC6BC.js +30 -0
- package/dist/chunk-QDXFC6BC.js.map +1 -0
- package/dist/chunk-W3AXGSX3.js +2148 -0
- package/dist/chunk-W3AXGSX3.js.map +1 -0
- package/dist/config.cjs +50 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +12 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +2276 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.cjs +2262 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +15 -0
- package/dist/protocol.d.ts +15 -0
- package/dist/protocol.js +10 -0
- package/dist/protocol.js.map +1 -0
- package/dist/provider.cjs +2251 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +590 -0
- package/dist/provider.d.ts +590 -0
- package/dist/provider.js +23 -0
- package/dist/provider.js.map +1 -0
- package/dist/validators.cjs +1072 -0
- package/dist/validators.cjs.map +1 -0
- package/dist/validators.d.cts +199 -0
- package/dist/validators.d.ts +199 -0
- package/dist/validators.js +1065 -0
- package/dist/validators.js.map +1 -0
- package/module.json +17 -0
- package/package.json +88 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,95 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @anywalletkit/protocol-swap2-omniston
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
STON.fi Omniston as a swap2 module: TON ↔ TON swaps settled on the STON.fi DEX,
|
|
4
|
+
and TON ↔ EVM and EVM ↔ EVM stable orders settled through HTLC escrows
|
|
5
|
+
(resolver Arbiter), over the Omniston WebSocket RFQ. Standalone through
|
|
6
|
+
`OmnistonSwap2Protocol`, or as one provider of the router.
|
|
7
|
+
|
|
8
|
+
EVM chains: Ethereum, BNB, Polygon, X Layer, HyperEVM, Robinhood, Base, Plasma,
|
|
9
|
+
Arbitrum, Avalanche. ARC (in Omniston's matrix) waits for the asset catalog;
|
|
10
|
+
TRON needs its own order path and is not wired yet.
|
|
11
|
+
|
|
12
|
+
## Routes and their gates
|
|
13
|
+
|
|
14
|
+
Every route is fail-closed until its allowlists and validators are configured:
|
|
15
|
+
|
|
16
|
+
- **TON → TON** (DEX swap): `trustedSettlementContracts["ton:-239"]`,
|
|
17
|
+
`validateTonJettonWallet`, `validateTonSwapTarget`. The built message's DEX
|
|
18
|
+
call is decoded in the package (STON.fi v1/v2 incl. pTON and cross-swap,
|
|
19
|
+
DeDust v1, DeDust CPMM v2): receiver = destination, refunds/excess = trader,
|
|
20
|
+
on-chain minimum ≥ the quote's, no foreign referral; unknown layouts and
|
|
21
|
+
split/multi-route quotes are refused by name. `validateTonSwapLeg`
|
|
22
|
+
(supplied by `createOmnistonTonValidators`) confirms the routers' ask
|
|
23
|
+
wallets, pTON wallet ownership and DeDust pool pairs on chain.
|
|
24
|
+
`tonSwapPayloadCheck: "report"` traces `ton-swap-payload <reason>` instead
|
|
25
|
+
of refusing (default `"enforce"`).
|
|
26
|
+
- **TON → EVM** (HTLC order, the wallet pays a jetton escrow): factory
|
|
27
|
+
allowlisted on both chains, `validateTonJettonWallet`,
|
|
28
|
+
`validateTonEscrowPayload`, `validateEvmOutputPosition`.
|
|
29
|
+
- **EVM → TON** (gasless order): the wallet approves the Omniston order
|
|
30
|
+
protocol (a 1inch Limit Order Protocol v4 fork, `trustedEvmOrderProtocols`
|
|
31
|
+
per chain — a different table from the factories, since one address plays
|
|
32
|
+
different roles on different chains) and signs an EIP-712 `Order`;
|
|
33
|
+
`buildDeposit` returns a `typedData` `UnsignedTx` only after the order, the
|
|
34
|
+
pinned v1beta8 extension and the serialized order details are verified
|
|
35
|
+
against the quote, `registerSignedOrder` hands the signature to Omniston,
|
|
36
|
+
and `trackIntent` discloses the HTLC secret only when
|
|
37
|
+
`validateEvmInputPosition` (finalized `SrcEscrowCreated` + escrow state)
|
|
38
|
+
AND `validateTonOutputPosition` (factory-deployed TON position with bound
|
|
39
|
+
state, inside its completion window) both pass.
|
|
40
|
+
- **EVM → EVM** (gasless order, same order protocol as EVM → TON): the signed
|
|
41
|
+
extension's ExtraDataArgs name the destination chain, token and deposit and
|
|
42
|
+
are checked against the quote. The EVM recipient is NOT in anything the
|
|
43
|
+
wallet signs (it rides in the unsigned order details), so the secret is
|
|
44
|
+
disclosed only when `validateEvmInputPosition` (source fill, including the
|
|
45
|
+
destination complement) AND `validateEvmOutputPosition` (an escrow the
|
|
46
|
+
trusted factory derives from immutables that pay the recipient) both pass.
|
|
47
|
+
The destination escrow's fee split must be exactly the quoted protocol and
|
|
48
|
+
integrator fees, paid only to the quote's `protocolFeeRecipientAddress` /
|
|
49
|
+
integrator, its destination stages must be 1/120/180 s, and the secret is
|
|
50
|
+
not released within 45 s of its cancellation stage (refusal reasons go to
|
|
51
|
+
the validator's `onRefusal`).
|
|
52
|
+
|
|
53
|
+
## Validators
|
|
54
|
+
|
|
55
|
+
`@anywalletkit/protocol-swap2-omniston/validators` ships the RPC/indexer-backed
|
|
56
|
+
validators every route above needs, plus the audited contract tables:
|
|
57
|
+
`createOmnistonEvmOutputValidator`, `createOmnistonEvmInputValidator`,
|
|
58
|
+
`createOmnistonTonValidators` (TonAPI), `createOmnistonEvmDeliveryLocator`
|
|
59
|
+
(feeds `locateEvmDelivery`: a completed EVM-destination order then carries
|
|
60
|
+
`destTxHash`, the escrow's payout to the recipient — Omniston's feed names the
|
|
61
|
+
escrow, not that transaction), `AUDITED_OMNISTON_SETTLEMENT_CONTRACTS`,
|
|
62
|
+
`AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS`. No deployment env is read: pass your
|
|
63
|
+
own endpoints as `rpcUrls` (CAIP-2 → URLs, tried before the public fallbacks)
|
|
64
|
+
and `tonApiUrl` / `tonApiKey`. On serverless also inject durable
|
|
65
|
+
`secretStore` / `quoteStore` — the HTLC secret must survive to the poll that
|
|
66
|
+
discloses it.
|
|
67
|
+
|
|
68
|
+
The destination-escrow proof requires the escrow immutables to be found in the
|
|
69
|
+
resolver's calldata AND to derive, through the trusted factory's
|
|
70
|
+
`addressOfEscrowDst` (deployedAt stamped with the block timestamp), to the
|
|
71
|
+
escrow address the factory announced; a decoy tuple or hidden immutables fail
|
|
72
|
+
closed.
|
|
73
|
+
|
|
74
|
+
## Activity
|
|
75
|
+
|
|
76
|
+
`describeActivity(tx, ctx)` recognizes TON-side transactions by their
|
|
77
|
+
counterparty (compared in raw form, so `EQ…`, `UQ…` and `0:…` all match), looking
|
|
78
|
+
at the destination contract and both sides of every transfer:
|
|
79
|
+
|
|
80
|
+
- STON.fi DEX router (`STONFI_ROUTERS` in `src/activity.ts`; v2.2
|
|
81
|
+
`EQCS4UEa…cN3` is what the wallet's swaps hit, v1 kept for older history) →
|
|
82
|
+
`swap`, "Swapped GRAM → USD₮" / "Swapped USD₮ → GRAM", subtitle "STON.fi · TON".
|
|
83
|
+
- Omniston HTLC escrow (`OMNISTON_ESCROWS`, the Escrow Minter
|
|
84
|
+
`EQAbWJ3Y…mrZ` that every live quote names as `srcProtocolContractAddress`) →
|
|
85
|
+
`bridge`, "Bridged USD₮", subtitle "Omniston · STON.fi". The EVM leg is paid by
|
|
86
|
+
the resolver and is not recognizable offline.
|
|
87
|
+
|
|
88
|
+
EVM → TON: the EVM leg is an off-chain signature (no transaction to
|
|
89
|
+
recognize); the delivery is a jetton transfer from the same escrow contract and
|
|
90
|
+
shows up as `bridge`. Nothing on EVM is recognized.
|
|
91
|
+
|
|
92
|
+
Fixtures (`fixtures/activity/`, test wallet `UQCbXJ1-…fQaq`, tonapi events):
|
|
93
|
+
two STON.fi swaps (GRAM → USD₮, USD₮ → GRAM) and one escrow order (1.6 USD₮);
|
|
94
|
+
negatives: a 1Click deposit on TON (a plain jetton transfer to a one-time
|
|
95
|
+
address — must stay null) and an EVM LI.FI swap.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/activity.ts
|
|
21
|
+
var activity_exports = {};
|
|
22
|
+
__export(activity_exports, {
|
|
23
|
+
OMNISTON_ESCROWS: () => OMNISTON_ESCROWS,
|
|
24
|
+
OMNISTON_MODULE: () => OMNISTON_MODULE,
|
|
25
|
+
STONFI_ROUTERS: () => STONFI_ROUTERS,
|
|
26
|
+
describeOmnistonActivity: () => describeOmnistonActivity
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(activity_exports);
|
|
29
|
+
var import_core = require("@ton/core");
|
|
30
|
+
var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
|
|
31
|
+
var OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
32
|
+
var STONFI_ROUTERS = [
|
|
33
|
+
"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3",
|
|
34
|
+
"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt"
|
|
35
|
+
];
|
|
36
|
+
var OMNISTON_ESCROWS = ["EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ"];
|
|
37
|
+
function raw(address) {
|
|
38
|
+
if (!address) return null;
|
|
39
|
+
try {
|
|
40
|
+
return import_core.Address.parse(address).toRawString();
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
var ROUTER_RAW = new Set(STONFI_ROUTERS.map((a) => raw(a)));
|
|
46
|
+
var ESCROW_RAW = new Set(OMNISTON_ESCROWS.map((a) => raw(a)));
|
|
47
|
+
function counterparties(tx, own) {
|
|
48
|
+
const ownRaw = /* @__PURE__ */ new Set();
|
|
49
|
+
for (const a of own) {
|
|
50
|
+
const r = raw(a);
|
|
51
|
+
if (r) ownRaw.add(r);
|
|
52
|
+
}
|
|
53
|
+
const out = /* @__PURE__ */ new Set();
|
|
54
|
+
const add = (a) => {
|
|
55
|
+
const r = raw(a);
|
|
56
|
+
if (r && !ownRaw.has(r)) out.add(r);
|
|
57
|
+
};
|
|
58
|
+
add(tx.call?.to);
|
|
59
|
+
add(tx.to);
|
|
60
|
+
for (const t of tx.transfers) {
|
|
61
|
+
add(t.from);
|
|
62
|
+
add(t.to);
|
|
63
|
+
}
|
|
64
|
+
return [...out];
|
|
65
|
+
}
|
|
66
|
+
function describeOmnistonActivity(tx, ctx) {
|
|
67
|
+
if (!tx.chain.startsWith("ton:")) return null;
|
|
68
|
+
const parties = counterparties(tx, ctx.own);
|
|
69
|
+
const escrow = parties.find((p) => ESCROW_RAW.has(p));
|
|
70
|
+
if (escrow) {
|
|
71
|
+
return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: OMNISTON_MODULE, subtitle: "Omniston \xB7 STON.fi", kind: "bridge", counterparty: tx.call?.to ?? tx.to ?? escrow });
|
|
72
|
+
}
|
|
73
|
+
const router = parties.find((p) => ROUTER_RAW.has(p));
|
|
74
|
+
if (router) {
|
|
75
|
+
return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: OMNISTON_MODULE, subtitle: "STON.fi \xB7 TON", kind: "swap", counterparty: tx.call?.to ?? tx.to ?? router });
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=activity.cjs.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/** Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders. */\nexport const OMNISTON_ESCROWS: readonly string[] = [\"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ\"];\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;AAEO,IAAM,mBAAsC,CAAC,kDAAkD;AAEtG,SAAS,IAAI,SAAmD;AAC9D,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI;AACF,WAAO,oBAAQ,MAAM,OAAO,EAAE,YAAY;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAM,aAAa,IAAI,IAAI,eAAe,IAAI,CAAC,MAAM,IAAI,CAAC,CAAE,CAAC;AAC7D,IAAM,aAAa,IAAI,IAAI,iBAAiB,IAAI,CAAC,MAAM,IAAI,CAAC,CAAE,CAAC;AAG/D,SAAS,eAAe,IAAa,KAA4B;AAC/D,QAAM,SAAS,oBAAI,IAAY;AAC/B,aAAW,KAAK,KAAK;AACnB,UAAM,IAAI,IAAI,CAAC;AACf,QAAI,EAAG,QAAO,IAAI,CAAC;AAAA,EACrB;AACA,QAAM,MAAM,oBAAI,IAAY;AAC5B,QAAM,MAAM,CAAC,MAAiC;AAC5C,UAAM,IAAI,IAAI,CAAC;AACf,QAAI,KAAK,CAAC,OAAO,IAAI,CAAC,EAAG,KAAI,IAAI,CAAC;AAAA,EACpC;AACA,MAAI,GAAG,MAAM,EAAE;AACf,MAAI,GAAG,EAAE;AACT,aAAW,KAAK,GAAG,WAAW;AAC5B,QAAI,EAAE,IAAI;AACV,QAAI,EAAE,EAAE;AAAA,EACV;AACA,SAAO,CAAC,GAAG,GAAG;AAChB;AAEO,SAAS,yBAAyB,IAAa,KAAmD;AACvG,MAAI,CAAC,GAAG,MAAM,WAAW,MAAM,EAAG,QAAO;AACzC,QAAM,UAAU,eAAe,IAAI,IAAI,GAAG;AAC1C,QAAM,SAAS,QAAQ,KAAK,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC;AACpD,MAAI,QAAQ;AACV,eAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,iBAAiB,UAAU,yBAAsB,MAAM,UAAU,cAAc,GAAG,MAAM,MAAM,GAAG,MAAM,OAAM,CAAC;AAAA,EAC5J;AACA,QAAM,SAAS,QAAQ,KAAK,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC;AACpD,MAAI,QAAQ;AACV,eAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,iBAAiB,UAAU,oBAAiB,MAAM,QAAQ,cAAc,GAAG,MAAM,MAAM,GAAG,MAAM,OAAM,CAAC;AAAA,EACrJ;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
|
|
2
|
+
|
|
3
|
+
declare const OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
4
|
+
/** STON.fi DEX routers (tonapi "STON.fi DEX"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */
|
|
5
|
+
declare const STONFI_ROUTERS: readonly string[];
|
|
6
|
+
/** Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders. */
|
|
7
|
+
declare const OMNISTON_ESCROWS: readonly string[];
|
|
8
|
+
declare function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
9
|
+
|
|
10
|
+
export { OMNISTON_ESCROWS, OMNISTON_MODULE, STONFI_ROUTERS, describeOmnistonActivity };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
|
|
2
|
+
|
|
3
|
+
declare const OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
4
|
+
/** STON.fi DEX routers (tonapi "STON.fi DEX"; v2.2 observed in the test wallet's swaps, v1 kept for older history). */
|
|
5
|
+
declare const STONFI_ROUTERS: readonly string[];
|
|
6
|
+
/** Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders. */
|
|
7
|
+
declare const OMNISTON_ESCROWS: readonly string[];
|
|
8
|
+
declare function describeOmnistonActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
9
|
+
|
|
10
|
+
export { OMNISTON_ESCROWS, OMNISTON_MODULE, STONFI_ROUTERS, describeOmnistonActivity };
|
package/dist/activity.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OMNISTON_ESCROWS,
|
|
3
|
+
OMNISTON_MODULE,
|
|
4
|
+
STONFI_ROUTERS,
|
|
5
|
+
describeOmnistonActivity
|
|
6
|
+
} from "./chunk-AIWAM7BS.js";
|
|
7
|
+
export {
|
|
8
|
+
OMNISTON_ESCROWS,
|
|
9
|
+
OMNISTON_MODULE,
|
|
10
|
+
STONFI_ROUTERS,
|
|
11
|
+
describeOmnistonActivity
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/activity.ts
|
|
2
|
+
import { Address } from "@ton/core";
|
|
3
|
+
import { describeSwapLike } from "@anywalletkit/protocol-swap2-core/activity";
|
|
4
|
+
var OMNISTON_MODULE = "@anywalletkit/protocol-swap2-omniston";
|
|
5
|
+
var STONFI_ROUTERS = [
|
|
6
|
+
"EQCS4UEa5UaJLzOyyKieqQOQ2P9M-7kXpkO5HnP3Bv250cN3",
|
|
7
|
+
"EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt"
|
|
8
|
+
];
|
|
9
|
+
var OMNISTON_ESCROWS = ["EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ"];
|
|
10
|
+
function raw(address) {
|
|
11
|
+
if (!address) return null;
|
|
12
|
+
try {
|
|
13
|
+
return Address.parse(address).toRawString();
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var ROUTER_RAW = new Set(STONFI_ROUTERS.map((a) => raw(a)));
|
|
19
|
+
var ESCROW_RAW = new Set(OMNISTON_ESCROWS.map((a) => raw(a)));
|
|
20
|
+
function counterparties(tx, own) {
|
|
21
|
+
const ownRaw = /* @__PURE__ */ new Set();
|
|
22
|
+
for (const a of own) {
|
|
23
|
+
const r = raw(a);
|
|
24
|
+
if (r) ownRaw.add(r);
|
|
25
|
+
}
|
|
26
|
+
const out = /* @__PURE__ */ new Set();
|
|
27
|
+
const add = (a) => {
|
|
28
|
+
const r = raw(a);
|
|
29
|
+
if (r && !ownRaw.has(r)) out.add(r);
|
|
30
|
+
};
|
|
31
|
+
add(tx.call?.to);
|
|
32
|
+
add(tx.to);
|
|
33
|
+
for (const t of tx.transfers) {
|
|
34
|
+
add(t.from);
|
|
35
|
+
add(t.to);
|
|
36
|
+
}
|
|
37
|
+
return [...out];
|
|
38
|
+
}
|
|
39
|
+
function describeOmnistonActivity(tx, ctx) {
|
|
40
|
+
if (!tx.chain.startsWith("ton:")) return null;
|
|
41
|
+
const parties = counterparties(tx, ctx.own);
|
|
42
|
+
const escrow = parties.find((p) => ESCROW_RAW.has(p));
|
|
43
|
+
if (escrow) {
|
|
44
|
+
return describeSwapLike(tx, ctx, { protocol: OMNISTON_MODULE, subtitle: "Omniston \xB7 STON.fi", kind: "bridge", counterparty: tx.call?.to ?? tx.to ?? escrow });
|
|
45
|
+
}
|
|
46
|
+
const router = parties.find((p) => ROUTER_RAW.has(p));
|
|
47
|
+
if (router) {
|
|
48
|
+
return describeSwapLike(tx, ctx, { protocol: OMNISTON_MODULE, subtitle: "STON.fi \xB7 TON", kind: "swap", counterparty: tx.call?.to ?? tx.to ?? router });
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
OMNISTON_MODULE,
|
|
55
|
+
STONFI_ROUTERS,
|
|
56
|
+
OMNISTON_ESCROWS,
|
|
57
|
+
describeOmnistonActivity
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=chunk-AIWAM7BS.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/** Omniston HTLC escrow on TON (Omniston Escrow Minter) — the `srcProtocolContractAddress` of TON→EVM orders. */\nexport const OMNISTON_ESCROWS: readonly string[] = [\"EQAbWJ3Y1HgIIvcMq1prG1anlDC0T3cZlAU7luPT6LmTpmrZ\"];\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;AAEO,IAAM,mBAAsC,CAAC,kDAAkD;AAEtG,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,IAAI,eAAe,IAAI,CAAC,MAAM,IAAI,CAAC,CAAE,CAAC;AAC7D,IAAM,aAAa,IAAI,IAAI,iBAAiB,IAAI,CAAC,MAAM,IAAI,CAAC,CAAE,CAAC;AAG/D,SAAS,eAAe,IAAa,KAA4B;AAC/D,QAAM,SAAS,oBAAI,IAAY;AAC/B,aAAW,KAAK,KAAK;AACnB,UAAM,IAAI,IAAI,CAAC;AACf,QAAI,EAAG,QAAO,IAAI,CAAC;AAAA,EACrB;AACA,QAAM,MAAM,oBAAI,IAAY;AAC5B,QAAM,MAAM,CAAC,MAAiC;AAC5C,UAAM,IAAI,IAAI,CAAC;AACf,QAAI,KAAK,CAAC,OAAO,IAAI,CAAC,EAAG,KAAI,IAAI,CAAC;AAAA,EACpC;AACA,MAAI,GAAG,MAAM,EAAE;AACf,MAAI,GAAG,EAAE;AACT,aAAW,KAAK,GAAG,WAAW;AAC5B,QAAI,EAAE,IAAI;AACV,QAAI,EAAE,EAAE;AAAA,EACV;AACA,SAAO,CAAC,GAAG,GAAG;AAChB;AAEO,SAAS,yBAAyB,IAAa,KAAmD;AACvG,MAAI,CAAC,GAAG,MAAM,WAAW,MAAM,EAAG,QAAO;AACzC,QAAM,UAAU,eAAe,IAAI,IAAI,GAAG;AAC1C,QAAM,SAAS,QAAQ,KAAK,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC;AACpD,MAAI,QAAQ;AACV,WAAO,iBAAiB,IAAI,KAAK,EAAC,UAAU,iBAAiB,UAAU,yBAAsB,MAAM,UAAU,cAAc,GAAG,MAAM,MAAM,GAAG,MAAM,OAAM,CAAC;AAAA,EAC5J;AACA,QAAM,SAAS,QAAQ,KAAK,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC;AACpD,MAAI,QAAQ;AACV,WAAO,iBAAiB,IAAI,KAAK,EAAC,UAAU,iBAAiB,UAAU,oBAAiB,MAAM,QAAQ,cAAc,GAAG,MAAM,MAAM,GAAG,MAAM,OAAM,CAAC;AAAA,EACrJ;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
omnistonProvider
|
|
3
|
+
} from "./chunk-W3AXGSX3.js";
|
|
4
|
+
import {
|
|
5
|
+
omniston
|
|
6
|
+
} from "./chunk-QDXFC6BC.js";
|
|
7
|
+
|
|
8
|
+
// src/protocol.ts
|
|
9
|
+
import { SingleProviderSwap2 } from "@anywalletkit/protocol-swap2-core/swap2/single";
|
|
10
|
+
var OmnistonSwap2Protocol = class extends SingleProviderSwap2 {
|
|
11
|
+
provider;
|
|
12
|
+
constructor(account, config) {
|
|
13
|
+
super(account, config);
|
|
14
|
+
this.provider = omnistonProvider(config);
|
|
15
|
+
}
|
|
16
|
+
chainSupported(caip2) {
|
|
17
|
+
return omniston.supportsChain(caip2);
|
|
18
|
+
}
|
|
19
|
+
pairSupported(fromChain, toChain) {
|
|
20
|
+
return this.provider.supportsRoute({ chain: fromChain, token: "" }, { chain: toChain, token: "" });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
OmnistonSwap2Protocol
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=chunk-K2KBWGNL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protocol.ts"],"sourcesContent":["import \"./buffer-global.js\";\nimport {SingleProviderSwap2} from \"@anywalletkit/protocol-swap2-core/swap2/single\";\nimport type {Swap2Account, Swap2EngineConfig} from \"@anywalletkit/protocol-swap2-core/swap2/base\";\nimport {omniston as omnistonCfg} from \"./config.js\";\nimport {omnistonProvider, type OmnistonProviderOptions} from \"./provider.js\";\n\nexport interface OmnistonSwap2Config extends Swap2EngineConfig, OmnistonProviderOptions {}\n\nexport class OmnistonSwap2Protocol extends SingleProviderSwap2 {\n protected readonly provider;\n constructor(account: Swap2Account | undefined, config: OmnistonSwap2Config) {\n super(account, config);\n this.provider = omnistonProvider(config);\n }\n protected override chainSupported(caip2: string): boolean {\n // Network discovery is broad; provider.supportsRoute keeps the currently\n // audited execution direction (TON-source → EVM) fail-closed.\n return omnistonCfg.supportsChain(caip2);\n }\n protected override pairSupported(fromChain: string, toChain: string): boolean {\n return this.provider.supportsRoute({chain: fromChain, token: \"\"}, {chain: toChain, token: \"\"});\n }\n}\n"],"mappings":";;;;;;;;AACA,SAAQ,2BAA0B;AAO3B,IAAM,wBAAN,cAAoC,oBAAoB;AAAA,EAC1C;AAAA,EACnB,YAAY,SAAmC,QAA6B;AAC1E,UAAM,SAAS,MAAM;AACrB,SAAK,WAAW,iBAAiB,MAAM;AAAA,EACzC;AAAA,EACmB,eAAe,OAAwB;AAGxD,WAAO,SAAY,cAAc,KAAK;AAAA,EACxC;AAAA,EACmB,cAAc,WAAmB,SAA0B;AAC5E,WAAO,KAAK,SAAS,cAAc,EAAC,OAAO,WAAW,OAAO,GAAE,GAAG,EAAC,OAAO,SAAS,OAAO,GAAE,CAAC;AAAA,EAC/F;AACF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { evmRef, isEvm, namespace } from "@anywalletkit/protocol-swap2-core/util";
|
|
3
|
+
var OMNISTON_EVM = /* @__PURE__ */ new Set([1, 56, 137, 196, 999, 4663, 8453, 9745, 42161, 43114]);
|
|
4
|
+
var omniston = {
|
|
5
|
+
enabled: () => true,
|
|
6
|
+
integratorAddress: () => "",
|
|
7
|
+
integratorFeePips: () => "",
|
|
8
|
+
wsUrl: () => "wss://omni-ws.ston.fi",
|
|
9
|
+
/** Per-swap USD cap — the resolver quotes the corridor up to ~$1000. */
|
|
10
|
+
maxUsd: () => {
|
|
11
|
+
return 1e3;
|
|
12
|
+
},
|
|
13
|
+
supportsChain(chain) {
|
|
14
|
+
if (namespace(chain) === "ton") return true;
|
|
15
|
+
return isEvm(chain) && OMNISTON_EVM.has(evmRef(chain));
|
|
16
|
+
},
|
|
17
|
+
// TON↔EVM and EVM↔EVM cross-chain (order settlement), TON↔TON same-chain
|
|
18
|
+
// (swap settlement — immediate DEX routes). Same-chain EVM is not an order
|
|
19
|
+
// corridor.
|
|
20
|
+
supports(from, to) {
|
|
21
|
+
if (!this.supportsChain(from) || !this.supportsChain(to)) return false;
|
|
22
|
+
const tonSide = namespace(from) === "ton" || namespace(to) === "ton";
|
|
23
|
+
return tonSide || from !== to;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
omniston
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-QDXFC6BC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["import {evmRef, isEvm, namespace} from \"@anywalletkit/protocol-swap2-core/util\";\n\n// ── Omniston (STON.fi) — stable corridors over a WebSocket RFQ ───────────────\n// Operational matrix (docs.ston.fi \"Supported Chains\", re-checked 2026-10-20):\n// Arbitrum, Avalanche, Base, BNB, Ethereum, Polygon, Robinhood, X Layer (196),\n// HyperEVM (999), Plasma (9745), ARC (5042), TON, TRON. ARC waits for the asset\n// catalog; TRON needs its own order/position path. Live RFQ 2026-10-20: every\n// listed chain quotes against TON USDT both ways, and EVM↔EVM pairs quote too.\nconst OMNISTON_EVM = new Set([1, 56, 137, 196, 999, 4663, 8453, 9745, 42161, 43114]);\nexport const omniston = {\n enabled: () => true,\n integratorAddress: () => \"\",\n integratorFeePips: () => \"\",\n wsUrl: () => \"wss://omni-ws.ston.fi\",\n /** Per-swap USD cap — the resolver quotes the corridor up to ~$1000. */\n maxUsd: () => {\n return 1000;\n },\n supportsChain(chain: string): boolean {\n if (namespace(chain) === \"ton\") return true;\n return isEvm(chain) && OMNISTON_EVM.has(evmRef(chain));\n },\n // TON↔EVM and EVM↔EVM cross-chain (order settlement), TON↔TON same-chain\n // (swap settlement — immediate DEX routes). Same-chain EVM is not an order\n // corridor.\n supports(from: string, to: string): boolean {\n if (!this.supportsChain(from) || !this.supportsChain(to)) return false;\n const tonSide = namespace(from) === \"ton\" || namespace(to) === \"ton\";\n return tonSide || from !== to;\n },\n};\n"],"mappings":";AAAA,SAAQ,QAAQ,OAAO,iBAAgB;AAQvC,IAAM,eAAe,oBAAI,IAAI,CAAC,GAAG,IAAI,KAAK,KAAK,KAAK,MAAM,MAAM,MAAM,OAAO,KAAK,CAAC;AAC5E,IAAM,WAAW;AAAA,EACtB,SAAS,MAAM;AAAA,EACf,mBAAmB,MAAM;AAAA,EACzB,mBAAmB,MAAM;AAAA,EACzB,OAAO,MAAM;AAAA;AAAA,EAEb,QAAQ,MAAM;AACZ,WAAO;AAAA,EACT;AAAA,EACA,cAAc,OAAwB;AACpC,QAAI,UAAU,KAAK,MAAM,MAAO,QAAO;AACvC,WAAO,MAAM,KAAK,KAAK,aAAa,IAAI,OAAO,KAAK,CAAC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA,EAIA,SAAS,MAAc,IAAqB;AAC1C,QAAI,CAAC,KAAK,cAAc,IAAI,KAAK,CAAC,KAAK,cAAc,EAAE,EAAG,QAAO;AACjE,UAAM,UAAU,UAAU,IAAI,MAAM,SAAS,UAAU,EAAE,MAAM;AAC/D,WAAO,WAAW,SAAS;AAAA,EAC7B;AACF;","names":[]}
|