Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed balance formatting in dropdown (#181) #182

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 4 additions & 5 deletions src/components/elements/input/token/selector/row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@
}

function formatBalanceString(balanceString: string) {
if (balanceString.length < 9) {
return balanceString
}

const balanceInIntegers = balanceString.split('.')[0]
const decimals = balanceString.split('.')[1]

if (balanceInIntegers.length < 8) {
return balanceInIntegers
return decimals?.length === 0
? balanceString
: `${balanceInIntegers}.${decimals.substring(0, 4)}`
}

return `${Number(balanceInIntegers) / 1000000} M`
Expand Down
6 changes: 5 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ export const chains: ChainConfig[] = [
},
{
id: 'proton',
chainFeatures: new Set([ChainFeatures.Staking, ChainFeatures.VoteProducer]),
chainFeatures: new Set([
ChainFeatures.BuyRAM,
ChainFeatures.Staking,
ChainFeatures.VoteProducer,
]),
chainId: ChainId.from('384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0'),
coreTokenSymbol: Asset.Symbol.from('4,XPR'),
coreTokenContract: Name.from('eosio.token'),
Expand Down
Loading