From 50623614ab110b485fd77f7b667827ca1dc03933 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 9 Oct 2021 22:51:35 +0800 Subject: [PATCH] add sifchain starname --- .github/workflows/deploy.yaml | 4 ++-- src/lang/locales/en.json | 2 ++ src/libs/data/data.js | 12 ++++++++--- src/store/chains/sifchain.json | 7 +++++++ src/store/chains/starname.json | 7 +++++++ src/views/Summary.vue | 24 +++++++++++++++++---- src/views/SummaryAssetsComponent.vue | 4 ++-- src/views/WalletAccountDetail.vue | 10 ++++----- src/views/WalletAccounts.vue | 31 +++++++++++++++------------- 9 files changed, 71 insertions(+), 30 deletions(-) create mode 100644 src/store/chains/sifchain.json create mode 100644 src/store/chains/starname.json diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0a10243e..fd8613c8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,9 +3,9 @@ name: Ping Deploy on: push: - branches: [ v2 ] + branches: [ master ] pull_request: - branches: [ v2 ] + branches: [ master ] jobs: deploy: diff --git a/src/lang/locales/en.json b/src/lang/locales/en.json index 0a7c267e..3a2181fa 100644 --- a/src/lang/locales/en.json +++ b/src/lang/locales/en.json @@ -18,6 +18,8 @@ "juno": "Juno", "certik": "Certik", "sentinel": "Sentinel", + "sifchain": "Sifchain", + "starname": "Starname", "staking": "Staking", "governance": "Governance", diff --git a/src/libs/data/data.js b/src/libs/data/data.js index 89db9a97..f296a163 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -269,10 +269,16 @@ export function formatTokenDenom(tokenDenom) { } export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') { - if (denom.startsWith('u')) { - // for special case + let decimals = 1000000n + if (denom.startsWith('rowan')) { + decimals = 1000000000000000000n } - const amount = tokenAmount / 1000000 + let ta = tokenAmount + if (typeof tokenAmount === 'string' && tokenAmount.indexOf('.') > 1) { + ta = tokenAmount.substring(0, tokenAmount.indexOf('.')) + } + // eslint-disable-next-line no-undef + const amount = Number(BigInt(ta) / decimals) if (amount > 10) { return parseFloat(amount.toFixed(fraction)) } diff --git a/src/store/chains/sifchain.json b/src/store/chains/sifchain.json new file mode 100644 index 00000000..ec26103e --- /dev/null +++ b/src/store/chains/sifchain.json @@ -0,0 +1,7 @@ +{ + "chain_name": "sifchain", + "api": "https://api.sifchain.finance", + "sdk_version": "0.42.6", + "addr_prefix": "sif", + "logo": "https://dl.airtable.com/.attachments/990cb076d7566e53e976c1fa69d60b09/3c05e786/71144030.jpeg" +} \ No newline at end of file diff --git a/src/store/chains/starname.json b/src/store/chains/starname.json new file mode 100644 index 00000000..09eb8d92 --- /dev/null +++ b/src/store/chains/starname.json @@ -0,0 +1,7 @@ +{ + "chain_name": "starname", + "api": "http://lcd-private-iov-mainnet-2.iov.one", + "sdk_version": "0.42.6", + "addr_prefix": "star", + "logo": "https://dl.airtable.com/.attachments/69f75a1b45803d70d8ef69f7f83198e1/d991d407/ZUZfz7Th_400x400.jpg" +} \ No newline at end of file diff --git a/src/views/Summary.vue b/src/views/Summary.vue index 2aa1dbcd..17d02477 100644 --- a/src/views/Summary.vue +++ b/src/views/Summary.vue @@ -1,5 +1,13 @@