Skip to content

Commit

Permalink
Merge pull request #78 from Cerebellum-Network/hotfix/0.11.2
Browse files Browse the repository at this point in the history
hotfix v0.11.2
  • Loading branch information
Andrei Navoichyk authored May 6, 2022
2 parents 3b6e98e + 28c9e24 commit ee27fd1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REACT_APP_SUPPORT_URL="https://t.me/ceretroubleshooting"
REACT_APP_SENTRY_DSN_URL="https://3d39fa05d843482eb93377947b435b5b@o318183.ingest.sentry.io/5987177"
REACT_APP_SENTRY_ENV=development
SENTRY_AUTH_TOKEN="db67ae12222811ecabd2564b6436d30d"
REACT_APP_SENTRY_RELEASE="0.11.1"
REACT_APP_SENTRY_RELEASE="0.11.2"

REACT_APP_MAINTENANCE=false
REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true
2 changes: 1 addition & 1 deletion .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REACT_APP_SUPPORT_URL="https://t.me/ceretroubleshooting"
REACT_APP_SENTRY_DSN_URL="https://3d39fa05d843482eb93377947b435b5b@o318183.ingest.sentry.io/5987177"
REACT_APP_SENTRY_ENV=production
SENTRY_AUTH_TOKEN="db67ae12222811ecabd2564b6436d30d"
REACT_APP_SENTRY_RELEASE="0.11.1"
REACT_APP_SENTRY_RELEASE="0.11.2"

REACT_APP_MAINTENANCE=false
REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true
2 changes: 1 addition & 1 deletion .env.stage
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REACT_APP_SUPPORT_URL="https://t.me/ceretroubleshooting"
REACT_APP_SENTRY_DSN_URL="https://3d39fa05d843482eb93377947b435b5b@o318183.ingest.sentry.io/5987177"
REACT_APP_SENTRY_ENV=staging
SENTRY_AUTH_TOKEN="db67ae12222811ecabd2564b6436d30d"
REACT_APP_SENTRY_RELEASE="0.11.1"
REACT_APP_SENTRY_RELEASE="0.11.2"

REACT_APP_MAINTENANCE=false
REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- ...

## v0.11.2

- Available balance should be used as base for calculating transferable balance

## v0.11.1

- Show transfer amount with fixed digits in fraction
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@Cerebellum-Network/chainbridge-ui",
"version": "0.11.1",
"version": "0.11.2",
"private": true,
"dependencies": {
"@babel/core": "^7.12.3",
Expand Down
37 changes: 18 additions & 19 deletions src/Contexts/Adaptors/SubstrateAdaptors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,28 @@ export const SubstrateHomeAdaptorProvider = ({
if (!homeChainConfig || !address) return;
let unsubscribe: VoidFn | undefined;
if (api) {
api.query.system
.account(address, (result) => {
const {
data: { free: balance },
} = result.toJSON() as any;
api.derive.balances
.all(address, (result) => {
const balance = result.availableBalance.toString();
const transferableBalance = Math.max(
0,
parseFloat(
toFixedWithoutRounding(
parseFloat(
utils.formatUnits(balance, homeChainConfig.decimals)
) -
(homeChainConfig as SubstrateBridgeConfig)
.existentialDepositPlusNetworkFee,
homeChainConfig.decimals
)
)
);
setTokens({
[homeChainConfig.tokens[0].symbol || "TOKEN"]: {
decimals:
homeChainConfig.tokens[0].decimals ?? homeChainConfig.decimals,
balance: Math.max(
0,
parseFloat(
toFixedWithoutRounding(
parseFloat(
utils.formatUnits(balance, homeChainConfig.decimals)
) -
(homeChainConfig as SubstrateBridgeConfig)
.existentialDepositPlusNetworkFee,
homeChainConfig.decimals
)
)
),
balanceBN: new BN(balance).shiftedBy(-homeChainConfig.decimals),
balance: transferableBalance,
balanceBN: new BN(transferableBalance),
name: homeChainConfig.tokens[0].name,
symbol: homeChainConfig.tokens[0].symbol,
},
Expand Down

0 comments on commit ee27fd1

Please sign in to comment.