@anywalletkit/protocol-swap2-omniston 0.2.7 → 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.
- package/README.md +18 -1
- package/dist/{chunk-IIFNHGC5.js → chunk-CRYYP6X3.js} +2 -2
- package/dist/{chunk-PKDRSR7N.js → chunk-JVFDD7PV.js} +116 -9
- package/dist/chunk-JVFDD7PV.js.map +1 -0
- package/dist/index.cjs +116 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -4
- package/dist/protocol.cjs +52 -8
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +116 -9
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +64 -2
- package/dist/provider.d.ts +64 -2
- package/dist/provider.js +9 -3
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.d.cts +1 -1
- package/dist/validators.d.ts +1 -1
- package/dist/validators.js.map +1 -1
- package/package.json +16 -8
- package/dist/chunk-PKDRSR7N.js.map +0 -1
- /package/dist/{chunk-IIFNHGC5.js.map → chunk-CRYYP6X3.js.map} +0 -0
package/dist/provider.d.cts
CHANGED
|
@@ -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 HtlcSecretStore, type OmnistonClientLike, type OmnistonProviderOptions, type OmnistonQuoteStore, 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.d.ts
CHANGED
|
@@ -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 HtlcSecretStore, type OmnistonClientLike, type OmnistonProviderOptions, type OmnistonQuoteStore, 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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
25
|
+
omnistonVerifyBuild,
|
|
26
|
+
validateEvmToTonOrderExtension,
|
|
27
|
+
validateEvmTypedOrder
|
|
22
28
|
};
|
|
23
29
|
//# sourceMappingURL=provider.js.map
|