@avalabs/avacloud-waas-react 1.0.3 → 1.0.4
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 +21 -7
- package/dist/index.mjs +29 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2376,7 +2376,8 @@ function SendFormView({
|
|
|
2376
2376
|
value: recipient,
|
|
2377
2377
|
onChange: (e) => handleRecipientChange(e.target.value),
|
|
2378
2378
|
error: !!error || !!addressError,
|
|
2379
|
-
helperText: addressError
|
|
2379
|
+
helperText: !selectedToken ? "Select a token first" : addressError,
|
|
2380
|
+
disabled: !selectedToken
|
|
2380
2381
|
}
|
|
2381
2382
|
)
|
|
2382
2383
|
] }),
|
|
@@ -2395,7 +2396,8 @@ function SendFormView({
|
|
|
2395
2396
|
placeholder: "0.00",
|
|
2396
2397
|
value: amount,
|
|
2397
2398
|
onChange: handleAmountChange,
|
|
2398
|
-
error: !!error
|
|
2399
|
+
error: !!error,
|
|
2400
|
+
disabled: !selectedToken
|
|
2399
2401
|
}
|
|
2400
2402
|
)
|
|
2401
2403
|
] }),
|
|
@@ -2712,6 +2714,14 @@ function SendView({ onBack, onViewStateChange, selectedToken: initialToken }) {
|
|
|
2712
2714
|
const [selectedToken, setSelectedToken] = (0, import_react13.useState)(initialToken);
|
|
2713
2715
|
const { transfer, transferERC20, error, isLoading, txHash, viewState, reset, actualBaseFee, actualPriorityFee, actualTotalFee } = useTransferTokens();
|
|
2714
2716
|
const { data: blockchainInfo } = useBlockchain((chainId == null ? void 0 : chainId.toString()) || "");
|
|
2717
|
+
const { wallet } = useAvaCloudWallet();
|
|
2718
|
+
const { data: tokenBalancesResponse } = useERC20Balances((wallet == null ? void 0 : wallet.address) || void 0, chainId == null ? void 0 : chainId.toString());
|
|
2719
|
+
const tokenBalances = tokenBalancesResponse;
|
|
2720
|
+
(0, import_react13.useEffect)(() => {
|
|
2721
|
+
if (!selectedToken && (tokenBalances == null ? void 0 : tokenBalances.nativeTokenBalance)) {
|
|
2722
|
+
setSelectedToken(tokenBalances.nativeTokenBalance);
|
|
2723
|
+
}
|
|
2724
|
+
}, [selectedToken, tokenBalances]);
|
|
2715
2725
|
(0, import_react13.useEffect)(() => {
|
|
2716
2726
|
onViewStateChange == null ? void 0 : onViewStateChange(viewState);
|
|
2717
2727
|
}, [viewState, onViewStateChange]);
|
|
@@ -2805,6 +2815,8 @@ function ReceiveView(_props) {
|
|
|
2805
2815
|
const { wallet } = useAvaCloudWallet();
|
|
2806
2816
|
const { chainId } = useChainId();
|
|
2807
2817
|
const [_copied, setCopied] = (0, import_react15.useState)(false);
|
|
2818
|
+
const theme = (0, import_core_k2_components10.useTheme)();
|
|
2819
|
+
const { isDarkMode } = useThemeMode();
|
|
2808
2820
|
if (!wallet.address) {
|
|
2809
2821
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core_k2_components10.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core_k2_components10.Typography, { color: "text.secondary", children: "No wallet address available" }) });
|
|
2810
2822
|
}
|
|
@@ -2826,7 +2838,7 @@ function ReceiveView(_props) {
|
|
|
2826
2838
|
import_core_k2_components10.Typography,
|
|
2827
2839
|
{
|
|
2828
2840
|
sx: {
|
|
2829
|
-
color: "
|
|
2841
|
+
color: "text.primary",
|
|
2830
2842
|
fontSize: "14px",
|
|
2831
2843
|
fontWeight: 500,
|
|
2832
2844
|
lineHeight: "20px"
|
|
@@ -2847,7 +2859,7 @@ function ReceiveView(_props) {
|
|
|
2847
2859
|
flex: 1,
|
|
2848
2860
|
fontFamily: "monospace",
|
|
2849
2861
|
fontSize: "14px",
|
|
2850
|
-
color: "
|
|
2862
|
+
color: "text.primary",
|
|
2851
2863
|
overflow: "hidden",
|
|
2852
2864
|
textOverflow: "ellipsis"
|
|
2853
2865
|
},
|
|
@@ -2863,16 +2875,18 @@ function ReceiveView(_props) {
|
|
|
2863
2875
|
width: "100%",
|
|
2864
2876
|
aspectRatio: "1",
|
|
2865
2877
|
p: 2,
|
|
2866
|
-
background: "#FFF",
|
|
2878
|
+
background: isDarkMode ? theme.palette.background.paper : "#FFF",
|
|
2867
2879
|
borderRadius: "8px",
|
|
2868
|
-
border:
|
|
2880
|
+
border: `1px solid ${isDarkMode ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)"}`
|
|
2869
2881
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2870
2882
|
import_qrcode.QRCodeSVG,
|
|
2871
2883
|
{
|
|
2872
2884
|
value: wallet.address ? `ethereum:${wallet.address}@${chainId}` : "",
|
|
2873
2885
|
level: "H",
|
|
2874
2886
|
includeMargin: false,
|
|
2875
|
-
size: 200
|
|
2887
|
+
size: 200,
|
|
2888
|
+
bgColor: isDarkMode ? theme.palette.background.paper : "#FFFFFF",
|
|
2889
|
+
fgColor: isDarkMode ? "#FFFFFF" : "#000000"
|
|
2876
2890
|
}
|
|
2877
2891
|
) }),
|
|
2878
2892
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_core_k2_components10.Box, { sx: { mt: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PoweredByAvaCloud, {}) })
|
package/dist/index.mjs
CHANGED
|
@@ -1604,7 +1604,7 @@ import {
|
|
|
1604
1604
|
IconButton as IconButton9,
|
|
1605
1605
|
CopyIcon as CopyIcon5,
|
|
1606
1606
|
AvaCloudIcon as AvaCloudIcon2,
|
|
1607
|
-
useTheme as
|
|
1607
|
+
useTheme as useTheme5
|
|
1608
1608
|
} from "@avalabs/core-k2-components";
|
|
1609
1609
|
|
|
1610
1610
|
// src/components/WalletCard.tsx
|
|
@@ -1614,7 +1614,7 @@ import {
|
|
|
1614
1614
|
Box as Box10,
|
|
1615
1615
|
IconButton as IconButton8,
|
|
1616
1616
|
CopyIcon as CopyIcon4,
|
|
1617
|
-
useTheme as
|
|
1617
|
+
useTheme as useTheme4,
|
|
1618
1618
|
CircularProgress as CircularProgress2,
|
|
1619
1619
|
AvaCloudIcon,
|
|
1620
1620
|
Dialog as Dialog4,
|
|
@@ -2370,7 +2370,8 @@ function SendFormView({
|
|
|
2370
2370
|
value: recipient,
|
|
2371
2371
|
onChange: (e) => handleRecipientChange(e.target.value),
|
|
2372
2372
|
error: !!error || !!addressError,
|
|
2373
|
-
helperText: addressError
|
|
2373
|
+
helperText: !selectedToken ? "Select a token first" : addressError,
|
|
2374
|
+
disabled: !selectedToken
|
|
2374
2375
|
}
|
|
2375
2376
|
)
|
|
2376
2377
|
] }),
|
|
@@ -2389,7 +2390,8 @@ function SendFormView({
|
|
|
2389
2390
|
placeholder: "0.00",
|
|
2390
2391
|
value: amount,
|
|
2391
2392
|
onChange: handleAmountChange,
|
|
2392
|
-
error: !!error
|
|
2393
|
+
error: !!error,
|
|
2394
|
+
disabled: !selectedToken
|
|
2393
2395
|
}
|
|
2394
2396
|
)
|
|
2395
2397
|
] }),
|
|
@@ -2706,6 +2708,14 @@ function SendView({ onBack, onViewStateChange, selectedToken: initialToken }) {
|
|
|
2706
2708
|
const [selectedToken, setSelectedToken] = useState11(initialToken);
|
|
2707
2709
|
const { transfer, transferERC20, error, isLoading, txHash, viewState, reset, actualBaseFee, actualPriorityFee, actualTotalFee } = useTransferTokens();
|
|
2708
2710
|
const { data: blockchainInfo } = useBlockchain((chainId == null ? void 0 : chainId.toString()) || "");
|
|
2711
|
+
const { wallet } = useAvaCloudWallet();
|
|
2712
|
+
const { data: tokenBalancesResponse } = useERC20Balances((wallet == null ? void 0 : wallet.address) || void 0, chainId == null ? void 0 : chainId.toString());
|
|
2713
|
+
const tokenBalances = tokenBalancesResponse;
|
|
2714
|
+
useEffect6(() => {
|
|
2715
|
+
if (!selectedToken && (tokenBalances == null ? void 0 : tokenBalances.nativeTokenBalance)) {
|
|
2716
|
+
setSelectedToken(tokenBalances.nativeTokenBalance);
|
|
2717
|
+
}
|
|
2718
|
+
}, [selectedToken, tokenBalances]);
|
|
2709
2719
|
useEffect6(() => {
|
|
2710
2720
|
onViewStateChange == null ? void 0 : onViewStateChange(viewState);
|
|
2711
2721
|
}, [viewState, onViewStateChange]);
|
|
@@ -2797,13 +2807,16 @@ import {
|
|
|
2797
2807
|
Box as Box4,
|
|
2798
2808
|
Typography as Typography5,
|
|
2799
2809
|
IconButton as IconButton4,
|
|
2800
|
-
CopyIcon
|
|
2810
|
+
CopyIcon,
|
|
2811
|
+
useTheme as useTheme2
|
|
2801
2812
|
} from "@avalabs/core-k2-components";
|
|
2802
2813
|
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2803
2814
|
function ReceiveView(_props) {
|
|
2804
2815
|
const { wallet } = useAvaCloudWallet();
|
|
2805
2816
|
const { chainId } = useChainId();
|
|
2806
2817
|
const [_copied, setCopied] = useState12(false);
|
|
2818
|
+
const theme = useTheme2();
|
|
2819
|
+
const { isDarkMode } = useThemeMode();
|
|
2807
2820
|
if (!wallet.address) {
|
|
2808
2821
|
return /* @__PURE__ */ jsx12(Box4, { sx: { p: 2 }, children: /* @__PURE__ */ jsx12(Typography5, { color: "text.secondary", children: "No wallet address available" }) });
|
|
2809
2822
|
}
|
|
@@ -2825,7 +2838,7 @@ function ReceiveView(_props) {
|
|
|
2825
2838
|
Typography5,
|
|
2826
2839
|
{
|
|
2827
2840
|
sx: {
|
|
2828
|
-
color: "
|
|
2841
|
+
color: "text.primary",
|
|
2829
2842
|
fontSize: "14px",
|
|
2830
2843
|
fontWeight: 500,
|
|
2831
2844
|
lineHeight: "20px"
|
|
@@ -2846,7 +2859,7 @@ function ReceiveView(_props) {
|
|
|
2846
2859
|
flex: 1,
|
|
2847
2860
|
fontFamily: "monospace",
|
|
2848
2861
|
fontSize: "14px",
|
|
2849
|
-
color: "
|
|
2862
|
+
color: "text.primary",
|
|
2850
2863
|
overflow: "hidden",
|
|
2851
2864
|
textOverflow: "ellipsis"
|
|
2852
2865
|
},
|
|
@@ -2862,16 +2875,18 @@ function ReceiveView(_props) {
|
|
|
2862
2875
|
width: "100%",
|
|
2863
2876
|
aspectRatio: "1",
|
|
2864
2877
|
p: 2,
|
|
2865
|
-
background: "#FFF",
|
|
2878
|
+
background: isDarkMode ? theme.palette.background.paper : "#FFF",
|
|
2866
2879
|
borderRadius: "8px",
|
|
2867
|
-
border:
|
|
2880
|
+
border: `1px solid ${isDarkMode ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)"}`
|
|
2868
2881
|
}, children: /* @__PURE__ */ jsx12(
|
|
2869
2882
|
QRCodeSVG,
|
|
2870
2883
|
{
|
|
2871
2884
|
value: wallet.address ? `ethereum:${wallet.address}@${chainId}` : "",
|
|
2872
2885
|
level: "H",
|
|
2873
2886
|
includeMargin: false,
|
|
2874
|
-
size: 200
|
|
2887
|
+
size: 200,
|
|
2888
|
+
bgColor: isDarkMode ? theme.palette.background.paper : "#FFFFFF",
|
|
2889
|
+
fgColor: isDarkMode ? "#FFFFFF" : "#000000"
|
|
2875
2890
|
}
|
|
2876
2891
|
) }),
|
|
2877
2892
|
/* @__PURE__ */ jsx12(Box4, { sx: { mt: "auto" }, children: /* @__PURE__ */ jsx12(PoweredByAvaCloud, {}) })
|
|
@@ -2994,7 +3009,7 @@ import {
|
|
|
2994
3009
|
Box as Box8,
|
|
2995
3010
|
Tabs,
|
|
2996
3011
|
Tab,
|
|
2997
|
-
useTheme as
|
|
3012
|
+
useTheme as useTheme3
|
|
2998
3013
|
} from "@avalabs/core-k2-components";
|
|
2999
3014
|
|
|
3000
3015
|
// src/components/FungibleList.tsx
|
|
@@ -3390,7 +3405,7 @@ function NonFungibleList() {
|
|
|
3390
3405
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3391
3406
|
function TokensView({ onSend }) {
|
|
3392
3407
|
const [activeTab, setActiveTab] = useState14("tokens");
|
|
3393
|
-
const theme =
|
|
3408
|
+
const theme = useTheme3();
|
|
3394
3409
|
const handleCopyAddress = (address) => {
|
|
3395
3410
|
navigator.clipboard.writeText(address);
|
|
3396
3411
|
};
|
|
@@ -3631,7 +3646,7 @@ function WalletCard({ onClose }) {
|
|
|
3631
3646
|
const { balance, isLoadingBalance, currencySymbol, blockchain } = useGlacier();
|
|
3632
3647
|
const [currentView, setCurrentView] = useState15("main");
|
|
3633
3648
|
const [selectedToken, setSelectedToken] = useState15();
|
|
3634
|
-
const theme =
|
|
3649
|
+
const theme = useTheme4();
|
|
3635
3650
|
if (!isAuthenticated || !user) return null;
|
|
3636
3651
|
const handleCopy = (e) => {
|
|
3637
3652
|
e.stopPropagation();
|
|
@@ -3823,7 +3838,7 @@ function WalletButton({
|
|
|
3823
3838
|
}) {
|
|
3824
3839
|
const { isLoading, isAuthenticated, wallet } = useAvaCloudWallet();
|
|
3825
3840
|
const [isModalOpen, setIsModalOpen] = useState16(false);
|
|
3826
|
-
const theme =
|
|
3841
|
+
const theme = useTheme5();
|
|
3827
3842
|
const { isDarkMode } = useThemeMode();
|
|
3828
3843
|
const handleOpen = () => setIsModalOpen(true);
|
|
3829
3844
|
const handleClose = () => setIsModalOpen(false);
|