@spicenet-io/spiceflow-ui 1.9.4 → 1.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +24 -5
- package/dist/index.js +24 -5
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2753,6 +2753,7 @@ const PrivyProviderWrapper = ({ children, appId, supportedViemChains }) => {
|
|
|
2753
2753
|
theme: "#fafafa",
|
|
2754
2754
|
showWalletLoginFirst: false,
|
|
2755
2755
|
walletChainType: "ethereum-only",
|
|
2756
|
+
logo: "https://spicenet.io/assets/Spicenet_Lockup_Secondary_FullColor.png",
|
|
2756
2757
|
walletList: [
|
|
2757
2758
|
"detected_ethereum_wallets",
|
|
2758
2759
|
"metamask",
|
|
@@ -6076,6 +6077,9 @@ const SelectChainModal = ({
|
|
|
6076
6077
|
const [selectedNetwork, setSelectedNetwork] = React.useState(null);
|
|
6077
6078
|
const [hoveredNetwork, setHoveredNetwork] = React.useState(null);
|
|
6078
6079
|
const [isSelectHovered, setIsSelectHovered] = React.useState(false);
|
|
6080
|
+
const [isSwitching, setIsSwitching] = React.useState(false);
|
|
6081
|
+
const [switchError, setSwitchError] = React.useState(null);
|
|
6082
|
+
const { switchChainAsync } = wagmi.useSwitchChain();
|
|
6079
6083
|
React.useEffect(() => {
|
|
6080
6084
|
const link = document.createElement("link");
|
|
6081
6085
|
link.href = "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@100;200;300;400;500;600;700&display=swap";
|
|
@@ -6099,9 +6103,24 @@ const SelectChainModal = ({
|
|
|
6099
6103
|
const filteredNetworks = networks.filter(
|
|
6100
6104
|
(network) => network.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
6101
6105
|
);
|
|
6102
|
-
const handleSelect = () => {
|
|
6103
|
-
if (selectedNetwork
|
|
6104
|
-
|
|
6106
|
+
const handleSelect = async () => {
|
|
6107
|
+
if (!selectedNetwork) return;
|
|
6108
|
+
const chainId = parseInt(selectedNetwork, 10);
|
|
6109
|
+
setIsSwitching(true);
|
|
6110
|
+
setSwitchError(null);
|
|
6111
|
+
try {
|
|
6112
|
+
await switchChainAsync({ chainId });
|
|
6113
|
+
if (onChainSelect) {
|
|
6114
|
+
onChainSelect(selectedNetwork);
|
|
6115
|
+
}
|
|
6116
|
+
onClose();
|
|
6117
|
+
} catch (error) {
|
|
6118
|
+
console.error("Failed to switch chain:", error);
|
|
6119
|
+
setSwitchError(
|
|
6120
|
+
error instanceof Error ? error.message : "Failed to switch chain"
|
|
6121
|
+
);
|
|
6122
|
+
} finally {
|
|
6123
|
+
setIsSwitching(false);
|
|
6105
6124
|
}
|
|
6106
6125
|
};
|
|
6107
6126
|
if (!isOpen) return null;
|
|
@@ -6315,7 +6334,7 @@ const SelectChainModal = ({
|
|
|
6315
6334
|
onClick: handleSelect,
|
|
6316
6335
|
onMouseEnter: () => setIsSelectHovered(true),
|
|
6317
6336
|
onMouseLeave: () => setIsSelectHovered(false),
|
|
6318
|
-
disabled: !selectedNetwork,
|
|
6337
|
+
disabled: !selectedNetwork || isSwitching,
|
|
6319
6338
|
style: {
|
|
6320
6339
|
width: "100%",
|
|
6321
6340
|
padding: "10px",
|
|
@@ -6331,7 +6350,7 @@ const SelectChainModal = ({
|
|
|
6331
6350
|
backgroundColor: "white",
|
|
6332
6351
|
border: "1px solid #00000029",
|
|
6333
6352
|
color: "black",
|
|
6334
|
-
cursor: selectedNetwork ? "pointer" : "not-allowed"
|
|
6353
|
+
cursor: selectedNetwork && !isSwitching ? "pointer" : "not-allowed"
|
|
6335
6354
|
},
|
|
6336
6355
|
children: [
|
|
6337
6356
|
"SELECT",
|
package/dist/index.js
CHANGED
|
@@ -2751,6 +2751,7 @@ const PrivyProviderWrapper = ({ children, appId, supportedViemChains }) => {
|
|
|
2751
2751
|
theme: "#fafafa",
|
|
2752
2752
|
showWalletLoginFirst: false,
|
|
2753
2753
|
walletChainType: "ethereum-only",
|
|
2754
|
+
logo: "https://spicenet.io/assets/Spicenet_Lockup_Secondary_FullColor.png",
|
|
2754
2755
|
walletList: [
|
|
2755
2756
|
"detected_ethereum_wallets",
|
|
2756
2757
|
"metamask",
|
|
@@ -6074,6 +6075,9 @@ const SelectChainModal = ({
|
|
|
6074
6075
|
const [selectedNetwork, setSelectedNetwork] = useState(null);
|
|
6075
6076
|
const [hoveredNetwork, setHoveredNetwork] = useState(null);
|
|
6076
6077
|
const [isSelectHovered, setIsSelectHovered] = useState(false);
|
|
6078
|
+
const [isSwitching, setIsSwitching] = useState(false);
|
|
6079
|
+
const [switchError, setSwitchError] = useState(null);
|
|
6080
|
+
const { switchChainAsync } = useSwitchChain();
|
|
6077
6081
|
useEffect(() => {
|
|
6078
6082
|
const link = document.createElement("link");
|
|
6079
6083
|
link.href = "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@100;200;300;400;500;600;700&display=swap";
|
|
@@ -6097,9 +6101,24 @@ const SelectChainModal = ({
|
|
|
6097
6101
|
const filteredNetworks = networks.filter(
|
|
6098
6102
|
(network) => network.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
6099
6103
|
);
|
|
6100
|
-
const handleSelect = () => {
|
|
6101
|
-
if (selectedNetwork
|
|
6102
|
-
|
|
6104
|
+
const handleSelect = async () => {
|
|
6105
|
+
if (!selectedNetwork) return;
|
|
6106
|
+
const chainId = parseInt(selectedNetwork, 10);
|
|
6107
|
+
setIsSwitching(true);
|
|
6108
|
+
setSwitchError(null);
|
|
6109
|
+
try {
|
|
6110
|
+
await switchChainAsync({ chainId });
|
|
6111
|
+
if (onChainSelect) {
|
|
6112
|
+
onChainSelect(selectedNetwork);
|
|
6113
|
+
}
|
|
6114
|
+
onClose();
|
|
6115
|
+
} catch (error) {
|
|
6116
|
+
console.error("Failed to switch chain:", error);
|
|
6117
|
+
setSwitchError(
|
|
6118
|
+
error instanceof Error ? error.message : "Failed to switch chain"
|
|
6119
|
+
);
|
|
6120
|
+
} finally {
|
|
6121
|
+
setIsSwitching(false);
|
|
6103
6122
|
}
|
|
6104
6123
|
};
|
|
6105
6124
|
if (!isOpen) return null;
|
|
@@ -6313,7 +6332,7 @@ const SelectChainModal = ({
|
|
|
6313
6332
|
onClick: handleSelect,
|
|
6314
6333
|
onMouseEnter: () => setIsSelectHovered(true),
|
|
6315
6334
|
onMouseLeave: () => setIsSelectHovered(false),
|
|
6316
|
-
disabled: !selectedNetwork,
|
|
6335
|
+
disabled: !selectedNetwork || isSwitching,
|
|
6317
6336
|
style: {
|
|
6318
6337
|
width: "100%",
|
|
6319
6338
|
padding: "10px",
|
|
@@ -6329,7 +6348,7 @@ const SelectChainModal = ({
|
|
|
6329
6348
|
backgroundColor: "white",
|
|
6330
6349
|
border: "1px solid #00000029",
|
|
6331
6350
|
color: "black",
|
|
6332
|
-
cursor: selectedNetwork ? "pointer" : "not-allowed"
|
|
6351
|
+
cursor: selectedNetwork && !isSwitching ? "pointer" : "not-allowed"
|
|
6333
6352
|
},
|
|
6334
6353
|
children: [
|
|
6335
6354
|
"SELECT",
|