diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0493fafd11..4a3a153c38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,9 +81,6 @@ discuss your intended approach for solving the problem in the comments for an ex - **Add documentation.** Document your changes with code doc comments or in existing guides. -- **Update the CHANGELOG** for all enhancements and bug fixes. Include the corresponding date, issue - number if one exists and current version if any. Check the format of the [CHANGELOG](.docs/CHANGELOG.md). - - **Target the `development` branch.** The repo's default branch is still `main`, but do **not** open pull requests against `main`. Branch from and [submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) diff --git a/cmd/rpc/server.go b/cmd/rpc/server.go index 95b3090400..f1d4e9ec6c 100644 --- a/cmd/rpc/server.go +++ b/cmd/rpc/server.go @@ -33,7 +33,7 @@ const ( // uses golang's semver naming convention // https://pkg.go.dev/golang.org/x/mod/semver - SoftwareVersion = "v0.1.27+beta" + SoftwareVersion = "v0.1.28+beta" ContentType = "Content-MessageType" ApplicationJSON = "application/json; charset=utf-8" diff --git a/cmd/rpc/web/explorer/package.json b/cmd/rpc/web/explorer/package.json index 242af38ac6..5157131760 100644 --- a/cmd/rpc/web/explorer/package.json +++ b/cmd/rpc/web/explorer/package.json @@ -7,6 +7,7 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", + "test:clipboard": "node --test tests/clipboard.test.cjs", "preview": "vite preview", "type-check": "tsc --noEmit" }, diff --git a/cmd/rpc/web/explorer/src/components/account/AccountDetailHeader.tsx b/cmd/rpc/web/explorer/src/components/account/AccountDetailHeader.tsx index 7fdb8fe73b..4627ccda88 100644 --- a/cmd/rpc/web/explorer/src/components/account/AccountDetailHeader.tsx +++ b/cmd/rpc/web/explorer/src/components/account/AccountDetailHeader.tsx @@ -1,6 +1,8 @@ import React, { useState } from 'react' import { motion } from 'framer-motion' import { Check, Copy } from 'lucide-react' +import toast from 'react-hot-toast' +import { copyText } from '../../lib/clipboard' import AnimatedNumber from '../AnimatedNumber' import accountDetailTexts from '../../data/accountDetail.json' import { cnpyDetailFormat, toCNPY } from '../../lib/utils' @@ -37,11 +39,11 @@ const AccountDetailHeader: React.FC = ({ account }) => const copyToClipboard = async () => { try { - await navigator.clipboard.writeText(account.address) + await copyText(account.address) setCopied(true) setTimeout(() => setCopied(false), 2000) - } catch (err) { - console.error('Failed to copy address:', err) + } catch { + toast.error('Unable to copy address') } } diff --git a/cmd/rpc/web/explorer/src/components/block/BlockDetailInfo.tsx b/cmd/rpc/web/explorer/src/components/block/BlockDetailInfo.tsx index 25154133b1..1cbc3d8acf 100644 --- a/cmd/rpc/web/explorer/src/components/block/BlockDetailInfo.tsx +++ b/cmd/rpc/web/explorer/src/components/block/BlockDetailInfo.tsx @@ -2,6 +2,7 @@ import React, { useState } from 'react' import { motion } from 'framer-motion' import { Copy } from 'lucide-react' import toast from 'react-hot-toast' +import { copyText } from '../../lib/clipboard' import blockDetailTexts from '../../data/blockDetail.json' import { GREEN_BADGE_CLASS } from '../ui/badgeStyles' import { formatCNPY } from '../../lib/utils' @@ -26,16 +27,20 @@ const CopySymbol = () =>