From f0a4d468ac0a2126cb2cc230cb5f57cbf93f5eca Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:14:26 -0500 Subject: [PATCH] fix: multi-mfx mint/burn large numbers --- components/factory/modals/multiMfxBurnModal.tsx | 4 ++-- components/factory/modals/multiMfxMintModal.tsx | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/factory/modals/multiMfxBurnModal.tsx b/components/factory/modals/multiMfxBurnModal.tsx index 7a583554..8f3da005 100644 --- a/components/factory/modals/multiMfxBurnModal.tsx +++ b/components/factory/modals/multiMfxBurnModal.tsx @@ -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; @@ -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(), }, ], }) diff --git a/components/factory/modals/multiMfxMintModal.tsx b/components/factory/modals/multiMfxMintModal.tsx index 7a8dab52..62733d3e 100644 --- a/components/factory/modals/multiMfxMintModal.tsx +++ b/components/factory/modals/multiMfxMintModal.tsx @@ -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; @@ -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({ @@ -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(), }, })), });