-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new ProgressOverlay
#156
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/cennznet/app-hub/9PQCdweUGhVTY73XtTFXsPenF7Uf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! couple things,
- dismiss button still missing for pool & bridge
- can we get the explorer link for CENNZ side of bridge withdraw? would be helpful for users who need to do historical withdrawal in case of tx fail
@aidan-starke re having CENNZnet transaction link on the Bridge, I'm two minds about it, it's super useful for us to debug probably, but users would not really care, plus there are too many buttons on it already 😄. Put a ticket to track that tho #157 157 |
no worries, it shouldn't be necessary with the new historic claim ui anyway |
* Release v1.0.0 (#135) * implement next/link and edit AppSwitch styling (#55) * inplement next/link and edit AppSwitch styling * remove unnecessary code * remove unnecessary code * review fixes * PageBackdrop component (#57) * Run code formatting to the current CSS files * Add `pool.module.css` * Add a slight round corners for the panels * Rename CSS files to match with components / pages they are bound to * Tidy up the `/public` folder, move all svg to `images` folder * Remove usage of Teko fonts * Add `sass` package * Add `PageBackdrop` component * Add graphic layers for each section * Add parallax effects to the PageBackdrop * Fix file name casing * Update layer2 graphics for each section * Adjust AppSwitch and main panels so it's scrollable * Create `PageFrame` component to ensure the content is scrolled under the border * Update AppSwtich to resolve warning about invalid prop `sx` ...also update the hover effects to match with design * Fix spacing issue on the bridge * Disable the ripple effect * Adjust top right spacing for the Wallet and its modal * Update red color to match with design * Remove fixed height to avoid big spacing gap at the bottom * Reduce the moving distance of graphics on mouse move * Reduce the size of the graphic elements (#60) * Reduce the size of the graphics element * Re-add `shouldForwardProp` to avoid Warning about React does not recognise prop * hot fix connect wallet btn (#70) * Split Pool Button in two Buttons (#59) * initial split into two buttons pool * fixed styling to match bridge * updated to swap color and actions on callback and fixed arrow styling * fixed issue #40 * fixed styling issues after rebase * fixed swap fee box styling * removed swapicon component * removed unused pool arrows * fixed pool swapper as per PR * fixed onClick typing connect wallet btn * fixed gnarly ternary operator * fixed issue #67 * fixed issue #62 * minor fix to Withdrawable displaying undefined * fixed poolswaper styling, pool head text, and removed bottom text * fixed issue #72 * removed color from poolswaper * merge fetchAssetBalances & getBridgeBalances (#58) * merge fetchAssetBalances and getBridgeBalances * fix build error * move BalanceInfo to types * strict types, add logic for tiny balance case * fetch balances for genericAssets * review fixes * fix formatBalance test * only list ethereum tokens with balance (deposit) * update formatBalance * restrict Pool & Swap tokens to CENNZ/CPAY * hotfix remove console.log * Aidan/assigned issues (#79) * add clickAwayListener to token picker dropdown * disable amount input while assets loading * fix linting & spelling * add clickAwayListener to ChainPicker & PoolSwapper * fix validateDOMnesting errors * prevent account picker dropdown for bridge withdrawal * actually fix DOM nesting for bridge * Improve `Connect CENNZnet` flow (#80) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Fix long account name is not being truncated with `ellipsis` * Use proper label `CENNZnet` * Remove `sass` package (#81) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Switch over to use `css` prop for `PageBackdrop` component * Switch over to use `css` prop for `PageFrame` component * Switch over to use `css` prop for `ThreeDots` component * Remove `sass` package * `UserAgentProvider` and `CENNZApiProvider` test cases (#82) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * Add `BridgeProvider` test case (#85) * rename BlockchainProvider -> BridgeProvider * test BridgeProvider * update getDepositValues() calls to include decimals * move @testing-library/react-hooks to devDependencies * import FC type * initBlockchain -> initBridge * onClick={onClick} * async connectWallet * remove unnecessary JSX fragment * increase test timeouts * increase remaning test timeouts * move timeout change to jest config * spyOn & void console.error * Add `PoolProvider` test case (#87) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * test PoolProvider * scrict typings Co-authored-by: Ken Vu <[email protected]> * Feature/78 (#83) * display user pool share as percentage * improve error handling * fix type, improve error handling * add more info about liquidity * use css from @emotion/react * remove MUI Box & Typography * Bug Fixes (#93) * Switch between 'Liquidity Pool' & 'Your Account' in 'To' PoolSwapper * change nth-child -> nth-of-type * fix DOM nesting * use <b> tags instead of style * set value to "" while amount is undefined * 'Balance Too Low' -> 'Balance Is Too Low' * calculate exchange rate at same time as estimatedFee * update Bridge to use css from `@emotion/react` (#95) * update Bridge to use css from `@emotion/react` * remove font-family: Roboto * Update contracts from peg-fix (#90) * update contract addresses * add validators to withdraw proof * update ERC20Peg ABI * add validators to withdraw proof * update contract addresses * remove unnecessary else block * Ethereum Tokens and CENNZnet Assets (#99) * Add `getTokenLogo` helper function * Add list of top well-known Ethereum tokens * Rename type to be `CENNZnetAccount` * Tidy up `types/index.d.ts` file * Switch over to use `interface` * Add `fetchCENNZnetAssets` and `fetchEthereumTokens` * Add `fetchBridgeTokens`, `fetchPoolAssets` and `fetchSwapAssets` * Rename `SupportedWalletProvider` to `CENNZWalletProvider` * Rename `CENNZnetAccount` to be `CENNZAccount` * Remove un-used types * Rename `CENNZnetAsset` to `CENNZAsset` * Remove unused imports * Rename `fetchAssetBalances` to `fetchCENNZAssetBalances` ... plus update its logic to only fetch registered assets * Rename `fetchCENNZnetAssets` to `fetchCENNZAssets` * Update `WalletModal` to use `getTokenLogo` to fetch for logo asset * Add sorting to the assets by default * Use `getTokenLogo` to retrieve the logo icon path * Fix type issue * Remove token from chainId 3 * Run `prettier-format` * Add a mock for getTokenLogo plus fixing failing tests * Add ETH, wETH and LINK for Kovan chain Co-authored-by: aidan-starke <[email protected]> * Global Transaction Modal (#96) * updated with initial globalmodal and provider * updated modal content styles * updated modal with css-js styling fixed centering * updated to dynamic colors based on route * updated global modal provider * updated with closing modal and initial hook up to txmodal * updated with withdrawals from bridge transaction flow * updated with deposit txmodal and refactor * updated with swap with transaction modal * updated pool with transaction modal * updated modal attributes, fixed dependencies txmodal * updated with three dot loader * added fixme comment * Fix navigation issues (#103) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Global modal tweaks (#104) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Replace `fontSize` prop with `rootCss` prop to allow custom styling in ThreeDots * Add a `ModalBackdrop` that can be used for both `WalletModal` and `GlobalModal` * Fix type issue * Switch over to use `interface` to define object like type * Update/token picker (#105) * fix LINK address * fix getTokenLogo * update pool interfaces to use CENNZAsset * use CENNZAsset, format Numbers to handle error * export new functions * use new functions to fetch Assets & Balances * fix tests * prettier-format * use CENNZAsset & assetIdToErc20 && ethBridge.eventProof * fix build errors/warnings * only fetch balance if EthereumToken * fix exchangeRate, fees & extrinsic * fix test * fix logo not displaying * fixed issue #65 (#107) * Updated Bridge Account Picker (#106) * initial account picker styling * updated with switching accounts and styling * updated with checking if valid address * updated with switching ETH address and cennznet * updated with MM jazzicon * clear error on clear button * updated clear button style and func * use supportedchain * updated with MM logo and MM account listener * update to cleanup event listener * add wCENNZ for Nikau (#111) * add wCENNZ for Nikau * add temp wCENNZ svg, edit tokenButton font-size * rename tokes, use { css } * Emotion Css Refactor (#115) * updated with initial emotion refactor * rest of css refactor * removed global style * Bump follow-redirects from 1.14.7 to 1.14.9 (#113) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.9. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.14.7...v1.14.9) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update `Swap` section (#116) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Remove unused code * Add border-radius to the SwapStats block * Reverse the Accordion chevron icon in `SwapStats` * Wallet update (#117) * Rename `Wallet` to `WalletButton` plus move `WalletModal` outside of `shared` folder * Add new animation to the `WalletModal` while fetching new balances * Add logic to at least show balance for core assets even if they are 0 * Remove unued files * Update `Pool` section (#119) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Add `MainPanel` and use it to house content for all sections * Remove unused files (again!) * Make the `palceholder` for TokenInput to be "0.0" * Remove `palette.text.highlight` and update components to use their corresponding colors * Declare `getCENNZApiForTest` and `getCENNZCoreAssetForTest` in global namespace * Add `NEXT_PUBLIC_ALLOWED_ASSET_IDS` environment * Update `fetchCENNZAssets` with a few more filters * Rename `SwapButton` to `SwitchButton` as Swap is a reserved namespace * Update type for `vertical` plus set type as "button" to avoid form submission * Add generic `SelectInput` that has matched-styling with `TokenInput` dropdown part * Add `PoolActionsPair` * Rename several variables to make them a bit clearer * Add `useAssetBalances` and move that logic to `SwapAssetsPair` * Fix incorrect ternary logic * Rename `token` to `asset` * Switch to use `HelpOutlineIcon` instead * Use propper callback for `onMaxValueRequest` * Tweak styling for `SwapForm` * Add `PoolAssetsPair` * Switch to use `px` for fontSize * Add copy for `Remove` pool action * Update copy in Swap panel * Add loading state for `useSwapGasFee` and `useSwapExchangeRate` * Sync up the asset input values using exchangeRate * Rename to `getCENNZCoreAssetsForTest` * Pass in both `tradeAsset` and `coreAsset` to `fetchPoolExchangeInfo` * Ensure other input is being reset correctly * Add balances info to `PoolAssetsPair` * Update WalletModal color palette to stay the same across section * Sync up colors between `AppSwitch`, `PageBackdrop` and `PageFrame` * Add `PoolStats` * Add Gas Fee to `PoolStats` * Add `PoolSettings` * Add `PoolForm` as it is * Add custom validation for Core Asset input * Bring certain copy to the Tooltip popper to tidy up the interface * Re-concile all TxStatus to `SwapProvider` * Add `PoolProgress` * Update `fetchPoolExchangeInfo` and `fetchPoolUserInfo` to include more details * Use the correct `minLiquidity` parameter when creating addLiquidity extrinsic * Rename `usePoolBalances` to `usePoolUserInfo` * Update liquidity extrinsic calculation logics * Fix form validation failed when balance is 0 * Update Button color palette to match with the sections * Rename `usePoolExchangeRate` -> `usePoolExchangeRate` * Add `Balance` and use it for liquidity extrinsics * Use Balance class for Wallet Balances * Use `Balance` in `usePoolGasFee` and a few other places * Wrap all method in `Big` to return as `Balance` instance * Update Swap section to use `Balance` * Fix Core Input not updating its validation * Add couple more helper methods to Balance class * Use `registry.findMetaError` to extract more error details * Tidy up code * Update `fetchSellPrice` to use `Balance` clas * Add `usePoolExchangeRate` to better handle the CPAY conversion * Fix build issues * Retire old `pool` codebase * Fix failed tests * Fix JS error when `userInfo` is null * Fix UI issue when CENNZnet is not connected * Fix JS issue when balanceList is not rendered yet * Update yarn v3 (#118) * setup yarn 3.2.0 & typescript plugin, attempt PnP * upgrade packages * set yarn path * lint, add yarn/PnP files to .prettierignore * set `nodeLinker: node-modules` so tests will run * remove console.log * Fix remaining issues in Pool (#120) * Remove commented types * Replace `UnwrapPromise` with the official type `Awaited` instead * Bump @cennznet/api to 2.1.0-rc.1 * Update Pool section to handle exchange pair that have 0 liquidity * Rename `usePoolExchangeRate` to `usePoolCoreAssetValue` * Fix receive input does not update in Swap section * Add some docs to the `usePoolCoreAssetValue` * Replace `formatBalance` with `Balance.format` * Simplify TokenInput to only use a single input instance * Add validation to ensure user has sufficient fund to add/remove liquidity * Allow CoreAsset value input to be freely updated in all scenarios * Update `Bridge` section (#124) * Prep the `Bridge` section for an update * Setup new scaffolding for Bridge page * Update `fetchBridgeTokens` to handle both `Deposit` and `Withdraw` actions * Setup `getStaticProps` for `/bridge` page * Add `MetaMaskExtensionProvider` and `MetaMaskWalletProvider` * Update `SubmitButton` with the new MetaMask connect and styling * Add `BridgeActionsPair` * Add a `useEffect` to check if MetaMask is connected and has account * Add `BridgeTokenDestination` with `TokenInput` part * Rename `useWalletBalances` to `useCENNZBalances` * Add `AddressInput` * Update the ModalBackdrop to use the respective color for each section * Update labels for Token and Address * Update section titles to connect them with the previous version * Add address validation to the Address input * Add `useBridgeStatus` hook and disable the form if it's the case * Add `BridgeProgress` * Update variable naming * Add `sendDepositReqeust` * Use lowercase of the address to avoid mismatching * Add sorting when fetching bridge tokens * Add a temp fix to reset the token select when selected token does not exist * Rename variables for clarity * Avoid uppercase `CENNZnet` * Separate the address field for deposit / withdraw * Reset the balance to null before fetching for new value * Add loading progress to the balance * Update `BridgeForm` with withdraw action * Add a check to ensure bridge is active before proceeding * Add logic to update corresponding wallet balance when switching action * Add routine to check for Deposit status in Relayer * Add a guard to ensure we are in a correct ethereum chain before submitting * Add `BridgeStats` * Fix flickering issue with TokenInput when switch to different action * Remove unused code * Fix up typos * Import `sendWithdrawEthereumRequest` from `@/utils` package instead * Use proper `TransactionResponse` type * Avoid anonymous function calling * Fix typo in filename * Fix build issues (#128) * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * ensure chain if user has previously connected but switched networks (#129) * Auxiliary update (#125) * Add `min-width` to #__next container and ensure app is scrollable below that * Add a message re browser support * Rename variables from `useTokeInput` for better clarity * Fix balance validation due to rounding issue * Reduce the drifting distance * Add GA tracking * Add `next-seo` and setup page title for each section * Add in first entry for CHANGELOG * Remove unused files * Fix typo * Fix up letter spacing for all "Roboto Mono" occurrences * Avoid render Balance if network is not connected * Avoid showing progress bar on the Deposit side * Update favicon plus ticker for CENNZ, wCENNZ and CPAY * Set `padFractionalZeros` default to false * Remove LINK on production for now * Feature/manual historic withdrawal (#123) * allow user to enter historical event proof id * add event proof tooltip * add historical withdraw functionality * return early if historical * remove else statements * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * implement historical withdrawals * remove `required` from historical textfields * extract historical value state to bridge provider * clear values on accordion shrink * shrink accordion if historical withdrawal was successful * notaryKeys if/else -> ternary * increase blockHash input width, allow multiline * update if statement * review fixes * validate block hash * allow user to enter transferValue over their balance for historical withdraw * remove `padFractionalZeros={false}` * simpler block hash validation * fix validation * Wrap tooltip icon with InputAdornment * Rename variable to `disabled` for better clarity Co-authored-by: Ken Vu <[email protected]> * Minor updates (#132) * Update content * Update `format` and `toInput` to remove any padded zeros * Fix build error * Add default share image for App Hub * Define onTokenChange for receive token (#133) * Pre-Release v1.0.0 (#134) * Update production env vars * Update CHANGELOG * Bump `@cennznet/api` to `2.1.0-rc.2` * reduce token list for prod * sort by symbol * prettier, add wETH Co-authored-by: aidan-starke <[email protected]> Co-authored-by: Aidan Starke <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: aidan-starke <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Release v1.0.1 (#147) * Prep for v1.0.1 * Misc fixes (#138) * Use the new icon for CENNZnet * Remove the `public/images` folder * Ensure all icons are matching in sizes * Take into account staking lock when fetching the balance * Address PR-135 feedbacks (#139) * Avoid checking `ethBridge.bridgePaused` status when it's Deposit * Explicitly using assetId to check if it's CPAY * Move BRIDGE / PEG contract addresses to `constants.ts` * Add default timeout value to be `1000` instead of zero * Use `sellAsset` extrinsic to allow fluctuating the receiving token * Update Slippage value and message to match with the `sellAsset` extrinsic * Add >= and <= symbols in front of Slippage * Update messaging around Slippage * Ensure clearing the interval before rejecting error * Update CHANGELOG * Release v1.0.2 (#152) * Prep for release v1.0.2 * Add confirming state to the Bridge (#151) * Reduce the space between `value` and `symbol` * Add `selectMap` * Update progress title during deposit confirming state * Update progress status for withdraw confirming state * Allow mix casing in Progress title * Add a generic missing token (#149) * Remove the generic "Confirming" state * Update API_URL (#154) * Use new `ProgressOverlay` (#156) * Add `Link` component * Add `CENNZTransaction` class and utilise it in `signAndSendTx2` * Update SwapProgress with improved layout, transaction link * Update Pool section to use new ProgressOverlay system * Update Bridge section to use new ProgressOverlay system * Re-add `Dismiss` button back * Deprecate the old `signAndSend` function * Add `Dismiss` button into Pool and Bridge sections * Append `?network=Nikau` for Nikau transaction * Use differnt approach to get CENNZnet Wallet (#162) * Chore: Pruning unused packages and bump @cennznet/api to `2.1.0` (#163) * Update @cennznet/api to 2.1.0 plus remove unused packages * Update TS config to pick up custom types * Fix build error due to incorrect type casting * Remove unused types * Update ui/ux for Historical Withdrawal (#155) * new ui/ux for historical withdrawal * fetch UNClaimed withdrawals * prettier * use new `BridgeAdvanced` component, remove `processHistoricalWithdrawRequest` * remove historic vars, allow passing of historicalAmount to `setSuccessStatus` * add `WithdrawClaim` interface * add `fetchUnclaimedWithdrawals` export * rename to `BridgeWithdrawAdvanced` for clarity * move `advancedExpanded` state to `BridgeProvider` * use `advancedExpanded` boolean to define `useBalanceValidation` disabled state * prettier * use Nullish coalescing operator * hide claim button if claim expired * `historicalAmount` -> generic 'value' * avoid filtering empty array * use generic `value` * fix build error * set selected token & value, use values from unclaimed withdrawal * use BRIDGE_RELAYER_URL * extract `updateUnclaimedWithdrawals` to hook * update unclaimed on withdraw tx fail & historic tx success * handle advancedMounted state in BridgeProvider * edit expiryString, add `expiryRaw` to `WithdrawClaim` type * render unclaimed withdrawals in a table * fix table row comment * refactor * close advanced on tx fail/cancel/success * hide expired claims * update styling * handle updating unclaimed in `BridgeProvider` * update progress styling * review comments * remove `setUnclaimedWithdrawals` from BridgeContextType * Add minor tweaking to the table list (#167) * Fix mixed up claiming address (#168) * Use `beneficiary` field to send along with withdraw request * Tweak table list styling * Spike/use proofs endpoint (#171) * use proofs endpoint WIP * map _id to eventId * add options for _id & eventId * remove `sendHistoricalWithdrawEthereumRequest` * use for fresh & historic withdrawEthereum requests * use `sendWithdrawEthereumRequest` * auto expand advanced if some unclaimed withdrawals * prep for release v1.1.0 * prevent window exit if txStatus is pending (#173) * prevent window exit if txStatus is pending * extract useEffect to hook * use `useBeforeUnload` * use `TxStatus` type Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Use new `ProgressOverlay` (#156) * Add `Link` component * Add `CENNZTransaction` class and utilise it in `signAndSendTx2` * Update SwapProgress with improved layout, transaction link * Update Pool section to use new ProgressOverlay system * Update Bridge section to use new ProgressOverlay system * Re-add `Dismiss` button back * Deprecate the old `signAndSend` function * Add `Dismiss` button into Pool and Bridge sections * Append `?network=Nikau` for Nikau transaction * Use differnt approach to get CENNZnet Wallet (#162) * Chore: Pruning unused packages and bump @cennznet/api to `2.1.0` (#163) * Update @cennznet/api to 2.1.0 plus remove unused packages * Update TS config to pick up custom types * Fix build error due to incorrect type casting * Remove unused types * Update ui/ux for Historical Withdrawal (#155) * new ui/ux for historical withdrawal * fetch UNClaimed withdrawals * prettier * use new `BridgeAdvanced` component, remove `processHistoricalWithdrawRequest` * remove historic vars, allow passing of historicalAmount to `setSuccessStatus` * add `WithdrawClaim` interface * add `fetchUnclaimedWithdrawals` export * rename to `BridgeWithdrawAdvanced` for clarity * move `advancedExpanded` state to `BridgeProvider` * use `advancedExpanded` boolean to define `useBalanceValidation` disabled state * prettier * use Nullish coalescing operator * hide claim button if claim expired * `historicalAmount` -> generic 'value' * avoid filtering empty array * use generic `value` * fix build error * set selected token & value, use values from unclaimed withdrawal * use BRIDGE_RELAYER_URL * extract `updateUnclaimedWithdrawals` to hook * update unclaimed on withdraw tx fail & historic tx success * handle advancedMounted state in BridgeProvider * edit expiryString, add `expiryRaw` to `WithdrawClaim` type * render unclaimed withdrawals in a table * fix table row comment * refactor * close advanced on tx fail/cancel/success * hide expired claims * update styling * handle updating unclaimed in `BridgeProvider` * update progress styling * review comments * remove `setUnclaimedWithdrawals` from BridgeContextType * Add minor tweaking to the table list (#167) * Fix mixed up claiming address (#168) * Use `beneficiary` field to send along with withdraw request * Tweak table list styling * Spike/use proofs endpoint (#171) * use proofs endpoint WIP * map _id to eventId * add options for _id & eventId * remove `sendHistoricalWithdrawEthereumRequest` * use for fresh & historic withdrawEthereum requests * use `sendWithdrawEthereumRequest` * auto expand advanced if some unclaimed withdrawals * prevent window exit if txStatus is pending (#173) * prevent window exit if txStatus is pending * extract useEffect to hook * use `useBeforeUnload` * use `TxStatus` type * back merge release v.1.1.0 (#180) * Release v1.0.0 (#135) * implement next/link and edit AppSwitch styling (#55) * inplement next/link and edit AppSwitch styling * remove unnecessary code * remove unnecessary code * review fixes * PageBackdrop component (#57) * Run code formatting to the current CSS files * Add `pool.module.css` * Add a slight round corners for the panels * Rename CSS files to match with components / pages they are bound to * Tidy up the `/public` folder, move all svg to `images` folder * Remove usage of Teko fonts * Add `sass` package * Add `PageBackdrop` component * Add graphic layers for each section * Add parallax effects to the PageBackdrop * Fix file name casing * Update layer2 graphics for each section * Adjust AppSwitch and main panels so it's scrollable * Create `PageFrame` component to ensure the content is scrolled under the border * Update AppSwtich to resolve warning about invalid prop `sx` ...also update the hover effects to match with design * Fix spacing issue on the bridge * Disable the ripple effect * Adjust top right spacing for the Wallet and its modal * Update red color to match with design * Remove fixed height to avoid big spacing gap at the bottom * Reduce the moving distance of graphics on mouse move * Reduce the size of the graphic elements (#60) * Reduce the size of the graphics element * Re-add `shouldForwardProp` to avoid Warning about React does not recognise prop * hot fix connect wallet btn (#70) * Split Pool Button in two Buttons (#59) * initial split into two buttons pool * fixed styling to match bridge * updated to swap color and actions on callback and fixed arrow styling * fixed issue #40 * fixed styling issues after rebase * fixed swap fee box styling * removed swapicon component * removed unused pool arrows * fixed pool swapper as per PR * fixed onClick typing connect wallet btn * fixed gnarly ternary operator * fixed issue #67 * fixed issue #62 * minor fix to Withdrawable displaying undefined * fixed poolswaper styling, pool head text, and removed bottom text * fixed issue #72 * removed color from poolswaper * merge fetchAssetBalances & getBridgeBalances (#58) * merge fetchAssetBalances and getBridgeBalances * fix build error * move BalanceInfo to types * strict types, add logic for tiny balance case * fetch balances for genericAssets * review fixes * fix formatBalance test * only list ethereum tokens with balance (deposit) * update formatBalance * restrict Pool & Swap tokens to CENNZ/CPAY * hotfix remove console.log * Aidan/assigned issues (#79) * add clickAwayListener to token picker dropdown * disable amount input while assets loading * fix linting & spelling * add clickAwayListener to ChainPicker & PoolSwapper * fix validateDOMnesting errors * prevent account picker dropdown for bridge withdrawal * actually fix DOM nesting for bridge * Improve `Connect CENNZnet` flow (#80) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Fix long account name is not being truncated with `ellipsis` * Use proper label `CENNZnet` * Remove `sass` package (#81) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Switch over to use `css` prop for `PageBackdrop` component * Switch over to use `css` prop for `PageFrame` component * Switch over to use `css` prop for `ThreeDots` component * Remove `sass` package * `UserAgentProvider` and `CENNZApiProvider` test cases (#82) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * Add `BridgeProvider` test case (#85) * rename BlockchainProvider -> BridgeProvider * test BridgeProvider * update getDepositValues() calls to include decimals * move @testing-library/react-hooks to devDependencies * import FC type * initBlockchain -> initBridge * onClick={onClick} * async connectWallet * remove unnecessary JSX fragment * increase test timeouts * increase remaning test timeouts * move timeout change to jest config * spyOn & void console.error * Add `PoolProvider` test case (#87) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * test PoolProvider * scrict typings Co-authored-by: Ken Vu <[email protected]> * Feature/78 (#83) * display user pool share as percentage * improve error handling * fix type, improve error handling * add more info about liquidity * use css from @emotion/react * remove MUI Box & Typography * Bug Fixes (#93) * Switch between 'Liquidity Pool' & 'Your Account' in 'To' PoolSwapper * change nth-child -> nth-of-type * fix DOM nesting * use <b> tags instead of style * set value to "" while amount is undefined * 'Balance Too Low' -> 'Balance Is Too Low' * calculate exchange rate at same time as estimatedFee * update Bridge to use css from `@emotion/react` (#95) * update Bridge to use css from `@emotion/react` * remove font-family: Roboto * Update contracts from peg-fix (#90) * update contract addresses * add validators to withdraw proof * update ERC20Peg ABI * add validators to withdraw proof * update contract addresses * remove unnecessary else block * Ethereum Tokens and CENNZnet Assets (#99) * Add `getTokenLogo` helper function * Add list of top well-known Ethereum tokens * Rename type to be `CENNZnetAccount` * Tidy up `types/index.d.ts` file * Switch over to use `interface` * Add `fetchCENNZnetAssets` and `fetchEthereumTokens` * Add `fetchBridgeTokens`, `fetchPoolAssets` and `fetchSwapAssets` * Rename `SupportedWalletProvider` to `CENNZWalletProvider` * Rename `CENNZnetAccount` to be `CENNZAccount` * Remove un-used types * Rename `CENNZnetAsset` to `CENNZAsset` * Remove unused imports * Rename `fetchAssetBalances` to `fetchCENNZAssetBalances` ... plus update its logic to only fetch registered assets * Rename `fetchCENNZnetAssets` to `fetchCENNZAssets` * Update `WalletModal` to use `getTokenLogo` to fetch for logo asset * Add sorting to the assets by default * Use `getTokenLogo` to retrieve the logo icon path * Fix type issue * Remove token from chainId 3 * Run `prettier-format` * Add a mock for getTokenLogo plus fixing failing tests * Add ETH, wETH and LINK for Kovan chain Co-authored-by: aidan-starke <[email protected]> * Global Transaction Modal (#96) * updated with initial globalmodal and provider * updated modal content styles * updated modal with css-js styling fixed centering * updated to dynamic colors based on route * updated global modal provider * updated with closing modal and initial hook up to txmodal * updated with withdrawals from bridge transaction flow * updated with deposit txmodal and refactor * updated with swap with transaction modal * updated pool with transaction modal * updated modal attributes, fixed dependencies txmodal * updated with three dot loader * added fixme comment * Fix navigation issues (#103) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Global modal tweaks (#104) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Replace `fontSize` prop with `rootCss` prop to allow custom styling in ThreeDots * Add a `ModalBackdrop` that can be used for both `WalletModal` and `GlobalModal` * Fix type issue * Switch over to use `interface` to define object like type * Update/token picker (#105) * fix LINK address * fix getTokenLogo * update pool interfaces to use CENNZAsset * use CENNZAsset, format Numbers to handle error * export new functions * use new functions to fetch Assets & Balances * fix tests * prettier-format * use CENNZAsset & assetIdToErc20 && ethBridge.eventProof * fix build errors/warnings * only fetch balance if EthereumToken * fix exchangeRate, fees & extrinsic * fix test * fix logo not displaying * fixed issue #65 (#107) * Updated Bridge Account Picker (#106) * initial account picker styling * updated with switching accounts and styling * updated with checking if valid address * updated with switching ETH address and cennznet * updated with MM jazzicon * clear error on clear button * updated clear button style and func * use supportedchain * updated with MM logo and MM account listener * update to cleanup event listener * add wCENNZ for Nikau (#111) * add wCENNZ for Nikau * add temp wCENNZ svg, edit tokenButton font-size * rename tokes, use { css } * Emotion Css Refactor (#115) * updated with initial emotion refactor * rest of css refactor * removed global style * Bump follow-redirects from 1.14.7 to 1.14.9 (#113) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.9. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.14.7...v1.14.9) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update `Swap` section (#116) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Remove unused code * Add border-radius to the SwapStats block * Reverse the Accordion chevron icon in `SwapStats` * Wallet update (#117) * Rename `Wallet` to `WalletButton` plus move `WalletModal` outside of `shared` folder * Add new animation to the `WalletModal` while fetching new balances * Add logic to at least show balance for core assets even if they are 0 * Remove unued files * Update `Pool` section (#119) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Add `MainPanel` and use it to house content for all sections * Remove unused files (again!) * Make the `palceholder` for TokenInput to be "0.0" * Remove `palette.text.highlight` and update components to use their corresponding colors * Declare `getCENNZApiForTest` and `getCENNZCoreAssetForTest` in global namespace * Add `NEXT_PUBLIC_ALLOWED_ASSET_IDS` environment * Update `fetchCENNZAssets` with a few more filters * Rename `SwapButton` to `SwitchButton` as Swap is a reserved namespace * Update type for `vertical` plus set type as "button" to avoid form submission * Add generic `SelectInput` that has matched-styling with `TokenInput` dropdown part * Add `PoolActionsPair` * Rename several variables to make them a bit clearer * Add `useAssetBalances` and move that logic to `SwapAssetsPair` * Fix incorrect ternary logic * Rename `token` to `asset` * Switch to use `HelpOutlineIcon` instead * Use propper callback for `onMaxValueRequest` * Tweak styling for `SwapForm` * Add `PoolAssetsPair` * Switch to use `px` for fontSize * Add copy for `Remove` pool action * Update copy in Swap panel * Add loading state for `useSwapGasFee` and `useSwapExchangeRate` * Sync up the asset input values using exchangeRate * Rename to `getCENNZCoreAssetsForTest` * Pass in both `tradeAsset` and `coreAsset` to `fetchPoolExchangeInfo` * Ensure other input is being reset correctly * Add balances info to `PoolAssetsPair` * Update WalletModal color palette to stay the same across section * Sync up colors between `AppSwitch`, `PageBackdrop` and `PageFrame` * Add `PoolStats` * Add Gas Fee to `PoolStats` * Add `PoolSettings` * Add `PoolForm` as it is * Add custom validation for Core Asset input * Bring certain copy to the Tooltip popper to tidy up the interface * Re-concile all TxStatus to `SwapProvider` * Add `PoolProgress` * Update `fetchPoolExchangeInfo` and `fetchPoolUserInfo` to include more details * Use the correct `minLiquidity` parameter when creating addLiquidity extrinsic * Rename `usePoolBalances` to `usePoolUserInfo` * Update liquidity extrinsic calculation logics * Fix form validation failed when balance is 0 * Update Button color palette to match with the sections * Rename `usePoolExchangeRate` -> `usePoolExchangeRate` * Add `Balance` and use it for liquidity extrinsics * Use Balance class for Wallet Balances * Use `Balance` in `usePoolGasFee` and a few other places * Wrap all method in `Big` to return as `Balance` instance * Update Swap section to use `Balance` * Fix Core Input not updating its validation * Add couple more helper methods to Balance class * Use `registry.findMetaError` to extract more error details * Tidy up code * Update `fetchSellPrice` to use `Balance` clas * Add `usePoolExchangeRate` to better handle the CPAY conversion * Fix build issues * Retire old `pool` codebase * Fix failed tests * Fix JS error when `userInfo` is null * Fix UI issue when CENNZnet is not connected * Fix JS issue when balanceList is not rendered yet * Update yarn v3 (#118) * setup yarn 3.2.0 & typescript plugin, attempt PnP * upgrade packages * set yarn path * lint, add yarn/PnP files to .prettierignore * set `nodeLinker: node-modules` so tests will run * remove console.log * Fix remaining issues in Pool (#120) * Remove commented types * Replace `UnwrapPromise` with the official type `Awaited` instead * Bump @cennznet/api to 2.1.0-rc.1 * Update Pool section to handle exchange pair that have 0 liquidity * Rename `usePoolExchangeRate` to `usePoolCoreAssetValue` * Fix receive input does not update in Swap section * Add some docs to the `usePoolCoreAssetValue` * Replace `formatBalance` with `Balance.format` * Simplify TokenInput to only use a single input instance * Add validation to ensure user has sufficient fund to add/remove liquidity * Allow CoreAsset value input to be freely updated in all scenarios * Update `Bridge` section (#124) * Prep the `Bridge` section for an update * Setup new scaffolding for Bridge page * Update `fetchBridgeTokens` to handle both `Deposit` and `Withdraw` actions * Setup `getStaticProps` for `/bridge` page * Add `MetaMaskExtensionProvider` and `MetaMaskWalletProvider` * Update `SubmitButton` with the new MetaMask connect and styling * Add `BridgeActionsPair` * Add a `useEffect` to check if MetaMask is connected and has account * Add `BridgeTokenDestination` with `TokenInput` part * Rename `useWalletBalances` to `useCENNZBalances` * Add `AddressInput` * Update the ModalBackdrop to use the respective color for each section * Update labels for Token and Address * Update section titles to connect them with the previous version * Add address validation to the Address input * Add `useBridgeStatus` hook and disable the form if it's the case * Add `BridgeProgress` * Update variable naming * Add `sendDepositReqeust` * Use lowercase of the address to avoid mismatching * Add sorting when fetching bridge tokens * Add a temp fix to reset the token select when selected token does not exist * Rename variables for clarity * Avoid uppercase `CENNZnet` * Separate the address field for deposit / withdraw * Reset the balance to null before fetching for new value * Add loading progress to the balance * Update `BridgeForm` with withdraw action * Add a check to ensure bridge is active before proceeding * Add logic to update corresponding wallet balance when switching action * Add routine to check for Deposit status in Relayer * Add a guard to ensure we are in a correct ethereum chain before submitting * Add `BridgeStats` * Fix flickering issue with TokenInput when switch to different action * Remove unused code * Fix up typos * Import `sendWithdrawEthereumRequest` from `@/utils` package instead * Use proper `TransactionResponse` type * Avoid anonymous function calling * Fix typo in filename * Fix build issues (#128) * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * ensure chain if user has previously connected but switched networks (#129) * Auxiliary update (#125) * Add `min-width` to #__next container and ensure app is scrollable below that * Add a message re browser support * Rename variables from `useTokeInput` for better clarity * Fix balance validation due to rounding issue * Reduce the drifting distance * Add GA tracking * Add `next-seo` and setup page title for each section * Add in first entry for CHANGELOG * Remove unused files * Fix typo * Fix up letter spacing for all "Roboto Mono" occurrences * Avoid render Balance if network is not connected * Avoid showing progress bar on the Deposit side * Update favicon plus ticker for CENNZ, wCENNZ and CPAY * Set `padFractionalZeros` default to false * Remove LINK on production for now * Feature/manual historic withdrawal (#123) * allow user to enter historical event proof id * add event proof tooltip * add historical withdraw functionality * return early if historical * remove else statements * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * implement historical withdrawals * remove `required` from historical textfields * extract historical value state to bridge provider * clear values on accordion shrink * shrink accordion if historical withdrawal was successful * notaryKeys if/else -> ternary * increase blockHash input width, allow multiline * update if statement * review fixes * validate block hash * allow user to enter transferValue over their balance for historical withdraw * remove `padFractionalZeros={false}` * simpler block hash validation * fix validation * Wrap tooltip icon with InputAdornment * Rename variable to `disabled` for better clarity Co-authored-by: Ken Vu <[email protected]> * Minor updates (#132) * Update content * Update `format` and `toInput` to remove any padded zeros * Fix build error * Add default share image for App Hub * Define onTokenChange for receive token (#133) * Pre-Release v1.0.0 (#134) * Update production env vars * Update CHANGELOG * Bump `@cennznet/api` to `2.1.0-rc.2` * reduce token list for prod * sort by symbol * prettier, add wETH Co-authored-by: aidan-starke <[email protected]> Co-authored-by: Aidan Starke <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: aidan-starke <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Release v1.0.1 (#147) * Prep for v1.0.1 * Misc fixes (#138) * Use the new icon for CENNZnet * Remove the `public/images` folder * Ensure all icons are matching in sizes * Take into account staking lock when fetching the balance * Address PR-135 feedbacks (#139) * Avoid checking `ethBridge.bridgePaused` status when it's Deposit * Explicitly using assetId to check if it's CPAY * Move BRIDGE / PEG contract addresses to `constants.ts` * Add default timeout value to be `1000` instead of zero * Use `sellAsset` extrinsic to allow fluctuating the receiving token * Update Slippage value and message to match with the `sellAsset` extrinsic * Add >= and <= symbols in front of Slippage * Update messaging around Slippage * Ensure clearing the interval before rejecting error * Update CHANGELOG * Release v1.0.2 (#152) * Prep for release v1.0.2 * Add confirming state to the Bridge (#151) * Reduce the space between `value` and `symbol` * Add `selectMap` * Update progress title during deposit confirming state * Update progress status for withdraw confirming state * Allow mix casing in Progress title * Add a generic missing token (#149) * Remove the generic "Confirming" state * Update API_URL (#154) * prep for release v1.1.0 Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add version number and commit hash to bottom of the page (#182) * Add version number and commit hash to bottom of the page * Use the correct env var for commit sha * Avoid adding the whole `package.json` to runtime JS * Spike/testing (#177) * test `fetchUnclaimedEventProof`, `fetchUnclaimedWithdrawals` * disconnect api after test * test `fetchDepositRelayerStatus` * test `ensureRelayerDepositDone` * test `Balance` - TODO test `fromCodec` & `fromApiBalance` * test `fetchBridgeDepositStatus`, `fetchBridgeWithdrawStatus` * use `global.getCENNZApiForTest()` * update types * fix 'Promise is ignored' warning, update types * test `fetchMetaMaskBalance` * use `global.getEthereumAssetsForTest()` * test `getContract` utils * setup and use `global.getWeb3MockForTest` * use `global.get[provider]TestingAccount` * setup environment to test `signAndSendTx` * test `getAddLiquidityExtrinsic` * test `getRemoveLiquidityExtrinsic` * test `get[Buy/Sell]AssetExtrinsic` utils * test `getExpiryString.ts` * test `getPegWithdrawExtrinsic` * test `is[Ethereum/CENNZ]Address` utils * prettier * setup environment to test `sendDepositRequest` * test `signAndSendTx` * test `sendDepositRequest` * test `sendWithdrawEthereumRequest` * remove TODO - `getPegWithdrawExtrinsic` and `signAndSendTx` are tested * mock `fromCodec` and `fromApiBalance` * remove todo * test `getTokenLogo` * delete unused file * fix typo, use `global.getCENNZApiForTest` * fix `fromCodec` and `fromApiBalance` tests * mock api * update throw test * update error handling * test throw case * use `args` inspection test * fix `timeout` test * change test order * update wCENNZ logo Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* update wCENNZ address * add wCENNZ for mainnet * update wcennz logo (#186) * Use new `ProgressOverlay` (#156) * Add `Link` component * Add `CENNZTransaction` class and utilise it in `signAndSendTx2` * Update SwapProgress with improved layout, transaction link * Update Pool section to use new ProgressOverlay system * Update Bridge section to use new ProgressOverlay system * Re-add `Dismiss` button back * Deprecate the old `signAndSend` function * Add `Dismiss` button into Pool and Bridge sections * Append `?network=Nikau` for Nikau transaction * Use differnt approach to get CENNZnet Wallet (#162) * Chore: Pruning unused packages and bump @cennznet/api to `2.1.0` (#163) * Update @cennznet/api to 2.1.0 plus remove unused packages * Update TS config to pick up custom types * Fix build error due to incorrect type casting * Remove unused types * Update ui/ux for Historical Withdrawal (#155) * new ui/ux for historical withdrawal * fetch UNClaimed withdrawals * prettier * use new `BridgeAdvanced` component, remove `processHistoricalWithdrawRequest` * remove historic vars, allow passing of historicalAmount to `setSuccessStatus` * add `WithdrawClaim` interface * add `fetchUnclaimedWithdrawals` export * rename to `BridgeWithdrawAdvanced` for clarity * move `advancedExpanded` state to `BridgeProvider` * use `advancedExpanded` boolean to define `useBalanceValidation` disabled state * prettier * use Nullish coalescing operator * hide claim button if claim expired * `historicalAmount` -> generic 'value' * avoid filtering empty array * use generic `value` * fix build error * set selected token & value, use values from unclaimed withdrawal * use BRIDGE_RELAYER_URL * extract `updateUnclaimedWithdrawals` to hook * update unclaimed on withdraw tx fail & historic tx success * handle advancedMounted state in BridgeProvider * edit expiryString, add `expiryRaw` to `WithdrawClaim` type * render unclaimed withdrawals in a table * fix table row comment * refactor * close advanced on tx fail/cancel/success * hide expired claims * update styling * handle updating unclaimed in `BridgeProvider` * update progress styling * review comments * remove `setUnclaimedWithdrawals` from BridgeContextType * Add minor tweaking to the table list (#167) * Fix mixed up claiming address (#168) * Use `beneficiary` field to send along with withdraw request * Tweak table list styling * Spike/use proofs endpoint (#171) * use proofs endpoint WIP * map _id to eventId * add options for _id & eventId * remove `sendHistoricalWithdrawEthereumRequest` * use for fresh & historic withdrawEthereum requests * use `sendWithdrawEthereumRequest` * auto expand advanced if some unclaimed withdrawals * prevent window exit if txStatus is pending (#173) * prevent window exit if txStatus is pending * extract useEffect to hook * use `useBeforeUnload` * use `TxStatus` type * back merge release v.1.1.0 (#180) * Release v1.0.0 (#135) * implement next/link and edit AppSwitch styling (#55) * inplement next/link and edit AppSwitch styling * remove unnecessary code * remove unnecessary code * review fixes * PageBackdrop component (#57) * Run code formatting to the current CSS files * Add `pool.module.css` * Add a slight round corners for the panels * Rename CSS files to match with components / pages they are bound to * Tidy up the `/public` folder, move all svg to `images` folder * Remove usage of Teko fonts * Add `sass` package * Add `PageBackdrop` component * Add graphic layers for each section * Add parallax effects to the PageBackdrop * Fix file name casing * Update layer2 graphics for each section * Adjust AppSwitch and main panels so it's scrollable * Create `PageFrame` component to ensure the content is scrolled under the border * Update AppSwtich to resolve warning about invalid prop `sx` ...also update the hover effects to match with design * Fix spacing issue on the bridge * Disable the ripple effect * Adjust top right spacing for the Wallet and its modal * Update red color to match with design * Remove fixed height to avoid big spacing gap at the bottom * Reduce the moving distance of graphics on mouse move * Reduce the size of the graphic elements (#60) * Reduce the size of the graphics element * Re-add `shouldForwardProp` to avoid Warning about React does not recognise prop * hot fix connect wallet btn (#70) * Split Pool Button in two Buttons (#59) * initial split into two buttons pool * fixed styling to match bridge * updated to swap color and actions on callback and fixed arrow styling * fixed issue #40 * fixed styling issues after rebase * fixed swap fee box styling * removed swapicon component * removed unused pool arrows * fixed pool swapper as per PR * fixed onClick typing connect wallet btn * fixed gnarly ternary operator * fixed issue #67 * fixed issue #62 * minor fix to Withdrawable displaying undefined * fixed poolswaper styling, pool head text, and removed bottom text * fixed issue #72 * removed color from poolswaper * merge fetchAssetBalances & getBridgeBalances (#58) * merge fetchAssetBalances and getBridgeBalances * fix build error * move BalanceInfo to types * strict types, add logic for tiny balance case * fetch balances for genericAssets * review fixes * fix formatBalance test * only list ethereum tokens with balance (deposit) * update formatBalance * restrict Pool & Swap tokens to CENNZ/CPAY * hotfix remove console.log * Aidan/assigned issues (#79) * add clickAwayListener to token picker dropdown * disable amount input while assets loading * fix linting & spelling * add clickAwayListener to ChainPicker & PoolSwapper * fix validateDOMnesting errors * prevent account picker dropdown for bridge withdrawal * actually fix DOM nesting for bridge * Improve `Connect CENNZnet` flow (#80) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Fix long account name is not being truncated with `ellipsis` * Use proper label `CENNZnet` * Remove `sass` package (#81) * Re-add `connectWallet` functionality to the Wallet button ... plus identify different wallet states to update UI accordingly * Move Identicon outside of React rendering so Next can do its optimisation * Avoid showing loading progress as `balances` should be all ready by when open * Update `tsconfig.json` to allow using `css` property on DOM element * Bring AccountIdenticon to the Wallet plus fix nesting error due `div` inside `p` * Pass modal open state straight down to avoid state out of sync * Opt for a simpler picker to select the account * Move styling into `styles` object for legibility * Update Wallet and WalletModal styling ... plus improving connect flow and switching account flow * Re-style the WalletModal panel ... also merge `AccountBalances` with `WalletModal` * Add check to `balances.length` in PoolForm * Pass props to `styles` object via wrapped functions * Switch over to use `css` prop for `PageBackdrop` component * Switch over to use `css` prop for `PageFrame` component * Switch over to use `css` prop for `ThreeDots` component * Remove `sass` package * `UserAgentProvider` and `CENNZApiProvider` test cases (#82) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * Add `BridgeProvider` test case (#85) * rename BlockchainProvider -> BridgeProvider * test BridgeProvider * update getDepositValues() calls to include decimals * move @testing-library/react-hooks to devDependencies * import FC type * initBlockchain -> initBridge * onClick={onClick} * async connectWallet * remove unnecessary JSX fragment * increase test timeouts * increase remaning test timeouts * move timeout change to jest config * spyOn & void console.error * Add `PoolProvider` test case (#87) * Add `@testing-library/react-hooks` * Remove un-used DappModuleProvider * Allow adding custom value to UserAgentProvider ... plus update syntax to use FC type * Add `UserAgentProvider.test.tsx` * Allow adding custom `endpoint` for CENNZApiProvider ... plus update the syntax to make use of FC type * Add `CENNZApiProvider.test.tsx` * test PoolProvider * scrict typings Co-authored-by: Ken Vu <[email protected]> * Feature/78 (#83) * display user pool share as percentage * improve error handling * fix type, improve error handling * add more info about liquidity * use css from @emotion/react * remove MUI Box & Typography * Bug Fixes (#93) * Switch between 'Liquidity Pool' & 'Your Account' in 'To' PoolSwapper * change nth-child -> nth-of-type * fix DOM nesting * use <b> tags instead of style * set value to "" while amount is undefined * 'Balance Too Low' -> 'Balance Is Too Low' * calculate exchange rate at same time as estimatedFee * update Bridge to use css from `@emotion/react` (#95) * update Bridge to use css from `@emotion/react` * remove font-family: Roboto * Update contracts from peg-fix (#90) * update contract addresses * add validators to withdraw proof * update ERC20Peg ABI * add validators to withdraw proof * update contract addresses * remove unnecessary else block * Ethereum Tokens and CENNZnet Assets (#99) * Add `getTokenLogo` helper function * Add list of top well-known Ethereum tokens * Rename type to be `CENNZnetAccount` * Tidy up `types/index.d.ts` file * Switch over to use `interface` * Add `fetchCENNZnetAssets` and `fetchEthereumTokens` * Add `fetchBridgeTokens`, `fetchPoolAssets` and `fetchSwapAssets` * Rename `SupportedWalletProvider` to `CENNZWalletProvider` * Rename `CENNZnetAccount` to be `CENNZAccount` * Remove un-used types * Rename `CENNZnetAsset` to `CENNZAsset` * Remove unused imports * Rename `fetchAssetBalances` to `fetchCENNZAssetBalances` ... plus update its logic to only fetch registered assets * Rename `fetchCENNZnetAssets` to `fetchCENNZAssets` * Update `WalletModal` to use `getTokenLogo` to fetch for logo asset * Add sorting to the assets by default * Use `getTokenLogo` to retrieve the logo icon path * Fix type issue * Remove token from chainId 3 * Run `prettier-format` * Add a mock for getTokenLogo plus fixing failing tests * Add ETH, wETH and LINK for Kovan chain Co-authored-by: aidan-starke <[email protected]> * Global Transaction Modal (#96) * updated with initial globalmodal and provider * updated modal content styles * updated modal with css-js styling fixed centering * updated to dynamic colors based on route * updated global modal provider * updated with closing modal and initial hook up to txmodal * updated with withdrawals from bridge transaction flow * updated with deposit txmodal and refactor * updated with swap with transaction modal * updated pool with transaction modal * updated modal attributes, fixed dependencies txmodal * updated with three dot loader * added fixme comment * Fix navigation issues (#103) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Global modal tweaks (#104) * Update redirect rule to go from `/` to `/swap` * Add `SectionUri` type * Switch over to use `css` to style the navigation * Re-add `SectionUri` type * Remove un-used Switch component * Add `useSectionUri` hook * Replace `fontSize` prop with `rootCss` prop to allow custom styling in ThreeDots * Add a `ModalBackdrop` that can be used for both `WalletModal` and `GlobalModal` * Fix type issue * Switch over to use `interface` to define object like type * Update/token picker (#105) * fix LINK address * fix getTokenLogo * update pool interfaces to use CENNZAsset * use CENNZAsset, format Numbers to handle error * export new functions * use new functions to fetch Assets & Balances * fix tests * prettier-format * use CENNZAsset & assetIdToErc20 && ethBridge.eventProof * fix build errors/warnings * only fetch balance if EthereumToken * fix exchangeRate, fees & extrinsic * fix test * fix logo not displaying * fixed issue #65 (#107) * Updated Bridge Account Picker (#106) * initial account picker styling * updated with switching accounts and styling * updated with checking if valid address * updated with switching ETH address and cennznet * updated with MM jazzicon * clear error on clear button * updated clear button style and func * use supportedchain * updated with MM logo and MM account listener * update to cleanup event listener * add wCENNZ for Nikau (#111) * add wCENNZ for Nikau * add temp wCENNZ svg, edit tokenButton font-size * rename tokes, use { css } * Emotion Css Refactor (#115) * updated with initial emotion refactor * rest of css refactor * removed global style * Bump follow-redirects from 1.14.7 to 1.14.9 (#113) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.9. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.14.7...v1.14.9) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update `Swap` section (#116) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Remove unused code * Add border-radius to the SwapStats block * Reverse the Accordion chevron icon in `SwapStats` * Wallet update (#117) * Rename `Wallet` to `WalletButton` plus move `WalletModal` outside of `shared` folder * Add new animation to the `WalletModal` while fetching new balances * Add logic to at least show balance for core assets even if they are 0 * Remove unued files * Update `Pool` section (#119) * Add `ThemeProvider` and `CssGlobal` * Add `TokenInput` * Add `Max` button to the `TokenInput` * Config `ThemeProvider` to match with the current section color * Update new prop names * Tidy up dependency list * Update `TokenInput` styling * Re-implement the Swap panel using TokenInput * Add a global style rule to reduce font thickness * Update request variant to match with Roboto variants * Re-add asset balances and max button * Add logic to update the send value depends on the selected token * Rename `sendToken` to `exchangeToken` * Add `SwapButton` using different swap icon and plus animation effect * Update animation speed for ThreeDots * Use generic to determine the return type for `useTokenInput` * Add `useExchangeRate` plus simplify the `fetchExchangeRate` method * Fix swapping not working for non-default pair * Use `Roboto Mono` to display numeric value * Use `CircularProgress` to display loading state for the balances * Follow Uniswap implementation to enforce numeric input * Fix issue when remove exchange value doesn't reset the receive value * Avoid displaying `Connecting...` state * Disable hover effects on `disabled` prop * Fix warning from Mui re out-of-bound for `Select` component * Update theme secodary colors to be in full hex and fix opaicty in backdrop * Rename `useExchangeRate` -> `useSwapExchangeRate` * Use assetId to find CENNZ and CPAY, plus hardcode it to the enviroment variables * Add `decimalValues` to CENNZAsset type for convenience sake * Move `swap/fetchExchangeRate` to `fetchSwapExchangeRate` * Add `big.js` * Move `swap/fetchEstimatedTransactionFee` and `swap/fetchExchangeExtrinsic` to top level `utils` * Add `Gas Fee` info to the Swap info panel * Switch over to use a single LinearProgress component for formInfo box * Put environment variables in `constants.ts` for better type casting * Update styling system to avoid using "!important" in CSSGlobal plus avoid re-render the global styling * Add the box-shadow value to the theme `shadows` array * Add Settings accordion with Slippage input c * Move the (i) icon inline with the text * Add `cennznet-blue` to `assets` folder * Connect submit button with the signAndSendTx function * Switch to use MUI Dialog to make use of its transition effect * Add InProgress overlay and display dialog when tx is complete or incomplete * Add validation when exchange value is greater than max * Fix build errors * Fix build errors * Add workaround for CSS specificity issue * Remove the generic fetchSupportedAssets function * Use `export from` syntax to re-export modules * Re-organise `pages/swap/index.ts` into small components * Replace `input` element in `TokenInput` with IMaskInput * Update to use IMask hook instead to keep the `min` and `max` attributes for native validation * Swap over to use `debounce` instead of `throttle` plus fix issue where debouncing is not working correctly * Fix up form styling * Fix validation issue where input is required to be in specific range * Add `SwapProgress` and use it during SwapForm submission * Tidy up the `pages/swap/index.tsx` * Move to `pages/swap.txs` * Use approximate symbol * Fix build issues * Add prefix to the error code to make it easier to recognise * Tweak the disabled version of the TokenInput * Fix test due to recent changes * Comment out `tests/swap.test.ts` and add `fetchGasFee.test.ts` * Add `fetchSellPrice` test * Change `getBuyAssetExtrinsic` parameters to Number * Fix failed test in `PoolProvider.test.tsx` * Fix issue where cancel the sign prompt will set `txStatus` to "success" * Update "in-progress" title in `SwapProgress` * Remove unused package `suitcss-base` * Set to update gasFee and exchangeRate upon completes the transaction * Update SwapProgress copy * Make receiveInput displays value using `formatBalance` * Reverse `Select` dropdown icon in `TokenInput` * Avoid "Exchange Rate" and "Gas Fee" flickering due re-rendering * Add `MainPanel` and use it to house content for all sections * Remove unused files (again!) * Make the `palceholder` for TokenInput to be "0.0" * Remove `palette.text.highlight` and update components to use their corresponding colors * Declare `getCENNZApiForTest` and `getCENNZCoreAssetForTest` in global namespace * Add `NEXT_PUBLIC_ALLOWED_ASSET_IDS` environment * Update `fetchCENNZAssets` with a few more filters * Rename `SwapButton` to `SwitchButton` as Swap is a reserved namespace * Update type for `vertical` plus set type as "button" to avoid form submission * Add generic `SelectInput` that has matched-styling with `TokenInput` dropdown part * Add `PoolActionsPair` * Rename several variables to make them a bit clearer * Add `useAssetBalances` and move that logic to `SwapAssetsPair` * Fix incorrect ternary logic * Rename `token` to `asset` * Switch to use `HelpOutlineIcon` instead * Use propper callback for `onMaxValueRequest` * Tweak styling for `SwapForm` * Add `PoolAssetsPair` * Switch to use `px` for fontSize * Add copy for `Remove` pool action * Update copy in Swap panel * Add loading state for `useSwapGasFee` and `useSwapExchangeRate` * Sync up the asset input values using exchangeRate * Rename to `getCENNZCoreAssetsForTest` * Pass in both `tradeAsset` and `coreAsset` to `fetchPoolExchangeInfo` * Ensure other input is being reset correctly * Add balances info to `PoolAssetsPair` * Update WalletModal color palette to stay the same across section * Sync up colors between `AppSwitch`, `PageBackdrop` and `PageFrame` * Add `PoolStats` * Add Gas Fee to `PoolStats` * Add `PoolSettings` * Add `PoolForm` as it is * Add custom validation for Core Asset input * Bring certain copy to the Tooltip popper to tidy up the interface * Re-concile all TxStatus to `SwapProvider` * Add `PoolProgress` * Update `fetchPoolExchangeInfo` and `fetchPoolUserInfo` to include more details * Use the correct `minLiquidity` parameter when creating addLiquidity extrinsic * Rename `usePoolBalances` to `usePoolUserInfo` * Update liquidity extrinsic calculation logics * Fix form validation failed when balance is 0 * Update Button color palette to match with the sections * Rename `usePoolExchangeRate` -> `usePoolExchangeRate` * Add `Balance` and use it for liquidity extrinsics * Use Balance class for Wallet Balances * Use `Balance` in `usePoolGasFee` and a few other places * Wrap all method in `Big` to return as `Balance` instance * Update Swap section to use `Balance` * Fix Core Input not updating its validation * Add couple more helper methods to Balance class * Use `registry.findMetaError` to extract more error details * Tidy up code * Update `fetchSellPrice` to use `Balance` clas * Add `usePoolExchangeRate` to better handle the CPAY conversion * Fix build issues * Retire old `pool` codebase * Fix failed tests * Fix JS error when `userInfo` is null * Fix UI issue when CENNZnet is not connected * Fix JS issue when balanceList is not rendered yet * Update yarn v3 (#118) * setup yarn 3.2.0 & typescript plugin, attempt PnP * upgrade packages * set yarn path * lint, add yarn/PnP files to .prettierignore * set `nodeLinker: node-modules` so tests will run * remove console.log * Fix remaining issues in Pool (#120) * Remove commented types * Replace `UnwrapPromise` with the official type `Awaited` instead * Bump @cennznet/api to 2.1.0-rc.1 * Update Pool section to handle exchange pair that have 0 liquidity * Rename `usePoolExchangeRate` to `usePoolCoreAssetValue` * Fix receive input does not update in Swap section * Add some docs to the `usePoolCoreAssetValue` * Replace `formatBalance` with `Balance.format` * Simplify TokenInput to only use a single input instance * Add validation to ensure user has sufficient fund to add/remove liquidity * Allow CoreAsset value input to be freely updated in all scenarios * Update `Bridge` section (#124) * Prep the `Bridge` section for an update * Setup new scaffolding for Bridge page * Update `fetchBridgeTokens` to handle both `Deposit` and `Withdraw` actions * Setup `getStaticProps` for `/bridge` page * Add `MetaMaskExtensionProvider` and `MetaMaskWalletProvider` * Update `SubmitButton` with the new MetaMask connect and styling * Add `BridgeActionsPair` * Add a `useEffect` to check if MetaMask is connected and has account * Add `BridgeTokenDestination` with `TokenInput` part * Rename `useWalletBalances` to `useCENNZBalances` * Add `AddressInput` * Update the ModalBackdrop to use the respective color for each section * Update labels for Token and Address * Update section titles to connect them with the previous version * Add address validation to the Address input * Add `useBridgeStatus` hook and disable the form if it's the case * Add `BridgeProgress` * Update variable naming * Add `sendDepositReqeust` * Use lowercase of the address to avoid mismatching * Add sorting when fetching bridge tokens * Add a temp fix to reset the token select when selected token does not exist * Rename variables for clarity * Avoid uppercase `CENNZnet` * Separate the address field for deposit / withdraw * Reset the balance to null before fetching for new value * Add loading progress to the balance * Update `BridgeForm` with withdraw action * Add a check to ensure bridge is active before proceeding * Add logic to update corresponding wallet balance when switching action * Add routine to check for Deposit status in Relayer * Add a guard to ensure we are in a correct ethereum chain before submitting * Add `BridgeStats` * Fix flickering issue with TokenInput when switch to different action * Remove unused code * Fix up typos * Import `sendWithdrawEthereumRequest` from `@/utils` package instead * Use proper `TransactionResponse` type * Avoid anonymous function calling * Fix typo in filename * Fix build issues (#128) * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * ensure chain if user has previously connected but switched networks (#129) * Auxiliary update (#125) * Add `min-width` to #__next container and ensure app is scrollable below that * Add a message re browser support * Rename variables from `useTokeInput` for better clarity * Fix balance validation due to rounding issue * Reduce the drifting distance * Add GA tracking * Add `next-seo` and setup page title for each section * Add in first entry for CHANGELOG * Remove unused files * Fix typo * Fix up letter spacing for all "Roboto Mono" occurrences * Avoid render Balance if network is not connected * Avoid showing progress bar on the Deposit side * Update favicon plus ticker for CENNZ, wCENNZ and CPAY * Set `padFractionalZeros` default to false * Remove LINK on production for now * Feature/manual historic withdrawal (#123) * allow user to enter historical event proof id * add event proof tooltip * add historical withdraw functionality * return early if historical * remove else statements * Fix build issue due to incorrect filenames * Fix failed test for `fetchBridgeTokens` * Rename old tests to skip them for now * Revert "Rename old tests to skip them for now" This reverts commit 8c10a87. * Use jest.config to ignore test files in `bridge` folder instead of renaming ...Renaming it causing TS to include those files into its compiling process * implement historical withdrawals * remove `required` from historical textfields * extract historical value state to bridge provider * clear values on accordion shrink * shrink accordion if historical withdrawal was successful * notaryKeys if/else -> ternary * increase blockHash input width, allow multiline * update if statement * review fixes * validate block hash * allow user to enter transferValue over their balance for historical withdraw * remove `padFractionalZeros={false}` * simpler block hash validation * fix validation * Wrap tooltip icon with InputAdornment * Rename variable to `disabled` for better clarity Co-authored-by: Ken Vu <[email protected]> * Minor updates (#132) * Update content * Update `format` and `toInput` to remove any padded zeros * Fix build error * Add default share image for App Hub * Define onTokenChange for receive token (#133) * Pre-Release v1.0.0 (#134) * Update production env vars * Update CHANGELOG * Bump `@cennznet/api` to `2.1.0-rc.2` * reduce token list for prod * sort by symbol * prettier, add wETH Co-authored-by: aidan-starke <[email protected]> Co-authored-by: Aidan Starke <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: aidan-starke <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Release v1.0.1 (#147) * Prep for v1.0.1 * Misc fixes (#138) * Use the new icon for CENNZnet * Remove the `public/images` folder * Ensure all icons are matching in sizes * Take into account staking lock when fetching the balance * Address PR-135 feedbacks (#139) * Avoid checking `ethBridge.bridgePaused` status when it's Deposit * Explicitly using assetId to check if it's CPAY * Move BRIDGE / PEG contract addresses to `constants.ts` * Add default timeout value to be `1000` instead of zero * Use `sellAsset` extrinsic to allow fluctuating the receiving token * Update Slippage value and message to match with the `sellAsset` extrinsic * Add >= and <= symbols in front of Slippage * Update messaging around Slippage * Ensure clearing the interval before rejecting error * Update CHANGELOG * Release v1.0.2 (#152) * Prep for release v1.0.2 * Add confirming state to the Bridge (#151) * Reduce the space between `value` and `symbol` * Add `selectMap` * Update progress title during deposit confirming state * Update progress status for withdraw confirming state * Allow mix casing in Progress title * Add a generic missing token (#149) * Remove the generic "Confirming" state * Update API_URL (#154) * prep for release v1.1.0 Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add version number and commit hash to bottom of the page (#182) * Add version number and commit hash to bottom of the page * Use the correct env var for commit sha * Avoid adding the whole `package.json` to runtime JS * Spike/testing (#177) * test `fetchUnclaimedEventProof`, `fetchUnclaimedWithdrawals` * disconnect api after test * test `fetchDepositRelayerStatus` * test `ensureRelayerDepositDone` * test `Balance` - TODO test `fromCodec` & `fromApiBalance` * test `fetchBridgeDepositStatus`, `fetchBridgeWithdrawStatus` * use `global.getCENNZApiForTest()` * update types * fix 'Promise is ignored' warning, update types * test `fetchMetaMaskBalance` * use `global.getEthereumAssetsForTest()` * test `getContract` utils * setup and use `global.getWeb3MockForTest` * use `global.get[provider]TestingAccount` * setup environment to test `signAndSendTx` * test `getAddLiquidityExtrinsic` * test `getRemoveLiquidityExtrinsic` * test `get[Buy/Sell]AssetExtrinsic` utils * test `getExpiryString.ts` * test `getPegWithdrawExtrinsic` * test `is[Ethereum/CENNZ]Address` utils * prettier * setup environment to test `sendDepositRequest` * test `signAndSendTx` * test `sendDepositRequest` * test `sendWithdrawEthereumRequest` * remove TODO - `getPegWithdrawExtrinsic` and `signAndSendTx` are tested * mock `fromCodec` and `fromApiBalance` * remove todo * test `getTokenLogo` * delete unused file * fix typo, use `global.getCENNZApiForTest` * fix `fromCodec` and `fromApiBalance` tests * mock api * update throw test * update error handling * test throw case * use `args` inspection test * fix `timeout` test * change test order * update wCENNZ logo Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ken Vu <[email protected]> Co-authored-by: Eugene Upston <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
Update the UI when transaction In Progress
Details
Changes
ProgressOverlay
generic component for all sectionsBridgeForm
into smaller partsFixes
Notes
Because we want to grab the TX hash as soon as possible so there are substantial changes especially around the Bridge Deposit / Withdraw. Some good tests are needed