@anywalletkit/protocol-swap2-omniston 0.5.3 → 0.5.5

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 (41) hide show
  1. package/README.md +72 -4
  2. package/dist/activity.cjs +4 -1
  3. package/dist/activity.cjs.map +1 -1
  4. package/dist/activity.d.cts +7 -1
  5. package/dist/activity.d.ts +7 -1
  6. package/dist/activity.js +1 -1
  7. package/dist/{chunk-AIWAM7BS.js → chunk-ENAEOF7N.js} +5 -2
  8. package/dist/chunk-ENAEOF7N.js.map +1 -0
  9. package/dist/{chunk-4JOTKQOT.js → chunk-FDSTD34Z.js} +10 -3
  10. package/dist/{chunk-4JOTKQOT.js.map → chunk-FDSTD34Z.js.map} +1 -1
  11. package/dist/chunk-IDRZHWWL.js +74 -0
  12. package/dist/chunk-IDRZHWWL.js.map +1 -0
  13. package/dist/{chunk-2E6CVWD6.js → chunk-IX4NF2J7.js} +2 -2
  14. package/dist/index.cjs +49 -2
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +4 -4
  19. package/dist/protocol.cjs +11 -1
  20. package/dist/protocol.cjs.map +1 -1
  21. package/dist/protocol.d.cts +1 -1
  22. package/dist/protocol.d.ts +1 -1
  23. package/dist/protocol.js +4 -4
  24. package/dist/{provider-CcCZB-Cj.d.cts → provider-BQzNkVvW.d.cts} +18 -2
  25. package/dist/{provider-CcCZB-Cj.d.ts → provider-BQzNkVvW.d.ts} +18 -2
  26. package/dist/provider.cjs +49 -2
  27. package/dist/provider.cjs.map +1 -1
  28. package/dist/provider.d.cts +1 -1
  29. package/dist/provider.d.ts +1 -1
  30. package/dist/provider.js +3 -3
  31. package/dist/validators.cjs +125 -12
  32. package/dist/validators.cjs.map +1 -1
  33. package/dist/validators.d.cts +41 -4
  34. package/dist/validators.d.ts +41 -4
  35. package/dist/validators.js +88 -12
  36. package/dist/validators.js.map +1 -1
  37. package/package.json +6 -6
  38. package/dist/chunk-AIWAM7BS.js.map +0 -1
  39. package/dist/chunk-JWYDIW4V.js +0 -37
  40. package/dist/chunk-JWYDIW4V.js.map +0 -1
  41. /package/dist/{chunk-2E6CVWD6.js.map → chunk-IX4NF2J7.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- export { D as DEFAULT_OMNISTON_TON_CODE_HASHES, w as DEFAULT_OMNISTON_TON_PROXY_TON_MASTERS, x as DEFAULT_OMNISTON_TON_SWAP_INTERFACES, M as MAX_OMNISTON_EXCLUSIVITY_SECONDS, y as OmnistonTonDeliveryInput, z as OmnistonTonDeliveryLocatorOptions, B as OmnistonTonValidationOptions, F as TonEscrowBuildExpectation, G as TonOutputPositionInput, I as createOmnistonTonDeliveryLocator, J as createOmnistonTonValidators } from './provider-CcCZB-Cj.cjs';
1
+ export { D as DEFAULT_OMNISTON_TON_CODE_HASHES, w as DEFAULT_OMNISTON_TON_PROXY_TON_MASTERS, x as DEFAULT_OMNISTON_TON_SWAP_INTERFACES, M as MAX_OMNISTON_EXCLUSIVITY_SECONDS, y as OmnistonTonDeliveryInput, z as OmnistonTonDeliveryLocatorOptions, B as OmnistonTonValidationOptions, F as TonEscrowBuildExpectation, G as TonOutputPositionInput, I as createOmnistonTonDeliveryLocator, J as createOmnistonTonValidators } from './provider-BQzNkVvW.cjs';
2
2
  import '@anywalletkit/protocol-swap2-core/types';
3
3
 
4
4
  /** How far back (blocks) a factory event is searched, per chain — shared with the EVM input validator. */
@@ -34,12 +34,48 @@ interface EvmOutputValidationInput {
34
34
  type OmnistonEvmOutputRefusal = (reason: string, details?: Record<string, unknown>) => void;
35
35
  /** JSON-RPC over the caller's endpoints (`rpcUrls`) with public failover (reads only). */
36
36
  declare function omnistonEvmRpcRequest(chain: string, method: string, params: unknown[], rpcUrls?: OmnistonRpcUrls): Promise<unknown>;
37
+ /**
38
+ * The operator behind an RPC endpoint, for counting a quorum: the registrable domain, approximated by the host's last
39
+ * two labels (`base-rpc.publicnode.com` → `publicnode.com`, `mainnet.base.org` → `base.org`); an IP literal is its own
40
+ * operator. Two endpoints of one company under different domains still count twice — pass `operatorOf` to merge them.
41
+ */
42
+ declare function omnistonRpcOperator(url: string): string;
43
+ /** The endpoints for `chain` — the caller's first, the public fallbacks after, each URL once — grouped by operator in first-seen order. */
44
+ declare function omnistonRpcOperatorGroups(chain: string, rpcUrls?: OmnistonRpcUrls, operatorOf?: (url: string) => string): {
45
+ operator: string;
46
+ urls: string[];
47
+ }[];
48
+ /** Quorum options shared by the EVM output and input validators. */
49
+ interface OmnistonRpcQuorumOptions {
50
+ /**
51
+ * Independent RPC operators that must each prove the position on their own before the secret is disclosed. The
52
+ * chain's endpoints (`rpcUrls`, then the public fallbacks) are grouped by operator ({@link omnistonRpcOperatorGroups});
53
+ * every group runs the whole validation — its state reads pinned to its own finalized block (head minus the chain's
54
+ * confirmations) instead of `latest` — and at least `quorum` groups must pass. With fewer operators configured than
55
+ * the quorum, nothing is disclosed. Default 1: one validation over the first answering endpoint, as before.
56
+ * Needs `rpcUrls` (or the public fallbacks); a single injected `request` cannot be split into operators.
57
+ */
58
+ quorum?: number;
59
+ /** The operator of an endpoint URL (default {@link omnistonRpcOperator}). */
60
+ operatorOf?: (url: string) => string;
61
+ }
62
+ /**
63
+ * Runs `once` against one request (quorum 1: the caller's `request`, or the endpoints with failover), or against every
64
+ * independent operator with pinned state reads (quorum ≥ 2) — true only when at least `quorum` of them prove it.
65
+ * Refusals from an operator's run carry its `operator`.
66
+ */
67
+ declare function omnistonQuorumValidator<I extends {
68
+ chain: string;
69
+ }>(options: {
70
+ request?: RpcRequest;
71
+ rpcUrls?: OmnistonRpcUrls;
72
+ } & OmnistonRpcQuorumOptions, refuse: (reason: string, details?: Record<string, unknown>) => false, once: (request: RpcRequest, input: I, refuse: (reason: string, details?: Record<string, unknown>) => false) => Promise<boolean>): (input: I) => Promise<boolean>;
37
73
  declare function createOmnistonEvmOutputValidator(options?: {
38
74
  request?: RpcRequest;
39
75
  rpcUrls?: OmnistonRpcUrls;
40
76
  now?: () => number;
41
77
  onRefusal?: OmnistonEvmOutputRefusal;
42
- }): (input: EvmOutputValidationInput) => Promise<boolean>;
78
+ } & OmnistonRpcQuorumOptions): (input: EvmOutputValidationInput) => Promise<boolean>;
43
79
  /**
44
80
  * Finds an Omniston EVM delivery: the ERC-20 `Transfer` from the destination
45
81
  * escrow to the recipient of at least `minUnits`, within the chain's lookback
@@ -79,12 +115,13 @@ interface EvmInputValidationInput {
79
115
  }
80
116
  /** Diagnostics hook: every refusal names its check and the numbers it compared (never a secret). */
