@anywalletkit/protocol-swap2-omniston 0.0.0-stage → 0.2.2

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.
Files changed (48) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +94 -2
  3. package/dist/activity.cjs +79 -0
  4. package/dist/activity.cjs.map +1 -0
  5. package/dist/activity.d.cts +10 -0
  6. package/dist/activity.d.ts +10 -0
  7. package/dist/activity.js +13 -0
  8. package/dist/activity.js.map +1 -0
  9. package/dist/chunk-AIWAM7BS.js +59 -0
  10. package/dist/chunk-AIWAM7BS.js.map +1 -0
  11. package/dist/chunk-K2KBWGNL.js +27 -0
  12. package/dist/chunk-K2KBWGNL.js.map +1 -0
  13. package/dist/chunk-QDXFC6BC.js +30 -0
  14. package/dist/chunk-QDXFC6BC.js.map +1 -0
  15. package/dist/chunk-W3AXGSX3.js +2148 -0
  16. package/dist/chunk-W3AXGSX3.js.map +1 -0
  17. package/dist/config.cjs +50 -0
  18. package/dist/config.cjs.map +1 -0
  19. package/dist/config.d.cts +12 -0
  20. package/dist/config.d.ts +12 -0
  21. package/dist/config.js +7 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/index.cjs +2276 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +8 -0
  26. package/dist/index.d.ts +8 -0
  27. package/dist/index.js +40 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/protocol.cjs +2262 -0
  30. package/dist/protocol.cjs.map +1 -0
  31. package/dist/protocol.d.cts +15 -0
  32. package/dist/protocol.d.ts +15 -0
  33. package/dist/protocol.js +10 -0
  34. package/dist/protocol.js.map +1 -0
  35. package/dist/provider.cjs +2251 -0
  36. package/dist/provider.cjs.map +1 -0
  37. package/dist/provider.d.cts +590 -0
  38. package/dist/provider.d.ts +590 -0
  39. package/dist/provider.js +23 -0
  40. package/dist/provider.js.map +1 -0
  41. package/dist/validators.cjs +1072 -0
  42. package/dist/validators.cjs.map +1 -0
  43. package/dist/validators.d.cts +199 -0
  44. package/dist/validators.d.ts +199 -0
  45. package/dist/validators.js +1065 -0
  46. package/dist/validators.js.map +1 -0
  47. package/module.json +17 -0
  48. package/package.json +88 -3
