diff --git a/.env.dev b/.env.dev index 2d35177e..aa8c19e0 100644 --- a/.env.dev +++ b/.env.dev @@ -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.10.5" +REACT_APP_SENTRY_RELEASE="0.11.0" REACT_APP_MAINTENANCE=false REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true diff --git a/.env.prod b/.env.prod index 0d42e0cf..1929f90e 100644 --- a/.env.prod +++ b/.env.prod @@ -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.10.5" +REACT_APP_SENTRY_RELEASE="0.11.0" REACT_APP_MAINTENANCE=false REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true diff --git a/.env.stage b/.env.stage index fd513db9..123eae7d 100644 --- a/.env.stage +++ b/.env.stage @@ -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.10.5" +REACT_APP_SENTRY_RELEASE="0.11.0" REACT_APP_MAINTENANCE=false REACT_APP_CONNECT_WITH_SUBSTRATE_WALLET_ENABLED=true diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1eb993..cdda85c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - ... +## v0.11.0 + +- Added transferable balance + ## v0.10.5 - Added fallback urls diff --git a/README.md b/README.md index 3d7d06c3..87e92eeb 100755 --- a/README.md +++ b/README.md @@ -20,12 +20,18 @@ ## Install +### Install dependencies + +For installing the dependencies use the command: + ``` yarn install ``` -Create a `.env` file based on the `.env.example` file in the root of the project. -Get a Blocknative DAPP ID (here)[https://explorer.blocknative.com/account] and populate the respective field in the `.env` file +### Update configs + +1. Copy to `.env` file in the root of the project the content from `.env.dev`, `.env.stage` or `env.prod` depending on the environment you want to run. +1. Copy to `chainbridge-runtime-config.js` file in the `public` folder the content from `chainbridge-runtime-config.cere.dev.js`, `chainbridge-runtime-config.cere.stage.js` or `chainbridge-runtime-config.cere.prod.js` in `config` folder depending on the environment you want to run. ## Usage @@ -37,13 +43,6 @@ For running a local instance use the command: yarn start ``` -The codebase is configured to be run against the Geth <> Substrate node that can be set up by following the guide [here](https://chainbridge.chainsafe.io/local/) or executing: - -- `yarn start:substrate` to start, -- `yarn setup:example` to initialize - -Should the substrate chain you are targetting require different type definitions, the type definitions file should be added to `src/Contexts/Adaptors/SubstrateApis/` and the file name for the types set in the substrate bridge configs. - ### Build Update the configs for the bridge in `src/chainbridgeContext.ts`. There should be at least 2 chains configured for correct functioning of the bridge. Each chain accepts the following configuration parameters: diff --git a/config/chainbridge-runtime-config.cere.dev.js b/config/chainbridge-runtime-config.cere.dev.js index aec54dd6..ae050e9b 100644 --- a/config/chainbridge-runtime-config.cere.dev.js +++ b/config/chainbridge-runtime-config.cere.dev.js @@ -47,6 +47,7 @@ window.__RUNTIME_CONFIG__ = { transferPalletName: "erc20", transferFunctionName: "transferNative", typesFileName: "bridgeTypes.json", + existentialDepositPlusNetworkFee: "1.03", tokens: [ { address: "cere-native", diff --git a/config/chainbridge-runtime-config.cere.prod.js b/config/chainbridge-runtime-config.cere.prod.js index 1085a168..c50fd6ce 100644 --- a/config/chainbridge-runtime-config.cere.prod.js +++ b/config/chainbridge-runtime-config.cere.prod.js @@ -48,6 +48,7 @@ window.__RUNTIME_CONFIG__ = { transferPalletName: "erc20", transferFunctionName: "transferNative", typesFileName: "bridgeTypes.json", + existentialDepositPlusNetworkFee: "1.03", tokens: [ { address: "cere-native", diff --git a/config/chainbridge-runtime-config.cere.stage.js b/config/chainbridge-runtime-config.cere.stage.js index 342e7d72..12ccafc4 100644 --- a/config/chainbridge-runtime-config.cere.stage.js +++ b/config/chainbridge-runtime-config.cere.stage.js @@ -48,6 +48,7 @@ window.__RUNTIME_CONFIG__ = { transferPalletName: "erc20", transferFunctionName: "transferNative", typesFileName: "bridgeTypes.json", + existentialDepositPlusNetworkFee: "1.03", tokens: [ { address: "cere-native", diff --git a/package.json b/package.json index ee3aec08..bf10c0c1 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@Cerebellum-Network/chainbridge-ui", - "version": "0.10.5", + "version": "0.11.0", "private": true, "dependencies": { "@babel/core": "^7.12.3", diff --git a/src/Components/Pages/TransferPage.tsx b/src/Components/Pages/TransferPage.tsx index 942da742..f3f6bbd0 100644 --- a/src/Components/Pages/TransferPage.tsx +++ b/src/Components/Pages/TransferPage.tsx @@ -696,7 +696,7 @@ const TransferPage = () => { tokens={tokens} name="token" disabled={!destinationChainConfig} - label={`Balance: `} + label={`Transferable balance: `} className={classes.generalInput} placeholder="" sync={(tokenAddress) => { diff --git a/src/Contexts/Adaptors/SubstrateAdaptors.tsx b/src/Contexts/Adaptors/SubstrateAdaptors.tsx index f3df06f8..8a6cdf86 100644 --- a/src/Contexts/Adaptors/SubstrateAdaptors.tsx +++ b/src/Contexts/Adaptors/SubstrateAdaptors.tsx @@ -142,8 +142,13 @@ export const SubstrateHomeAdaptorProvider = ({ [homeChainConfig.tokens[0].symbol || "TOKEN"]: { decimals: homeChainConfig.tokens[0].decimals ?? homeChainConfig.decimals, - balance: parseInt( - utils.formatUnits(balance, homeChainConfig.decimals) + balance: Math.max( + 0, + parseFloat( + utils.formatUnits(balance, homeChainConfig.decimals) + ) - + (homeChainConfig as SubstrateBridgeConfig) + .existentialDepositPlusNetworkFee ), balanceBN: new BN(balance).shiftedBy(-homeChainConfig.decimals), name: homeChainConfig.tokens[0].name, diff --git a/src/chainbridgeConfig.ts b/src/chainbridgeConfig.ts index fe5d7529..35be0e52 100644 --- a/src/chainbridgeConfig.ts +++ b/src/chainbridgeConfig.ts @@ -48,6 +48,7 @@ export type SubstrateBridgeConfig = BridgeConfig & { transferPalletName: string; transferFunctionName: string; typesFileName: string; + existentialDepositPlusNetworkFee: number; }; export type ChainbridgeConfig = {