Add helper for formatting cryptocurrencies

This commit is contained in:
2020-08-13 15:19:17 +02:00
parent ec6b72008d
commit f1bd20a6f4
3 changed files with 42 additions and 17 deletions
+18
View File
@@ -0,0 +1,18 @@
import { helper } from '@ember/component/helper';
export default helper(function fmtCryptoCurrency(params/*, hash*/) {
let fmtAmount;
const amount = params[0];
const code = params[1];
switch(code) {
case 'ETH':
fmtAmount = amount / 1000000000000000000;
break;
case 'WBTC':
fmtAmount = amount / 100000000;
break;
}
return fmtAmount;
});