81
117
  type OmnistonValidatorRefusal = (reason: string, details?: Record<string, unknown>) => void;
118
+ /** `quorum` / `operatorOf`: see {@link OmnistonRpcQuorumOptions} — the same independent-operator check as the output validator. */
82
119
  declare function createOmnistonEvmInputValidator(options?: {
83
120
  request?: OmnistonRpcRequest;
84
121
  rpcUrls?: OmnistonRpcUrls;
85
122
  now?: () => number;
86
123
  onRefusal?: OmnistonValidatorRefusal;
87
- }): (input: EvmInputValidationInput) => Promise<boolean>;
124
+ } & OmnistonRpcQuorumOptions): (input: EvmInputValidationInput) => Promise<boolean>;
88
125
 
89
126
  /**
90
127
  * Settlement contracts this deployment trusts for Omniston, per CAIP-2 chain.
@@ -105,4 +142,4 @@ declare const AUDITED_OMNISTON_SETTLEMENT_CONTRACTS: Record<string, string[]>;
105
142
  */
106
143
  declare const AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS: Record<string, string[]>;
107
144
 
108
- export { AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS, AUDITED_OMNISTON_SETTLEMENT_CONTRACTS, type EvmInputValidationInput, type EvmOutputValidationInput, OMNISTON_EVM_LOOKBACK_BLOCKS, OMNISTON_EVM_MIN_CONFIRMATIONS, type OmnistonEvmOutputRefusal, type OmnistonRpcRequest, type OmnistonRpcUrls, type OmnistonValidatorRefusal, SRC_ESCROW_CREATED_TOPIC, createOmnistonEvmDeliveryLocator, createOmnistonEvmInputValidator, createOmnistonEvmOutputValidator, omnistonEvmRpcRequest };
145
+ export { AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS, AUDITED_OMNISTON_SETTLEMENT_CONTRACTS, type EvmInputValidationInput, type EvmOutputValidationInput, OMNISTON_EVM_LOOKBACK_BLOCKS, OMNISTON_EVM_MIN_CONFIRMATIONS, type OmnistonEvmOutputRefusal, type OmnistonRpcQuorumOptions, type OmnistonRpcRequest, type OmnistonRpcUrls, type OmnistonValidatorRefusal, SRC_ESCROW_CREATED_TOPIC, createOmnistonEvmDeliveryLocator, createOmnistonEvmInputValidator, createOmnistonEvmOutputValidator, omnistonEvmRpcRequest, omnistonQuorumValidator, omnistonRpcOperator, omnistonRpcOperatorGroups };
@@ -1,4 +1,4 @@
1
- export { D as DEFAULT_OMNISTON_TON_CODE_HASHES, w as DEFAULT_OMNISTON_TON_PROXY_TON_MASTERS, x as DEFAULT_OMNISTON_TON_SWAP_INTERFACES, M as MAX_OMNISTON_EXCLUSIVITY_SECONDS, y as OmnistonTonDeliveryInput, z as OmnistonTonDeliveryLocatorOptions, B as OmnistonTonValidationOptions, F as TonEscrowBuildExpectation, G as TonOutputPositionInput, I as createOmnistonTonDeliveryLocator, J as createOmnistonTonValidators } from './provider-CcCZB-Cj.js';
1
+ export { D as DEFAULT_OMNISTON_TON_CODE_HASHES, w as DEFAULT_OMNISTON_TON_PROXY_TON_MASTERS, x as DEFAULT_OMNISTON_TON_SWAP_INTERFACES, M as MAX_OMNISTON_EXCLUSIVITY_SECONDS, y as OmnistonTonDeliveryInput, z as OmnistonTonDeliveryLocatorOptions, B as OmnistonTonValidationOptions, F as TonEscrowBuildExpectation, G as TonOutputPositionInput, I as createOmnistonTonDeliveryLocator, J as createOmnistonTonValidators } from './provider-BQzNkVvW.js';
2
2
  import '@anywalletkit/protocol-swap2-core/types';
