Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve create multisig errors #229

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading