Remove the code handling NYM to uNYM conversion
This commit is contained in:
parent
053d7f5618
commit
1124805bb7
@ -1,6 +1,5 @@
|
||||
REACT_APP_WALLET_CONNECT_PROJECT_ID=
|
||||
|
||||
REACT_APP_DEFAULT_GAS_PRICE=0.025
|
||||
# Reference: https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
REACT_APP_GAS_ADJUSTMENT=2
|
||||
REACT_APP_LACONICD_RPC_URL=https://laconicd-sapo.laconic.com
|
||||
|
@ -111,19 +111,12 @@ export const useWebViewHandler = () => {
|
||||
|
||||
// Handle incoming transfer requests
|
||||
const navigateToTransfer = useCallback(async (to: string, amount: string, namespace: String, chainId: string, memo: string) => {
|
||||
const chainSpecs = {
|
||||
namespace,
|
||||
chainId,
|
||||
};
|
||||
|
||||
try {
|
||||
const unymAmount = chainSpecs.chainId === 'nyx'
|
||||
? Math.round(parseFloat(amount) * 1_000_000).toString()
|
||||
: amount;
|
||||
|
||||
// TODO: Pass the account info for transferring tokens
|
||||
// Get all accounts
|
||||
const chainAccounts = await retrieveAccountsForNetwork(
|
||||
`${chainSpecs.namespace}:${chainSpecs.chainId}`,
|
||||
`${namespace}:${chainId}`,
|
||||
'0' // Use the first account
|
||||
);
|
||||
|
||||
@ -137,7 +130,7 @@ export const useWebViewHandler = () => {
|
||||
}
|
||||
const chainAccount = chainAccounts[0]; // Use the first account
|
||||
|
||||
const path = `/transfer/${chainSpecs.namespace}/${chainSpecs.chainId}/${chainAccount.address}/${to}/${unymAmount}`;
|
||||
const path = `/transfer/${namespace}/${chainId}/${chainAccount.address}/${to}/${amount}`;
|
||||
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
@ -146,13 +139,12 @@ export const useWebViewHandler = () => {
|
||||
name: 'ApproveTransfer',
|
||||
path: path,
|
||||
params: {
|
||||
namespace: chainSpecs.namespace,
|
||||
chainId: `${chainSpecs.namespace}:${chainSpecs.chainId}`,
|
||||
namespace: namespace,
|
||||
chainId: `${namespace}:${chainId}`,
|
||||
transaction: {
|
||||
from: chainAccount.address,
|
||||
to: to,
|
||||
value: unymAmount,
|
||||
data: ''
|
||||
value: amount
|
||||
},
|
||||
accountInfo: chainAccount,
|
||||
memo: memo
|
||||
@ -161,7 +153,6 @@ export const useWebViewHandler = () => {
|
||||
],
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Navigation error:', error);
|
||||
if (window.Android?.onTransferError) {
|
||||
window.Android.onTransferError(`Navigation error: ${error}`);
|
||||
}
|
||||
|
@ -56,14 +56,13 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
// Extract data from route params or path
|
||||
const requestSession = route.params.requestSessionData;
|
||||
const requestName = requestSession?.peer.metadata.name;
|
||||
const requestIcon = requestSession?.peer.metadata.icons?.[0];
|
||||
const requestIcon = requestSession?.peer.metadata.icons[0];
|
||||
const requestURL = requestSession?.peer.metadata.url;
|
||||
const transaction = route.params.transaction;
|
||||
const requestEvent = route.params.requestEvent;
|
||||
const chainId = requestEvent?.params.chainId || route.params.chainId;
|
||||
const requestMethod = requestEvent?.params.request.method;
|
||||
const customMemo = route.params.memo;
|
||||
const finalMemo = customMemo || MEMO;
|
||||
const finalMemo = route.params.memo || MEMO;
|
||||
|
||||
const [account, setAccount] = useState<Account>();
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@ -206,6 +205,7 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
[navigation, requestedNetwork],
|
||||
);
|
||||
|
||||
//TODO: Handle ETH transactions
|
||||
const handleIntent = async () => {
|
||||
if (!account) {
|
||||
throw new Error('Account is not valid');
|
||||
@ -215,7 +215,7 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
from: account.address,
|
||||
to: transaction.to,
|
||||
amount: transaction.value,
|
||||
denom: requestedNetwork?.nativeDenom,
|
||||
denom: requestedNetwork!.nativeDenom,
|
||||
memo: finalMemo,
|
||||
gas: cosmosGasLimit,
|
||||
fees: fees
|
||||
@ -390,7 +390,6 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
|
||||
const { topic } = requestEvent;
|
||||
await web3wallet!.respondSessionRequest({ topic, response });
|
||||
navigation.navigate('Home');
|
||||
} else {
|
||||
await handleIntent();
|
||||
navigation.navigate('Home');
|
||||
@ -407,6 +406,8 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
};
|
||||
|
||||
const rejectRequestHandler = async () => {
|
||||
setIsTxLoading(true);
|
||||
try {
|
||||
if (requestEvent) {
|
||||
const response = rejectWalletConnectRequest(requestEvent);
|
||||
const { topic } = requestEvent;
|
||||
@ -421,6 +422,15 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
|
||||
} else {
|
||||
navigation.navigate('Home');
|
||||
}
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
setTxError(error.message);
|
||||
setIsTxErrorDialogOpen(true);
|
||||
}
|
||||
setIsTxLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -52,6 +52,8 @@ export const DEFAULT_NETWORKS: NetworksFormData[] = [
|
||||
gasPrice: '0.025',
|
||||
isDefault: true,
|
||||
},
|
||||
|
||||
//TODO: Add network from android app
|
||||
{
|
||||
chainId: 'nyx',
|
||||
networkName: 'Nym',
|
||||
@ -61,6 +63,8 @@ export const DEFAULT_NETWORKS: NetworksFormData[] = [
|
||||
nativeDenom: 'unym',
|
||||
addressPrefix: 'n',
|
||||
coinType: '118',
|
||||
|
||||
// Ref: https://nym.com/docs/operators/nodes/validator-setup#apptoml-configuration
|
||||
gasPrice: '0.025',
|
||||
isDefault: true,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user