bridge_ui: remove max from native
Change-Id: Iea26581292b1c51441b7328daa85c1459d9b0be8
This commit is contained in:
parent
4f2f6922cd
commit
3491a1370b
|
@ -5,18 +5,19 @@ import {
|
|||
TextFieldProps,
|
||||
} from "@material-ui/core";
|
||||
|
||||
export default function NumberTextField(
|
||||
props: TextFieldProps & { onMaxClick?: () => void }
|
||||
) {
|
||||
export default function NumberTextField({
|
||||
onMaxClick,
|
||||
...props
|
||||
}: TextFieldProps & { onMaxClick?: () => void }) {
|
||||
return (
|
||||
<TextField
|
||||
type="number"
|
||||
{...props}
|
||||
InputProps={{
|
||||
endAdornment: props.onMaxClick ? (
|
||||
endAdornment: onMaxClick ? (
|
||||
<InputAdornment position="end">
|
||||
<Button
|
||||
onClick={props.onMaxClick}
|
||||
onClick={onMaxClick}
|
||||
disabled={props.disabled}
|
||||
variant="outlined"
|
||||
>
|
||||
|
|
|
@ -150,7 +150,11 @@ function Source() {
|
|||
value={amount}
|
||||
onChange={handleAmountChange}
|
||||
disabled={shouldLockFields}
|
||||
onMaxClick={uiAmountString ? handleMaxClick : undefined}
|
||||
onMaxClick={
|
||||
uiAmountString && !parsedTokenAccount.isNativeAsset
|
||||
? handleMaxClick
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
<ButtonWithLoader
|
||||
|
|
|
@ -3,6 +3,8 @@ const MM_ERR_WITH_INFO_START =
|
|||
const parseError = (e: any) =>
|
||||
e?.data?.message?.startsWith(MM_ERR_WITH_INFO_START)
|
||||
? e.data.message.replace(MM_ERR_WITH_INFO_START, "")
|
||||
: e?.response?.data?.error // terra error
|
||||
? e.response.data.error
|
||||
: e?.message
|
||||
? e.message
|
||||
: "An unknown error occurred";
|
||||
|
|
|
@ -40,6 +40,12 @@ export async function waitForTerraExecution(transaction: TxResult) {
|
|||
console.error(e);
|
||||
}
|
||||
}
|
||||
if (info.code !== undefined) {
|
||||
// error code
|
||||
throw new Error(
|
||||
`Tx ${transaction.result.txhash}: error code ${info.code}: ${info.raw_log}`
|
||||
);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -62,7 +68,7 @@ export async function postWithFees(
|
|||
msgs: any[],
|
||||
memo: string
|
||||
) {
|
||||
try {
|
||||
// don't try/catch, let errors propagate
|
||||
const lcd = new LCDClient(TERRA_HOST);
|
||||
//let gasPrices = await lcd.config.gasPrices //Unsure if the values returned from this are hardcoded or not.
|
||||
//Thus, we are going to pull it directly from the current FCD.
|
||||
|
@ -73,7 +79,11 @@ export async function postWithFees(
|
|||
const feeEstimate = await lcd.tx.estimateFee(
|
||||
wallet.walletAddress,
|
||||
[...msgs],
|
||||
{ memo, feeDenoms: ["uluna"], gasPrices }
|
||||
{
|
||||
memo,
|
||||
feeDenoms: ["uluna"],
|
||||
gasPrices,
|
||||
}
|
||||
);
|
||||
|
||||
const result = await wallet.post({
|
||||
|
@ -85,7 +95,4 @@ export async function postWithFees(
|
|||
});
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue