Remove amount input from form
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Decimal } from "@cosmjs/math";
|
||||
import { Account, calculateFee } from "@cosmjs/stargate";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import axios from "axios";
|
||||
@@ -20,27 +19,18 @@ interface Props {
|
||||
const RewardsForm = (props: Props) => {
|
||||
const { state } = useAppContext();
|
||||
const [validatorAddress, setValidatorAddress] = useState("");
|
||||
const [amount, setAmount] = useState("0");
|
||||
const [memo, setMemo] = useState("");
|
||||
const [gas, setGas] = useState(200000);
|
||||
const [gasPrice, _setGasPrice] = useState(state.chain.gasPrice);
|
||||
const [_processing, setProcessing] = useState(false);
|
||||
const [addressError, setAddressError] = useState("");
|
||||
|
||||
const createTransaction = (txValidatorAddress: string, txAmount: string, gasLimit: number) => {
|
||||
const createTransaction = (txValidatorAddress: string, gasLimit: number) => {
|
||||
assert(Number.isSafeInteger(gasLimit) && gasLimit > 0, "gas limit must be a positive integer");
|
||||
|
||||
const amountInAtomics = Decimal.fromUserInput(
|
||||
txAmount,
|
||||
Number(state.chain.displayDenomExponent),
|
||||
).atomics;
|
||||
const msgDelegatorReward = {
|
||||
delegatorAddress: props.address,
|
||||
validatorAddress: txValidatorAddress,
|
||||
amount: {
|
||||
amount: amountInAtomics,
|
||||
denom: state.chain.denom,
|
||||
},
|
||||
};
|
||||
const msg = {
|
||||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
|
||||
@@ -71,7 +61,7 @@ const RewardsForm = (props: Props) => {
|
||||
}
|
||||
|
||||
setProcessing(true);
|
||||
const tx = createTransaction(validatorAddress, amount, gas);
|
||||
const tx = createTransaction(validatorAddress, gas);
|
||||
console.log(tx, "tx data");
|
||||
const dataJSON = JSON.stringify(tx);
|
||||
const res = await axios.post("/api/transaction", { dataJSON });
|
||||
@@ -98,15 +88,6 @@ const RewardsForm = (props: Props) => {
|
||||
placeholder={`E.g. ${exampleValidatorAddress(0, state.chain.addressPrefix)})}`}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-item">
|
||||
<Input
|
||||
label={`Amount (${state.chain.displayDenom})`}
|
||||
name="amount"
|
||||
type="number"
|
||||
value={amount}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setAmount(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-item">
|
||||
<Input
|
||||
label="Gas Limit"
|
||||
|
||||
Reference in New Issue
Block a user