From ff63a3ac594d9990283e441649928fb64f2bf793 Mon Sep 17 00:00:00 2001 From: Mike <17463738+mwmerz@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:04:41 -0400 Subject: [PATCH] IS Sprint 22 - 7.3.1 (#476) * fix: property undefined chainID error * fix: convert object error * fixed wallet popover overlapping on top of Send and Recieve title ST-475 (#436) * fix: add scroll to chainlist container (#437) * feat: filter out non-whitelisted tokens (#439) * feat: disable send if wallet is empty (#438) * feat: disable send if wallet is empty * Co-authored-by: Manuel Alessandro Collazo * feat: lunc display * feat: introduce amplitude (#440) * feat: introduce amplitude * feat: fix denom ibc in staking assets dropdown (#448) * feat: fix denom ibc in staking assets dropdown * feat: fix denom ibc in staking assets dropdown 2 * revert: denom undefined default value * fix: add spacing --------- Co-authored-by: Manuel Alessandro Collazo * St 565 val page staking rewards (#447) * feat: fix val page staking rewards * Fix scenario whereby proposal with empty description result in error * Show disabled network name and icon (#454) * ST-492: wallet-kit integration (#418) * Use new IBC channels (#453) * Improve LUNC/LUNA IBC detection (#456) * fix ibc lunc * fix readNativeDenom() * fix undefined chainID * Use chainID to map unknownIBCDenoms * fix ts error * feat: chain dependent staking functionality (#450) * wip: neutron chain integation * wip: use network by chain feature * feat: chain dependent staking functionality * chore: revert local url * chore: remove unused imports * feat: St 543 implement amplitude (#455) * wip: amplitude tracking revisions * feat: amplitude setup and tx event track * fix: add versioning to amplitude client * chore: fix versioning * fix: price calculation Fixing issue with being unable to click withdraw rewards when there are rewards available. * chore: update package-lock.json * fix ibc token denoms (#460) * FIX: swap Read component (#461) * fix swap Read component * show 0 if integer is undefined * show % if there are no decimals * fix: undefined prices `ncheq` not available in price list. Protect against denoms not being available in memoizedPrices. * Fix ICS20 send back * fix ICS20 denom calculation * fix kujira factory IBC tokens (#466) * fix kujira factory IBC tokens * fix send back and use prefix to detect kujira * feat: validate amount inputs (#465) * feat: validate number fields in amount inputs * fix: hide input spin button * fix: unintended form validation * chore: rem kado buy button (#467) * chore: rem rewards weight from stake table (#468) * chore: rem rewards weight from stake table * fix: rem rewards rate from 2 other places * chore: added more spacing on the Quick Stake table --------- Co-authored-by: Joshua * fix: pass decimals in fee estimation (#471) * St 619 localterra fix (#469) * localterra setup * improve hot reload speed, add env vars in constants * update preconfigured wallets * update package.json scripts * Update preconfigured.json * fix merge * add network scan to localterra * restore src/config/preconfigured.json orig state * chore(deps): bump semver from 7.3.7 to 7.5.2 (#444) Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.5.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.5.2) --- updated-dependencies: - dependency-name: semver dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump tough-cookie from 4.0.0 to 4.1.3 (#462) Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3. - [Release notes](https://github.com/salesforce/tough-cookie/releases) - [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md) - [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3) --- updated-dependencies: - dependency-name: tough-cookie dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 (#474) * chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: Mike <17463738+mwmerz@users.noreply.github.com> * fix: allow decimals in swap (#477) * St 505 fix history pagination with cosmos sdk 46 (#475) * wip: use new pagination keys for terra only. * feat: lower history limit to 75 * Revert "chore: rem kado buy button (#467)" This reverts commit db138e58bcc6c5f80f1007f10fe3b6f31c1a86bf. --------- Signed-off-by: dependabot[bot] Co-authored-by: Manuel Alessandro Collazo Co-authored-by: Joshua Brigati Co-authored-by: plubber <51789398+ericHgorski@users.noreply.github.com> Co-authored-by: Terence Lim Co-authored-by: Alessandro Candeago <54709706+alecande11@users.noreply.github.com> Co-authored-by: Joshua Co-authored-by: Greg Junge Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .dockerignore | 4 ++ .env | 3 + Dockerfile | 59 ++++++++++++++++++ docker-assets/haproxy.cfg | 44 ++++++++++++++ docker-compose.yml | 66 +++++++++++++++++++++ package-lock.json | 56 ++++++++--------- package.json | 8 ++- src/app/InitNetworks.tsx | 1 + src/components/form/Input.tsx | 1 + src/components/layout/Table.module.scss | 8 +++ src/components/layout/Table.tsx | 2 +- src/config/constants.ts | 7 ++- src/pages/history/HistoryList.tsx | 42 +++++++++++-- src/pages/stake/QuickStake.tsx | 29 +-------- src/pages/stake/StakingDetailsCompact.tsx | 7 --- src/pages/stake/Validators.tsx | 28 --------- src/pages/wallet/IbcSendBackTx.tsx | 1 + src/pages/wallet/SendPage.tsx | 1 + src/pages/wallet/TransferPage.tsx | 1 + src/styles/_customize.scss | 10 ++++ src/txs/Tx.tsx | 1 + src/txs/gov/DepositForm.tsx | 1 + src/txs/gov/SubmitProposalForm.tsx | 3 + src/txs/stake/QuickStakeForm.tsx | 18 +----- src/txs/stake/StakeForm.tsx | 1 + src/txs/swap/TFMSwapForm.tsx | 2 + src/txs/swap/components/AssetFormItem.tsx | 8 ++- src/txs/swap/components/SlippageControl.tsx | 2 +- src/txs/wasm/ExecuteContractForm.tsx | 1 + src/txs/wasm/InstantiateContractForm.tsx | 2 + src/txs/wasm/MigrateContractForm.tsx | 1 + 31 files changed, 302 insertions(+), 116 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-assets/haproxy.cfg create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b2b737a0d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Dockerfile +docker-compose.yml +build/ +node_modules/ diff --git a/.env b/.env index 0157db51e..bb59fd5f7 100644 --- a/.env +++ b/.env @@ -1 +1,4 @@ SASS_PATH=node_modules:src/styles + +# Docker Compose +COMPOSE_PROJECT_NAME=localterra \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..62e7b545d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +FROM node:16 as builder + +WORKDIR /app + +RUN set -eux &&\ + apt update &&\ + apt install -y \ + libudev-dev \ + libusb-1.0-0-dev + +COPY package*.json ./ +COPY tsconfig.json ./ + +RUN set -eux && \ + npm install -g typescript react-scripts && \ + npm install --include=dev + +COPY . . + +ARG REACT_APP_ASSETS="https://assets.terra.money" \ + REACT_APP_STATION_ASSETS="https://station-assets.terra.money" + +ENV REACT_APP_ASSETS=${REACT_APP_ASSETS} \ + REACT_APP_STATION_ASSETS=${REACT_APP_STATION_ASSETS} + +RUN set -eux && \ + npm run build --openssl-legacy-provider + +############################################################################### + +FROM node:16 as reloader + +ARG REACT_APP_ASSETS="https://assets.terra.money" \ + REACT_APP_STATION_ASSETS="https://station-assets.terra.money" + +ENV REACT_APP_ASSETS=${REACT_APP_ASSETS} \ + REACT_APP_STATION_ASSETS=${REACT_APP_STATION_ASSETS} + +# add node modules to parent directory +COPY --from=builder /app/node_modules /app/node_modules +ENV PATH=/app/node_modules/.bin:$PATH + +# use bind mount to enable hot reloading +WORKDIR /app/src +COPY . . + +CMD ["npm", "run", "start"] + +############################################################################### + +FROM node:16-alpine + +WORKDIR /app +COPY --from=builder /app/build . + +RUN set -eux && \ + npm install -g serve + +CMD ["serve", "-s", "."] diff --git a/docker-assets/haproxy.cfg b/docker-assets/haproxy.cfg new file mode 100644 index 000000000..fcc7dfc65 --- /dev/null +++ b/docker-assets/haproxy.cfg @@ -0,0 +1,44 @@ +global + log stdout format raw daemon debug + #chroot /var/lib/haproxy + #stats socket /var/run/haproxy.sock mode 660 level admin expose-fd listeners + #stats timeout 30s + user haproxy + group haproxy + daemon + +defaults + log global + mode http + option httplog + option dontlognull + option forwardfor + option http-server-close + option redispatch + retries 3 + timeout http-request 10s + timeout queue 1m + timeout connect 10s + timeout client 1m + timeout server 1m + timeout http-keep-alive 10s + timeout check 10s + maxconn 3000 + +frontend stats + bind *:8444 + stats enable + stats uri / + stats refresh 10s + +frontend localterra + bind *:1317 + http-response set-header Access-Control-Allow-Origin * + http-response set-header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" + http-response set-header Access-Control-Allow-Headers "*" + http-response set-header Access-Control-Max-Age 3600 + default_backend localterra_lcd_backend + +backend localterra_lcd_backend + mode http + server localterra_lcd localterra:1317 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..1f93add33 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,66 @@ +version: '3.9' + +############################################################################### +services: + + haproxy: + image: haproxy:2.8.0-alpine + volumes: + - ./docker-assets/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro + networks: + - default + ports: + - '1317:1317' + - '8444:8444' + + localterra: + image: ghcr.io/terra-money/localterra:${TERRA_VERSION:-latest} + platform: linux/amd64 + hostname: terrad + volumes: + - terra:/app + networks: + - default + + assets: + image: ghcr.io/terra-money/station-assets:1.0.1 + hostname: assets + networks: + - default + ports: + - '3001:3001' + + station: + build: + context: ./ + dockerfile: Dockerfile + target: reloader + args: + REACT_APP_ASSETS: http://localhost:3001 + REACT_APP_STATION_ASSETS: http://localhost:3001 + image: ghcr.io/terra-money/station:localhr + networks: + - default + ports: + - '3000:3000' + # To enable/disable hot reload in station + # comment/uncomment the build `target` above and + # comment/uncomment the following lines below + command: > + /bin/sh -c " + echo 'Development server will take 2-3min to start up.' && \ + exec npm run start" + environment: + NODE_ENV: "development" + HTTPS: "false" + volumes: + - ./:/app/dev + - /app/dev/node_modules + +############################################################################### + +volumes: + terra: + +networks: + default: diff --git a/package-lock.json b/package-lock.json index eb8f9dab0..0664ebb72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "recoil": "^0.7.2", "sass": "^1.52.1", "secp256k1": "^4.0.3", - "semver": "^7.3.7", + "semver": "^7.5.2", "sentence-case": "^3.0.4", "xss": "1.0.11" }, @@ -22086,9 +22086,9 @@ } }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -24443,23 +24443,24 @@ } }, "node_modules/tough-cookie": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", - "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", - "universalify": "^0.1.2" + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { "node": ">=6" } }, "node_modules/tough-cookie/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true, "engines": { "node": ">= 4.0.0" @@ -26767,9 +26768,9 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -44475,9 +44476,9 @@ } }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", "requires": { "lru-cache": "^6.0.0" } @@ -46393,20 +46394,21 @@ "dev": true }, "tough-cookie": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", - "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, "requires": { "psl": "^1.1.33", "punycode": "^2.1.1", - "universalify": "^0.1.2" + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "dependencies": { "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true } } @@ -48297,9 +48299,9 @@ } }, "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "dev": true }, "workbox-background-sync": { diff --git a/package.json b/package.json index 0c4b4894f..e4e3c4378 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,11 @@ "test": "react-scripts test", "prepare": "husky install", "pre-commit": "lint-staged", - "analyze": "source-map-explorer 'build/static/js/*.js'" + "analyze": "source-map-explorer 'build/static/js/*.js'", + "dc:up": "docker-compose up --build -d", + "dc:logs": "docker-compose logs -f", + "dc:down": "docker-compose down", + "dc:purge": "docker compose rm -f -s -v && docker volume rm localterra_terra" }, "dependencies": { "@amplitude/analytics-browser": "^2.0.0", @@ -59,7 +63,7 @@ "recoil": "^0.7.2", "sass": "^1.52.1", "secp256k1": "^4.0.3", - "semver": "^7.3.7", + "semver": "^7.5.2", "sentence-case": "^3.0.4", "xss": "1.0.11" }, diff --git a/src/app/InitNetworks.tsx b/src/app/InitNetworks.tsx index 5be4b460e..3ddb50ff5 100644 --- a/src/app/InitNetworks.tsx +++ b/src/app/InitNetworks.tsx @@ -41,6 +41,7 @@ const InitNetworks = ({ children }: PropsWithChildren<{}>) => { ...networks.mainnet, ...networks.testnet, ...networks.classic, + ...networks.localterra, } ?? {} ).map((chain) => { const lcd = customLCDs[chain?.chainID] ?? chain.lcd diff --git a/src/components/form/Input.tsx b/src/components/form/Input.tsx index 489d9d13c..a75791ce0 100644 --- a/src/components/form/Input.tsx +++ b/src/components/form/Input.tsx @@ -31,6 +31,7 @@ const Input = forwardRef( before: token || actionButton, after: selectBefore, })} + step="any" autoComplete="off" ref={ref} /> diff --git a/src/components/layout/Table.module.scss b/src/components/layout/Table.module.scss index 18947249e..113c6ce29 100644 --- a/src/components/layout/Table.module.scss +++ b/src/components/layout/Table.module.scss @@ -148,3 +148,11 @@ border-top: 0px solid var(--card-border); } } + +.actions { + padding-left: 100px !important; + + @media (max-width: 1550px) and (min-width: 1420px) { + padding-left: 50px !important; + } +} diff --git a/src/components/layout/Table.tsx b/src/components/layout/Table.tsx index ad8610f9b..f9fc765fb 100644 --- a/src/components/layout/Table.tsx +++ b/src/components/layout/Table.tsx @@ -50,7 +50,7 @@ function Table({ dataSource, filter, rowKey, ...props }: Props) { const columns = props.columns.filter(({ hidden }) => !hidden) /* helpers */ - const getClassName = ({ align }: Column) => cx(align) + const getClassName = ({ align, dataIndex }: Column) => cx(align, dataIndex) /* pagination */ const [page, setPage] = useState(1) diff --git a/src/config/constants.ts b/src/config/constants.ts index a5a9bd8d3..e1a959d55 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -5,8 +5,11 @@ export const LAZY_LIMIT = 999 export const BRIDGE = "https://walletconnect.terra.dev" /* api */ -export const ASSETS = "https://assets.terra.money" -export const STATION_ASSETS = "https://station-assets.terra.money" +export const ASSETS = + process.env.REACT_APP_ASSETS ?? "https://assets.terra.money" +export const STATION_ASSETS = + process.env.REACT_APP_STATION_ASSETS ?? "https://station-assets.terra.money" + export const OBSERVER = "wss://observer.terra.dev" /* website */ diff --git a/src/pages/history/HistoryList.tsx b/src/pages/history/HistoryList.tsx index 74f2923ca..4d208a06b 100644 --- a/src/pages/history/HistoryList.tsx +++ b/src/pages/history/HistoryList.tsx @@ -7,16 +7,45 @@ import { Card, Col, Page } from "components/layout" import { Empty } from "components/feedback" import HistoryItem from "./HistoryItem" import { useInterchainAddresses } from "auth/hooks/useAddress" +import { isTerraChain } from "utils/chain" interface Props { chainID?: string } +interface PaginationKeys { + limit: string + offset: string + reverse: string +} + +/** + * Returns pagination keys for the given chain. Switched by cosmos_sdk + * version in the future, isTerra for now. + * + * @param isTerra boolean based on chain-id. True if Terra, false if not. + */ +function getPaginationKeys(isTerra: boolean): PaginationKeys { + if (isTerra) { + return { + limit: "limit", + offset: "page", + reverse: "orderBy", + } + } else { + return { + limit: "pagination.limit", + offset: "pagination.offset", + reverse: "pagination.reverse", + } + } +} + const HistoryList = ({ chainID }: Props) => { const addresses = useInterchainAddresses() const networks = useNetwork() - const LIMIT = 100 + const LIMIT = 75 const EVENTS = [ // any tx signed by the user "message.sender", @@ -32,6 +61,11 @@ const HistoryList = ({ chainID }: Props) => { .map((chain) => { const address = chain && addresses?.[chain] + const isTerra = isTerraChain(chain) + + // return pagination keys by network. + const paginationKeys = getPaginationKeys(isTerra) + return { queryKey: [queryKey.History, networks?.[chain]?.lcd, address], queryFn: async () => { @@ -49,9 +83,9 @@ const HistoryList = ({ chainID }: Props) => { params: { events: `${event}='${address}'`, //order_by: "ORDER_BY_DESC", - "pagination.offset": 0 || undefined, - "pagination.reverse": true, - "pagination.limit": LIMIT, + [paginationKeys.offset]: 0 || undefined, + [paginationKeys.reverse]: isTerra ? 2 : true, + [paginationKeys.limit]: LIMIT, }, }) }) diff --git a/src/pages/stake/QuickStake.tsx b/src/pages/stake/QuickStake.tsx index 194273816..2034bf94f 100644 --- a/src/pages/stake/QuickStake.tsx +++ b/src/pages/stake/QuickStake.tsx @@ -1,4 +1,3 @@ -import { readPercent } from "@terra-money/terra-utils" import { Button } from "components/general" import { Flex, Grid, InlineFlex, Page, Table, Tabs } from "components/layout" import { useBalances } from "data/queries/bank" @@ -265,35 +264,9 @@ const QuickStake = () => { render: (value = 0) => t("{{value}} days", { value }), align: "right", }, - { - title: ( - - {t("Rewards weight")}{" "} - -

- The amount of rewards an Alliance asset accrues is - determined by the asset's Reward Weight. -

-

- This parameter is set by governance and represents the - maximum proportion of rewards an asset will earn. -

- - } - /> -
- ), - dataIndex: "rewards", - defaultSortOrder: "desc", - sorter: ({ rewards: a = 0 }, { rewards: b = 0 }) => a - b, - render: (rewards = 0) => readPercent(rewards), - align: "right", - }, { title: t("Actions"), - dataIndex: ["asset", "chainID"], + dataIndex: "actions", render: ( _, { diff --git a/src/pages/stake/StakingDetailsCompact.tsx b/src/pages/stake/StakingDetailsCompact.tsx index 57b2c4723..7caa5c2ed 100644 --- a/src/pages/stake/StakingDetailsCompact.tsx +++ b/src/pages/stake/StakingDetailsCompact.tsx @@ -4,7 +4,6 @@ import styles from "./StakingDetailsCompact.module.scss" import { useNativeDenoms } from "data/token" import { useNetworkWithFeature } from "data/wallet" import { useTranslation } from "react-i18next" -import { readPercent } from "@terra-money/terra-utils" import { useDelegations, useStakingParams } from "data/queries/staking" import { useAlliance, useAllianceDelegations } from "data/queries/alliance" import { combineState } from "data/query" @@ -92,12 +91,6 @@ const StakingDetailsCompact = ({
{t("Unbonding period")}:
{t("{{value}} days", { value: daysToUnbond })}
-
-
{t("Rewards rate")}:
-
- {readPercent(isAlliance ? alliance?.reward_weight ?? 0 : 1)} -
-
{!!delegated && (
diff --git a/src/pages/stake/Validators.tsx b/src/pages/stake/Validators.tsx index 3e96459a7..8681f8068 100644 --- a/src/pages/stake/Validators.tsx +++ b/src/pages/stake/Validators.tsx @@ -24,7 +24,6 @@ import { } from "data/queries/staking" import { combineState } from "data/query" import { useNativeDenoms } from "data/token" -import { readPercent } from "@terra-money/terra-utils" import { Tooltip, TooltipIcon } from "components/display" import { ChainFeature } from "types/chains" @@ -243,33 +242,6 @@ const Validators = () => { render: (value = 0) => t("{{value}} days", { value }), align: "right", }, - { - title: ( - - {t("Rewards weight")}{" "} - -

- The amount of rewards an Alliance asset accrues is - determined by the asset's Reward Weight. -

-

- This parameter is set by governance and represents - the maximum proportion of rewards an asset will - earn. -

- - } - /> -
- ), - dataIndex: "rewards", - defaultSortOrder: "desc", - sorter: ({ rewards: a = 0 }, { rewards: b = 0 }) => a - b, - render: (rewards = 0) => readPercent(rewards), - align: "right", - }, ]} /> diff --git a/src/pages/wallet/IbcSendBackTx.tsx b/src/pages/wallet/IbcSendBackTx.tsx index 71c53d29b..e00d18fc2 100644 --- a/src/pages/wallet/IbcSendBackTx.tsx +++ b/src/pages/wallet/IbcSendBackTx.tsx @@ -286,6 +286,7 @@ function IbcSendBackTx({ token, chainID }: Props) { decimals ), })} + type="number" token={ibcDetails?.baseDenom} inputMode="decimal" onFocus={max.reset} diff --git a/src/pages/wallet/SendPage.tsx b/src/pages/wallet/SendPage.tsx index 7b04ea469..998ed0f74 100644 --- a/src/pages/wallet/SendPage.tsx +++ b/src/pages/wallet/SendPage.tsx @@ -442,6 +442,7 @@ const SendPage = () => { ), })} token={asset} + type="number" inputMode="decimal" onFocus={max.reset} placeholder={getPlaceholder(decimals)} diff --git a/src/pages/wallet/TransferPage.tsx b/src/pages/wallet/TransferPage.tsx index 8417c77ce..f93d8ba2d 100644 --- a/src/pages/wallet/TransferPage.tsx +++ b/src/pages/wallet/TransferPage.tsx @@ -421,6 +421,7 @@ const TransferPage = () => { ), })} token={asset} + type="number" inputMode="decimal" onFocus={max.reset} placeholder={getPlaceholder(decimals)} diff --git a/src/styles/_customize.scss b/src/styles/_customize.scss index d71e04908..cdcc37c30 100644 --- a/src/styles/_customize.scss +++ b/src/styles/_customize.scss @@ -63,3 +63,13 @@ .recharts-legend-wrapper { max-width: 45%; } + +input[type="number"] { + -moz-appearance: textfield; +} + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} diff --git a/src/txs/Tx.tsx b/src/txs/Tx.tsx index 5dc2de35c..07dc5c389 100644 --- a/src/txs/Tx.tsx +++ b/src/txs/Tx.tsx @@ -376,6 +376,7 @@ function Tx(props: Props) {
{gasFee.amount && ( { })} token={networks[chain].baseAsset} onFocus={max.reset} + type="number" inputMode="decimal" placeholder={getPlaceholder()} autoFocus diff --git a/src/txs/gov/SubmitProposalForm.tsx b/src/txs/gov/SubmitProposalForm.tsx index 318f5c326..ede109495 100644 --- a/src/txs/gov/SubmitProposalForm.tsx +++ b/src/txs/gov/SubmitProposalForm.tsx @@ -242,6 +242,7 @@ const SubmitProposalForm = ({ chain }: { chain: string }) => { validate: validate.input(toInput(max)), })} inputMode="decimal" + type="number" placeholder={placeholder} selectBefore={ @@ -483,6 +485,7 @@ const SubmitProposalForm = ({ chain }: { chain: string }) => { true ), })} + type="number" token={networks[chain].baseAsset} onFocus={max.reset} inputMode="decimal" diff --git a/src/txs/stake/QuickStakeForm.tsx b/src/txs/stake/QuickStakeForm.tsx index 78c93222b..c98d3b9b1 100644 --- a/src/txs/stake/QuickStakeForm.tsx +++ b/src/txs/stake/QuickStakeForm.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo } from "react" import { useTranslation } from "react-i18next" import { useForm } from "react-hook-form" import { Coin } from "@terra-money/feather.js" -import { readPercent, toAmount } from "@terra-money/terra-utils" +import { toAmount } from "@terra-money/terra-utils" import { getAmount } from "utils/coin" import { combineState, queryKey } from "data/query" import { useNetwork } from "data/wallet" @@ -38,21 +38,12 @@ interface Props { balances: { denom: string; amount: string }[] chainID: string denom: string - rewardRate: number unbondingTime: number isAlliance: boolean } const QuickStakeForm = (props: Props) => { - const { - action, - balances, - chainID, - denom, - rewardRate, - unbondingTime, - isAlliance, - } = props + const { action, balances, chainID, denom, unbondingTime, isAlliance } = props const { t } = useTranslation() const addresses = useInterchainAddresses() @@ -197,10 +188,6 @@ const QuickStakeForm = (props: Props) => {
{t("Unbonding period")}:
{t("{{value}} days", { value: unbondingTime })}
-
-
{t("Rewards rate")}:
-
{readPercent(rewardRate)}
-
{ valueAsNumber: true, validate: validate.input(toInput(max.amount)), })} + type="number" token={denom} onFocus={max.reset} inputMode="decimal" diff --git a/src/txs/stake/StakeForm.tsx b/src/txs/stake/StakeForm.tsx index ad68359bc..f7f2a644b 100644 --- a/src/txs/stake/StakeForm.tsx +++ b/src/txs/stake/StakeForm.tsx @@ -289,6 +289,7 @@ const StakeForm = (props: Props) => { })} token={denom} onFocus={max.reset} + type="number" inputMode="decimal" placeholder={getPlaceholder()} autoFocus diff --git a/src/txs/swap/TFMSwapForm.tsx b/src/txs/swap/TFMSwapForm.tsx index 7fe39c485..ab73dd373 100644 --- a/src/txs/swap/TFMSwapForm.tsx +++ b/src/txs/swap/TFMSwapForm.tsx @@ -290,6 +290,7 @@ const TFMSwapForm = ({ chainID }: { chainID: string }) => { ), })} inputMode="decimal" + type="number" placeholder={getPlaceholder(offerDecimals)} onFocus={max.reset} autoFocus @@ -333,6 +334,7 @@ const TFMSwapForm = ({ chainID }: { chainID: string }) => { })} input={slippageInput} // to warn inputMode="decimal" + type="number" placeholder={getPlaceholder(2)} error={errors.slippageInput?.message} /> diff --git a/src/txs/swap/components/AssetFormItem.tsx b/src/txs/swap/components/AssetFormItem.tsx index 2c8defadd..799929951 100644 --- a/src/txs/swap/components/AssetFormItem.tsx +++ b/src/txs/swap/components/AssetFormItem.tsx @@ -36,7 +36,13 @@ export const AssetInput = forwardRef( ref: ForwardedRef ) => { return ( - + ) } ) diff --git a/src/txs/swap/components/SlippageControl.tsx b/src/txs/swap/components/SlippageControl.tsx index d536fa40c..7cabc685a 100644 --- a/src/txs/swap/components/SlippageControl.tsx +++ b/src/txs/swap/components/SlippageControl.tsx @@ -33,7 +33,7 @@ const SlippageControl = forwardRef(
- + %
diff --git a/src/txs/wasm/ExecuteContractForm.tsx b/src/txs/wasm/ExecuteContractForm.tsx index 0af708960..64c0c46d9 100644 --- a/src/txs/wasm/ExecuteContractForm.tsx +++ b/src/txs/wasm/ExecuteContractForm.tsx @@ -123,6 +123,7 @@ const ExecuteContractForm = () => { valueAsNumber: true, })} inputMode="decimal" + type="number" placeholder={getPlaceholder(decimals)} selectBefore={ diff --git a/src/txs/wasm/MigrateContractForm.tsx b/src/txs/wasm/MigrateContractForm.tsx index c1d65d10e..79f1c93b2 100644 --- a/src/txs/wasm/MigrateContractForm.tsx +++ b/src/txs/wasm/MigrateContractForm.tsx @@ -72,6 +72,7 @@ const MigrateContractForm = ({ contract }: { contract: AccAddress }) => { }, })} inputMode="decimal" + type="number" placeholder="1" autoFocus />