@anywalletkit/protocol-swap2-omniston 0.3.0 → 0.4.0

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.
@@ -1,652 +1,2 @@
1
- import { RemotePins, CrossChainProvider, Quote, UnsignedTx, QuoteParams } 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
- * Save only if nothing is stored under `quoteId` yet, atomically (Redis `SET NX`, a KV conditional put): true when
95
- * this call wrote it. A quote id is the platform's choice, so a context must never be overwritten by another user's
96
- * quote under the same id (scan 2026-10-27 modules, F27). Without it the provider checks then saves — fine for one
97
- * process, racy across instances.
98
- */
99
- claim?(quoteId: string, valueJson: string): boolean | Promise<boolean>;
100
- }
101
- /** Default quote store — long-lived processes and tests only. */
102
- declare function inMemoryQuoteStore(): OmnistonQuoteStore;
103
- /** Default store — suitable for long-lived processes and tests only. */
104
- declare function inMemorySecretStore(): HtlcSecretStore;
105
- interface ObservableLike<T> {
106
- subscribe(observer: {
107
- next?: (value: T) => void;
108
- error?: (err: unknown) => void;
109
- complete?: () => void;
110
- }): {
111
- unsubscribe(): void;
112
- };
113
- }
114
- /** Self-contained structural SDK types. Keeping these local prevents the
115
- * optional Omniston peer from leaking into every consumer's declaration graph. */
116
- interface AssetId {
117
- chain: {
118
- $case: string;
119
- value: string | {
120
- kind?: {
121
- $case: string;
122
- value?: unknown;
123
- };
124
- };
125
- };
126
- }
127
- interface ChainAddress {
128
- chain: {
129
- $case: string;
130
- value: string;
131
- };
132
- }
133
- interface QuoteRequest {
134
- inputAsset: AssetId;
135
- outputAsset: AssetId;
136
- amount: {
137
- $case: string;
138
- value: string;
139
- };
140
- settlementParams: {
141
- params: {
142
- $case: string;
143
- value: Record<string, unknown>;
144
- };
145
- }[];
146
- integratorAddress?: ChainAddress;
147
- integratorFeePips?: number;
148
- }
149
- interface OmnistonQuote {
150
- rfqId: string;
151
- quoteId: string;
152
- inputAsset: AssetId;
153
- outputAsset: AssetId;
154
- inputUnits: string;
155
- outputUnits: string;
156
- protocolFeeUnits?: string;
157
- integratorFeeUnits?: string;
158
- integratorAddress?: ChainAddress;
159
- quoteTimestamp: number;
160
- /** Total TON the trade needs on top of the input (swap settlement); omitted for gasless quotes. */
161
- gasBudget?: string | undefined;
162
- /** Omniston's estimate of the gas the route actually burns (swap settlement); the rest of the budget returns. */
163
- estimatedGasConsumption?: string | undefined;
164
- settlementData: {
165
- $case: "order";
166
- value: OrderSettlement;
167
- } | {
168
- $case: "swap";
169
- value: SwapSettlement;
170
- };
171
- }
172
- /** Order settlement (HTLC / escrow) — the cross-chain branch. */
173
- interface OrderSettlement {
174
- srcProtocolContractAddress: ChainAddress;
175
- dstProtocolContractAddress?: ChainAddress;
176
- srcInitialResolverAddress?: ChainAddress;
177
- resolverSendsUnits: string;
178
- srcHtlcSecurityDepositUnits?: string;
179
- dstSecurityDepositUnits?: string;
180
- tradeStartDeadline: number;
181
- /**
182
- * Seconds after the trader creates the position before a resolver must
183
- * reserve it; after that the position is withdrawable by the trader (SDK
184
- * docs). The TON escrow config carries it, so the payload validator binds
185
- * the built escrow to the quoted value.
186
- */
187
- exclusivityTimeout?: number;
188
- htlcHashingFunction?: string;
189
- /** Fee profile the EVM order extension must mirror (EVM-source orders). */
190
- protocolFeePips?: number;
191
- integratorFeePips?: number;
192
- /** Destination-chain wallet the protocol fee must be paid to (EVM-destination
193
- * orders); the EVM output validator binds the escrow's fee split to it. */
194
- protocolFeeRecipientAddress?: ChainAddress;
195
- }
196
- /** Swap settlement — immediate DEX routes, the TON same-chain branch. */
197
- interface SwapSettlement {
198
- routes: {
199
- steps: {
200
- inputAsset?: AssetId;
201
- outputAsset?: AssetId;
202
- chunks: {
203
- protocol: string;
204
- inputUnits: string;
205
- outputUnits: string;
206
- }[];
207
- }[];
208
- }[];
209
- minOutputAmount: string;
210
- recommendedMinOutputAmount?: string;
211
- recommendedSlippagePips?: number;
212
- priceImpactPips?: number | undefined;
213
- }
214
- type RfqEvent = {
215
- $case: "ack";
216
- value: {
217
- rfqId: string;
218
- };
219
- } | {
220
- $case: "quoteUpdated";
221
- rfqId?: string;
222
- value: OmnistonQuote;
223
- } | {
224
- $case: "noQuote";
225
- rfqId?: string;
226
- value: unknown;
227
- } | {
228
- $case: string;
229
- value?: unknown;
230
- };
231
- interface EscrowMessage {
232
- targetAddress: string;
233
- sendAmount: string;
234
- payload: string;
235
- jettonWalletStateInit?: string | undefined;
236
- }
237
- interface OrderExecution {
238
- index: number;
239
- inputUnits: string;
240
- outputUnits: string;
241
- resolverSendsUnits: string;
242
- secretHash?: Uint8Array | undefined;
243
- inputPositionPhase?: string | undefined;
244
- inputPositionAddress?: ChainAddress | undefined;
245
- outputPositionPhase?: string | undefined;
246
- outputPositionAddress?: ChainAddress | undefined;
247
- }
248
- interface OrderSnapshot {
249
- status: string;
250
- executions: OrderExecution[];
251
- }
252
- type OrderEvent = {
253
- $case: "order";
254
- value: OrderSnapshot;
255
- } | {
256
- $case: string;
257
- value?: unknown;
258
- };
259
- type SwapTrackEvent = {
260
- $case: "awaitingTransfer";
261
- value?: unknown;
262
- } | {
263
- $case: "progress";
264
- value: {
265
- status: string;
266
- outgoingTxHash?: string;
267
- };
268
- } | {
269
- $case: string;
270
- value?: unknown;
271
- };
272
- /** The slice of `Omniston` this provider uses — a real instance satisfies it. */
273
- interface OmnistonClientLike {
274
- requestForQuote(request: QuoteRequest): ObservableLike<RfqEvent>;
275
- tonBuildEscrowTransfer(request: {
276
- quoteId: string;
277
- ownerSrcAddress: ChainAddress;
278
- transferSrcAddress: ChainAddress;
279
- refundSrcAddress: ChainAddress;
280
- gasExcessAddress: ChainAddress;
281
- traderDstAddress: ChainAddress;
282
- htlcSecrets: {
283
- secretMode: {
284
- $case: "provided";
285
- value: {
286
- hashes: Uint8Array[];
287
- };
288
- };
289
- };
290
- }): Promise<{
291
- messages: EscrowMessage[];
292
- }>;
293
- evmBuildOrderPayload(request: {
294
- quoteId: string;
295
- ownerSrcAddress: ChainAddress;
296
- traderDstAddress?: ChainAddress;
297
- htlcSecrets?: {
298
- secretMode: {
299
- $case: "provided";
300
- value: {
301
- hashes: Uint8Array[];
302
- };
303
- };
304
- };
305
- }): Promise<{
306
- typedData: string;
307
- orderExtension: Uint8Array;
308
- serializedOrderDetails?: Uint8Array | undefined;
309
- }>;
310
- orderRegisterSignedOrder(request: {
311
- quoteId: string;
312
- ownerSrcAddress: ChainAddress;
313
- signedOrder: {
314
- order: {
315
- $case: "evmV1";
316
- value: {
317
- encodedOrder: Uint8Array;
318
- signature: Uint8Array;
319
- orderExtension: Uint8Array;
320
- };
321
- };
322
- };
323
- serializedOrderDetails?: Uint8Array | undefined;
324
- }): Promise<void>;
325
- /** Swap settlement (TON↔TON). Optional so older injected clients keep working; without them same-chain swaps fail closed. */
326
- tonBuildSwap?(request: {
327
- quoteId: string;
328
- transferSrcAddress: ChainAddress;
329
- refundSrcAddress: ChainAddress;
330
- gasExcessAddress: ChainAddress;
331
- traderDstAddress: ChainAddress;
332
- useRecommendedSlippage?: boolean;
333
- }): Promise<{
334
- messages: EscrowMessage[];
335
- }>;
336
- swapTrack?(request: {
337
- quoteId: string;
338
- traderAddress: ChainAddress;
339
- outgoingTxQuery: string;
340
- }): ObservableLike<SwapTrackEvent>;
341
- orderTrack(request: {
342
- quoteId: string;
343
- traderAddress: ChainAddress;
344
- }): ObservableLike<OrderEvent>;
345
- orderDiscloseHtlcSecret(request: {
346
- quoteId: string;
347
- executionIndex: number;
348
- secret: Uint8Array;
349
- }): Promise<void>;
350
- close?: () => void;
351
- transport?: {
352
- close(): void;
353
- };
354
- }
355
- interface OmnistonProviderOptions {
356
- /** Injected SDK client (tests); defaults to a lazy `new Omniston({apiUrl})`. */
357
- client?: OmnistonClientLike;
358
- /** WebSocket API URL; defaults to the public ston.fi endpoint. */
359
- apiUrl?: string;
360
- /** HTLC preimage persistence; defaults to in-memory (NOT serverless-safe). */
361
- secretStore?: HtlcSecretStore;
362
- /** Quote/build context persistence; defaults to in-memory (NOT serverless-safe). */
363
- quoteStore?: OmnistonQuoteStore;
364
- /** Maximum number of HTLC execution attempts covered by generated secrets. */
365
- maxHtlcExecutions?: number;
366
- /** Hard cap for resolver-requested TON gas/forward value (default: 2 TON). */
367
- maxTonExecutionNano?: string;
368
- /** Resolver competition window; primarily useful for deterministic tests. */
369
- quoteSettleMs?: number;
370
- /** Explicit constructor configuration; no deployment environment is read. */
371
- enabled?: boolean;
372
- /** Exact decimal USD cap; string form avoids binary-float rounding. */
373
- maxUsd?: number | string;
374
- integratorAddress?: string;
375
- integratorFeePips?: number;
376
- /** Independently trusted settlement contracts, keyed by CAIP-2 chain. */
377
- trustedSettlementContracts?: Readonly<Record<string, readonly string[]>>;
378
- /**
379
- * Independently trusted EVM order protocols — the Omniston fork of the 1inch
380
- * Limit Order Protocol an EVM-source order is signed against and that moves
381
- * the input token on fill — keyed by CAIP-2 chain. Kept apart from
382
- * `trustedSettlementContracts` because one address plays different roles on
383
- * different chains (0xafCF… is the escrow factory on Ethereum and the order
384
- * protocol on Polygon). EVM→TON is advertised only for chains listed here.
385
- */
386
- trustedEvmOrderProtocols?: Readonly<Record<string, readonly string[]>>;
387
- /**
388
- * RPC-backed TON jetton-wallet verification. A TON-source order is rejected
389
- * when this hook is absent or does not prove that `walletAddress` belongs to
390
- * the quoted jetton master for `ownerAddress`.
391
- */
392
- validateTonJettonWallet?: (input: {
393
- ownerAddress: string;
394
- jettonMasterAddress: string;
395
- walletAddress: string;
396
- }) => boolean | Promise<boolean>;
397
- /**
398
- * Independent semantic verifier for the Omniston TON escrow forward cell.
399
- * The resolver-built BoC is never accepted through byte-search heuristics.
400
- * A TON-source route is disabled unless this hook parses the documented
401
- * contract schema and proves every expected field below in its exact slot.
402
- */
403
- /**
404
- * TON↔TON swap settlement: independently confirm that the contract a swap
405
- * message pays into — directly for native GRAM, as the jetton-transfer
406
- * destination for jettons — is a DEX contract of a protocol the quote named
407
- * (e.g. by its code interface on an indexer). Without it, same-chain TON
408
- * swaps are not advertised.
409
- */
410
- validateTonSwapTarget?: (input: {
411
- address: string;
412
- protocols: readonly string[];
413
- }) => Promise<boolean> | boolean;
414
- /**
415
- * TON↔TON swap settlement (scan F11): confirm one chain fact the decoded
416
- * swap body depends on — that a STON.fi hop's ask wallet is its router's
417
- * wallet of the quoted output (and, for native input, that the pTON wallet
418
- * the message pays belongs to that router), or that a DeDust pool trades the
419
- * quoted pair. `createOmnistonTonValidators` supplies it. When absent the
420
- * decoded-body rules still apply and each skipped leg is traced as
421
- * `ton-swap-payload legs-unverified`; STON.fi v1 native input (pTON v1) is
422
- * refused without it.
423
- */
424
- validateTonSwapLeg?: (leg: TonSwapLeg) => Promise<boolean> | boolean;
425
- /**
426
- * TON↔TON swap settlement (scan F11): what a built swap body that fails the
427
- * decoder (receiver ≠ destination, refund/excess ≠ trader, on-chain minimum
428
- * below the quote, unknown layout, unverifiable leg) does. "enforce"
429
- * (default) refuses the build; "report" traces `ton-swap-payload <reason>`
430
- * and still builds — a rollout escape hatch, not a steady state.
431
- */
432
- tonSwapPayloadCheck?: "report" | "enforce";
433
- validateTonEscrowPayload?: (input: {
434
- payloadBocHex: string;
435
- forwardPayloadBocHex: string;
436
- quoteId: string;
437
- inputUnits: string;
438
- resolverSendsUnits: string;
439
- srcHtlcSecurityDepositUnits: string;
440
- protocolAddress: string;
441
- ownerAddress: string;
442
- destinationChain: string;
443
- destinationAddress: string;
444
- outputTokenAddress: string;
445
- initialResolverAddress: string;
446
- secretHashes: readonly Uint8Array[];
447
- hashingFunction?: string;
448
- /** The quote's `exclusivityTimeout` (seconds) the escrow config must carry. */
449
- exclusivityTimeout: number;
450
- }) => boolean | Promise<boolean>;
451
- /**
452
- * RPC-backed proof of the destination EVM escrow. The tracking feed is only
453
- * a discovery hint: no HTLC preimage is disclosed until this hook proves the
454
- * independently finalized on-chain position matches the signed quote.
455
- */
456
- validateEvmOutputPosition?: (input: {
457
- chain: string;
458
- positionAddress: string;
459
- factoryAddress: string;
460
- quoteTimestamp: number;
461
- executionIndex: number;
462
- recipientAddress: string;
463
- outputTokenAddress: string;
464
- inputUnits: string;
465
- outputUnits: string;
466
- resolverSendsUnits: string;
467
- srcHtlcSecurityDepositUnits: string;
468
- dstSecurityDepositUnits: string;
469
- protocolFeeUnits: string;
470
- integratorFeeUnits: string;
471
- integratorAddress?: string;
472
- /** The quote's `settlementData.protocolFeeRecipientAddress` (destination chain). */
473
- protocolFeeRecipientAddress?: string;
474
- secretHash: Uint8Array;
475
- }) => boolean | Promise<boolean>;
476
- /**
477
- * RPC-backed proof of the finalized EVM source position (EVM→TON). The
478
- * tracking feed only hints at the address; no secret is disclosed until this
479
- * hook proves — from the trusted factory's own `SrcEscrowCreated` event, the
480
- * deterministic escrow address and the escrow's balances — that the
481
- * trader's FULL input is locked for this hashlock under the quoted terms
482
- * (owner, token, amount, resolver, deposit, timelocks, TON output amount).
483
- */
484
- validateEvmInputPosition?: (input: {
485
- chain: string;
486
- positionAddress: string;
487
- factoryAddress: string;
488
- orderProtocolAddress: string;
489
- ownerAddress: string;
490
- resolverAddress: string;
491
- inputTokenAddress: string;
492
- inputUnits: string;
493
- resolverSendsUnits: string;
494
- srcHtlcSecurityDepositUnits: string;
495
- quoteTimestamp: number;
496
- secretHash: Uint8Array;
497
- /** EVM destination only: the escrow event's destination complement must name this chain, token and deposit. */
498
- destinationChainId?: number;
499
- destinationTokenAddress?: string;
500
- dstSecurityDepositUnits?: string;
501
- }) => boolean | Promise<boolean>;
502
- /**
503
- * Indexer/RPC-backed proof of the TON output position (EVM→TON): deployed by
504
- * the trusted factory for THIS quote, pinned position/escrow code, hashlock,
505
- * recipient, amount, security deposit, and a cancellation boundary still far
506
- * enough away to complete. The tracking feed is only a discovery hint.
507
- */
508
- validateTonOutputPosition?: (input: {
509
- positionAddress: string;
510
- protocolAddress: string;
511
- outputJettonMasterAddress: string;
512
- recipientAddress: string;
513
- quoteId: string;
514
- quoteTimestamp: number;
515
- inputUnits: string;
516
- outputUnits: string;
517
- resolverSendsUnits: string;
518
- dstSecurityDepositUnits: string;
519
- secretHash: Uint8Array;
520
- }) => boolean | Promise<boolean>;
521
- /**
522
- * EVM destination: find the delivery transaction — the destination escrow's
523
- * payout to the recipient — so a completed order carries `destTxHash`.
524
- * Omniston's tracking feed names the escrow but not that transaction.
525
- */
526
- locateEvmDelivery?: (input: {
527
- chain: string;
528
- positionAddress: string;
529
- recipientAddress: string;
530
- tokenAddress: string;
531
- minUnits: string;
532
- }) => Promise<string | null>;
533
- /**
534
- * TON destination: find the delivery — the output position's jetton transfer
535
- * to the recipient — so a completed EVM → TON order carries `destTxHash` in
536
- * the form the TON history source uses (tonapi event id). Without it the
537
- * wallet's feed cannot pair the TON receive with the swap.
538
- */
539
- locateTonDelivery?: (input: {
540
- positionAddress: string;
541
- recipientAddress: string;
542
- jettonMasterAddress: string;
543
- minUnits: string;
544
- }) => Promise<string | null>;
545
- /** Close an injected client when the provider closes (default: caller owns it). */
546
- closeInjectedClient?: boolean;
547
- /**
548
- * Diagnostics: why a poll did not disclose (`disclosure-skipped` with the gate
549
- * and its fields, `validator-refused`, `validator-threw`) and when it did
550
- * (`secret-disclosed`). Never carries secrets. Wire it to your logger: a
551
- * silent "pending" cost a live order its 2-minute window (2026-10-20).
552
- */
553
- trace?: (event: string, details?: Record<string, unknown>) => void;
554
- }
555
- /** EIP-712 typed data → the ABI-encoded order struct `SignedOrderEvmV1` wants.
556
- * Structs referenced in `types` become tuples, recursively. */
557
- declare function encodeTypedMessage(td: {
558
- types: Record<string, {
559
- name: string;
560
- type: string;
561
- }[]>;
562
- primaryType: string;
563
- message: unknown;
564
- }): Uint8Array;
565
- /**
566
- * Strict decoder for the currently observed Omniston v1beta8 EVM→TON 1inch
567
- * extension profile. It deliberately rejects unknown auction/fee/timelock
568
- * profiles: signing a merely well-formed extension is not enough because the
569
- * resolver-controlled tail contains the actual on-chain HTLC terms.
570
- *
571
- * This binds what the wallet signs to the quote; it does not by itself make
572
- * the swap complete. Secret disclosure additionally needs the independently
573
- * finalized EVM source-fill and TON output-position proofs (trackIntent).
574
- * `dstSecurityDepositUnits` is the value the EVM deposits word carries — for a
575
- * TON destination that word is 0 (the TON deposit is bound in the TON position).
576
- */
577
- declare function validateEvmToTonOrderExtension(extension: Uint8Array, expected: {
578
- quoteId: string;
579
- quoteTimestamp: number;
580
- tradeStartDeadline: number;
581
- protocolFeePips: number;
582
- integratorFeePips: number;
583
- initialResolverAddress: string;
584
- outputTokenAddress: string;
585
- traderDstAddress: string;
586
- takerAsset: string;
587
- srcSecurityDepositUnits: string;
588
- dstSecurityDepositUnits: string;
589
- secretHash: Uint8Array;
590
- trustedTarget: (address: string) => boolean;
591
- /** EVM destination (EIP-155 id): ExtraDataArgs carry it and the destination
592
- * ERC-20 (`outputTokenAddress`, `traderDstAddress` are EVM then). Absent = TON. */
593
- dstChainId?: number;
594
- }): Promise<void>;
595
- /**
596
- * The EVM order checks the provider runs on every build, exported so an app that holds the quote's settlement data
597
- * can run them itself (scan 2026-10-27 modules, F4): the 1inch Limit Order Protocol v4 domain on the settlement
598
- * contract and chain, the exact Order schema, this owner as maker, the resolver as receiver, the input asset and
599
- * amount, single-fill traits, the salt committing the order extension and the expiry at the trade-start deadline.
600
- * Throws when any of it does not hold.
601
- */
602
- declare function validateEvmTypedOrder(td: unknown, expected: {
603
- chainId: number;
604
- settlementContract: string;
605
- owner: string;
606
- receiver: string;
607
- makerAsset: string;
608
- makingAmount: string;
609
- takingAmount: string;
610
- orderExtension: Uint8Array;
611
- quoteTimestamp: number;
612
- tradeStartDeadline: number;
613
- }): asserts td is {
614
- domain: {
615
- verifyingContract: string;
616
- chainId: string | number;
617
- };
618
- types: Record<string, {
619
- name: string;
620
- type: string;
621
- }[]>;
622
- primaryType: string;
623
- message: Record<string, unknown>;
624
- };
625
- /**
626
- * The app's side of `remoteProvider({name: "omniston", baseUrl, ...omnistonPins(trustedEvmOrderProtocols)})`: the
627
- * audited order-protocol contracts per EVM chain — the list the provider's `trustedEvmOrderProtocols` takes — are the
628
- * only spenders, and so the only EIP-712 verifying contracts, a remote typed order may name (scan 2026-10-27 modules,
629
- * F4). Omniston's EVM orders call no contract from the wallet: there are no call targets.
630
- */
631
- declare function omnistonPins(trustedEvmOrderProtocols: Readonly<Record<string, readonly string[]>>): RemotePins;
632
- /**
633
- * The app's check of a remote Omniston TON swap build, for `remoteProvider({name: "omniston", baseUrl, verifyBuild:
634
- * omnistonVerifyBuild({validateTonSwapTarget, validateTonSwapLeg})})` (scan 2026-10-27 modules, F7/F13/F18/F19): the
635
- * body is opened with `checkTonSwapPayload` against the app's own request — receiver, refund / excess to the trader,
636
- * the on-chain minimum, the input — and the DEX it pays is confirmed with the app's validators (the same hooks the
637
- * provider takes; `createOmnistonTonValidators` builds them). Any other cell body (a TON → EVM escrow) cannot be
638
- * checked without the quote's settlement data and is refused; EVM typed orders pass through to the engine's own
639
- * order checks. The reason it fails, or null.
640
- */
641
- declare function omnistonVerifyBuild(hooks: {
642
- validateTonSwapTarget: (input: {
643
- address: string;
644
- protocols: readonly string[];
645
- }) => Promise<boolean> | boolean;
646
- validateTonSwapLeg?: (leg: TonSwapLeg) => Promise<boolean> | boolean;
647
- /** The integrator your backend's Omniston provider uses: the only referral a body may name. */
648
- integratorAddress?: string | null;
649
- }): (quote: Quote, tx: UnsignedTx, params?: QuoteParams) => Promise<string | null>;
650
- declare function omnistonProvider(opts?: OmnistonProviderOptions): CrossChainProvider;
651
-
652
- export { type AssetId, type ChainAddress, type EscrowMessage, type HtlcSecretStore, type ObservableLike, type OmnistonClientLike, type OmnistonProviderOptions, type OmnistonQuote, type OmnistonQuoteStore, type OrderEvent, type OrderExecution, type OrderSettlement, type OrderSnapshot, type QuoteRequest, type RfqEvent, type SwapSettlement, type SwapTrackEvent, TON_SWAP_PROTOCOL_LAYOUTS, type TonSwapCheckInput, type TonSwapCheckResult, type TonSwapLeg, TonSwapPayloadError, checkTonSwapPayload, encodeTypedMessage, inMemoryQuoteStore, inMemorySecretStore, omnistonPins, omnistonProvider, omnistonVerifyBuild, validateEvmToTonOrderExtension, validateEvmTypedOrder };
1
+ export { A as AssetId, C as ChainAddress, E as EscrowMessage, H as HtlcSecretStore, O as ObservableLike, a as OmnistonClientLike, b as OmnistonProviderOptions, c as OmnistonQuote, d as OmnistonQuoteStore, e as OrderEvent, f as OrderExecution, g as OrderSettlement, h as OrderSnapshot, Q as QuoteRequest, R as RfqEvent, S as SwapSettlement, i as SwapTrackEvent, T as TON_SWAP_PROTOCOL_LAYOUTS, j as TonSwapCheckInput, k as TonSwapCheckResult, l as TonSwapLeg, m as TonSwapPayloadError, n as checkTonSwapPayload, o as encodeTypedMessage, p as inMemoryQuoteStore, q as inMemorySecretStore, r as omnistonPins, s as omnistonProvider, t as omnistonVerifyBuild, v as validateEvmToTonOrderExtension, u as validateEvmTypedOrder } from './provider-D6RXRgf-.js';
2
+ import '@anywalletkit/protocol-swap2-core/types';
package/dist/provider.js CHANGED
@@ -10,9 +10,10 @@ import {
10
10
  omnistonVerifyBuild,
11
11
  validateEvmToTonOrderExtension,
12
12
  validateEvmTypedOrder
13
- } from "./chunk-JVFDD7PV.js";
13
+ } from "./chunk-R6B2CV5Z.js";
14
14
  import "./chunk-QDXFC6BC.js";
15
15
  import "./chunk-AIWAM7BS.js";
16
+ import "./chunk-JWYDIW4V.js";
16
17
  export {
17
18
  TON_SWAP_PROTOCOL_LAYOUTS,
18
19
  TonSwapPayloadError,