forked from cerc-io/laconic-wallet
Reset Add Network form after switching the network (#97)
* Reset form upon switching nws * Modify gitignore * Fix undefined field error * Add env steps in readme * Remove .env file * Fix indentation in readme * Disable buttons while loading (#99) * Disable buttons while loading * Disable pairing modal button * Format code
This commit is contained in:
parent
15da99a827
commit
2adfffba55
@ -1,2 +1 @@
|
|||||||
WALLET_CONNECT_PROJECT_ID=
|
WALLET_CONNECT_PROJECT_ID=
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -64,3 +64,5 @@ yarn-error.log
|
|||||||
|
|
||||||
# testing
|
# testing
|
||||||
/coverage
|
/coverage
|
||||||
|
|
||||||
|
.env
|
||||||
|
@ -81,7 +81,14 @@
|
|||||||
yarn
|
yarn
|
||||||
```
|
```
|
||||||
|
|
||||||
4. In [.env](./.env) file add WalletConnect project id. You can generate your own ProjectId at https://cloud.walletconnect.com
|
4. Setup .env
|
||||||
|
- Copy and update [`.env`](./.env)
|
||||||
|
|
||||||
|
```
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
- In [.env](./.env) file add WalletConnect project id. You can generate your own ProjectId at https://cloud.walletconnect.com
|
||||||
|
|
||||||
```
|
```
|
||||||
WALLET_CONNECT_PROJECT_ID=39bc93c...
|
WALLET_CONNECT_PROJECT_ID=39bc93c...
|
||||||
|
@ -134,7 +134,8 @@ const Accounts = ({ currentIndex, updateIndex }: AccountsProps) => {
|
|||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={addAccountHandler}
|
onPress={addAccountHandler}
|
||||||
loading={isAccountCreating}>
|
loading={isAccountCreating}
|
||||||
|
disabled={isAccountCreating}>
|
||||||
{isAccountCreating ? 'Adding' : 'Add Account'}
|
{isAccountCreating ? 'Adding' : 'Add Account'}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -15,6 +15,7 @@ const CreateWallet = ({
|
|||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
loading={isWalletCreating}
|
loading={isWalletCreating}
|
||||||
|
disabled={isWalletCreating}
|
||||||
onPress={createWalletHandler}>
|
onPress={createWalletHandler}>
|
||||||
{isWalletCreating ? 'Creating' : 'Create Wallet'}
|
{isWalletCreating ? 'Creating' : 'Create Wallet'}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -88,7 +88,8 @@ const HDPath = ({
|
|||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={createFromHDPathHandler}
|
onPress={createFromHDPathHandler}
|
||||||
loading={isAccountCreating}>
|
loading={isAccountCreating}
|
||||||
|
disabled={isAccountCreating}>
|
||||||
{isAccountCreating ? 'Adding' : 'Add Account'}
|
{isAccountCreating ? 'Adding' : 'Add Account'}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -229,7 +229,11 @@ const PairingModal = ({
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<View style={styles.flexRow}>
|
<View style={styles.flexRow}>
|
||||||
<Button mode="contained" onPress={handleAccept} loading={isLoading}>
|
<Button
|
||||||
|
mode="contained"
|
||||||
|
onPress={handleAccept}
|
||||||
|
loading={isLoading}
|
||||||
|
disabled={isLoading}>
|
||||||
{isLoading ? 'Connecting' : 'Yes'}
|
{isLoading ? 'Connecting' : 'Yes'}
|
||||||
</Button>
|
</Button>
|
||||||
<View style={styles.space} />
|
<View style={styles.space} />
|
||||||
|
@ -56,20 +56,19 @@ const AddNetwork = () => {
|
|||||||
chain => chain.chainId === Number(chainId),
|
chain => chain.chainId === Number(chainId),
|
||||||
);
|
);
|
||||||
if (!ethChainDetails) {
|
if (!ethChainDetails) {
|
||||||
reset({ chainId: chainId });
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setValue('networkName', ethChainDetails.name);
|
setValue('networkName', ethChainDetails.name);
|
||||||
setValue('rpcUrl', ethChainDetails.rpc[0]);
|
setValue('rpcUrl', ethChainDetails.rpc[0]);
|
||||||
setValue('blockExplorerUrl', ethChainDetails.explorers![0].url);
|
setValue('blockExplorerUrl', ethChainDetails.explorers?.[0].url || '');
|
||||||
setValue('coinType', String(ethChainDetails.slip44));
|
setValue('coinType', String(ethChainDetails.slip44));
|
||||||
setValue('currencySymbol', ethChainDetails.nativeCurrency.symbol);
|
setValue('currencySymbol', ethChainDetails.nativeCurrency.symbol);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const cosmosChainDetails = chains.find(
|
const cosmosChainDetails = chains.find(
|
||||||
({ chain_id }) => chain_id === chainId,
|
({ chain_id }) => chain_id === chainId,
|
||||||
);
|
);
|
||||||
if (!cosmosChainDetails) {
|
if (!cosmosChainDetails) {
|
||||||
reset({ chainId: chainId });
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setValue('networkName', cosmosChainDetails.pretty_name);
|
setValue('networkName', cosmosChainDetails.pretty_name);
|
||||||
@ -152,6 +151,10 @@ const AddNetwork = () => {
|
|||||||
fetchChainDetails(watchChainId);
|
fetchChainDetails(watchChainId);
|
||||||
}, [watchChainId, fetchChainDetails]);
|
}, [watchChainId, fetchChainDetails]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
reset();
|
||||||
|
}, [namespace, reset]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// TODO: get form data from json file
|
// TODO: get form data from json file
|
||||||
<ScrollView contentContainerStyle={styles.signPage}>
|
<ScrollView contentContainerStyle={styles.signPage}>
|
||||||
|
@ -282,7 +282,8 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={signMessageHandler}
|
onPress={signMessageHandler}
|
||||||
loading={isApproving}>
|
loading={isApproving}
|
||||||
|
disabled={isApproving}>
|
||||||
Yes
|
Yes
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
Reference in New Issue
Block a user