From e2a0d5124a8ad129df7a52de29a4ac2f997326bc Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Wed, 12 Apr 2023 17:01:40 +0200 Subject: [PATCH] Remove amount input from form --- components/forms/RewardsForm.tsx | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/components/forms/RewardsForm.tsx b/components/forms/RewardsForm.tsx index c8e3ff7..484587c 100644 --- a/components/forms/RewardsForm.tsx +++ b/components/forms/RewardsForm.tsx @@ -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)})}`} /> -