From c1b685f52ad8b192041094478f03174e195b83e0 Mon Sep 17 00:00:00 2001
From: abefernan <44572727+abefernan@users.noreply.github.com>
Date: Tue, 11 Jun 2024 13:45:38 +0200
Subject: [PATCH 1/4] Add Fund pool and reorganize
---
.../dataViews/TransactionInfo/index.tsx | 32 +++++++----
.../forms/CreateTxForm/MsgForm/index.tsx | 54 +++++++++++--------
components/forms/CreateTxForm/index.tsx | 27 +++++++---
lib/txMsgHelpers.ts | 31 +++++++----
types/txMsg.ts | 45 +++++++++++-----
5 files changed, 125 insertions(+), 64 deletions(-)
diff --git a/components/dataViews/TransactionInfo/index.tsx b/components/dataViews/TransactionInfo/index.tsx
index 344b7e50..a6868b29 100644
--- a/components/dataViews/TransactionInfo/index.tsx
+++ b/components/dataViews/TransactionInfo/index.tsx
@@ -4,51 +4,61 @@ import { printableCoins } from "../../../lib/displayHelpers";
import { DbTransaction } from "../../../types";
import { MsgTypeUrls } from "../../../types/txMsg";
import StackableContainer from "../../layout/StackableContainer";
-import TxMsgClaimRewardsDetails from "./TxMsgClaimRewardsDetails";
+import TxMsgBeginRedelegateDetails from "./TxMsgBeginRedelegateDetails";
import TxMsgCreateVestingAccountDetails from "./TxMsgCreateVestingAccountDetails";
import TxMsgDelegateDetails from "./TxMsgDelegateDetails";
import TxMsgExecuteContractDetails from "./TxMsgExecuteContractDetails";
+import TxMsgFundCommunityPoolDetails from "./TxMsgFundCommunityPoolDetails";
import TxMsgInstantiateContract2Details from "./TxMsgInstantiateContract2Details";
import TxMsgInstantiateContractDetails from "./TxMsgInstantiateContractDetails";
import TxMsgMigrateContractDetails from "./TxMsgMigrateContractDetails";
-import TxMsgRedelegateDetails from "./TxMsgRedelegateDetails";
import TxMsgSendDetails from "./TxMsgSendDetails";
import TxMsgSetWithdrawAddressDetails from "./TxMsgSetWithdrawAddressDetails";
import TxMsgTransferDetails from "./TxMsgTransferDetails";
import TxMsgUndelegateDetails from "./TxMsgUndelegateDetails";
import TxMsgUpdateAdminDetails from "./TxMsgUpdateAdminDetails";
import TxMsgVoteDetails from "./TxMsgVoteDetails";
+import TxMsgWithdrawDelegatorRewardDetails from "./TxMsgWithdrawDelegatorRewardDetails";
const TxMsgDetails = ({ typeUrl, value: msgValue }: EncodeObject) => {
switch (typeUrl) {
+ // Bank
case MsgTypeUrls.Send:
return ;
+ // Staking
case MsgTypeUrls.Delegate:
return ;
case MsgTypeUrls.Undelegate:
return ;
case MsgTypeUrls.BeginRedelegate:
- return ;
- case MsgTypeUrls.WithdrawDelegatorReward:
- return ;
+ return ;
+ // Distribution
+ case MsgTypeUrls.FundCommunityPool:
+ return ;
case MsgTypeUrls.SetWithdrawAddress:
return ;
+ case MsgTypeUrls.WithdrawDelegatorReward:
+ return ;
+ // Vesting
case MsgTypeUrls.CreateVestingAccount:
return ;
+ // Governance
case MsgTypeUrls.Vote:
return ;
+ // IBC
case MsgTypeUrls.Transfer:
return ;
- case MsgTypeUrls.Execute:
- return ;
- case MsgTypeUrls.Instantiate:
+ // CosmWasm
+ case MsgTypeUrls.InstantiateContract:
return ;
- case MsgTypeUrls.Instantiate2:
+ case MsgTypeUrls.InstantiateContract2:
return ;
- case MsgTypeUrls.Migrate:
- return ;
case MsgTypeUrls.UpdateAdmin:
return ;
+ case MsgTypeUrls.ExecuteContract:
+ return ;
+ case MsgTypeUrls.MigrateContract:
+ return ;
default:
return null;
}
diff --git a/components/forms/CreateTxForm/MsgForm/index.tsx b/components/forms/CreateTxForm/MsgForm/index.tsx
index 122f12a9..8757b552 100644
--- a/components/forms/CreateTxForm/MsgForm/index.tsx
+++ b/components/forms/CreateTxForm/MsgForm/index.tsx
@@ -1,19 +1,20 @@
import { MsgGetter } from "..";
import { MsgTypeUrl, MsgTypeUrls } from "../../../../types/txMsg";
-import MsgClaimRewardsForm from "./MsgClaimRewardsForm";
+import MsgBeginRedelegateForm from "./MsgBeginRedelegateForm";
import MsgCreateVestingAccountForm from "./MsgCreateVestingAccountForm";
import MsgDelegateForm from "./MsgDelegateForm";
import MsgExecuteContractForm from "./MsgExecuteContractForm";
+import MsgFundCommunityPoolForm from "./MsgFundCommunityPoolForm";
import MsgInstantiateContract2Form from "./MsgInstantiateContract2Form";
import MsgInstantiateContractForm from "./MsgInstantiateContractForm";
import MsgMigrateContractForm from "./MsgMigrateContractForm";
-import MsgRedelegateForm from "./MsgRedelegateForm";
import MsgSendForm from "./MsgSendForm";
import MsgSetWithdrawAddressForm from "./MsgSetWithdrawAddressForm";
import MsgTransferForm from "./MsgTransferForm";
import MsgUndelegateForm from "./MsgUndelegateForm";
import MsgUpdateAdminForm from "./MsgUpdateAdminForm";
import MsgVoteForm from "./MsgVoteForm";
+import MsgWithdrawDelegatorRewardForm from "./MsgWithdrawDelegatorRewardForm";
interface MsgFormProps {
readonly msgType: MsgTypeUrl;
@@ -22,36 +23,45 @@ interface MsgFormProps {
readonly deleteMsg: () => void;
}
-const MsgForm = ({ msgType, senderAddress, ...restProps }: MsgFormProps) => {
+const MsgForm = ({ msgType, ...restProps }: MsgFormProps) => {
switch (msgType) {
+ // Bank
case MsgTypeUrls.Send:
- return ;
+ return ;
+ // Staking
case MsgTypeUrls.Delegate:
- return ;
+ return ;
case MsgTypeUrls.Undelegate:
- return ;
+ return ;
case MsgTypeUrls.BeginRedelegate:
- return ;
- case MsgTypeUrls.WithdrawDelegatorReward:
- return ;
+ return ;
+ // Distribution
+ case MsgTypeUrls.FundCommunityPool:
+ return ;
case MsgTypeUrls.SetWithdrawAddress:
- return ;
+ return ;
+ case MsgTypeUrls.WithdrawDelegatorReward:
+ return ;
+ // Vesting
case MsgTypeUrls.CreateVestingAccount:
- return ;
+ return ;
+ // Governance
case MsgTypeUrls.Vote:
- return ;
+ return ;
+ // IBC
case MsgTypeUrls.Transfer:
- return ;
- case MsgTypeUrls.Execute:
- return ;
- case MsgTypeUrls.Instantiate:
- return ;
- case MsgTypeUrls.Instantiate2:
- return ;
- case MsgTypeUrls.Migrate:
- return ;
+ return ;
+ // CosmWasm
+ case MsgTypeUrls.InstantiateContract:
+ return ;
+ case MsgTypeUrls.InstantiateContract2:
+ return ;
case MsgTypeUrls.UpdateAdmin:
- return ;
+ return ;
+ case MsgTypeUrls.ExecuteContract:
+ return ;
+ case MsgTypeUrls.MigrateContract:
+ return ;
default:
return null;
}
diff --git a/components/forms/CreateTxForm/index.tsx b/components/forms/CreateTxForm/index.tsx
index a9a9b9d8..2ef46c01 100644
--- a/components/forms/CreateTxForm/index.tsx
+++ b/components/forms/CreateTxForm/index.tsx
@@ -229,11 +229,14 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro
/>
+
+
+
-
-
@@ -242,6 +245,12 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro
onClick={() => addMsgType(MsgTypeUrls.SetWithdrawAddress)}
/>
+ -
+
@@ -250,20 +259,26 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro
-
- addMsgType(MsgTypeUrls.Migrate)} />
+ addMsgType(MsgTypeUrls.MigrateContract)}
+ />
{
switch (msgType) {
+ // Bank
case MsgTypeUrls.Send:
return 100_000;
- case MsgTypeUrls.SetWithdrawAddress:
- return 100_000;
- case MsgTypeUrls.WithdrawDelegatorReward:
- return 100_000;
- case MsgTypeUrls.BeginRedelegate:
- return 400_000;
+ // Staking
case MsgTypeUrls.Delegate:
// This is enough for 1 delegation and 1 autoclaim. But it is probably too low for
// a lot of auto-claims. See https://github.com/cosmos/cosmos-multisig-ui/issues/177.
return 400_000;
case MsgTypeUrls.Undelegate:
return 400_000;
+ case MsgTypeUrls.BeginRedelegate:
+ return 400_000;
+ // Distribution
+ case MsgTypeUrls.FundCommunityPool:
+ return 100_000;
+ case MsgTypeUrls.SetWithdrawAddress:
+ return 100_000;
+ case MsgTypeUrls.WithdrawDelegatorReward:
+ return 100_000;
+ // Vesting
case MsgTypeUrls.CreateVestingAccount:
return 100_000;
+ // Governance
case MsgTypeUrls.Vote:
return 100_000;
+ // IBC
case MsgTypeUrls.Transfer:
return 180_000;
- case MsgTypeUrls.Execute:
+ // CosmWasm
+ case MsgTypeUrls.InstantiateContract:
return 150_000;
- case MsgTypeUrls.Instantiate:
+ case MsgTypeUrls.InstantiateContract2:
return 150_000;
- case MsgTypeUrls.Instantiate2:
+ case MsgTypeUrls.UpdateAdmin:
return 150_000;
- case MsgTypeUrls.Migrate:
+ case MsgTypeUrls.ExecuteContract:
return 150_000;
- case MsgTypeUrls.UpdateAdmin:
+ case MsgTypeUrls.MigrateContract:
return 150_000;
default:
throw new Error("Unknown msg type");
diff --git a/types/txMsg.ts b/types/txMsg.ts
index 166b96b0..b5b96167 100644
--- a/types/txMsg.ts
+++ b/types/txMsg.ts
@@ -1,5 +1,6 @@
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import {
+ MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
@@ -20,37 +21,53 @@ import {
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
export const MsgTypeUrls = {
+ // Bank
Send: "/cosmos.bank.v1beta1.MsgSend",
- SetWithdrawAddress: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
- WithdrawDelegatorReward: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
- BeginRedelegate: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
+ // Staking
Delegate: "/cosmos.staking.v1beta1.MsgDelegate",
Undelegate: "/cosmos.staking.v1beta1.MsgUndelegate",
+ BeginRedelegate: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
+ // Distribution
+ FundCommunityPool: "/cosmos.distribution.v1beta1.MsgFundCommunityPool",
+ SetWithdrawAddress: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
+ WithdrawDelegatorReward: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
+ // Vesting
CreateVestingAccount: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount",
+ // Governance
Vote: "/cosmos.gov.v1beta1.MsgVote",
+ // IBC
Transfer: "/ibc.applications.transfer.v1.MsgTransfer",
- Execute: "/cosmwasm.wasm.v1.MsgExecuteContract",
- Instantiate: "/cosmwasm.wasm.v1.MsgInstantiateContract",
- Instantiate2: "/cosmwasm.wasm.v1.MsgInstantiateContract2",
- Migrate: "/cosmwasm.wasm.v1.MsgMigrateContract",
+ // CosmWasm
+ InstantiateContract: "/cosmwasm.wasm.v1.MsgInstantiateContract",
+ InstantiateContract2: "/cosmwasm.wasm.v1.MsgInstantiateContract2",
UpdateAdmin: "/cosmwasm.wasm.v1.MsgUpdateAdmin",
+ ExecuteContract: "/cosmwasm.wasm.v1.MsgExecuteContract",
+ MigrateContract: "/cosmwasm.wasm.v1.MsgMigrateContract",
} as const;
export type MsgTypeUrl = (typeof MsgTypeUrls)[keyof typeof MsgTypeUrls];
export const MsgCodecs = {
+ // Bank
[MsgTypeUrls.Send]: MsgSend,
- [MsgTypeUrls.SetWithdrawAddress]: MsgSetWithdrawAddress,
- [MsgTypeUrls.WithdrawDelegatorReward]: MsgWithdrawDelegatorReward,
- [MsgTypeUrls.BeginRedelegate]: MsgBeginRedelegate,
+ // Staking
[MsgTypeUrls.Delegate]: MsgDelegate,
[MsgTypeUrls.Undelegate]: MsgUndelegate,
+ [MsgTypeUrls.BeginRedelegate]: MsgBeginRedelegate,
+ // Distribution
+ [MsgTypeUrls.FundCommunityPool]: MsgFundCommunityPool,
+ [MsgTypeUrls.SetWithdrawAddress]: MsgSetWithdrawAddress,
+ [MsgTypeUrls.WithdrawDelegatorReward]: MsgWithdrawDelegatorReward,
+ // Vesting
[MsgTypeUrls.CreateVestingAccount]: MsgCreateVestingAccount,
+ // Governance
[MsgTypeUrls.Vote]: MsgVote,
+ // IBC
[MsgTypeUrls.Transfer]: MsgTransfer,
- [MsgTypeUrls.Execute]: MsgExecuteContract,
- [MsgTypeUrls.Instantiate]: MsgInstantiateContract,
- [MsgTypeUrls.Instantiate2]: MsgInstantiateContract2,
- [MsgTypeUrls.Migrate]: MsgMigrateContract,
+ // CosmWasm
+ [MsgTypeUrls.InstantiateContract]: MsgInstantiateContract,
+ [MsgTypeUrls.InstantiateContract2]: MsgInstantiateContract2,
[MsgTypeUrls.UpdateAdmin]: MsgUpdateAdmin,
+ [MsgTypeUrls.ExecuteContract]: MsgExecuteContract,
+ [MsgTypeUrls.MigrateContract]: MsgMigrateContract,
};
From 8606f8306c4e01871e4612c8a50e43bc6f4d3417 Mon Sep 17 00:00:00 2001
From: abefernan <44572727+abefernan@users.noreply.github.com>
Date: Tue, 11 Jun 2024 13:49:03 +0200
Subject: [PATCH 2/4] Add new Fund pool details
---
.../TxMsgFundCommunityPoolDetails.tsx | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 components/dataViews/TransactionInfo/TxMsgFundCommunityPoolDetails.tsx
diff --git a/components/dataViews/TransactionInfo/TxMsgFundCommunityPoolDetails.tsx b/components/dataViews/TransactionInfo/TxMsgFundCommunityPoolDetails.tsx
new file mode 100644
index 00000000..ce5e1af6
--- /dev/null
+++ b/components/dataViews/TransactionInfo/TxMsgFundCommunityPoolDetails.tsx
@@ -0,0 +1,50 @@
+import { MsgFundCommunityPool } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
+import { useChains } from "../../../context/ChainsContext";
+import { printableCoins } from "../../../lib/displayHelpers";
+
+interface TxMsgFundCommunityPoolDetailsProps {
+ readonly msgValue: MsgFundCommunityPool;
+}
+
+const TxMsgFundCommunityPoolDetails = ({ msgValue }: TxMsgFundCommunityPoolDetailsProps) => {
+ const { chain } = useChains();
+
+ return (
+ <>
+
+ MsgFundCommunityPool
+
+
+
+ {printableCoins(msgValue.amount, chain) || "None"}
+
+
+ >
+ );
+};
+
+export default TxMsgFundCommunityPoolDetails;
From 049dc64863c33ab209617e303325112eb2d1f03d Mon Sep 17 00:00:00 2001
From: abefernan <44572727+abefernan@users.noreply.github.com>
Date: Tue, 11 Jun 2024 13:49:15 +0200
Subject: [PATCH 3/4] Add new Fund pool form
---
.../MsgForm/MsgFundCommunityPoolForm.tsx | 194 ++++++++++++++++++
1 file changed, 194 insertions(+)
create mode 100644 components/forms/CreateTxForm/MsgForm/MsgFundCommunityPoolForm.tsx
diff --git a/components/forms/CreateTxForm/MsgForm/MsgFundCommunityPoolForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgFundCommunityPoolForm.tsx
new file mode 100644
index 00000000..91539eb4
--- /dev/null
+++ b/components/forms/CreateTxForm/MsgForm/MsgFundCommunityPoolForm.tsx
@@ -0,0 +1,194 @@
+import { EncodeObject } from "@cosmjs/proto-signing";
+import { useEffect, useState } from "react";
+import { MsgGetter } from "..";
+import { useChains } from "../../../../context/ChainsContext";
+import { displayCoinToBaseCoin } from "../../../../lib/coinHelpers";
+import { trimStringsObj } from "../../../../lib/displayHelpers";
+import { RegistryAsset } from "../../../../types/chainRegistry";
+import { MsgCodecs, MsgTypeUrls } from "../../../../types/txMsg";
+import Input from "../../../inputs/Input";
+import Select from "../../../inputs/Select";
+import StackableContainer from "../../../layout/StackableContainer";
+
+const customDenomOption = { label: "Custom (enter denom below)", value: "custom" } as const;
+
+const getDenomOptions = (assets: readonly RegistryAsset[]) => {
+ if (!assets?.length) {
+ return [customDenomOption];
+ }
+
+ return [...assets.map((asset) => ({ label: asset.symbol, value: asset })), customDenomOption];
+};
+
+interface MsgFundCommunityPoolFormProps {
+ readonly senderAddress: string;
+ readonly setMsgGetter: (msgGetter: MsgGetter) => void;
+ readonly deleteMsg: () => void;
+}
+
+const MsgFundCommunityPoolForm = ({
+ senderAddress,
+ setMsgGetter,
+ deleteMsg,
+}: MsgFundCommunityPoolFormProps) => {
+ const { chain } = useChains();
+
+ const denomOptions = getDenomOptions(chain.assets);
+
+ const [selectedDenom, setSelectedDenom] = useState(denomOptions[0]);
+ const [customDenom, setCustomDenom] = useState("");
+ const [amount, setAmount] = useState("0");
+
+ const [customDenomError, setCustomDenomError] = useState("");
+ const [amountError, setAmountError] = useState("");
+
+ const trimmedInputs = trimStringsObj({ customDenom, amount });
+
+ useEffect(() => {
+ // eslint-disable-next-line no-shadow
+ const { customDenom, amount } = trimmedInputs;
+
+ const isMsgValid = (): boolean => {
+ setCustomDenomError("");
+ setAmountError("");
+
+ if (
+ selectedDenom.value === customDenomOption.value &&
+ !customDenom &&
+ amount &&
+ amount !== "0"
+ ) {
+ setCustomDenomError("Custom denom must be set because of selection above");
+ return false;
+ }
+
+ if (!amount || Number(amount) <= 0) {
+ setAmountError("Amount must be greater than 0");
+ return false;
+ }
+
+ if (selectedDenom.value === customDenomOption.value && !Number.isInteger(Number(amount))) {
+ setAmountError("Amount cannot be decimal for custom denom");
+ return false;
+ }
+
+ try {
+ displayCoinToBaseCoin({ denom, amount }, chain.assets);
+ } catch (e: unknown) {
+ setAmountError(e instanceof Error ? e.message : "Could not set decimals");
+ return false;
+ }
+
+ return true;
+ };
+
+ const denom =
+ selectedDenom.value === customDenomOption.value ? customDenom : selectedDenom.value.symbol;
+
+ const microCoin = (() => {
+ try {
+ if (!denom || !amount || amount === "0") {
+ return null;
+ }
+
+ return displayCoinToBaseCoin({ denom, amount }, chain.assets);
+ } catch {
+ return null;
+ }
+ })();
+
+ const msgValue = MsgCodecs[MsgTypeUrls.FundCommunityPool].fromPartial({
+ depositor: senderAddress,
+ amount: microCoin ? [microCoin] : [],
+ });
+
+ const msg: EncodeObject = { typeUrl: MsgTypeUrls.FundCommunityPool, value: msgValue };
+
+ setMsgGetter({ isMsgValid, msg });
+ }, [chain.assets, selectedDenom.value, senderAddress, setMsgGetter, trimmedInputs]);
+
+ return (
+
+ deleteMsg()}>
+ ✕
+
+ MsgFundCommunityPool
+
+
+
+ {selectedDenom.value === customDenomOption.value ? (
+
+ {
+ setCustomDenom(target.value);
+ setCustomDenomError("");
+ }}
+ placeholder={
+ selectedDenom.value === customDenomOption.value
+ ? "Enter custom denom"
+ : "Select Custom denom above"
+ }
+ disabled={selectedDenom.value !== customDenomOption.value}
+ error={customDenomError}
+ />
+
+ ) : null}
+
+ {
+ setAmount(target.value);
+ setAmountError("");
+ }}
+ error={amountError}
+ />
+
+
+
+ );
+};
+
+export default MsgFundCommunityPoolForm;
From 085856d3916de2f71ea580618d9e70626f5c4f79 Mon Sep 17 00:00:00 2001
From: abefernan <44572727+abefernan@users.noreply.github.com>
Date: Tue, 11 Jun 2024 13:54:04 +0200
Subject: [PATCH 4/4] Tweak namings
---
...ls.tsx => TxMsgBeginRedelegateDetails.tsx} | 6 ++---
...> TxMsgWithdrawDelegatorRewardDetails.tsx} | 8 ++++---
...ateForm.tsx => MsgBeginRedelegateForm.tsx} | 23 +++++++++++--------
.../MsgForm/MsgCreateVestingAccountForm.tsx | 8 +++----
.../CreateTxForm/MsgForm/MsgDelegateForm.tsx | 8 +++----
.../MsgForm/MsgExecuteContractForm.tsx | 15 +++++++-----
.../MsgForm/MsgInstantiateContract2Form.tsx | 12 +++++-----
.../MsgForm/MsgInstantiateContractForm.tsx | 12 +++++-----
.../MsgForm/MsgMigrateContractForm.tsx | 15 +++++++-----
.../CreateTxForm/MsgForm/MsgSendForm.tsx | 8 +++----
.../MsgForm/MsgSetWithdrawAddressForm.tsx | 8 +++----
.../CreateTxForm/MsgForm/MsgTransferForm.tsx | 8 +++----
.../MsgForm/MsgUndelegateForm.tsx | 12 ++++------
.../MsgForm/MsgUpdateAdminForm.tsx | 12 ++++++----
.../CreateTxForm/MsgForm/MsgVoteForm.tsx | 8 +++----
...tsx => MsgWithdrawDelegatorRewardForm.tsx} | 16 ++++++-------
16 files changed, 95 insertions(+), 84 deletions(-)
rename components/dataViews/TransactionInfo/{TxMsgRedelegateDetails.tsx => TxMsgBeginRedelegateDetails.tsx} (90%)
rename components/dataViews/TransactionInfo/{TxMsgClaimRewardsDetails.tsx => TxMsgWithdrawDelegatorRewardDetails.tsx} (82%)
rename components/forms/CreateTxForm/MsgForm/{MsgRedelegateForm.tsx => MsgBeginRedelegateForm.tsx} (91%)
rename components/forms/CreateTxForm/MsgForm/{MsgClaimRewardsForm.tsx => MsgWithdrawDelegatorRewardForm.tsx} (88%)
diff --git a/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx b/components/dataViews/TransactionInfo/TxMsgBeginRedelegateDetails.tsx
similarity index 90%
rename from components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx
rename to components/dataViews/TransactionInfo/TxMsgBeginRedelegateDetails.tsx
index 66a39dba..5cca2da3 100644
--- a/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx
+++ b/components/dataViews/TransactionInfo/TxMsgBeginRedelegateDetails.tsx
@@ -4,11 +4,11 @@ import { useChains } from "../../../context/ChainsContext";
import { printableCoin } from "../../../lib/displayHelpers";
import HashView from "../HashView";
-interface TxMsgRedelegateDetailsProps {
+interface TxMsgBeginRedelegateDetailsProps {
readonly msgValue: MsgBeginRedelegate;
}
-const TxMsgRedelegateDetails = ({ msgValue }: TxMsgRedelegateDetailsProps) => {
+const TxMsgBeginRedelegateDetails = ({ msgValue }: TxMsgBeginRedelegateDetailsProps) => {
const { chain } = useChains();
assert(
msgValue.amount,
@@ -65,4 +65,4 @@ const TxMsgRedelegateDetails = ({ msgValue }: TxMsgRedelegateDetailsProps) => {
);
};
-export default TxMsgRedelegateDetails;
+export default TxMsgBeginRedelegateDetails;
diff --git a/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx b/components/dataViews/TransactionInfo/TxMsgWithdrawDelegatorRewardDetails.tsx
similarity index 82%
rename from components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx
rename to components/dataViews/TransactionInfo/TxMsgWithdrawDelegatorRewardDetails.tsx
index 5df21937..319dedad 100644
--- a/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx
+++ b/components/dataViews/TransactionInfo/TxMsgWithdrawDelegatorRewardDetails.tsx
@@ -1,11 +1,13 @@
import { MsgWithdrawDelegatorReward } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import HashView from "../HashView";
-interface TxMsgClaimRewardsDetailsProps {
+interface TxMsgWithdrawDelegatorRewardDetailsProps {
readonly msgValue: MsgWithdrawDelegatorReward;
}
-const TxMsgClaimRewardsDetails = ({ msgValue }: TxMsgClaimRewardsDetailsProps) => (
+const TxMsgWithdrawDelegatorRewardDetails = ({
+ msgValue,
+}: TxMsgWithdrawDelegatorRewardDetailsProps) => (
<>
MsgWithdrawDelegatorReward
@@ -44,4 +46,4 @@ const TxMsgClaimRewardsDetails = ({ msgValue }: TxMsgClaimRewardsDetailsProps) =
>
);
-export default TxMsgClaimRewardsDetails;
+export default TxMsgWithdrawDelegatorRewardDetails;
diff --git a/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgBeginRedelegateForm.tsx
similarity index 91%
rename from components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx
rename to components/forms/CreateTxForm/MsgForm/MsgBeginRedelegateForm.tsx
index 2f7a4335..1227598c 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgBeginRedelegateForm.tsx
@@ -1,5 +1,5 @@
import SelectValidator from "@/components/SelectValidator";
-import { EncodeObject } from "@cosmjs/proto-signing";
+import { MsgBeginRedelegateEncodeObject } from "@cosmjs/stargate";
import { useEffect, useState } from "react";
import { MsgGetter } from "..";
import { useChains } from "../../../../context/ChainsContext";
@@ -9,17 +9,17 @@ import { MsgCodecs, MsgTypeUrls } from "../../../../types/txMsg";
import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
-interface MsgRedelegateFormProps {
- readonly delegatorAddress: string;
+interface MsgBeginRedelegateFormProps {
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgRedelegateForm = ({
- delegatorAddress,
+const MsgBeginRedelegateForm = ({
+ senderAddress,
setMsgGetter,
deleteMsg,
-}: MsgRedelegateFormProps) => {
+}: MsgBeginRedelegateFormProps) => {
const { chain } = useChains();
const [validatorSrcAddress, setValidatorSrcAddress] = useState("");
@@ -81,13 +81,16 @@ const MsgRedelegateForm = ({
})();
const msgValue = MsgCodecs[MsgTypeUrls.BeginRedelegate].fromPartial({
- delegatorAddress,
+ delegatorAddress: senderAddress,
validatorSrcAddress,
validatorDstAddress,
amount: microCoin,
});
- const msg: EncodeObject = { typeUrl: MsgTypeUrls.BeginRedelegate, value: msgValue };
+ const msg: MsgBeginRedelegateEncodeObject = {
+ typeUrl: MsgTypeUrls.BeginRedelegate,
+ value: msgValue,
+ };
setMsgGetter({ isMsgValid, msg });
}, [
@@ -95,7 +98,7 @@ const MsgRedelegateForm = ({
chain.assets,
chain.chainId,
chain.displayDenom,
- delegatorAddress,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
@@ -173,4 +176,4 @@ const MsgRedelegateForm = ({
);
};
-export default MsgRedelegateForm;
+export default MsgBeginRedelegateForm;
diff --git a/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx
index 13d33a2e..0849da28 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx
@@ -13,13 +13,13 @@ import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
interface MsgCreateVestingAccountFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgCreateVestingAccountForm = ({
- fromAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgCreateVestingAccountFormProps) => {
@@ -87,7 +87,7 @@ const MsgCreateVestingAccountForm = ({
})();
const msgValue = MsgCodecs[MsgTypeUrls.CreateVestingAccount].fromPartial({
- fromAddress,
+ fromAddress: senderAddress,
toAddress,
amount: microCoin ? [microCoin] : [],
endTime: timestampFromDatetimeLocal(endTime, "s"),
@@ -103,7 +103,7 @@ const MsgCreateVestingAccountForm = ({
chain.chainId,
chain.displayDenom,
delayed,
- fromAddress,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx
index 53ef890d..34141472 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx
@@ -10,12 +10,12 @@ import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
interface MsgDelegateFormProps {
- readonly delegatorAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgDelegateForm = ({ delegatorAddress, setMsgGetter, deleteMsg }: MsgDelegateFormProps) => {
+const MsgDelegateForm = ({ senderAddress, setMsgGetter, deleteMsg }: MsgDelegateFormProps) => {
const { chain } = useChains();
const [validatorAddress, setValidatorAddress] = useState("");
@@ -66,7 +66,7 @@ const MsgDelegateForm = ({ delegatorAddress, setMsgGetter, deleteMsg }: MsgDeleg
})();
const msgValue = MsgCodecs[MsgTypeUrls.Delegate].fromPartial({
- delegatorAddress,
+ delegatorAddress: senderAddress,
validatorAddress,
amount: microCoin,
});
@@ -79,7 +79,7 @@ const MsgDelegateForm = ({ delegatorAddress, setMsgGetter, deleteMsg }: MsgDeleg
chain.assets,
chain.chainId,
chain.displayDenom,
- delegatorAddress,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx
index ec795bce..db6b434b 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx
@@ -25,13 +25,13 @@ const getDenomOptions = (assets: ChainInfo["assets"]) => {
};
interface MsgExecuteContractFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgExecuteContractForm = ({
- fromAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgExecuteContractFormProps) => {
@@ -126,23 +126,26 @@ const MsgExecuteContractForm = ({
}
})();
- const msgValue = MsgCodecs[MsgTypeUrls.Execute].fromPartial({
- sender: fromAddress,
+ const msgValue = MsgCodecs[MsgTypeUrls.ExecuteContract].fromPartial({
+ sender: senderAddress,
contract: contractAddress,
msg: msgContentUtf8Array,
funds: microCoin ? [microCoin] : [],
});
- const msg: MsgExecuteContractEncodeObject = { typeUrl: MsgTypeUrls.Execute, value: msgValue };
+ const msg: MsgExecuteContractEncodeObject = {
+ typeUrl: MsgTypeUrls.ExecuteContract,
+ value: msgValue,
+ };
setMsgGetter({ isMsgValid, msg });
}, [
chain.addressPrefix,
chain.assets,
chain.chainId,
- fromAddress,
msgContent,
selectedDenom.value,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx
index d2d9ab25..858b0158 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx
@@ -25,13 +25,13 @@ const getDenomOptions = (assets: ChainInfo["assets"]) => {
};
interface MsgInstantiateContract2FormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgInstantiateContract2Form = ({
- fromAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgInstantiateContract2FormProps) => {
@@ -163,8 +163,8 @@ const MsgInstantiateContract2Form = ({
}
})();
- const msgValue = MsgCodecs[MsgTypeUrls.Instantiate2].fromPartial({
- sender: fromAddress,
+ const msgValue = MsgCodecs[MsgTypeUrls.InstantiateContract2].fromPartial({
+ sender: senderAddress,
codeId: BigInt(codeId),
label,
admin: adminAddress,
@@ -175,7 +175,7 @@ const MsgInstantiateContract2Form = ({
});
const msg: MsgInstantiateContract2EncodeObject = {
- typeUrl: MsgTypeUrls.Instantiate2,
+ typeUrl: MsgTypeUrls.InstantiateContract2,
value: msgValue,
};
@@ -184,9 +184,9 @@ const MsgInstantiateContract2Form = ({
chain.addressPrefix,
chain.assets,
chain.chainId,
- fromAddress,
msgContent,
selectedDenom.value,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx
index 256b915c..186dd8f5 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx
@@ -25,13 +25,13 @@ const getDenomOptions = (assets: ChainInfo["assets"]) => {
};
interface MsgInstantiateContractFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgInstantiateContractForm = ({
- fromAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgInstantiateContractFormProps) => {
@@ -141,8 +141,8 @@ const MsgInstantiateContractForm = ({
}
})();
- const msgValue = MsgCodecs[MsgTypeUrls.Instantiate].fromPartial({
- sender: fromAddress,
+ const msgValue = MsgCodecs[MsgTypeUrls.InstantiateContract].fromPartial({
+ sender: senderAddress,
codeId: BigInt(codeId),
label,
admin: adminAddress,
@@ -151,7 +151,7 @@ const MsgInstantiateContractForm = ({
});
const msg: MsgInstantiateContractEncodeObject = {
- typeUrl: MsgTypeUrls.Instantiate,
+ typeUrl: MsgTypeUrls.InstantiateContract,
value: msgValue,
};
@@ -160,9 +160,9 @@ const MsgInstantiateContractForm = ({
chain.addressPrefix,
chain.assets,
chain.chainId,
- fromAddress,
msgContent,
selectedDenom.value,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgMigrateContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgMigrateContractForm.tsx
index b0e77558..2d177b58 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgMigrateContractForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgMigrateContractForm.tsx
@@ -12,13 +12,13 @@ import StackableContainer from "../../../layout/StackableContainer";
const JsonEditor = dynamic(() => import("../../../inputs/JsonEditor"), { ssr: false });
interface MsgMigrateContractFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgMigrateContractForm = ({
- fromAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgMigrateContractFormProps) => {
@@ -69,17 +69,20 @@ const MsgMigrateContractForm = ({
}
})();
- const msgValue = MsgCodecs[MsgTypeUrls.Migrate].fromPartial({
- sender: fromAddress,
+ const msgValue = MsgCodecs[MsgTypeUrls.MigrateContract].fromPartial({
+ sender: senderAddress,
contract: contractAddress,
codeId: BigInt(codeId),
msg: msgContentUtf8Array,
});
- const msg: MsgMigrateContractEncodeObject = { typeUrl: MsgTypeUrls.Migrate, value: msgValue };
+ const msg: MsgMigrateContractEncodeObject = {
+ typeUrl: MsgTypeUrls.MigrateContract,
+ value: msgValue,
+ };
setMsgGetter({ isMsgValid, msg });
- }, [chain.addressPrefix, chain.chainId, fromAddress, msgContent, setMsgGetter, trimmedInputs]);
+ }, [chain.addressPrefix, chain.chainId, msgContent, senderAddress, setMsgGetter, trimmedInputs]);
return (
diff --git a/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx
index 02f7c50d..d5b0a7ac 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx
@@ -21,12 +21,12 @@ const getDenomOptions = (assets: readonly RegistryAsset[]) => {
};
interface MsgSendFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgSendForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgSendFormProps) => {
+const MsgSendForm = ({ senderAddress, setMsgGetter, deleteMsg }: MsgSendFormProps) => {
const { chain } = useChains();
const denomOptions = getDenomOptions(chain.assets);
@@ -103,7 +103,7 @@ const MsgSendForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgSendFormProps)
})();
const msgValue = MsgCodecs[MsgTypeUrls.Send].fromPartial({
- fromAddress,
+ fromAddress: senderAddress,
toAddress,
amount: microCoin ? [microCoin] : [],
});
@@ -115,8 +115,8 @@ const MsgSendForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgSendFormProps)
chain.addressPrefix,
chain.assets,
chain.chainId,
- fromAddress,
selectedDenom.value,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgSetWithdrawAddressForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgSetWithdrawAddressForm.tsx
index 4081bff3..b9027798 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgSetWithdrawAddressForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgSetWithdrawAddressForm.tsx
@@ -8,13 +8,13 @@ import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
interface MsgSetWithdrawAddressFormProps {
- readonly delegatorAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
const MsgSetWithdrawAddressForm = ({
- delegatorAddress,
+ senderAddress,
setMsgGetter,
deleteMsg,
}: MsgSetWithdrawAddressFormProps) => {
@@ -42,13 +42,13 @@ const MsgSetWithdrawAddressForm = ({
};
const msgValue = MsgCodecs[MsgTypeUrls.SetWithdrawAddress].fromPartial({
- delegatorAddress,
+ delegatorAddress: senderAddress,
withdrawAddress,
});
const msg: EncodeObject = { typeUrl: MsgTypeUrls.SetWithdrawAddress, value: msgValue };
setMsgGetter({ isMsgValid, msg });
- }, [chain.addressPrefix, chain.chainId, delegatorAddress, setMsgGetter, trimmedInputs]);
+ }, [chain.addressPrefix, chain.chainId, senderAddress, setMsgGetter, trimmedInputs]);
return (
diff --git a/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx
index 6c89d346..895b7b4a 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx
@@ -24,12 +24,12 @@ const humanTimestampOptions = [
];
interface MsgTransferFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgTransferForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgTransferFormProps) => {
+const MsgTransferForm = ({ senderAddress, setMsgGetter, deleteMsg }: MsgTransferFormProps) => {
const { chain } = useChains();
const [toAddress, setToAddress] = useState("");
@@ -107,7 +107,7 @@ const MsgTransferForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgTransferFo
};
const msgValue = MsgCodecs[MsgTypeUrls.Transfer].fromPartial({
- sender: fromAddress,
+ sender: senderAddress,
receiver: toAddress,
token: { denom, amount },
sourcePort,
@@ -119,7 +119,7 @@ const MsgTransferForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgTransferFo
const msg: MsgTransferEncodeObject = { typeUrl: MsgTypeUrls.Transfer, value: msgValue };
setMsgGetter({ isMsgValid, msg });
- }, [chain.chainId, fromAddress, setMsgGetter, trimmedInputs]);
+ }, [chain.chainId, senderAddress, setMsgGetter, trimmedInputs]);
return (
diff --git a/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx
index 4d6fbb7e..0138c909 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx
@@ -10,16 +10,12 @@ import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
interface MsgUndelegateFormProps {
- readonly delegatorAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgUndelegateForm = ({
- delegatorAddress,
- setMsgGetter,
- deleteMsg,
-}: MsgUndelegateFormProps) => {
+const MsgUndelegateForm = ({ senderAddress, setMsgGetter, deleteMsg }: MsgUndelegateFormProps) => {
const { chain } = useChains();
const [validatorAddress, setValidatorAddress] = useState("");
@@ -70,7 +66,7 @@ const MsgUndelegateForm = ({
})();
const msgValue = MsgCodecs[MsgTypeUrls.Undelegate].fromPartial({
- delegatorAddress,
+ delegatorAddress: senderAddress,
validatorAddress,
amount: microCoin,
});
@@ -83,7 +79,7 @@ const MsgUndelegateForm = ({
chain.assets,
chain.chainId,
chain.displayDenom,
- delegatorAddress,
+ senderAddress,
setMsgGetter,
trimmedInputs,
]);
diff --git a/components/forms/CreateTxForm/MsgForm/MsgUpdateAdminForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgUpdateAdminForm.tsx
index ced812ba..85b86576 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgUpdateAdminForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgUpdateAdminForm.tsx
@@ -8,12 +8,16 @@ import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
interface MsgUpdateAdminFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgUpdateAdminForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgUpdateAdminFormProps) => {
+const MsgUpdateAdminForm = ({
+ senderAddress,
+ setMsgGetter,
+ deleteMsg,
+}: MsgUpdateAdminFormProps) => {
const { chain } = useChains();
const [contractAddress, setContractAddress] = useState("");
@@ -52,7 +56,7 @@ const MsgUpdateAdminForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgUpdateA
};
const msgValue = MsgCodecs[MsgTypeUrls.UpdateAdmin].fromPartial({
- sender: fromAddress,
+ sender: senderAddress,
contract: contractAddress,
newAdmin: newAdminAddress,
});
@@ -60,7 +64,7 @@ const MsgUpdateAdminForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgUpdateA
const msg: MsgUpdateAdminEncodeObject = { typeUrl: MsgTypeUrls.UpdateAdmin, value: msgValue };
setMsgGetter({ isMsgValid, msg });
- }, [chain.addressPrefix, chain.chainId, fromAddress, setMsgGetter, trimmedInputs]);
+ }, [chain.addressPrefix, chain.chainId, senderAddress, setMsgGetter, trimmedInputs]);
return (
diff --git a/components/forms/CreateTxForm/MsgForm/MsgVoteForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgVoteForm.tsx
index 7618e25e..b46949d6 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgVoteForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgVoteForm.tsx
@@ -20,12 +20,12 @@ const selectVoteOptions = voteOptions.map((opt) => {
});
interface MsgVoteFormProps {
- readonly fromAddress: string;
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgVoteForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgVoteFormProps) => {
+const MsgVoteForm = ({ senderAddress, setMsgGetter, deleteMsg }: MsgVoteFormProps) => {
const [proposalId, setProposalId] = useState("0");
const [selectedVote, setSelectedVote] = useState(selectVoteOptions[0]);
@@ -64,7 +64,7 @@ const MsgVoteForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgVoteFormProps)
})();
const msgValue = MsgCodecs[MsgTypeUrls.Vote].fromPartial({
- voter: fromAddress,
+ voter: senderAddress,
proposalId: proposalIdBigInt,
option: selectedVote.value,
});
@@ -72,7 +72,7 @@ const MsgVoteForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgVoteFormProps)
const msg: MsgVoteEncodeObject = { typeUrl: MsgTypeUrls.Vote, value: msgValue };
setMsgGetter({ isMsgValid, msg });
- }, [fromAddress, selectedVote.value, setMsgGetter, trimmedInputs]);
+ }, [selectedVote.value, senderAddress, setMsgGetter, trimmedInputs]);
return (
diff --git a/components/forms/CreateTxForm/MsgForm/MsgClaimRewardsForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgWithdrawDelegatorRewardForm.tsx
similarity index 88%
rename from components/forms/CreateTxForm/MsgForm/MsgClaimRewardsForm.tsx
rename to components/forms/CreateTxForm/MsgForm/MsgWithdrawDelegatorRewardForm.tsx
index 64eb5075..742062b5 100644
--- a/components/forms/CreateTxForm/MsgForm/MsgClaimRewardsForm.tsx
+++ b/components/forms/CreateTxForm/MsgForm/MsgWithdrawDelegatorRewardForm.tsx
@@ -8,17 +8,17 @@ import { MsgCodecs, MsgTypeUrls } from "../../../../types/txMsg";
import Input from "../../../inputs/Input";
import StackableContainer from "../../../layout/StackableContainer";
-interface MsgClaimRewardsFormProps {
- readonly delegatorAddress: string;
+interface MsgWithdrawDelegatorRewardFormProps {
+ readonly senderAddress: string;
readonly setMsgGetter: (msgGetter: MsgGetter) => void;
readonly deleteMsg: () => void;
}
-const MsgClaimRewardsForm = ({
- delegatorAddress,
+const MsgWithdrawDelegatorRewardForm = ({
+ senderAddress,
setMsgGetter,
deleteMsg,
-}: MsgClaimRewardsFormProps) => {
+}: MsgWithdrawDelegatorRewardFormProps) => {
const { chain } = useChains();
const [validatorAddress, setValidatorAddress] = useState("");
@@ -45,7 +45,7 @@ const MsgClaimRewardsForm = ({
};
const msgValue = MsgCodecs[MsgTypeUrls.WithdrawDelegatorReward].fromPartial({
- delegatorAddress,
+ delegatorAddress: senderAddress,
validatorAddress,
});
@@ -55,7 +55,7 @@ const MsgClaimRewardsForm = ({
};
setMsgGetter({ isMsgValid, msg });
- }, [chain.addressPrefix, chain.chainId, delegatorAddress, setMsgGetter, trimmedInputs]);
+ }, [chain.addressPrefix, chain.chainId, senderAddress, setMsgGetter, trimmedInputs]);
return (
@@ -100,4 +100,4 @@ const MsgClaimRewardsForm = ({
);
};
-export default MsgClaimRewardsForm;
+export default MsgWithdrawDelegatorRewardForm;