-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #567 from logion-network/feature/purge-multicoin
Completely remove fake multicoin support
- Loading branch information
Showing
43 changed files
with
490 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Lgnt, Numbers, TypesAccountData } from "@logion/node-api"; | ||
import { useMemo } from "react"; | ||
|
||
export function useAvailableMemo(balance: TypesAccountData | undefined) { | ||
return useMemo(() => { | ||
if(balance) { | ||
return toOptimizedNumber(balance.available); | ||
} else { | ||
return Numbers.PrefixedNumber.ZERO; | ||
} | ||
}, [ balance ]); | ||
} | ||
|
||
export function toOptimizedNumber(amount: Lgnt) { | ||
return amount.toPrefixedNumber().optimizeScale(3); | ||
} | ||
|
||
export function balanceLevel(amount: Numbers.PrefixedNumber) { | ||
return amount.toNumber() === 0 ? 0 : 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import { CoinBalance } from "@logion/node-api"; | ||
import CoinName from "src/components/coin/CoinName"; | ||
import { Lgnt, Numbers } from "@logion/node-api"; | ||
|
||
export interface Props { | ||
balance: CoinBalance; | ||
unit: Numbers.UnitPrefix; | ||
} | ||
|
||
export default function AssetNameCell(props: Props) { | ||
|
||
return ( | ||
<div className="asset-name-cell"> | ||
<span className="name"><CoinName coinId={ props.balance.coin.id }/> ({ props.balance.available.prefix.symbol }{ props.balance.coin.symbol })</span> | ||
<span className="name">Logion Token ({ props.unit.symbol }{ Lgnt.CODE })</span> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Lgnt, TypesAccountData } from "@logion/node-api"; | ||
import Gauge from "./Gauge"; | ||
import { balanceLevel, useAvailableMemo } from "./Amount"; | ||
|
||
export interface Props { | ||
balance?: TypesAccountData; | ||
} | ||
|
||
export default function BalanceGauge(props: Props) { | ||
|
||
const balance = useAvailableMemo(props.balance); | ||
|
||
return ( | ||
<Gauge | ||
readingIntegerPart={ balance.coefficient.toInteger() } | ||
readingDecimalPart={ balance.coefficient.toFixedPrecisionDecimals(2) } | ||
unit={ balance.prefix.symbol + Lgnt.CODE } | ||
level={ balanceLevel(balance) } | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Lgnt, TypesAccountData } from '@logion/node-api'; | ||
import './Reading.css'; | ||
import Reading from './Reading'; | ||
import { balanceLevel, useAvailableMemo } from './Amount'; | ||
|
||
export interface Props { | ||
balance?: TypesAccountData; | ||
} | ||
|
||
export default function BalanceReading(props: Props) { | ||
|
||
const balance = useAvailableMemo(props.balance); | ||
|
||
return ( | ||
<Reading | ||
readingIntegerPart={ balance.coefficient.toInteger() } | ||
readingDecimalPart={ balance.coefficient.toFixedPrecisionDecimals(2) } | ||
unit={ balance.prefix.symbol + Lgnt.CODE } | ||
level={ balanceLevel(balance) } | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.