@spicenet-io/spiceflow-core 0.9.0-private-rpc.0 → 0.9.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/index.cjs CHANGED
@@ -393,92 +393,7 @@ async function submitTransaction(baseUrl, request, retry) {
393
393
  }
394
394
 
395
395
  // src/core.ts
396
- var SpiceFlowCore = class {
397
- constructor(cfg, signers) {
398
- this.cfg = cfg;
399
- this.signers = signers;
400
- }
401
- getConfig() {
402
- return this.cfg;
403
- }
404
- getClient(chainId) {
405
- return this.cfg.publicClientForChain(chainId);
406
- }
407
- async signDelegations(params) {
408
- const out = [];
409
- for (const d of params.delegations) {
410
- const client = this.getClient(d.chainId);
411
- const nonce = typeof d.nonce === "number" ? d.nonce : await getAccountNonce(params.user, client);
412
- const auth = await this.signers.authorizationSigner({
413
- contractAddress: d.contractAddress,
414
- chainId: d.chainId,
415
- nonce,
416
- address: params.user
417
- });
418
- delete auth.v;
419
- out.push(auth);
420
- }
421
- return out;
422
- }
423
- async buildChainBatches(nbf, exp, callsByChain, signatureType = "ecdsa") {
424
- const chainBatches = hashChainBatches(
425
- callsByChain.map((c) => ({ chainId: c.chainId, calls: c.calls }))
426
- );
427
- const digest = getIntentHash(
428
- signatureType,
429
- nbf,
430
- exp,
431
- chainBatches
432
- );
433
- return { chainBatches, digest };
434
- }
435
- async signIntent(digest) {
436
- return this.signers.messageSigner(digest);
437
- }
438
- async submitIntent(req) {
439
- const signatureType = req.signatureType ?? "ecdsa";
440
- const signature = req.signature ?? await this.signIntent(
441
- getIntentHash(
442
- signatureType,
443
- req.nbf,
444
- req.exp,
445
- req.chainBatches
446
- )
447
- );
448
- const resp = await submitTransaction(this.cfg.txApiUrl, {
449
- tokenAddress: req.tokenAddress,
450
- tokenAmount: req.tokenAmount,
451
- address: req.user,
452
- authorization: req.authorization,
453
- intentAuthorization: { signature, chainBatches: req.chainBatches }
454
- });
455
- return resp;
456
- }
457
- };
458
-
459
- // src/status.ts
460
- async function getIntentStepStatus(txApiUrl, intentId, stepId, retry) {
461
- const res = await fetchWithRetry(
462
- `${txApiUrl}/intent/${intentId}/step/${stepId}/status`,
463
- {},
464
- retry
465
- );
466
- return res.json();
467
- }
468
-
469
- // src/rfqt.ts
470
- async function prepareRFQT(txApiUrl, request, retry) {
471
- const res = await fetchWithRetry(
472
- `${txApiUrl}/rfqt`,
473
- {
474
- method: "POST",
475
- headers: { "Content-Type": "application/json" },
476
- body: JSON.stringify(request)
477
- },
478
- retry
479
- );
480
- return res.json();
481
- }
396
+ var import_viem4 = require("viem");
482
397
 
483
398
  // src/logos.ts
484
399
  var logo_arb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAjVBMVEVMaXEgMkwgMk0fMUogMkwgMkwgMkwgMUsNOE0gMUwhMk0fMk0fMUsgM00gMkz///8hM04iNVESqf78/P0RIz8hKkEYKkURsv8Rrv8yQ1vq7O7W2d4fQGBXZHhrdohFVGoVjtMbWIOeprETm+XEyM8YdK0SpfQaZZYdS3AWgb+mrbh5hJSKlKG0usOUnakhSCyqAAAADnRSTlMAj2cY0Oqw/QP6KkyHd87n3EEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAPZSURBVHjarZfbeqowEIVBQUBsmEBArHiuVu3h/R9vz4QQIMHD/mwuWmrJuNbkz2TiONYIQ/oxjWcTz48Yi3xvMounYfOfR4NeCmPXizjnAAwHAD5GnhuHz4TAF8ZvHk6BIIoCJkcQRAF94r2N5Qv3v37s+gBBoOa2Az8B8GfjuyJCJxz5+N3W7CYGcH8U3hYROlMPp7M7A0N40xsRUNoo4sHd+aSCR6NBG2EYujx6MF2JcEM7Ajqb8Ig9NSI+GUjE8/NVBFOAOZ/owbXvPPQj9CWEjmvOLwSNApoHU4PbjYD554Exf33d7/fXdVGs5MOXmUo+aiPg+vv95Ydi8Z4kSZb8Cr7EX1lyLcBYC7/DAyawL4CLrySjsREr+ZCsjAAoQSeSDBgLAMWH/N6PorjKhyUwsJZCmxgbBnD+JpMOvoS2EuSmBPDHSsDMFMDFd0IR3hdiLR+SjTjvzAgRn9USUIBJCtSZ+ykaKyy/HCzMawmh8wZWBlaJFL4W2go/lGfbxBtJCD1zB4OoM4cOGiv5riyPdgCPLMSmAWAqc3uhreSXsjxwa1NAjAFcbglQmVsJbaU6pWlppTFAoIccFD/12nPx2zj4nKfp/DLoYWpuYo3xd4PxXgTbEhWcKpumqRObDiTGFGFTOyAr5AAlfNoeYpuiIYwZKUjL7RBLE/4IY7Qic5CmpyqwC4uZQwvjbIMb8YYHzKJjcWxhXDAO+WUuPdg0O09gXG2rfCc92DhHDnsCY5SOe4E8WDgzZwDjrI9xcJlvmfJg42xYuIXxGXeT9GDiHBlJ1BiD2HcwRunKg4EzJrG3jIhxptZeWyGMUXp+lB76ONMy9kDqYKytnJV0+dtAgUDqodzBuLFSfzNKH8KZUO5upiGMlfRDpXBOq04E2kzd7dwWAG2laKTv8upU2h6m/YICzTmmrWDDtVXpt3Gui2Jb0jTGq041Br0TGxRanGVJ6xRVaApAuyNJgd6JNs6yqHY8kINMnmMNxtRg5FslXS3Itu8AD5Z2HRb7TDrQGMsA9U5EnM9lOj8duXGwdI427EY2P8kykBjTjiTqqJo00g/zS5UbR1vvcAVeiPVatAeL/FDvxPxzl+cA5uHaO96xJyoIY8qhaipApR9RCNrp7fFuNhj4yuLaVGMFGKZ/nh4rBjDYYOBC9EozpeIjoWqs/sb0l9tz3jtWsMVxbjZZmIpivdw0bRHk5wOZv9Nk2W0eiK5cYDnA7TZvqNFk3CyW9xrNoVb3UbNsddsvNtt/0e5THuDJC8eNK8trV57XL11/cO2rL56zFy6eKsQLV98/uHz/9/X/H1O71f+Xu2swAAAAAElFTkSuQmCC";
@@ -496,889 +411,1047 @@ var logo_usdg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqa
496
411
  var logo_usdt = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iM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QDz68oFGoCEsNa9CODWZpJvAjJcGRurd+O2aLhrY/mcNwvunT55B++Gk+1ePdLIzu1G03cISMBPHQLqD/EY6Zjm6fzpzGN7PJ5+uEtqwBY0bjnRWiJgfUtacmOYRwMY3t1b7+Xk+f35mK7XQ/BXsQDceauWP9WaKja8fMkd4SxfL/Xy5OluqJovWfgL0a3mw+JH7FGy93mae42f+Y9ur9dJxWh+tfvA+RRRYK2FXwQ83Ebkq88Dh8gchwBYn2bUhEq5T2K3BdB4yHLQ+3v8gBMAAKrdE6J+US63ueXz3ggPzGOZC9M+WFxx+5IoH77mtr3j8/iWXP3DNB4jw+rsXndhVLwP93lWvP3DZ7fev+/2BC4+/f+XzD1x6/QPXfv/AxeccQ+8Xr37/hcvvhSUU1/8fqex/ififZbqhk/AAAAAASUVORK5CYII=";
498
413
 
