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:
nabarun 2024-08-01 06:18:02 +00:00
parent cd0f6fa5d2
commit 504badebb8
4 changed files with 15 additions and 30 deletions

View File

@ -15,14 +15,7 @@ import { WalletConnectProvider } from './context/WalletConnectContext';
globalThis.Buffer = Buffer;
const linking = {
prefixes: ['https://wallet.laconic.com'],
config: {
screens: {
SignRequest: {
path: 'sign/:namespace/:chaindId/:address/:message',
},
},
},
prefixes: ['https://wallet.laconic.com']
};
const theme = {

View File

@ -50,7 +50,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
const [account, setAccount] = useState<Account>();
const [cosmosStargateClient, setCosmosStargateClient] =
useState<LaconicClient>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [fees, setFees] = useState<string>();
const [txError, setTxError] = useState<string>();
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
@ -201,7 +201,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
denom: requestedNetwork!.nativeDenom!,
},
],
gas: cosmosGasLimit!,
gas: cosmosGasLimit,
},
txMsg: transactionMessage,
};

View File

@ -70,8 +70,8 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
const [isTxLoading, setIsTxLoading] = useState(false);
const [cosmosStargateClient, setCosmosStargateClient] =
useState<SigningStargateClient>();
const [fees, setFees] = useState<string>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
const [fees, setFees] = useState<string>('');
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [txError, setTxError] = useState<string>();
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
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
(ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) ||
// Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated
cosmosGasLimit !== undefined
!cosmosGasLimit
) {
setIsLoading(false);
}
@ -311,11 +311,11 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
// This amount is total fees required for transaction
amount: [
{
amount: fees!,
amount: fees,
denom: requestedNetwork!.nativeDenom!,
},
],
gas: cosmosGasLimit!,
gas: cosmosGasLimit,
},
sendMsg,
memo: MEMO,

View File

@ -49,7 +49,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
const isCosmosSignDirect = useMemo(() => {
const requestParams = route.params.requestEvent;
if (!requestParams) {
if (!requestParams?.id) {
return false;
}
@ -59,7 +59,7 @@ const SignRequest = ({ route }: SignRequestProps) => {
const isEthSendTransaction = useMemo(() => {
const requestParams = route.params.requestEvent;
if (!requestParams) {
if (!requestParams?.id) {
return false;
}
@ -86,21 +86,13 @@ const SignRequest = ({ route }: SignRequestProps) => {
return;
}
if (requestAccount !== account) {
setAccount(requestAccount);
}
if (requestMessage !== message) {
setMessage(decodeURIComponent(requestMessage));
}
if (requestNamespace !== namespace) {
setNamespace(requestNamespace);
}
if (requestChainId !== chainId) {
setChainId(requestChainId);
}
setAccount(requestAccount);
setMessage(decodeURIComponent(requestMessage));
setNamespace(requestNamespace);
setChainId(requestChainId);
setIsLoading(false);
},
[account, message, navigation, namespace, chainId],
[navigation],
);
const sanitizePath = useCallback(