@@ -0,0 +1,590 @@
1
+ import { CrossChainProvider } from '@anywalletkit/protocol-swap2-core/types';
2
+
3
+ /** Omniston's `SwapChunk.protocol` names and the layout each one builds. */
4
+ declare const TON_SWAP_PROTOCOL_LAYOUTS: Readonly<Record<string, "stonfi-v1" | "stonfi-v2" | "dedust-v1" | "dedust-v2">>;
5
+ /** A chain fact the payload depends on; checked by `validateTonSwapLeg`. A
6
+ * jetton is named by its master address; `null` is native GRAM. */
7
+ type TonSwapLeg = {
8
+ kind: "stonfi-router";
9
+ version: 1 | 2;
10
+ /** The router that executes this hop; null = the owner of `proxyTonWallet`. */
11
+ router: string | null;
12
+ /** Native input: the router's proxy-TON wallet the message pays into. */
13
+ proxyTonWallet?: string;
14
+ /** The router's wallet the hop asks for — must be the router's wallet of `outputJetton`
15
+ * (of a proxy-TON master when the output is native). */
16
+ askWallet: string;
17
+ inputJetton: string | null;
18
+ outputJetton: string | null;
19
+ } | {
20
+ kind: "dedust-pool";
21
+ version: 1 | 2;
22
+ pool: string;
23
+ inputJetton: string | null;
24
+ outputJetton: string | null;
25
+ };
26
+ interface TonSwapCheckInput {
27
+ /** The built message's body (BoC hex) and destination. */
28
+ payloadHex: string;
29
+ targetAddress: string;
30
+ /** Value attached to the message, nanoTON. */
31
+ sendAmount: bigint;
32
+ /** The trader's wallet (signs; refunds and excesses return to it). */
33
+ trader: string;
34
+ /** Where the output must land. */
35
+ dest: string;
36
+ /** Quote fields the body must honour. */
37
+ inputUnits: string;
38
+ minOutputAmount: string;
39
+ inputJetton: string | null;
40
+ outputJetton: string | null;
41
+ steps: readonly {
42
+ protocol: string;
43
+ inputJetton: string | null | undefined;
44
+ outputJetton: string | null | undefined;
45
+ }[];
46
+ /** The integrator the quote was requested with: the only referral a body may name. */
47
+ integratorAddress?: string | null;
48
+ }
49
+ interface TonSwapCheckResult {
50
+ layout: "stonfi-v1" | "stonfi-v2" | "dedust-v1" | "dedust-v2";
51
+ /** On-chain minimum of the final hop. */
52
+ minOut: bigint;
53
+ legs: TonSwapLeg[];
54
+ }
55
+ /** A refusal with a stable, loggable reason code (never carries secrets). */
56
+ declare class TonSwapPayloadError extends Error {
57
+ readonly reason: string;
58
+ constructor(reason: string, detail?: string);
59
+ }
60
+ /**
61
+ * Decode and check a built TON same-chain swap message. Throws
62
+ * `TonSwapPayloadError` with a reason code on the first violated rule; returns
63
+ * the chain facts (`legs`) still to be confirmed by `validateTonSwapLeg`.
64
+ *
65
+ * Rules (all protocols): one route of single-protocol steps; the body's
66
+ * layout is the one the quoted protocol builds; the DEX call moves exactly the
67
+ * quoted input; the final receiver is the destination; refunds / excesses go
68
+ * to the trader; the final on-chain minimum is ≥ the quote's minOutputAmount;
69
+ * no referral other than the configured integrator; no trailing data.
70
+ */
71
+ declare function checkTonSwapPayload(ctx: TonSwapCheckInput): TonSwapCheckResult;
72
+
73
+ /**
74
+ * Persists HTLC secret preimages by quoteId between buildDeposit and the
75
+ * trackIntent poll that discloses them. Losing a secret does NOT lose funds —
76
+ * the escrow refunds after the HTLC timeout — but it does fail the swap.
77
+ */
78
+ interface HtlcSecretStore {
79
+ save(quoteId: string, secretsHex: string[]): void | Promise<void>;
80
+ load(quoteId: string): string[] | undefined | Promise<string[] | undefined>;
81
+ clear(quoteId: string): void | Promise<void>;
82
+ }
83
+ /**
84
+ * Persists the quote/build context between getQuote, buildDeposit and
85
+ * registerSignedOrder. On SERVERLESS these run on different instances, so the
86
+ * default in-memory map strands executions ("quote expired") — inject a
87
+ * durable store there. Values are JSON-safe (byte fields base64-encoded).
88
+ */
89
+ interface OmnistonQuoteStore {
90
+ save(quoteId: string, valueJson: string): void | Promise<void>;
91
+ load(quoteId: string): string | undefined | Promise<string | undefined>;
92
+ clear(quoteId: string): void | Promise<void>;
93
+ }
94
+ /** Default quote store — long-lived processes and tests only. */
95
+ declare function inMemoryQuoteStore(): OmnistonQuoteStore;
96
+ /** Default store — suitable for long-lived processes and tests only. */
97
+ declare function inMemorySecretStore(): HtlcSecretStore;
98
+ interface ObservableLike<T> {
99
+ subscribe(observer: {
100
+ next?: (value: T) => void;
101
+ error?: (err: unknown) => void;
102
+ complete?: () => void;
103
+ }): {
104
+ unsubscribe(): void;
105
+ };
106
+ }
107
+ /** Self-contained structural SDK types. Keeping these local prevents the
108
+ * optional Omniston peer from leaking into every consumer's declaration graph. */
109
+ interface AssetId {
110
+ chain: {
111
+ $case: string;
112
+ value: string | {
113
+ kind?: {
114
+ $case: string;
115
+ value?: unknown;
116
+ };
117
+ };
118
+ };
119
+ }
120
+ interface ChainAddress {
121
+ chain: {
122
+ $case: string;
123
+ value: string;
124
+ };
125
+ }
126
+ interface QuoteRequest {
127
+ inputAsset: AssetId;
128
+ outputAsset: AssetId;
129
+ amount: {
130
+ $case: string;
131
+ value: string;
132
+ };
133
+ settlementParams: {
134
+ params: {
135
+ $case: string;
136
+ value: Record<string, unknown>;
137
+ };
138
+ }[];
139
+ integratorAddress?: ChainAddress;
140
+ integratorFeePips?: number;
141
+ }
142
+ interface OmnistonQuote {
143
+ rfqId: string;
144
+ quoteId: string;
145
+ inputAsset: AssetId;
146
+ outputAsset: AssetId;
147
+ inputUnits: string;
148
+ outputUnits: string;
149
+ protocolFeeUnits?: string;
150
+ integratorFeeUnits?: string;
151
+ integratorAddress?: ChainAddress;
152
+ quoteTimestamp: number;
153
+ /** Total TON the trade needs on top of the input (swap settlement); omitted for gasless quotes. */
154
+ gasBudget?: string | undefined;
155
+ /** Omniston's estimate of the gas the route actually burns (swap settlement); the rest of the budget returns. */
156
+ estimatedGasConsumption?: string | undefined;
157
+ settlementData: {
158
+ $case: "order";
159
+ value: OrderSettlement;
160
+ } | {
161
+ $case: "swap";
162
+ value: SwapSettlement;
163
+ };
164
+ }
165
+ /** Order settlement (HTLC / escrow) — the cross-chain branch. */
166
+ interface OrderSettlement {
167
+ srcProtocolContractAddress: ChainAddress;
168
+ dstProtocolContractAddress?: ChainAddress;
169
+ srcInitialResolverAddress?: ChainAddress;
170
+ resolverSendsUnits: string;
171
+ srcHtlcSecurityDepositUnits?: string;
172
+ dstSecurityDepositUnits?: string;
173
+ tradeStartDeadline: number;
174
+ /**
175
+ * Seconds after the trader creates the position before a resolver must
176
+ * reserve it; after that the position is withdrawable by the trader (SDK
177
+ * docs). The TON escrow config carries it, so the payload validator binds
178
+ * the built escrow to the quoted value.
179
+ */
180
+ exclusivityTimeout?: number;
181
+ htlcHashingFunction?: string;
182
+ /** Fee profile the EVM order extension must mirror (EVM-source orders). */
183
+ protocolFeePips?: number;
184
+ integratorFeePips?: number;
185
+ /** Destination-chain wallet the protocol fee must be paid to (EVM-destination
186
+ * orders); the EVM output validator binds the escrow's fee split to it. */
187
+ protocolFeeRecipientAddress?: ChainAddress;
188
+ }
189
+ /** Swap settlement — immediate DEX routes, the TON same-chain branch. */
190
+ interface SwapSettlement {
191
+ routes: {
192
+ steps: {
193
+ inputAsset?: AssetId;
194
+ outputAsset?: AssetId;
195
+ chunks: {
196
+ protocol: string;
197
+ inputUnits: string;
198
+ outputUnits: string;
199
+ }[];
200
+ }[];
201
+ }[];
202
+ minOutputAmount: string;
203
+ recommendedMinOutputAmount?: string;
204
+ recommendedSlippagePips?: number;
205
+ priceImpactPips?: number | undefined;
206
+ }
207
+ type RfqEvent = {
208
+ $case: "ack";
209
+ value: {
210
+ rfqId: string;
211
+ };
212
+ } | {
213
+ $case: "quoteUpdated";
214
+ rfqId?: string;
215
+ value: OmnistonQuote;
216
+ } | {
217
+ $case: "noQuote";
218
+ rfqId?: string;
219
+ value: unknown;
220
+ } | {
221
+ $case: string;
222
+ value?: unknown;
223
+ };
224
+ interface EscrowMessage {
225
+ targetAddress: string;
226
+ sendAmount: string;
227
+ payload: string;
228
+ jettonWalletStateInit?: string | undefined;
229
+ }
230
+ interface OrderExecution {
231
+ index: number;
232
+ inputUnits: string;
233
+ outputUnits: string;
234
+ resolverSendsUnits: string;
235
+ secretHash?: Uint8Array | undefined;
236
+ inputPositionPhase?: string | undefined;
237
+ inputPositionAddress?: ChainAddress | undefined;
238
+ outputPositionPhase?: string | undefined;
239
+ outputPositionAddress?: ChainAddress | undefined;
240
+ }
241
+ interface OrderSnapshot {
242
+ status: string;
243
+ executions: OrderExecution[];
244
+ }
245
+ type OrderEvent = {
246
+ $case: "order";
247
+ value: OrderSnapshot;
248
+ } | {
249
+ $case: string;
250
+ value?: unknown;
251
+ };
252
+ type SwapTrackEvent = {
253
+ $case: "awaitingTransfer";
254
+ value?: unknown;
255
+ } | {
256
+ $case: "progress";
257
+ value: {
258
+ status: string;
259
+ outgoingTxHash?: string;
260
+ };
261
+ } | {
262
+ $case: string;
263
+ value?: unknown;
264
+ };
265
+ /** The slice of `Omniston` this provider uses — a real instance satisfies it. */
266
+ interface OmnistonClientLike {
267
+ requestForQuote(request: QuoteRequest): ObservableLike<RfqEvent>;
268
+ tonBuildEscrowTransfer(request: {
269
+ quoteId: string;
270
+ ownerSrcAddress: ChainAddress;
271
+ transferSrcAddress: ChainAddress;
272
+ refundSrcAddress: ChainAddress;
273
+ gasExcessAddress: ChainAddress;
274
+ traderDstAddress: ChainAddress;
275
+ htlcSecrets: {
276
+ secretMode: {
277
+ $case: "provided";
278
+ value: {
279
+ hashes: Uint8Array[];
280
+ };
281
+ };
282
+ };
283
+ }): Promise<{
284
+ messages: EscrowMessage[];
285
+ }>;
286
+ evmBuildOrderPayload(request: {
287
+ quoteId: string;
288
+ ownerSrcAddress: ChainAddress;
289
+ traderDstAddress?: ChainAddress;
290
+ htlcSecrets?: {
291
+ secretMode: {
292
+ $case: "provided";
293
+ value: {
294
+ hashes: Uint8Array[];
295
+ };
296
+ };
297
+ };
298
+ }): Promise<{
299
+ typedData: string;
300
+ orderExtension: Uint8Array;
301
+ serializedOrderDetails?: Uint8Array | undefined;
302
+ }>;
303
+ orderRegisterSignedOrder(request: {
304
+ quoteId: string;
305
+ ownerSrcAddress: ChainAddress;
306
+ signedOrder: {
307
+ order: {
308
+ $case: "evmV1";
309
+ value: {
310
+ encodedOrder: Uint8Array;
311
+ signature: Uint8Array;
312
+ orderExtension: Uint8Array;
313
+ };
314
+ };
315
+ };
316
+ serializedOrderDetails?: Uint8Array | undefined;
317
+ }): Promise<void>;
318
+ /** Swap settlement (TON↔TON). Optional so older injected clients keep working; without them same-chain swaps fail closed. */
319
+ tonBuildSwap?(request: {
320
+ quoteId: string;
321
+ transferSrcAddress: ChainAddress;
322
+ refundSrcAddress: ChainAddress;
323
+ gasExcessAddress: ChainAddress;
324
+ traderDstAddress: ChainAddress;
325
+ useRecommendedSlippage?: boolean;
326
+ }): Promise<{
327
+ messages: EscrowMessage[];
328
+ }>;
329
+ swapTrack?(request: {
330
+ quoteId: string;
331
+ traderAddress: ChainAddress;
332
+ outgoingTxQuery: string;
333
+ }): ObservableLike<SwapTrackEvent>;
334
+ orderTrack(request: {
335
+ quoteId: string;
336
+ traderAddress: ChainAddress;
337
+ }): ObservableLike<OrderEvent>;
338
+ orderDiscloseHtlcSecret(request: {
339
+ quoteId: string;
340
+ executionIndex: number;
341
+ secret: Uint8Array;
342
+ }): Promise<void>;
343
+ close?: () => void;
344
+ transport?: {
345
+ close(): void;
346
+ };
347
+ }
348
+ interface OmnistonProviderOptions {
349
+ /** Injected SDK client (tests); defaults to a lazy `new Omniston({apiUrl})`. */
350
+ client?: OmnistonClientLike;
351
+ /** WebSocket API URL; defaults to the public ston.fi endpoint. */
352
+ apiUrl?: string;
353
+ /** HTLC preimage persistence; defaults to in-memory (NOT serverless-safe). */
354
+ secretStore?: HtlcSecretStore;
355
+ /** Quote/build context persistence; defaults to in-memory (NOT serverless-safe). */
356
+ quoteStore?: OmnistonQuoteStore;
357
+ /** Maximum number of HTLC execution attempts covered by generated secrets. */
358
+ maxHtlcExecutions?: number;
359
+ /** Hard cap for resolver-requested TON gas/forward value (default: 2 TON). */
360
+ maxTonExecutionNano?: string;
361
+ /** Resolver competition window; primarily useful for deterministic tests. */
362
+ quoteSettleMs?: number;
363
+ /** Explicit constructor configuration; no deployment environment is read. */
364
+ enabled?: boolean;
365
+ /** Exact decimal USD cap; string form avoids binary-float rounding. */
366
+ maxUsd?: number | string;
367
+ integratorAddress?: string;
368
+ integratorFeePips?: number;
369
+ /** Independently trusted settlement contracts, keyed by CAIP-2 chain. */
370
+ trustedSettlementContracts?: Readonly<Record<string, readonly string[]>>;
371
+ /**
372
+ * Independently trusted EVM order protocols — the Omniston fork of the 1inch
373
+ * Limit Order Protocol an EVM-source order is signed against and that moves
374
+ * the input token on fill — keyed by CAIP-2 chain. Kept apart from
375
+ * `trustedSettlementContracts` because one address plays different roles on
376
+ * different chains (0xafCF… is the escrow factory on Ethereum and the order
377
+ * protocol on Polygon). EVM→TON is advertised only for chains listed here.
378
+ */
379
+ trustedEvmOrderProtocols?: Readonly<Record<string, readonly string[]>>;
380
+ /**
381
+ * RPC-backed TON jetton-wallet verification. A TON-source order is rejected
382
+ * when this hook is absent or does not prove that `walletAddress` belongs to
383
+ * the quoted jetton master for `ownerAddress`.
384
+ */
385
+ validateTonJettonWallet?: (input: {
386
+ ownerAddress: string;
387
+ jettonMasterAddress: string;
388
+ walletAddress: string;
389
+ }) => boolean | Promise<boolean>;
390
+ /**
391
+ * Independent semantic verifier for the Omniston TON escrow forward cell.
392
+ * The resolver-built BoC is never accepted through byte-search heuristics.
393
+ * A TON-source route is disabled unless this hook parses the documented
394
+ * contract schema and proves every expected field below in its exact slot.
395
+ */
396
+ /**
397
+ * TON↔TON swap settlement: independently confirm that the contract a swap
398
+ * message pays into — directly for native GRAM, as the jetton-transfer
399
+ * destination for jettons — is a DEX contract of a protocol the quote named
400
+ * (e.g. by its code interface on an indexer). Without it, same-chain TON
401
+ * swaps are not advertised.
402
+ */
403
+ validateTonSwapTarget?: (input: {
404
+ address: string;
405
+ protocols: readonly string[];
406
+ }) => Promise<boolean> | boolean;
407
+ /**
408
+ * TON↔TON swap settlement (scan F11): confirm one chain fact the decoded
409
+ * swap body depends on — that a STON.fi hop's ask wallet is its router's
410
+ * wallet of the quoted output (and, for native input, that the pTON wallet
411
+ * the message pays belongs to that router), or that a DeDust pool trades the
412
+ * quoted pair. `createOmnistonTonValidators` supplies it. When absent the
413
+ * decoded-body rules still apply and each skipped leg is traced as
414
+ * `ton-swap-payload legs-unverified`; STON.fi v1 native input (pTON v1) is
415
+ * refused without it.
416
+ */
417
+ validateTonSwapLeg?: (leg: TonSwapLeg) => Promise<boolean> | boolean;
418
+ /**
419
+ * TON↔TON swap settlement (scan F11): what a built swap body that fails the
420
+ * decoder (receiver ≠ destination, refund/excess ≠ trader, on-chain minimum
421
+ * below the quote, unknown layout, unverifiable leg) does. "enforce"
422
+ * (default) refuses the build; "report" traces `ton-swap-payload <reason>`
423
+ * and still builds — a rollout escape hatch, not a steady state.
424
+ */
425
+ tonSwapPayloadCheck?: "report" | "enforce";
426
+ validateTonEscrowPayload?: (input: {
427
+ payloadBocHex: string;
428
+ forwardPayloadBocHex: string;
429
+ quoteId: string;
430
+ inputUnits: string;
431
+ resolverSendsUnits: string;
432
+ srcHtlcSecurityDepositUnits: string;
433
+ protocolAddress: string;
434
+ ownerAddress: string;
435
+ destinationChain: string;
436
+ destinationAddress: string;
437
+ outputTokenAddress: string;
438
+ initialResolverAddress: string;
439
+ secretHashes: readonly Uint8Array[];
440
+ hashingFunction?: string;
441
+ /** The quote's `exclusivityTimeout` (seconds) the escrow config must carry. */
442
+ exclusivityTimeout: number;
443
+ }) => boolean | Promise<boolean>;
444
+ /**
445
+ * RPC-backed proof of the destination EVM escrow. The tracking feed is only
446
+ * a discovery hint: no HTLC preimage is disclosed until this hook proves the
447
+ * independently finalized on-chain position matches the signed quote.
448
+ */
449
+ validateEvmOutputPosition?: (input: {
450
+ chain: string;
451
+ positionAddress: string;
452
+ factoryAddress: string;
453
+ quoteTimestamp: number;
454
+ executionIndex: number;
455
+ recipientAddress: string;
456
+ outputTokenAddress: string;
457
+ inputUnits: string;
458
+ outputUnits: string;
459
+ resolverSendsUnits: string;
460
+ srcHtlcSecurityDepositUnits: string;
461
+ dstSecurityDepositUnits: string;
462
+ protocolFeeUnits: string;
463
+ integratorFeeUnits: string;
464
+ integratorAddress?: string;
465
+ /** The quote's `settlementData.protocolFeeRecipientAddress` (destination chain). */
466
+ protocolFeeRecipientAddress?: string;
467
+ secretHash: Uint8Array;
468
+ }) => boolean | Promise<boolean>;
469
+ /**
470
+ * RPC-backed proof of the finalized EVM source position (EVM→TON). The
471
+ * tracking feed only hints at the address; no secret is disclosed until this
472
+ * hook proves — from the trusted factory's own `SrcEscrowCreated` event, the
473
+ * deterministic escrow address and the escrow's balances — that the
474
+ * trader's FULL input is locked for this hashlock under the quoted terms
475
+ * (owner, token, amount, resolver, deposit, timelocks, TON output amount).
476
+ */
477
+ validateEvmInputPosition?: (input: {
478
+ chain: string;
479
+ positionAddress: string;
480
+ factoryAddress: string;
481
+ orderProtocolAddress: string;
482
+ ownerAddress: string;
483
+ resolverAddress: string;
484
+ inputTokenAddress: string;
485
+ inputUnits: string;
486
+ resolverSendsUnits: string;
487
+ srcHtlcSecurityDepositUnits: string;
488
+ quoteTimestamp: number;
489
+ secretHash: Uint8Array;
490
+ /** EVM destination only: the escrow event's destination complement must name this chain, token and deposit. */
491
+ destinationChainId?: number;
492
+ destinationTokenAddress?: string;
493
+ dstSecurityDepositUnits?: string;
494
+ }) => boolean | Promise<boolean>;
495
+ /**
496
+ * Indexer/RPC-backed proof of the TON output position (EVM→TON): deployed by
497
+ * the trusted factory for THIS quote, pinned position/escrow code, hashlock,
498
+ * recipient, amount, security deposit, and a cancellation boundary still far
499
+ * enough away to complete. The tracking feed is only a discovery hint.
500
+ */
501
+ validateTonOutputPosition?: (input: {
502
+ positionAddress: string;
503
+ protocolAddress: string;
504
+ outputJettonMasterAddress: string;
505
+ recipientAddress: string;
506
+ quoteId: string;
507
+ quoteTimestamp: number;
508
+ inputUnits: string;
509
+ outputUnits: string;
510
+ resolverSendsUnits: string;
511
+ dstSecurityDepositUnits: string;
512
+ secretHash: Uint8Array;
513
+ }) => boolean | Promise<boolean>;
514
+ /**
515
+ * EVM destination: find the delivery transaction — the destination escrow's
516
+ * payout to the recipient — so a completed order carries `destTxHash`.
517
+ * Omniston's tracking feed names the escrow but not that transaction.
518
+ */
519
+ locateEvmDelivery?: (input: {
520
+ chain: string;
521
+ positionAddress: string;
522
+ recipientAddress: string;
523
+ tokenAddress: string;
524
+ minUnits: string;
525
+ }) => Promise<string | null>;
526
+ /**
527
+ * TON destination: find the delivery — the output position's jetton transfer
528
+ * to the recipient — so a completed EVM → TON order carries `destTxHash` in
529
+ * the form the TON history source uses (tonapi event id). Without it the
530
+ * wallet's feed cannot pair the TON receive with the swap.
531
+ */
532
+ locateTonDelivery?: (input: {
533
+ positionAddress: string;
534
+ recipientAddress: string;
535
+ jettonMasterAddress: string;
536
+ minUnits: string;
537
+ }) => Promise<string | null>;
538
+ /** Close an injected client when the provider closes (default: caller owns it). */
539
+ closeInjectedClient?: boolean;
540
+ /**
541
+ * Diagnostics: why a poll did not disclose (`disclosure-skipped` with the gate
542
+ * and its fields, `validator-refused`, `validator-threw`) and when it did
543
+ * (`secret-disclosed`). Never carries secrets. Wire it to your logger: a
544
+ * silent "pending" cost a live order its 2-minute window (2026-10-20).
545
+ */
546
+ trace?: (event: string, details?: Record<string, unknown>) => void;
547
+ }
548
+ /** EIP-712 typed data → the ABI-encoded order struct `SignedOrderEvmV1` wants.
549
+ * Structs referenced in `types` become tuples, recursively. */
550
+ declare function encodeTypedMessage(td: {
551
+ types: Record<string, {
552
+ name: string;
553
+ type: string;
554
+ }[]>;
555
+ primaryType: string;
556
+ message: unknown;
557
+ }): Uint8Array;
558
+ /**
559
+ * Strict decoder for the currently observed Omniston v1beta8 EVM→TON 1inch
560
+ * extension profile. It deliberately rejects unknown auction/fee/timelock
561
+ * profiles: signing a merely well-formed extension is not enough because the
562
+ * resolver-controlled tail contains the actual on-chain HTLC terms.
563
+ *
564
+ * This binds what the wallet signs to the quote; it does not by itself make
565
+ * the swap complete. Secret disclosure additionally needs the independently
566
+ * finalized EVM source-fill and TON output-position proofs (trackIntent).
567
+ * `dstSecurityDepositUnits` is the value the EVM deposits word carries — for a
568
+ * TON destination that word is 0 (the TON deposit is bound in the TON position).
569
+ */
570
+ declare function validateEvmToTonOrderExtension(extension: Uint8Array, expected: {
571
+ quoteId: string;
572
+ quoteTimestamp: number;
573
+ tradeStartDeadline: number;
574
+ protocolFeePips: number;
575
+ integratorFeePips: number;
576
+ initialResolverAddress: string;
577
+ outputTokenAddress: string;
578
+ traderDstAddress: string;
579
+ takerAsset: string;
580
+ srcSecurityDepositUnits: string;
581
+ dstSecurityDepositUnits: string;
582
+ secretHash: Uint8Array;
583
+ trustedTarget: (address: string) => boolean;
584
+ /** EVM destination (EIP-155 id): ExtraDataArgs carry it and the destination
585
+ * ERC-20 (`outputTokenAddress`, `traderDstAddress` are EVM then). Absent = TON. */
586
+ dstChainId?: number;
587
+ }): Promise<void>;
588
+ declare function omnistonProvider(opts?: OmnistonProviderOptions): CrossChainProvider;
589
+
590
+ export { type HtlcSecretStore, type OmnistonClientLike, type OmnistonProviderOptions, type OmnistonQuoteStore, TON_SWAP_PROTOCOL_LAYOUTS, type TonSwapCheckInput, type TonSwapCheckResult, type TonSwapLeg, TonSwapPayloadError, checkTonSwapPayload, encodeTypedMessage, inMemoryQuoteStore, inMemorySecretStore, omnistonProvider, validateEvmToTonOrderExtension };