3
3
 
4
4
  /** How far back (blocks) a factory event is searched, per chain — shared with the EVM input validator. */
@@ -34,12 +34,48 @@ interface EvmOutputValidationInput {
34
34
  type OmnistonEvmOutputRefusal = (reason: string, details?: Record<string, unknown>) => void;
35
35
  /** JSON-RPC over the caller's endpoints (`rpcUrls`) with public failover (reads only). */
36
36
  declare function omnistonEvmRpcRequest(chain: string, method: string, params: unknown[], rpcUrls?: OmnistonRpcUrls): Promise<unknown>;
37
+ /**
38
+ * The operator behind an RPC endpoint, for counting a quorum: the registrable domain, approximated by the host's last
39
+ * two labels (`base-rpc.publicnode.com` → `publicnode.com`, `mainnet.base.org` → `base.org`); an IP literal is its own
40
+ * operator. Two endpoints of one company under different domains still count twice — pass `operatorOf` to merge them.
41
+ */
42
+ declare function omnistonRpcOperator(url: string): string;
43
+ /** The endpoints for `chain` — the caller's first, the public fallbacks after, each URL once — grouped by operator in first-seen order. */
44
+ declare function omnistonRpcOperatorGroups(chain: string, rpcUrls?: OmnistonRpcUrls, operatorOf?: (url: string) => string): {
45
+ operator: string;
46
+ urls: string[];
47
+ }[];
48
+ /** Quorum options shared by the EVM output and input validators. */
49
+ interface OmnistonRpcQuorumOptions {
50
+ /**
51
+ * Independent RPC operators that must each prove the position on their own before the secret is disclosed. The
52
+ * chain's endpoints (`rpcUrls`, then the public fallbacks) are grouped by operator ({@link omnistonRpcOperatorGroups});
53
+ * every group runs the whole validation — its state reads pinned to its own finalized block (head minus the chain's
54
+ * confirmations) instead of `latest` — and at least `quorum` groups must pass. With fewer operators configured than
55
+ * the quorum, nothing is disclosed. Default 1: one validation over the first answering endpoint, as before.
56
+ * Needs `rpcUrls` (or the public fallbacks); a single injected `request` cannot be split into operators.
57
+ */
58
+ quorum?: number;
59
+ /** The operator of an endpoint URL (default {@link omnistonRpcOperator}). */
60
+ operatorOf?: (url: string) => string;
61
+ }
62
+ /**
63
+ * Runs `once` against one request (quorum 1: the caller's `request`, or the endpoints with failover), or against every
64
+ * independent operator with pinned state reads (quorum ≥ 2) — true only when at least `quorum` of them prove it.
65
+ * Refusals from an operator's run carry its `operator`.
66
+ */
67
+ declare function omnistonQuorumValidator<I extends {
68
+ chain: string;
69
+ }>(options: {
70
+ request?: RpcRequest;
71
+ rpcUrls?: OmnistonRpcUrls;
72
+ } & OmnistonRpcQuorumOptions, refuse: (reason: string, details?: Record<string, unknown>) => false, once: (request: RpcRequest, input: I, refuse: (reason: string, details?: Record<string, unknown>) => false) => Promise<boolean>): (input: I) => Promise<boolean>;
37
73
  declare function createOmnistonEvmOutputValidator(options?: {
38
74
  request?: RpcRequest;
39
75
  rpcUrls?: OmnistonRpcUrls;
40
76
  now?: () => number;
41
77
  onRefusal?: OmnistonEvmOutputRefusal;
42
- }): (input: EvmOutputValidationInput) => Promise<boolean>;
78
+ } & OmnistonRpcQuorumOptions): (input: EvmOutputValidationInput) => Promise<boolean>;
43
79
  /**
44
80
  * Finds an Omniston EVM delivery: the ERC-20 `Transfer` from the destination
45
81
  * escrow to the recipient of at least `minUnits`, within the chain's lookback
@@ -79,12 +115,13 @@ interface EvmInputValidationInput {
79
115
  }
80
116
  /** Diagnostics hook: every refusal names its check and the numbers it compared (never a secret). */
