@qntx/wallet-engine 0.11.0 → 0.13.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/dist/connect.d.mts +1 -1
- package/dist/connect.mjs +1 -1
- package/dist/{errors-Bglz0VYn.d.mts → errors-CQnlTc1i.d.mts} +301 -19
- package/dist/gateway-contract.d.mts +247 -1
- package/dist/gateway-contract.mjs +146 -2
- package/dist/gateway-contract.mjs.map +1 -1
- package/dist/index.d.mts +162 -59
- package/dist/index.mjs +6325 -3997
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-Deo5WQe1.d.mts → registry-DwguKWvt.d.mts} +3 -1
- package/dist/{registry-wYrcuFNc.mjs → registry-oorLoGtz.mjs} +23 -2
- package/dist/registry-oorLoGtz.mjs.map +1 -0
- package/dist/{webln-BGKm12wd.mjs → webln-DKqCnqx1.mjs} +72 -33
- package/dist/webln-DKqCnqx1.mjs.map +1 -0
- package/package.json +10 -8
- package/dist/registry-wYrcuFNc.mjs.map +0 -1
- package/dist/webln-BGKm12wd.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as networkById, i as SOLANA_NETWORKS, n as NETWORKS, r as NetworkInfo, t as BITCOIN_NETWORKS } from "./registry-
|
|
1
|
+
import { a as networkById, i as SOLANA_NETWORKS, n as NETWORKS, r as NetworkInfo, t as BITCOIN_NETWORKS } from "./registry-DwguKWvt.mjs";
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
3
|
export declare const INSTALL_ID_HEADER = "x-install-id";
|
|
4
4
|
export declare const PROVIDERS_HEADER = "x-gateway-providers";
|
|
@@ -358,5 +358,251 @@ export declare const union: (a: HashList, b: HashList) => HashList;
|
|
|
358
358
|
export declare const difference: (a: HashList, b: HashList) => HashList;
|
|
359
359
|
/** `(list − remove) ∪ add`. */
|
|
360
360
|
export declare const applyDiff: (list: HashList, add: HashList, remove: HashList) => HashList;
|
|
361
|
+
/** The native-token sentinel 0x uses for sell and buy tokens. */
|
|
362
|
+
export declare const ZEROX_NATIVE_TOKEN = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
363
|
+
/** The `swapQuote` request: which exact-in sell on which chain, for which taker, at what slippage. */
|
|
364
|
+
export declare const swapQuoteRequest: z.ZodMiniObject<{
|
|
365
|
+
network: z.ZodMiniString<string>;
|
|
366
|
+
sellToken: z.ZodMiniString<string>;
|
|
367
|
+
buyToken: z.ZodMiniString<string>;
|
|
368
|
+
sellAmount: z.ZodMiniString<string>;
|
|
369
|
+
taker: z.ZodMiniString<string>;
|
|
370
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
371
|
+
}, z.core.$strip>;
|
|
372
|
+
export declare const swapQuoteResponse: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
373
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
374
|
+
provider: z.ZodMiniLiteral<"0x">;
|
|
375
|
+
sellToken: z.ZodMiniString<string>;
|
|
376
|
+
buyToken: z.ZodMiniString<string>;
|
|
377
|
+
sellAmount: z.ZodMiniString<string>;
|
|
378
|
+
buyAmount: z.ZodMiniString<string>;
|
|
379
|
+
minBuyAmount: z.ZodMiniString<string>;
|
|
380
|
+
allowanceTarget: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>;
|
|
381
|
+
transaction: z.ZodMiniObject<{
|
|
382
|
+
to: z.ZodMiniString<string>;
|
|
383
|
+
data: z.ZodMiniString<string>;
|
|
384
|
+
value: z.ZodMiniString<string>;
|
|
385
|
+
gas: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>;
|
|
386
|
+
}, z.core.$strip>;
|
|
387
|
+
fees: z.ZodMiniObject<{
|
|
388
|
+
integrator: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
389
|
+
token: z.ZodMiniString<string>;
|
|
390
|
+
amount: z.ZodMiniString<string>;
|
|
391
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
392
|
+
zeroEx: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
393
|
+
token: z.ZodMiniString<string>;
|
|
394
|
+
amount: z.ZodMiniString<string>;
|
|
395
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
396
|
+
}, z.core.$strip>;
|
|
397
|
+
blockNumber: z.ZodMiniString<string>;
|
|
398
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
399
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
400
|
+
}, z.core.$strip>]>;
|
|
401
|
+
export declare const swapQuote: Endpoint<z.ZodMiniObject<{
|
|
402
|
+
network: z.ZodMiniString<string>;
|
|
403
|
+
sellToken: z.ZodMiniString<string>;
|
|
404
|
+
buyToken: z.ZodMiniString<string>;
|
|
405
|
+
sellAmount: z.ZodMiniString<string>;
|
|
406
|
+
taker: z.ZodMiniString<string>;
|
|
407
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
408
|
+
}, z.core.$strip>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
409
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
410
|
+
provider: z.ZodMiniLiteral<"0x">;
|
|
411
|
+
sellToken: z.ZodMiniString<string>;
|
|
412
|
+
buyToken: z.ZodMiniString<string>;
|
|
413
|
+
sellAmount: z.ZodMiniString<string>;
|
|
414
|
+
buyAmount: z.ZodMiniString<string>;
|
|
415
|
+
minBuyAmount: z.ZodMiniString<string>;
|
|
416
|
+
allowanceTarget: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>;
|
|
417
|
+
transaction: z.ZodMiniObject<{
|
|
418
|
+
to: z.ZodMiniString<string>;
|
|
419
|
+
data: z.ZodMiniString<string>;
|
|
420
|
+
value: z.ZodMiniString<string>;
|
|
421
|
+
gas: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNull]>;
|
|
422
|
+
}, z.core.$strip>;
|
|
423
|
+
fees: z.ZodMiniObject<{
|
|
424
|
+
integrator: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
425
|
+
token: z.ZodMiniString<string>;
|
|
426
|
+
amount: z.ZodMiniString<string>;
|
|
427
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
428
|
+
zeroEx: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
429
|
+
token: z.ZodMiniString<string>;
|
|
430
|
+
amount: z.ZodMiniString<string>;
|
|
431
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
432
|
+
}, z.core.$strip>;
|
|
433
|
+
blockNumber: z.ZodMiniString<string>;
|
|
434
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
435
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
436
|
+
}, z.core.$strip>]>>;
|
|
437
|
+
export type SwapQuoteRequest = z.infer<typeof swapQuoteRequest>;
|
|
438
|
+
export type SwapQuoteResponse = z.infer<typeof swapQuoteResponse>;
|
|
439
|
+
/** Jupiter is mainnet-only — every other Solana CAIP-2 id is a client error. */
|
|
440
|
+
export declare const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
441
|
+
/** The `swapQuoteSolana` request: an exact-in mint pair for a taker on Solana mainnet. */
|
|
442
|
+
export declare const swapQuoteSolanaRequest: z.ZodMiniObject<{
|
|
443
|
+
network: z.ZodMiniLiteral<"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp">;
|
|
444
|
+
inputMint: z.ZodMiniString<string>;
|
|
445
|
+
outputMint: z.ZodMiniString<string>;
|
|
446
|
+
amount: z.ZodMiniString<string>;
|
|
447
|
+
taker: z.ZodMiniString<string>;
|
|
448
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
449
|
+
}, z.core.$strip>;
|
|
450
|
+
/** One Solana instruction as the wire carries it — base64 data, plain account flags. */
|
|
451
|
+
export declare const solanaInstruction: z.ZodMiniObject<{
|
|
452
|
+
programId: z.ZodMiniString<string>;
|
|
453
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
454
|
+
address: z.ZodMiniString<string>;
|
|
455
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
456
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
457
|
+
}, z.core.$strip>>;
|
|
458
|
+
data: z.ZodMiniString<string>;
|
|
459
|
+
}, z.core.$strip>;
|
|
460
|
+
export declare const swapQuoteSolanaResponse: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
461
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
462
|
+
provider: z.ZodMiniLiteral<"jupiter">;
|
|
463
|
+
inputMint: z.ZodMiniString<string>;
|
|
464
|
+
outputMint: z.ZodMiniString<string>;
|
|
465
|
+
inAmount: z.ZodMiniString<string>;
|
|
466
|
+
outAmount: z.ZodMiniString<string>;
|
|
467
|
+
otherAmountThreshold: z.ZodMiniString<string>;
|
|
468
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
469
|
+
setup: z.ZodMiniArray<z.ZodMiniObject<{
|
|
470
|
+
programId: z.ZodMiniString<string>;
|
|
471
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
472
|
+
address: z.ZodMiniString<string>;
|
|
473
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
474
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
475
|
+
}, z.core.$strip>>;
|
|
476
|
+
data: z.ZodMiniString<string>;
|
|
477
|
+
}, z.core.$strip>>;
|
|
478
|
+
swap: z.ZodMiniObject<{
|
|
479
|
+
programId: z.ZodMiniString<string>;
|
|
480
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
481
|
+
address: z.ZodMiniString<string>;
|
|
482
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
483
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
484
|
+
}, z.core.$strip>>;
|
|
485
|
+
data: z.ZodMiniString<string>;
|
|
486
|
+
}, z.core.$strip>;
|
|
487
|
+
cleanup: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
488
|
+
programId: z.ZodMiniString<string>;
|
|
489
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
490
|
+
address: z.ZodMiniString<string>;
|
|
491
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
492
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
493
|
+
}, z.core.$strip>>;
|
|
494
|
+
data: z.ZodMiniString<string>;
|
|
495
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
496
|
+
lookupTables: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
497
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
498
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
499
|
+
}, z.core.$strip>]>;
|
|
500
|
+
export declare const swapQuoteSolana: Endpoint<z.ZodMiniObject<{
|
|
501
|
+
network: z.ZodMiniLiteral<"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp">;
|
|
502
|
+
inputMint: z.ZodMiniString<string>;
|
|
503
|
+
outputMint: z.ZodMiniString<string>;
|
|
504
|
+
amount: z.ZodMiniString<string>;
|
|
505
|
+
taker: z.ZodMiniString<string>;
|
|
506
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
507
|
+
}, z.core.$strip>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
508
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
509
|
+
provider: z.ZodMiniLiteral<"jupiter">;
|
|
510
|
+
inputMint: z.ZodMiniString<string>;
|
|
511
|
+
outputMint: z.ZodMiniString<string>;
|
|
512
|
+
inAmount: z.ZodMiniString<string>;
|
|
513
|
+
outAmount: z.ZodMiniString<string>;
|
|
514
|
+
otherAmountThreshold: z.ZodMiniString<string>;
|
|
515
|
+
slippageBps: z.ZodMiniNumber<unknown>;
|
|
516
|
+
setup: z.ZodMiniArray<z.ZodMiniObject<{
|
|
517
|
+
programId: z.ZodMiniString<string>;
|
|
518
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
519
|
+
address: z.ZodMiniString<string>;
|
|
520
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
521
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
522
|
+
}, z.core.$strip>>;
|
|
523
|
+
data: z.ZodMiniString<string>;
|
|
524
|
+
}, z.core.$strip>>;
|
|
525
|
+
swap: z.ZodMiniObject<{
|
|
526
|
+
programId: z.ZodMiniString<string>;
|
|
527
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
528
|
+
address: z.ZodMiniString<string>;
|
|
529
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
530
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
531
|
+
}, z.core.$strip>>;
|
|
532
|
+
data: z.ZodMiniString<string>;
|
|
533
|
+
}, z.core.$strip>;
|
|
534
|
+
cleanup: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
535
|
+
programId: z.ZodMiniString<string>;
|
|
536
|
+
accounts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
537
|
+
address: z.ZodMiniString<string>;
|
|
538
|
+
signer: z.ZodMiniBoolean<boolean>;
|
|
539
|
+
writable: z.ZodMiniBoolean<boolean>;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
data: z.ZodMiniString<string>;
|
|
542
|
+
}, z.core.$strip>, z.ZodMiniNull]>;
|
|
543
|
+
lookupTables: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
544
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
545
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
546
|
+
}, z.core.$strip>]>>;
|
|
547
|
+
export type SwapQuoteSolanaRequest = z.infer<typeof swapQuoteSolanaRequest>;
|
|
548
|
+
export type SwapQuoteSolanaResponse = z.infer<typeof swapQuoteSolanaResponse>;
|
|
549
|
+
/** The `bridgeQuote` request: an exact-in token transfer from an origin chain to a destination. */
|
|
550
|
+
export declare const bridgeQuoteRequest: z.ZodMiniObject<{
|
|
551
|
+
network: z.ZodMiniString<string>;
|
|
552
|
+
destinationNetwork: z.ZodMiniString<string>;
|
|
553
|
+
inputToken: z.ZodMiniString<string>;
|
|
554
|
+
outputToken: z.ZodMiniString<string>;
|
|
555
|
+
amount: z.ZodMiniString<string>;
|
|
556
|
+
taker: z.ZodMiniString<string>;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
export declare const bridgeQuoteResponse: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
559
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
560
|
+
provider: z.ZodMiniLiteral<"across">;
|
|
561
|
+
inputToken: z.ZodMiniString<string>;
|
|
562
|
+
outputToken: z.ZodMiniString<string>;
|
|
563
|
+
inputAmount: z.ZodMiniString<string>;
|
|
564
|
+
outputAmount: z.ZodMiniString<string>;
|
|
565
|
+
destinationNetwork: z.ZodMiniString<string>;
|
|
566
|
+
quoteTimestamp: z.ZodMiniNumber<unknown>;
|
|
567
|
+
fillDeadline: z.ZodMiniNumber<unknown>;
|
|
568
|
+
exclusiveRelayer: z.ZodMiniString<string>;
|
|
569
|
+
exclusivityParameter: z.ZodMiniNumber<unknown>;
|
|
570
|
+
spokePool: z.ZodMiniString<string>;
|
|
571
|
+
limits: z.ZodMiniObject<{
|
|
572
|
+
minDeposit: z.ZodMiniString<string>;
|
|
573
|
+
maxDeposit: z.ZodMiniString<string>;
|
|
574
|
+
}, z.core.$strip>;
|
|
575
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
576
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
577
|
+
}, z.core.$strip>]>;
|
|
578
|
+
export declare const bridgeQuote: Endpoint<z.ZodMiniObject<{
|
|
579
|
+
network: z.ZodMiniString<string>;
|
|
580
|
+
destinationNetwork: z.ZodMiniString<string>;
|
|
581
|
+
inputToken: z.ZodMiniString<string>;
|
|
582
|
+
outputToken: z.ZodMiniString<string>;
|
|
583
|
+
amount: z.ZodMiniString<string>;
|
|
584
|
+
taker: z.ZodMiniString<string>;
|
|
585
|
+
}, z.core.$strip>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
586
|
+
liquidity: z.ZodMiniLiteral<true>;
|
|
587
|
+
provider: z.ZodMiniLiteral<"across">;
|
|
588
|
+
inputToken: z.ZodMiniString<string>;
|
|
589
|
+
outputToken: z.ZodMiniString<string>;
|
|
590
|
+
inputAmount: z.ZodMiniString<string>;
|
|
591
|
+
outputAmount: z.ZodMiniString<string>;
|
|
592
|
+
destinationNetwork: z.ZodMiniString<string>;
|
|
593
|
+
quoteTimestamp: z.ZodMiniNumber<unknown>;
|
|
594
|
+
fillDeadline: z.ZodMiniNumber<unknown>;
|
|
595
|
+
exclusiveRelayer: z.ZodMiniString<string>;
|
|
596
|
+
exclusivityParameter: z.ZodMiniNumber<unknown>;
|
|
597
|
+
spokePool: z.ZodMiniString<string>;
|
|
598
|
+
limits: z.ZodMiniObject<{
|
|
599
|
+
minDeposit: z.ZodMiniString<string>;
|
|
600
|
+
maxDeposit: z.ZodMiniString<string>;
|
|
601
|
+
}, z.core.$strip>;
|
|
602
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
603
|
+
liquidity: z.ZodMiniLiteral<false>;
|
|
604
|
+
}, z.core.$strip>]>>;
|
|
605
|
+
export type BridgeQuoteRequest = z.infer<typeof bridgeQuoteRequest>;
|
|
606
|
+
export type BridgeQuoteResponse = z.infer<typeof bridgeQuoteResponse>;
|
|
361
607
|
export { BITCOIN_NETWORKS, NETWORKS, type NetworkInfo, SOLANA_NETWORKS, networkById };
|
|
362
608
|
//# sourceMappingURL=gateway-contract.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as networkById, n as NETWORKS, r as SOLANA_NETWORKS, t as BITCOIN_NETWORKS } from "./registry-
|
|
1
|
+
import { i as networkById, n as NETWORKS, r as SOLANA_NETWORKS, t as BITCOIN_NETWORKS } from "./registry-oorLoGtz.mjs";
|
|
2
2
|
import { utf8ToBytes } from "@noble/hashes/utils.js";
|
|
3
3
|
import * as z from "zod/mini";
|
|
4
4
|
import { base64 } from "@scure/base";
|
|
@@ -389,6 +389,150 @@ const union = (a, b) => merge(a, b, () => true);
|
|
|
389
389
|
const difference = (a, b) => merge(a, b, (inA, inB) => inA && !inB);
|
|
390
390
|
/** `(list − remove) ∪ add`. */
|
|
391
391
|
const applyDiff = (list, add, remove) => union(difference(list, remove), add);
|
|
392
|
-
|
|
392
|
+
// src/gateway/contract/quotes.ts
|
|
393
|
+
/** The native-token sentinel 0x uses for sell and buy tokens. */
|
|
394
|
+
const ZEROX_NATIVE_TOKEN = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
395
|
+
/** `0x` + 40 hex — an EVM address, the 0x native sentinel `0xEeee…` among them. */
|
|
396
|
+
const evmAddress = z.string().check(z.regex(/^0x[0-9a-fA-F]{40}$/));
|
|
397
|
+
/** A decimal string of a non-negative integer (`"0"` allowed for gas nulls). */
|
|
398
|
+
const decimal = z.string().check(z.regex(/^[0-9]+$/));
|
|
399
|
+
/** The `swapQuote` request: which exact-in sell on which chain, for which taker, at what slippage. */
|
|
400
|
+
const swapQuoteRequest = z.object({
|
|
401
|
+
/** `eip155:<n>` — the only namespace a 0x swap supports. */
|
|
402
|
+
network: caip2.check(z.regex(/^eip155:[0-9]+$/)),
|
|
403
|
+
/** The token sold — an ERC-20 address, or `0xEeeee…` for native. */
|
|
404
|
+
sellToken: evmAddress,
|
|
405
|
+
/** The token bought — an ERC-20 address, or `0xEeeee…` for native. */
|
|
406
|
+
buyToken: evmAddress,
|
|
407
|
+
/** Exact base-unit sell amount, a positive integer as decimal. */
|
|
408
|
+
sellAmount: z.string().check(z.regex(/^[1-9][0-9]*$/)),
|
|
409
|
+
/** The address the settlement contract pays out for. */
|
|
410
|
+
taker: evmAddress,
|
|
411
|
+
/** Worst-case slippage in basis points, 1–5000 (a query string, coerced). */
|
|
412
|
+
slippageBps: z.coerce.number().check(z.int(), z.minimum(1), z.maximum(5e3))
|
|
413
|
+
});
|
|
414
|
+
const fee = z.object({
|
|
415
|
+
/** The token the fee is charged in (sell or buy token). */
|
|
416
|
+
token: evmAddress,
|
|
417
|
+
/** The fee amount in base units. */
|
|
418
|
+
amount: decimal
|
|
419
|
+
});
|
|
420
|
+
/** A quote with liquidity: the AllowanceHolder `exec` calldata to sign and the terms it must keep. */
|
|
421
|
+
const quoteFilled = z.object({
|
|
422
|
+
liquidity: z.literal(true),
|
|
423
|
+
provider: z.literal("0x"),
|
|
424
|
+
sellToken: evmAddress,
|
|
425
|
+
buyToken: evmAddress,
|
|
426
|
+
sellAmount: decimal,
|
|
427
|
+
buyAmount: decimal,
|
|
428
|
+
minBuyAmount: decimal,
|
|
429
|
+
/** The spender `exec` approves — `null` for a native sell. */
|
|
430
|
+
allowanceTarget: z.union([evmAddress, z.null()]),
|
|
431
|
+
transaction: z.object({
|
|
432
|
+
to: evmAddress,
|
|
433
|
+
data: z.string().check(z.regex(/^0x[0-9a-fA-F]*$/)),
|
|
434
|
+
value: decimal,
|
|
435
|
+
gas: z.union([decimal, z.null()])
|
|
436
|
+
}),
|
|
437
|
+
fees: z.object({
|
|
438
|
+
integrator: z.union([fee, z.null()]),
|
|
439
|
+
zeroEx: z.union([fee, z.null()])
|
|
440
|
+
}),
|
|
441
|
+
/** The block the quote was priced at — staleness is measured against this. */
|
|
442
|
+
blockNumber: decimal
|
|
443
|
+
});
|
|
444
|
+
/** No route found: the response carries only the liquidity flag. */
|
|
445
|
+
const quoteEmpty = z.object({ liquidity: z.literal(false) });
|
|
446
|
+
const swapQuoteResponse = z.union([quoteFilled, quoteEmpty]);
|
|
447
|
+
const swapQuote = endpoint("GET", "/v1/quotes/swap", swapQuoteRequest, swapQuoteResponse);
|
|
448
|
+
/** Base58 public key — Solana mints, program ids, takers and accounts are all 32-byte keys. */
|
|
449
|
+
const base58$1 = z.string().check(z.regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/));
|
|
450
|
+
/** Jupiter is mainnet-only — every other Solana CAIP-2 id is a client error. */
|
|
451
|
+
const SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
452
|
+
/** The `swapQuoteSolana` request: an exact-in mint pair for a taker on Solana mainnet. */
|
|
453
|
+
const swapQuoteSolanaRequest = z.object({
|
|
454
|
+
network: z.literal(SOLANA_MAINNET),
|
|
455
|
+
/** The mint sold — `So111…112` for wrapped SOL. */
|
|
456
|
+
inputMint: base58$1,
|
|
457
|
+
/** The mint bought — `So111…112` for wrapped SOL. */
|
|
458
|
+
outputMint: base58$1,
|
|
459
|
+
/** Exact base-unit sell amount, a positive integer as decimal. */
|
|
460
|
+
amount: z.string().check(z.regex(/^[1-9][0-9]*$/)),
|
|
461
|
+
/** The account the swap settles for. */
|
|
462
|
+
taker: base58$1,
|
|
463
|
+
/** Worst-case slippage in basis points, 1–5000 (a query string, coerced). */
|
|
464
|
+
slippageBps: z.coerce.number().check(z.int(), z.minimum(1), z.maximum(5e3))
|
|
465
|
+
});
|
|
466
|
+
/** One Solana instruction as the wire carries it — base64 data, plain account flags. */
|
|
467
|
+
const solanaInstruction = z.object({
|
|
468
|
+
programId: base58$1,
|
|
469
|
+
accounts: z.array(z.object({
|
|
470
|
+
address: base58$1,
|
|
471
|
+
signer: z.boolean(),
|
|
472
|
+
writable: z.boolean()
|
|
473
|
+
})),
|
|
474
|
+
data: z.string().check(z.regex(/^[A-Za-z0-9+/]*={0,2}$/))
|
|
475
|
+
});
|
|
476
|
+
/**
|
|
477
|
+
* A Jupiter `/build` relay: the instructions that assemble the versioned transaction — the engine
|
|
478
|
+
* replaces the compute budget with its own and reads the named lookup tables from chain.
|
|
479
|
+
*/
|
|
480
|
+
const solanaQuoteFilled = z.object({
|
|
481
|
+
liquidity: z.literal(true),
|
|
482
|
+
provider: z.literal("jupiter"),
|
|
483
|
+
inputMint: base58$1,
|
|
484
|
+
outputMint: base58$1,
|
|
485
|
+
inAmount: decimal,
|
|
486
|
+
outAmount: decimal,
|
|
487
|
+
otherAmountThreshold: decimal,
|
|
488
|
+
slippageBps: z.coerce.number().check(z.int()),
|
|
489
|
+
setup: z.array(solanaInstruction),
|
|
490
|
+
swap: solanaInstruction,
|
|
491
|
+
cleanup: z.union([solanaInstruction, z.null()]),
|
|
492
|
+
/** The address lookup tables the message compresses against — contents never come over the wire. */
|
|
493
|
+
lookupTables: z.array(base58$1)
|
|
494
|
+
});
|
|
495
|
+
const swapQuoteSolanaResponse = z.union([solanaQuoteFilled, quoteEmpty]);
|
|
496
|
+
const swapQuoteSolana = endpoint("GET", "/v1/quotes/swap/solana", swapQuoteSolanaRequest, swapQuoteSolanaResponse);
|
|
497
|
+
/** The `bridgeQuote` request: an exact-in token transfer from an origin chain to a destination. */
|
|
498
|
+
const bridgeQuoteRequest = z.object({
|
|
499
|
+
/** `eip155:<n>` — the origin chain. */
|
|
500
|
+
network: caip2.check(z.regex(/^eip155:[0-9]+$/)),
|
|
501
|
+
/** `eip155:<n>` — the destination chain. */
|
|
502
|
+
destinationNetwork: caip2.check(z.regex(/^eip155:[0-9]+$/)),
|
|
503
|
+
/** The token deposited on the origin chain — the chain's wrapped native for a native send. */
|
|
504
|
+
inputToken: evmAddress,
|
|
505
|
+
/** The token received on the destination chain. */
|
|
506
|
+
outputToken: evmAddress,
|
|
507
|
+
/** Exact base-unit input amount, a positive integer as decimal. */
|
|
508
|
+
amount: z.string().check(z.regex(/^[1-9][0-9]*$/)),
|
|
509
|
+
/** The account the deposit settles for. */
|
|
510
|
+
taker: evmAddress
|
|
511
|
+
});
|
|
512
|
+
/**
|
|
513
|
+
* An Across `/suggested-fees` relay: the deposit terms the engine must verify on-chain — output and
|
|
514
|
+
* deadline verbatim, the spoke pool address so a stale or spoofed build is refused.
|
|
515
|
+
*/
|
|
516
|
+
const bridgeQuoteFilled = z.object({
|
|
517
|
+
liquidity: z.literal(true),
|
|
518
|
+
provider: z.literal("across"),
|
|
519
|
+
inputToken: evmAddress,
|
|
520
|
+
outputToken: evmAddress,
|
|
521
|
+
inputAmount: decimal,
|
|
522
|
+
outputAmount: decimal,
|
|
523
|
+
destinationNetwork: caip2.check(z.regex(/^eip155:[0-9]+$/)),
|
|
524
|
+
quoteTimestamp: z.coerce.number().check(z.int()),
|
|
525
|
+
fillDeadline: z.coerce.number().check(z.int()),
|
|
526
|
+
exclusiveRelayer: evmAddress,
|
|
527
|
+
exclusivityParameter: z.coerce.number().check(z.int()),
|
|
528
|
+
spokePool: evmAddress,
|
|
529
|
+
limits: z.object({
|
|
530
|
+
minDeposit: decimal,
|
|
531
|
+
maxDeposit: decimal
|
|
532
|
+
})
|
|
533
|
+
});
|
|
534
|
+
const bridgeQuoteResponse = z.union([bridgeQuoteFilled, quoteEmpty]);
|
|
535
|
+
const bridgeQuote = endpoint("GET", "/v1/quotes/bridge", bridgeQuoteRequest, bridgeQuoteResponse);
|
|
536
|
+
export { BITCOIN_NETWORKS, ESPLORA_ROUTES, EVM_RPC_METHODS, GATEWAY_ERRORS, INSTALL_ID_HEADER, NETWORKS, PHISHING_HASH_BYTES, PHISHING_MAX_PATH_SEGMENTS, PROVIDERS_HEADER, RPC_BATCH_MAX, SOLANA_MAINNET, SOLANA_NETWORKS, SOLANA_RPC_METHODS, ZEROX_NATIVE_TOKEN, accepts, applyDiff, bridgeQuote, bridgeQuoteRequest, bridgeQuoteResponse, caip2, contains, decodeHashList, difference, encodeHashList, endpoint, esploraBasePath, esploraGet, esploraPathAllowed, esploraPost, evmRpcRequest, gatewayError, hashCount, hashList, health, healthRequest, healthResponse, installId, jsonRpcId, jsonRpcResponse, networkById, networksPath, parseWith, phishingCandidates, phishingHash, phishingKey, phishingList, phishingListPath, phishingListRequest, phishingListResponse, rpc, rpcPath, rpcRequest, rpcResponse, servedNetworks, servedNetworksRequest, servedNetworksResponse, solanaInstruction, solanaRpcRequest, swapQuote, swapQuoteRequest, swapQuoteResponse, swapQuoteSolana, swapQuoteSolanaRequest, swapQuoteSolanaResponse, union };
|
|
393
537
|
|
|
394
538
|
//# sourceMappingURL=gateway-contract.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-contract.mjs","names":[],"sources":["../src/gateway/contract/endpoint.ts","../src/gateway/contract/rpc.ts","../src/gateway/contract/primitives.ts","../src/gateway/contract/health.ts","../src/gateway/contract/esplora.ts","../src/gateway/contract/served.ts","../src/gateway/contract/risk.ts","../src/gateway/contract/hash-list.ts"],"sourcesContent":["import * as z from \"zod/mini\";\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"DELETE\";\n\nexport type Endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType> = {\n readonly method: HttpMethod;\n readonly path: string;\n readonly request: Req;\n readonly response: Res;\n};\n\n/** One gateway route: its verb, versioned path template, and request/response schemas. */\nexport function endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType>(\n method: HttpMethod,\n path: `/v1/${string}`,\n request: Req,\n response: Res,\n): Endpoint<Req, Res> {\n return { method, path, request, response };\n}\n\n/** `value` typed by `schema`, or `undefined` when it does not satisfy it. */\nexport function parseWith<S extends z.ZodMiniType>(\n schema: S,\n value: unknown,\n): z.output<S> | undefined {\n const result = z.safeParse(schema, value);\n return result.success ? result.data : undefined;\n}\n\n/** Whether `value` satisfies `schema` — lets consumers validate without importing zod. */\nexport function accepts(schema: z.ZodMiniType, value: unknown): boolean {\n return z.safeParse(schema, value).success;\n}\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\n/** One JSON-RPC call plus nothing else: batches may carry at most this many entries. */\nexport const RPC_BATCH_MAX = 20;\n\n/** Read-only EVM methods plus `eth_sendRawTransaction`. Anything not listed is rejected. */\nexport const EVM_RPC_METHODS = [\n \"eth_blobBaseFee\",\n \"eth_blockNumber\",\n \"eth_call\",\n \"eth_chainId\",\n \"eth_createAccessList\",\n \"eth_estimateGas\",\n \"eth_feeHistory\",\n \"eth_gasPrice\",\n \"eth_getBalance\",\n \"eth_getBlockByHash\",\n \"eth_getBlockByNumber\",\n \"eth_getBlockReceipts\",\n \"eth_getBlockTransactionCountByHash\",\n \"eth_getBlockTransactionCountByNumber\",\n \"eth_getCode\",\n \"eth_getProof\",\n \"eth_getStorageAt\",\n \"eth_getTransactionByBlockHashAndIndex\",\n \"eth_getTransactionByBlockNumberAndIndex\",\n \"eth_getTransactionByHash\",\n \"eth_getTransactionCount\",\n \"eth_getTransactionReceipt\",\n \"eth_maxPriorityFeePerGas\",\n \"eth_sendRawTransaction\",\n \"eth_simulateV1\",\n \"net_version\",\n \"web3_clientVersion\",\n] as const;\n\n/** Read-only Solana methods plus `sendTransaction`. Anything not listed is rejected. */\nexport const SOLANA_RPC_METHODS = [\n \"getAccountInfo\",\n \"getBalance\",\n \"getBlock\",\n \"getBlockHeight\",\n \"getBlockTime\",\n \"getEpochInfo\",\n \"getFeeForMessage\",\n \"getGenesisHash\",\n \"getLatestBlockhash\",\n \"getMinimumBalanceForRentExemption\",\n \"getMultipleAccounts\",\n \"getRecentPrioritizationFees\",\n \"getSignatureStatuses\",\n \"getSignaturesForAddress\",\n \"getSlot\",\n \"getTokenAccountBalance\",\n \"getTokenAccountsByOwner\",\n \"getTokenSupply\",\n \"getTransaction\",\n \"getVersion\",\n \"isBlockhashValid\",\n \"sendTransaction\",\n \"simulateTransaction\",\n] as const;\n\nexport type EvmRpcMethod = (typeof EVM_RPC_METHODS)[number];\nexport type SolanaRpcMethod = (typeof SOLANA_RPC_METHODS)[number];\n\nexport const jsonRpcId = z.union([z.string(), z.number(), z.null()]);\n\nconst jsonRpcParams = z.optional(\n z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]),\n);\n\nconst callSchema = <M extends z.ZodMiniType<string>>(method: M) =>\n z.object({ jsonrpc: z.literal(\"2.0\"), id: jsonRpcId, method, params: jsonRpcParams });\n\nconst bodySchema = <C extends z.ZodMiniType>(call: C) =>\n z.union([call, z.array(call).check(z.minLength(1), z.maxLength(RPC_BATCH_MAX))]);\n\n/** Method-agnostic wire shape of a call or batch (the gateway narrows by family). */\nexport const rpcRequest = bodySchema(callSchema(z.string()));\n\nexport const evmRpcRequest = bodySchema(callSchema(z.enum(EVM_RPC_METHODS)));\nexport const solanaRpcRequest = bodySchema(callSchema(z.enum(SOLANA_RPC_METHODS)));\n\nconst successResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n result: z.unknown(),\n});\nconst errorResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n error: z.object({ code: z.int(), message: z.string(), data: z.optional(z.unknown()) }),\n});\n\nexport const jsonRpcResponse = z.union([successResponse, errorResponse]);\nexport const rpcResponse = z.union([jsonRpcResponse, z.array(jsonRpcResponse)]);\n\nexport const rpc = endpoint(\"POST\", \"/v1/rpc/:caip2\", rpcRequest, rpcResponse);\n\n/** The JSON-RPC URL path for one network. */\nexport const rpcPath = (caip2: string): string => rpc.path.replace(\":caip2\", caip2);\n","import * as z from \"zod/mini\";\n\nexport const INSTALL_ID_HEADER = \"x-install-id\";\nexport const PROVIDERS_HEADER = \"x-gateway-providers\";\n\n/** 128 random bits as lowercase hex — generated once per install, unrelated to wallet secrets. */\nexport const installId = z.string().check(z.regex(/^[0-9a-f]{32}$/));\n\n/** CAIP-2 chain id: `namespace:reference`. */\nexport const caip2 = z.string().check(z.regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/));\n\nexport type Caip2 = z.infer<typeof caip2>;\nexport type InstallId = z.infer<typeof installId>;\n\nexport const GATEWAY_ERRORS = [\n \"invalid-request\",\n \"unknown-network\",\n \"not-found\",\n \"rate-limited\",\n \"unavailable\",\n \"internal\",\n] as const;\n\nexport const gatewayError = z.object({ error: z.enum(GATEWAY_ERRORS) });\n\nexport type GatewayErrorCode = (typeof GATEWAY_ERRORS)[number];\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nexport const healthRequest = z.undefined();\nexport const healthResponse = z.object({ status: z.literal(\"ok\") });\n\nexport const health = endpoint(\"GET\", \"/v1/health\", healthRequest, healthResponse);\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nconst HEX64 = \"[0-9a-f]{64}\";\n\ntype EsploraRoute = { readonly method: \"GET\" | \"POST\"; readonly pattern: RegExp };\n\n/** The Esplora surface the engine uses; every other path is rejected. */\nexport const ESPLORA_ROUTES: ReadonlyArray<EsploraRoute> = [\n { method: \"GET\", pattern: /^\\/block-height\\/\\d{1,10}$/ },\n { method: \"GET\", pattern: /^\\/fee-estimates$/ },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/txs$`) },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/utxo$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/hex$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/status$`) },\n { method: \"POST\", pattern: /^\\/tx$/ },\n];\n\n/** `path` is the Esplora path after `/v1/esplora/:caip2`, with a leading slash and no query. */\nexport const esploraPathAllowed = (method: string, path: string): boolean =>\n ESPLORA_ROUTES.some((route) => route.method === method && route.pattern.test(path));\n\nexport const esploraGet = endpoint(\"GET\", \"/v1/esplora/:caip2/*\", z.undefined(), z.unknown());\n\n/** The Esplora base path for one network; allow-listed paths are appended to it. */\nexport const esploraBasePath = (caip2: string): string =>\n esploraGet.path.replace(\":caip2\", caip2).replace(/\\/\\*$/, \"\");\nexport const esploraPost = endpoint(\"POST\", \"/v1/esplora/:caip2/tx\", z.string(), z.string());\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\nimport { caip2 } from \"./primitives.ts\";\n\nexport const servedNetworksRequest = z.undefined();\n/** The networks the gateway actually serves, in its configured order. */\nexport const servedNetworksResponse = z.object({ networks: z.array(caip2) });\n\nexport const servedNetworks = endpoint(\n \"GET\",\n \"/v1/networks\",\n servedNetworksRequest,\n servedNetworksResponse,\n);\n\nexport const networksPath: string = servedNetworks.path;\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nexport const PHISHING_HASH_BYTES = 8;\nexport const PHISHING_MAX_PATH_SEGMENTS = 8;\n\nconst MAX_HOST_LENGTH = 253;\nconst MIN_HOST_LABELS = 2;\nconst FORBIDDEN_ENTRY = /:\\/\\/|[?#@\\\\\\s]/;\nconst IPV4 = /^\\d{1,3}(?:\\.\\d{1,3}){3}$/;\n/** Lowercase ASCII labels ending in a non-numeric label: `new URL` returns such a host unchanged. */\nconst PLAIN_HOST = /^(?:[a-z0-9_-]+\\.)+[a-z][a-z0-9_-]*\\.?$/;\n\nconst trimTrailingDot = (host: string): string => (host.endsWith(\".\") ? host.slice(0, -1) : host);\n\nconst pathSegments = (pathname: string): ReadonlyArray<string> =>\n pathname.split(\"/\").filter((segment) => segment !== \"\");\n\n/** One list entry as its lookup key, or `undefined` when the entry is not a usable host or path. */\nexport function phishingKey(entry: string): string | undefined {\n if (PLAIN_HOST.test(entry) && !entry.includes(\"xn--\")) {\n const host = trimTrailingDot(entry);\n return host.length > MAX_HOST_LENGTH ? undefined : host;\n }\n let raw = entry.trim();\n if (raw.startsWith(\"*.\")) {\n raw = raw.slice(2);\n }\n if (raw === \"\" || FORBIDDEN_ENTRY.test(raw)) {\n return undefined;\n }\n let url: URL;\n try {\n url = new URL(`https://${raw}`);\n } catch {\n return undefined;\n }\n if ((raw.split(\"/\")[0] ?? \"\").includes(\":\")) {\n return undefined;\n }\n const host = trimTrailingDot(url.hostname.toLowerCase());\n const labels = host.split(\".\");\n if (\n host.length > MAX_HOST_LENGTH ||\n labels.length < MIN_HOST_LABELS ||\n labels.some((label) => label === \"\")\n ) {\n return undefined;\n }\n const segments = pathSegments(url.pathname);\n if (segments.length === 0) {\n return host;\n }\n if (segments.length > PHISHING_MAX_PATH_SEGMENTS) {\n return undefined;\n }\n return `${host}/${segments.join(\"/\")}`;\n}\n\n/** The first 8 bytes of SHA-256 over the UTF-8 key. */\nexport function phishingHash(key: string): Uint8Array {\n return sha256(utf8ToBytes(key)).slice(0, PHISHING_HASH_BYTES);\n}\n\n/** Lookup keys for a page URL, most specific first; empty for anything but http(s). */\nexport function phishingCandidates(url: string): ReadonlyArray<string> {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return [];\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return [];\n }\n const host = trimTrailingDot(parsed.hostname);\n if (host === \"\") {\n return [];\n }\n if (host.startsWith(\"[\") || IPV4.test(host)) {\n return [host];\n }\n const segments = pathSegments(parsed.pathname).slice(0, PHISHING_MAX_PATH_SEGMENTS);\n const candidates: string[] = [];\n for (let depth = segments.length; depth > 0; depth -= 1) {\n candidates.push(`${host}/${segments.slice(0, depth).join(\"/\")}`);\n }\n const labels = host.split(\".\");\n for (let start = 0; labels.length - start >= MIN_HOST_LABELS; start += 1) {\n candidates.push(labels.slice(start).join(\".\"));\n }\n return candidates;\n}\n\nconst version = z.number().check(z.int(), z.nonnegative());\n\n/** Concatenated sorted 8-byte hashes, standard-alphabet base64; the empty string is an empty set. */\nconst hashes = z\n .string()\n .check(z.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/));\n\nconst delta = z.object({ add: hashes, remove: hashes });\n\nexport const phishingListRequest = z.object({\n since: z.optional(z.string().check(z.regex(/^\\d{1,15}$/))),\n});\n\nexport const phishingListResponse = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"current\"), version }),\n z.object({\n kind: z.literal(\"diff\"),\n from: version,\n version,\n deny: delta,\n allow: delta,\n }),\n z.object({ kind: z.literal(\"snapshot\"), version, deny: hashes, allow: hashes }),\n]);\n\nexport type PhishingListResponse = z.infer<typeof phishingListResponse>;\n\nexport const phishingList = endpoint(\n \"GET\",\n \"/v1/risk/lists/phishing\",\n phishingListRequest,\n phishingListResponse,\n);\n\nexport const phishingListPath: string = phishingList.path;\n","import { base64 } from \"@scure/base\";\n\nimport { PHISHING_HASH_BYTES } from \"./risk.ts\";\n\n/** Strictly ascending 8-byte hashes, concatenated: a sorted set. */\nexport type HashList = Uint8Array;\n\nconst WIDTH = PHISHING_HASH_BYTES;\n\nfunction compareAt(a: Uint8Array, ai: number, b: Uint8Array, bi: number): number {\n for (let k = 0; k < WIDTH; k += 1) {\n const delta = (a[ai * WIDTH + k] ?? 0) - (b[bi * WIDTH + k] ?? 0);\n if (delta !== 0) {\n return delta;\n }\n }\n return 0;\n}\n\nconst size = (list: HashList): number => list.length / WIDTH;\n\nexport const hashCount = size;\n\nconst isStrictlyAscending = (list: HashList): boolean => {\n for (let i = 1; i < size(list); i += 1) {\n if (compareAt(list, i - 1, list, i) >= 0) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * A base64 hash list, or `undefined` when it is not whole 8-byte hashes in strictly ascending\n * order.\n */\nexport function decodeHashList(encoded: string): HashList | undefined {\n let bytes: Uint8Array;\n try {\n bytes = base64.decode(encoded);\n } catch {\n return undefined;\n }\n return bytes.length % WIDTH === 0 && isStrictlyAscending(bytes) ? bytes : undefined;\n}\n\nconst RADIX = 256;\n\n/** Indices of the `count` hashes in `flat`, ascending: an LSD radix sort, one pass per byte. */\nfunction sortedOrder(flat: Uint8Array, count: number): Uint32Array {\n let order = new Uint32Array(count);\n let scratch = new Uint32Array(count);\n for (let i = 0; i < count; i += 1) {\n order[i] = i;\n }\n const offsets = new Uint32Array(RADIX + 1);\n for (let byte = WIDTH - 1; byte >= 0; byte -= 1) {\n offsets.fill(0);\n for (let i = 0; i < count; i += 1) {\n const slot = (flat[i * WIDTH + byte] ?? 0) + 1;\n offsets[slot] = (offsets[slot] ?? 0) + 1;\n }\n for (let bucket = 0; bucket < RADIX; bucket += 1) {\n offsets[bucket + 1] = (offsets[bucket + 1] ?? 0) + (offsets[bucket] ?? 0);\n }\n for (let i = 0; i < count; i += 1) {\n const index = order[i] ?? 0;\n const bucket = flat[index * WIDTH + byte] ?? 0;\n scratch[offsets[bucket] ?? 0] = index;\n offsets[bucket] = (offsets[bucket] ?? 0) + 1;\n }\n [order, scratch] = [scratch, order];\n }\n return order;\n}\n\n/** The sorted set of `hashes`, duplicates removed. */\nexport function hashList(hashes: Iterable<Uint8Array>): HashList {\n let flat = new Uint8Array(1024 * WIDTH);\n let count = 0;\n for (const hash of hashes) {\n if ((count + 1) * WIDTH > flat.length) {\n const grown = new Uint8Array(flat.length * 2);\n grown.set(flat);\n flat = grown;\n }\n flat.set(hash.subarray(0, WIDTH), count * WIDTH);\n count += 1;\n }\n const order = sortedOrder(flat, count);\n const out = new Uint8Array(count * WIDTH);\n let written = 0;\n for (let i = 0; i < count; i += 1) {\n const at = (order[i] ?? 0) * WIDTH;\n if (written === 0 || compareAt(out, written / WIDTH - 1, flat, at / WIDTH) !== 0) {\n out.set(flat.subarray(at, at + WIDTH), written);\n written += WIDTH;\n }\n }\n return out.slice(0, written);\n}\n\nexport const encodeHashList = (list: HashList): string => base64.encode(list);\n\nexport function contains(list: HashList, hash: Uint8Array): boolean {\n let low = 0;\n let high = size(list) - 1;\n while (low <= high) {\n const middle = Math.floor((low + high) / 2);\n const order = compareAt(list, middle, hash, 0);\n if (order === 0) {\n return true;\n }\n if (order < 0) {\n low = middle + 1;\n } else {\n high = middle - 1;\n }\n }\n return false;\n}\n\nfunction merge(a: HashList, b: HashList, keep: (inA: boolean, inB: boolean) => boolean): HashList {\n const out = new Uint8Array(a.length + b.length);\n let written = 0;\n const take = (source: Uint8Array, index: number): void => {\n out.set(source.subarray(index * WIDTH, (index + 1) * WIDTH), written);\n written += WIDTH;\n };\n let i = 0;\n let j = 0;\n while (i < size(a) || j < size(b)) {\n const order = i >= size(a) ? 1 : j >= size(b) ? -1 : compareAt(a, i, b, j);\n if (order < 0) {\n if (keep(true, false)) {\n take(a, i);\n }\n i += 1;\n } else if (order > 0) {\n if (keep(false, true)) {\n take(b, j);\n }\n j += 1;\n } else {\n if (keep(true, true)) {\n take(a, i);\n }\n i += 1;\n j += 1;\n }\n }\n return out.slice(0, written);\n}\n\nexport const union = (a: HashList, b: HashList): HashList => merge(a, b, () => true);\n\n/** The hashes of `a` that are not in `b`. */\nexport const difference = (a: HashList, b: HashList): HashList =>\n merge(a, b, (inA, inB) => inA && !inB);\n\n/** `(list − remove) ∪ add`. */\nexport const applyDiff = (list: HashList, add: HashList, remove: HashList): HashList =>\n union(difference(list, remove), add);\n"],"mappings":";;;;;;;AAYA,SAAgB,SACd,QACA,MACA,SACA,UACoB;CACpB,OAAO;EAAE;EAAQ;EAAM;EAAS;CAAS;AAC3C;;AAGA,SAAgB,UACd,QACA,OACyB;CACzB,MAAM,SAAS,EAAE,UAAU,QAAQ,KAAK;CACxC,OAAO,OAAO,UAAU,OAAO,OAAO,KAAA;AACxC;;AAGA,SAAgB,QAAQ,QAAuB,OAAyB;CACtE,OAAO,EAAE,UAAU,QAAQ,KAAK,CAAC,CAAC;AACpC;;;AC5BA,MAAa,gBAAgB;;AAG7B,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAa,YAAY,EAAE,MAAM;CAAC,EAAE,OAAO;CAAG,EAAE,OAAO;CAAG,EAAE,KAAK;AAAC,CAAC;AAEnE,MAAM,gBAAgB,EAAE,SACtB,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,OAA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I,MAAM,GAAG,OAAO;AAC7B;AAEA,MAAa,SAAS,GAAa,MAA0B,MAAM,GAAG,SAAS,IAAI;;AAGnF,MAAa,cAAc,GAAa,MACtC,MAAM,GAAG,IAAI,KAAK,QAAQ,OAAO,CAAC,GAAG;;AAGvC,MAAa,aAAa,MAAgB,KAAe,WACvD,MAAM,WAAW,MAAM,MAAM,GAAG,GAAG"}
|
|
1
|
+
{"version":3,"file":"gateway-contract.mjs","names":["base58"],"sources":["../src/gateway/contract/endpoint.ts","../src/gateway/contract/rpc.ts","../src/gateway/contract/primitives.ts","../src/gateway/contract/health.ts","../src/gateway/contract/esplora.ts","../src/gateway/contract/served.ts","../src/gateway/contract/risk.ts","../src/gateway/contract/hash-list.ts","../src/gateway/contract/quotes.ts"],"sourcesContent":["import * as z from \"zod/mini\";\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"DELETE\";\n\nexport type Endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType> = {\n readonly method: HttpMethod;\n readonly path: string;\n readonly request: Req;\n readonly response: Res;\n};\n\n/** One gateway route: its verb, versioned path template, and request/response schemas. */\nexport function endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType>(\n method: HttpMethod,\n path: `/v1/${string}`,\n request: Req,\n response: Res,\n): Endpoint<Req, Res> {\n return { method, path, request, response };\n}\n\n/** `value` typed by `schema`, or `undefined` when it does not satisfy it. */\nexport function parseWith<S extends z.ZodMiniType>(\n schema: S,\n value: unknown,\n): z.output<S> | undefined {\n const result = z.safeParse(schema, value);\n return result.success ? result.data : undefined;\n}\n\n/** Whether `value` satisfies `schema` — lets consumers validate without importing zod. */\nexport function accepts(schema: z.ZodMiniType, value: unknown): boolean {\n return z.safeParse(schema, value).success;\n}\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\n/** One JSON-RPC call plus nothing else: batches may carry at most this many entries. */\nexport const RPC_BATCH_MAX = 20;\n\n/** Read-only EVM methods plus `eth_sendRawTransaction`. Anything not listed is rejected. */\nexport const EVM_RPC_METHODS = [\n \"eth_blobBaseFee\",\n \"eth_blockNumber\",\n \"eth_call\",\n \"eth_chainId\",\n \"eth_createAccessList\",\n \"eth_estimateGas\",\n \"eth_feeHistory\",\n \"eth_gasPrice\",\n \"eth_getBalance\",\n \"eth_getBlockByHash\",\n \"eth_getBlockByNumber\",\n \"eth_getBlockReceipts\",\n \"eth_getBlockTransactionCountByHash\",\n \"eth_getBlockTransactionCountByNumber\",\n \"eth_getCode\",\n \"eth_getProof\",\n \"eth_getStorageAt\",\n \"eth_getTransactionByBlockHashAndIndex\",\n \"eth_getTransactionByBlockNumberAndIndex\",\n \"eth_getTransactionByHash\",\n \"eth_getTransactionCount\",\n \"eth_getTransactionReceipt\",\n \"eth_maxPriorityFeePerGas\",\n \"eth_sendRawTransaction\",\n \"eth_simulateV1\",\n \"net_version\",\n \"web3_clientVersion\",\n] as const;\n\n/** Read-only Solana methods plus `sendTransaction`. Anything not listed is rejected. */\nexport const SOLANA_RPC_METHODS = [\n \"getAccountInfo\",\n \"getBalance\",\n \"getBlock\",\n \"getBlockHeight\",\n \"getBlockTime\",\n \"getEpochInfo\",\n \"getFeeForMessage\",\n \"getGenesisHash\",\n \"getLatestBlockhash\",\n \"getMinimumBalanceForRentExemption\",\n \"getMultipleAccounts\",\n \"getRecentPrioritizationFees\",\n \"getSignatureStatuses\",\n \"getSignaturesForAddress\",\n \"getSlot\",\n \"getTokenAccountBalance\",\n \"getTokenAccountsByOwner\",\n \"getTokenSupply\",\n \"getTransaction\",\n \"getVersion\",\n \"isBlockhashValid\",\n \"sendTransaction\",\n \"simulateTransaction\",\n] as const;\n\nexport type EvmRpcMethod = (typeof EVM_RPC_METHODS)[number];\nexport type SolanaRpcMethod = (typeof SOLANA_RPC_METHODS)[number];\n\nexport const jsonRpcId = z.union([z.string(), z.number(), z.null()]);\n\nconst jsonRpcParams = z.optional(\n z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]),\n);\n\nconst callSchema = <M extends z.ZodMiniType<string>>(method: M) =>\n z.object({ jsonrpc: z.literal(\"2.0\"), id: jsonRpcId, method, params: jsonRpcParams });\n\nconst bodySchema = <C extends z.ZodMiniType>(call: C) =>\n z.union([call, z.array(call).check(z.minLength(1), z.maxLength(RPC_BATCH_MAX))]);\n\n/** Method-agnostic wire shape of a call or batch (the gateway narrows by family). */\nexport const rpcRequest = bodySchema(callSchema(z.string()));\n\nexport const evmRpcRequest = bodySchema(callSchema(z.enum(EVM_RPC_METHODS)));\nexport const solanaRpcRequest = bodySchema(callSchema(z.enum(SOLANA_RPC_METHODS)));\n\nconst successResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n result: z.unknown(),\n});\nconst errorResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n error: z.object({ code: z.int(), message: z.string(), data: z.optional(z.unknown()) }),\n});\n\nexport const jsonRpcResponse = z.union([successResponse, errorResponse]);\nexport const rpcResponse = z.union([jsonRpcResponse, z.array(jsonRpcResponse)]);\n\nexport const rpc = endpoint(\"POST\", \"/v1/rpc/:caip2\", rpcRequest, rpcResponse);\n\n/** The JSON-RPC URL path for one network. */\nexport const rpcPath = (caip2: string): string => rpc.path.replace(\":caip2\", caip2);\n","import * as z from \"zod/mini\";\n\nexport const INSTALL_ID_HEADER = \"x-install-id\";\nexport const PROVIDERS_HEADER = \"x-gateway-providers\";\n\n/** 128 random bits as lowercase hex — generated once per install, unrelated to wallet secrets. */\nexport const installId = z.string().check(z.regex(/^[0-9a-f]{32}$/));\n\n/** CAIP-2 chain id: `namespace:reference`. */\nexport const caip2 = z.string().check(z.regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/));\n\nexport type Caip2 = z.infer<typeof caip2>;\nexport type InstallId = z.infer<typeof installId>;\n\nexport const GATEWAY_ERRORS = [\n \"invalid-request\",\n \"unknown-network\",\n \"not-found\",\n \"rate-limited\",\n \"unavailable\",\n \"internal\",\n] as const;\n\nexport const gatewayError = z.object({ error: z.enum(GATEWAY_ERRORS) });\n\nexport type GatewayErrorCode = (typeof GATEWAY_ERRORS)[number];\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nexport const healthRequest = z.undefined();\nexport const healthResponse = z.object({ status: z.literal(\"ok\") });\n\nexport const health = endpoint(\"GET\", \"/v1/health\", healthRequest, healthResponse);\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nconst HEX64 = \"[0-9a-f]{64}\";\n\ntype EsploraRoute = { readonly method: \"GET\" | \"POST\"; readonly pattern: RegExp };\n\n/** The Esplora surface the engine uses; every other path is rejected. */\nexport const ESPLORA_ROUTES: ReadonlyArray<EsploraRoute> = [\n { method: \"GET\", pattern: /^\\/block-height\\/\\d{1,10}$/ },\n { method: \"GET\", pattern: /^\\/fee-estimates$/ },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/txs$`) },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/utxo$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/hex$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/status$`) },\n { method: \"POST\", pattern: /^\\/tx$/ },\n];\n\n/** `path` is the Esplora path after `/v1/esplora/:caip2`, with a leading slash and no query. */\nexport const esploraPathAllowed = (method: string, path: string): boolean =>\n ESPLORA_ROUTES.some((route) => route.method === method && route.pattern.test(path));\n\nexport const esploraGet = endpoint(\"GET\", \"/v1/esplora/:caip2/*\", z.undefined(), z.unknown());\n\n/** The Esplora base path for one network; allow-listed paths are appended to it. */\nexport const esploraBasePath = (caip2: string): string =>\n esploraGet.path.replace(\":caip2\", caip2).replace(/\\/\\*$/, \"\");\nexport const esploraPost = endpoint(\"POST\", \"/v1/esplora/:caip2/tx\", z.string(), z.string());\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\nimport { caip2 } from \"./primitives.ts\";\n\nexport const servedNetworksRequest = z.undefined();\n/** The networks the gateway actually serves, in its configured order. */\nexport const servedNetworksResponse = z.object({ networks: z.array(caip2) });\n\nexport const servedNetworks = endpoint(\n \"GET\",\n \"/v1/networks\",\n servedNetworksRequest,\n servedNetworksResponse,\n);\n\nexport const networksPath: string = servedNetworks.path;\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nexport const PHISHING_HASH_BYTES = 8;\nexport const PHISHING_MAX_PATH_SEGMENTS = 8;\n\nconst MAX_HOST_LENGTH = 253;\nconst MIN_HOST_LABELS = 2;\nconst FORBIDDEN_ENTRY = /:\\/\\/|[?#@\\\\\\s]/;\nconst IPV4 = /^\\d{1,3}(?:\\.\\d{1,3}){3}$/;\n/** Lowercase ASCII labels ending in a non-numeric label: `new URL` returns such a host unchanged. */\nconst PLAIN_HOST = /^(?:[a-z0-9_-]+\\.)+[a-z][a-z0-9_-]*\\.?$/;\n\nconst trimTrailingDot = (host: string): string => (host.endsWith(\".\") ? host.slice(0, -1) : host);\n\nconst pathSegments = (pathname: string): ReadonlyArray<string> =>\n pathname.split(\"/\").filter((segment) => segment !== \"\");\n\n/** One list entry as its lookup key, or `undefined` when the entry is not a usable host or path. */\nexport function phishingKey(entry: string): string | undefined {\n if (PLAIN_HOST.test(entry) && !entry.includes(\"xn--\")) {\n const host = trimTrailingDot(entry);\n return host.length > MAX_HOST_LENGTH ? undefined : host;\n }\n let raw = entry.trim();\n if (raw.startsWith(\"*.\")) {\n raw = raw.slice(2);\n }\n if (raw === \"\" || FORBIDDEN_ENTRY.test(raw)) {\n return undefined;\n }\n let url: URL;\n try {\n url = new URL(`https://${raw}`);\n } catch {\n return undefined;\n }\n if ((raw.split(\"/\")[0] ?? \"\").includes(\":\")) {\n return undefined;\n }\n const host = trimTrailingDot(url.hostname.toLowerCase());\n const labels = host.split(\".\");\n if (\n host.length > MAX_HOST_LENGTH ||\n labels.length < MIN_HOST_LABELS ||\n labels.some((label) => label === \"\")\n ) {\n return undefined;\n }\n const segments = pathSegments(url.pathname);\n if (segments.length === 0) {\n return host;\n }\n if (segments.length > PHISHING_MAX_PATH_SEGMENTS) {\n return undefined;\n }\n return `${host}/${segments.join(\"/\")}`;\n}\n\n/** The first 8 bytes of SHA-256 over the UTF-8 key. */\nexport function phishingHash(key: string): Uint8Array {\n return sha256(utf8ToBytes(key)).slice(0, PHISHING_HASH_BYTES);\n}\n\n/** Lookup keys for a page URL, most specific first; empty for anything but http(s). */\nexport function phishingCandidates(url: string): ReadonlyArray<string> {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return [];\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return [];\n }\n const host = trimTrailingDot(parsed.hostname);\n if (host === \"\") {\n return [];\n }\n if (host.startsWith(\"[\") || IPV4.test(host)) {\n return [host];\n }\n const segments = pathSegments(parsed.pathname).slice(0, PHISHING_MAX_PATH_SEGMENTS);\n const candidates: string[] = [];\n for (let depth = segments.length; depth > 0; depth -= 1) {\n candidates.push(`${host}/${segments.slice(0, depth).join(\"/\")}`);\n }\n const labels = host.split(\".\");\n for (let start = 0; labels.length - start >= MIN_HOST_LABELS; start += 1) {\n candidates.push(labels.slice(start).join(\".\"));\n }\n return candidates;\n}\n\nconst version = z.number().check(z.int(), z.nonnegative());\n\n/** Concatenated sorted 8-byte hashes, standard-alphabet base64; the empty string is an empty set. */\nconst hashes = z\n .string()\n .check(z.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/));\n\nconst delta = z.object({ add: hashes, remove: hashes });\n\nexport const phishingListRequest = z.object({\n since: z.optional(z.string().check(z.regex(/^\\d{1,15}$/))),\n});\n\nexport const phishingListResponse = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"current\"), version }),\n z.object({\n kind: z.literal(\"diff\"),\n from: version,\n version,\n deny: delta,\n allow: delta,\n }),\n z.object({ kind: z.literal(\"snapshot\"), version, deny: hashes, allow: hashes }),\n]);\n\nexport type PhishingListResponse = z.infer<typeof phishingListResponse>;\n\nexport const phishingList = endpoint(\n \"GET\",\n \"/v1/risk/lists/phishing\",\n phishingListRequest,\n phishingListResponse,\n);\n\nexport const phishingListPath: string = phishingList.path;\n","import { base64 } from \"@scure/base\";\n\nimport { PHISHING_HASH_BYTES } from \"./risk.ts\";\n\n/** Strictly ascending 8-byte hashes, concatenated: a sorted set. */\nexport type HashList = Uint8Array;\n\nconst WIDTH = PHISHING_HASH_BYTES;\n\nfunction compareAt(a: Uint8Array, ai: number, b: Uint8Array, bi: number): number {\n for (let k = 0; k < WIDTH; k += 1) {\n const delta = (a[ai * WIDTH + k] ?? 0) - (b[bi * WIDTH + k] ?? 0);\n if (delta !== 0) {\n return delta;\n }\n }\n return 0;\n}\n\nconst size = (list: HashList): number => list.length / WIDTH;\n\nexport const hashCount = size;\n\nconst isStrictlyAscending = (list: HashList): boolean => {\n for (let i = 1; i < size(list); i += 1) {\n if (compareAt(list, i - 1, list, i) >= 0) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * A base64 hash list, or `undefined` when it is not whole 8-byte hashes in strictly ascending\n * order.\n */\nexport function decodeHashList(encoded: string): HashList | undefined {\n let bytes: Uint8Array;\n try {\n bytes = base64.decode(encoded);\n } catch {\n return undefined;\n }\n return bytes.length % WIDTH === 0 && isStrictlyAscending(bytes) ? bytes : undefined;\n}\n\nconst RADIX = 256;\n\n/** Indices of the `count` hashes in `flat`, ascending: an LSD radix sort, one pass per byte. */\nfunction sortedOrder(flat: Uint8Array, count: number): Uint32Array {\n let order = new Uint32Array(count);\n let scratch = new Uint32Array(count);\n for (let i = 0; i < count; i += 1) {\n order[i] = i;\n }\n const offsets = new Uint32Array(RADIX + 1);\n for (let byte = WIDTH - 1; byte >= 0; byte -= 1) {\n offsets.fill(0);\n for (let i = 0; i < count; i += 1) {\n const slot = (flat[i * WIDTH + byte] ?? 0) + 1;\n offsets[slot] = (offsets[slot] ?? 0) + 1;\n }\n for (let bucket = 0; bucket < RADIX; bucket += 1) {\n offsets[bucket + 1] = (offsets[bucket + 1] ?? 0) + (offsets[bucket] ?? 0);\n }\n for (let i = 0; i < count; i += 1) {\n const index = order[i] ?? 0;\n const bucket = flat[index * WIDTH + byte] ?? 0;\n scratch[offsets[bucket] ?? 0] = index;\n offsets[bucket] = (offsets[bucket] ?? 0) + 1;\n }\n [order, scratch] = [scratch, order];\n }\n return order;\n}\n\n/** The sorted set of `hashes`, duplicates removed. */\nexport function hashList(hashes: Iterable<Uint8Array>): HashList {\n let flat = new Uint8Array(1024 * WIDTH);\n let count = 0;\n for (const hash of hashes) {\n if ((count + 1) * WIDTH > flat.length) {\n const grown = new Uint8Array(flat.length * 2);\n grown.set(flat);\n flat = grown;\n }\n flat.set(hash.subarray(0, WIDTH), count * WIDTH);\n count += 1;\n }\n const order = sortedOrder(flat, count);\n const out = new Uint8Array(count * WIDTH);\n let written = 0;\n for (let i = 0; i < count; i += 1) {\n const at = (order[i] ?? 0) * WIDTH;\n if (written === 0 || compareAt(out, written / WIDTH - 1, flat, at / WIDTH) !== 0) {\n out.set(flat.subarray(at, at + WIDTH), written);\n written += WIDTH;\n }\n }\n return out.slice(0, written);\n}\n\nexport const encodeHashList = (list: HashList): string => base64.encode(list);\n\nexport function contains(list: HashList, hash: Uint8Array): boolean {\n let low = 0;\n let high = size(list) - 1;\n while (low <= high) {\n const middle = Math.floor((low + high) / 2);\n const order = compareAt(list, middle, hash, 0);\n if (order === 0) {\n return true;\n }\n if (order < 0) {\n low = middle + 1;\n } else {\n high = middle - 1;\n }\n }\n return false;\n}\n\nfunction merge(a: HashList, b: HashList, keep: (inA: boolean, inB: boolean) => boolean): HashList {\n const out = new Uint8Array(a.length + b.length);\n let written = 0;\n const take = (source: Uint8Array, index: number): void => {\n out.set(source.subarray(index * WIDTH, (index + 1) * WIDTH), written);\n written += WIDTH;\n };\n let i = 0;\n let j = 0;\n while (i < size(a) || j < size(b)) {\n const order = i >= size(a) ? 1 : j >= size(b) ? -1 : compareAt(a, i, b, j);\n if (order < 0) {\n if (keep(true, false)) {\n take(a, i);\n }\n i += 1;\n } else if (order > 0) {\n if (keep(false, true)) {\n take(b, j);\n }\n j += 1;\n } else {\n if (keep(true, true)) {\n take(a, i);\n }\n i += 1;\n j += 1;\n }\n }\n return out.slice(0, written);\n}\n\nexport const union = (a: HashList, b: HashList): HashList => merge(a, b, () => true);\n\n/** The hashes of `a` that are not in `b`. */\nexport const difference = (a: HashList, b: HashList): HashList =>\n merge(a, b, (inA, inB) => inA && !inB);\n\n/** `(list − remove) ∪ add`. */\nexport const applyDiff = (list: HashList, add: HashList, remove: HashList): HashList =>\n union(difference(list, remove), add);\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\nimport { caip2 } from \"./primitives.ts\";\n\n/** The native-token sentinel 0x uses for sell and buy tokens. */\nexport const ZEROX_NATIVE_TOKEN = \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\";\n\n/** `0x` + 40 hex — an EVM address, the 0x native sentinel `0xEeee…` among them. */\nconst evmAddress = z.string().check(z.regex(/^0x[0-9a-fA-F]{40}$/));\n\n/** A decimal string of a non-negative integer (`\"0\"` allowed for gas nulls). */\nconst decimal = z.string().check(z.regex(/^[0-9]+$/));\n\n/** The `swapQuote` request: which exact-in sell on which chain, for which taker, at what slippage. */\nexport const swapQuoteRequest = z.object({\n /** `eip155:<n>` — the only namespace a 0x swap supports. */\n network: caip2.check(z.regex(/^eip155:[0-9]+$/)),\n /** The token sold — an ERC-20 address, or `0xEeeee…` for native. */\n sellToken: evmAddress,\n /** The token bought — an ERC-20 address, or `0xEeeee…` for native. */\n buyToken: evmAddress,\n /** Exact base-unit sell amount, a positive integer as decimal. */\n sellAmount: z.string().check(z.regex(/^[1-9][0-9]*$/)),\n /** The address the settlement contract pays out for. */\n taker: evmAddress,\n /** Worst-case slippage in basis points, 1–5000 (a query string, coerced). */\n slippageBps: z.coerce.number().check(z.int(), z.minimum(1), z.maximum(5000)),\n});\n\nconst fee = z.object({\n /** The token the fee is charged in (sell or buy token). */\n token: evmAddress,\n /** The fee amount in base units. */\n amount: decimal,\n});\n\n/** A quote with liquidity: the AllowanceHolder `exec` calldata to sign and the terms it must keep. */\nconst quoteFilled = z.object({\n liquidity: z.literal(true),\n provider: z.literal(\"0x\"),\n sellToken: evmAddress,\n buyToken: evmAddress,\n sellAmount: decimal,\n buyAmount: decimal,\n minBuyAmount: decimal,\n /** The spender `exec` approves — `null` for a native sell. */\n allowanceTarget: z.union([evmAddress, z.null()]),\n transaction: z.object({\n to: evmAddress,\n data: z.string().check(z.regex(/^0x[0-9a-fA-F]*$/)),\n value: decimal,\n gas: z.union([decimal, z.null()]),\n }),\n fees: z.object({\n integrator: z.union([fee, z.null()]),\n zeroEx: z.union([fee, z.null()]),\n }),\n /** The block the quote was priced at — staleness is measured against this. */\n blockNumber: decimal,\n});\n\n/** No route found: the response carries only the liquidity flag. */\nconst quoteEmpty = z.object({ liquidity: z.literal(false) });\n\nexport const swapQuoteResponse = z.union([quoteFilled, quoteEmpty]);\n\nexport const swapQuote = endpoint(\"GET\", \"/v1/quotes/swap\", swapQuoteRequest, swapQuoteResponse);\n\nexport type SwapQuoteRequest = z.infer<typeof swapQuoteRequest>;\nexport type SwapQuoteResponse = z.infer<typeof swapQuoteResponse>;\n\n/** Base58 public key — Solana mints, program ids, takers and accounts are all 32-byte keys. */\nconst base58 = z.string().check(z.regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/));\n\n/** Jupiter is mainnet-only — every other Solana CAIP-2 id is a client error. */\nexport const SOLANA_MAINNET = \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\";\n\n/** The `swapQuoteSolana` request: an exact-in mint pair for a taker on Solana mainnet. */\nexport const swapQuoteSolanaRequest = z.object({\n network: z.literal(SOLANA_MAINNET),\n /** The mint sold — `So111…112` for wrapped SOL. */\n inputMint: base58,\n /** The mint bought — `So111…112` for wrapped SOL. */\n outputMint: base58,\n /** Exact base-unit sell amount, a positive integer as decimal. */\n amount: z.string().check(z.regex(/^[1-9][0-9]*$/)),\n /** The account the swap settles for. */\n taker: base58,\n /** Worst-case slippage in basis points, 1–5000 (a query string, coerced). */\n slippageBps: z.coerce.number().check(z.int(), z.minimum(1), z.maximum(5000)),\n});\n\n/** One Solana instruction as the wire carries it — base64 data, plain account flags. */\nexport const solanaInstruction = z.object({\n programId: base58,\n accounts: z.array(\n z.object({\n address: base58,\n signer: z.boolean(),\n writable: z.boolean(),\n }),\n ),\n data: z.string().check(z.regex(/^[A-Za-z0-9+/]*={0,2}$/)),\n});\n\n/**\n * A Jupiter `/build` relay: the instructions that assemble the versioned transaction — the engine\n * replaces the compute budget with its own and reads the named lookup tables from chain.\n */\nconst solanaQuoteFilled = z.object({\n liquidity: z.literal(true),\n provider: z.literal(\"jupiter\"),\n inputMint: base58,\n outputMint: base58,\n inAmount: decimal,\n outAmount: decimal,\n otherAmountThreshold: decimal,\n slippageBps: z.coerce.number().check(z.int()),\n setup: z.array(solanaInstruction),\n swap: solanaInstruction,\n cleanup: z.union([solanaInstruction, z.null()]),\n /** The address lookup tables the message compresses against — contents never come over the wire. */\n lookupTables: z.array(base58),\n});\n\nexport const swapQuoteSolanaResponse = z.union([solanaQuoteFilled, quoteEmpty]);\n\nexport const swapQuoteSolana = endpoint(\n \"GET\",\n \"/v1/quotes/swap/solana\",\n swapQuoteSolanaRequest,\n swapQuoteSolanaResponse,\n);\n\nexport type SwapQuoteSolanaRequest = z.infer<typeof swapQuoteSolanaRequest>;\nexport type SwapQuoteSolanaResponse = z.infer<typeof swapQuoteSolanaResponse>;\n\n/** The `bridgeQuote` request: an exact-in token transfer from an origin chain to a destination. */\nexport const bridgeQuoteRequest = z.object({\n /** `eip155:<n>` — the origin chain. */\n network: caip2.check(z.regex(/^eip155:[0-9]+$/)),\n /** `eip155:<n>` — the destination chain. */\n destinationNetwork: caip2.check(z.regex(/^eip155:[0-9]+$/)),\n /** The token deposited on the origin chain — the chain's wrapped native for a native send. */\n inputToken: evmAddress,\n /** The token received on the destination chain. */\n outputToken: evmAddress,\n /** Exact base-unit input amount, a positive integer as decimal. */\n amount: z.string().check(z.regex(/^[1-9][0-9]*$/)),\n /** The account the deposit settles for. */\n taker: evmAddress,\n});\n\n/**\n * An Across `/suggested-fees` relay: the deposit terms the engine must verify on-chain — output and\n * deadline verbatim, the spoke pool address so a stale or spoofed build is refused.\n */\nconst bridgeQuoteFilled = z.object({\n liquidity: z.literal(true),\n provider: z.literal(\"across\"),\n inputToken: evmAddress,\n outputToken: evmAddress,\n inputAmount: decimal,\n outputAmount: decimal,\n destinationNetwork: caip2.check(z.regex(/^eip155:[0-9]+$/)),\n quoteTimestamp: z.coerce.number().check(z.int()),\n fillDeadline: z.coerce.number().check(z.int()),\n exclusiveRelayer: evmAddress,\n exclusivityParameter: z.coerce.number().check(z.int()),\n spokePool: evmAddress,\n limits: z.object({ minDeposit: decimal, maxDeposit: decimal }),\n});\n\nexport const bridgeQuoteResponse = z.union([bridgeQuoteFilled, quoteEmpty]);\n\nexport const bridgeQuote = endpoint(\n \"GET\",\n \"/v1/quotes/bridge\",\n bridgeQuoteRequest,\n bridgeQuoteResponse,\n);\n\nexport type BridgeQuoteRequest = z.infer<typeof bridgeQuoteRequest>;\nexport type BridgeQuoteResponse = z.infer<typeof bridgeQuoteResponse>;\n"],"mappings":";;;;;;;AAYA,SAAgB,SACd,QACA,MACA,SACA,UACoB;CACpB,OAAO;EAAE;EAAQ;EAAM;EAAS;CAAS;AAC3C;;AAGA,SAAgB,UACd,QACA,OACyB;CACzB,MAAM,SAAS,EAAE,UAAU,QAAQ,KAAK;CACxC,OAAO,OAAO,UAAU,OAAO,OAAO,KAAA;AACxC;;AAGA,SAAgB,QAAQ,QAAuB,OAAyB;CACtE,OAAO,EAAE,UAA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