Skip to content

Commit

Permalink
revert transaction payment revert after RTU
Browse files Browse the repository at this point in the history
  • Loading branch information
Leouarz committed Oct 21, 2024
1 parent 8dea98b commit 4793e5a
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 19 deletions.
10 changes: 0 additions & 10 deletions packages/apps-config/src/api/typesBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16393,16 +16393,6 @@ export const typesBundle = {
"Cell": {
"row": "BlockLengthRows",
"col": "BlockLengthColumns"
},
"ProxyType": {
"_enum": [
"Any",
"NonTransfer",
"Governance",
"Staking",
"IdentityJudgement",
"NominationPools"
]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/Accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
locked: balancesAll.lockedBalance,
redeemable: stakingInfo?.redeemable || BN_ZERO,
total: balancesAll.freeBalance.add(balancesAll.reservedBalance),
transferable: balancesAll.availableBalance,
transferable: balancesAll.transferable || balancesAll.availableBalance,
unbonding: calcUnbonding(stakingInfo)
});

Expand Down
2 changes: 1 addition & 1 deletion packages/page-bounties/src/hooks/useBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function useBalanceImpl (accountId: string | null): Balance | undefined {
const { api } = useApi();
const balancesAll = useCall<DeriveBalancesAll>(api.derive.balances?.all, [accountId]);

return balancesAll?.availableBalance;
return balancesAll?.transferable || balancesAll?.availableBalance;
}

export const useBalance = createNamedHook('useBalance', useBalanceImpl);
2 changes: 1 addition & 1 deletion packages/page-staking2/src/Pools/useAmountError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function useAmountErrorImpl (accountId?: string | null, amount?: BN | null, minA
return useMemo(
() => !amount || amount.isZero() || !minAmount || minAmount.gt(amount) || (
!!balances &&
amount.gt(balances.availableBalance.sub(api.consts.balances.existentialDeposit))
amount.gt((balances.transferable || balances.availableBalance).sub(api.consts.balances.existentialDeposit))
),
[api, amount, balances, minAmount]
);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-components/src/AddressInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ function createBalanceItems (formatIndex: number, lookup: Record<string, string>
/>
</React.Fragment>
);
balancesAll && balanceDisplay.available && deriveBalances.availableBalance && allItems.push(
balancesAll && balanceDisplay.available && (deriveBalances.transferable || deriveBalances.availableBalance) && allItems.push(
<React.Fragment key={1}>
<Label label={t('transferable')} />
<FormatBalance
className='result'
formatIndex={formatIndex}
labelPost={<IconVoid />}
value={deriveBalances.availableBalance}
value={deriveBalances.transferable || deriveBalances.availableBalance}
/>
</React.Fragment>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-components/src/modals/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ function Transfer ({ className = '', onClose, recipientId: propRecipientId, send
if (balances && balances.accountId?.eq(fromId) && fromId && toId && api.call.transactionPaymentApi && api.tx.balances) {
nextTick(async (): Promise<void> => {
try {
const extrinsic = (api.tx.balances.transferAllowDeath || api.tx.balances.transfer)(toId, balances.availableBalance);
const extrinsic = (api.tx.balances.transferAllowDeath || api.tx.balances.transfer)(toId, (balances.transferable || balances.availableBalance));
const { partialFee } = await extrinsic.paymentInfo(fromId);
const adjFee = partialFee.muln(110).div(BN_HUNDRED);
const maxTransfer = balances.availableBalance.sub(adjFee);
const maxTransfer = (balances.transferable || balances.availableBalance).sub(adjFee);

setMaxTransfer(
api.consts.balances && maxTransfer.gt(api.consts.balances.existentialDeposit)
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/Available.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function AvailableDisplay ({ children, className = '', label, params }: Props):
<FormatBalance
className={className}
label={label}
value={allBalances?.availableBalance}
value={allBalances?.transferable || allBalances?.availableBalance}
>
{children}
</FormatBalance>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-signer/src/PaymentInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function PaymentInfo ({ accountId, className = '', extrinsic, isHeader }: Props)
}

const isFeeError = api.consts.balances && !(api.tx.balances?.transferAllowDeath?.is(extrinsic) || api.tx.balances?.transfer?.is(extrinsic)) && balances?.accountId.eq(accountId) && (
balances.availableBalance.lte(dispatchInfo.partialFee) ||
(balances.transferable || balances.availableBalance).lte(dispatchInfo.partialFee) ||
balances.freeBalance.sub(dispatchInfo.partialFee).lte(api.consts.balances.existentialDeposit)
);

Expand Down

0 comments on commit 4793e5a

Please sign in to comment.