Skip to content

Commit

Permalink
refactor(LSK): use min fee from adamant-wallets & rename LSK_COMMAND_FEE
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Dec 22, 2023
1 parent f7804e2 commit 84dd30a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/lisk/lisk-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const LiskHashSettings = {
export const LSK_CHAIN_ID = '00000000'
export const LSK_TOKEN_ID = '0000000000000000'
export const LSK_DECIMALS = CryptosInfo.LSK.decimals
export const LSK_MIN_REQUIRED_FEE = BigInt(164000) // in beddows
export const LSK_COMMAND_FEE = BigInt(5000000) // additional fee when sending to new accounts (@see https://lisk.com/documentation/understand-blockchain/blocks-txs.html#command-fee)
export const LSK_MIN_REQUIRED_FEE = BigInt(CryptosInfo.LSK.defaultFee * 10 ** LSK_DECIMALS) // in beddows
export const LSK_TRANSFER_TO_NEW_ACCOUNT_FEE = BigInt(5000000) // additional fee when sending to new accounts (@see https://lisk.com/documentation/understand-blockchain/blocks-txs.html#command-fee)
export const LSK_TXS_PER_PAGE = 25 // transactions per page

// Used for estimating fee
Expand Down
6 changes: 3 additions & 3 deletions src/lib/lisk/lisk-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import sodium from 'sodium-browserify-tweetnacl'
import {
LiskHashSettings,
LSK_CHAIN_ID,
LSK_COMMAND_FEE,
LSK_TRANSFER_TO_NEW_ACCOUNT_FEE,
LSK_DECIMALS,
LSK_DEMO_ACCOUNT,
LSK_MIN_REQUIRED_FEE,
Expand Down Expand Up @@ -259,9 +259,9 @@ export function estimateFee(params?: EstimateFeeParams) {

const minFee = computeMinFee(signedTransaction, TRANSACTION_PARAMS_SCHEMA)
const fee = minFee < LSK_MIN_REQUIRED_FEE ? LSK_MIN_REQUIRED_FEE : minFee
const commandFee = isNewAccount ? LSK_COMMAND_FEE : BigInt(0)
const transferToNewAccountFee = isNewAccount ? LSK_TRANSFER_TO_NEW_ACCOUNT_FEE : BigInt(0)

const totalFee = fee + commandFee
const totalFee = fee + transferToNewAccountFee

return convertBeddowsToLSK(totalFee.toString())
}

0 comments on commit 84dd30a

Please sign in to comment.