Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

LIVE-1292 Cover Polkadot existential deposit edge case #1953

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/families/polkadot/js-getTransactionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ const getSendTransactionStatus = async (
const minimumBalanceExistential = getMinimumBalance(a);
const leftover = a.spendableBalance.minus(totalSpent);

if (
if (a.spendableBalance.lte(EXISTENTIAL_DEPOSIT)) {
errors.amount = new NotEnoughBalance();
} else if (
minimumBalanceExistential.gt(0) &&
leftover.lt(minimumBalanceExistential) &&
leftover.gt(0)
Expand Down
5 changes: 5 additions & 0 deletions src/families/polkadot/js-signOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const MODE_TO_TYPE = {
};
const MODE_TO_PALLET_METHOD = {
send: "balances.transferKeepAlive",
sendMax: "balances.transfer",
bond: "staking.bond",
bondExtra: "staking.bondExtra",
unbond: "staking.unbond",
Expand All @@ -52,6 +53,10 @@ const getExtra = (type: string, account: Account, transaction: Transaction) => {
}
: {};

if (transaction.mode == "send" && transaction.useAllAmount) {
extra.palletMethod = MODE_TO_PALLET_METHOD["sendMax"];
}

This conversation was marked as resolved.
Show resolved Hide resolved
switch (type) {
case "OUT":
return { ...extra, transferAmount: new BigNumber(transaction.amount) };
Expand Down
2 changes: 1 addition & 1 deletion src/families/polkadot/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Account, OperationType } from "../../types";
import type { Transaction } from "./types";
import { getCurrentPolkadotPreloadData } from "./preload";

export const EXISTENTIAL_DEPOSIT = new BigNumber(10000000000);
export const EXISTENTIAL_DEPOSIT = new BigNumber(11000000000);
This conversation was marked as resolved.
Show resolved Hide resolved
export const MAX_NOMINATIONS = 16;
export const MAX_UNLOCKINGS = 32;
export const PRELOAD_MAX_AGE = 60 * 1000;
Expand Down