Skip to content

Commit

Permalink
fix: multi-mfx mint/burn large numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Nov 26, 2024
1 parent b1b4794 commit f0a4d46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions components/factory/modals/multiMfxBurnModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { chainName } from '@/config';
import { cosmos, osmosis, liftedinit } from '@liftedinit/manifestjs';
import { Any } from '@liftedinit/manifestjs/dist/codegen/google/protobuf/any';

import { ExtendedMetadataSDKType } from '@/utils';
import { ExtendedMetadataSDKType, parseNumberToBigInt } from '@/utils';

interface BurnPair {
address: string;
Expand Down Expand Up @@ -83,7 +83,7 @@ export function MultiBurnModal({
burnCoins: [
{
denom: denom?.base ?? '',
amount: BigInt(parseFloat(pair.amount) * Math.pow(10, exponent)).toString(),
amount: parseNumberToBigInt(pair.amount, exponent).toString(),
},
],
})
Expand Down
9 changes: 3 additions & 6 deletions components/factory/modals/multiMfxMintModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { chainName } from '@/config';
import { cosmos, liftedinit } from '@liftedinit/manifestjs';
import { Any } from '@liftedinit/manifestjs/dist/codegen/google/protobuf/any';
import { MsgPayout } from '@liftedinit/manifestjs/dist/codegen/liftedinit/manifest/v1/tx';
import { ExtendedMetadataSDKType } from '@/utils';
import { ExtendedMetadataSDKType, parseNumberToBigInt } from '@/utils';
//TODO: find max mint amount from team for mfx. Find tx size limit for max payout pairs
interface PayoutPair {
address: string;
Expand All @@ -30,10 +30,7 @@ interface MultiMintModalProps {

const PayoutPairSchema = Yup.object().shape({
address: Yup.string().manifestAddress().required('Required'),
amount: Yup.number()
.positive('Amount must be positive')
.required('Required')
.max(100000, 'Amount too large'),
amount: Yup.number().positive('Amount must be positive').required('Required'),
});

const MultiMintSchema = Yup.object().shape({
Expand Down Expand Up @@ -89,7 +86,7 @@ export function MultiMintModal({
address: pair.address,
coin: {
denom: denom?.base ?? '',
amount: BigInt(parseFloat(pair.amount) * Math.pow(10, exponent)).toString(),
amount: parseNumberToBigInt(pair.amount, exponent).toString(),
},
})),
});
Expand Down

0 comments on commit f0a4d46

Please sign in to comment.