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