499
- // src/tokens/list.ts
500
- var TOKENS = [
501
- {
502
- symbol: "USDC",
503
- name: "USD Coin",
504
- equivalenceGroup: "USDC",
505
- logo: logo_usdc,
506
- deployments: [
507
- {
508
- chainId: 1,
509
- address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
510
- decimals: 6,
511
- network: "mainnet",
512
- swapContracts: []
513
- },
514
- {
515
- chainId: 8453,
516
- address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
517
- decimals: 6,
518
- network: "mainnet",
519
- swapContracts: []
520
- },
521
- {
522
- chainId: 42161,
523
- address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
524
- decimals: 6,
525
- network: "mainnet",
526
- swapContracts: []
527
- },
528
- {
529
- chainId: 4114,
530
- address: "0xe045e6c36cf77faa2cfb54466d71a3aef7bbe839",
531
- decimals: 6,
532
- network: "mainnet",
533
- swapContracts: []
534
- },
535
- {
536
- chainId: 56,
537
- address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
538
- decimals: 18,
539
- network: "mainnet",
540
- swapContracts: []
541
- },
542
- {
543
- chainId: 137,
544
- address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
545
- decimals: 6,
546
- network: "mainnet",
547
- swapContracts: []
548
- },
549
- {
550
- chainId: 143,
551
- address: "0x754704bc059f8c67012fed69bc8a327a5aafb603",
552
- decimals: 6,
553
- network: "mainnet",
554
- swapContracts: []
555
- },
556
- {
557
- chainId: 11155111,
558
- address: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
559
- decimals: 6,
560
- network: "testnet",
561
- swapContracts: []
562
- },
563
- {
564
- chainId: 421614,
565
- address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868",
566
- decimals: 18,
567
- network: "testnet",
568
- swapContracts: []
569
- },
570
- {
571
- chainId: 84532,
572
- address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8",
573
- decimals: 18,
574
- network: "testnet",
575
- swapContracts: []
576
- }
577
- ]
414
+ // src/chains/list.ts
415
+ var CHAINS = {
416
+ 1: {
417
+ id: 1,
418
+ name: "Ethereum",
419
+ displayName: "Ethereum",
420
+ network: "mainnet",
421
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
422
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
423
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
424
+ blockExplorer: "https://etherscan.io",
425
+ rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/alch_4ehgbBF6bx-U6loLSFRIy",
426
+ logo: logo_eth
578
427
  },
579
- {
580
- symbol: "ctUSD",
581
- name: "Citrea USD",
582
- equivalenceGroup: "USDC",
583
- logo: logo_usdc,
584
- deployments: [
585
- {
586
- chainId: 4114,
587
- address: "0x8d82c4e3c936c7b5724a382a9c5a4e6eb7ab6d5d",
588
- decimals: 6,
589
- network: "mainnet",
590
- swapContracts: []
591
- }
592
- ]
428
+ 8453: {
429
+ id: 8453,
430
+ name: "Base Mainnet",
431
+ displayName: "Base",
432
+ network: "mainnet",
433
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
434
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
435
+ escrowContract: "0xd3F8f177BB3d7dfD883d7c232f3093EdD61C3De9",
436
+ blockExplorer: "https://basescan.org",
437
+ rpcUrl: "https://base-mainnet.g.alchemy.com/v2/alch_4ehgbBF6bx-U6loLSFRIy",
438
+ logo: logo_base
593
439
  },
594
- {
595
- symbol: "USDG",
596
- name: "Global USD",
597
- equivalenceGroup: "USDC",
598
- logo: logo_usdg,
599
- deployments: [
600
- {
601
- chainId: 4663,
602
- address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
603
- decimals: 6,
604
- network: "mainnet",
605
- swapContracts: []
606
- },
607
- {
608
- chainId: 46630,
609
- address: "0x7E955252E15c84f5768B83c41a71F9eba181802F",
610
- decimals: 6,
611
- network: "testnet",
612
- swapContracts: []
613
- }
614
- ]
440
+ 42161: {
441
+ id: 42161,
442
+ name: "Arbitrum One",
443
+ displayName: "Arbitrum",
444
+ network: "mainnet",
445
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
446
+ delegateContract: "0x262E1A689555dA5209113A056d0d164EF8355395",
447
+ escrowContract: "0x47d6DB10d99b1E0A074B1467407C7A53B68e1147",
448
+ blockExplorer: "https://arbiscan.io",
449
+ rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/alch_4ehgbBF6bx-U6loLSFRIy",
450
+ logo: logo_arb
615
451
  },
616
- {
617
- symbol: "sUSD",
618
- name: "Spice USD",
619
- equivalenceGroup: "SUSD",
620
- logo: logo_usdc,
621
- deployments: [
622
- {
623
- chainId: 11155111,
624
- address: "0x9bf2d44887be65c4f6337b20814ec79197a092aa",
625
- decimals: 18,
626
- network: "testnet",
627
- swapContracts: []
628
- },
629
- {
630
- chainId: 421614,
631
- address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8",
632
- decimals: 18,
633
- network: "testnet",
634
- swapContracts: []
635
- },
636
- {
637
- chainId: 84532,
638
- address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868",
639
- decimals: 18,
640
- network: "testnet",
641
- swapContracts: []
642
- }
643
- ]
452
+ 4114: {
453
+ id: 4114,
454
+ name: "Citrea Mainnet",
455
+ displayName: "Citrea",
456
+ network: "mainnet",
457
+ nativeCurrency: { name: "Citrea Bitcoin", symbol: "cBTC", decimals: 18 },
458
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
459
+ escrowContract: "0x3677113f10d82acFEeDd22dF5c7cFD58736111ee",
460
+ blockExplorer: "https://explorer.mainnet.citrea.xyz",
461
+ rpcUrl: "https://citrea-mainnet.g.alchemy.com/v2/alch_4ehgbBF6bx-U6loLSFRIy",
462
+ logo: logo_citrea,
463
+ wrappedNativeTokenAddress: "0x3100000000000000000000000000000000000006"
644
464
  },
645
- {
646
- symbol: "USDT",
647
- name: "Tether USD",
648
- equivalenceGroup: "USDT",
649
- logo: logo_usdt,
650
- deployments: [
651
- {
652
- chainId: 1,
653
- address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
654
- decimals: 6,
655
- network: "mainnet",
656
- swapContracts: []
657
- },
658
- {
659
- chainId: 8453,
660
- address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
661
- decimals: 6,
662
- network: "mainnet",
663
- swapContracts: []
664
- },
665
- {
666
- chainId: 42161,
667
- address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
668
- decimals: 6,
669
- network: "mainnet",
670
- swapContracts: []
671
- },
672
- {
673
- chainId: 56,
674
- address: "0x55d398326f99059fF775485246999027B3197955",
675
- decimals: 18,
676
- network: "mainnet",
677
- swapContracts: []
678
- },
679
- {
680
- chainId: 137,
681
- address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
682
- decimals: 6,
683
- network: "mainnet",
684
- swapContracts: []
685
- },
686
- {
687
- chainId: 143,
688
- address: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
689
- decimals: 6,
690
- network: "mainnet",
691
- swapContracts: []
692
- }
693
- ]
465
+ 4663: {
466
+ id: 4663,
467
+ name: "Robinhood Chain",
468
+ displayName: "Robinhood",
469
+ network: "mainnet",
470
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
471
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
472
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
473
+ blockExplorer: "https://robinhoodchain.blockscout.com",
474
+ rpcUrl: "https://rpc.mainnet.chain.robinhood.com",
475
+ logo: logo_robinhood,
476
+ wrappedNativeTokenAddress: "0x0bd7d308f8e1639fab988df18a8011f41eacad73"
694
477
  },
695
- {
696
- symbol: "USD",
697
- name: "USD Stable Coin",
698
- equivalenceGroup: "SUSD",
699
- logo: logo_usdc,
700
- deployments: [
701
- {
702
- chainId: 5115,
703
- address: "0xf19308f923582a6f7c465e5ce7a9dc1bec6665b1",
704
- decimals: 18,
705
- network: "testnet",
706
- swapContracts: []
707
- },
708
- {
709
- chainId: 688689,
710
- address: "0x16b90aeb3de140dde993da1d5734bca28574702b",
711
- decimals: 6,
712
- network: "testnet",
713
- swapContracts: []
714
- }
715
- ]
478
+ 56: {
479
+ id: 56,
480
+ name: "Binance Smart Chain",
481
+ displayName: "BSC",
482
+ network: "mainnet",
483
+ nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
484
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
485
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
486
+ blockExplorer: "https://bscscan.com",
487
+ rpcUrl: "https://bsc-dataseed.bnbchain.org",
488
+ logo: logo_bnb,
489
+ wrappedNativeTokenAddress: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
716
490
  },
717
- {
718
- symbol: "WBTC",
719
- name: "Wrapped Bitcoin",
720
- equivalenceGroup: "WBTC",
721
- logo: logo_wbtc,
722
- deployments: [
723
- {
724
- chainId: 1,
725
- address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
726
- decimals: 8,
727
- network: "mainnet",
728
- swapContracts: []
729
- },
730
- {
731
- chainId: 42161,
732
- address: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
733
- decimals: 8,
734
- network: "mainnet",
735
- swapContracts: []
736
- },
737
- {
738
- chainId: 56,
739
- address: "0x0555e30da8f98308edb960aa94c0db47230d2b9c",
740
- decimals: 8,
741
- network: "mainnet",
742
- swapContracts: []
743
- },
744
- {
745
- chainId: 137,
746
- address: "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
747
- decimals: 8,
748
- network: "mainnet",
749
- swapContracts: []
750
- },
751
- {
752
- chainId: 143,
753
- address: "0x0555e30da8f98308edb960aa94c0db47230d2b9c",
754
- decimals: 8,
755
- network: "mainnet",
756
- swapContracts: []
757
- },
758
- {
759
- chainId: 11155111,
760
- address: "0x4fc381b6cc6df8cf1c1bd46d184475be5b7a3c62",
761
- decimals: 8,
762
- network: "testnet",
763
- swapContracts: []
764
- },
765
- {
766
- chainId: 421614,
767
- address: "0xba4c54d4cf10c766c22a08f783998cfab237f7c9",
768
- decimals: 8,
769
- network: "testnet",
770
- swapContracts: []
771
- },
772
- {
773
- chainId: 84532,
774
- address: "0x16dd3a855433059be478facb416d9afed6ca96ec",
775
- decimals: 8,
776
- network: "testnet",
777
- swapContracts: []
778
- }
779
- ]
491
+ 137: {
492
+ id: 137,
493
+ name: "Polygon",
494
+ displayName: "Polygon",
495
+ network: "mainnet",
496
+ nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
497
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
498
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
499
+ blockExplorer: "https://polygonscan.com",
500
+ rpcUrl: "https://polygon-bor-rpc.publicnode.com",
501
+ logo: logo_polygon,
502
+ wrappedNativeTokenAddress: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
780
503
  },
781
- {
782
- symbol: "ETH",
783
- name: "Ether",
784
- equivalenceGroup: "ETH",
785
- logo: logo_eth,
786
- deployments: [
787
- {
788
- chainId: 1,
789
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
790
- decimals: 18,
791
- network: "mainnet",
792
- swapContracts: []
793
- },
794
- {
795
- chainId: 8453,
796
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
797
- decimals: 18,
798
- network: "mainnet",
799
- swapContracts: []
800
- },
801
- {
802
- chainId: 42161,
803
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
804
- decimals: 18,
805
- network: "mainnet",
806
- swapContracts: []
807
- },
808
- {
809
- chainId: 11155111,
810
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
811
- decimals: 18,
812
- network: "testnet",
813
- swapContracts: []
814
- },
815
- {
816
- chainId: 421614,
817
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
818
- decimals: 18,
819
- network: "testnet",
820
- swapContracts: []
821
- },
822
- {
823
- chainId: 84532,
824
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
825
- decimals: 18,
826
- network: "testnet",
827
- swapContracts: []
828
- },
829
- {
830
- chainId: 4663,
831
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
832
- decimals: 18,
833
- network: "mainnet",
834
- swapContracts: []
835
- },
836
- {
837
- chainId: 46630,
838
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
839
- decimals: 18,
840
- network: "testnet",
841
- swapContracts: []
842
- }
843
- ]
504
+ 143: {
505
+ id: 143,
506
+ name: "Monad",
507
+ displayName: "Monad",
508
+ network: "mainnet",
509
+ nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
510
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
511
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
512
+ blockExplorer: "https://monadexplorer.com",
513
+ rpcUrl: "https://rpc.monad.xyz",
514
+ logo: logo_monad,
515
+ wrappedNativeTokenAddress: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a"
844
516
  },
845
- {
846
- symbol: "cbETH",
847
- name: "Coinbase Wrapped Staked ETH",
848
- equivalenceGroup: "ETH",
849
- logo: logo_eth,
850
- deployments: [
851
- {
852
- chainId: 8453,
853
- address: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
854
- decimals: 18,
855
- network: "mainnet",
856
- swapContracts: []
857
- }
858
- ]
517
+ 11155111: {
518
+ id: 11155111,
519
+ name: "Ethereum Sepolia",
520
+ displayName: "Sepolia",
521
+ network: "testnet",
522
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
523
+ delegateContract: "0xDF7d39BB544778F467D10b08B1F5C170fd7fB480",
524
+ blockExplorer: "https://sepolia.etherscan.io",
525
+ rpcUrl: "https://rpc.sepolia.org",
526
+ logo: logo_eth
859
527
  },
860
- {
861
- symbol: "cBTC",
862
- name: "Citrea Bitcoin",
863
- equivalenceGroup: "CBTC",
864
- logo: logo_cbtc,
865
- deployments: [
866
- {
867
- chainId: 4114,
868
- // Native cBTC; 0x310...0002 is Citrea's bridge contract, not a token.
869
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
870
- decimals: 18,
871
- network: "mainnet",
872
- swapContracts: []
873
- }
874
- ]
528
+ 421614: {
529
+ id: 421614,
530
+ name: "Arbitrum Sepolia",
531
+ displayName: "Arbitrum Sepolia",
532
+ network: "testnet",
533
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
534
+ delegateContract: "0x151755d1bdFeB6082D141EF86e4291b2e902b43F",
535
+ blockExplorer: "https://sepolia.arbiscan.io",
536
+ rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
537
+ logo: logo_arb
875
538
  },
876
- {
877
- symbol: "WCBTC",
878
- name: "Wrapped Citrea BTC",
879
- equivalenceGroup: "CBTC",
880
- logo: logo_cbtc,
881
- deployments: [
882
- {
883
- chainId: 4114,
884
- address: "0x3100000000000000000000000000000000000006",
885
- decimals: 18,
886
- network: "mainnet",
887
- swapContracts: []
888
- },
889
- {
890
- chainId: 5115,
891
- address: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93",
892
- decimals: 18,
893
- network: "testnet",
894
- swapContracts: []
895
- }
896
- ]
539
+ 84532: {
540
+ id: 84532,
541
+ delegationDisabledReason: "Legacy delegate permits signed-call replay",
542
+ name: "Base Sepolia",
543
+ displayName: "Base Sepolia",
544
+ network: "testnet",
545
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
546
+ delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
547
+ escrowContract: "0x3Bb5B432Cd651c9E7bdF36D825CFd4237e4592c6",
548
+ blockExplorer: "https://sepolia.basescan.org",
549
+ rpcUrl: "https://sepolia.base.org",
550
+ logo: logo_base
897
551
  },
898
- {
899
- symbol: "eCBTC",
900
- name: "CBTC Vault",
901
- equivalenceGroup: "CBTC",
902
- logo: logo_cbtc,
903
- deployments: [
904
- {
905
- chainId: 5115,
906
- address: "0x2876a1fb400c238b0a9e4edd2e7e03d3cf9b53c2",
907
- decimals: 18,
908
- network: "testnet",
909
- swapContracts: []
910
- }
911
- ]
552
+ 5115: {
553
+ id: 5115,
554
+ name: "Citrea Testnet",
555
+ displayName: "Citrea Testnet",
556
+ network: "testnet",
557
+ nativeCurrency: { name: "cBTC", symbol: "cBTC", decimals: 18 },
558
+ delegateContract: "0x347056dd1CB95ae850192e3fC6FA995537A3A091",
559
+ escrowContract: "0xDf5616Fe65f103972c25EF596C6386904E5CbC8f",
560
+ blockExplorer: "https://explorer.testnet.citrea.xyz",
561
+ rpcUrl: "https://rpc.testnet.citrea.xyz",
562
+ logo: logo_citrea,
563
+ wrappedNativeTokenAddress: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93"
912
564
  },
913
- {
914
- symbol: "ARB",
915
- name: "Arbitrum",
916
- equivalenceGroup: "ARB",
917
- logo: logo_arb,
918
- deployments: [
919
- {
920
- chainId: 42161,
921
- address: "0x912ce59144191c1204e64559fe8253a0e49e6548",
922
- decimals: 18,
923
- network: "mainnet",
924
- swapContracts: []
925
- }
926
- ]
565
+ 123420001114: {
566
+ id: 123420001114,
567
+ name: "Base Camp Testnet",
568
+ displayName: "Base Camp",
569
+ network: "testnet",
570
+ nativeCurrency: { name: "Ethereum", symbol: "ETH", decimals: 18 },
571
+ delegateContract: "0xA15BFeD4eC0BEdd36b00b9856aFa1C6BCFE61574",
572
+ blockExplorer: "https://basecamp.gelato.network",
573
+ rpcUrl: "https://rpc-campnetwork.xyz",
574
+ logo: logo_base
575
+ },
576
+ 688688: {
577
+ id: 688688,
578
+ name: "Pharos Testnet",
579
+ displayName: "Pharos",
580
+ network: "testnet",
581
+ nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
582
+ delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
583
+ blockExplorer: "https://testnet.pharosscan.xyz",
584
+ rpcUrl: "https://testnet.dplabs-internal.com",
585
+ logo: logo_pharos
586
+ },
587
+ 688689: {
588
+ id: 688689,
589
+ name: "Pharos Atlantic",
590
+ displayName: "Pharos Atlantic",
591
+ network: "testnet",
592
+ nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
593
+ delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
594
+ blockExplorer: "https://atlantic.pharosscan.xyz",
595
+ rpcUrl: "https://atlantic.dplabs-internal.com",
596
+ logo: logo_pharos
597
+ },
598
+ 46630: {
599
+ id: 46630,
600
+ name: "Robinhood Chain Testnet",
601
+ displayName: "Robinhood Testnet",
602
+ network: "testnet",
603
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
604
+ delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
605
+ escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
606
+ blockExplorer: "https://explorer.testnet.chain.robinhood.com",
607
+ rpcUrl: "https://rpc.testnet.chain.robinhood.com",
608
+ logo: logo_robinhood,
609
+ wrappedNativeTokenAddress: "0x7943e237c7F95DA44E0301572D358911207852Fa"
610
+ },
611
+ 10143: {
612
+ id: 10143,
613
+ name: "Monad Testnet",
614
+ displayName: "Monad",
615
+ network: "testnet",
616
+ nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
617
+ delegateContract: "0xEc4087643A1c5f532Fde98bCa029cebA4E47b053",
618
+ blockExplorer: "https://testnet.monadexplorer.com",
619
+ rpcUrl: "https://testnet-rpc.monad.xyz",
620
+ logo: logo_eth
621
+ },
622
+ 97: {
623
+ id: 97,
624
+ delegationDisabledReason: "Legacy delegate permits signed-call replay",
625
+ name: "BSC Testnet",
626
+ displayName: "BSC Testnet",
627
+ network: "testnet",
628
+ nativeCurrency: { name: "tBNB", symbol: "tBNB", decimals: 18 },
629
+ delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
630
+ blockExplorer: "https://testnet.bscscan.com",
631
+ rpcUrl: "https://bsc-testnet.public.blastapi.io",
632
+ logo: logo_eth
633
+ },
634
+ 43113: {
635
+ id: 43113,
636
+ delegationDisabledReason: "EIP-7702 is not supported on this chain",
637
+ name: "Avalanche Fuji",
638
+ displayName: "Avalanche Fuji",
639
+ network: "testnet",
640
+ nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },
641
+ delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
642
+ blockExplorer: "https://testnet.snowtrace.io",
643
+ rpcUrl: "https://avalanche-fuji.drpc.org",
644
+ logo: logo_eth
645
+ },
646
+ 80002: {
647
+ id: 80002,
648
+ delegationDisabledReason: "Legacy delegate permits signed-call replay",
649
+ name: "Polygon Amoy",
650
+ displayName: "Polygon Amoy",
651
+ network: "testnet",
652
+ nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
653
+ delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
654
+ blockExplorer: "https://amoy.polygonscan.com",
655
+ rpcUrl: "https://polygon-amoy-public.nodies.app",
656
+ logo: logo_eth
657
+ },
658
+ 11155420: {
659
+ id: 11155420,
660
+ delegationDisabledReason: "Legacy delegate permits signed-call replay",
661
+ name: "Optimism Sepolia",
662
+ displayName: "Optimism Sepolia",
663
+ network: "testnet",
664
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
665
+ delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
666
+ blockExplorer: "https://sepolia-optimism.etherscan.io",
667
+ rpcUrl: "https://sepolia.optimism.io",
668
+ logo: logo_eth
927
669
  }
928
- ];
670
+ };
929
671
 
930
- // src/tokens/index.ts
931
- var _addressIndex = /* @__PURE__ */ new Map();
932
- var _ambiguousAddresses = /* @__PURE__ */ new Set();
933
- var _deploymentIndex = /* @__PURE__ */ new Map();
934
- var _chainIndex = /* @__PURE__ */ new Map();
935
- var _equivalenceIndex = /* @__PURE__ */ new Map();
936
- var NATIVE_SENTINEL = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
937
- var NATIVE_ALIASES = ["0x0000000000000000000000000000000000000000", "0x0"];
938
- function indexAddress(address, token) {
939
- if (_ambiguousAddresses.has(address)) return;
940
- const previous = _addressIndex.get(address);
941
- if (previous && previous.equivalenceGroup !== token.equivalenceGroup) {
942
- _addressIndex.delete(address);
943
- _ambiguousAddresses.add(address);
944
- return;
945
- }
946
- _addressIndex.set(address, token);
672
+ // src/chains/index.ts
673
+ var import_viem3 = require("viem");
674
+ function getChainMeta(chainId) {
675
+ return CHAINS[chainId];
947
676
  }
948
- function _buildIndexes() {
949
- for (const token of TOKENS) {
950
- const groupAddrs = _equivalenceIndex.get(token.equivalenceGroup) ?? [];
951
- for (const d of token.deployments) {
952
- const addr = d.address.toLowerCase();
953
- const key = `${d.chainId}:${addr}`;
954
- indexAddress(addr, token);
955
- _deploymentIndex.set(key, { token, deployment: d });
956
- const chainEntries = _chainIndex.get(d.chainId) ?? [];
957
- chainEntries.push({ token, deployment: d });
958
- _chainIndex.set(d.chainId, chainEntries);
959
- if (!groupAddrs.includes(addr)) {
960
- groupAddrs.push(addr);
961
- }
962
- if (addr === NATIVE_SENTINEL) {
963
- for (const alias of NATIVE_ALIASES) {
964
- indexAddress(alias, token);
965
- _deploymentIndex.set(`${d.chainId}:${alias}`, {
966
- token,
967
- deployment: d
968
- });
969
- if (!groupAddrs.includes(alias)) {
970
- groupAddrs.push(alias);
971
- }
972
- }
973
- }
974
- }
975
- _equivalenceIndex.set(token.equivalenceGroup, groupAddrs);
976
- }
977
- }
978
- _buildIndexes();
979
- function _resolve(token, deployment) {
980
- return {
981
- symbol: token.symbol,
982
- name: token.name,
983
- equivalenceGroup: token.equivalenceGroup,
984
- logo: token.logo,
985
- address: deployment.address,
986
- chainId: deployment.chainId,
987
- decimals: deployment.decimals,
988
- network: deployment.network,
989
- swapContracts: deployment.swapContracts
990
- };
677
+ function getChainsByNetwork(network) {
678
+ return Object.values(CHAINS).filter(
679
+ (c) => c.network === network && c.chainType !== "starknet"
680
+ );
991
681
  }
992
- function getTokensForChain(chainId) {
993
- const entries = _chainIndex.get(chainId);
994
- if (!entries) return [];
995
- return entries.map(({ token, deployment }) => _resolve(token, deployment));
682
+ function getChainIdsByNetwork(network) {
683
+ return getChainsByNetwork(network).map((c) => c.id);
996
684
  }
997
- function getTokenByAddress(address, chainId) {
998
- const entry = _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`);
999
- if (!entry) return void 0;
1000
- return _resolve(entry.token, entry.deployment);
685
+ function getMainnetChains() {
686
+ return getChainsByNetwork("mainnet");
1001
687
  }
1002
- function getTokenBySymbol(symbol, chainId) {
1003
- return getTokensForChain(chainId).find(
1004
- (token) => token.symbol.toUpperCase() === symbol.toUpperCase()
1005
- );
688
+ function getTestnetChains() {
689
+ return getChainsByNetwork("testnet");
1006
690
  }
1007
- function requireTokenBySymbol(symbol, chainId) {
1008
- const token = getTokenBySymbol(symbol, chainId);
1009
- if (token) return token;
1010
- throw new Error(
1011
- `Token "${symbol}" not found on chain ${chainId} in the token registry.`
1012
- );
691
+ function getAllChainsByNetwork(network) {
692
+ return Object.values(CHAINS).filter((c) => c.network === network);
1013
693
  }
1014
- function getTokenDefinition(address) {
1015
- return _addressIndex.get(address.toLowerCase());
694
+ function getDelegateContract(chainId) {
695
+ const meta = CHAINS[chainId];
696
+ return meta?.delegationDisabledReason ? void 0 : meta?.delegateContract;
1016
697
  }
1017
- function getDeployment(address, chainId) {
1018
- return _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`)?.deployment;
698
+ function getEscrowContract(chainId) {
699
+ return CHAINS[chainId]?.escrowContract;
1019
700
  }
1020
- function getEquivalentAddresses(tokenAddress) {
1021
- const token = _addressIndex.get(tokenAddress.toLowerCase());
1022
- if (!token) return [tokenAddress.toLowerCase()];
1023
- return _equivalenceIndex.get(token.equivalenceGroup) ?? [
1024
- tokenAddress.toLowerCase()
1025
- ];
701
+ function toViemChain(meta) {
702
+ if (meta.chainType === "starknet") return void 0;
703
+ return (0, import_viem3.defineChain)({
704
+ id: meta.id,
705
+ name: meta.name,
706
+ nativeCurrency: meta.nativeCurrency,
707
+ rpcUrls: {
708
+ default: {
709
+ http: [meta.rpcUrl]
710
+ },
711
+ public: {
712
+ http: [meta.rpcUrl]
713
+ }
714
+ },
715
+ ...meta.blockExplorer ? {
716
+ blockExplorers: {
717
+ default: {
718
+ name: meta.displayName || meta.name,
719
+ url: meta.blockExplorer
720
+ }
721
+ }
722
+ } : {}
723
+ });
1026
724
  }
1027
- function getEquivalenceGroup(tokenAddress) {
1028
- return _addressIndex.get(tokenAddress.toLowerCase())?.equivalenceGroup;
725
+ var VIEM_CHAINS = Object.fromEntries(
726
+ Object.values(CHAINS).map((meta) => [meta.id, toViemChain(meta)]).filter((entry) => entry[1] !== void 0)
727
+ );
728
+ function getViemChain(chainId) {
729
+ return VIEM_CHAINS[chainId];
1029
730
  }
1030
- function areEquivalent(a, b) {
1031
- const tokenA = _addressIndex.get(a.toLowerCase());
1032
- const tokenB = _addressIndex.get(b.toLowerCase());
1033
- if (!tokenA || !tokenB) return false;
1034
- return tokenA.equivalenceGroup === tokenB.equivalenceGroup;
731
+ function requireViemChain(chainId) {
732
+ const chain = getViemChain(chainId);
733
+ if (chain) return chain;
734
+ throw new Error(`Viem chain not found for chain ${chainId}.`);
1035
735
  }
1036
- var USD_GROUPS = /* @__PURE__ */ new Set(["USDC", "SUSD"]);
1037
- var BTC_GROUPS = /* @__PURE__ */ new Set(["WBTC", "CBTC"]);
1038
- function isUsdDenominated(address) {
1039
- const group = getEquivalenceGroup(address);
1040
- return group !== void 0 && USD_GROUPS.has(group);
736
+ function isStarknetChain(chainId) {
737
+ return getChainMeta(chainId)?.chainType === "starknet";
1041
738
  }
1042
- function isBtcDenominated(address) {
1043
- const group = getEquivalenceGroup(address);
1044
- return group !== void 0 && BTC_GROUPS.has(group);
739
+ var STARKNET_MAINNET_CHAIN_ID = 23448594291968336;
740
+
741
+ // src/core.ts
742
+ var SECP256K1_ORDER = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
743
+ async function validateAuthorization(value, expected, user) {
744
+ const invalid = () => new Error("Invalid delegation authorization returned by signer");
745
+ if (!value || typeof value !== "object") throw invalid();
746
+ const auth = value;
747
+ if (typeof auth.address !== "string" || auth.address.toLowerCase() !== expected.address.toLowerCase())
748
+ throw invalid();
749
+ if (auth.contractAddress !== void 0 && (typeof auth.contractAddress !== "string" || auth.contractAddress.toLowerCase() !== expected.address.toLowerCase()))
750
+ throw invalid();
751
+ for (const field of ["chainId", "nonce"]) {
752
+ if (typeof auth[field] === "bigint" ? auth[field] !== BigInt(expected[field]) : auth[field] !== expected[field])
753
+ throw invalid();
754
+ }
755
+ const { r, s, yParity } = auth;
756
+ if (typeof r !== "string" || typeof s !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(r) || !/^0x[0-9a-fA-F]{64}$/.test(s) || yParity !== 0 && yParity !== 1 || BigInt(r) === 0n || BigInt(r) >= SECP256K1_ORDER || BigInt(s) === 0n || BigInt(s) > SECP256K1_ORDER / 2n)
757
+ throw invalid();
758
+ const authorization = { ...expected, r, s, yParity };
759
+ let recovered;
760
+ try {
761
+ recovered = await (0, import_viem4.recoverAddress)({
762
+ hash: (0, import_viem4.keccak256)(
763
+ (0, import_viem4.concatHex)([
764
+ "0x05",
765
+ (0, import_viem4.toRlp)([
766
+ (0, import_viem4.toHex)(expected.chainId),
767
+ expected.address,
768
+ expected.nonce === 0 ? "0x" : (0, import_viem4.toHex)(expected.nonce)
769
+ ])
770
+ ])
771
+ ),
772
+ signature: { r, s, yParity }
773
+ });
774
+ } catch {
775
+ throw invalid();
776
+ }
777
+ if (recovered.toLowerCase() !== user.toLowerCase()) throw invalid();
778
+ return authorization;
1045
779
  }
1046
- function resolveTokenRef(ref) {
1047
- const [symbol, chainId] = ref;
1048
- const match = getTokenBySymbol(symbol, chainId);
1049
- if (!match) {
1050
- throw new Error(
1051
- `Token "${symbol}" not found on chain ${chainId} in the token registry.`
780
+ var SpiceFlowCore = class {
781
+ constructor(cfg, signers) {
782
+ this.cfg = cfg;
783
+ this.signers = signers;
784
+ }
785
+ getConfig() {
786
+ return this.cfg;
787
+ }
788
+ getClient(chainId) {
789
+ return this.cfg.publicClientForChain(chainId);
790
+ }
791
+ async signDelegations(params) {
792
+ const user = params.user;
793
+ const delegations = params.delegations.map(
794
+ ({ chainId, contractAddress, nonce }) => ({
795
+ chainId,
796
+ contractAddress,
797
+ nonce
798
+ })
1052
799
  );
800
+ if (!(0, import_viem4.isAddress)(user, { strict: false }) || user.toLowerCase() === import_viem4.zeroAddress)
801
+ throw new Error("Invalid delegation signer");
802
+ for (const d of delegations) {
803
+ const reason = getChainMeta(d.chainId)?.delegationDisabledReason;
804
+ if (reason)
805
+ throw new Error(
806
+ `Cannot sign delegation for chain ${d.chainId}: ${reason}`
807
+ );
808
+ if (!Number.isSafeInteger(d.chainId) || d.chainId <= 0 || !(0, import_viem4.isAddress)(d.contractAddress, { strict: false }) || d.contractAddress.toLowerCase() === import_viem4.zeroAddress || d.nonce !== void 0 && (!Number.isSafeInteger(d.nonce) || d.nonce < 0))
809
+ throw new Error("Invalid delegation request");
810
+ }
811
+ const out = [];
812
+ for (const d of delegations) {
813
+ const client = this.getClient(d.chainId);
814
+ const nonce = typeof d.nonce === "number" ? d.nonce : await getAccountNonce(user, client);
815
+ if (!Number.isSafeInteger(nonce) || nonce < 0)
816
+ throw new Error("Invalid delegation nonce");
817
+ const auth = await this.signers.authorizationSigner({
818
+ contractAddress: d.contractAddress,
819
+ chainId: d.chainId,
820
+ nonce,
821
+ address: user
822
+ });
823
+ out.push(
824
+ await validateAuthorization(
825
+ auth,
826
+ { address: d.contractAddress, chainId: d.chainId, nonce },
827
+ user
828
+ )
829
+ );
830
+ }
831
+ return out;
1053
832
  }
1054
- return {
1055
- address: match.address,
1056
- symbol: match.symbol,
1057
- decimals: match.decimals,
1058
- chainId
1059
- };
833
+ async buildChainBatches(nbf, exp, callsByChain, signatureType = "ecdsa") {
834
+ const chainBatches = hashChainBatches(
835
+ callsByChain.map((c) => ({ chainId: c.chainId, calls: c.calls }))
836
+ );
837
+ const digest = getIntentHash(
838
+ signatureType,
839
+ nbf,
840
+ exp,
841
+ chainBatches
842
+ );
843
+ return { chainBatches, digest };
844
+ }
845
+ async signIntent(digest) {
846
+ return this.signers.messageSigner(digest);
847
+ }
848
+ async submitIntent(req) {
849
+ const signatureType = req.signatureType ?? "ecdsa";
850
+ const signature = req.signature ?? await this.signIntent(
851
+ getIntentHash(
852
+ signatureType,
853
+ req.nbf,
854
+ req.exp,
855
+ req.chainBatches
856
+ )
857
+ );
858
+ const resp = await submitTransaction(this.cfg.txApiUrl, {
859
+ tokenAddress: req.tokenAddress,
860
+ tokenAmount: req.tokenAmount,
861
+ address: req.user,
862
+ authorization: req.authorization,
863
+ intentAuthorization: { signature, chainBatches: req.chainBatches }
864
+ });
865
+ return resp;
866
+ }
867
+ };
868
+
869
+ // src/status.ts
870
+ async function getIntentStepStatus(txApiUrl, intentId, stepId, retry) {
871
+ const res = await fetchWithRetry(
872
+ `${txApiUrl}/intent/${intentId}/step/${stepId}/status`,
873
+ {},
874
+ retry
875
+ );
876
+ return res.json();
1060
877
  }
1061
878
 
1062
- // src/chains/list.ts
1063
- var CHAINS = {
1064
- 1: {
1065
- id: 1,
1066
- name: "Ethereum",
1067
- displayName: "Ethereum",
1068
- network: "mainnet",
1069
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1070
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1071
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1072
- blockExplorer: "https://etherscan.io",
1073
- rpcUrl: "https://tx-submission-api.spicenet.io/rpc/1",
1074
- logo: logo_eth
1075
- },
1076
- 8453: {
1077
- id: 8453,
1078
- name: "Base Mainnet",
1079
- displayName: "Base",
1080
- network: "mainnet",
1081
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1082
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1083
- escrowContract: "0xd3F8f177BB3d7dfD883d7c232f3093EdD61C3De9",
1084
- blockExplorer: "https://basescan.org",
1085
- rpcUrl: "https://tx-submission-api.spicenet.io/rpc/8453",
1086
- logo: logo_base
1087
- },
1088
- 42161: {
1089
- id: 42161,
1090
- name: "Arbitrum One",
1091
- displayName: "Arbitrum",
1092
- network: "mainnet",
1093
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1094
- delegateContract: "0x262E1A689555dA5209113A056d0d164EF8355395",
1095
- escrowContract: "0x47d6DB10d99b1E0A074B1467407C7A53B68e1147",
1096
- blockExplorer: "https://arbiscan.io",
1097
- rpcUrl: "https://tx-submission-api.spicenet.io/rpc/42161",
1098
- logo: logo_arb
1099
- },
1100
- 4114: {
1101
- id: 4114,
1102
- name: "Citrea Mainnet",
1103
- displayName: "Citrea",
1104
- network: "mainnet",
1105
- nativeCurrency: { name: "Citrea Bitcoin", symbol: "cBTC", decimals: 18 },
1106
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1107
- escrowContract: "0x3677113f10d82acFEeDd22dF5c7cFD58736111ee",
1108
- blockExplorer: "https://explorer.mainnet.citrea.xyz",
1109
- rpcUrl: "https://tx-submission-api.spicenet.io/rpc/4114",
1110
- logo: logo_citrea,
1111
- wrappedNativeTokenAddress: "0x3100000000000000000000000000000000000006"
1112
- },
1113
- 4663: {
1114
- id: 4663,
1115
- name: "Robinhood Chain",
1116
- displayName: "Robinhood",
1117
- network: "mainnet",
1118
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1119
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1120
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1121
- blockExplorer: "https://robinhoodchain.blockscout.com",
1122
- rpcUrl: "https://rpc.mainnet.chain.robinhood.com",
1123
- logo: logo_robinhood,
1124
- wrappedNativeTokenAddress: "0x0bd7d308f8e1639fab988df18a8011f41eacad73"
1125
- },
1126
- 56: {
1127
- id: 56,
1128
- name: "Binance Smart Chain",
1129
- displayName: "BSC",
1130
- network: "mainnet",
1131
- nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
1132
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1133
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1134
- blockExplorer: "https://bscscan.com",
1135
- rpcUrl: "https://bsc-dataseed.bnbchain.org",
1136
- logo: logo_bnb,
1137
- wrappedNativeTokenAddress: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
1138
- },
1139
- 137: {
1140
- id: 137,
1141
- name: "Polygon",
1142
- displayName: "Polygon",
1143
- network: "mainnet",
1144
- nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
1145
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1146
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1147
- blockExplorer: "https://polygonscan.com",
1148
- rpcUrl: "https://polygon-bor-rpc.publicnode.com",
1149
- logo: logo_polygon,
1150
- wrappedNativeTokenAddress: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
1151
- },
1152
- 143: {
1153
- id: 143,
1154
- name: "Monad",
1155
- displayName: "Monad",
1156
- network: "mainnet",
1157
- nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
1158
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1159
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1160
- blockExplorer: "https://monadexplorer.com",
1161
- rpcUrl: "https://rpc.monad.xyz",
1162
- logo: logo_monad,
1163
- wrappedNativeTokenAddress: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a"
1164
- },
1165
- 11155111: {
1166
- id: 11155111,
1167
- name: "Ethereum Sepolia",
1168
- displayName: "Sepolia",
1169
- network: "testnet",
1170
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
1171
- delegateContract: "0xDF7d39BB544778F467D10b08B1F5C170fd7fB480",
1172
- blockExplorer: "https://sepolia.etherscan.io",
1173
- rpcUrl: "https://rpc.sepolia.org",
1174
- logo: logo_eth
879
+ // src/rfqt.ts
880
+ async function prepareRFQT(txApiUrl, request, retry) {
881
+ const res = await fetchWithRetry(
882
+ `${txApiUrl}/rfqt`,
883
+ {
884
+ method: "POST",
885
+ headers: { "Content-Type": "application/json" },
886
+ body: JSON.stringify(request)
887
+ },
888
+ retry
889
+ );
890
+ return res.json();
891
+ }
892
+
893
+ // src/tokens/list.ts
894
+ var TOKENS = [
895
+ {
896
+ symbol: "USDC",
897
+ name: "USD Coin",
898
+ equivalenceGroup: "USDC",
899
+ logo: logo_usdc,
900
+ deployments: [
901
+ {
902
+ chainId: 1,
903
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
904
+ decimals: 6,
905
+ network: "mainnet",
906
+ swapContracts: []
907
+ },
908
+ {
909
+ chainId: 8453,
910
+ address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
911
+ decimals: 6,
912
+ network: "mainnet",
913
+ swapContracts: []
914
+ },
915
+ {
916
+ chainId: 42161,
917
+ address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
918
+ decimals: 6,
919
+ network: "mainnet",
920
+ swapContracts: []
921
+ },
922
+ {
923
+ chainId: 4114,
924
+ address: "0xe045e6c36cf77faa2cfb54466d71a3aef7bbe839",
925
+ decimals: 6,
926
+ network: "mainnet",
927
+ swapContracts: []
928
+ },
929
+ {
930
+ chainId: 56,
931
+ address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
932
+ decimals: 18,
933
+ network: "mainnet",
934
+ swapContracts: []
935
+ },
936
+ {
937
+ chainId: 137,
938
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
939
+ decimals: 6,
940
+ network: "mainnet",
941
+ swapContracts: []
942
+ },
943
+ {
944
+ chainId: 143,
945
+ address: "0x754704bc059f8c67012fed69bc8a327a5aafb603",
946
+ decimals: 6,
947
+ network: "mainnet",
948
+ swapContracts: []
949
+ },
950
+ {
951
+ chainId: 11155111,
952
+ address: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
953
+ decimals: 6,
954
+ network: "testnet",
955
+ swapContracts: []
956
+ },
957
+ {
958
+ chainId: 421614,
959
+ address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868",
960
+ decimals: 18,
961
+ network: "testnet",
962
+ swapContracts: []
963
+ },
964
+ {
965
+ chainId: 84532,
966
+ address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8",
967
+ decimals: 18,
968
+ network: "testnet",
969
+ swapContracts: []
970
+ }
971
+ ]
1175
972
  },
1176
- 421614: {
1177
- id: 421614,
1178
- name: "Arbitrum Sepolia",
1179
- displayName: "Arbitrum Sepolia",
1180
- network: "testnet",
1181
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
1182
- delegateContract: "0x151755d1bdFeB6082D141EF86e4291b2e902b43F",
1183
- blockExplorer: "https://sepolia.arbiscan.io",
1184
- rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
1185
- logo: logo_arb
973
+ {
974
+ symbol: "ctUSD",
975
+ name: "Citrea USD",
976
+ equivalenceGroup: "USDC",
977
+ logo: logo_usdc,
978
+ deployments: [
979
+ {
980
+ chainId: 4114,
981
+ address: "0x8d82c4e3c936c7b5724a382a9c5a4e6eb7ab6d5d",
982
+ decimals: 6,
983
+ network: "mainnet",
984
+ swapContracts: []
985
+ }
986
+ ]
1186
987
  },
1187
- 84532: {
1188
- id: 84532,
1189
- name: "Base Sepolia",
1190
- displayName: "Base Sepolia",
1191
- network: "testnet",
1192
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
1193
- delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
1194
- escrowContract: "0x3Bb5B432Cd651c9E7bdF36D825CFd4237e4592c6",
1195
- blockExplorer: "https://sepolia.basescan.org",
1196
- rpcUrl: "https://sepolia.base.org",
1197
- logo: logo_base
988
+ {
989
+ symbol: "USDG",
990
+ name: "Global USD",
991
+ equivalenceGroup: "USDC",
992
+ logo: logo_usdg,
993
+ deployments: [
994
+ {
995
+ chainId: 4663,
996
+ address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
997
+ decimals: 6,
998
+ network: "mainnet",
999
+ swapContracts: []
1000
+ },
1001
+ {
1002
+ chainId: 46630,
1003
+ address: "0x7E955252E15c84f5768B83c41a71F9eba181802F",
1004
+ decimals: 6,
1005
+ network: "testnet",
1006
+ swapContracts: []
1007
+ }
1008
+ ]
1198
1009
  },
1199
- 5115: {
1200
- id: 5115,
1201
- name: "Citrea Testnet",
1202
- displayName: "Citrea Testnet",
1203
- network: "testnet",
1204
- nativeCurrency: { name: "cBTC", symbol: "cBTC", decimals: 18 },
1205
- delegateContract: "0x347056dd1CB95ae850192e3fC6FA995537A3A091",
1206
- escrowContract: "0xDf5616Fe65f103972c25EF596C6386904E5CbC8f",
1207
- blockExplorer: "https://explorer.testnet.citrea.xyz",
1208
- rpcUrl: "https://rpc.testnet.citrea.xyz",
1209
- logo: logo_citrea,
1210
- wrappedNativeTokenAddress: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93"
1010
+ {
1011
+ symbol: "sUSD",
1012
+ name: "Spice USD",
1013
+ equivalenceGroup: "SUSD",
1014
+ logo: logo_usdc,
1015
+ deployments: [
1016
+ {
1017
+ chainId: 11155111,
1018
+ address: "0x9bf2d44887be65c4f6337b20814ec79197a092aa",
1019
+ decimals: 18,
1020
+ network: "testnet",
1021
+ swapContracts: []
1022
+ },
1023
+ {
1024
+ chainId: 421614,
1025
+ address: "0xf370dc3765f81ac9dd2febd59fb4e710330b0bc8",
1026
+ decimals: 18,
1027
+ network: "testnet",
1028
+ swapContracts: []
1029
+ },
1030
+ {
1031
+ chainId: 84532,
1032
+ address: "0xbeb51deb2018b67b35d5695fd15bb30d452c7868",
1033
+ decimals: 18,
1034
+ network: "testnet",
1035
+ swapContracts: []
1036
+ }
1037
+ ]
1211
1038
  },
1212
- 123420001114: {
1213
- id: 123420001114,
1214
- name: "Base Camp Testnet",
1215
- displayName: "Base Camp",
1216
- network: "testnet",
1217
- nativeCurrency: { name: "Ethereum", symbol: "ETH", decimals: 18 },
1218
- delegateContract: "0xA15BFeD4eC0BEdd36b00b9856aFa1C6BCFE61574",
1219
- blockExplorer: "https://basecamp.gelato.network",
1220
- rpcUrl: "https://rpc-campnetwork.xyz",
1221
- logo: logo_base
1039
+ {
1040
+ symbol: "USDT",
1041
+ name: "Tether USD",
1042
+ equivalenceGroup: "USDT",
1043
+ logo: logo_usdt,
1044
+ deployments: [
1045
+ {
1046
+ chainId: 1,
1047
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1048
+ decimals: 6,
1049
+ network: "mainnet",
1050
+ swapContracts: []
1051
+ },
1052
+ {
1053
+ chainId: 8453,
1054
+ address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
1055
+ decimals: 6,
1056
+ network: "mainnet",
1057
+ swapContracts: []
1058
+ },
1059
+ {
1060
+ chainId: 42161,
1061
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
1062
+ decimals: 6,
1063
+ network: "mainnet",
1064
+ swapContracts: []
1065
+ },
1066
+ {
1067
+ chainId: 56,
1068
+ address: "0x55d398326f99059fF775485246999027B3197955",
1069
+ decimals: 18,
1070
+ network: "mainnet",
1071
+ swapContracts: []
1072
+ },
1073
+ {
1074
+ chainId: 137,
1075
+ address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
1076
+ decimals: 6,
1077
+ network: "mainnet",
1078
+ swapContracts: []
1079
+ },
1080
+ {
1081
+ chainId: 143,
1082
+ address: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
1083
+ decimals: 6,
1084
+ network: "mainnet",
1085
+ swapContracts: []
1086
+ }
1087
+ ]
1222
1088
  },
1223
- 688688: {
1224
- id: 688688,
1225
- name: "Pharos Testnet",
1226
- displayName: "Pharos",
1227
- network: "testnet",
1228
- nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
1229
- delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
1230
- blockExplorer: "https://testnet.pharosscan.xyz",
1231
- rpcUrl: "https://testnet.dplabs-internal.com",
1232
- logo: logo_pharos
1089
+ {
1090
+ symbol: "USD",
1091
+ name: "USD Stable Coin",
1092
+ equivalenceGroup: "SUSD",
1093
+ logo: logo_usdc,
1094
+ deployments: [
1095
+ {
1096
+ chainId: 5115,
1097
+ address: "0xf19308f923582a6f7c465e5ce7a9dc1bec6665b1",
1098
+ decimals: 18,
1099
+ network: "testnet",
1100
+ swapContracts: []
1101
+ },
1102
+ {
1103
+ chainId: 688689,
1104
+ address: "0x16b90aeb3de140dde993da1d5734bca28574702b",
1105
+ decimals: 6,
1106
+ network: "testnet",
1107
+ swapContracts: []
1108
+ }
1109
+ ]
1233
1110
  },
1234
- 688689: {
1235
- id: 688689,
1236
- name: "Pharos Atlantic",
1237
- displayName: "Pharos Atlantic",
1238
- network: "testnet",
1239
- nativeCurrency: { name: "PHRS", symbol: "PHRS", decimals: 18 },
1240
- delegateContract: "0xAd45b774C4c632540d36f2105889C0E6aC28b504",
1241
- blockExplorer: "https://atlantic.pharosscan.xyz",
1242
- rpcUrl: "https://atlantic.dplabs-internal.com",
1243
- logo: logo_pharos
1111
+ {
1112
+ symbol: "WBTC",
1113
+ name: "Wrapped Bitcoin",
1114
+ equivalenceGroup: "WBTC",
1115
+ logo: logo_wbtc,
1116
+ deployments: [
1117
+ {
1118
+ chainId: 1,
1119
+ address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
1120
+ decimals: 8,
1121
+ network: "mainnet",
1122
+ swapContracts: []
1123
+ },
1124
+ {
1125
+ chainId: 42161,
1126
+ address: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
1127
+ decimals: 8,
1128
+ network: "mainnet",
1129
+ swapContracts: []
1130
+ },
1131
+ {
1132
+ chainId: 56,
1133
+ address: "0x0555e30da8f98308edb960aa94c0db47230d2b9c",
1134
+ decimals: 8,
1135
+ network: "mainnet",
1136
+ swapContracts: []
1137
+ },
1138
+ {
1139
+ chainId: 137,
1140
+ address: "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
1141
+ decimals: 8,
1142
+ network: "mainnet",
1143
+ swapContracts: []
1144
+ },
1145
+ {
1146
+ chainId: 143,
1147
+ address: "0x0555e30da8f98308edb960aa94c0db47230d2b9c",
1148
+ decimals: 8,
1149
+ network: "mainnet",
1150
+ swapContracts: []
1151
+ },
1152
+ {
1153
+ chainId: 11155111,
1154
+ address: "0x4fc381b6cc6df8cf1c1bd46d184475be5b7a3c62",
1155
+ decimals: 8,
1156
+ network: "testnet",
1157
+ swapContracts: []
1158
+ },
1159
+ {
1160
+ chainId: 421614,
1161
+ address: "0xba4c54d4cf10c766c22a08f783998cfab237f7c9",
1162
+ decimals: 8,
1163
+ network: "testnet",
1164
+ swapContracts: []
1165
+ },
1166
+ {
1167
+ chainId: 84532,
1168
+ address: "0x16dd3a855433059be478facb416d9afed6ca96ec",
1169
+ decimals: 8,
1170
+ network: "testnet",
1171
+ swapContracts: []
1172
+ }
1173
+ ]
1244
1174
  },
1245
- 46630: {
1246
- id: 46630,
1247
- name: "Robinhood Chain Testnet",
1248
- displayName: "Robinhood Testnet",
1249
- network: "testnet",
1250
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1251
- delegateContract: "0x5884Bff4876C979271E65D2feA8D0CF3bF6E6CcC",
1252
- escrowContract: "0x93ee466f920e1b4961f85749001f03aAd868eF0E",
1253
- blockExplorer: "https://explorer.testnet.chain.robinhood.com",
1254
- rpcUrl: "https://rpc.testnet.chain.robinhood.com",
1255
- logo: logo_robinhood,
1256
- wrappedNativeTokenAddress: "0x7943e237c7F95DA44E0301572D358911207852Fa"
1175
+ {
1176
+ symbol: "ETH",
1177
+ name: "Ether",
1178
+ equivalenceGroup: "ETH",
1179
+ logo: logo_eth,
1180
+ deployments: [
1181
+ {
1182
+ chainId: 1,
1183
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1184
+ decimals: 18,
1185
+ network: "mainnet",
1186
+ swapContracts: []
1187
+ },
1188
+ {
1189
+ chainId: 8453,
1190
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1191
+ decimals: 18,
1192
+ network: "mainnet",
1193
+ swapContracts: []
1194
+ },
1195
+ {
1196
+ chainId: 42161,
1197
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1198
+ decimals: 18,
1199
+ network: "mainnet",
1200
+ swapContracts: []
1201
+ },
1202
+ {
1203
+ chainId: 11155111,
1204
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1205
+ decimals: 18,
1206
+ network: "testnet",
1207
+ swapContracts: []
1208
+ },
1209
+ {
1210
+ chainId: 421614,
1211
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1212
+ decimals: 18,
1213
+ network: "testnet",
1214
+ swapContracts: []
1215
+ },
1216
+ {
1217
+ chainId: 84532,
1218
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1219
+ decimals: 18,
1220
+ network: "testnet",
1221
+ swapContracts: []
1222
+ },
1223
+ {
1224
+ chainId: 4663,
1225
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1226
+ decimals: 18,
1227
+ network: "mainnet",
1228
+ swapContracts: []
1229
+ },
1230
+ {
1231
+ chainId: 46630,
1232
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1233
+ decimals: 18,
1234
+ network: "testnet",
1235
+ swapContracts: []
1236
+ }
1237
+ ]
1257
1238
  },
1258
- 10143: {
1259
- id: 10143,
1260
- name: "Monad Testnet",
1261
- displayName: "Monad",
1262
- network: "testnet",
1263
- nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 },
1264
- delegateContract: "0xEc4087643A1c5f532Fde98bCa029cebA4E47b053",
1265
- blockExplorer: "https://testnet.monadexplorer.com",
1266
- rpcUrl: "https://testnet-rpc.monad.xyz",
1267
- logo: logo_eth
1239
+ {
1240
+ symbol: "cbETH",
1241
+ name: "Coinbase Wrapped Staked ETH",
1242
+ equivalenceGroup: "ETH",
1243
+ logo: logo_eth,
1244
+ deployments: [
1245
+ {
1246
+ chainId: 8453,
1247
+ address: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
1248
+ decimals: 18,
1249
+ network: "mainnet",
1250
+ swapContracts: []
1251
+ }
1252
+ ]
1268
1253
  },
1269
- 97: {
1270
- id: 97,
1271
- name: "BSC Testnet",
1272
- displayName: "BSC Testnet",
1273
- network: "testnet",
1274
- nativeCurrency: { name: "tBNB", symbol: "tBNB", decimals: 18 },
1275
- delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
1276
- blockExplorer: "https://testnet.bscscan.com",
1277
- rpcUrl: "https://bsc-testnet.public.blastapi.io",
1278
- logo: logo_eth
1254
+ {
1255
+ symbol: "cBTC",
1256
+ name: "Citrea Bitcoin",
1257
+ equivalenceGroup: "CBTC",
1258
+ logo: logo_cbtc,
1259
+ deployments: [
1260
+ {
1261
+ chainId: 4114,
1262
+ // Native cBTC; 0x310...0002 is Citrea's bridge contract, not a token.
1263
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
1264
+ decimals: 18,
1265
+ network: "mainnet",
1266
+ swapContracts: []
1267
+ }
1268
+ ]
1279
1269
  },
1280
- 43113: {
1281
- id: 43113,
1282
- name: "Avalanche Fuji",
1283
- displayName: "Avalanche Fuji",
1284
- network: "testnet",
1285
- nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },
1286
- delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
1287
- blockExplorer: "https://testnet.snowtrace.io",
1288
- rpcUrl: "https://avalanche-fuji.drpc.org",
1289
- logo: logo_eth
1270
+ {
1271
+ symbol: "WCBTC",
1272
+ name: "Wrapped Citrea BTC",
1273
+ equivalenceGroup: "CBTC",
1274
+ logo: logo_cbtc,
1275
+ deployments: [
1276
+ {
1277
+ chainId: 4114,
1278
+ address: "0x3100000000000000000000000000000000000006",
1279
+ decimals: 18,
1280
+ network: "mainnet",
1281
+ swapContracts: []
1282
+ },
1283
+ {
1284
+ chainId: 5115,
1285
+ address: "0x8d0c9d1c17ae5e40fff9be350f57840e9e66cd93",
1286
+ decimals: 18,
1287
+ network: "testnet",
1288
+ swapContracts: []
1289
+ }
1290
+ ]
1290
1291
  },
1291
- 80002: {
1292
- id: 80002,
1293
- name: "Polygon Amoy",
1294
- displayName: "Polygon Amoy",
1295
- network: "testnet",
1296
- nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
1297
- delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
1298
- blockExplorer: "https://amoy.polygonscan.com",
1299
- rpcUrl: "https://polygon-amoy-public.nodies.app",
1300
- logo: logo_eth
1292
+ {
1293
+ symbol: "eCBTC",
1294
+ name: "CBTC Vault",
1295
+ equivalenceGroup: "CBTC",
1296
+ logo: logo_cbtc,
1297
+ deployments: [
1298
+ {
1299
+ chainId: 5115,
1300
+ address: "0x2876a1fb400c238b0a9e4edd2e7e03d3cf9b53c2",
1301
+ decimals: 18,
1302
+ network: "testnet",
1303
+ swapContracts: []
1304
+ }
1305
+ ]
1301
1306
  },
1302
- 11155420: {
1303
- id: 11155420,
1304
- name: "Optimism Sepolia",
1305
- displayName: "Optimism Sepolia",
1306
- network: "testnet",
1307
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
1308
- delegateContract: "0xD4C4A222cdd42f5c3219249a083a5aBf1420E9D8",
1309
- blockExplorer: "https://sepolia-optimism.etherscan.io",
1310
- rpcUrl: "https://sepolia.optimism.io",
1311
- logo: logo_eth
1307
+ {
1308
+ symbol: "ARB",
1309
+ name: "Arbitrum",
1310
+ equivalenceGroup: "ARB",
1311
+ logo: logo_arb,
1312
+ deployments: [
1313
+ {
1314
+ chainId: 42161,
1315
+ address: "0x912ce59144191c1204e64559fe8253a0e49e6548",
1316
+ decimals: 18,
1317
+ network: "mainnet",
1318
+ swapContracts: []
1319
+ }
1320
+ ]
1312
1321
  }
1313
- };
1322
+ ];
1314
1323
 
1315
- // src/chains/index.ts
1316
- var import_viem3 = require("viem");
1317
- function getChainMeta(chainId) {
1318
- return CHAINS[chainId];
1324
+ // src/tokens/index.ts
1325
+ var _addressIndex = /* @__PURE__ */ new Map();
1326
+ var _ambiguousAddresses = /* @__PURE__ */ new Set();
1327
+ var _deploymentIndex = /* @__PURE__ */ new Map();
1328
+ var _chainIndex = /* @__PURE__ */ new Map();
1329
+ var _equivalenceIndex = /* @__PURE__ */ new Map();
1330
+ var NATIVE_SENTINEL = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
1331
+ var NATIVE_ALIASES = ["0x0000000000000000000000000000000000000000", "0x0"];
1332
+ function indexAddress(address, token) {
1333
+ if (_ambiguousAddresses.has(address)) return;
1334
+ const previous = _addressIndex.get(address);
1335
+ if (previous && previous.equivalenceGroup !== token.equivalenceGroup) {
1336
+ _addressIndex.delete(address);
1337
+ _ambiguousAddresses.add(address);
1338
+ return;
1339
+ }
1340
+ _addressIndex.set(address, token);
1319
1341
  }
1320
- function getChainsByNetwork(network) {
1321
- return Object.values(CHAINS).filter(
1322
- (c) => c.network === network && c.chainType !== "starknet"
1323
- );
1342
+ function _buildIndexes() {
1343
+ for (const token of TOKENS) {
1344
+ const groupAddrs = _equivalenceIndex.get(token.equivalenceGroup) ?? [];
1345
+ for (const d of token.deployments) {
1346
+ const addr = d.address.toLowerCase();
1347
+ const key = `${d.chainId}:${addr}`;
1348
+ indexAddress(addr, token);
1349
+ _deploymentIndex.set(key, { token, deployment: d });
1350
+ const chainEntries = _chainIndex.get(d.chainId) ?? [];
1351
+ chainEntries.push({ token, deployment: d });
1352
+ _chainIndex.set(d.chainId, chainEntries);
1353
+ if (!groupAddrs.includes(addr)) {
1354
+ groupAddrs.push(addr);
1355
+ }
1356
+ if (addr === NATIVE_SENTINEL) {
1357
+ for (const alias of NATIVE_ALIASES) {
1358
+ indexAddress(alias, token);
1359
+ _deploymentIndex.set(`${d.chainId}:${alias}`, {
1360
+ token,
1361
+ deployment: d
1362
+ });
1363
+ if (!groupAddrs.includes(alias)) {
1364
+ groupAddrs.push(alias);
1365
+ }
1366
+ }
1367
+ }
1368
+ }
1369
+ _equivalenceIndex.set(token.equivalenceGroup, groupAddrs);
1370
+ }
1324
1371
  }
1325
- function getChainIdsByNetwork(network) {
1326
- return getChainsByNetwork(network).map((c) => c.id);
1372
+ _buildIndexes();
1373
+ function _resolve(token, deployment) {
1374
+ return {
1375
+ symbol: token.symbol,
1376
+ name: token.name,
1377
+ equivalenceGroup: token.equivalenceGroup,
1378
+ logo: token.logo,
1379
+ address: deployment.address,
1380
+ chainId: deployment.chainId,
1381
+ decimals: deployment.decimals,
1382
+ network: deployment.network,
1383
+ swapContracts: deployment.swapContracts
1384
+ };
1327
1385
  }
1328
- function getMainnetChains() {
1329
- return getChainsByNetwork("mainnet");
1386
+ function getTokensForChain(chainId) {
1387
+ const entries = _chainIndex.get(chainId);
1388
+ if (!entries) return [];
1389
+ return entries.map(({ token, deployment }) => _resolve(token, deployment));
1330
1390
  }
1331
- function getTestnetChains() {
1332
- return getChainsByNetwork("testnet");
1391
+ function getTokenByAddress(address, chainId) {
1392
+ const entry = _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`);
1393
+ if (!entry) return void 0;
1394
+ return _resolve(entry.token, entry.deployment);
1333
1395
  }
1334
- function getAllChainsByNetwork(network) {
1335
- return Object.values(CHAINS).filter((c) => c.network === network);
1396
+ function getTokenBySymbol(symbol, chainId) {
1397
+ return getTokensForChain(chainId).find(
1398
+ (token) => token.symbol.toUpperCase() === symbol.toUpperCase()
1399
+ );
1336
1400
  }
1337
- function getDelegateContract(chainId) {
1338
- return CHAINS[chainId]?.delegateContract;
1401
+ function requireTokenBySymbol(symbol, chainId) {
1402
+ const token = getTokenBySymbol(symbol, chainId);
1403
+ if (token) return token;
1404
+ throw new Error(
1405
+ `Token "${symbol}" not found on chain ${chainId} in the token registry.`
1406
+ );
1339
1407
  }
1340
- function getEscrowContract(chainId) {
1341
- return CHAINS[chainId]?.escrowContract;
1408
+ function getTokenDefinition(address) {
1409
+ return _addressIndex.get(address.toLowerCase());
1342
1410
  }
1343
- function toViemChain(meta) {
1344
- if (meta.chainType === "starknet") return void 0;
1345
- return (0, import_viem3.defineChain)({
1346
- id: meta.id,
1347
- name: meta.name,
1348
- nativeCurrency: meta.nativeCurrency,
1349
- rpcUrls: {
1350
- default: {
1351
- http: [meta.rpcUrl]
1352
- },
1353
- public: {
1354
- http: [meta.rpcUrl]
1355
- }
1356
- },
1357
- ...meta.blockExplorer ? {
1358
- blockExplorers: {
1359
- default: {
1360
- name: meta.displayName || meta.name,
1361
- url: meta.blockExplorer
1362
- }
1363
- }
1364
- } : {}
1365
- });
1411
+ function getDeployment(address, chainId) {
1412
+ return _deploymentIndex.get(`${chainId}:${address.toLowerCase()}`)?.deployment;
1366
1413
  }
1367
- var VIEM_CHAINS = Object.fromEntries(
1368
- Object.values(CHAINS).map((meta) => [meta.id, toViemChain(meta)]).filter((entry) => entry[1] !== void 0)
1369
- );
1370
- function getViemChain(chainId) {
1371
- return VIEM_CHAINS[chainId];
1414
+ function getEquivalentAddresses(tokenAddress) {
1415
+ const token = _addressIndex.get(tokenAddress.toLowerCase());
1416
+ if (!token) return [tokenAddress.toLowerCase()];
1417
+ return _equivalenceIndex.get(token.equivalenceGroup) ?? [
1418
+ tokenAddress.toLowerCase()
1419
+ ];
1372
1420
  }
1373
- function requireViemChain(chainId) {
1374
- const chain = getViemChain(chainId);
1375
- if (chain) return chain;
1376
- throw new Error(`Viem chain not found for chain ${chainId}.`);
1421
+ function getEquivalenceGroup(tokenAddress) {
1422
+ return _addressIndex.get(tokenAddress.toLowerCase())?.equivalenceGroup;
1377
1423
  }
1378
- function isStarknetChain(chainId) {
1379
- return getChainMeta(chainId)?.chainType === "starknet";
1424
+ function areEquivalent(a, b) {
1425
+ const tokenA = _addressIndex.get(a.toLowerCase());
1426
+ const tokenB = _addressIndex.get(b.toLowerCase());
1427
+ if (!tokenA || !tokenB) return false;
1428
+ return tokenA.equivalenceGroup === tokenB.equivalenceGroup;
1429
+ }
1430
+ var USD_GROUPS = /* @__PURE__ */ new Set(["USDC", "SUSD"]);
1431
+ var BTC_GROUPS = /* @__PURE__ */ new Set(["WBTC", "CBTC"]);
1432
+ function isUsdDenominated(address) {
1433
+ const group = getEquivalenceGroup(address);
1434
+ return group !== void 0 && USD_GROUPS.has(group);
1435
+ }
1436
+ function isBtcDenominated(address) {
1437
+ const group = getEquivalenceGroup(address);
1438
+ return group !== void 0 && BTC_GROUPS.has(group);
1439
+ }
1440
+ function resolveTokenRef(ref) {
1441
+ const [symbol, chainId] = ref;
1442
+ const match = getTokenBySymbol(symbol, chainId);
1443
+ if (!match) {
1444
+ throw new Error(
1445
+ `Token "${symbol}" not found on chain ${chainId} in the token registry.`
1446
+ );
1447
+ }
1448
+ return {
1449
+ address: match.address,
1450
+ symbol: match.symbol,
1451
+ decimals: match.decimals,
1452
+ chainId
1453
+ };
1380
1454
  }
1381
- var STARKNET_MAINNET_CHAIN_ID = 23448594291968336;
1382
1455
 
1383
1456
  // src/utils.ts
1384
1457
  var NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
@@ -3097,7 +3170,7 @@ var spicenetEscrowAbi = [
3097
3170
  ];
3098
3171
 
3099
3172
  // src/swap.ts
3100
- var import_viem4 = require("viem");
3173
+ var import_viem5 = require("viem");
3101
3174
  function applySlippage(amount, slippage = 0.03) {
3102
3175
  const slippageBps = BigInt(Math.floor((1 - slippage) * 1e4));
3103
3176
  return amount * slippageBps / 10000n;
@@ -3116,8 +3189,8 @@ function buildUniV3SwapCalls(params) {
3116
3189
  {
3117
3190
  to: tokenIn,
3118
3191
  value: 0n,
3119
- data: (0, import_viem4.encodeFunctionData)({
3120
- abi: import_viem4.erc20Abi,
3192
+ data: (0, import_viem5.encodeFunctionData)({
3193
+ abi: import_viem5.erc20Abi,
3121
3194
  functionName: "approve",
3122
3195
  args: [config.swapRouter, amountIn]
3123
3196
  })
@@ -3125,7 +3198,7 @@ function buildUniV3SwapCalls(params) {
3125
3198
  {
3126
3199
  to: config.swapRouter,
3127
3200
  value: 0n,
3128
- data: (0, import_viem4.encodeFunctionData)({
3201
+ data: (0, import_viem5.encodeFunctionData)({
3129
3202
  abi: uniV3SwapRouterAbi,
3130
3203
  functionName: "exactInputSingle",
3131
3204
  args: [