@anywalletkit/protocol-swap2-omniston 0.2.8 → 0.3.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,4 +1,4 @@
1
- import { CrossChainProvider } from '@anywalletkit/protocol-swap2-core/types';
1
+ import { RemotePins, CrossChainProvider, Quote, UnsignedTx, QuoteParams } from '@anywalletkit/protocol-swap2-core/types';
2
2
 
3
3
  /** Omniston's `SwapChunk.protocol` names and the layout each one builds. */
4
4
  declare const TON_SWAP_PROTOCOL_LAYOUTS: Readonly<Record<string, "stonfi-v1" | "stonfi-v2" | "dedust-v1" | "dedust-v2">>;
@@ -90,6 +90,13 @@ interface OmnistonQuoteStore {
90
90
  save(quoteId: string, valueJson: string): void | Promise<void>;
91
91
  load(quoteId: string): string | undefined | Promise<string | undefined>;
92
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>;
93
100
  }
94
101
  /** Default quote store — long-lived processes and tests only. */
95
102
  declare function inMemoryQuoteStore(): OmnistonQuoteStore;
@@ -585,6 +592,61 @@ declare function validateEvmToTonOrderExtension(extension: Uint8Array, expected:
585
592
  * ERC-20 (`outputTokenAddress`, `traderDstAddress` are EVM then). Absent = TON. */
586
593
  dstChainId?: number;
587
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>;
588
650
  declare function omnistonProvider(opts?: OmnistonProviderOptions): CrossChainProvider;
589
651
 
590
- 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, omnistonProvider, validateEvmToTonOrderExtension };
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,4 +1,4 @@
1
- import { CrossChainProvider } from '@anywalletkit/protocol-swap2-core/types';
1
+ import { RemotePins, CrossChainProvider, Quote, UnsignedTx, QuoteParams } from '@anywalletkit/protocol-swap2-core/types';
2
2
 
3
3
  /** Omniston's `SwapChunk.protocol` names and the layout each one builds. */
4
4
  declare const TON_SWAP_PROTOCOL_LAYOUTS: Readonly<Record<string, "stonfi-v1" | "stonfi-v2" | "dedust-v1" | "dedust-v2">>;
@@ -90,6 +90,13 @@ interface OmnistonQuoteStore {
90
90
  save(quoteId: string, valueJson: string): void | Promise<void>;
91
91
  load(quoteId: string): string | undefined | Promise<string | undefined>;
92
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>;
93
100
  }
94
101
  /** Default quote store — long-lived processes and tests only. */
95
102
  declare function inMemoryQuoteStore(): OmnistonQuoteStore;
@@ -585,6 +592,61 @@ declare function validateEvmToTonOrderExtension(extension: Uint8Array, expected:
585
592
  * ERC-20 (`outputTokenAddress`, `traderDstAddress` are EVM then). Absent = TON. */
586
593
  dstChainId?: number;
587
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>;
588
650
  declare function omnistonProvider(opts?: OmnistonProviderOptions): CrossChainProvider;
589
651
 
590
- 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, omnistonProvider, validateEvmToTonOrderExtension };
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 };
package/dist/provider.js CHANGED
@@ -5,9 +5,12 @@ import {
5
5
  encodeTypedMessage,
6
6
  inMemoryQuoteStore,
7
7
  inMemorySecretStore,
8
+ omnistonPins,
8
9
  omnistonProvider,
9
- validateEvmToTonOrderExtension
10
- } from "./chunk-KNT2XSQU.js";
10
+ omnistonVerifyBuild,
11
+ validateEvmToTonOrderExtension,
12
+ validateEvmTypedOrder
13
+ } from "./chunk-JVFDD7PV.js";
11
14
  import "./chunk-QDXFC6BC.js";
12
15
  import "./chunk-AIWAM7BS.js";
13
16
  export {
@@ -17,7 +20,10 @@ export {
17
20
  encodeTypedMessage,
18
21
  inMemoryQuoteStore,
19
22
  inMemorySecretStore,
23
+ omnistonPins,
20
24
  omnistonProvider,
21
- validateEvmToTonOrderExtension
25
+ omnistonVerifyBuild,
26
+ validateEvmToTonOrderExtension,
27
+ validateEvmTypedOrder
22
28
  };
23
29
  //# sourceMappingURL=provider.js.map