Skip to content

Commit

Permalink
fix: execute denom creation and metadata in the same tx (#227)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Felix C. Morency <[email protected]>
  • Loading branch information
chalabi2 and fmorency authored Jan 31, 2025
1 parent 75fc3c5 commit a4ea712
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions components/factory/forms/ConfirmationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@ export default function ConfirmationForm({
subdenom: prefixedSubdenom,
});

const createDenomFee = await estimateFee(address, [createDenomMsg]);
const createDenomResult = await tx([createDenomMsg], {
fee: createDenomFee,
returnError: true,
});

if (createDenomResult && createDenomResult.error) {
console.error('Error creating denom:', createDenomResult.error);
return;
}

// If createDenom is successful, proceed with setDenomMetadata
const setMetadataMsg = setDenomMetadata({
sender: address,
Expand All @@ -145,8 +134,8 @@ export default function ConfirmationForm({
},
});

const setMetadataFee = await estimateFee(address, [setMetadataMsg]);
await tx([setMetadataMsg], {
const setMetadataFee = await estimateFee(address, [createDenomMsg, setMetadataMsg]);
await tx([createDenomMsg, setMetadataMsg], {
fee: setMetadataFee,
onSuccess: () => {
nextStep();
Expand All @@ -172,13 +161,6 @@ export default function ConfirmationForm({
</div>

<div className="space-y-6">
{!formData.isGroup && (
<div className="text-md">
You will be required to sign two messages: the first to create the token on the
blockchain, and the second to configure the token&#39;s metadata, including its name,
ticker, description, and other details.
</div>
)}
{/* Token Information */}
<div>
<h2 className="text-xl font-semibold mb-4 ">Token Information</h2>
Expand Down

0 comments on commit a4ea712

Please sign in to comment.