81
117
  type OmnistonValidatorRefusal = (reason: string, details?: Record<string, unknown>) => void;
118
+ /** `quorum` / `operatorOf`: see {@link OmnistonRpcQuorumOptions} — the same independent-operator check as the output validator. */
82
119
  declare function createOmnistonEvmInputValidator(options?: {
83
120
  request?: OmnistonRpcRequest;
84
121
  rpcUrls?: OmnistonRpcUrls;
85
122
  now?: () => number;
86
123
  onRefusal?: OmnistonValidatorRefusal;
87
- }): (input: EvmInputValidationInput) => Promise<boolean>;
124
+ } & OmnistonRpcQuorumOptions): (input: EvmInputValidationInput) => Promise<boolean>;
88
125
 
89
126
  /**
90
127
  * Settlement contracts this deployment trusts for Omniston, per CAIP-2 chain.
@@ -105,4 +142,4 @@ declare const AUDITED_OMNISTON_SETTLEMENT_CONTRACTS: Record<string, string[]>;
105
142
  */
106
143
  declare const AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS: Record<string, string[]>;
107
144
 
108
- export { AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS, AUDITED_OMNISTON_SETTLEMENT_CONTRACTS, type EvmInputValidationInput, type EvmOutputValidationInput, OMNISTON_EVM_LOOKBACK_BLOCKS, OMNISTON_EVM_MIN_CONFIRMATIONS, type OmnistonEvmOutputRefusal, type OmnistonRpcRequest, type OmnistonRpcUrls, type OmnistonValidatorRefusal, SRC_ESCROW_CREATED_TOPIC, createOmnistonEvmDeliveryLocator, createOmnistonEvmInputValidator, createOmnistonEvmOutputValidator, omnistonEvmRpcRequest };
145
+ export { AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS, AUDITED_OMNISTON_SETTLEMENT_CONTRACTS, type EvmInputValidationInput, type EvmOutputValidationInput, OMNISTON_EVM_LOOKBACK_BLOCKS, OMNISTON_EVM_MIN_CONFIRMATIONS, type OmnistonEvmOutputRefusal, type OmnistonRpcQuorumOptions, type OmnistonRpcRequest, type OmnistonRpcUrls, type OmnistonValidatorRefusal, SRC_ESCROW_CREATED_TOPIC, createOmnistonEvmDeliveryLocator, createOmnistonEvmInputValidator, createOmnistonEvmOutputValidator, omnistonEvmRpcRequest, omnistonQuorumValidator, omnistonRpcOperator, omnistonRpcOperatorGroups };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AUDITED_OMNISTON_EVM_ORDER_PROTOCOLS,
3
3
  AUDITED_OMNISTON_SETTLEMENT_CONTRACTS
