From bca052cf32516ffc0978a5ad52009e9cde5fec27 Mon Sep 17 00:00:00 2001 From: devinxl Date: Tue, 28 May 2024 14:58:21 +0800 Subject: [PATCH 1/5] fix(dcellar-web-ui): unified encoding method same as go-sdk --- apps/dcellar-web-ui/package.json | 5 +++- apps/dcellar-web-ui/src/utils/string.ts | 37 +++++++++++++++---------- common/config/rush/pnpm-lock.yaml | 8 +++--- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/apps/dcellar-web-ui/package.json b/apps/dcellar-web-ui/package.json index 1ef8bfae..2f80facf 100644 --- a/apps/dcellar-web-ui/package.json +++ b/apps/dcellar-web-ui/package.json @@ -19,7 +19,7 @@ "antd": "5.11.0", "ahooks": "3.7.7", "hash-wasm": "4.10.0", - "@bnb-chain/greenfield-js-sdk": "2.1.0-alpha.0", + "@bnb-chain/greenfield-js-sdk": "2.1.0-alpha.2", "@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.32", "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", @@ -92,5 +92,8 @@ "prettier --write" ], "*.ts?(x)": "tsc-files --noEmit" + }, + "browser": { + "crypto": false } } diff --git a/apps/dcellar-web-ui/src/utils/string.ts b/apps/dcellar-web-ui/src/utils/string.ts index 9b04c2f8..a74beeaa 100644 --- a/apps/dcellar-web-ui/src/utils/string.ts +++ b/apps/dcellar-web-ui/src/utils/string.ts @@ -1,5 +1,6 @@ import { IQuotaProps } from '@bnb-chain/greenfield-js-sdk'; import BigNumber from 'bignumber.js'; +import { hexlify, toUtf8Bytes } from 'ethers/lib/utils'; export const trimFloatZero = (str: string) => { const [intStr, floatStr] = str.split('.'); @@ -89,22 +90,30 @@ export const encodeObjectName = (pathName: string) => { encodedPathName += s; continue; + // default: + // // . ! @ # $ % ^ & * ) ( - + = { } [ ] / " , ' < > ~ \ .` ? : ; | \\ + // // eslint-disable-next-line no-useless-escape + // if (/[.!@#$%^&*)(\-+={}\[\]\/",'<>~·`?:;|\\]+$/.test(s)) { + // // english characters + // const hexStr = s.charCodeAt(0).toString(16); + // encodedPathName += '%' + hexStr.toUpperCase(); + // } else { + // // others characters + // try { + // encodedPathName += encodeURI(s); + // } catch (e) { + // encodedPathName += s; + // } + // } // others characters need to be encoded - default: - // . ! @ # $ % ^ & * ) ( - + = { } [ ] / " , ' < > ~ \ .` ? : ; | \\ - // eslint-disable-next-line no-useless-escape - if (/[.!@#$%^&*)(\-+={}\[\]\/",'<>~·`?:;|\\]+$/.test(s)) { - // english characters - const hexStr = s.charCodeAt(0).toString(16); - encodedPathName += '%' + hexStr.toUpperCase(); - } else { - // others characters - try { - encodedPathName += encodeURI(s); - } catch (e) { - encodedPathName += s; - } + default: { + const u = toUtf8Bytes(s); + + for (let i = 0; i < u.length; i++) { + const hexStr = hexlify(u[i]); + encodedPathName += '%' + hexStr.slice(2).toUpperCase(); } + } } } return encodedPathName; diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 373c7230..0ddd270b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -8,7 +8,7 @@ importers: ../../apps/dcellar-web-ui: specifiers: '@bnb-chain/greenfield-cosmos-types': 0.4.0-alpha.32 - '@bnb-chain/greenfield-js-sdk': 2.1.0-alpha.0 + '@bnb-chain/greenfield-js-sdk': 2.1.0-alpha.2 '@commitlint/cli': ^17.4.3 '@commitlint/config-conventional': ^17.4.3 '@emotion/react': ^11.10.5 @@ -75,7 +75,7 @@ importers: wagmi: ~1.4.10 dependencies: '@bnb-chain/greenfield-cosmos-types': 0.4.0-alpha.32 - '@bnb-chain/greenfield-js-sdk': 2.1.0-alpha.0 + '@bnb-chain/greenfield-js-sdk': 2.1.0-alpha.2 '@emotion/react': 11.11.3_mj3jo2baq3jslihcop7oivercy '@emotion/styled': 11.11.0_44o7ug6fvmx5wru7ifqtcwoy2i '@next/bundle-analyzer': 13.5.6 @@ -1497,8 +1497,8 @@ packages: protobufjs: 6.11.4 dev: false - /@bnb-chain/greenfield-js-sdk/2.1.0-alpha.0: - resolution: {integrity: sha512-QEXoofh2VAo6oCCSiyirCf41txbHc9TuuA5ETQMImqdlQQTWTSBfQQEmiVLScKYoNMd7boTDQTTIq0z0yK9RPQ==} + /@bnb-chain/greenfield-js-sdk/2.1.0-alpha.2: + resolution: {integrity: sha512-frYyzOPLGqTC1NPDhSaYrCdLvNxVwB+C1aJFdl00sqShIMA1FfXrChbDcD1Iw2XWRrFwblVzDdzATWSAYxZ2aA==} dependencies: '@bnb-chain/greenfield-cosmos-types': 0.4.0-alpha.32 '@cosmjs/proto-signing': 0.32.2 From 0afb27dfc55ca827b4259f391f89b3fd1cca8c32 Mon Sep 17 00:00:00 2001 From: devinxl <94832688+devinxl@users.noreply.github.com> Date: Thu, 30 May 2024 17:01:48 +0800 Subject: [PATCH 2/5] feat(dcellar-web-ui): add bucket status tip to the bucket detail drawer (#388) --- .../components/DetailBucketOperation.tsx | 30 ++++++++++++++++++- .../dcellar-web-ui/src/store/slices/bucket.ts | 5 +++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx b/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx index 63cf8687..fe01c558 100644 --- a/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx +++ b/apps/dcellar-web-ui/src/modules/bucket/components/DetailBucketOperation.tsx @@ -44,6 +44,7 @@ import { useMount, useUnmount } from 'ahooks'; import { DEFAULT_TAG } from '@/components/common/ManageTags'; import { Activities } from '@/components/Activities'; import { BucketStatus } from '@bnb-chain/greenfield-js-sdk'; +import { DiscontinueBanner } from '@/components/common/DiscontinueBanner'; export const Label = ({ children }: PropsWithChildren) => ( @@ -101,6 +102,12 @@ export const DetailBucketOperation = memo(function D }, }; + const isFlowRateLimit = ['1', '3'].includes(selectedBucketInfo?.OffChainStatus); + const isBucketDiscontinue = + selectedBucketInfo.BucketStatus === BucketStatus.BUCKET_STATUS_DISCONTINUED; + const isBucketMigrating = + selectedBucketInfo.BucketStatus === BucketStatus.BUCKET_STATUS_MIGRATING; + const quotaDetail = [ { key: 'Monthly quota', @@ -418,7 +425,7 @@ export const DetailBucketOperation = memo(function D <> Bucket Detail - + @@ -477,6 +484,27 @@ export const DetailBucketOperation = memo(function D + {isFlowRateLimit && ( + + )} + {isBucketDiscontinue && ( + + )} + {isBucketMigrating && ( + } + color={'#1184EE'} + bg="opacity7" + marginBottom={16} + content="This bucket is in the process of data migration to another provider." + /> + )} {VERSION_TABS.map((tab) => ( diff --git a/apps/dcellar-web-ui/src/store/slices/bucket.ts b/apps/dcellar-web-ui/src/store/slices/bucket.ts index 6a7f66ff..79bb7531 100644 --- a/apps/dcellar-web-ui/src/store/slices/bucket.ts +++ b/apps/dcellar-web-ui/src/store/slices/bucket.ts @@ -243,7 +243,10 @@ export const setupBucketList = } const bucketList = - res.body?.map((bucket) => ({ ...bucket, BucketInfo: { ...bucket.BucketInfo } })) || []; + res.body?.map((bucket) => ({ + ...bucket, + BucketInfo: { ...bucket.BucketInfo, BucketStatus: 1 }, + })) || []; const bucketSpInfo = bucketList.map((b) => ({ bucketName: b.BucketInfo.BucketName, From ed38e744c249ab80f3972ea60f6d82559dce4a58 Mon Sep 17 00:00:00 2001 From: devinxl Date: Thu, 30 May 2024 17:02:52 +0800 Subject: [PATCH 3/5] feat(dcellar-web-ui): replace the related links of bnb greenfield doc --- README.md | 6 +++--- apps/dcellar-web-ui/src/components/layout/Nav/index.tsx | 4 ++-- .../src/modules/pricing-calculator/components/FAQ.tsx | 4 ++-- .../modules/pricing-calculator/components/PricingCard.tsx | 2 +- .../src/modules/welcome/components/DeveloperTools.tsx | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 591c89f1..8042a193 100644 --- a/README.md +++ b/README.md @@ -138,12 +138,12 @@ If you use editor other than vscode, just make your app's directory as your work ## Documentation Links - [Greenfield Whitepaper](https://github.com/bnb-chain/greenfield-whitepaper) -- [Guide to BNB Greenfield](https://docs.bnbchain.org/greenfield-docs/docs/guide/home) +- [Guide to BNB Greenfield](https://docs.bnbchain.org/bnb-greenfield/) - [Guide to DCellar](https://docs.nodereal.io/docs/dcellar-get-started) - [Guide to Rush](https://rushjs.io/pages/intro/welcome/) - [Guide to Apollo](https://github.com/apolloconfig/apollo) -- [BNB Greenfield Release Notes](https://docs.bnbchain.org/greenfield-docs/docs/release-notes/releaseNotes/#greenfield-v023---testnet-maintenance-upgrade-reset) -- [BNB Greenfield RPC Endpoints](https://docs.bnbchain.org/greenfield-docs/docs/api/endpoints/) +- [BNB Greenfield Release Notes](https://docs.bnbchain.org/bnb-greenfield/release-notes/releaseNotes/) +- [BNB Greenfield RPC Endpoints](https://docs.bnbchain.org/bnb-greenfield/for-developers/network-endpoint/endpoints/?h=rpc) - [@bnb-chain/greenfield-js-sdk](https://docs.bnbchain.org/greenfield-js-sdk/) - [@node-real/uikit](https://node-real.github.io/uikit/#/guides) - [@node-real/wallketkit](https://node-real.github.io/walletkit/) diff --git a/apps/dcellar-web-ui/src/components/layout/Nav/index.tsx b/apps/dcellar-web-ui/src/components/layout/Nav/index.tsx index 37e96621..f52ccb2c 100644 --- a/apps/dcellar-web-ui/src/components/layout/Nav/index.tsx +++ b/apps/dcellar-web-ui/src/components/layout/Nav/index.tsx @@ -41,13 +41,13 @@ const MENU_ITEMS = [ const ASIDE = [ { - link: 'https://docs.bnbchain.org/greenfield-docs/', + link: 'https://docs.bnbchain.org/bnb-greenfield/', trackId: 'dc.main.nav.doc.click', icon: 'book', text: 'BNB Greenfield Docs', }, { - link: 'https://docs.bnbchain.org/greenfield-docs/docs/release-notes/releaseNotes/', + link: 'https://docs.bnbchain.org/bnb-greenfield/for-developers/network-endpoint/endpoints/?h=rpc', trackId: 'dc.main.nav.release_note.click', icon: 'doc', text: 'Release Notes', diff --git a/apps/dcellar-web-ui/src/modules/pricing-calculator/components/FAQ.tsx b/apps/dcellar-web-ui/src/modules/pricing-calculator/components/FAQ.tsx index 04b1ed27..5d301d0c 100644 --- a/apps/dcellar-web-ui/src/modules/pricing-calculator/components/FAQ.tsx +++ b/apps/dcellar-web-ui/src/modules/pricing-calculator/components/FAQ.tsx @@ -150,9 +150,9 @@ export const FAQ = ({ openKeys, toggleOpenKeys }: FAQProps) => { more about it, please refer to{' '} - https://docs.bnbchain.org/greenfield-docs/docs/guide/greenfield-blockchain/modules/billing-and-payment#storage-fee-price-and-adjustment + https://github.com/bnb-chain/greenfield/blob/master/docs/modules/billing-and-payment.md#storage-fee-price-and-adjustment . diff --git a/apps/dcellar-web-ui/src/modules/pricing-calculator/components/PricingCard.tsx b/apps/dcellar-web-ui/src/modules/pricing-calculator/components/PricingCard.tsx index 000cf336..734f96bc 100644 --- a/apps/dcellar-web-ui/src/modules/pricing-calculator/components/PricingCard.tsx +++ b/apps/dcellar-web-ui/src/modules/pricing-calculator/components/PricingCard.tsx @@ -104,7 +104,7 @@ export const PricingCard = ({ storeParams }: PricingCardProps) => { }} > Global prices will update monthly based on all the SPs' suggested prices.{' '} - + Learn More diff --git a/apps/dcellar-web-ui/src/modules/welcome/components/DeveloperTools.tsx b/apps/dcellar-web-ui/src/modules/welcome/components/DeveloperTools.tsx index 31704544..12911bab 100644 --- a/apps/dcellar-web-ui/src/modules/welcome/components/DeveloperTools.tsx +++ b/apps/dcellar-web-ui/src/modules/welcome/components/DeveloperTools.tsx @@ -34,7 +34,7 @@ const datas = [ icon: , iconBg: '#F5A861', name: 'BNB Greenfield Docs', - link: 'https://docs.bnbchain.org/greenfield-docs/docs/guide/home', + link: 'https://docs.bnbchain.org/bnb-greenfield/', gaClickName: 'dc_lp.homepage.tool.docs.click', }, { From 75df46011be86a0c0c5a1f20ee1e3639d7a061cb Mon Sep 17 00:00:00 2001 From: devinxl Date: Thu, 30 May 2024 17:05:28 +0800 Subject: [PATCH 4/5] docs(dcellar-web-ui): update changelog --- apps/dcellar-web-ui/CHANGELOG.json | 18 ++++++++++++++++++ apps/dcellar-web-ui/CHANGELOG.md | 11 ++++++++++- apps/dcellar-web-ui/package.json | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/apps/dcellar-web-ui/CHANGELOG.json b/apps/dcellar-web-ui/CHANGELOG.json index df99654a..c6b975fc 100644 --- a/apps/dcellar-web-ui/CHANGELOG.json +++ b/apps/dcellar-web-ui/CHANGELOG.json @@ -1,6 +1,24 @@ { "name": "dcellar-web-ui", "entries": [ + { + "version": "1.6.0", + "tag": "dcellar-web-ui_v1.6.0", + "date": "Thu, 30 May 2024 09:05:12 GMT", + "comments": { + "minor": [ + { + "comment": "Unified encoding method same as go-sdk" + }, + { + "comment": "Replace the related links of bnb greenfield doc" + }, + { + "comment": "Add bucket status tip to the bucket detail drawer" + } + ] + } + }, { "version": "1.5.0", "tag": "dcellar-web-ui_v1.5.0", diff --git a/apps/dcellar-web-ui/CHANGELOG.md b/apps/dcellar-web-ui/CHANGELOG.md index 878b0642..5854ac70 100644 --- a/apps/dcellar-web-ui/CHANGELOG.md +++ b/apps/dcellar-web-ui/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log - dcellar-web-ui -This log was last generated on Thu, 23 May 2024 03:42:29 GMT and should not be manually modified. +This log was last generated on Thu, 30 May 2024 09:05:12 GMT and should not be manually modified. + +## 1.6.0 +Thu, 30 May 2024 09:05:12 GMT + +### Minor changes + +- Unified encoding method same as go-sdk +- Replace the related links of bnb greenfield doc +- Add bucket status tip to the bucket detail drawer ## 1.5.0 Thu, 23 May 2024 03:42:29 GMT diff --git a/apps/dcellar-web-ui/package.json b/apps/dcellar-web-ui/package.json index 2f80facf..c0b2e981 100644 --- a/apps/dcellar-web-ui/package.json +++ b/apps/dcellar-web-ui/package.json @@ -1,6 +1,6 @@ { "name": "dcellar-web-ui", - "version": "1.5.0", + "version": "1.6.0", "private": false, "scripts": { "dev": "node ./scripts/dev.js -p 3200", From d54452b11c751179cd269346a73be72d5346ff04 Mon Sep 17 00:00:00 2001 From: devinxl Date: Thu, 30 May 2024 17:07:32 +0800 Subject: [PATCH 5/5] chore(dcellar-web-ui): remove redundant codes --- apps/dcellar-web-ui/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/dcellar-web-ui/package.json b/apps/dcellar-web-ui/package.json index c0b2e981..79d676cd 100644 --- a/apps/dcellar-web-ui/package.json +++ b/apps/dcellar-web-ui/package.json @@ -92,8 +92,5 @@ "prettier --write" ], "*.ts?(x)": "tsc-files --noEmit" - }, - "browser": { - "crypto": false } }