@siphoyawe/mina-cli 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +321 -0
- package/dist/index.js +1050 -671
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
// src/index.tsx
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
-
import
|
|
6
|
+
import React12 from "react";
|
|
7
7
|
import { render } from "ink";
|
|
8
8
|
|
|
9
9
|
// src/commands/wizard.tsx
|
|
10
|
-
import { useState, useEffect, useCallback } from "react";
|
|
11
|
-
import { Box as
|
|
10
|
+
import { useState as useState2, useEffect, useCallback } from "react";
|
|
11
|
+
import { Box as Box8, Text as Text8, useApp, useInput as useInput2 } from "ink";
|
|
12
12
|
import {
|
|
13
|
+
Mina,
|
|
13
14
|
getChains,
|
|
14
15
|
getBridgeableTokens,
|
|
15
|
-
|
|
16
|
+
getQuote,
|
|
17
|
+
HYPEREVM_CHAIN_ID,
|
|
18
|
+
HYPEREVM_USDC_ADDRESS,
|
|
19
|
+
normalizeError
|
|
16
20
|
} from "@siphoyawe/mina-sdk";
|
|
17
21
|
|
|
18
22
|
// src/ui/theme.ts
|
|
@@ -73,7 +77,9 @@ var symbols = {
|
|
|
73
77
|
bullet: "\u2022",
|
|
74
78
|
arrow: "\u203A",
|
|
75
79
|
check: "\u2714",
|
|
76
|
-
cross: "\u2718"
|
|
80
|
+
cross: "\u2718",
|
|
81
|
+
search: "\u2315",
|
|
82
|
+
star: "\u2605"
|
|
77
83
|
};
|
|
78
84
|
var MINA_LOGO = `
|
|
79
85
|
__ __ ___ _ _ _
|
|
@@ -483,43 +489,337 @@ function KeyValue({
|
|
|
483
489
|
] }, index)) });
|
|
484
490
|
}
|
|
485
491
|
|
|
492
|
+
// src/ui/SearchableList.tsx
|
|
493
|
+
import { useState, useMemo } from "react";
|
|
494
|
+
import { Box as Box7, Text as Text7, useInput, useStdin } from "ink";
|
|
495
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
496
|
+
function fuzzyMatch(query, text) {
|
|
497
|
+
const lowerQuery = query.toLowerCase();
|
|
498
|
+
const lowerText = text.toLowerCase();
|
|
499
|
+
if (lowerText.includes(lowerQuery)) return true;
|
|
500
|
+
let queryIndex = 0;
|
|
501
|
+
for (const char of lowerText) {
|
|
502
|
+
if (char === lowerQuery[queryIndex]) {
|
|
503
|
+
queryIndex++;
|
|
504
|
+
if (queryIndex === lowerQuery.length) return true;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
function sortItems(items, popularIds) {
|
|
510
|
+
return [...items].sort((a, b) => {
|
|
511
|
+
const aPopular = popularIds.includes(a.id);
|
|
512
|
+
const bPopular = popularIds.includes(b.id);
|
|
513
|
+
if (aPopular && !bPopular) return -1;
|
|
514
|
+
if (!aPopular && bPopular) return 1;
|
|
515
|
+
return a.label.localeCompare(b.label);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
function KeyboardHandler({
|
|
519
|
+
searchable,
|
|
520
|
+
displayedItemsLength,
|
|
521
|
+
selectedIndex,
|
|
522
|
+
setSelectedIndex,
|
|
523
|
+
setQuery,
|
|
524
|
+
setShowAll,
|
|
525
|
+
hasMore,
|
|
526
|
+
onSelect,
|
|
527
|
+
displayedItems
|
|
528
|
+
}) {
|
|
529
|
+
useInput((input, key) => {
|
|
530
|
+
if (searchable) {
|
|
531
|
+
if (key.backspace || key.delete) {
|
|
532
|
+
setQuery((q) => q.slice(0, -1));
|
|
533
|
+
setSelectedIndex(0);
|
|
534
|
+
} else if (input && !key.ctrl && !key.meta && input.length === 1 && input.match(/[a-zA-Z0-9 -]/)) {
|
|
535
|
+
setQuery((q) => q + input);
|
|
536
|
+
setSelectedIndex(0);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (key.upArrow) {
|
|
540
|
+
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
541
|
+
} else if (key.downArrow) {
|
|
542
|
+
setSelectedIndex((i) => Math.min(displayedItemsLength - 1, i + 1));
|
|
543
|
+
} else if (key.return && onSelect && displayedItems[selectedIndex]) {
|
|
544
|
+
onSelect(displayedItems[selectedIndex]);
|
|
545
|
+
} else if (input === "m" && hasMore) {
|
|
546
|
+
setShowAll(true);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
function SearchableList({
|
|
552
|
+
items,
|
|
553
|
+
title,
|
|
554
|
+
placeholder = "Type to search...",
|
|
555
|
+
pageSize = 8,
|
|
556
|
+
popularIds = [],
|
|
557
|
+
onSelect,
|
|
558
|
+
searchable = true,
|
|
559
|
+
maxDisplay = 15
|
|
560
|
+
}) {
|
|
561
|
+
const { isRawModeSupported } = useStdin();
|
|
562
|
+
const isInteractive = isRawModeSupported;
|
|
563
|
+
const [query, setQuery] = useState("");
|
|
564
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
565
|
+
const [showAll, setShowAll] = useState(false);
|
|
566
|
+
const filteredItems = useMemo(() => {
|
|
567
|
+
let result = items;
|
|
568
|
+
if (query) {
|
|
569
|
+
result = items.filter(
|
|
570
|
+
(item) => fuzzyMatch(query, item.label) || item.sublabel && fuzzyMatch(query, item.sublabel)
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
return sortItems(result, popularIds);
|
|
574
|
+
}, [items, query, popularIds]);
|
|
575
|
+
const displayLimit = showAll ? filteredItems.length : Math.min(maxDisplay, filteredItems.length);
|
|
576
|
+
const displayedItems = filteredItems.slice(0, displayLimit);
|
|
577
|
+
const hasMore = filteredItems.length > displayLimit;
|
|
578
|
+
const safeIndex = Math.min(selectedIndex, Math.max(0, displayedItems.length - 1));
|
|
579
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
580
|
+
isInteractive && /* @__PURE__ */ jsx7(
|
|
581
|
+
KeyboardHandler,
|
|
582
|
+
{
|
|
583
|
+
searchable,
|
|
584
|
+
displayedItemsLength: displayedItems.length,
|
|
585
|
+
selectedIndex,
|
|
586
|
+
setSelectedIndex,
|
|
587
|
+
setQuery,
|
|
588
|
+
setShowAll,
|
|
589
|
+
hasMore,
|
|
590
|
+
onSelect,
|
|
591
|
+
displayedItems
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
title && /* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
|
|
595
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.secondary, children: [
|
|
596
|
+
symbols.arrow,
|
|
597
|
+
" ",
|
|
598
|
+
title
|
|
599
|
+
] }),
|
|
600
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.muted, children: [
|
|
601
|
+
" (",
|
|
602
|
+
filteredItems.length,
|
|
603
|
+
")"
|
|
604
|
+
] })
|
|
605
|
+
] }),
|
|
606
|
+
searchable && isInteractive && /* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
|
|
607
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.border, children: borders.vertical }),
|
|
608
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.muted, children: [
|
|
609
|
+
" ",
|
|
610
|
+
symbols.search,
|
|
611
|
+
" "
|
|
612
|
+
] }),
|
|
613
|
+
query ? /* @__PURE__ */ jsx7(Text7, { color: theme.primary, children: query }) : /* @__PURE__ */ jsx7(Text7, { color: theme.muted, dimColor: true, children: placeholder }),
|
|
614
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: "\u258C" })
|
|
615
|
+
] }),
|
|
616
|
+
/* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
617
|
+
displayedItems.map((item, index) => {
|
|
618
|
+
const isSelected = isInteractive && index === safeIndex;
|
|
619
|
+
const isPopular = popularIds.includes(item.id);
|
|
620
|
+
return /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
621
|
+
isInteractive && /* @__PURE__ */ jsx7(Text7, { color: isSelected ? theme.accent : theme.border, children: isSelected ? symbols.arrow : " " }),
|
|
622
|
+
/* @__PURE__ */ jsx7(Text7, { children: " " }),
|
|
623
|
+
isPopular && /* @__PURE__ */ jsx7(Text7, { color: theme.warning, children: "\u2605 " }),
|
|
624
|
+
/* @__PURE__ */ jsx7(
|
|
625
|
+
Text7,
|
|
626
|
+
{
|
|
627
|
+
color: isSelected ? theme.primary : theme.secondary,
|
|
628
|
+
bold: isSelected,
|
|
629
|
+
children: item.label
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
item.sublabel && /* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
633
|
+
" ",
|
|
634
|
+
"(",
|
|
635
|
+
item.sublabel,
|
|
636
|
+
")"
|
|
637
|
+
] }),
|
|
638
|
+
item.badge && /* @__PURE__ */ jsxs7(Text7, { color: item.badgeColor || theme.accent, children: [
|
|
639
|
+
" ",
|
|
640
|
+
"[",
|
|
641
|
+
item.badge,
|
|
642
|
+
"]"
|
|
643
|
+
] })
|
|
644
|
+
] }, item.id);
|
|
645
|
+
}),
|
|
646
|
+
displayedItems.length === 0 && /* @__PURE__ */ jsx7(Box7, { children: /* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
647
|
+
'No matches for "',
|
|
648
|
+
query,
|
|
649
|
+
'"'
|
|
650
|
+
] }) }),
|
|
651
|
+
hasMore && !showAll && /* @__PURE__ */ jsxs7(Box7, { marginTop: 1, children: [
|
|
652
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
653
|
+
"+",
|
|
654
|
+
filteredItems.length - displayLimit,
|
|
655
|
+
" more",
|
|
656
|
+
isInteractive && " \u2014 press "
|
|
657
|
+
] }),
|
|
658
|
+
isInteractive && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
659
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: "m" }),
|
|
660
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.muted, dimColor: true, children: " to show all" })
|
|
661
|
+
] })
|
|
662
|
+
] })
|
|
663
|
+
] }),
|
|
664
|
+
isInteractive && /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
665
|
+
"\u2191\u2193 navigate",
|
|
666
|
+
onSelect ? " \u2022 Enter select" : "",
|
|
667
|
+
searchable ? " \u2022 Type to filter" : ""
|
|
668
|
+
] }) })
|
|
669
|
+
] });
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/lib/wallet.ts
|
|
673
|
+
import fs from "fs";
|
|
674
|
+
import readline from "readline";
|
|
675
|
+
async function loadPrivateKey(path3) {
|
|
676
|
+
if (path3) {
|
|
677
|
+
if (!fs.existsSync(path3)) {
|
|
678
|
+
throw new Error(`Key file not found: ${path3}`);
|
|
679
|
+
}
|
|
680
|
+
const content = fs.readFileSync(path3, "utf-8");
|
|
681
|
+
try {
|
|
682
|
+
const json = JSON.parse(content);
|
|
683
|
+
const key = json.privateKey || json.private_key || json.key;
|
|
684
|
+
if (key) {
|
|
685
|
+
return normalizePrivateKey(key);
|
|
686
|
+
}
|
|
687
|
+
return normalizePrivateKey(content.trim());
|
|
688
|
+
} catch {
|
|
689
|
+
return normalizePrivateKey(content.trim());
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return promptForPrivateKey();
|
|
693
|
+
}
|
|
694
|
+
function promptForPrivateKey() {
|
|
695
|
+
return new Promise((resolve, reject) => {
|
|
696
|
+
const rl = readline.createInterface({
|
|
697
|
+
input: process.stdin,
|
|
698
|
+
output: process.stdout
|
|
699
|
+
});
|
|
700
|
+
process.stdout.write("Enter private key (input will be visible): ");
|
|
701
|
+
rl.on("line", (answer) => {
|
|
702
|
+
rl.close();
|
|
703
|
+
try {
|
|
704
|
+
resolve(normalizePrivateKey(answer.trim()));
|
|
705
|
+
} catch (err) {
|
|
706
|
+
reject(err);
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
rl.on("close", () => {
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function normalizePrivateKey(key) {
|
|
714
|
+
const trimmed = key.trim();
|
|
715
|
+
const keyWithoutPrefix = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
|
|
716
|
+
if (!/^[0-9a-fA-F]{64}$/.test(keyWithoutPrefix)) {
|
|
717
|
+
throw new Error("Invalid private key format. Expected 64 hex characters.");
|
|
718
|
+
}
|
|
719
|
+
return trimmed.startsWith("0x") ? trimmed : `0x${trimmed}`;
|
|
720
|
+
}
|
|
721
|
+
async function getAddressFromPrivateKey(privateKey) {
|
|
722
|
+
const { privateKeyToAccount } = await import("viem/accounts");
|
|
723
|
+
const account = privateKeyToAccount(privateKey);
|
|
724
|
+
return account.address;
|
|
725
|
+
}
|
|
726
|
+
async function createSigner(privateKey, chainId, rpcUrl) {
|
|
727
|
+
const { privateKeyToAccount } = await import("viem/accounts");
|
|
728
|
+
const { createWalletClient, http } = await import("viem");
|
|
729
|
+
const { arbitrum, mainnet, optimism, polygon, base, avalanche, bsc } = await import("viem/chains");
|
|
730
|
+
const chainMap = {
|
|
731
|
+
1: mainnet,
|
|
732
|
+
42161: arbitrum,
|
|
733
|
+
10: optimism,
|
|
734
|
+
137: polygon,
|
|
735
|
+
8453: base,
|
|
736
|
+
43114: avalanche,
|
|
737
|
+
56: bsc,
|
|
738
|
+
// HyperEVM
|
|
739
|
+
999: {
|
|
740
|
+
id: 999,
|
|
741
|
+
name: "HyperEVM",
|
|
742
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
743
|
+
rpcUrls: {
|
|
744
|
+
default: { http: ["https://rpc.hyperliquid.xyz/evm"] }
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
const chain = chainMap[chainId];
|
|
749
|
+
if (!chain) {
|
|
750
|
+
throw new Error(`Unsupported chain ID: ${chainId}. Supported: ${Object.keys(chainMap).join(", ")}`);
|
|
751
|
+
}
|
|
752
|
+
const account = privateKeyToAccount(privateKey);
|
|
753
|
+
const transport = rpcUrl ? http(rpcUrl) : http();
|
|
754
|
+
const walletClient = createWalletClient({
|
|
755
|
+
account,
|
|
756
|
+
chain,
|
|
757
|
+
transport
|
|
758
|
+
});
|
|
759
|
+
return {
|
|
760
|
+
sendTransaction: async (request) => {
|
|
761
|
+
const txHash = await walletClient.sendTransaction({
|
|
762
|
+
to: request.to,
|
|
763
|
+
data: request.data,
|
|
764
|
+
value: BigInt(request.value || "0"),
|
|
765
|
+
gas: request.gasLimit ? BigInt(request.gasLimit) : void 0,
|
|
766
|
+
gasPrice: request.gasPrice ? BigInt(request.gasPrice) : void 0,
|
|
767
|
+
chain
|
|
768
|
+
});
|
|
769
|
+
return txHash;
|
|
770
|
+
},
|
|
771
|
+
getAddress: async () => {
|
|
772
|
+
return account.address;
|
|
773
|
+
},
|
|
774
|
+
getChainId: async () => {
|
|
775
|
+
return chainId;
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
|
|
486
780
|
// src/commands/wizard.tsx
|
|
487
|
-
import { jsx as
|
|
781
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
488
782
|
var initialState = {
|
|
489
783
|
step: "chain",
|
|
490
784
|
chain: null,
|
|
491
785
|
token: null,
|
|
492
786
|
amount: "",
|
|
493
787
|
quote: null,
|
|
494
|
-
error: null
|
|
788
|
+
error: null,
|
|
789
|
+
privateKey: null,
|
|
790
|
+
walletAddress: null,
|
|
791
|
+
executionResult: null,
|
|
792
|
+
executionStatus: ""
|
|
495
793
|
};
|
|
496
794
|
function NavigationHints({ step }) {
|
|
497
795
|
const hints = {
|
|
498
796
|
chain: "up/down Select Enter Confirm q Quit",
|
|
499
797
|
token: "up/down Select Enter Confirm b Back q Quit",
|
|
500
798
|
amount: "Enter Confirm b Back q Quit",
|
|
799
|
+
key: "Enter Confirm b Back q Quit",
|
|
501
800
|
confirm: "Enter Execute b Back q Quit",
|
|
502
801
|
execute: "Please wait..."
|
|
503
802
|
};
|
|
504
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: hints[step] }) });
|
|
505
804
|
}
|
|
506
805
|
function StepIndicator({ currentStep }) {
|
|
507
|
-
const steps = ["chain", "token", "amount", "confirm", "execute"];
|
|
806
|
+
const steps = ["chain", "token", "amount", "key", "confirm", "execute"];
|
|
508
807
|
const stepLabels = {
|
|
509
808
|
chain: "Chain",
|
|
510
809
|
token: "Token",
|
|
511
810
|
amount: "Amount",
|
|
811
|
+
key: "Wallet",
|
|
512
812
|
confirm: "Confirm",
|
|
513
813
|
execute: "Execute"
|
|
514
814
|
};
|
|
515
815
|
const currentIndex = steps.indexOf(currentStep);
|
|
516
|
-
return /* @__PURE__ */
|
|
816
|
+
return /* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: steps.map((step, index) => {
|
|
517
817
|
const isActive = index === currentIndex;
|
|
518
818
|
const isCompleted = index < currentIndex;
|
|
519
819
|
const separator = index < steps.length - 1 ? " > " : "";
|
|
520
|
-
return /* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
|
|
820
|
+
return /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
821
|
+
/* @__PURE__ */ jsxs8(
|
|
822
|
+
Text8,
|
|
523
823
|
{
|
|
524
824
|
color: isActive ? theme.primary : isCompleted ? theme.success : theme.muted,
|
|
525
825
|
bold: isActive,
|
|
@@ -531,7 +831,7 @@ function StepIndicator({ currentStep }) {
|
|
|
531
831
|
]
|
|
532
832
|
}
|
|
533
833
|
),
|
|
534
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: separator })
|
|
535
835
|
] }, step);
|
|
536
836
|
}) });
|
|
537
837
|
}
|
|
@@ -539,9 +839,9 @@ function ChainSelectionStep({
|
|
|
539
839
|
onSelect,
|
|
540
840
|
selectedChain
|
|
541
841
|
}) {
|
|
542
|
-
const [chains, setChains] =
|
|
543
|
-
const [loading, setLoading] =
|
|
544
|
-
const [error, setError] =
|
|
842
|
+
const [chains, setChains] = useState2([]);
|
|
843
|
+
const [loading, setLoading] = useState2(true);
|
|
844
|
+
const [error, setError] = useState2(null);
|
|
545
845
|
useEffect(() => {
|
|
546
846
|
async function loadChains() {
|
|
547
847
|
try {
|
|
@@ -559,16 +859,16 @@ function ChainSelectionStep({
|
|
|
559
859
|
loadChains();
|
|
560
860
|
}, []);
|
|
561
861
|
if (loading) {
|
|
562
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ jsx8(Spinner, { text: "Loading available chains..." });
|
|
563
863
|
}
|
|
564
864
|
if (error) {
|
|
565
|
-
return /* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
866
|
+
/* @__PURE__ */ jsxs8(Text8, { color: theme.error, children: [
|
|
567
867
|
symbols.failed,
|
|
568
868
|
" Error: ",
|
|
569
869
|
error
|
|
570
870
|
] }),
|
|
571
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.muted, children: "Press q to quit and try again" })
|
|
572
872
|
] });
|
|
573
873
|
}
|
|
574
874
|
const chainItems = chains.map((chain) => ({
|
|
@@ -578,9 +878,9 @@ function ChainSelectionStep({
|
|
|
578
878
|
type: "origin",
|
|
579
879
|
description: `Chain ID: ${chain.id}`
|
|
580
880
|
}));
|
|
581
|
-
return /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
881
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
882
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.secondary, bold: true, children: "Select source chain to bridge from:" }) }),
|
|
883
|
+
/* @__PURE__ */ jsx8(
|
|
584
884
|
ChainSelect,
|
|
585
885
|
{
|
|
586
886
|
chains: chainItems,
|
|
@@ -591,7 +891,7 @@ function ChainSelectionStep({
|
|
|
591
891
|
label: ""
|
|
592
892
|
}
|
|
593
893
|
),
|
|
594
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.muted, dimColor: true, children: [
|
|
595
895
|
"Destination: HyperEVM (Chain ID: ",
|
|
596
896
|
HYPEREVM_CHAIN_ID,
|
|
597
897
|
")"
|
|
@@ -603,9 +903,9 @@ function TokenSelectionStep({
|
|
|
603
903
|
onSelect,
|
|
604
904
|
selectedToken
|
|
605
905
|
}) {
|
|
606
|
-
const [tokens, setTokens] =
|
|
607
|
-
const [loading, setLoading] =
|
|
608
|
-
const [error, setError] =
|
|
906
|
+
const [tokens, setTokens] = useState2([]);
|
|
907
|
+
const [loading, setLoading] = useState2(true);
|
|
908
|
+
const [error, setError] = useState2(null);
|
|
609
909
|
useEffect(() => {
|
|
610
910
|
async function loadTokens() {
|
|
611
911
|
try {
|
|
@@ -622,26 +922,26 @@ function TokenSelectionStep({
|
|
|
622
922
|
loadTokens();
|
|
623
923
|
}, [chain.id]);
|
|
624
924
|
if (loading) {
|
|
625
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsx8(Spinner, { text: `Loading bridgeable tokens for ${chain.name}...` });
|
|
626
926
|
}
|
|
627
927
|
if (error) {
|
|
628
|
-
return /* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
929
|
+
/* @__PURE__ */ jsxs8(Text8, { color: theme.error, children: [
|
|
630
930
|
symbols.failed,
|
|
631
931
|
" Error: ",
|
|
632
932
|
error
|
|
633
933
|
] }),
|
|
634
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.muted, children: "Press b to go back or q to quit" })
|
|
635
935
|
] });
|
|
636
936
|
}
|
|
637
937
|
if (tokens.length === 0) {
|
|
638
|
-
return /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
939
|
+
/* @__PURE__ */ jsxs8(Text8, { color: theme.warning, children: [
|
|
640
940
|
symbols.pending,
|
|
641
941
|
" No bridgeable tokens found for ",
|
|
642
942
|
chain.name
|
|
643
943
|
] }),
|
|
644
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.muted, children: "Press b to go back and select another chain" })
|
|
645
945
|
] });
|
|
646
946
|
}
|
|
647
947
|
const tokenItems = tokens.map((token) => ({
|
|
@@ -650,13 +950,13 @@ function TokenSelectionStep({
|
|
|
650
950
|
symbol: token.symbol,
|
|
651
951
|
description: token.name
|
|
652
952
|
}));
|
|
653
|
-
return /* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
954
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.secondary, bold: true, children: [
|
|
655
955
|
"Select token to bridge from ",
|
|
656
956
|
chain.name,
|
|
657
957
|
":"
|
|
658
958
|
] }) }),
|
|
659
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsx8(
|
|
660
960
|
TokenSelect,
|
|
661
961
|
{
|
|
662
962
|
tokens: tokenItems,
|
|
@@ -677,14 +977,14 @@ function AmountInputStep({
|
|
|
677
977
|
onConfirm,
|
|
678
978
|
error
|
|
679
979
|
}) {
|
|
680
|
-
const [cursorVisible, setCursorVisible] =
|
|
980
|
+
const [cursorVisible, setCursorVisible] = useState2(true);
|
|
681
981
|
useEffect(() => {
|
|
682
982
|
const interval = setInterval(() => {
|
|
683
983
|
setCursorVisible((v) => !v);
|
|
684
984
|
}, 530);
|
|
685
985
|
return () => clearInterval(interval);
|
|
686
986
|
}, []);
|
|
687
|
-
|
|
987
|
+
useInput2((input, key) => {
|
|
688
988
|
if (key.return && amount.length > 0) {
|
|
689
989
|
onConfirm();
|
|
690
990
|
return;
|
|
@@ -701,52 +1001,117 @@ function AmountInputStep({
|
|
|
701
1001
|
});
|
|
702
1002
|
const cursor = cursorVisible ? "|" : " ";
|
|
703
1003
|
const displayAmount = amount || "0";
|
|
704
|
-
return /* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
1004
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1005
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.secondary, bold: true, children: [
|
|
706
1006
|
"Enter amount of ",
|
|
707
1007
|
token.symbol,
|
|
708
1008
|
" to bridge:"
|
|
709
1009
|
] }) }),
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsx8(Box, { bordered: true, padding: 1, children: /* @__PURE__ */ jsxs8(Box8, { children: [
|
|
1011
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.primary, bold: true, children: displayAmount }),
|
|
1012
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.primary, children: cursor }),
|
|
1013
|
+
/* @__PURE__ */ jsxs8(Text8, { color: theme.muted, children: [
|
|
714
1014
|
" ",
|
|
715
1015
|
token.symbol
|
|
716
1016
|
] })
|
|
717
1017
|
] }) }),
|
|
718
|
-
error && /* @__PURE__ */
|
|
1018
|
+
error && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.error, children: [
|
|
719
1019
|
symbols.failed,
|
|
720
1020
|
" ",
|
|
721
1021
|
error
|
|
722
1022
|
] }) }),
|
|
723
|
-
/* @__PURE__ */
|
|
1023
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.muted, dimColor: true, children: [
|
|
724
1024
|
"From: ",
|
|
725
1025
|
chain.name,
|
|
726
1026
|
" (",
|
|
727
1027
|
token.symbol,
|
|
728
1028
|
")"
|
|
729
1029
|
] }) }),
|
|
730
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: "To: HyperEVM (USDC)" }) })
|
|
1031
|
+
] });
|
|
1032
|
+
}
|
|
1033
|
+
function KeyInputStep({
|
|
1034
|
+
privateKey,
|
|
1035
|
+
walletAddress,
|
|
1036
|
+
onKeyChange,
|
|
1037
|
+
onConfirm,
|
|
1038
|
+
error,
|
|
1039
|
+
loading
|
|
1040
|
+
}) {
|
|
1041
|
+
const [cursorVisible, setCursorVisible] = useState2(true);
|
|
1042
|
+
useEffect(() => {
|
|
1043
|
+
const interval = setInterval(() => {
|
|
1044
|
+
setCursorVisible((v) => !v);
|
|
1045
|
+
}, 530);
|
|
1046
|
+
return () => clearInterval(interval);
|
|
1047
|
+
}, []);
|
|
1048
|
+
useInput2((input, key) => {
|
|
1049
|
+
if (loading) return;
|
|
1050
|
+
if (key.return && privateKey.length >= 64) {
|
|
1051
|
+
onConfirm();
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
if (key.backspace || key.delete) {
|
|
1055
|
+
onKeyChange(privateKey.slice(0, -1));
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
if (/^[0-9a-fA-Fx]$/.test(input)) {
|
|
1059
|
+
onKeyChange(privateKey + input);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
const cursor = cursorVisible ? "|" : " ";
|
|
1063
|
+
const maskedKey = privateKey.length > 10 ? `${privateKey.slice(0, 6)}${"*".repeat(Math.max(0, privateKey.length - 10))}${privateKey.slice(-4)}` : privateKey;
|
|
1064
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1065
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.secondary, bold: true, children: "Enter your private key to sign the transaction:" }) }),
|
|
1066
|
+
/* @__PURE__ */ jsx8(Box, { bordered: true, padding: 1, children: /* @__PURE__ */ jsxs8(Box8, { children: [
|
|
1067
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.primary, bold: true, children: maskedKey || "0x" }),
|
|
1068
|
+
/* @__PURE__ */ jsx8(Text8, { color: theme.primary, children: cursor })
|
|
1069
|
+
] }) }),
|
|
1070
|
+
loading && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx8(Spinner, { text: "Validating key and fetching quote..." }) }),
|
|
1071
|
+
walletAddress && !loading && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.success, children: [
|
|
1072
|
+
symbols.check,
|
|
1073
|
+
" Wallet: ",
|
|
1074
|
+
walletAddress.slice(0, 8),
|
|
1075
|
+
"...",
|
|
1076
|
+
walletAddress.slice(-6)
|
|
1077
|
+
] }) }),
|
|
1078
|
+
error && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.error, children: [
|
|
1079
|
+
symbols.failed,
|
|
1080
|
+
" ",
|
|
1081
|
+
error
|
|
1082
|
+
] }) }),
|
|
1083
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: "Your key is only used locally to sign transactions" }) }),
|
|
1084
|
+
/* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: "Tip: Paste your 64-character hex key (with or without 0x prefix)" }) })
|
|
731
1085
|
] });
|
|
732
1086
|
}
|
|
733
1087
|
function ConfirmationStep({
|
|
734
1088
|
chain,
|
|
735
1089
|
token,
|
|
736
1090
|
amount,
|
|
1091
|
+
quote,
|
|
1092
|
+
walletAddress,
|
|
737
1093
|
onConfirm
|
|
738
1094
|
}) {
|
|
739
|
-
|
|
740
|
-
if (key.return) {
|
|
1095
|
+
useInput2((_input, key) => {
|
|
1096
|
+
if (key.return && quote) {
|
|
741
1097
|
onConfirm();
|
|
742
1098
|
}
|
|
743
1099
|
});
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
1100
|
+
if (!quote) {
|
|
1101
|
+
return /* @__PURE__ */ jsx8(Spinner, { text: "Fetching quote..." });
|
|
1102
|
+
}
|
|
1103
|
+
const estimatedMinutes = Math.ceil(quote.estimatedTime / 60);
|
|
1104
|
+
const outputFormatted = (Number(quote.toAmount) / Math.pow(10, quote.toToken.decimals)).toFixed(2);
|
|
1105
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1106
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.secondary, bold: true, children: "Review your bridge transaction:" }) }),
|
|
1107
|
+
walletAddress && /* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.muted, dimColor: true, children: [
|
|
1108
|
+
"Wallet: ",
|
|
1109
|
+
walletAddress.slice(0, 8),
|
|
1110
|
+
"...",
|
|
1111
|
+
walletAddress.slice(-6)
|
|
1112
|
+
] }) }),
|
|
1113
|
+
/* @__PURE__ */ jsxs8(Box, { bordered: true, title: "Transaction Summary", padding: 1, children: [
|
|
1114
|
+
/* @__PURE__ */ jsx8(
|
|
750
1115
|
KeyValue,
|
|
751
1116
|
{
|
|
752
1117
|
items: [
|
|
@@ -754,72 +1119,143 @@ function ConfirmationStep({
|
|
|
754
1119
|
{ key: "Token", value: token.symbol },
|
|
755
1120
|
{ key: "Amount", value: `${amount} ${token.symbol}` },
|
|
756
1121
|
{ key: "To Chain", value: "HyperEVM" },
|
|
757
|
-
{ key: "Receive", value:
|
|
1122
|
+
{ key: "You Receive", value: `~${outputFormatted} ${quote.toToken.symbol}` }
|
|
758
1123
|
]
|
|
759
1124
|
}
|
|
760
1125
|
),
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ jsx8(Divider, { width: 40 }) }),
|
|
1127
|
+
/* @__PURE__ */ jsx8(
|
|
763
1128
|
KeyValue,
|
|
764
1129
|
{
|
|
765
1130
|
items: [
|
|
766
|
-
{ key: "
|
|
767
|
-
{ key: "
|
|
1131
|
+
{ key: "Gas Fee", value: `$${quote.fees.gasUsd.toFixed(2)}` },
|
|
1132
|
+
{ key: "Bridge Fee", value: `$${quote.fees.bridgeFeeUsd.toFixed(2)}` },
|
|
1133
|
+
{ key: "Total Fees", value: `$${quote.fees.totalUsd.toFixed(2)}` },
|
|
1134
|
+
{ key: "Est. Time", value: `~${estimatedMinutes} min` }
|
|
768
1135
|
],
|
|
769
1136
|
keyColor: theme.muted,
|
|
770
1137
|
valueColor: theme.warning
|
|
771
1138
|
}
|
|
772
1139
|
)
|
|
773
1140
|
] }),
|
|
774
|
-
/* @__PURE__ */
|
|
1141
|
+
quote.highImpact && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.warning, children: [
|
|
1142
|
+
symbols.pending,
|
|
1143
|
+
" Warning: High price impact (",
|
|
1144
|
+
(quote.priceImpact * 100).toFixed(2),
|
|
1145
|
+
"%)"
|
|
1146
|
+
] }) }),
|
|
1147
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.success, bold: true, children: [
|
|
775
1148
|
symbols.arrow,
|
|
776
1149
|
" Press Enter to execute the bridge"
|
|
777
1150
|
] }) }),
|
|
778
|
-
/* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: "Press b to go back and edit" }) })
|
|
779
1152
|
] });
|
|
780
1153
|
}
|
|
781
1154
|
function ExecutionStep({
|
|
782
1155
|
chain,
|
|
783
1156
|
token,
|
|
784
|
-
amount
|
|
1157
|
+
amount,
|
|
1158
|
+
quote,
|
|
1159
|
+
privateKey,
|
|
1160
|
+
onComplete,
|
|
1161
|
+
onError
|
|
785
1162
|
}) {
|
|
786
|
-
const [
|
|
1163
|
+
const [stepState, setStepState] = useState2({
|
|
1164
|
+
approval: "active",
|
|
1165
|
+
bridge: "pending",
|
|
1166
|
+
confirm: "pending"
|
|
1167
|
+
});
|
|
1168
|
+
const [statusMessage, setStatusMessage] = useState2("Initializing...");
|
|
1169
|
+
const [txHash, setTxHash] = useState2(null);
|
|
1170
|
+
const [error, setError] = useState2(null);
|
|
1171
|
+
const [isExecuting, setIsExecuting] = useState2(false);
|
|
787
1172
|
useEffect(() => {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1173
|
+
if (isExecuting) return;
|
|
1174
|
+
setIsExecuting(true);
|
|
1175
|
+
const executeBridge = async () => {
|
|
1176
|
+
try {
|
|
1177
|
+
const signer = await createSigner(privateKey, chain.id);
|
|
1178
|
+
const mina = new Mina({
|
|
1179
|
+
integrator: "mina-cli-wizard",
|
|
1180
|
+
autoDeposit: true
|
|
1181
|
+
});
|
|
1182
|
+
const result = await mina.execute({
|
|
1183
|
+
quote,
|
|
1184
|
+
signer,
|
|
1185
|
+
onStepChange: (stepStatus) => {
|
|
1186
|
+
setStatusMessage(`${stepStatus.step}: ${stepStatus.status}`);
|
|
1187
|
+
if (stepStatus.step === "approval") {
|
|
1188
|
+
if (stepStatus.status === "completed") {
|
|
1189
|
+
setStepState((prev) => ({ ...prev, approval: "completed", bridge: "active" }));
|
|
1190
|
+
} else if (stepStatus.status === "failed") {
|
|
1191
|
+
setStepState((prev) => ({ ...prev, approval: "failed" }));
|
|
1192
|
+
} else if (stepStatus.status === "active") {
|
|
1193
|
+
setStepState((prev) => ({ ...prev, approval: "active" }));
|
|
1194
|
+
}
|
|
1195
|
+
} else if (stepStatus.step === "bridge" || stepStatus.step === "swap") {
|
|
1196
|
+
if (stepStatus.status === "completed") {
|
|
1197
|
+
setStepState((prev) => ({ ...prev, bridge: "completed", confirm: "active" }));
|
|
1198
|
+
} else if (stepStatus.status === "failed") {
|
|
1199
|
+
setStepState((prev) => ({ ...prev, bridge: "failed" }));
|
|
1200
|
+
} else if (stepStatus.status === "active") {
|
|
1201
|
+
setStepState((prev) => ({ ...prev, bridge: "active" }));
|
|
1202
|
+
}
|
|
1203
|
+
if (stepStatus.txHash) {
|
|
1204
|
+
setTxHash(stepStatus.txHash);
|
|
1205
|
+
}
|
|
1206
|
+
} else if (stepStatus.step === "deposit") {
|
|
1207
|
+
if (stepStatus.status === "completed") {
|
|
1208
|
+
setStepState((prev) => ({ ...prev, confirm: "completed" }));
|
|
1209
|
+
} else if (stepStatus.status === "failed") {
|
|
1210
|
+
setStepState((prev) => ({ ...prev, confirm: "failed" }));
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
onStatusChange: (status) => {
|
|
1215
|
+
setStatusMessage(status.substatus || `Step ${status.currentStep}/${status.totalSteps}`);
|
|
1216
|
+
if (status.txHash) {
|
|
1217
|
+
setTxHash(status.txHash);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
if (result.status === "completed") {
|
|
1222
|
+
setStepState({
|
|
1223
|
+
approval: "completed",
|
|
1224
|
+
bridge: "completed",
|
|
1225
|
+
confirm: "completed"
|
|
1226
|
+
});
|
|
1227
|
+
onComplete(result);
|
|
1228
|
+
} else if (result.status === "failed") {
|
|
1229
|
+
setError(result.error?.message || "Bridge execution failed");
|
|
1230
|
+
onError(result.error || new Error("Bridge execution failed"));
|
|
793
1231
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1232
|
+
} catch (err) {
|
|
1233
|
+
const normalizedError = normalizeError(err instanceof Error ? err : new Error(String(err)));
|
|
1234
|
+
setError(normalizedError.message);
|
|
1235
|
+
onError(normalizedError);
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
executeBridge();
|
|
798
1239
|
}, []);
|
|
799
1240
|
const steps = [
|
|
800
1241
|
{
|
|
801
|
-
label: "
|
|
802
|
-
status:
|
|
803
|
-
|
|
804
|
-
{
|
|
805
|
-
label: "Fetching quote",
|
|
806
|
-
status: currentStep > 1 ? "completed" : currentStep === 1 ? "active" : "pending"
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
label: "Approving token",
|
|
810
|
-
status: currentStep > 2 ? "completed" : currentStep === 2 ? "active" : "pending"
|
|
1242
|
+
label: "Approving token spend",
|
|
1243
|
+
status: stepState.approval,
|
|
1244
|
+
description: stepState.approval === "active" ? "Waiting for approval..." : void 0
|
|
811
1245
|
},
|
|
812
1246
|
{
|
|
813
|
-
label: "Executing bridge",
|
|
814
|
-
status:
|
|
1247
|
+
label: "Executing bridge transaction",
|
|
1248
|
+
status: stepState.bridge,
|
|
1249
|
+
description: stepState.bridge === "active" ? statusMessage : void 0
|
|
815
1250
|
},
|
|
816
1251
|
{
|
|
817
1252
|
label: "Confirming on destination",
|
|
818
|
-
status:
|
|
1253
|
+
status: stepState.confirm,
|
|
1254
|
+
description: stepState.confirm === "active" ? "Waiting for bridge confirmation..." : void 0
|
|
819
1255
|
}
|
|
820
1256
|
];
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1258
|
+
/* @__PURE__ */ jsx8(Box8, { marginBottom: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.secondary, bold: true, children: [
|
|
823
1259
|
"Bridging ",
|
|
824
1260
|
amount,
|
|
825
1261
|
" ",
|
|
@@ -828,23 +1264,35 @@ function ExecutionStep({
|
|
|
828
1264
|
chain.name,
|
|
829
1265
|
" to HyperEVM"
|
|
830
1266
|
] }) }),
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
|
|
1267
|
+
/* @__PURE__ */ jsx8(ProgressSteps, { steps, title: "Bridge Progress", showNumbers: true }),
|
|
1268
|
+
txHash && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.muted, children: [
|
|
1269
|
+
"TX: ",
|
|
1270
|
+
txHash.slice(0, 16),
|
|
1271
|
+
"...",
|
|
1272
|
+
txHash.slice(-8)
|
|
1273
|
+
] }) }),
|
|
1274
|
+
stepState.confirm === "completed" && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.success, bold: true, children: [
|
|
833
1275
|
symbols.check,
|
|
834
|
-
" Bridge
|
|
1276
|
+
" Bridge completed successfully!"
|
|
1277
|
+
] }) }),
|
|
1278
|
+
error && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsxs8(Text8, { color: theme.error, children: [
|
|
1279
|
+
symbols.failed,
|
|
1280
|
+
" Error: ",
|
|
1281
|
+
error
|
|
835
1282
|
] }) }),
|
|
836
|
-
/* @__PURE__ */
|
|
1283
|
+
!error && stepState.confirm !== "completed" && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text8, { color: theme.muted, dimColor: true, children: statusMessage }) })
|
|
837
1284
|
] });
|
|
838
1285
|
}
|
|
839
1286
|
function Wizard() {
|
|
840
1287
|
const { exit } = useApp();
|
|
841
|
-
const [state, setState] =
|
|
842
|
-
|
|
1288
|
+
const [state, setState] = useState2(initialState);
|
|
1289
|
+
const [keyLoading, setKeyLoading] = useState2(false);
|
|
1290
|
+
useInput2((input, key) => {
|
|
843
1291
|
if (input === "q" && state.step !== "execute") {
|
|
844
1292
|
exit();
|
|
845
1293
|
return;
|
|
846
1294
|
}
|
|
847
|
-
if (input === "b" && state.step !== "chain" && state.step !== "execute" && state.step !== "amount") {
|
|
1295
|
+
if (input === "b" && state.step !== "chain" && state.step !== "execute" && state.step !== "amount" && state.step !== "key") {
|
|
848
1296
|
goBack();
|
|
849
1297
|
return;
|
|
850
1298
|
}
|
|
@@ -852,6 +1300,10 @@ function Wizard() {
|
|
|
852
1300
|
goBack();
|
|
853
1301
|
return;
|
|
854
1302
|
}
|
|
1303
|
+
if (input === "b" && state.step === "key" && !keyLoading) {
|
|
1304
|
+
goBack();
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
855
1307
|
});
|
|
856
1308
|
const goBack = useCallback(() => {
|
|
857
1309
|
setState((prev) => {
|
|
@@ -860,8 +1312,10 @@ function Wizard() {
|
|
|
860
1312
|
return { ...prev, step: "chain", token: null, error: null };
|
|
861
1313
|
case "amount":
|
|
862
1314
|
return { ...prev, step: "token", amount: "", error: null };
|
|
1315
|
+
case "key":
|
|
1316
|
+
return { ...prev, step: "amount", privateKey: null, walletAddress: null, quote: null, error: null };
|
|
863
1317
|
case "confirm":
|
|
864
|
-
return { ...prev, step: "
|
|
1318
|
+
return { ...prev, step: "key", error: null };
|
|
865
1319
|
default:
|
|
866
1320
|
return prev;
|
|
867
1321
|
}
|
|
@@ -882,15 +1336,53 @@ function Wizard() {
|
|
|
882
1336
|
setState((prev) => ({ ...prev, error: "Please enter a valid positive amount" }));
|
|
883
1337
|
return;
|
|
884
1338
|
}
|
|
885
|
-
setState((prev) => ({ ...prev, step: "
|
|
1339
|
+
setState((prev) => ({ ...prev, step: "key", error: null }));
|
|
886
1340
|
}, [state.amount]);
|
|
1341
|
+
const handleKeyChange = useCallback((key) => {
|
|
1342
|
+
setState((prev) => ({ ...prev, privateKey: key, error: null }));
|
|
1343
|
+
}, []);
|
|
1344
|
+
const handleKeyConfirm = useCallback(async () => {
|
|
1345
|
+
if (!state.privateKey || !state.chain || !state.token) return;
|
|
1346
|
+
const keyWithoutPrefix = state.privateKey.startsWith("0x") ? state.privateKey.slice(2) : state.privateKey;
|
|
1347
|
+
if (!/^[0-9a-fA-F]{64}$/.test(keyWithoutPrefix)) {
|
|
1348
|
+
setState((prev) => ({ ...prev, error: "Invalid private key format. Expected 64 hex characters." }));
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
setKeyLoading(true);
|
|
1352
|
+
try {
|
|
1353
|
+
const normalizedKey = state.privateKey.startsWith("0x") ? state.privateKey : `0x${state.privateKey}`;
|
|
1354
|
+
const address = await getAddressFromPrivateKey(normalizedKey);
|
|
1355
|
+
setState((prev) => ({ ...prev, walletAddress: address, privateKey: normalizedKey }));
|
|
1356
|
+
const amountInSmallestUnit = (parseFloat(state.amount) * Math.pow(10, state.token.decimals)).toString();
|
|
1357
|
+
const quote = await getQuote({
|
|
1358
|
+
fromChainId: state.chain.id,
|
|
1359
|
+
toChainId: HYPEREVM_CHAIN_ID,
|
|
1360
|
+
fromToken: state.token.address,
|
|
1361
|
+
toToken: HYPEREVM_USDC_ADDRESS,
|
|
1362
|
+
fromAmount: amountInSmallestUnit,
|
|
1363
|
+
fromAddress: address
|
|
1364
|
+
});
|
|
1365
|
+
setState((prev) => ({ ...prev, quote, step: "confirm", error: null }));
|
|
1366
|
+
} catch (err) {
|
|
1367
|
+
const error = err instanceof Error ? err.message : "Failed to validate key or fetch quote";
|
|
1368
|
+
setState((prev) => ({ ...prev, error }));
|
|
1369
|
+
} finally {
|
|
1370
|
+
setKeyLoading(false);
|
|
1371
|
+
}
|
|
1372
|
+
}, [state.privateKey, state.chain, state.token, state.amount]);
|
|
887
1373
|
const handleConfirm = useCallback(() => {
|
|
888
1374
|
setState((prev) => ({ ...prev, step: "execute", error: null }));
|
|
889
1375
|
}, []);
|
|
1376
|
+
const handleExecutionComplete = useCallback((result) => {
|
|
1377
|
+
setState((prev) => ({ ...prev, executionResult: result, executionStatus: "completed" }));
|
|
1378
|
+
}, []);
|
|
1379
|
+
const handleExecutionError = useCallback((error) => {
|
|
1380
|
+
setState((prev) => ({ ...prev, error: error.message, executionStatus: "failed" }));
|
|
1381
|
+
}, []);
|
|
890
1382
|
const renderStepContent = () => {
|
|
891
1383
|
switch (state.step) {
|
|
892
1384
|
case "chain":
|
|
893
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ jsx8(
|
|
894
1386
|
ChainSelectionStep,
|
|
895
1387
|
{
|
|
896
1388
|
onSelect: handleChainSelect,
|
|
@@ -899,7 +1391,7 @@ function Wizard() {
|
|
|
899
1391
|
);
|
|
900
1392
|
case "token":
|
|
901
1393
|
if (!state.chain) return null;
|
|
902
|
-
return /* @__PURE__ */
|
|
1394
|
+
return /* @__PURE__ */ jsx8(
|
|
903
1395
|
TokenSelectionStep,
|
|
904
1396
|
{
|
|
905
1397
|
chain: state.chain,
|
|
@@ -909,7 +1401,7 @@ function Wizard() {
|
|
|
909
1401
|
);
|
|
910
1402
|
case "amount":
|
|
911
1403
|
if (!state.chain || !state.token) return null;
|
|
912
|
-
return /* @__PURE__ */
|
|
1404
|
+
return /* @__PURE__ */ jsx8(
|
|
913
1405
|
AmountInputStep,
|
|
914
1406
|
{
|
|
915
1407
|
chain: state.chain,
|
|
@@ -920,50 +1412,69 @@ function Wizard() {
|
|
|
920
1412
|
error: state.error
|
|
921
1413
|
}
|
|
922
1414
|
);
|
|
1415
|
+
case "key":
|
|
1416
|
+
if (!state.chain || !state.token) return null;
|
|
1417
|
+
return /* @__PURE__ */ jsx8(
|
|
1418
|
+
KeyInputStep,
|
|
1419
|
+
{
|
|
1420
|
+
privateKey: state.privateKey || "",
|
|
1421
|
+
walletAddress: state.walletAddress,
|
|
1422
|
+
onKeyChange: handleKeyChange,
|
|
1423
|
+
onConfirm: handleKeyConfirm,
|
|
1424
|
+
error: state.error,
|
|
1425
|
+
loading: keyLoading
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
923
1428
|
case "confirm":
|
|
924
1429
|
if (!state.chain || !state.token) return null;
|
|
925
|
-
return /* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsx8(
|
|
926
1431
|
ConfirmationStep,
|
|
927
1432
|
{
|
|
928
1433
|
chain: state.chain,
|
|
929
1434
|
token: state.token,
|
|
930
1435
|
amount: state.amount,
|
|
1436
|
+
quote: state.quote,
|
|
1437
|
+
walletAddress: state.walletAddress,
|
|
931
1438
|
onConfirm: handleConfirm
|
|
932
1439
|
}
|
|
933
1440
|
);
|
|
934
1441
|
case "execute":
|
|
935
|
-
if (!state.chain || !state.token) return null;
|
|
936
|
-
return /* @__PURE__ */
|
|
1442
|
+
if (!state.chain || !state.token || !state.quote || !state.privateKey) return null;
|
|
1443
|
+
return /* @__PURE__ */ jsx8(
|
|
937
1444
|
ExecutionStep,
|
|
938
1445
|
{
|
|
939
1446
|
chain: state.chain,
|
|
940
1447
|
token: state.token,
|
|
941
|
-
amount: state.amount
|
|
1448
|
+
amount: state.amount,
|
|
1449
|
+
quote: state.quote,
|
|
1450
|
+
privateKey: state.privateKey,
|
|
1451
|
+
onComplete: handleExecutionComplete,
|
|
1452
|
+
onError: handleExecutionError
|
|
942
1453
|
}
|
|
943
1454
|
);
|
|
944
1455
|
default:
|
|
945
1456
|
return null;
|
|
946
1457
|
}
|
|
947
1458
|
};
|
|
948
|
-
return /* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
952
|
-
/* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", padding: 1, children: [
|
|
1460
|
+
/* @__PURE__ */ jsx8(Header, { showTagline: true, tagline: "Cross-chain bridge to Hyperliquid" }),
|
|
1461
|
+
/* @__PURE__ */ jsx8(StepIndicator, { currentStep: state.step }),
|
|
1462
|
+
/* @__PURE__ */ jsx8(Box8, { flexDirection: "column", marginY: 1, children: renderStepContent() }),
|
|
1463
|
+
/* @__PURE__ */ jsx8(NavigationHints, { step: state.step })
|
|
953
1464
|
] });
|
|
954
1465
|
}
|
|
955
1466
|
|
|
956
1467
|
// src/commands/quote.tsx
|
|
957
|
-
import { useState as
|
|
958
|
-
import { Box as
|
|
1468
|
+
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
1469
|
+
import { Box as Box9, Text as Text9, useApp as useApp2 } from "ink";
|
|
959
1470
|
import {
|
|
960
|
-
Mina,
|
|
1471
|
+
Mina as Mina2,
|
|
961
1472
|
getChains as getChains2,
|
|
962
1473
|
getTokens,
|
|
963
1474
|
HYPEREVM_CHAIN_ID as HYPEREVM_CHAIN_ID2,
|
|
964
|
-
HYPEREVM_USDC_ADDRESS
|
|
1475
|
+
HYPEREVM_USDC_ADDRESS as HYPEREVM_USDC_ADDRESS2
|
|
965
1476
|
} from "@siphoyawe/mina-sdk";
|
|
966
|
-
import { jsx as
|
|
1477
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
967
1478
|
function parseAmount(amount, decimals) {
|
|
968
1479
|
const [whole, fraction = ""] = amount.split(".");
|
|
969
1480
|
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
@@ -1006,8 +1517,8 @@ function QuoteBox({
|
|
|
1006
1517
|
const gasFees = formatUsd(quote.fees.gasUsd);
|
|
1007
1518
|
const bridgeFees = formatUsd(quote.fees.bridgeFeeUsd);
|
|
1008
1519
|
const protocolFees = formatUsd(quote.fees.protocolFeeUsd);
|
|
1009
|
-
return /* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1520
|
+
return /* @__PURE__ */ jsx9(Box9, { flexDirection: "column", children: /* @__PURE__ */ jsxs9(Box, { bordered: true, title: "Bridge Quote", padding: 1, children: [
|
|
1521
|
+
/* @__PURE__ */ jsx9(
|
|
1011
1522
|
KeyValue,
|
|
1012
1523
|
{
|
|
1013
1524
|
items: [
|
|
@@ -1018,8 +1529,8 @@ function QuoteBox({
|
|
|
1018
1529
|
valueColor: theme.primary
|
|
1019
1530
|
}
|
|
1020
1531
|
),
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx9(Box9, { marginY: 1, children: /* @__PURE__ */ jsx9(Divider, { width: 45 }) }),
|
|
1533
|
+
/* @__PURE__ */ jsx9(
|
|
1023
1534
|
KeyValue,
|
|
1024
1535
|
{
|
|
1025
1536
|
items: [
|
|
@@ -1031,9 +1542,9 @@ function QuoteBox({
|
|
|
1031
1542
|
valueColor: theme.secondary
|
|
1032
1543
|
}
|
|
1033
1544
|
),
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
/* @__PURE__ */
|
|
1545
|
+
/* @__PURE__ */ jsx9(Box9, { marginY: 1, children: /* @__PURE__ */ jsx9(Divider, { width: 45 }) }),
|
|
1546
|
+
/* @__PURE__ */ jsx9(Box9, { marginBottom: 1, children: /* @__PURE__ */ jsx9(Text9, { color: theme.muted, bold: true, children: "Fee Breakdown:" }) }),
|
|
1547
|
+
/* @__PURE__ */ jsx9(
|
|
1037
1548
|
KeyValue,
|
|
1038
1549
|
{
|
|
1039
1550
|
items: [
|
|
@@ -1046,13 +1557,13 @@ function QuoteBox({
|
|
|
1046
1557
|
valueColor: theme.warning
|
|
1047
1558
|
}
|
|
1048
1559
|
),
|
|
1049
|
-
quote.highImpact && /* @__PURE__ */
|
|
1560
|
+
quote.highImpact && /* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: theme.warning, children: [
|
|
1050
1561
|
symbols.pending,
|
|
1051
1562
|
" High price impact: ",
|
|
1052
1563
|
(quote.priceImpact * 100).toFixed(2),
|
|
1053
1564
|
"%"
|
|
1054
1565
|
] }) }),
|
|
1055
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: theme.muted, children: [
|
|
1056
1567
|
"Min. received: ",
|
|
1057
1568
|
quote.minimumReceivedFormatted,
|
|
1058
1569
|
" ",
|
|
@@ -1102,17 +1613,17 @@ function JsonOutput({ quote, fromChain, sourceToken }) {
|
|
|
1102
1613
|
expiresAt: quote.expiresAt
|
|
1103
1614
|
}
|
|
1104
1615
|
};
|
|
1105
|
-
return /* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ jsx9(Text9, { children: JSON.stringify(jsonData, null, 2) });
|
|
1106
1617
|
}
|
|
1107
1618
|
function ErrorDisplay({ message }) {
|
|
1108
|
-
return /* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", padding: 1, children: [
|
|
1620
|
+
/* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsxs9(Text9, { color: theme.error, bold: true, children: [
|
|
1110
1621
|
symbols.failed,
|
|
1111
1622
|
" Error: ",
|
|
1112
1623
|
message
|
|
1113
1624
|
] }) }),
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1625
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { color: theme.muted, children: "Usage: npx mina quote --from <chain> --token <symbol> --amount <number>" }) }),
|
|
1626
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { color: theme.muted, children: "Example: npx mina quote --from arbitrum --token USDC --amount 100" }) })
|
|
1116
1627
|
] });
|
|
1117
1628
|
}
|
|
1118
1629
|
function QuoteDisplay({
|
|
@@ -1123,12 +1634,12 @@ function QuoteDisplay({
|
|
|
1123
1634
|
jsonOutput
|
|
1124
1635
|
}) {
|
|
1125
1636
|
const { exit } = useApp2();
|
|
1126
|
-
const [loading, setLoading] =
|
|
1127
|
-
const [error, setError] =
|
|
1128
|
-
const [quote, setQuote] =
|
|
1129
|
-
const [sourceChain, setSourceChain] =
|
|
1130
|
-
const [sourceToken, setSourceToken] =
|
|
1131
|
-
const [destToken, setDestToken] =
|
|
1637
|
+
const [loading, setLoading] = useState3(true);
|
|
1638
|
+
const [error, setError] = useState3(null);
|
|
1639
|
+
const [quote, setQuote] = useState3(null);
|
|
1640
|
+
const [sourceChain, setSourceChain] = useState3(null);
|
|
1641
|
+
const [sourceToken, setSourceToken] = useState3(null);
|
|
1642
|
+
const [destToken, setDestToken] = useState3(null);
|
|
1132
1643
|
useEffect2(() => {
|
|
1133
1644
|
async function fetchQuote() {
|
|
1134
1645
|
try {
|
|
@@ -1161,7 +1672,7 @@ function QuoteDisplay({
|
|
|
1161
1672
|
}
|
|
1162
1673
|
setSourceToken(foundToken);
|
|
1163
1674
|
const destinationToken = {
|
|
1164
|
-
address:
|
|
1675
|
+
address: HYPEREVM_USDC_ADDRESS2,
|
|
1165
1676
|
symbol: "USDC",
|
|
1166
1677
|
name: "USD Coin",
|
|
1167
1678
|
decimals: 6,
|
|
@@ -1169,12 +1680,12 @@ function QuoteDisplay({
|
|
|
1169
1680
|
chainId: HYPEREVM_CHAIN_ID2
|
|
1170
1681
|
};
|
|
1171
1682
|
setDestToken(destinationToken);
|
|
1172
|
-
const mina = new
|
|
1683
|
+
const mina = new Mina2({ integrator: "mina-cli" });
|
|
1173
1684
|
const quoteResult = await mina.getQuote({
|
|
1174
1685
|
fromChainId: chain.id,
|
|
1175
1686
|
toChainId: HYPEREVM_CHAIN_ID2,
|
|
1176
1687
|
fromToken: foundToken.address,
|
|
1177
|
-
toToken:
|
|
1688
|
+
toToken: HYPEREVM_USDC_ADDRESS2,
|
|
1178
1689
|
fromAmount: parseAmount(amount, foundToken.decimals),
|
|
1179
1690
|
fromAddress: "0x0000000000000000000000000000000000000000"
|
|
1180
1691
|
// Placeholder for quote
|
|
@@ -1196,19 +1707,19 @@ function QuoteDisplay({
|
|
|
1196
1707
|
}
|
|
1197
1708
|
}, [loading, jsonOutput, exit]);
|
|
1198
1709
|
if (loading) {
|
|
1199
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsx9(Box9, { padding: 1, children: /* @__PURE__ */ jsx9(Spinner, { text: `Fetching quote for ${amount} ${token} from ${fromChain}...` }) });
|
|
1200
1711
|
}
|
|
1201
1712
|
if (error) {
|
|
1202
|
-
return /* @__PURE__ */
|
|
1713
|
+
return /* @__PURE__ */ jsx9(ErrorDisplay, { message: error });
|
|
1203
1714
|
}
|
|
1204
1715
|
if (!quote || !sourceChain || !sourceToken || !destToken) {
|
|
1205
|
-
return /* @__PURE__ */
|
|
1716
|
+
return /* @__PURE__ */ jsx9(ErrorDisplay, { message: "Failed to fetch quote data" });
|
|
1206
1717
|
}
|
|
1207
1718
|
if (jsonOutput) {
|
|
1208
|
-
return /* @__PURE__ */
|
|
1719
|
+
return /* @__PURE__ */ jsx9(JsonOutput, { quote, fromChain: sourceChain, sourceToken });
|
|
1209
1720
|
}
|
|
1210
|
-
return /* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", padding: 1, children: [
|
|
1722
|
+
/* @__PURE__ */ jsx9(
|
|
1212
1723
|
QuoteBox,
|
|
1213
1724
|
{
|
|
1214
1725
|
quote,
|
|
@@ -1218,7 +1729,7 @@ function QuoteDisplay({
|
|
|
1218
1729
|
destToken
|
|
1219
1730
|
}
|
|
1220
1731
|
),
|
|
1221
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: theme.muted, children: [
|
|
1222
1733
|
"Quote valid until: ",
|
|
1223
1734
|
new Date(quote.expiresAt).toLocaleTimeString()
|
|
1224
1735
|
] }) })
|
|
@@ -1226,18 +1737,36 @@ function QuoteDisplay({
|
|
|
1226
1737
|
}
|
|
1227
1738
|
|
|
1228
1739
|
// src/commands/chains.tsx
|
|
1229
|
-
import { useState as
|
|
1230
|
-
import { Box as
|
|
1740
|
+
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
1741
|
+
import { Box as Box10, Text as Text10, useApp as useApp3 } from "ink";
|
|
1231
1742
|
import {
|
|
1232
1743
|
getChains as getChains3,
|
|
1233
1744
|
HYPEREVM_CHAIN_ID as HYPEREVM_CHAIN_ID3
|
|
1234
1745
|
} from "@siphoyawe/mina-sdk";
|
|
1235
|
-
import { jsx as
|
|
1746
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1747
|
+
var POPULAR_CHAIN_IDS = [
|
|
1748
|
+
1,
|
|
1749
|
+
// Ethereum
|
|
1750
|
+
42161,
|
|
1751
|
+
// Arbitrum
|
|
1752
|
+
10,
|
|
1753
|
+
// Optimism
|
|
1754
|
+
137,
|
|
1755
|
+
// Polygon
|
|
1756
|
+
8453,
|
|
1757
|
+
// Base
|
|
1758
|
+
43114,
|
|
1759
|
+
// Avalanche
|
|
1760
|
+
56,
|
|
1761
|
+
// BNB Chain
|
|
1762
|
+
999
|
|
1763
|
+
// HyperEVM (destination)
|
|
1764
|
+
];
|
|
1236
1765
|
function ChainsCommand({ json = false }) {
|
|
1237
1766
|
const { exit } = useApp3();
|
|
1238
|
-
const [chains, setChains] =
|
|
1239
|
-
const [loading, setLoading] =
|
|
1240
|
-
const [error, setError] =
|
|
1767
|
+
const [chains, setChains] = useState4([]);
|
|
1768
|
+
const [loading, setLoading] = useState4(true);
|
|
1769
|
+
const [error, setError] = useState4(null);
|
|
1241
1770
|
useEffect3(() => {
|
|
1242
1771
|
async function loadChains() {
|
|
1243
1772
|
try {
|
|
@@ -1262,12 +1791,6 @@ function ChainsCommand({ json = false }) {
|
|
|
1262
1791
|
hyperEvmChain.type = "Dest";
|
|
1263
1792
|
}
|
|
1264
1793
|
}
|
|
1265
|
-
chainRows.sort((a, b) => {
|
|
1266
|
-
if (a.type !== b.type) {
|
|
1267
|
-
return a.type === "Origin" ? -1 : 1;
|
|
1268
|
-
}
|
|
1269
|
-
return a.name.localeCompare(b.name);
|
|
1270
|
-
});
|
|
1271
1794
|
setChains(chainRows);
|
|
1272
1795
|
} catch (err) {
|
|
1273
1796
|
setError(err instanceof Error ? err.message : "Failed to load chains");
|
|
@@ -1292,86 +1815,81 @@ function ChainsCommand({ json = false }) {
|
|
|
1292
1815
|
return null;
|
|
1293
1816
|
}
|
|
1294
1817
|
if (loading) {
|
|
1295
|
-
return /* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", padding: 1, children: [
|
|
1819
|
+
/* @__PURE__ */ jsx10(Header, { compact: true, showTagline: false }),
|
|
1820
|
+
/* @__PURE__ */ jsx10(Spinner, { text: "Loading supported chains..." })
|
|
1298
1821
|
] });
|
|
1299
1822
|
}
|
|
1300
1823
|
if (error) {
|
|
1301
|
-
return /* @__PURE__ */
|
|
1302
|
-
/* @__PURE__ */
|
|
1303
|
-
/* @__PURE__ */
|
|
1824
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", padding: 1, children: [
|
|
1825
|
+
/* @__PURE__ */ jsx10(Header, { compact: true, showTagline: false }),
|
|
1826
|
+
/* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs10(Text10, { color: theme.error, children: [
|
|
1304
1827
|
symbols.failed,
|
|
1305
1828
|
" Error: ",
|
|
1306
1829
|
error
|
|
1307
1830
|
] }) })
|
|
1308
1831
|
] });
|
|
1309
1832
|
}
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
headerColor: theme.primary,
|
|
1322
|
-
cellColor: theme.muted
|
|
1323
|
-
},
|
|
1324
|
-
{
|
|
1325
|
-
header: "Type",
|
|
1326
|
-
accessor: "type",
|
|
1327
|
-
headerColor: theme.primary,
|
|
1328
|
-
cellColor: (value) => value === "Origin" ? theme.success : theme.accent
|
|
1329
|
-
}
|
|
1330
|
-
];
|
|
1331
|
-
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", padding: 1, children: [
|
|
1332
|
-
/* @__PURE__ */ jsx9(Header, { compact: true, showTagline: false }),
|
|
1333
|
-
/* @__PURE__ */ jsx9(Box9, { marginBottom: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: theme.secondary, children: [
|
|
1334
|
-
symbols.arrow,
|
|
1335
|
-
" Supported Chains (",
|
|
1336
|
-
chains.length,
|
|
1337
|
-
")"
|
|
1338
|
-
] }) }),
|
|
1339
|
-
/* @__PURE__ */ jsx9(
|
|
1340
|
-
Table,
|
|
1833
|
+
const listItems = chains.map((chain) => ({
|
|
1834
|
+
id: chain.id,
|
|
1835
|
+
label: chain.name,
|
|
1836
|
+
sublabel: `ID: ${chain.id}`,
|
|
1837
|
+
badge: chain.type,
|
|
1838
|
+
badgeColor: chain.type === "Origin" ? theme.success : theme.accent
|
|
1839
|
+
}));
|
|
1840
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", padding: 1, children: [
|
|
1841
|
+
/* @__PURE__ */ jsx10(Header, { compact: true, showTagline: false }),
|
|
1842
|
+
/* @__PURE__ */ jsx10(
|
|
1843
|
+
SearchableList,
|
|
1341
1844
|
{
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1845
|
+
items: listItems,
|
|
1846
|
+
title: "Supported Chains",
|
|
1847
|
+
placeholder: "Type to filter chains...",
|
|
1848
|
+
popularIds: POPULAR_CHAIN_IDS,
|
|
1849
|
+
maxDisplay: 12,
|
|
1850
|
+
searchable: true
|
|
1346
1851
|
}
|
|
1347
1852
|
),
|
|
1348
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { color: theme.muted, dimColor: true, children: "\u2605 = Popular chains \u2022 Origin = Source for bridging \u2022 Dest = Destination" }) })
|
|
1349
1854
|
] });
|
|
1350
1855
|
}
|
|
1351
1856
|
|
|
1352
1857
|
// src/commands/tokens.tsx
|
|
1353
|
-
import { useState as
|
|
1354
|
-
import { Box as
|
|
1858
|
+
import { useState as useState5, useEffect as useEffect4 } from "react";
|
|
1859
|
+
import { Box as Box11, Text as Text11, useApp as useApp4 } from "ink";
|
|
1355
1860
|
import {
|
|
1356
1861
|
getChains as getChains4,
|
|
1357
1862
|
getBridgeableTokens as getBridgeableTokens2
|
|
1358
1863
|
} from "@siphoyawe/mina-sdk";
|
|
1359
|
-
import { jsx as
|
|
1864
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1865
|
+
var POPULAR_TOKEN_SYMBOLS = [
|
|
1866
|
+
"USDC",
|
|
1867
|
+
"USDT",
|
|
1868
|
+
"ETH",
|
|
1869
|
+
"WETH",
|
|
1870
|
+
"WBTC",
|
|
1871
|
+
"DAI",
|
|
1872
|
+
"USDC.e",
|
|
1873
|
+
"LINK",
|
|
1874
|
+
"UNI",
|
|
1875
|
+
"ARB",
|
|
1876
|
+
"OP",
|
|
1877
|
+
"MATIC"
|
|
1878
|
+
];
|
|
1360
1879
|
function truncateAddress(address) {
|
|
1361
1880
|
if (address.length <= 14) return address;
|
|
1362
|
-
return `${address.slice(0,
|
|
1881
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
1363
1882
|
}
|
|
1364
1883
|
async function resolveChainId(chainInput) {
|
|
1884
|
+
const response = await getChains4();
|
|
1365
1885
|
const numericId = parseInt(chainInput, 10);
|
|
1366
1886
|
if (!isNaN(numericId)) {
|
|
1367
|
-
const
|
|
1368
|
-
const chain2 = response2.chains.find((c) => c.id === numericId);
|
|
1887
|
+
const chain2 = response.chains.find((c) => c.id === numericId);
|
|
1369
1888
|
if (chain2) {
|
|
1370
1889
|
return { chainId: chain2.id, chainName: chain2.name };
|
|
1371
1890
|
}
|
|
1372
1891
|
return { chainId: numericId, chainName: chainInput };
|
|
1373
1892
|
}
|
|
1374
|
-
const response = await getChains4();
|
|
1375
1893
|
const chainLower = chainInput.toLowerCase();
|
|
1376
1894
|
const chain = response.chains.find(
|
|
1377
1895
|
(c) => c.name.toLowerCase() === chainLower || c.key?.toLowerCase() === chainLower
|
|
@@ -1386,11 +1904,11 @@ function TokensCommand({
|
|
|
1386
1904
|
json = false
|
|
1387
1905
|
}) {
|
|
1388
1906
|
const { exit } = useApp4();
|
|
1389
|
-
const [tokens, setTokens] =
|
|
1390
|
-
const [loading, setLoading] =
|
|
1391
|
-
const [error, setError] =
|
|
1392
|
-
const [chainName, setChainName] =
|
|
1393
|
-
const [availableChains, setAvailableChains] =
|
|
1907
|
+
const [tokens, setTokens] = useState5([]);
|
|
1908
|
+
const [loading, setLoading] = useState5(true);
|
|
1909
|
+
const [error, setError] = useState5(null);
|
|
1910
|
+
const [chainName, setChainName] = useState5("");
|
|
1911
|
+
const [availableChains, setAvailableChains] = useState5([]);
|
|
1394
1912
|
useEffect4(() => {
|
|
1395
1913
|
async function loadTokens() {
|
|
1396
1914
|
try {
|
|
@@ -1413,14 +1931,13 @@ function TokensCommand({
|
|
|
1413
1931
|
}
|
|
1414
1932
|
setChainName(resolved.chainName);
|
|
1415
1933
|
const response = await getBridgeableTokens2(resolved.chainId);
|
|
1416
|
-
const tokenRows = response.tokens.map((token) => ({
|
|
1934
|
+
const tokenRows = response.tokens.filter((token) => token.symbol && token.symbol.trim() !== "").map((token) => ({
|
|
1417
1935
|
symbol: token.symbol,
|
|
1418
1936
|
address: token.address,
|
|
1419
1937
|
displayAddress: truncateAddress(token.address),
|
|
1420
1938
|
decimals: token.decimals,
|
|
1421
1939
|
name: token.name
|
|
1422
1940
|
}));
|
|
1423
|
-
tokenRows.sort((a, b) => a.symbol.localeCompare(b.symbol));
|
|
1424
1941
|
setTokens(tokenRows);
|
|
1425
1942
|
} catch (err) {
|
|
1426
1943
|
setError(err instanceof Error ? err.message : "Failed to load tokens");
|
|
@@ -1457,110 +1974,82 @@ function TokensCommand({
|
|
|
1457
1974
|
return null;
|
|
1458
1975
|
}
|
|
1459
1976
|
if (loading) {
|
|
1460
|
-
return /* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1977
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", padding: 1, children: [
|
|
1978
|
+
/* @__PURE__ */ jsx11(Header, { compact: true, showTagline: false }),
|
|
1979
|
+
/* @__PURE__ */ jsx11(Spinner, { text: chain ? `Loading tokens for ${chain}...` : "Loading..." })
|
|
1463
1980
|
] });
|
|
1464
1981
|
}
|
|
1465
1982
|
if (error) {
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1983
|
+
const popularChainIds = [1, 42161, 10, 137, 8453, 43114];
|
|
1984
|
+
const popularChains = availableChains.filter((c) => popularChainIds.includes(c.id)).slice(0, 6);
|
|
1985
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", padding: 1, children: [
|
|
1986
|
+
/* @__PURE__ */ jsx11(Header, { compact: true, showTagline: false }),
|
|
1987
|
+
/* @__PURE__ */ jsx11(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsxs11(Text11, { color: theme.error, children: [
|
|
1469
1988
|
symbols.failed,
|
|
1470
1989
|
" ",
|
|
1471
1990
|
error
|
|
1472
1991
|
] }) }),
|
|
1473
|
-
availableChains.length > 0 && /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
/* @__PURE__ */ jsxs10(Text10, { color: theme.muted, children: [
|
|
1483
|
-
" (ID: ",
|
|
1484
|
-
c.id,
|
|
1485
|
-
")"
|
|
1486
|
-
] })
|
|
1487
|
-
] }, i)),
|
|
1488
|
-
availableChains.length > 10 && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { color: theme.muted, dimColor: true, children: [
|
|
1489
|
-
"...and ",
|
|
1490
|
-
availableChains.length - 10,
|
|
1491
|
-
' more. Use "mina chains" to see all.'
|
|
1492
|
-
] }) }),
|
|
1493
|
-
/* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { color: theme.muted, dimColor: true, children: "Example: mina tokens --chain arbitrum" }) })
|
|
1992
|
+
availableChains.length > 0 && /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
1993
|
+
/* @__PURE__ */ jsx11(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx11(Text11, { color: theme.secondary, children: "Popular chains:" }) }),
|
|
1994
|
+
/* @__PURE__ */ jsx11(Box11, { flexDirection: "row", gap: 2, flexWrap: "wrap", children: popularChains.map((c) => /* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsx11(Text11, { color: theme.primary, children: c.name.toLowerCase() }) }, c.id)) }),
|
|
1995
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text11, { color: theme.muted, dimColor: true, children: "Example: mina tokens --chain arbitrum" }) }),
|
|
1996
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsxs11(Text11, { color: theme.muted, dimColor: true, children: [
|
|
1997
|
+
'Run "mina chains" to see all ',
|
|
1998
|
+
availableChains.length,
|
|
1999
|
+
" supported chains"
|
|
2000
|
+
] }) })
|
|
1494
2001
|
] })
|
|
1495
2002
|
] });
|
|
1496
2003
|
}
|
|
1497
2004
|
if (tokens.length === 0) {
|
|
1498
|
-
return /* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
2005
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", padding: 1, children: [
|
|
2006
|
+
/* @__PURE__ */ jsx11(Header, { compact: true, showTagline: false }),
|
|
2007
|
+
/* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsxs11(Text11, { color: theme.warning, children: [
|
|
1501
2008
|
symbols.pending,
|
|
1502
2009
|
" No bridgeable tokens found for ",
|
|
1503
2010
|
chainName
|
|
1504
2011
|
] }) })
|
|
1505
2012
|
] });
|
|
1506
2013
|
}
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
width: 20
|
|
1520
|
-
},
|
|
1521
|
-
{
|
|
1522
|
-
header: "Decimals",
|
|
1523
|
-
accessor: (row) => String(row.decimals),
|
|
1524
|
-
align: "right",
|
|
1525
|
-
headerColor: theme.primary,
|
|
1526
|
-
cellColor: theme.secondary
|
|
1527
|
-
}
|
|
1528
|
-
];
|
|
1529
|
-
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", padding: 1, children: [
|
|
1530
|
-
/* @__PURE__ */ jsx10(Header, { compact: true, showTagline: false }),
|
|
1531
|
-
/* @__PURE__ */ jsxs10(Box10, { marginBottom: 1, children: [
|
|
1532
|
-
/* @__PURE__ */ jsxs10(Text10, { color: theme.secondary, children: [
|
|
2014
|
+
const listItems = tokens.map((token) => ({
|
|
2015
|
+
id: token.address,
|
|
2016
|
+
label: token.symbol,
|
|
2017
|
+
sublabel: token.displayAddress,
|
|
2018
|
+
badge: `${token.decimals}d`,
|
|
2019
|
+
badgeColor: theme.muted
|
|
2020
|
+
}));
|
|
2021
|
+
const popularTokenIds = tokens.filter((t) => POPULAR_TOKEN_SYMBOLS.includes(t.symbol.toUpperCase())).map((t) => t.address);
|
|
2022
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", padding: 1, children: [
|
|
2023
|
+
/* @__PURE__ */ jsx11(Header, { compact: true, showTagline: false }),
|
|
2024
|
+
/* @__PURE__ */ jsxs11(Box11, { marginBottom: 1, children: [
|
|
2025
|
+
/* @__PURE__ */ jsxs11(Text11, { color: theme.secondary, children: [
|
|
1533
2026
|
symbols.arrow,
|
|
1534
2027
|
" Bridgeable Tokens on",
|
|
1535
2028
|
" "
|
|
1536
2029
|
] }),
|
|
1537
|
-
/* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */ jsxs10(Text10, { color: theme.muted, children: [
|
|
1539
|
-
" (",
|
|
1540
|
-
tokens.length,
|
|
1541
|
-
")"
|
|
1542
|
-
] })
|
|
2030
|
+
/* @__PURE__ */ jsx11(Text11, { color: theme.primary, bold: true, children: chainName })
|
|
1543
2031
|
] }),
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
|
|
2032
|
+
/* @__PURE__ */ jsx11(
|
|
2033
|
+
SearchableList,
|
|
1546
2034
|
{
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
2035
|
+
items: listItems,
|
|
2036
|
+
placeholder: "Type to filter tokens (e.g. USDC, ETH)...",
|
|
2037
|
+
popularIds: popularTokenIds,
|
|
2038
|
+
maxDisplay: 12,
|
|
2039
|
+
searchable: true
|
|
1551
2040
|
}
|
|
1552
2041
|
),
|
|
1553
|
-
/* @__PURE__ */
|
|
2042
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text11, { color: theme.muted, dimColor: true, children: "\u2605 = Popular tokens \u2022 Tokens bridgeable to Hyperliquid via Mina" }) })
|
|
1554
2043
|
] });
|
|
1555
2044
|
}
|
|
1556
2045
|
|
|
1557
2046
|
// src/commands/status.tsx
|
|
1558
|
-
import { useState as
|
|
1559
|
-
import { Box as
|
|
2047
|
+
import { useState as useState6, useEffect as useEffect5, useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
2048
|
+
import { Box as Box12, Text as Text12, useApp as useApp5 } from "ink";
|
|
1560
2049
|
import {
|
|
1561
|
-
Mina as
|
|
2050
|
+
Mina as Mina3
|
|
1562
2051
|
} from "@siphoyawe/mina-sdk";
|
|
1563
|
-
import { jsx as
|
|
2052
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1564
2053
|
function formatDuration(ms) {
|
|
1565
2054
|
const seconds = Math.floor(ms / 1e3);
|
|
1566
2055
|
if (seconds < 60) return `${seconds}s`;
|
|
@@ -1591,15 +2080,15 @@ function getStatusColor2(status) {
|
|
|
1591
2080
|
function getStepIndicator(status) {
|
|
1592
2081
|
switch (status) {
|
|
1593
2082
|
case "pending":
|
|
1594
|
-
return /* @__PURE__ */
|
|
2083
|
+
return /* @__PURE__ */ jsx12(Text12, { color: theme.muted, children: symbols.pending });
|
|
1595
2084
|
case "executing":
|
|
1596
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx12(Text12, { color: theme.primary, children: /* @__PURE__ */ jsx12(Spinner, {}) });
|
|
1597
2086
|
case "completed":
|
|
1598
|
-
return /* @__PURE__ */
|
|
2087
|
+
return /* @__PURE__ */ jsx12(Text12, { color: theme.success, children: symbols.completed });
|
|
1599
2088
|
case "failed":
|
|
1600
|
-
return /* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ jsx12(Text12, { color: theme.error, children: symbols.failed });
|
|
1601
2090
|
default:
|
|
1602
|
-
return /* @__PURE__ */
|
|
2091
|
+
return /* @__PURE__ */ jsx12(Text12, { color: theme.muted, children: symbols.pending });
|
|
1603
2092
|
}
|
|
1604
2093
|
}
|
|
1605
2094
|
function calculateProgress(steps) {
|
|
@@ -1635,8 +2124,8 @@ function StatusDisplay({
|
|
|
1635
2124
|
const stepInfo = getCurrentStepInfo(status.steps);
|
|
1636
2125
|
const progress = calculateProgress(status.steps);
|
|
1637
2126
|
const statusLabel = status.status.charAt(0).toUpperCase() + status.status.slice(1);
|
|
1638
|
-
return /* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
2127
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
2128
|
+
/* @__PURE__ */ jsx12(Box, { bordered: true, title: "Bridge Status", padding: 1, children: /* @__PURE__ */ jsx12(
|
|
1640
2129
|
KeyValue,
|
|
1641
2130
|
{
|
|
1642
2131
|
items: [
|
|
@@ -1646,11 +2135,11 @@ function StatusDisplay({
|
|
|
1646
2135
|
valueColor: getStatusColor2(status.status)
|
|
1647
2136
|
}
|
|
1648
2137
|
) }),
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
status.steps.map((step, index) => /* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
|
|
2138
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Box, { bordered: true, padding: 1, children: /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
2139
|
+
status.steps.map((step, index) => /* @__PURE__ */ jsxs12(Box12, { children: [
|
|
2140
|
+
/* @__PURE__ */ jsx12(Box12, { width: 3, children: getStepIndicator(step.status) }),
|
|
2141
|
+
/* @__PURE__ */ jsx12(Box12, { flexGrow: 1, children: /* @__PURE__ */ jsxs12(
|
|
2142
|
+
Text12,
|
|
1654
2143
|
{
|
|
1655
2144
|
color: getStatusColor2(step.status),
|
|
1656
2145
|
bold: step.status === "executing",
|
|
@@ -1661,11 +2150,11 @@ function StatusDisplay({
|
|
|
1661
2150
|
]
|
|
1662
2151
|
}
|
|
1663
2152
|
) }),
|
|
1664
|
-
step.txHash && /* @__PURE__ */
|
|
2153
|
+
step.txHash && /* @__PURE__ */ jsx12(Box12, { marginLeft: 2, children: /* @__PURE__ */ jsx12(Text12, { color: theme.muted, dimColor: true, children: truncateHash(step.txHash) }) })
|
|
1665
2154
|
] }, step.stepId)),
|
|
1666
|
-
status.steps.length === 0 && /* @__PURE__ */
|
|
2155
|
+
status.steps.length === 0 && /* @__PURE__ */ jsx12(Text12, { color: theme.muted, children: "No steps found" })
|
|
1667
2156
|
] }) }) }),
|
|
1668
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Box, { bordered: true, padding: 1, children: /* @__PURE__ */ jsx12(
|
|
1669
2158
|
KeyValue,
|
|
1670
2159
|
{
|
|
1671
2160
|
items: [
|
|
@@ -1679,19 +2168,19 @@ function StatusDisplay({
|
|
|
1679
2168
|
valueColor: theme.secondary
|
|
1680
2169
|
}
|
|
1681
2170
|
) }) }),
|
|
1682
|
-
status.status === "failed" && /* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
2171
|
+
status.status === "failed" && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Box, { bordered: true, borderColor: theme.error, padding: 1, children: /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
2172
|
+
/* @__PURE__ */ jsxs12(Text12, { color: theme.error, bold: true, children: [
|
|
1684
2173
|
symbols.failed,
|
|
1685
2174
|
" Transaction Failed"
|
|
1686
2175
|
] }),
|
|
1687
|
-
status.steps.find((s) => s.status === "failed")?.error && /* @__PURE__ */
|
|
2176
|
+
status.steps.find((s) => s.status === "failed")?.error && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text12, { color: theme.muted, children: status.steps.find((s) => s.status === "failed")?.error }) })
|
|
1688
2177
|
] }) }) }),
|
|
1689
|
-
status.status === "completed" && /* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
2178
|
+
status.status === "completed" && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Box, { bordered: true, borderColor: theme.success, padding: 1, children: /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
2179
|
+
/* @__PURE__ */ jsxs12(Text12, { color: theme.success, bold: true, children: [
|
|
1691
2180
|
symbols.completed,
|
|
1692
2181
|
" Bridge Completed Successfully"
|
|
1693
2182
|
] }),
|
|
1694
|
-
status.bridgeTxHash && /* @__PURE__ */
|
|
2183
|
+
status.bridgeTxHash && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
1695
2184
|
KeyValue,
|
|
1696
2185
|
{
|
|
1697
2186
|
items: [
|
|
@@ -1706,23 +2195,23 @@ function StatusDisplay({
|
|
|
1706
2195
|
] });
|
|
1707
2196
|
}
|
|
1708
2197
|
function LoadingState({ txHash }) {
|
|
1709
|
-
return /* @__PURE__ */
|
|
2198
|
+
return /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", children: /* @__PURE__ */ jsx12(Box, { bordered: true, title: "Bridge Status", padding: 1, children: /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Spinner, { text: `Looking up ${truncateHash(txHash)}...` }) }) }) });
|
|
1710
2199
|
}
|
|
1711
2200
|
function NotFoundState({ txHash }) {
|
|
1712
|
-
return /* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", children: /* @__PURE__ */ jsx12(Box, { bordered: true, borderColor: theme.warning, title: "Bridge Status", padding: 1, children: /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
2202
|
+
/* @__PURE__ */ jsxs12(Text12, { color: theme.warning, children: [
|
|
1714
2203
|
symbols.pending,
|
|
1715
2204
|
" Transaction not found"
|
|
1716
2205
|
] }),
|
|
1717
|
-
/* @__PURE__ */
|
|
2206
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsxs12(Text12, { color: theme.muted, children: [
|
|
1718
2207
|
"TX: ",
|
|
1719
2208
|
truncateHash(txHash)
|
|
1720
2209
|
] }) }),
|
|
1721
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text12, { color: theme.muted, dimColor: true, children: "The transaction may not have been initiated via this CLI, or it may have expired from the local cache." }) })
|
|
1722
2211
|
] }) }) });
|
|
1723
2212
|
}
|
|
1724
2213
|
function ErrorState({ error }) {
|
|
1725
|
-
return /* @__PURE__ */
|
|
2214
|
+
return /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", children: /* @__PURE__ */ jsx12(Box, { bordered: true, borderColor: theme.error, title: "Error", padding: 1, children: /* @__PURE__ */ jsxs12(Text12, { color: theme.error, children: [
|
|
1726
2215
|
symbols.failed,
|
|
1727
2216
|
" ",
|
|
1728
2217
|
error
|
|
@@ -1730,13 +2219,13 @@ function ErrorState({ error }) {
|
|
|
1730
2219
|
}
|
|
1731
2220
|
function Status({ txHash, watch = false }) {
|
|
1732
2221
|
const { exit } = useApp5();
|
|
1733
|
-
const [status, setStatus] =
|
|
1734
|
-
const [loading, setLoading] =
|
|
1735
|
-
const [error, setError] =
|
|
1736
|
-
const [notFound, setNotFound] =
|
|
1737
|
-
const [startTime] =
|
|
1738
|
-
const [elapsedTime, setElapsedTime] =
|
|
1739
|
-
const mina =
|
|
2222
|
+
const [status, setStatus] = useState6(null);
|
|
2223
|
+
const [loading, setLoading] = useState6(true);
|
|
2224
|
+
const [error, setError] = useState6(null);
|
|
2225
|
+
const [notFound, setNotFound] = useState6(false);
|
|
2226
|
+
const [startTime] = useState6(Date.now());
|
|
2227
|
+
const [elapsedTime, setElapsedTime] = useState6(0);
|
|
2228
|
+
const mina = useMemo2(() => new Mina3({ integrator: "mina-cli" }), []);
|
|
1740
2229
|
const fetchStatus = useCallback2(async () => {
|
|
1741
2230
|
try {
|
|
1742
2231
|
const result = await mina.getStatus(txHash);
|
|
@@ -1786,17 +2275,17 @@ function Status({ txHash, watch = false }) {
|
|
|
1786
2275
|
const totalEstimated = elapsed / progress * 100;
|
|
1787
2276
|
return Math.max(0, totalEstimated - elapsed);
|
|
1788
2277
|
})() : null;
|
|
1789
|
-
return /* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
watch && /* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", padding: 1, children: [
|
|
2279
|
+
/* @__PURE__ */ jsx12(Header, { showTagline: false }),
|
|
2280
|
+
watch && /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsxs12(Text12, { color: theme.primary, children: [
|
|
2281
|
+
/* @__PURE__ */ jsx12(Spinner, {}),
|
|
1793
2282
|
" Watching for updates (polling every 5s)"
|
|
1794
2283
|
] }) }),
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
loading && /* @__PURE__ */
|
|
1797
|
-
error && /* @__PURE__ */
|
|
1798
|
-
notFound && !loading && /* @__PURE__ */
|
|
1799
|
-
status && !loading && !error && /* @__PURE__ */
|
|
2284
|
+
/* @__PURE__ */ jsxs12(Box12, { marginTop: 1, children: [
|
|
2285
|
+
loading && /* @__PURE__ */ jsx12(LoadingState, { txHash }),
|
|
2286
|
+
error && /* @__PURE__ */ jsx12(ErrorState, { error }),
|
|
2287
|
+
notFound && !loading && /* @__PURE__ */ jsx12(NotFoundState, { txHash }),
|
|
2288
|
+
status && !loading && !error && /* @__PURE__ */ jsx12(
|
|
1800
2289
|
StatusDisplay,
|
|
1801
2290
|
{
|
|
1802
2291
|
status,
|
|
@@ -1806,153 +2295,43 @@ function Status({ txHash, watch = false }) {
|
|
|
1806
2295
|
}
|
|
1807
2296
|
)
|
|
1808
2297
|
] }),
|
|
1809
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text12, { color: theme.muted, dimColor: true, children: watch ? "Ctrl+C to stop watching" : "Press any key to exit" }) })
|
|
1810
2299
|
] });
|
|
1811
2300
|
}
|
|
1812
2301
|
|
|
1813
2302
|
// src/commands/bridge.tsx
|
|
1814
|
-
import { useState as
|
|
1815
|
-
import { Box as
|
|
2303
|
+
import { useState as useState7, useEffect as useEffect6, useCallback as useCallback3 } from "react";
|
|
2304
|
+
import { Box as Box13, Text as Text13, useApp as useApp6, useInput as useInput3 } from "ink";
|
|
1816
2305
|
import {
|
|
1817
|
-
Mina as
|
|
2306
|
+
Mina as Mina4,
|
|
1818
2307
|
getChains as getChains5,
|
|
1819
2308
|
getBridgeableTokens as getBridgeableTokens3,
|
|
1820
|
-
getQuote,
|
|
2309
|
+
getQuote as getQuote2,
|
|
1821
2310
|
HYPEREVM_CHAIN_ID as HYPEREVM_CHAIN_ID4,
|
|
1822
|
-
HYPEREVM_USDC_ADDRESS as
|
|
1823
|
-
normalizeError,
|
|
2311
|
+
HYPEREVM_USDC_ADDRESS as HYPEREVM_USDC_ADDRESS3,
|
|
2312
|
+
normalizeError as normalizeError2,
|
|
1824
2313
|
isRecoverableError,
|
|
1825
2314
|
RECOVERY_ACTIONS
|
|
1826
2315
|
} from "@siphoyawe/mina-sdk";
|
|
1827
|
-
|
|
1828
|
-
// src/lib/wallet.ts
|
|
1829
|
-
import fs from "fs";
|
|
1830
|
-
import readline from "readline";
|
|
1831
|
-
async function loadPrivateKey(path3) {
|
|
1832
|
-
if (path3) {
|
|
1833
|
-
if (!fs.existsSync(path3)) {
|
|
1834
|
-
throw new Error(`Key file not found: ${path3}`);
|
|
1835
|
-
}
|
|
1836
|
-
const content = fs.readFileSync(path3, "utf-8");
|
|
1837
|
-
try {
|
|
1838
|
-
const json = JSON.parse(content);
|
|
1839
|
-
const key = json.privateKey || json.private_key || json.key;
|
|
1840
|
-
if (key) {
|
|
1841
|
-
return normalizePrivateKey(key);
|
|
1842
|
-
}
|
|
1843
|
-
return normalizePrivateKey(content.trim());
|
|
1844
|
-
} catch {
|
|
1845
|
-
return normalizePrivateKey(content.trim());
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
return promptForPrivateKey();
|
|
1849
|
-
}
|
|
1850
|
-
function promptForPrivateKey() {
|
|
1851
|
-
return new Promise((resolve, reject) => {
|
|
1852
|
-
const rl = readline.createInterface({
|
|
1853
|
-
input: process.stdin,
|
|
1854
|
-
output: process.stdout
|
|
1855
|
-
});
|
|
1856
|
-
process.stdout.write("Enter private key (input will be visible): ");
|
|
1857
|
-
rl.on("line", (answer) => {
|
|
1858
|
-
rl.close();
|
|
1859
|
-
try {
|
|
1860
|
-
resolve(normalizePrivateKey(answer.trim()));
|
|
1861
|
-
} catch (err) {
|
|
1862
|
-
reject(err);
|
|
1863
|
-
}
|
|
1864
|
-
});
|
|
1865
|
-
rl.on("close", () => {
|
|
1866
|
-
});
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
function normalizePrivateKey(key) {
|
|
1870
|
-
const trimmed = key.trim();
|
|
1871
|
-
const keyWithoutPrefix = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
|
|
1872
|
-
if (!/^[0-9a-fA-F]{64}$/.test(keyWithoutPrefix)) {
|
|
1873
|
-
throw new Error("Invalid private key format. Expected 64 hex characters.");
|
|
1874
|
-
}
|
|
1875
|
-
return trimmed.startsWith("0x") ? trimmed : `0x${trimmed}`;
|
|
1876
|
-
}
|
|
1877
|
-
async function getAddressFromPrivateKey(privateKey) {
|
|
1878
|
-
const { privateKeyToAccount } = await import("viem/accounts");
|
|
1879
|
-
const account = privateKeyToAccount(privateKey);
|
|
1880
|
-
return account.address;
|
|
1881
|
-
}
|
|
1882
|
-
async function createSigner(privateKey, chainId, rpcUrl) {
|
|
1883
|
-
const { privateKeyToAccount } = await import("viem/accounts");
|
|
1884
|
-
const { createWalletClient, http } = await import("viem");
|
|
1885
|
-
const { arbitrum, mainnet, optimism, polygon, base, avalanche, bsc } = await import("viem/chains");
|
|
1886
|
-
const chainMap = {
|
|
1887
|
-
1: mainnet,
|
|
1888
|
-
42161: arbitrum,
|
|
1889
|
-
10: optimism,
|
|
1890
|
-
137: polygon,
|
|
1891
|
-
8453: base,
|
|
1892
|
-
43114: avalanche,
|
|
1893
|
-
56: bsc,
|
|
1894
|
-
// HyperEVM
|
|
1895
|
-
999: {
|
|
1896
|
-
id: 999,
|
|
1897
|
-
name: "HyperEVM",
|
|
1898
|
-
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
1899
|
-
rpcUrls: {
|
|
1900
|
-
default: { http: ["https://rpc.hyperliquid.xyz/evm"] }
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
};
|
|
1904
|
-
const chain = chainMap[chainId];
|
|
1905
|
-
if (!chain) {
|
|
1906
|
-
throw new Error(`Unsupported chain ID: ${chainId}. Supported: ${Object.keys(chainMap).join(", ")}`);
|
|
1907
|
-
}
|
|
1908
|
-
const account = privateKeyToAccount(privateKey);
|
|
1909
|
-
const transport = rpcUrl ? http(rpcUrl) : http();
|
|
1910
|
-
const walletClient = createWalletClient({
|
|
1911
|
-
account,
|
|
1912
|
-
chain,
|
|
1913
|
-
transport
|
|
1914
|
-
});
|
|
1915
|
-
return {
|
|
1916
|
-
sendTransaction: async (request) => {
|
|
1917
|
-
const txHash = await walletClient.sendTransaction({
|
|
1918
|
-
to: request.to,
|
|
1919
|
-
data: request.data,
|
|
1920
|
-
value: BigInt(request.value || "0"),
|
|
1921
|
-
gas: request.gasLimit ? BigInt(request.gasLimit) : void 0,
|
|
1922
|
-
gasPrice: request.gasPrice ? BigInt(request.gasPrice) : void 0,
|
|
1923
|
-
chain
|
|
1924
|
-
});
|
|
1925
|
-
return txHash;
|
|
1926
|
-
},
|
|
1927
|
-
getAddress: async () => {
|
|
1928
|
-
return account.address;
|
|
1929
|
-
},
|
|
1930
|
-
getChainId: async () => {
|
|
1931
|
-
return chainId;
|
|
1932
|
-
}
|
|
1933
|
-
};
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
// src/commands/bridge.tsx
|
|
1937
|
-
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2316
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1938
2317
|
function ErrorDisplay2({
|
|
1939
2318
|
error,
|
|
1940
2319
|
recoveryAction
|
|
1941
2320
|
}) {
|
|
1942
|
-
const normalizedError =
|
|
2321
|
+
const normalizedError = normalizeError2(error);
|
|
1943
2322
|
const isRecoverable = isRecoverableError(normalizedError);
|
|
1944
|
-
return /* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
2323
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", marginTop: 1, children: [
|
|
2324
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text13, { color: theme.error, bold: true, children: [
|
|
1946
2325
|
symbols.failed,
|
|
1947
2326
|
" Error: ",
|
|
1948
2327
|
normalizedError.message
|
|
1949
2328
|
] }) }),
|
|
1950
|
-
recoveryAction && /* @__PURE__ */
|
|
2329
|
+
recoveryAction && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.warning, children: [
|
|
1951
2330
|
symbols.arrow,
|
|
1952
2331
|
" Recovery suggestion: ",
|
|
1953
2332
|
recoveryAction
|
|
1954
2333
|
] }) }),
|
|
1955
|
-
isRecoverable && /* @__PURE__ */
|
|
2334
|
+
isRecoverable && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text13, { color: theme.muted, dimColor: true, children: "This error may be temporary. Try again in a few moments." }) })
|
|
1956
2335
|
] });
|
|
1957
2336
|
}
|
|
1958
2337
|
function QuoteDisplay2({
|
|
@@ -1963,8 +2342,8 @@ function QuoteDisplay2({
|
|
|
1963
2342
|
}) {
|
|
1964
2343
|
const estimatedMinutes = Math.ceil(quote.estimatedTime / 60);
|
|
1965
2344
|
const outputFormatted = (Number(quote.toAmount) / Math.pow(10, quote.toToken.decimals)).toFixed(2);
|
|
1966
|
-
return /* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ jsxs13(Box, { bordered: true, title: "Bridge Quote", padding: 1, children: [
|
|
2346
|
+
/* @__PURE__ */ jsx13(
|
|
1968
2347
|
KeyValue,
|
|
1969
2348
|
{
|
|
1970
2349
|
items: [
|
|
@@ -1975,8 +2354,8 @@ function QuoteDisplay2({
|
|
|
1975
2354
|
]
|
|
1976
2355
|
}
|
|
1977
2356
|
),
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ jsx13(Divider, { width: 40 }) }),
|
|
2358
|
+
/* @__PURE__ */ jsx13(
|
|
1980
2359
|
KeyValue,
|
|
1981
2360
|
{
|
|
1982
2361
|
items: [
|
|
@@ -1989,13 +2368,13 @@ function QuoteDisplay2({
|
|
|
1989
2368
|
valueColor: theme.warning
|
|
1990
2369
|
}
|
|
1991
2370
|
),
|
|
1992
|
-
quote.highImpact && /* @__PURE__ */
|
|
2371
|
+
quote.highImpact && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.warning, children: [
|
|
1993
2372
|
symbols.pending,
|
|
1994
2373
|
" Warning: High price impact (",
|
|
1995
2374
|
(quote.priceImpact * 100).toFixed(2),
|
|
1996
2375
|
"%)"
|
|
1997
2376
|
] }) }),
|
|
1998
|
-
quote.includesAutoDeposit && /* @__PURE__ */
|
|
2377
|
+
quote.includesAutoDeposit && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.success, dimColor: true, children: [
|
|
1999
2378
|
symbols.check,
|
|
2000
2379
|
" Auto-deposit to Hyperliquid L1 included"
|
|
2001
2380
|
] }) })
|
|
@@ -2041,7 +2420,7 @@ function BridgeProgressDisplay({
|
|
|
2041
2420
|
}
|
|
2042
2421
|
}
|
|
2043
2422
|
}
|
|
2044
|
-
return /* @__PURE__ */
|
|
2423
|
+
return /* @__PURE__ */ jsx13(ProgressSteps, { steps, title: "Bridge Progress", showNumbers: true });
|
|
2045
2424
|
}
|
|
2046
2425
|
function SuccessDisplay({
|
|
2047
2426
|
result,
|
|
@@ -2049,12 +2428,12 @@ function SuccessDisplay({
|
|
|
2049
2428
|
token,
|
|
2050
2429
|
amount
|
|
2051
2430
|
}) {
|
|
2052
|
-
return /* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */
|
|
2431
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", marginTop: 1, children: [
|
|
2432
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text13, { color: theme.success, bold: true, children: [
|
|
2054
2433
|
symbols.check,
|
|
2055
2434
|
" Bridge completed successfully!"
|
|
2056
2435
|
] }) }),
|
|
2057
|
-
/* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Box, { bordered: true, padding: 1, children: /* @__PURE__ */ jsx13(
|
|
2058
2437
|
KeyValue,
|
|
2059
2438
|
{
|
|
2060
2439
|
items: [
|
|
@@ -2067,29 +2446,29 @@ function SuccessDisplay({
|
|
|
2067
2446
|
valueColor: theme.success
|
|
2068
2447
|
}
|
|
2069
2448
|
) }) }),
|
|
2070
|
-
/* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text13, { color: theme.muted, dimColor: true, children: "Your funds are now available on HyperEVM. Check your Hyperliquid balance." }) })
|
|
2071
2450
|
] });
|
|
2072
2451
|
}
|
|
2073
2452
|
function Bridge({ options }) {
|
|
2074
2453
|
const { exit } = useApp6();
|
|
2075
|
-
const [state, setState] =
|
|
2076
|
-
const [chain, setChain] =
|
|
2077
|
-
const [token, setToken] =
|
|
2078
|
-
const [quote, setQuote] =
|
|
2079
|
-
const [walletAddress, setWalletAddress] =
|
|
2080
|
-
const [privateKey, setPrivateKey] =
|
|
2081
|
-
const [error, setError] =
|
|
2082
|
-
const [recoveryAction, setRecoveryAction] =
|
|
2083
|
-
const [result, setResult] =
|
|
2084
|
-
const [currentStepDescription, setCurrentStepDescription] =
|
|
2085
|
-
const [stepState, setStepState] =
|
|
2454
|
+
const [state, setState] = useState7("loading");
|
|
2455
|
+
const [chain, setChain] = useState7(null);
|
|
2456
|
+
const [token, setToken] = useState7(null);
|
|
2457
|
+
const [quote, setQuote] = useState7(null);
|
|
2458
|
+
const [walletAddress, setWalletAddress] = useState7(null);
|
|
2459
|
+
const [privateKey, setPrivateKey] = useState7(null);
|
|
2460
|
+
const [error, setError] = useState7(null);
|
|
2461
|
+
const [recoveryAction, setRecoveryAction] = useState7(null);
|
|
2462
|
+
const [result, setResult] = useState7(null);
|
|
2463
|
+
const [currentStepDescription, setCurrentStepDescription] = useState7("");
|
|
2464
|
+
const [stepState, setStepState] = useState7({
|
|
2086
2465
|
loading: "active",
|
|
2087
2466
|
quote: "pending",
|
|
2088
2467
|
approval: "pending",
|
|
2089
2468
|
bridge: "pending",
|
|
2090
2469
|
confirm: "pending"
|
|
2091
2470
|
});
|
|
2092
|
-
|
|
2471
|
+
useInput3((input, key) => {
|
|
2093
2472
|
if (state === "confirming") {
|
|
2094
2473
|
if (key.return || input === "y" || input === "Y") {
|
|
2095
2474
|
executeBridge();
|
|
@@ -2131,11 +2510,11 @@ function Bridge({ options }) {
|
|
|
2131
2510
|
setToken(foundToken);
|
|
2132
2511
|
setStepState((prev) => ({ ...prev, loading: "completed", quote: "active" }));
|
|
2133
2512
|
const amountInSmallestUnit = (parseFloat(options.amount) * Math.pow(10, foundToken.decimals)).toString();
|
|
2134
|
-
const quoteResult = await
|
|
2513
|
+
const quoteResult = await getQuote2({
|
|
2135
2514
|
fromChainId: foundChain.id,
|
|
2136
2515
|
toChainId: HYPEREVM_CHAIN_ID4,
|
|
2137
2516
|
fromToken: foundToken.address,
|
|
2138
|
-
toToken:
|
|
2517
|
+
toToken: HYPEREVM_USDC_ADDRESS3,
|
|
2139
2518
|
fromAmount: amountInSmallestUnit,
|
|
2140
2519
|
fromAddress: address
|
|
2141
2520
|
});
|
|
@@ -2149,7 +2528,7 @@ function Bridge({ options }) {
|
|
|
2149
2528
|
setState("confirming");
|
|
2150
2529
|
}
|
|
2151
2530
|
} catch (err) {
|
|
2152
|
-
const normalizedError =
|
|
2531
|
+
const normalizedError = normalizeError2(err instanceof Error ? err : new Error(String(err)));
|
|
2153
2532
|
setError(normalizedError);
|
|
2154
2533
|
const action = RECOVERY_ACTIONS[normalizedError.code];
|
|
2155
2534
|
if (action) {
|
|
@@ -2169,7 +2548,7 @@ function Bridge({ options }) {
|
|
|
2169
2548
|
setState("executing");
|
|
2170
2549
|
setStepState((prev) => ({ ...prev, approval: "active" }));
|
|
2171
2550
|
const signer = await createSigner(privateKey, chain.id);
|
|
2172
|
-
const mina = new
|
|
2551
|
+
const mina = new Mina4({
|
|
2173
2552
|
integrator: "mina-cli",
|
|
2174
2553
|
autoDeposit: options.autoDeposit !== false
|
|
2175
2554
|
});
|
|
@@ -2216,7 +2595,7 @@ function Bridge({ options }) {
|
|
|
2216
2595
|
setState("failed");
|
|
2217
2596
|
}
|
|
2218
2597
|
} catch (err) {
|
|
2219
|
-
const normalizedError =
|
|
2598
|
+
const normalizedError = normalizeError2(err instanceof Error ? err : new Error(String(err)));
|
|
2220
2599
|
setError(normalizedError);
|
|
2221
2600
|
const action = RECOVERY_ACTIONS[normalizedError.code];
|
|
2222
2601
|
if (action) {
|
|
@@ -2225,9 +2604,9 @@ function Bridge({ options }) {
|
|
|
2225
2604
|
setState("failed");
|
|
2226
2605
|
}
|
|
2227
2606
|
}, [quote, chain, token, privateKey, walletAddress, options.autoDeposit]);
|
|
2228
|
-
return /* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", padding: 1, children: [
|
|
2608
|
+
/* @__PURE__ */ jsx13(Header, { compact: true, showTagline: false }),
|
|
2609
|
+
/* @__PURE__ */ jsx13(Box13, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.primary, bold: true, children: [
|
|
2231
2610
|
"Bridge ",
|
|
2232
2611
|
options.amount,
|
|
2233
2612
|
" ",
|
|
@@ -2235,15 +2614,15 @@ function Bridge({ options }) {
|
|
|
2235
2614
|
" from ",
|
|
2236
2615
|
options.from
|
|
2237
2616
|
] }) }),
|
|
2238
|
-
walletAddress && /* @__PURE__ */
|
|
2617
|
+
walletAddress && /* @__PURE__ */ jsx13(Box13, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.muted, dimColor: true, children: [
|
|
2239
2618
|
"Wallet: ",
|
|
2240
2619
|
walletAddress.slice(0, 8),
|
|
2241
2620
|
"...",
|
|
2242
2621
|
walletAddress.slice(-6)
|
|
2243
2622
|
] }) }),
|
|
2244
|
-
state === "loading" && /* @__PURE__ */
|
|
2245
|
-
state === "confirming" && quote && chain && token && /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2623
|
+
state === "loading" && /* @__PURE__ */ jsx13(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsx13(BridgeProgressDisplay, { stepState }) }),
|
|
2624
|
+
state === "confirming" && quote && chain && token && /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
2625
|
+
/* @__PURE__ */ jsx13(
|
|
2247
2626
|
QuoteDisplay2,
|
|
2248
2627
|
{
|
|
2249
2628
|
quote,
|
|
@@ -2252,22 +2631,22 @@ function Bridge({ options }) {
|
|
|
2252
2631
|
amount: options.amount
|
|
2253
2632
|
}
|
|
2254
2633
|
),
|
|
2255
|
-
!options.yes && /* @__PURE__ */
|
|
2634
|
+
!options.yes && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: theme.warning, bold: true, children: [
|
|
2256
2635
|
symbols.arrow,
|
|
2257
2636
|
" Proceed with bridge? (y/n)"
|
|
2258
2637
|
] }) }),
|
|
2259
|
-
options.yes && /* @__PURE__ */
|
|
2638
|
+
options.yes && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Spinner, { text: "Auto-confirming..." }) })
|
|
2260
2639
|
] }),
|
|
2261
|
-
state === "executing" && /* @__PURE__ */
|
|
2640
|
+
state === "executing" && /* @__PURE__ */ jsx13(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsx13(
|
|
2262
2641
|
BridgeProgressDisplay,
|
|
2263
2642
|
{
|
|
2264
2643
|
stepState,
|
|
2265
2644
|
currentStepDescription
|
|
2266
2645
|
}
|
|
2267
2646
|
) }),
|
|
2268
|
-
state === "completed" && result && chain && token && /* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2647
|
+
state === "completed" && result && chain && token && /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
2648
|
+
/* @__PURE__ */ jsx13(BridgeProgressDisplay, { stepState }),
|
|
2649
|
+
/* @__PURE__ */ jsx13(
|
|
2271
2650
|
SuccessDisplay,
|
|
2272
2651
|
{
|
|
2273
2652
|
result,
|
|
@@ -2276,24 +2655,24 @@ function Bridge({ options }) {
|
|
|
2276
2655
|
amount: options.amount
|
|
2277
2656
|
}
|
|
2278
2657
|
),
|
|
2279
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text13, { color: theme.muted, dimColor: true, children: "Press Enter or q to exit" }) })
|
|
2280
2659
|
] }),
|
|
2281
|
-
state === "failed" && error && /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
2660
|
+
state === "failed" && error && /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
2661
|
+
/* @__PURE__ */ jsx13(BridgeProgressDisplay, { stepState, error: error.message }),
|
|
2662
|
+
/* @__PURE__ */ jsx13(ErrorDisplay2, { error, recoveryAction: recoveryAction || void 0 }),
|
|
2663
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text13, { color: theme.muted, dimColor: true, children: "Press Enter or q to exit" }) })
|
|
2285
2664
|
] })
|
|
2286
2665
|
] });
|
|
2287
2666
|
}
|
|
2288
2667
|
async function bridgeCommand(options) {
|
|
2289
2668
|
const { render: render2 } = await import("ink");
|
|
2290
|
-
const
|
|
2291
|
-
render2(
|
|
2669
|
+
const React13 = await import("react");
|
|
2670
|
+
render2(React13.createElement(Bridge, { options }));
|
|
2292
2671
|
}
|
|
2293
2672
|
|
|
2294
2673
|
// src/commands/history.tsx
|
|
2295
|
-
import { useState as
|
|
2296
|
-
import { Box as
|
|
2674
|
+
import { useState as useState8, useEffect as useEffect7 } from "react";
|
|
2675
|
+
import { Box as Box14, Text as Text14, useApp as useApp7 } from "ink";
|
|
2297
2676
|
|
|
2298
2677
|
// src/lib/history.ts
|
|
2299
2678
|
import os from "os";
|
|
@@ -2326,7 +2705,7 @@ function getHistory(limit = 10, address) {
|
|
|
2326
2705
|
}
|
|
2327
2706
|
|
|
2328
2707
|
// src/commands/history.tsx
|
|
2329
|
-
import { Fragment, jsx as
|
|
2708
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2330
2709
|
function formatDate(timestamp) {
|
|
2331
2710
|
return new Date(timestamp).toLocaleString("en-US", {
|
|
2332
2711
|
month: "2-digit",
|
|
@@ -2366,19 +2745,19 @@ function transformToRows(entries) {
|
|
|
2366
2745
|
});
|
|
2367
2746
|
}
|
|
2368
2747
|
function EmptyState({ address }) {
|
|
2369
|
-
return /* @__PURE__ */
|
|
2370
|
-
|
|
2748
|
+
return /* @__PURE__ */ jsx14(Box14, { flexDirection: "column", children: /* @__PURE__ */ jsx14(
|
|
2749
|
+
Box14,
|
|
2371
2750
|
{
|
|
2372
2751
|
borderStyle: "round",
|
|
2373
2752
|
borderColor: theme.border,
|
|
2374
2753
|
paddingX: 2,
|
|
2375
2754
|
paddingY: 1,
|
|
2376
|
-
children: /* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2755
|
+
children: /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
2756
|
+
/* @__PURE__ */ jsxs14(Text14, { color: theme.muted, children: [
|
|
2378
2757
|
symbols.pending,
|
|
2379
2758
|
" No bridge history found"
|
|
2380
2759
|
] }),
|
|
2381
|
-
/* @__PURE__ */
|
|
2760
|
+
/* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: theme.muted, dimColor: true, children: address ? `No transactions found for address ${truncateHash2(address)}` : "Start by running a bridge transaction with: mina bridge --from <chain> --token USDC --amount 100" }) })
|
|
2382
2761
|
] })
|
|
2383
2762
|
}
|
|
2384
2763
|
) });
|
|
@@ -2389,8 +2768,8 @@ function HistoryCommand({
|
|
|
2389
2768
|
json = false
|
|
2390
2769
|
}) {
|
|
2391
2770
|
const { exit } = useApp7();
|
|
2392
|
-
const [entries, setEntries] =
|
|
2393
|
-
const [loading, setLoading] =
|
|
2771
|
+
const [entries, setEntries] = useState8([]);
|
|
2772
|
+
const [loading, setLoading] = useState8(true);
|
|
2394
2773
|
useEffect7(() => {
|
|
2395
2774
|
const history = getHistory(limit, address);
|
|
2396
2775
|
setEntries(history);
|
|
@@ -2407,9 +2786,9 @@ function HistoryCommand({
|
|
|
2407
2786
|
return null;
|
|
2408
2787
|
}
|
|
2409
2788
|
if (loading) {
|
|
2410
|
-
return /* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2789
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", padding: 1, children: [
|
|
2790
|
+
/* @__PURE__ */ jsx14(Header, { compact: true, showTagline: false }),
|
|
2791
|
+
/* @__PURE__ */ jsx14(Text14, { color: theme.muted, children: "Loading history..." })
|
|
2413
2792
|
] });
|
|
2414
2793
|
}
|
|
2415
2794
|
const rows = transformToRows(entries);
|
|
@@ -2440,25 +2819,25 @@ function HistoryCommand({
|
|
|
2440
2819
|
cellColor: (_, row) => row.statusColor
|
|
2441
2820
|
}
|
|
2442
2821
|
];
|
|
2443
|
-
return /* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
/* @__PURE__ */
|
|
2822
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", padding: 1, children: [
|
|
2823
|
+
/* @__PURE__ */ jsx14(Header, { compact: true, showTagline: false }),
|
|
2824
|
+
/* @__PURE__ */ jsx14(Box14, { marginBottom: 1, children: /* @__PURE__ */ jsxs14(Text14, { color: theme.secondary, children: [
|
|
2446
2825
|
symbols.arrow,
|
|
2447
2826
|
" Bridge History",
|
|
2448
|
-
address && /* @__PURE__ */
|
|
2827
|
+
address && /* @__PURE__ */ jsxs14(Text14, { color: theme.muted, children: [
|
|
2449
2828
|
" (",
|
|
2450
2829
|
truncateHash2(address),
|
|
2451
2830
|
")"
|
|
2452
2831
|
] }),
|
|
2453
|
-
entries.length > 0 && /* @__PURE__ */
|
|
2832
|
+
entries.length > 0 && /* @__PURE__ */ jsxs14(Text14, { color: theme.muted, children: [
|
|
2454
2833
|
" - ",
|
|
2455
2834
|
entries.length,
|
|
2456
2835
|
" transaction",
|
|
2457
2836
|
entries.length !== 1 ? "s" : ""
|
|
2458
2837
|
] })
|
|
2459
2838
|
] }) }),
|
|
2460
|
-
entries.length === 0 ? /* @__PURE__ */
|
|
2461
|
-
/* @__PURE__ */
|
|
2839
|
+
entries.length === 0 ? /* @__PURE__ */ jsx14(EmptyState, { address }) : /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
2840
|
+
/* @__PURE__ */ jsx14(
|
|
2462
2841
|
Table,
|
|
2463
2842
|
{
|
|
2464
2843
|
data: rows,
|
|
@@ -2467,8 +2846,8 @@ function HistoryCommand({
|
|
|
2467
2846
|
borderColor: theme.border
|
|
2468
2847
|
}
|
|
2469
2848
|
),
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
/* @__PURE__ */
|
|
2849
|
+
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
2850
|
+
/* @__PURE__ */ jsxs14(Text14, { color: theme.muted, dimColor: true, children: [
|
|
2472
2851
|
"Use ",
|
|
2473
2852
|
'"',
|
|
2474
2853
|
"mina status ",
|
|
@@ -2477,7 +2856,7 @@ function HistoryCommand({
|
|
|
2477
2856
|
'>"',
|
|
2478
2857
|
" for full transaction details"
|
|
2479
2858
|
] }),
|
|
2480
|
-
entries.length >= limit && /* @__PURE__ */
|
|
2859
|
+
entries.length >= limit && /* @__PURE__ */ jsxs14(Text14, { color: theme.muted, dimColor: true, children: [
|
|
2481
2860
|
"Showing last ",
|
|
2482
2861
|
limit,
|
|
2483
2862
|
" entries. Use --limit to see more."
|
|
@@ -2488,13 +2867,13 @@ function HistoryCommand({
|
|
|
2488
2867
|
}
|
|
2489
2868
|
|
|
2490
2869
|
// src/commands/balance.tsx
|
|
2491
|
-
import
|
|
2492
|
-
import { Box as
|
|
2870
|
+
import React10, { useState as useState9, useEffect as useEffect8 } from "react";
|
|
2871
|
+
import { Box as Box15, Text as Text15, useApp as useApp8 } from "ink";
|
|
2493
2872
|
import {
|
|
2494
|
-
Mina as
|
|
2873
|
+
Mina as Mina5,
|
|
2495
2874
|
getChains as getChains6
|
|
2496
2875
|
} from "@siphoyawe/mina-sdk";
|
|
2497
|
-
import { Fragment as
|
|
2876
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2498
2877
|
function truncateAddress2(address) {
|
|
2499
2878
|
if (address.length <= 14) return address;
|
|
2500
2879
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
@@ -2555,16 +2934,16 @@ function BalanceCommand({
|
|
|
2555
2934
|
json = false
|
|
2556
2935
|
}) {
|
|
2557
2936
|
const { exit } = useApp8();
|
|
2558
|
-
const [chainBalances, setChainBalances] =
|
|
2559
|
-
const [loading, setLoading] =
|
|
2560
|
-
const [error, setError] =
|
|
2561
|
-
const [totalUsd, setTotalUsd] =
|
|
2937
|
+
const [chainBalances, setChainBalances] = useState9([]);
|
|
2938
|
+
const [loading, setLoading] = useState9(true);
|
|
2939
|
+
const [error, setError] = useState9(null);
|
|
2940
|
+
const [totalUsd, setTotalUsd] = useState9(0);
|
|
2562
2941
|
useEffect8(() => {
|
|
2563
2942
|
async function loadBalances() {
|
|
2564
2943
|
try {
|
|
2565
2944
|
setLoading(true);
|
|
2566
2945
|
setError(null);
|
|
2567
|
-
const mina = new
|
|
2946
|
+
const mina = new Mina5({ integrator: "mina-cli" });
|
|
2568
2947
|
let chainIds = [];
|
|
2569
2948
|
let chainNameMap = {};
|
|
2570
2949
|
if (chain) {
|
|
@@ -2661,15 +3040,15 @@ function BalanceCommand({
|
|
|
2661
3040
|
return null;
|
|
2662
3041
|
}
|
|
2663
3042
|
if (loading) {
|
|
2664
|
-
return /* @__PURE__ */
|
|
2665
|
-
/* @__PURE__ */
|
|
2666
|
-
/* @__PURE__ */
|
|
3043
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
3044
|
+
/* @__PURE__ */ jsx15(Header, { compact: true, showTagline: false }),
|
|
3045
|
+
/* @__PURE__ */ jsx15(Spinner, { text: chain ? `Loading balances on ${chain}...` : "Loading balances across chains..." })
|
|
2667
3046
|
] });
|
|
2668
3047
|
}
|
|
2669
3048
|
if (error) {
|
|
2670
|
-
return /* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
3050
|
+
/* @__PURE__ */ jsx15(Header, { compact: true, showTagline: false }),
|
|
3051
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text15, { color: theme.error, children: [
|
|
2673
3052
|
symbols.failed,
|
|
2674
3053
|
" Error: ",
|
|
2675
3054
|
error
|
|
@@ -2686,105 +3065,105 @@ function BalanceCommand({
|
|
|
2686
3065
|
);
|
|
2687
3066
|
const boxWidth = Math.max(40, maxSymbolWidth + maxBalanceWidth + 20);
|
|
2688
3067
|
const hasAnyBalances = chainBalances.some((cb) => cb.balances.length > 0);
|
|
2689
|
-
return /* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
3069
|
+
/* @__PURE__ */ jsx15(Header, { compact: true, showTagline: false }),
|
|
3070
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text15, { color: theme.border, children: [
|
|
2692
3071
|
borders.topLeft,
|
|
2693
3072
|
borders.horizontal.repeat(boxWidth - 2),
|
|
2694
3073
|
borders.topRight
|
|
2695
3074
|
] }) }),
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3076
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3077
|
+
/* @__PURE__ */ jsx15(Box15, { width: boxWidth - 2, justifyContent: "center", children: /* @__PURE__ */ jsxs15(Text15, { color: theme.primary, bold: true, children: [
|
|
2699
3078
|
"Balances: ",
|
|
2700
3079
|
truncateAddress2(address)
|
|
2701
3080
|
] }) }),
|
|
2702
|
-
/* @__PURE__ */
|
|
3081
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
2703
3082
|
] }),
|
|
2704
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text15, { color: theme.border, children: [
|
|
2705
3084
|
borders.leftT,
|
|
2706
3085
|
borders.horizontal.repeat(boxWidth - 2),
|
|
2707
3086
|
borders.rightT
|
|
2708
3087
|
] }) }),
|
|
2709
|
-
!hasAnyBalances ? /* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
] }) }) : chainBalances.map((chainData, chainIndex) => /* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
3088
|
+
!hasAnyBalances ? /* @__PURE__ */ jsx15(Fragment3, { children: /* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3089
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3090
|
+
/* @__PURE__ */ jsx15(Box15, { width: boxWidth - 2, justifyContent: "center", children: /* @__PURE__ */ jsx15(Text15, { color: theme.muted, children: "No balances found" }) }),
|
|
3091
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
3092
|
+
] }) }) : chainBalances.map((chainData, chainIndex) => /* @__PURE__ */ jsxs15(React10.Fragment, { children: [
|
|
3093
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3094
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3095
|
+
/* @__PURE__ */ jsx15(Text15, { children: " " }),
|
|
3096
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.accent, bold: true, children: chainData.chainName }),
|
|
3097
|
+
/* @__PURE__ */ jsx15(Box15, { flexGrow: 1 }),
|
|
3098
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
2720
3099
|
] }),
|
|
2721
|
-
chainData.balances.length === 0 ? /* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
2724
|
-
/* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
] }) : chainData.balances.map((balance, i) => /* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
|
|
3100
|
+
chainData.balances.length === 0 ? /* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3101
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3102
|
+
/* @__PURE__ */ jsx15(Text15, { children: " " }),
|
|
3103
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.muted, dimColor: true, children: "No balances" }),
|
|
3104
|
+
/* @__PURE__ */ jsx15(Box15, { flexGrow: 1 }),
|
|
3105
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
3106
|
+
] }) : chainData.balances.map((balance, i) => /* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3107
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3108
|
+
/* @__PURE__ */ jsx15(Text15, { children: " " }),
|
|
3109
|
+
/* @__PURE__ */ jsx15(
|
|
3110
|
+
Text15,
|
|
2732
3111
|
{
|
|
2733
3112
|
color: balance.hasBalance ? theme.success : theme.muted,
|
|
2734
3113
|
dimColor: !balance.hasBalance,
|
|
2735
3114
|
children: balance.symbol.padEnd(maxSymbolWidth)
|
|
2736
3115
|
}
|
|
2737
3116
|
),
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2740
|
-
|
|
3117
|
+
/* @__PURE__ */ jsx15(Text15, { children: " " }),
|
|
3118
|
+
/* @__PURE__ */ jsx15(
|
|
3119
|
+
Text15,
|
|
2741
3120
|
{
|
|
2742
3121
|
color: balance.hasBalance ? theme.secondary : theme.muted,
|
|
2743
3122
|
dimColor: !balance.hasBalance,
|
|
2744
3123
|
children: balance.balanceFormatted.padStart(maxBalanceWidth)
|
|
2745
3124
|
}
|
|
2746
3125
|
),
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
|
|
3126
|
+
/* @__PURE__ */ jsx15(Text15, { children: " " }),
|
|
3127
|
+
/* @__PURE__ */ jsx15(
|
|
3128
|
+
Text15,
|
|
2750
3129
|
{
|
|
2751
3130
|
color: balance.hasBalance ? theme.muted : theme.muted,
|
|
2752
3131
|
dimColor: !balance.hasBalance,
|
|
2753
3132
|
children: formatUsd2(balance.usdValue).padStart(12)
|
|
2754
3133
|
}
|
|
2755
3134
|
),
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
3135
|
+
/* @__PURE__ */ jsx15(Box15, { flexGrow: 1 }),
|
|
3136
|
+
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
2758
3137
|
] }, `${chainData.chainId}-${balance.symbol}-${i}`)),
|
|
2759
|
-
chainIndex < chainBalances.length - 1 && /* @__PURE__ */
|
|
3138
|
+
chainIndex < chainBalances.length - 1 && /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text15, { color: theme.border, children: [
|
|
2760
3139
|
borders.leftT,
|
|
2761
3140
|
borders.horizontal.repeat(boxWidth - 2),
|
|
2762
3141
|
borders.rightT
|
|
2763
3142
|
] }) })
|
|
2764
3143
|
] }, chainData.chainId)),
|
|
2765
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text15, { color: theme.border, children: [
|
|
2766
3145
|
borders.bottomLeft,
|
|
2767
3146
|
borders.horizontal.repeat(boxWidth - 2),
|
|
2768
3147
|
borders.bottomRight
|
|
2769
3148
|
] }) }),
|
|
2770
|
-
hasAnyBalances && totalUsd > 0 && /* @__PURE__ */
|
|
2771
|
-
/* @__PURE__ */
|
|
3149
|
+
hasAnyBalances && totalUsd > 0 && /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, children: [
|
|
3150
|
+
/* @__PURE__ */ jsxs15(Text15, { color: theme.secondary, children: [
|
|
2772
3151
|
symbols.arrow,
|
|
2773
3152
|
" Total:"
|
|
2774
3153
|
] }),
|
|
2775
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsxs15(Text15, { color: theme.success, bold: true, children: [
|
|
2776
3155
|
" ",
|
|
2777
3156
|
"$",
|
|
2778
3157
|
formatNumber(totalUsd, 2)
|
|
2779
3158
|
] })
|
|
2780
3159
|
] }),
|
|
2781
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsx15(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text15, { color: theme.muted, dimColor: true, children: chain ? "Use --all to show zero balances" : "Use --chain <name> for specific chain, --all for zero balances" }) })
|
|
2782
3161
|
] });
|
|
2783
3162
|
}
|
|
2784
3163
|
|
|
2785
3164
|
// src/commands/config.tsx
|
|
2786
|
-
import { useState as
|
|
2787
|
-
import { Box as
|
|
3165
|
+
import { useState as useState10, useEffect as useEffect9 } from "react";
|
|
3166
|
+
import { Box as Box16, Text as Text16, useApp as useApp9 } from "ink";
|
|
2788
3167
|
|
|
2789
3168
|
// src/lib/config.ts
|
|
2790
3169
|
import os2 from "os";
|
|
@@ -2905,10 +3284,10 @@ function getConfigPath() {
|
|
|
2905
3284
|
}
|
|
2906
3285
|
|
|
2907
3286
|
// src/commands/config.tsx
|
|
2908
|
-
import { jsx as
|
|
3287
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2909
3288
|
function ConfigList() {
|
|
2910
3289
|
const { exit } = useApp9();
|
|
2911
|
-
const [items, setItems] =
|
|
3290
|
+
const [items, setItems] = useState10([]);
|
|
2912
3291
|
useEffect9(() => {
|
|
2913
3292
|
const configItems = getConfigList();
|
|
2914
3293
|
setItems(
|
|
@@ -2934,20 +3313,20 @@ function ConfigList() {
|
|
|
2934
3313
|
cellColor: (value, row) => row.isDefault ? theme.muted : theme.success
|
|
2935
3314
|
}
|
|
2936
3315
|
];
|
|
2937
|
-
return /* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
2939
|
-
/* @__PURE__ */
|
|
3316
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3317
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3318
|
+
/* @__PURE__ */ jsx16(Box16, { marginBottom: 1, children: /* @__PURE__ */ jsxs16(Text16, { color: theme.secondary, children: [
|
|
2940
3319
|
symbols.arrow,
|
|
2941
3320
|
" Configuration Settings"
|
|
2942
3321
|
] }) }),
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
3322
|
+
/* @__PURE__ */ jsx16(Table, { data: items, columns, bordered: true, borderColor: theme.border }),
|
|
3323
|
+
/* @__PURE__ */ jsx16(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: theme.muted, dimColor: true, children: "Values in gray are defaults. Use 'mina config set <key> <value>' to customize." }) })
|
|
2945
3324
|
] });
|
|
2946
3325
|
}
|
|
2947
3326
|
function ConfigGet({ configKey }) {
|
|
2948
3327
|
const { exit } = useApp9();
|
|
2949
|
-
const [value, setValue] =
|
|
2950
|
-
const [error, setError] =
|
|
3328
|
+
const [value, setValue] = useState10(null);
|
|
3329
|
+
const [error, setError] = useState10(null);
|
|
2951
3330
|
useEffect9(() => {
|
|
2952
3331
|
if (!isValidKey(configKey)) {
|
|
2953
3332
|
setError(`Unknown config key: ${configKey}`);
|
|
@@ -2958,29 +3337,29 @@ function ConfigGet({ configKey }) {
|
|
|
2958
3337
|
setTimeout(() => exit(), 100);
|
|
2959
3338
|
}, [configKey, exit]);
|
|
2960
3339
|
if (error) {
|
|
2961
|
-
return /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
/* @__PURE__ */
|
|
3340
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3341
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3342
|
+
/* @__PURE__ */ jsx16(Box16, { children: /* @__PURE__ */ jsxs16(Text16, { color: theme.error, children: [
|
|
2964
3343
|
symbols.failed,
|
|
2965
3344
|
" ",
|
|
2966
3345
|
error
|
|
2967
3346
|
] }) })
|
|
2968
3347
|
] });
|
|
2969
3348
|
}
|
|
2970
|
-
return /* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2972
|
-
/* @__PURE__ */
|
|
2973
|
-
/* @__PURE__ */
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
3349
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3350
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3351
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3352
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: configKey }),
|
|
3353
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " = " }),
|
|
3354
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, children: value })
|
|
2976
3355
|
] })
|
|
2977
3356
|
] });
|
|
2978
3357
|
}
|
|
2979
3358
|
function ConfigSet({ configKey, configValue }) {
|
|
2980
3359
|
const { exit } = useApp9();
|
|
2981
|
-
const [success, setSuccess] =
|
|
2982
|
-
const [error, setError] =
|
|
2983
|
-
const [parsedValue, setParsedValue] =
|
|
3360
|
+
const [success, setSuccess] = useState10(false);
|
|
3361
|
+
const [error, setError] = useState10(null);
|
|
3362
|
+
const [parsedValue, setParsedValue] = useState10(null);
|
|
2984
3363
|
useEffect9(() => {
|
|
2985
3364
|
if (!isValidKey(configKey)) {
|
|
2986
3365
|
setError(`Unknown config key: ${configKey}`);
|
|
@@ -2997,9 +3376,9 @@ function ConfigSet({ configKey, configValue }) {
|
|
|
2997
3376
|
setTimeout(() => exit(), 100);
|
|
2998
3377
|
}, [configKey, configValue, exit]);
|
|
2999
3378
|
if (error) {
|
|
3000
|
-
return /* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3379
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3380
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3381
|
+
/* @__PURE__ */ jsx16(Box16, { children: /* @__PURE__ */ jsxs16(Text16, { color: theme.error, children: [
|
|
3003
3382
|
symbols.failed,
|
|
3004
3383
|
" ",
|
|
3005
3384
|
error
|
|
@@ -3007,17 +3386,17 @@ function ConfigSet({ configKey, configValue }) {
|
|
|
3007
3386
|
] });
|
|
3008
3387
|
}
|
|
3009
3388
|
if (success) {
|
|
3010
|
-
return /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
/* @__PURE__ */
|
|
3013
|
-
/* @__PURE__ */
|
|
3389
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3390
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3391
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3392
|
+
/* @__PURE__ */ jsxs16(Text16, { color: theme.success, children: [
|
|
3014
3393
|
symbols.completed,
|
|
3015
3394
|
" "
|
|
3016
3395
|
] }),
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3396
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "Set " }),
|
|
3397
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, children: configKey }),
|
|
3398
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " = " }),
|
|
3399
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.success, children: String(parsedValue) })
|
|
3021
3400
|
] })
|
|
3022
3401
|
] });
|
|
3023
3402
|
}
|
|
@@ -3028,11 +3407,11 @@ function ConfigPath() {
|
|
|
3028
3407
|
useEffect9(() => {
|
|
3029
3408
|
setTimeout(() => exit(), 100);
|
|
3030
3409
|
}, [exit]);
|
|
3031
|
-
return /* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3410
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3411
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3412
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3413
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: "Config file: " }),
|
|
3414
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: getConfigPath() })
|
|
3036
3415
|
] })
|
|
3037
3416
|
] });
|
|
3038
3417
|
}
|
|
@@ -3041,78 +3420,78 @@ function ConfigHelp() {
|
|
|
3041
3420
|
useEffect9(() => {
|
|
3042
3421
|
setTimeout(() => exit(), 100);
|
|
3043
3422
|
}, [exit]);
|
|
3044
|
-
return /* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
/* @__PURE__ */
|
|
3054
|
-
/* @__PURE__ */
|
|
3055
|
-
/* @__PURE__ */
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
/* @__PURE__ */
|
|
3423
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
3424
|
+
/* @__PURE__ */ jsx16(Header, { compact: true, showTagline: false }),
|
|
3425
|
+
/* @__PURE__ */ jsx16(Box, { bordered: true, title: "Config Usage", padding: 1, children: /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
|
|
3426
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config list" }),
|
|
3427
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " Show all settings" }),
|
|
3428
|
+
/* @__PURE__ */ jsx16(Text16, { children: " " }),
|
|
3429
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config get <key>" }),
|
|
3430
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " Show single value" }),
|
|
3431
|
+
/* @__PURE__ */ jsx16(Text16, { children: " " }),
|
|
3432
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config set <key> <value>" }),
|
|
3433
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " Set a value" }),
|
|
3434
|
+
/* @__PURE__ */ jsx16(Text16, { children: " " }),
|
|
3435
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config path" }),
|
|
3436
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " Show config file location" })
|
|
3058
3437
|
] }) }),
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3438
|
+
/* @__PURE__ */ jsx16(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx16(Box, { bordered: true, title: "Available Settings", padding: 1, children: /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
|
|
3439
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3440
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, bold: true, children: "slippage" }),
|
|
3441
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " - Default slippage tolerance (e.g., 0.5)" })
|
|
3063
3442
|
] }),
|
|
3064
|
-
/* @__PURE__ */
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3443
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3444
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, bold: true, children: "autoDeposit" }),
|
|
3445
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " - Auto-deposit to Hyperliquid (true/false)" })
|
|
3067
3446
|
] }),
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3448
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, bold: true, children: "defaultChain" }),
|
|
3449
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " - Default source chain (e.g., arbitrum)" })
|
|
3071
3450
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3073
|
-
/* @__PURE__ */
|
|
3074
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsxs16(Box16, { children: [
|
|
3452
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.primary, bold: true, children: "rpc.<chain>" }),
|
|
3453
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.muted, children: " - Custom RPC URL for a chain" })
|
|
3075
3454
|
] })
|
|
3076
3455
|
] }) }) }),
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
/* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3456
|
+
/* @__PURE__ */ jsx16(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx16(Box, { bordered: true, title: "Examples", padding: 1, children: /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
|
|
3457
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config set slippage 0.5" }),
|
|
3458
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config set autoDeposit false" }),
|
|
3459
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config set rpc.arbitrum https://arb1.example.com" }),
|
|
3460
|
+
/* @__PURE__ */ jsx16(Text16, { color: theme.secondary, children: "mina config get slippage" })
|
|
3082
3461
|
] }) }) })
|
|
3083
3462
|
] });
|
|
3084
3463
|
}
|
|
3085
3464
|
function ConfigCommand({ action, key: configKey, value }) {
|
|
3086
3465
|
switch (action) {
|
|
3087
3466
|
case "list":
|
|
3088
|
-
return /* @__PURE__ */
|
|
3467
|
+
return /* @__PURE__ */ jsx16(ConfigList, {});
|
|
3089
3468
|
case "get":
|
|
3090
3469
|
if (!configKey) {
|
|
3091
|
-
return /* @__PURE__ */
|
|
3470
|
+
return /* @__PURE__ */ jsx16(ConfigHelp, {});
|
|
3092
3471
|
}
|
|
3093
|
-
return /* @__PURE__ */
|
|
3472
|
+
return /* @__PURE__ */ jsx16(ConfigGet, { configKey });
|
|
3094
3473
|
case "set":
|
|
3095
3474
|
if (!configKey || value === void 0) {
|
|
3096
|
-
return /* @__PURE__ */
|
|
3475
|
+
return /* @__PURE__ */ jsx16(ConfigHelp, {});
|
|
3097
3476
|
}
|
|
3098
|
-
return /* @__PURE__ */
|
|
3477
|
+
return /* @__PURE__ */ jsx16(ConfigSet, { configKey, configValue: value });
|
|
3099
3478
|
case "path":
|
|
3100
|
-
return /* @__PURE__ */
|
|
3479
|
+
return /* @__PURE__ */ jsx16(ConfigPath, {});
|
|
3101
3480
|
default:
|
|
3102
|
-
return /* @__PURE__ */
|
|
3481
|
+
return /* @__PURE__ */ jsx16(ConfigHelp, {});
|
|
3103
3482
|
}
|
|
3104
3483
|
}
|
|
3105
3484
|
|
|
3106
3485
|
// src/index.tsx
|
|
3107
|
-
var VERSION = "1.
|
|
3486
|
+
var VERSION = "1.2.0";
|
|
3108
3487
|
var program = new Command();
|
|
3109
3488
|
program.name("mina").description("Mina Bridge CLI - Bridge assets from any chain to Hyperliquid").version(VERSION, "-v, --version", "Display the current version").helpOption("-h, --help", "Display help information");
|
|
3110
3489
|
program.command("wizard").description("Launch the interactive bridge wizard").action(() => {
|
|
3111
|
-
render(
|
|
3490
|
+
render(React12.createElement(Wizard));
|
|
3112
3491
|
});
|
|
3113
3492
|
program.command("quote").description("Get a bridge quote").requiredOption("--from <chain>", "Source chain (e.g., ethereum, arbitrum, polygon)").option("--to <chain>", "Destination chain", "hyperliquid").requiredOption("--token <symbol>", "Token to bridge (e.g., USDC, ETH)").requiredOption("--amount <number>", "Amount to bridge").option("--json", "Output as JSON for machine-readable format").action((options) => {
|
|
3114
3493
|
render(
|
|
3115
|
-
|
|
3494
|
+
React12.createElement(QuoteDisplay, {
|
|
3116
3495
|
fromChain: options.from,
|
|
3117
3496
|
toChain: options.to,
|
|
3118
3497
|
token: options.token,
|
|
@@ -3123,7 +3502,7 @@ program.command("quote").description("Get a bridge quote").requiredOption("--fro
|
|
|
3123
3502
|
});
|
|
3124
3503
|
program.command("status <txHash>").description("Check bridge status").option("--watch", "Poll for updates").action((txHash, options) => {
|
|
3125
3504
|
render(
|
|
3126
|
-
|
|
3505
|
+
React12.createElement(Status, {
|
|
3127
3506
|
txHash,
|
|
3128
3507
|
watch: options.watch || false
|
|
3129
3508
|
})
|
|
@@ -3131,14 +3510,14 @@ program.command("status <txHash>").description("Check bridge status").option("--
|
|
|
3131
3510
|
});
|
|
3132
3511
|
program.command("chains").description("List supported chains").option("--json", "Output as JSON").action((options) => {
|
|
3133
3512
|
render(
|
|
3134
|
-
|
|
3513
|
+
React12.createElement(ChainsCommand, {
|
|
3135
3514
|
json: options.json || false
|
|
3136
3515
|
})
|
|
3137
3516
|
);
|
|
3138
3517
|
});
|
|
3139
3518
|
program.command("tokens").description("List bridgeable tokens").option("--chain <chain>", "Filter by chain (name or ID)").option("--json", "Output as JSON").action((options) => {
|
|
3140
3519
|
render(
|
|
3141
|
-
|
|
3520
|
+
React12.createElement(TokensCommand, {
|
|
3142
3521
|
chain: options.chain,
|
|
3143
3522
|
json: options.json || false
|
|
3144
3523
|
})
|
|
@@ -3149,7 +3528,7 @@ program.command("bridge").description("Execute a bridge transaction").requiredOp
|
|
|
3149
3528
|
});
|
|
3150
3529
|
program.command("history").description("View bridge transaction history").option("--limit <number>", "Number of entries to show", "10").option("--address <address>", "Filter by wallet address").option("--json", "Output as JSON").action((options) => {
|
|
3151
3530
|
render(
|
|
3152
|
-
|
|
3531
|
+
React12.createElement(HistoryCommand, {
|
|
3153
3532
|
limit: parseInt(options.limit, 10) || 10,
|
|
3154
3533
|
address: options.address,
|
|
3155
3534
|
json: options.json || false
|
|
@@ -3158,7 +3537,7 @@ program.command("history").description("View bridge transaction history").option
|
|
|
3158
3537
|
});
|
|
3159
3538
|
program.command("balance").description("Check wallet balances").requiredOption("--address <address>", "Wallet address").option("--chain <chain>", "Specific chain (name or ID)").option("--all", "Show all tokens including zero balance").option("--json", "Output as JSON").action((options) => {
|
|
3160
3539
|
render(
|
|
3161
|
-
|
|
3540
|
+
React12.createElement(BalanceCommand, {
|
|
3162
3541
|
address: options.address,
|
|
3163
3542
|
chain: options.chain,
|
|
3164
3543
|
showAll: options.all || false,
|
|
@@ -3168,7 +3547,7 @@ program.command("balance").description("Check wallet balances").requiredOption("
|
|
|
3168
3547
|
});
|
|
3169
3548
|
program.command("config [action] [key] [value]").description("Manage CLI configuration").action((action, key, value) => {
|
|
3170
3549
|
render(
|
|
3171
|
-
|
|
3550
|
+
React12.createElement(ConfigCommand, {
|
|
3172
3551
|
action,
|
|
3173
3552
|
key,
|
|
3174
3553
|
value
|
|
@@ -3222,7 +3601,7 @@ var args = process.argv.slice(2);
|
|
|
3222
3601
|
var hasCommand = args.length > 0 && !args[0]?.startsWith("-");
|
|
3223
3602
|
var isHelpOrVersion = args.some((arg) => ["-h", "--help", "-v", "--version"].includes(arg));
|
|
3224
3603
|
if (!hasCommand && !isHelpOrVersion) {
|
|
3225
|
-
render(
|
|
3604
|
+
render(React12.createElement(Wizard));
|
|
3226
3605
|
} else {
|
|
3227
3606
|
program.parse(process.argv);
|
|
3228
3607
|
}
|