4
- } from "./chunk-JWYDIW4V.js";
4
+ } from "./chunk-IDRZHWWL.js";
5
5
 
6
6
  // src/validators/evm-output.ts
7
7
  import {
@@ -152,6 +152,9 @@ function decodeFeeParameters(parameters) {
152
152
  async function omnistonEvmRpcRequest(chain, method, params, rpcUrls) {
153
153
  const urls = [...rpcUrls?.[chain] ?? [], ...DEFAULT_RPC_URLS[chain] ?? []].filter((url) => !!url);
154
154
  if (!urls.length) throw new Error(`omniston: no RPC configured for ${chain}`);
155
+ return await rpcOver(urls, chain, method, params);
156
+ }
157
+ async function rpcOver(urls, chain, method, params) {
155
158
  let lastError;
156
159
  for (const url of urls) {
157
160
  try {
@@ -171,6 +174,62 @@ async function omnistonEvmRpcRequest(chain, method, params, rpcUrls) {
171
174
  }
172
175
  throw lastError instanceof Error ? lastError : new Error(`omniston: RPC failed for ${chain}`);
173
176
  }
177
+ function omnistonRpcOperator(url) {
178
+ const host = new URL(url).hostname.toLowerCase().replace(/\.$/, "");
179
+ if (/^[\d.]+$/.test(host) || host.includes(":") || host.startsWith("[")) return host;
180
+ return host.split(".").slice(-2).join(".");
181
+ }
182
+ function omnistonRpcOperatorGroups(chain, rpcUrls, operatorOf = omnistonRpcOperator) {
183
+ const groups = [];
184
+ const seen = /* @__PURE__ */ new Set();
185
+ for (const url of [...rpcUrls?.[chain] ?? [], ...DEFAULT_RPC_URLS[chain] ?? []]) {
186
+ if (!url || seen.has(url)) continue;
187
+ seen.add(url);
188
+ let operator;
189
+ try {
190
+ operator = operatorOf(url);
191
+ } catch {
192
+ continue;
193
+ }
194
+ const group = groups.find((g) => g.operator === operator);
195
+ if (group) group.urls.push(url);
196
+ else groups.push({ operator, urls: [url] });
197
+ }
198
+ return groups;
199
+ }
200
+ function pinnedStateRequest(request) {
201
+ let pinned = null;
202
+ return async (chain, method, params) => {
203
+ if (method === "eth_blockNumber") {
204
+ const head = await request(chain, method, params);
205
+ const latest = BigInt(head);
206
+ const confirmations = OMNISTON_EVM_MIN_CONFIRMATIONS[chain] ?? 20n;
207
+ pinned = quantity(latest >= confirmations ? latest - confirmations : 0n);
208
+ return head;
209
+ }
210
+ if (pinned && (method === "eth_call" || method === "eth_getCode" || method === "eth_getBalance") && params.at(-1) === "latest") {
211
+ return await request(chain, method, [...params.slice(0, -1), pinned]);
212
+ }
213
+ return await request(chain, method, params);
214
+ };
215
+ }
216
+ function omnistonQuorumValidator(options, refuse, once) {
217
+ const quorum = options.quorum ?? 1;
218
+ if (!Number.isSafeInteger(quorum) || quorum < 1) throw new Error("omniston: quorum must be a positive integer");
219
+ if (quorum === 1) {
220
+ const request = options.request ?? ((chain, method, params) => omnistonEvmRpcRequest(chain, method, params, options.rpcUrls));
221
+ return (input) => once(request, input, refuse);
222
+ }
223
+ if (options.request) throw new Error("omniston: an RPC quorum needs rpcUrls (one request per operator), not a single request");
224
+ return async (input) => {
225
+ const groups = omnistonRpcOperatorGroups(input.chain, options.rpcUrls, options.operatorOf);
226
+ const operators = groups.map((g) => g.operator);
227
+ if (groups.length < quorum) return refuse("rpc-quorum-unavailable", { chain: input.chain, operators, quorum });
228
+ const results = await Promise.all(groups.map((g) => once(pinnedStateRequest((chain, method, params) => rpcOver(g.urls, chain, method, params)), input, (reason, details) => refuse(reason, { ...details, operator: g.operator })).catch(() => false)));
229
+ const agreed = operators.filter((_, i) => results[i]);
230
+ return agreed.length >= quorum || refuse("rpc-quorum-not-met", { chain: input.chain, agreed, operators, quorum });
231
+ };
232
+ }
174
233
  async function ethCall(request, chain, to, data) {
175
234
  return await request(chain, "eth_call", [{ to, data }, "latest"]);
176
235
  }
@@ -204,16 +263,15 @@ function locateImmutables(input, secretHash) {
204
263
  }
205
264
  }
206
265
  function createOmnistonEvmOutputValidator(options = {}) {
207
- const refuse = (reason, details) => {
266
+ const report = (reason, details) => {
208
267
  try {
209
268
  options.onRefusal?.(reason, details);
210
269
  } catch {
211
270
  }
212
271
  return false;
213
272
  };
214
- const request = options.request ?? ((chain, method, params) => omnistonEvmRpcRequest(chain, method, params, options.rpcUrls));
215
273
  const now = options.now ?? Date.now;
216
- return async (input) => {
274
+ return omnistonQuorumValidator(options, report, async (request, input, refuse) => {
217
275
  try {
218
276
  if (!OMNISTON_EVM_LOOKBACK_BLOCKS[input.chain] || input.executionIndex !== 0 || !isAddress(input.positionAddress) || !isAddress(input.factoryAddress) || !isAddress(input.recipientAddress) || !isAddress(input.outputTokenAddress) || !Number.isInteger(input.quoteTimestamp) || input.quoteTimestamp * 1e3 > now() + 12e4 || now() - input.quoteTimestamp * 1e3 > 6 * 60 * 60 * 1e3) return refuse("input-shape");
219
277
  const position = getAddress(input.positionAddress);
@@ -310,7 +368,7 @@ function createOmnistonEvmOutputValidator(options = {}) {
310
368
  } catch (error) {
311
369
  return refuse("error", { message: error instanceof Error ? error.message : String(error) });
312
370
  }
313
- };
371
+ });
314
372
  }
315
373
  var TRANSFER_TOPIC = keccak256(stringToHex("Transfer(address,address,uint256)"));
316
374
  var topicAddress = (address) => `0x${getAddress(address).slice(2).toLowerCase().padStart(64, "0")}`;
@@ -421,16 +479,15 @@ async function ethCall2(request, chain, to, data) {
421
479
  return await request(chain, "eth_call", [{ to, data }, "latest"]);
422
480
  }
423
481
  function createOmnistonEvmInputValidator(options = {}) {
424
- const refuse = (reason, details) => {
482
+ const report = (reason, details) => {
425
483
  try {
426
484
  options.onRefusal?.(reason, details);
427
485
  } catch {
428
486
  }
429
487
  return false;
430
488
  };
431
- const request = options.request ?? ((chain, method, params) => omnistonEvmRpcRequest(chain, method, params, options.rpcUrls));
432
489
  const now = options.now ?? Date.now;
433
- return async (input) => {
490
+ return omnistonQuorumValidator(options, report, async (request, input, refuse) => {
434
491
  try {
435
492
  if (!OMNISTON_EVM_LOOKBACK_BLOCKS[input.chain] || !isAddress2(input.positionAddress) || !isAddress2(input.factoryAddress) || !isAddress2(input.orderProtocolAddress) || !isAddress2(input.ownerAddress) || !isAddress2(input.resolverAddress) || !isAddress2(input.inputTokenAddress) || !Number.isInteger(input.quoteTimestamp) || input.quoteTimestamp * 1e3 > now() + 12e4 || now() - input.quoteTimestamp * 1e3 > 6 * 60 * 60 * 1e3 || input.secretHash.length !== 32) return refuse("input-shape");
436
493
  const position = getAddress2(input.positionAddress);
@@ -505,7 +562,7 @@ function createOmnistonEvmInputValidator(options = {}) {
505
562
  } catch (error) {
506
563
  return refuse("error", { message: error instanceof Error ? error.message : String(error) });
507
564
  }
508
- };
565
+ });
509
566
  }
510
567
 
511
568
  // src/validators/ton.ts
@@ -523,8 +580,24 @@ var DEFAULT_OMNISTON_TON_CODE_HASHES = {
523
580
  authorityKeys: ["ed210da12aa96ea42de4f2f61dc172bbaa3da86051a1b2a6f342f69a777d2770"],
524
581
  /** EVM→TON output position: the contract the factory deploys for the
525
582
  * resolver's jetton lock (observed on every resolver-created position,
526
- * 2026-10-15/16), and the escrow code cell it carries in its state. */
527
- position: ["e4d5115a321ade7b827e38fb522c20d2f2cd46e4c6b0b5f7dd8b6b096792d77b"],
583
+ * 2026-10-15/16), and the escrow code cell it carries in its state.
584
+ * A position counts only when a trusted factory itself sent its deploy
585
+ * message, and a minter deploys only the position code stored in its own
586
+ * data, so this list follows the trusted minters in
587
+ * AUDITED_OMNISTON_SETTLEMENT_CONTRACTS["ton:-239"]:
588
+ * - eb503578…: positions of the rev2 Escrow Minter EQDybO88… (the position
589
+ * code stored in its data; reviewed 2026-11-12). The diff to rev1's
590
+ * e4d5115a… is 13 sub-VM calls in another mode (RUNVMX 20 -> 276) and 2
591
+ * escrow-code whitelist checks. The state layout is the same, and live
592
+ * and settled rev2 positions pass every check of
593
+ * validateTonOutputPosition.
594
+ * - e4d5115a… (positions of the rev1 minter EQAbWJ3Y…) left the default
595
+ * with rev1 on 2026-11-12. Only an EVM -> TON order quoted on rev1 less
596
+ * than 6 h before an app upgrades can still need it (positionCodeHashes
597
+ * with both codes, until those 6 h are over). That pin alone trusts no
598
+ * new order: a new quote must name a trusted minter, and a position
599
+ * counts only when the minter its quote named deployed it. */
600
+ position: ["eb503578b4d9cd791c9c0ecd0da6da4064aae2bcb19d3c924d4001c493386bc5"],
528
601
  outputEscrow: ["d30423575384773abaad8d3c6f763898afa3d57a5693005904b7c61e95cee630"]
529
602
  };
530
603
  var POSITION_DEPLOY_OP = "0xf240cd30";
@@ -1145,6 +1218,9 @@ export {
1145
1218
  createOmnistonEvmOutputValidator,
1146
1219
  createOmnistonTonDeliveryLocator,
1147
1220
  createOmnistonTonValidators,
1148
- omnistonEvmRpcRequest
1221
+ omnistonEvmRpcRequest,
1222
+ omnistonQuorumValidator,
1223
+ omnistonRpcOperator,
1224
+ omnistonRpcOperatorGroups
1149
1225
  };
1150
1226
  //# sourceMappingURL=validators.js.map