mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-04-23 08:28:02 +00:00
28b991d61d
* Add documentation on GH pages * Expand classes for doc generation * Update docs * .nojekyll * Update Identicon.tsx * Update Demo.tsx * Update KeyPair.tsx * Export specific icons * Convert tests to TypeScript
24 lines
404 B
Markdown
24 lines
404 B
Markdown
# @polkadot/ui-util
|
|
|
|
Various utility and formatting functions
|
|
|
|
## formatBalance
|
|
|
|
```js
|
|
const props = await api.rpc.system.properties();
|
|
|
|
formatBalance.setDefaults({
|
|
decimals: props.tokenDecimals,
|
|
unit: props.tokenSymbol
|
|
});
|
|
|
|
formatBalance('12345'); // 12.345z DOT
|
|
```
|
|
|
|
## calcSi
|
|
|
|
```js
|
|
// calculates the SI unit applicable
|
|
formatBalance.calcSi('12345'); // { power: 3, value: 'k', text: 'Kilo' }
|
|
```
|