Remove deep link path and prevent re-render from useEffect (#7)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675) - Remove path config used for deep links Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Reviewed-on: #7
This commit is contained in:
parent
cd0f6fa5d2
commit
504badebb8
@ -15,14 +15,7 @@ import { WalletConnectProvider } from './context/WalletConnectContext';
|
|||||||
globalThis.Buffer = Buffer;
|
globalThis.Buffer = Buffer;
|
||||||
|
|
||||||
const linking = {
|
const linking = {
|
||||||
prefixes: ['https://wallet.laconic.com'],
|
prefixes: ['https://wallet.laconic.com']
|
||||||
config: {
|
|
||||||
screens: {
|
|
||||||
SignRequest: {
|
|
||||||
path: 'sign/:namespace/:chaindId/:address/:message',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const theme = {
|
const theme = {
|
||||||
|
@ -50,7 +50,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
|
|||||||
const [account, setAccount] = useState<Account>();
|
const [account, setAccount] = useState<Account>();
|
||||||
const [cosmosStargateClient, setCosmosStargateClient] =
|
const [cosmosStargateClient, setCosmosStargateClient] =
|
||||||
useState<LaconicClient>();
|
useState<LaconicClient>();
|
||||||
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
|
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
|
||||||
const [fees, setFees] = useState<string>();
|
const [fees, setFees] = useState<string>();
|
||||||
const [txError, setTxError] = useState<string>();
|
const [txError, setTxError] = useState<string>();
|
||||||
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
|
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
|
||||||
@ -201,7 +201,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
|
|||||||
denom: requestedNetwork!.nativeDenom!,
|
denom: requestedNetwork!.nativeDenom!,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: cosmosGasLimit!,
|
gas: cosmosGasLimit,
|
||||||
},
|
},
|
||||||
txMsg: transactionMessage,
|
txMsg: transactionMessage,
|
||||||
};
|
};
|
||||||
|
@ -70,8 +70,8 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
|
|||||||
const [isTxLoading, setIsTxLoading] = useState(false);
|
const [isTxLoading, setIsTxLoading] = useState(false);
|
||||||
const [cosmosStargateClient, setCosmosStargateClient] =
|
const [cosmosStargateClient, setCosmosStargateClient] =
|
||||||
useState<SigningStargateClient>();
|
useState<SigningStargateClient>();
|
||||||
const [fees, setFees] = useState<string>();
|
const [fees, setFees] = useState<string>('');
|
||||||
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
|
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
|
||||||
const [txError, setTxError] = useState<string>();
|
const [txError, setTxError] = useState<string>();
|
||||||
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
|
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
|
||||||
const [ethGasPrice, setEthGasPrice] = useState<BigNumber | null>();
|
const [ethGasPrice, setEthGasPrice] = useState<BigNumber | null>();
|
||||||
@ -212,7 +212,7 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
|
|||||||
// If requested chain is EVM compatible, set loading to false when ethMaxFee and ethPriorityFee have been populated
|
// If requested chain is EVM compatible, set loading to false when ethMaxFee and ethPriorityFee have been populated
|
||||||
(ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) ||
|
(ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) ||
|
||||||
// Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated
|
// Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated
|
||||||
cosmosGasLimit !== undefined
|
!cosmosGasLimit
|
||||||
) {
|
) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
@ -311,11 +311,11 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
|
|||||||
// This amount is total fees required for transaction
|
// This amount is total fees required for transaction
|
||||||
amount: [
|
amount: [
|
||||||
{
|
{
|
||||||
amount: fees!,
|
amount: fees,
|
||||||
denom: requestedNetwork!.nativeDenom!,
|
denom: requestedNetwork!.nativeDenom!,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: cosmosGasLimit!,
|
gas: cosmosGasLimit,
|
||||||
},
|
},
|
||||||
sendMsg,
|
sendMsg,
|
||||||
memo: MEMO,
|
memo: MEMO,
|
||||||
|
@ -49,7 +49,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
const isCosmosSignDirect = useMemo(() => {
|
const isCosmosSignDirect = useMemo(() => {
|
||||||
const requestParams = route.params.requestEvent;
|
const requestParams = route.params.requestEvent;
|
||||||
|
|
||||||
if (!requestParams) {
|
if (!requestParams?.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
const isEthSendTransaction = useMemo(() => {
|
const isEthSendTransaction = useMemo(() => {
|
||||||
const requestParams = route.params.requestEvent;
|
const requestParams = route.params.requestEvent;
|
||||||
|
|
||||||
if (!requestParams) {
|
if (!requestParams?.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,21 +86,13 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestAccount !== account) {
|
setAccount(requestAccount);
|
||||||
setAccount(requestAccount);
|
setMessage(decodeURIComponent(requestMessage));
|
||||||
}
|
setNamespace(requestNamespace);
|
||||||
if (requestMessage !== message) {
|
setChainId(requestChainId);
|
||||||
setMessage(decodeURIComponent(requestMessage));
|
|
||||||
}
|
|
||||||
if (requestNamespace !== namespace) {
|
|
||||||
setNamespace(requestNamespace);
|
|
||||||
}
|
|
||||||
if (requestChainId !== chainId) {
|
|
||||||
setChainId(requestChainId);
|
|
||||||
}
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
},
|
},
|
||||||
[account, message, navigation, namespace, chainId],
|
[navigation],
|
||||||
);
|
);
|
||||||
|
|
||||||
const sanitizePath = useCallback(
|
const sanitizePath = useCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user