forked from cerc-io/laconic-wallet
Fix spinner not showing up on starting wallet (#102)
* Fix spinner not showing up on starting wallet * Remove unnecessary dependancies
This commit is contained in:
parent
670d6f4a54
commit
e98dac7a5b
@ -75,7 +75,7 @@ const App = (): React.JSX.Element => {
|
||||
case NETWORK_METHODS.GET_NETWORKS:
|
||||
const retrievedNetworks = await retrieveNetworksData();
|
||||
const currentNetworkId = networksData.find(
|
||||
networkData => networkData.networkId === selectedNetwork.networkId,
|
||||
networkData => networkData.networkId === selectedNetwork!.networkId,
|
||||
)?.networkId;
|
||||
|
||||
const formattedResponse = formatJsonRpcResult(id, {
|
||||
|
@ -54,7 +54,7 @@ const Accounts = ({ currentIndex, updateIndex }: AccountsProps) => {
|
||||
optionalNamespaces,
|
||||
requiredNamespaces,
|
||||
networksData,
|
||||
selectedNetwork,
|
||||
selectedNetwork!,
|
||||
accounts,
|
||||
currentIndex,
|
||||
);
|
||||
@ -145,7 +145,7 @@ const Accounts = ({ currentIndex, updateIndex }: AccountsProps) => {
|
||||
mode="contained"
|
||||
onPress={() => {
|
||||
setHdDialog(true);
|
||||
setPathCode(`m/44'/${selectedNetwork.coinType}'/`);
|
||||
setPathCode(`m/44'/${selectedNetwork!.coinType}'/`);
|
||||
}}>
|
||||
Add Account from HD path
|
||||
</Button>
|
||||
|
@ -20,7 +20,7 @@ const NetworkDropdown = ({ updateNetwork }: NetworkDropdownProps) => {
|
||||
return (
|
||||
<View style={styles.networkDropdown}>
|
||||
<List.Accordion
|
||||
title={selectedNetwork.networkName}
|
||||
title={selectedNetwork!.networkName}
|
||||
expanded={expanded}
|
||||
onPress={() => setExpanded(!expanded)}>
|
||||
{networksData.map(networkData => (
|
||||
|
@ -100,7 +100,7 @@ const PairingModal = ({
|
||||
optionalNamespaces,
|
||||
requiredNamespaces,
|
||||
networksData,
|
||||
selectedNetwork,
|
||||
selectedNetwork!,
|
||||
accounts,
|
||||
currentIndex,
|
||||
);
|
||||
|
@ -11,8 +11,10 @@ const NetworksContext = createContext<{
|
||||
setNetworksData: React.Dispatch<React.SetStateAction<NetworksDataState[]>>;
|
||||
networkType: string;
|
||||
setNetworkType: (networkType: string) => void;
|
||||
selectedNetwork: NetworksDataState;
|
||||
setSelectedNetwork: React.Dispatch<React.SetStateAction<NetworksDataState>>;
|
||||
selectedNetwork?: NetworksDataState;
|
||||
setSelectedNetwork: React.Dispatch<
|
||||
React.SetStateAction<NetworksDataState | undefined>
|
||||
>;
|
||||
}>({
|
||||
currentIndex: 0,
|
||||
setCurrentIndex: () => {},
|
||||
@ -33,9 +35,7 @@ const NetworksProvider = ({ children }: { children: any }) => {
|
||||
const [networksData, setNetworksData] = useState<NetworksDataState[]>([]);
|
||||
const [currentIndex, setCurrentIndex] = useState<number>(0);
|
||||
const [networkType, setNetworkType] = useState<string>(EIP155);
|
||||
const [selectedNetwork, setSelectedNetwork] = useState<NetworksDataState>(
|
||||
{} as NetworksDataState,
|
||||
);
|
||||
const [selectedNetwork, setSelectedNetwork] = useState<NetworksDataState>();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
|
@ -85,7 +85,7 @@ const AddNetwork = () => {
|
||||
setValue('networkName', ethChainDetails.name);
|
||||
setValue('rpcUrl', ethChainDetails.rpc[0]);
|
||||
setValue('blockExplorerUrl', ethChainDetails.explorers?.[0].url || '');
|
||||
setValue('coinType', String(ethChainDetails.slip44));
|
||||
setValue('coinType', String(ethChainDetails.slip44 ?? '60'));
|
||||
setValue('currencySymbol', ethChainDetails.nativeCurrency.symbol);
|
||||
return;
|
||||
}
|
||||
@ -99,7 +99,7 @@ const AddNetwork = () => {
|
||||
setValue('rpcUrl', cosmosChainDetails.apis?.rpc?.[0]?.address || '');
|
||||
setValue('blockExplorerUrl', cosmosChainDetails.explorers?.[0].url || '');
|
||||
setValue('addressPrefix', cosmosChainDetails.bech32_prefix);
|
||||
setValue('coinType', String(cosmosChainDetails.slip44));
|
||||
setValue('coinType', String(cosmosChainDetails.slip44 ?? '118'));
|
||||
setValue('nativeDenom', cosmosChainDetails.fees?.fee_tokens[0].denom || '');
|
||||
}, CHAINID_DEBOUNCE_DELAY);
|
||||
|
||||
|
@ -26,7 +26,7 @@ import { useNetworks } from '../context/NetworksContext';
|
||||
type SignRequestProps = NativeStackScreenProps<StackParamsList, 'SignRequest'>;
|
||||
|
||||
const SignRequest = ({ route }: SignRequestProps) => {
|
||||
const { networksData, selectedNetwork } = useNetworks();
|
||||
const { networksData } = useNetworks();
|
||||
|
||||
const requestSession = route.params.requestSessionData;
|
||||
const requestName = requestSession?.peer?.metadata?.name;
|
||||
@ -146,7 +146,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
||||
route.params.address,
|
||||
route.params.message,
|
||||
);
|
||||
}, [retrieveData, sanitizePath, route, networksData, selectedNetwork]);
|
||||
}, [retrieveData, sanitizePath, route, networksData]);
|
||||
|
||||
const handleWalletConnectRequest = async () => {
|
||||
const { requestEvent } = route.params || {};
|
||||
|
Loading…
Reference in New Issue
Block a user