@siphoyawe/mina-cli 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +94 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import React12 from "react";
|
|
|
7
7
|
import { render } from "ink";
|
|
8
8
|
|
|
9
9
|
// src/commands/wizard.tsx
|
|
10
|
-
import { useState as useState2, useEffect, useCallback } from "react";
|
|
10
|
+
import { useState as useState2, useEffect as useEffect2, useCallback } from "react";
|
|
11
11
|
import { Box as Box8, Text as Text8, useApp, useInput as useInput2 } from "ink";
|
|
12
12
|
import {
|
|
13
13
|
Mina,
|
|
@@ -215,28 +215,32 @@ function Select({
|
|
|
215
215
|
function ChainSelect({
|
|
216
216
|
chains,
|
|
217
217
|
onSelect,
|
|
218
|
-
label = "Select Chain:"
|
|
218
|
+
label = "Select Chain:",
|
|
219
|
+
limit = 8
|
|
219
220
|
}) {
|
|
220
221
|
return /* @__PURE__ */ jsx3(
|
|
221
222
|
Select,
|
|
222
223
|
{
|
|
223
224
|
items: chains,
|
|
224
225
|
onSelect: (item) => onSelect(item),
|
|
225
|
-
label
|
|
226
|
+
label,
|
|
227
|
+
limit
|
|
226
228
|
}
|
|
227
229
|
);
|
|
228
230
|
}
|
|
229
231
|
function TokenSelect({
|
|
230
232
|
tokens,
|
|
231
233
|
onSelect,
|
|
232
|
-
label = "Select Token:"
|
|
234
|
+
label = "Select Token:",
|
|
235
|
+
limit = 10
|
|
233
236
|
}) {
|
|
234
237
|
return /* @__PURE__ */ jsx3(
|
|
235
238
|
Select,
|
|
236
239
|
{
|
|
237
240
|
items: tokens,
|
|
238
241
|
onSelect: (item) => onSelect(item),
|
|
239
|
-
label
|
|
242
|
+
label,
|
|
243
|
+
limit
|
|
240
244
|
}
|
|
241
245
|
);
|
|
242
246
|
}
|
|
@@ -490,9 +494,9 @@ function KeyValue({
|
|
|
490
494
|
}
|
|
491
495
|
|
|
492
496
|
// src/ui/SearchableList.tsx
|
|
493
|
-
import { useState, useMemo } from "react";
|
|
497
|
+
import { useState, useMemo, useEffect } from "react";
|
|
494
498
|
import { Box as Box7, Text as Text7, useInput, useStdin } from "ink";
|
|
495
|
-
import {
|
|
499
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
496
500
|
function fuzzyMatch(query, text) {
|
|
497
501
|
const lowerQuery = query.toLowerCase();
|
|
498
502
|
const lowerText = text.toLowerCase();
|
|
@@ -517,33 +521,32 @@ function sortItems(items, popularIds) {
|
|
|
517
521
|
}
|
|
518
522
|
function KeyboardHandler({
|
|
519
523
|
searchable,
|
|
520
|
-
|
|
524
|
+
totalItemsLength,
|
|
521
525
|
selectedIndex,
|
|
522
526
|
setSelectedIndex,
|
|
523
527
|
setQuery,
|
|
524
|
-
|
|
525
|
-
hasMore,
|
|
528
|
+
setViewportStart,
|
|
526
529
|
onSelect,
|
|
527
|
-
|
|
530
|
+
filteredItems
|
|
528
531
|
}) {
|
|
529
532
|
useInput((input, key) => {
|
|
530
533
|
if (searchable) {
|
|
531
534
|
if (key.backspace || key.delete) {
|
|
532
535
|
setQuery((q) => q.slice(0, -1));
|
|
533
536
|
setSelectedIndex(0);
|
|
537
|
+
setViewportStart(0);
|
|
534
538
|
} else if (input && !key.ctrl && !key.meta && input.length === 1 && input.match(/[a-zA-Z0-9 -]/)) {
|
|
535
539
|
setQuery((q) => q + input);
|
|
536
540
|
setSelectedIndex(0);
|
|
541
|
+
setViewportStart(0);
|
|
537
542
|
}
|
|
538
543
|
}
|
|
539
544
|
if (key.upArrow) {
|
|
540
545
|
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
541
546
|
} else if (key.downArrow) {
|
|
542
|
-
setSelectedIndex((i) => Math.min(
|
|
543
|
-
} else if (key.return && onSelect &&
|
|
544
|
-
onSelect(
|
|
545
|
-
} else if (input === "m" && hasMore) {
|
|
546
|
-
setShowAll(true);
|
|
547
|
+
setSelectedIndex((i) => Math.min(totalItemsLength - 1, i + 1));
|
|
548
|
+
} else if (key.return && onSelect && filteredItems[selectedIndex]) {
|
|
549
|
+
onSelect(filteredItems[selectedIndex]);
|
|
547
550
|
}
|
|
548
551
|
});
|
|
549
552
|
return null;
|
|
@@ -556,13 +559,13 @@ function SearchableList({
|
|
|
556
559
|
popularIds = [],
|
|
557
560
|
onSelect,
|
|
558
561
|
searchable = true,
|
|
559
|
-
maxDisplay =
|
|
562
|
+
maxDisplay = 10
|
|
560
563
|
}) {
|
|
561
564
|
const { isRawModeSupported } = useStdin();
|
|
562
565
|
const isInteractive = isRawModeSupported;
|
|
563
566
|
const [query, setQuery] = useState("");
|
|
564
567
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
565
|
-
const [
|
|
568
|
+
const [viewportStart, setViewportStart] = useState(0);
|
|
566
569
|
const filteredItems = useMemo(() => {
|
|
567
570
|
let result = items;
|
|
568
571
|
if (query) {
|
|
@@ -572,23 +575,31 @@ function SearchableList({
|
|
|
572
575
|
}
|
|
573
576
|
return sortItems(result, popularIds);
|
|
574
577
|
}, [items, query, popularIds]);
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
578
|
+
const viewportSize = Math.min(maxDisplay, filteredItems.length);
|
|
579
|
+
useEffect(() => {
|
|
580
|
+
if (selectedIndex < viewportStart) {
|
|
581
|
+
setViewportStart(selectedIndex);
|
|
582
|
+
} else if (selectedIndex >= viewportStart + viewportSize) {
|
|
583
|
+
setViewportStart(Math.max(0, selectedIndex - viewportSize + 1));
|
|
584
|
+
}
|
|
585
|
+
}, [selectedIndex, viewportStart, viewportSize]);
|
|
586
|
+
const displayedItems = filteredItems.slice(viewportStart, viewportStart + viewportSize);
|
|
587
|
+
const hasMoreAbove = viewportStart > 0;
|
|
588
|
+
const hasMoreBelow = viewportStart + viewportSize < filteredItems.length;
|
|
589
|
+
const safeIndex = Math.min(selectedIndex, Math.max(0, filteredItems.length - 1));
|
|
590
|
+
const viewportSelectedIndex = safeIndex - viewportStart;
|
|
579
591
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
580
592
|
isInteractive && /* @__PURE__ */ jsx7(
|
|
581
593
|
KeyboardHandler,
|
|
582
594
|
{
|
|
583
595
|
searchable,
|
|
584
|
-
|
|
596
|
+
totalItemsLength: filteredItems.length,
|
|
585
597
|
selectedIndex,
|
|
586
598
|
setSelectedIndex,
|
|
587
599
|
setQuery,
|
|
588
|
-
|
|
589
|
-
hasMore,
|
|
600
|
+
setViewportStart,
|
|
590
601
|
onSelect,
|
|
591
|
-
|
|
602
|
+
filteredItems
|
|
592
603
|
}
|
|
593
604
|
),
|
|
594
605
|
title && /* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
|
|
@@ -613,9 +624,17 @@ function SearchableList({
|
|
|
613
624
|
query ? /* @__PURE__ */ jsx7(Text7, { color: theme.primary, children: query }) : /* @__PURE__ */ jsx7(Text7, { color: theme.muted, dimColor: true, children: placeholder }),
|
|
614
625
|
/* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: "\u258C" })
|
|
615
626
|
] }),
|
|
627
|
+
hasMoreAbove && isInteractive && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
628
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: " \u25B2" }),
|
|
629
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
630
|
+
" ",
|
|
631
|
+
viewportStart,
|
|
632
|
+
" more above"
|
|
633
|
+
] })
|
|
634
|
+
] }),
|
|
616
635
|
/* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
617
636
|
displayedItems.map((item, index) => {
|
|
618
|
-
const isSelected = isInteractive && index ===
|
|
637
|
+
const isSelected = isInteractive && index === viewportSelectedIndex;
|
|
619
638
|
const isPopular = popularIds.includes(item.id);
|
|
620
639
|
return /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
621
640
|
isInteractive && /* @__PURE__ */ jsx7(Text7, { color: isSelected ? theme.accent : theme.border, children: isSelected ? symbols.arrow : " " }),
|
|
@@ -647,24 +666,21 @@ function SearchableList({
|
|
|
647
666
|
'No matches for "',
|
|
648
667
|
query,
|
|
649
668
|
'"'
|
|
650
|
-
] }) })
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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
|
-
] })
|
|
669
|
+
] }) })
|
|
670
|
+
] }),
|
|
671
|
+
hasMoreBelow && isInteractive && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
672
|
+
/* @__PURE__ */ jsx7(Text7, { color: theme.accent, children: " \u25BC" }),
|
|
673
|
+
/* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
674
|
+
" ",
|
|
675
|
+
filteredItems.length - viewportStart - viewportSize,
|
|
676
|
+
" more below"
|
|
662
677
|
] })
|
|
663
678
|
] }),
|
|
664
679
|
isInteractive && /* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsxs7(Text7, { color: theme.muted, dimColor: true, children: [
|
|
665
|
-
"\u2191\u2193
|
|
680
|
+
"\u2191\u2193 scroll",
|
|
666
681
|
onSelect ? " \u2022 Enter select" : "",
|
|
667
|
-
searchable ? " \u2022 Type to filter" : ""
|
|
682
|
+
searchable ? " \u2022 Type to filter" : "",
|
|
683
|
+
filteredItems.length > viewportSize && ` \u2022 ${safeIndex + 1}/${filteredItems.length}`
|
|
668
684
|
] }) })
|
|
669
685
|
] });
|
|
670
686
|
}
|
|
@@ -842,7 +858,7 @@ function ChainSelectionStep({
|
|
|
842
858
|
const [chains, setChains] = useState2([]);
|
|
843
859
|
const [loading, setLoading] = useState2(true);
|
|
844
860
|
const [error, setError] = useState2(null);
|
|
845
|
-
|
|
861
|
+
useEffect2(() => {
|
|
846
862
|
async function loadChains() {
|
|
847
863
|
try {
|
|
848
864
|
setLoading(true);
|
|
@@ -906,7 +922,7 @@ function TokenSelectionStep({
|
|
|
906
922
|
const [tokens, setTokens] = useState2([]);
|
|
907
923
|
const [loading, setLoading] = useState2(true);
|
|
908
924
|
const [error, setError] = useState2(null);
|
|
909
|
-
|
|
925
|
+
useEffect2(() => {
|
|
910
926
|
async function loadTokens() {
|
|
911
927
|
try {
|
|
912
928
|
setLoading(true);
|
|
@@ -978,7 +994,7 @@ function AmountInputStep({
|
|
|
978
994
|
error
|
|
979
995
|
}) {
|
|
980
996
|
const [cursorVisible, setCursorVisible] = useState2(true);
|
|
981
|
-
|
|
997
|
+
useEffect2(() => {
|
|
982
998
|
const interval = setInterval(() => {
|
|
983
999
|
setCursorVisible((v) => !v);
|
|
984
1000
|
}, 530);
|
|
@@ -1039,7 +1055,7 @@ function KeyInputStep({
|
|
|
1039
1055
|
loading
|
|
1040
1056
|
}) {
|
|
1041
1057
|
const [cursorVisible, setCursorVisible] = useState2(true);
|
|
1042
|
-
|
|
1058
|
+
useEffect2(() => {
|
|
1043
1059
|
const interval = setInterval(() => {
|
|
1044
1060
|
setCursorVisible((v) => !v);
|
|
1045
1061
|
}, 530);
|
|
@@ -1169,7 +1185,7 @@ function ExecutionStep({
|
|
|
1169
1185
|
const [txHash, setTxHash] = useState2(null);
|
|
1170
1186
|
const [error, setError] = useState2(null);
|
|
1171
1187
|
const [isExecuting, setIsExecuting] = useState2(false);
|
|
1172
|
-
|
|
1188
|
+
useEffect2(() => {
|
|
1173
1189
|
if (isExecuting) return;
|
|
1174
1190
|
setIsExecuting(true);
|
|
1175
1191
|
const executeBridge = async () => {
|
|
@@ -1465,7 +1481,7 @@ function Wizard() {
|
|
|
1465
1481
|
}
|
|
1466
1482
|
|
|
1467
1483
|
// src/commands/quote.tsx
|
|
1468
|
-
import { useState as useState3, useEffect as
|
|
1484
|
+
import { useState as useState3, useEffect as useEffect3 } from "react";
|
|
1469
1485
|
import { Box as Box9, Text as Text9, useApp as useApp2 } from "ink";
|
|
1470
1486
|
import {
|
|
1471
1487
|
Mina as Mina2,
|
|
@@ -1640,7 +1656,7 @@ function QuoteDisplay({
|
|
|
1640
1656
|
const [sourceChain, setSourceChain] = useState3(null);
|
|
1641
1657
|
const [sourceToken, setSourceToken] = useState3(null);
|
|
1642
1658
|
const [destToken, setDestToken] = useState3(null);
|
|
1643
|
-
|
|
1659
|
+
useEffect3(() => {
|
|
1644
1660
|
async function fetchQuote() {
|
|
1645
1661
|
try {
|
|
1646
1662
|
setLoading(true);
|
|
@@ -1700,7 +1716,7 @@ function QuoteDisplay({
|
|
|
1700
1716
|
}
|
|
1701
1717
|
fetchQuote();
|
|
1702
1718
|
}, [fromChain, token, amount]);
|
|
1703
|
-
|
|
1719
|
+
useEffect3(() => {
|
|
1704
1720
|
if (!loading && jsonOutput) {
|
|
1705
1721
|
const timer = setTimeout(() => exit(), 100);
|
|
1706
1722
|
return () => clearTimeout(timer);
|
|
@@ -1737,7 +1753,7 @@ function QuoteDisplay({
|
|
|
1737
1753
|
}
|
|
1738
1754
|
|
|
1739
1755
|
// src/commands/chains.tsx
|
|
1740
|
-
import { useState as useState4, useEffect as
|
|
1756
|
+
import { useState as useState4, useEffect as useEffect4 } from "react";
|
|
1741
1757
|
import { Box as Box10, Text as Text10, useApp as useApp3 } from "ink";
|
|
1742
1758
|
import {
|
|
1743
1759
|
getChains as getChains3,
|
|
@@ -1767,7 +1783,7 @@ function ChainsCommand({ json = false }) {
|
|
|
1767
1783
|
const [chains, setChains] = useState4([]);
|
|
1768
1784
|
const [loading, setLoading] = useState4(true);
|
|
1769
1785
|
const [error, setError] = useState4(null);
|
|
1770
|
-
|
|
1786
|
+
useEffect4(() => {
|
|
1771
1787
|
async function loadChains() {
|
|
1772
1788
|
try {
|
|
1773
1789
|
setLoading(true);
|
|
@@ -1800,7 +1816,7 @@ function ChainsCommand({ json = false }) {
|
|
|
1800
1816
|
}
|
|
1801
1817
|
loadChains();
|
|
1802
1818
|
}, []);
|
|
1803
|
-
|
|
1819
|
+
useEffect4(() => {
|
|
1804
1820
|
if (!loading && json) {
|
|
1805
1821
|
setTimeout(() => exit(), 100);
|
|
1806
1822
|
}
|
|
@@ -1855,7 +1871,7 @@ function ChainsCommand({ json = false }) {
|
|
|
1855
1871
|
}
|
|
1856
1872
|
|
|
1857
1873
|
// src/commands/tokens.tsx
|
|
1858
|
-
import { useState as useState5, useEffect as
|
|
1874
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
1859
1875
|
import { Box as Box11, Text as Text11, useApp as useApp4 } from "ink";
|
|
1860
1876
|
import {
|
|
1861
1877
|
getChains as getChains4,
|
|
@@ -1909,7 +1925,7 @@ function TokensCommand({
|
|
|
1909
1925
|
const [error, setError] = useState5(null);
|
|
1910
1926
|
const [chainName, setChainName] = useState5("");
|
|
1911
1927
|
const [availableChains, setAvailableChains] = useState5([]);
|
|
1912
|
-
|
|
1928
|
+
useEffect5(() => {
|
|
1913
1929
|
async function loadTokens() {
|
|
1914
1930
|
try {
|
|
1915
1931
|
setLoading(true);
|
|
@@ -1947,7 +1963,7 @@ function TokensCommand({
|
|
|
1947
1963
|
}
|
|
1948
1964
|
loadTokens();
|
|
1949
1965
|
}, [chain]);
|
|
1950
|
-
|
|
1966
|
+
useEffect5(() => {
|
|
1951
1967
|
if (!loading && json) {
|
|
1952
1968
|
setTimeout(() => exit(), 100);
|
|
1953
1969
|
}
|
|
@@ -2044,7 +2060,7 @@ function TokensCommand({
|
|
|
2044
2060
|
}
|
|
2045
2061
|
|
|
2046
2062
|
// src/commands/status.tsx
|
|
2047
|
-
import { useState as useState6, useEffect as
|
|
2063
|
+
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
2048
2064
|
import { Box as Box12, Text as Text12, useApp as useApp5 } from "ink";
|
|
2049
2065
|
import {
|
|
2050
2066
|
Mina as Mina3
|
|
@@ -2251,17 +2267,17 @@ function Status({ txHash, watch = false }) {
|
|
|
2251
2267
|
}
|
|
2252
2268
|
}
|
|
2253
2269
|
}, [txHash, watch, exit, mina]);
|
|
2254
|
-
|
|
2270
|
+
useEffect6(() => {
|
|
2255
2271
|
fetchStatus();
|
|
2256
2272
|
}, [fetchStatus]);
|
|
2257
|
-
|
|
2273
|
+
useEffect6(() => {
|
|
2258
2274
|
if (!watch) return;
|
|
2259
2275
|
const interval = setInterval(() => {
|
|
2260
2276
|
fetchStatus();
|
|
2261
2277
|
}, 5e3);
|
|
2262
2278
|
return () => clearInterval(interval);
|
|
2263
2279
|
}, [watch, fetchStatus]);
|
|
2264
|
-
|
|
2280
|
+
useEffect6(() => {
|
|
2265
2281
|
const interval = setInterval(() => {
|
|
2266
2282
|
setElapsedTime(Date.now() - (status?.createdAt || startTime));
|
|
2267
2283
|
}, 1e3);
|
|
@@ -2300,7 +2316,7 @@ function Status({ txHash, watch = false }) {
|
|
|
2300
2316
|
}
|
|
2301
2317
|
|
|
2302
2318
|
// src/commands/bridge.tsx
|
|
2303
|
-
import { useState as useState7, useEffect as
|
|
2319
|
+
import { useState as useState7, useEffect as useEffect7, useCallback as useCallback3 } from "react";
|
|
2304
2320
|
import { Box as Box13, Text as Text13, useApp as useApp6, useInput as useInput3 } from "ink";
|
|
2305
2321
|
import {
|
|
2306
2322
|
Mina as Mina4,
|
|
@@ -2482,7 +2498,7 @@ function Bridge({ options }) {
|
|
|
2482
2498
|
}
|
|
2483
2499
|
}
|
|
2484
2500
|
});
|
|
2485
|
-
|
|
2501
|
+
useEffect7(() => {
|
|
2486
2502
|
loadInitialData();
|
|
2487
2503
|
}, []);
|
|
2488
2504
|
const loadInitialData = async () => {
|
|
@@ -2671,7 +2687,7 @@ async function bridgeCommand(options) {
|
|
|
2671
2687
|
}
|
|
2672
2688
|
|
|
2673
2689
|
// src/commands/history.tsx
|
|
2674
|
-
import { useState as useState8, useEffect as
|
|
2690
|
+
import { useState as useState8, useEffect as useEffect8 } from "react";
|
|
2675
2691
|
import { Box as Box14, Text as Text14, useApp as useApp7 } from "ink";
|
|
2676
2692
|
|
|
2677
2693
|
// src/lib/history.ts
|
|
@@ -2705,7 +2721,7 @@ function getHistory(limit = 10, address) {
|
|
|
2705
2721
|
}
|
|
2706
2722
|
|
|
2707
2723
|
// src/commands/history.tsx
|
|
2708
|
-
import { Fragment
|
|
2724
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2709
2725
|
function formatDate(timestamp) {
|
|
2710
2726
|
return new Date(timestamp).toLocaleString("en-US", {
|
|
2711
2727
|
month: "2-digit",
|
|
@@ -2770,12 +2786,12 @@ function HistoryCommand({
|
|
|
2770
2786
|
const { exit } = useApp7();
|
|
2771
2787
|
const [entries, setEntries] = useState8([]);
|
|
2772
2788
|
const [loading, setLoading] = useState8(true);
|
|
2773
|
-
|
|
2789
|
+
useEffect8(() => {
|
|
2774
2790
|
const history = getHistory(limit, address);
|
|
2775
2791
|
setEntries(history);
|
|
2776
2792
|
setLoading(false);
|
|
2777
2793
|
}, [limit, address]);
|
|
2778
|
-
|
|
2794
|
+
useEffect8(() => {
|
|
2779
2795
|
if (!loading && json) {
|
|
2780
2796
|
setTimeout(() => exit(), 100);
|
|
2781
2797
|
}
|
|
@@ -2836,7 +2852,7 @@ function HistoryCommand({
|
|
|
2836
2852
|
entries.length !== 1 ? "s" : ""
|
|
2837
2853
|
] })
|
|
2838
2854
|
] }) }),
|
|
2839
|
-
entries.length === 0 ? /* @__PURE__ */ jsx14(EmptyState, { address }) : /* @__PURE__ */ jsxs14(
|
|
2855
|
+
entries.length === 0 ? /* @__PURE__ */ jsx14(EmptyState, { address }) : /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
2840
2856
|
/* @__PURE__ */ jsx14(
|
|
2841
2857
|
Table,
|
|
2842
2858
|
{
|
|
@@ -2867,13 +2883,13 @@ function HistoryCommand({
|
|
|
2867
2883
|
}
|
|
2868
2884
|
|
|
2869
2885
|
// src/commands/balance.tsx
|
|
2870
|
-
import React10, { useState as useState9, useEffect as
|
|
2886
|
+
import React10, { useState as useState9, useEffect as useEffect9 } from "react";
|
|
2871
2887
|
import { Box as Box15, Text as Text15, useApp as useApp8 } from "ink";
|
|
2872
2888
|
import {
|
|
2873
2889
|
Mina as Mina5,
|
|
2874
2890
|
getChains as getChains6
|
|
2875
2891
|
} from "@siphoyawe/mina-sdk";
|
|
2876
|
-
import { Fragment as
|
|
2892
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2877
2893
|
function truncateAddress2(address) {
|
|
2878
2894
|
if (address.length <= 14) return address;
|
|
2879
2895
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
@@ -2938,7 +2954,7 @@ function BalanceCommand({
|
|
|
2938
2954
|
const [loading, setLoading] = useState9(true);
|
|
2939
2955
|
const [error, setError] = useState9(null);
|
|
2940
2956
|
const [totalUsd, setTotalUsd] = useState9(0);
|
|
2941
|
-
|
|
2957
|
+
useEffect9(() => {
|
|
2942
2958
|
async function loadBalances() {
|
|
2943
2959
|
try {
|
|
2944
2960
|
setLoading(true);
|
|
@@ -3016,7 +3032,7 @@ function BalanceCommand({
|
|
|
3016
3032
|
}
|
|
3017
3033
|
loadBalances();
|
|
3018
3034
|
}, [address, chain, showAll]);
|
|
3019
|
-
|
|
3035
|
+
useEffect9(() => {
|
|
3020
3036
|
if (!loading && json) {
|
|
3021
3037
|
setTimeout(() => exit(), 100);
|
|
3022
3038
|
}
|
|
@@ -3085,7 +3101,7 @@ function BalanceCommand({
|
|
|
3085
3101
|
borders.horizontal.repeat(boxWidth - 2),
|
|
3086
3102
|
borders.rightT
|
|
3087
3103
|
] }) }),
|
|
3088
|
-
!hasAnyBalances ? /* @__PURE__ */ jsx15(
|
|
3104
|
+
!hasAnyBalances ? /* @__PURE__ */ jsx15(Fragment2, { children: /* @__PURE__ */ jsxs15(Box15, { children: [
|
|
3089
3105
|
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical }),
|
|
3090
3106
|
/* @__PURE__ */ jsx15(Box15, { width: boxWidth - 2, justifyContent: "center", children: /* @__PURE__ */ jsx15(Text15, { color: theme.muted, children: "No balances found" }) }),
|
|
3091
3107
|
/* @__PURE__ */ jsx15(Text15, { color: theme.border, children: borders.vertical })
|
|
@@ -3162,7 +3178,7 @@ function BalanceCommand({
|
|
|
3162
3178
|
}
|
|
3163
3179
|
|
|
3164
3180
|
// src/commands/config.tsx
|
|
3165
|
-
import { useState as useState10, useEffect as
|
|
3181
|
+
import { useState as useState10, useEffect as useEffect10 } from "react";
|
|
3166
3182
|
import { Box as Box16, Text as Text16, useApp as useApp9 } from "ink";
|
|
3167
3183
|
|
|
3168
3184
|
// src/lib/config.ts
|
|
@@ -3288,7 +3304,7 @@ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
|
3288
3304
|
function ConfigList() {
|
|
3289
3305
|
const { exit } = useApp9();
|
|
3290
3306
|
const [items, setItems] = useState10([]);
|
|
3291
|
-
|
|
3307
|
+
useEffect10(() => {
|
|
3292
3308
|
const configItems = getConfigList();
|
|
3293
3309
|
setItems(
|
|
3294
3310
|
configItems.map((item) => ({
|
|
@@ -3327,7 +3343,7 @@ function ConfigGet({ configKey }) {
|
|
|
3327
3343
|
const { exit } = useApp9();
|
|
3328
3344
|
const [value, setValue] = useState10(null);
|
|
3329
3345
|
const [error, setError] = useState10(null);
|
|
3330
|
-
|
|
3346
|
+
useEffect10(() => {
|
|
3331
3347
|
if (!isValidKey(configKey)) {
|
|
3332
3348
|
setError(`Unknown config key: ${configKey}`);
|
|
3333
3349
|
} else {
|
|
@@ -3360,7 +3376,7 @@ function ConfigSet({ configKey, configValue }) {
|
|
|
3360
3376
|
const [success, setSuccess] = useState10(false);
|
|
3361
3377
|
const [error, setError] = useState10(null);
|
|
3362
3378
|
const [parsedValue, setParsedValue] = useState10(null);
|
|
3363
|
-
|
|
3379
|
+
useEffect10(() => {
|
|
3364
3380
|
if (!isValidKey(configKey)) {
|
|
3365
3381
|
setError(`Unknown config key: ${configKey}`);
|
|
3366
3382
|
} else {
|
|
@@ -3404,7 +3420,7 @@ function ConfigSet({ configKey, configValue }) {
|
|
|
3404
3420
|
}
|
|
3405
3421
|
function ConfigPath() {
|
|
3406
3422
|
const { exit } = useApp9();
|
|
3407
|
-
|
|
3423
|
+
useEffect10(() => {
|
|
3408
3424
|
setTimeout(() => exit(), 100);
|
|
3409
3425
|
}, [exit]);
|
|
3410
3426
|
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
@@ -3417,7 +3433,7 @@ function ConfigPath() {
|
|
|
3417
3433
|
}
|
|
3418
3434
|
function ConfigHelp() {
|
|
3419
3435
|
const { exit } = useApp9();
|
|
3420
|
-
|
|
3436
|
+
useEffect10(() => {
|
|
3421
3437
|
setTimeout(() => exit(), 100);
|
|
3422
3438
|
}, [exit]);
|
|
3423
3439
|
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", padding: 1, children: [
|
|
@@ -3483,7 +3499,7 @@ function ConfigCommand({ action, key: configKey, value }) {
|
|
|
3483
3499
|
}
|
|
3484
3500
|
|
|
3485
3501
|
// src/index.tsx
|
|
3486
|
-
var VERSION = "1.2.
|
|
3502
|
+
var VERSION = "1.2.1";
|
|
3487
3503
|
var program = new Command();
|
|
3488
3504
|
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");
|
|
3489
3505
|
program.command("wizard").description("Launch the interactive bridge wizard").action(() => {
|