Skip to content

Commit

Permalink
Merge pull request #229 from cosmos/fix/create-ms-errors
Browse files Browse the repository at this point in the history
Improve create multisig errors
  • Loading branch information
abefernan authored Jul 1, 2024
2 parents ec30554 + 20ebcfa commit ee602ee
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions components/forms/CreateMultisigForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export default function CreateMultisigForm() {
}, [createMultisigForm, watchedMembers]);

const submitCreateMultisig = async () => {
// Caution: threshold is string instead of number
const { members, threshold } = createMultisigForm.getValues();

const pubkeys = await Promise.all(
members
.filter(({ member }) => member !== "")
.map(async ({ member }) => {
try {
try {
// Caution: threshold is string instead of number
const { members, threshold } = createMultisigForm.getValues();

const pubkeys = await Promise.all(
members
.filter(({ member }) => member !== "")
.map(async ({ member }) => {
if (!member.startsWith(chain.addressPrefix)) {
return member;
}
Expand All @@ -81,17 +81,15 @@ export default function CreateMultisigForm() {
const accountOnChain = await client.getAccount(member);

if (!accountOnChain || !accountOnChain.pubkey) {
return member;
throw new Error(
`Member "${member}" is not a pubkey and is not on chain. It needs to send a transaction to appear on chain or you can provide its pubkey`,
);
}

return String(accountOnChain.pubkey.value);
} catch {
return member;
}
}),
);
}),
);

try {
const { bech32Address: address } = await getKeplrKey(chain.chainId);

const multisigAddress = await createMultisigFromCompressedSecp256k1Pubkeys(
Expand Down

0 comments on commit ee602ee

Please sign in to comment.