From 4109330829c834642c26900ec15b3d2b4355619a Mon Sep 17 00:00:00 2001 From: Ross Bulat Date: Mon, 2 Dec 2024 23:53:30 +0700 Subject: [PATCH] chore: partial fee fallback --- packages/app/src/hooks/useBondGreatestFee/index.tsx | 6 ++++-- packages/app/src/hooks/useSubmitExtrinsic/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/app/src/hooks/useBondGreatestFee/index.tsx b/packages/app/src/hooks/useBondGreatestFee/index.tsx index 2f6b97cd9f..014c449c4d 100644 --- a/packages/app/src/hooks/useBondGreatestFee/index.tsx +++ b/packages/app/src/hooks/useBondGreatestFee/index.tsx @@ -48,8 +48,10 @@ export const useBondGreatestFee = ({ bondFor }: { bondFor: BondFor }) => { tx = new StakingBondExtra(network, BigInt(bond)).tx(); } - if (tx) { - const { partial_fee } = await tx.getPaymentInfo(activeAccount || ''); + if (tx && activeAccount) { + const partial_fee = + (await tx?.getPaymentInfo(activeAccount))?.partial_fee || 0n; + return new BigNumber(partial_fee.toString()); } return new BigNumber(0); diff --git a/packages/app/src/hooks/useSubmitExtrinsic/index.tsx b/packages/app/src/hooks/useSubmitExtrinsic/index.tsx index aa6ac31eff..2a46c96046 100644 --- a/packages/app/src/hooks/useSubmitExtrinsic/index.tsx +++ b/packages/app/src/hooks/useSubmitExtrinsic/index.tsx @@ -276,8 +276,8 @@ export const useSubmitExtrinsic = ({ if (!tx) { return; } - const fee = (await tx.getPaymentInfo(from)).partial_fee; - TxSubmission.updateFee(uid, fee); + const partial_fee = (await tx?.getPaymentInfo(from)?.partial_fee) || 0n; + TxSubmission.updateFee(uid, partial_fee); }; if (uid > 0) { fetchTxFee();