forked from cerc-io/laconic-wallet
Add spinner for tx after being approved (#67)
* Add spinner for tx * Change text color
This commit is contained in:
parent
4eecdb7e4c
commit
cc3d7f708f
@ -49,6 +49,7 @@ const ApproveTransaction = ({ route }: SignRequestProps) => {
|
||||
const [account, setAccount] = useState<Account>();
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [balance, setBalance] = useState<string>('');
|
||||
const [isTxLoading, setIsTxLoading] = useState(false);
|
||||
const [cosmosStargateClient, setCosmosStargateClient] =
|
||||
useState<SigningStargateClient>();
|
||||
|
||||
@ -96,6 +97,7 @@ const ApproveTransaction = ({ route }: SignRequestProps) => {
|
||||
}, [retrieveData, transaction]);
|
||||
|
||||
const acceptRequestHandler = async () => {
|
||||
setIsTxLoading(true);
|
||||
if (!account) {
|
||||
throw new Error('account not found');
|
||||
}
|
||||
@ -110,6 +112,7 @@ const ApproveTransaction = ({ route }: SignRequestProps) => {
|
||||
|
||||
const { topic } = requestEvent;
|
||||
await web3wallet!.respondSessionRequest({ topic, response });
|
||||
setIsTxLoading(false);
|
||||
|
||||
navigation.navigate('Laconic');
|
||||
};
|
||||
@ -254,8 +257,11 @@ const ApproveTransaction = ({ route }: SignRequestProps) => {
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.buttonContainer}>
|
||||
<Button mode="contained" onPress={acceptRequestHandler}>
|
||||
Yes
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={acceptRequestHandler}
|
||||
loading={isTxLoading}>
|
||||
{isTxLoading ? 'Processing' : 'Yes'}
|
||||
</Button>
|
||||
<Button
|
||||
mode="contained"
|
||||
|
Loading…
Reference in New Issue
Block a user