parse error message in abacus
This commit is contained in:
parent
74958ea3af
commit
fb21e27233
@ -39,7 +39,7 @@
|
||||
"@cosmjs/proto-signing": "^0.31.0",
|
||||
"@cosmjs/stargate": "^0.31.0",
|
||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||
"@dydxprotocol/v4-abacus": "^1.0.22",
|
||||
"@dydxprotocol/v4-abacus": "^1.0.24",
|
||||
"@dydxprotocol/v4-client-js": "^1.0.0",
|
||||
"@dydxprotocol/v4-localization": "^1.0.5",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
|
||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -27,8 +27,8 @@ dependencies:
|
||||
specifier: ^0.31.0
|
||||
version: 0.31.0
|
||||
'@dydxprotocol/v4-abacus':
|
||||
specifier: ^1.0.22
|
||||
version: 1.0.22
|
||||
specifier: ^1.0.24
|
||||
version: 1.0.24
|
||||
'@dydxprotocol/v4-client-js':
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
@ -982,8 +982,8 @@ packages:
|
||||
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
||||
dev: true
|
||||
|
||||
/@dydxprotocol/v4-abacus@1.0.22:
|
||||
resolution: {integrity: sha512-KLkBGY61T5xBYOS1WWDdH4Xk17TGJeDWuLmLEuQSdT4l0BKwasbI5F44ayBMyuu6vLvsP0iWSHtk5LlZHY5ChA==}
|
||||
/@dydxprotocol/v4-abacus@1.0.24:
|
||||
resolution: {integrity: sha512-wDGSjkrc3Se6Ev7UTjPgJV7PiyzZSz2mJwOTZikLwH7W3k1iPYGQmaCd7TudFk8h2aSdlEwNsQBCf0sLoyvHaQ==}
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-client-js@1.0.0:
|
||||
|
||||
@ -66,6 +66,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
resources,
|
||||
summary,
|
||||
errors: routeErrors,
|
||||
errorMessage: routeErrorMessage,
|
||||
} = useSelector(getTransferInputs, shallowEqual) || {};
|
||||
const chainId = chainIdStr ? parseInt(chainIdStr) : undefined;
|
||||
|
||||
@ -289,18 +290,12 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
}
|
||||
|
||||
if (routeErrors) {
|
||||
try {
|
||||
const parsedErrors = JSON.parse(routeErrors);
|
||||
if (parsedErrors?.[0]?.message) {
|
||||
return stringGetter({
|
||||
return routeErrorMessage
|
||||
? stringGetter({
|
||||
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
||||
params: { ERROR_MESSAGE: parsedErrors?.[0]?.message },
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
log('WithDrawForm/errorMessage', e);
|
||||
return stringGetter({ key: STRING_KEYS.SOMETHING_WENT_WRONG });
|
||||
}
|
||||
params: { ERROR_MESSAGE: routeErrorMessage },
|
||||
})
|
||||
: stringGetter({ key: STRING_KEYS.SOMETHING_WENT_WRONG });
|
||||
}
|
||||
|
||||
if (fromAmount) {
|
||||
@ -316,7 +311,16 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}, [error, routeErrors, balance, chainId, fromAmount, sourceToken, stringGetter]);
|
||||
}, [
|
||||
error,
|
||||
routeErrors,
|
||||
routeErrorMessage,
|
||||
balance,
|
||||
chainId,
|
||||
fromAmount,
|
||||
sourceToken,
|
||||
stringGetter,
|
||||
]);
|
||||
|
||||
const isDisabled =
|
||||
Boolean(errorMessage) ||
|
||||
|
||||
@ -70,6 +70,7 @@ export const WithdrawForm = () => {
|
||||
address: toAddress,
|
||||
resources,
|
||||
errors: routeErrors,
|
||||
errorMessage: routeErrorMessage,
|
||||
} = useSelector(getTransferInputs, shallowEqual) || {};
|
||||
|
||||
const isValidAddress = toAddress && isAddress(toAddress);
|
||||
@ -283,18 +284,12 @@ export const WithdrawForm = () => {
|
||||
}
|
||||
|
||||
if (routeErrors) {
|
||||
try {
|
||||
const parsedErrors = JSON.parse(routeErrors);
|
||||
if (parsedErrors?.[0]?.message) {
|
||||
return stringGetter({
|
||||
return routeErrorMessage
|
||||
? stringGetter({
|
||||
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
||||
params: { ERROR_MESSAGE: parsedErrors?.[0]?.message },
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
log('WithDrawForm/errorMessage', e);
|
||||
return stringGetter({ key: STRING_KEYS.SOMETHING_WENT_WRONG });
|
||||
}
|
||||
params: { ERROR_MESSAGE: routeErrorMessage },
|
||||
})
|
||||
: stringGetter({ key: STRING_KEYS.SOMETHING_WENT_WRONG });
|
||||
}
|
||||
|
||||
if (!toAddress) return stringGetter({ key: STRING_KEYS.WITHDRAW_MUST_SPECIFY_ADDRESS });
|
||||
@ -320,6 +315,7 @@ export const WithdrawForm = () => {
|
||||
}, [
|
||||
error,
|
||||
routeErrors,
|
||||
routeErrorMessage,
|
||||
freeCollateralBN,
|
||||
chainIdStr,
|
||||
debouncedAmountBN,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user