feat: BitSeq components and update deps (#69)
This commit is contained in:
committed by
GitHub
parent
594a9594e6
commit
e74ca383ee
44
package.json
44
package.json
@@ -14,16 +14,16 @@
|
||||
"semi": false
|
||||
},
|
||||
"dependencies": {
|
||||
"@acala-network/chopsticks-core": "^1.1.0",
|
||||
"@acala-network/chopsticks-core": "^1.2.0",
|
||||
"@noble/hashes": "^1.8.0",
|
||||
"@polkadot-api/descriptors": "file:.papi/descriptors",
|
||||
"@polkadot-api/json-rpc-provider-proxy": "^0.2.4",
|
||||
"@polkadot-api/metadata-builders": "^0.12.2",
|
||||
"@polkadot-api/observable-client": "^0.12.0",
|
||||
"@polkadot-api/react-builder": "0.2.9",
|
||||
"@polkadot-api/substrate-bindings": "^0.14.0",
|
||||
"@polkadot-api/metadata-builders": "^0.13.0",
|
||||
"@polkadot-api/observable-client": "^0.13.1",
|
||||
"@polkadot-api/react-builder": "0.3.1",
|
||||
"@polkadot-api/substrate-bindings": "^0.15.0",
|
||||
"@polkadot-api/substrate-client": "^0.4.1",
|
||||
"@polkadot-api/tx-utils": "^0.1.0",
|
||||
"@polkadot-api/tx-utils": "^0.1.1",
|
||||
"@polkadot-api/utils": "^0.2.0",
|
||||
"@radix-ui/react-accordion": "^1.2.11",
|
||||
"@radix-ui/react-dialog": "^1.1.14",
|
||||
@@ -40,20 +40,20 @@
|
||||
"@react-rxjs/core": "^0.10.8",
|
||||
"@react-rxjs/utils": "^0.9.7",
|
||||
"@walletconnect/modal": "^2.7.0",
|
||||
"@walletconnect/universal-provider": "^2.21.3",
|
||||
"@walletconnect/utils": "^2.21.3",
|
||||
"@walletconnect/universal-provider": "^2.21.4",
|
||||
"@walletconnect/utils": "^2.21.4",
|
||||
"blo": "^2.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "1.1.1",
|
||||
"idb-keyval": "^6.2.2",
|
||||
"lucide-react": "^0.511.0",
|
||||
"polkadot-api": "^1.14.0",
|
||||
"lucide-react": "^0.525.0",
|
||||
"polkadot-api": "^1.15.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-portal": "^4.3.0",
|
||||
"react-router-dom": "^7.6.2",
|
||||
"react-router-dom": "^7.6.3",
|
||||
"react-svg": "^16.3.0",
|
||||
"react-virtuoso": "^4.13.0",
|
||||
"react18-json-view": "^0.2.9",
|
||||
@@ -64,24 +64,24 @@
|
||||
"uuid": "^11.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.29.0",
|
||||
"@tailwindcss/vite": "^4.1.10",
|
||||
"@types/node": "^24.0.3",
|
||||
"@eslint/js": "^9.31.0",
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"@types/node": "^24.0.14",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"@types/react-portal": "^4.0.7",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@vitejs/plugin-react": "^4.5.2",
|
||||
"@walletconnect/types": "^2.21.3",
|
||||
"eslint": "^9.29.0",
|
||||
"@vitejs/plugin-react": "^4.6.0",
|
||||
"@walletconnect/types": "^2.21.4",
|
||||
"eslint": "^9.31.0",
|
||||
"eslint-plugin-react-hooks": "5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"globals": "^16.2.0",
|
||||
"prettier": "^3.5.3",
|
||||
"tailwindcss": "^4.1.10",
|
||||
"globals": "^16.3.0",
|
||||
"prettier": "^3.6.2",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.34.1",
|
||||
"vite": "^6.3.5"
|
||||
"typescript-eslint": "^8.37.0",
|
||||
"vite": "^7.0.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912",
|
||||
"pnpm": {
|
||||
|
||||
1962
pnpm-lock.yaml
generated
1962
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
EditAccountId,
|
||||
EditBigNumber,
|
||||
EditBitSeq,
|
||||
EditBool,
|
||||
EditBytes,
|
||||
EditEthAccount,
|
||||
@@ -44,6 +45,7 @@ export const CBigNumber: EditBigNumber = CPrimitive
|
||||
export const CNumber: EditNumber = CPrimitive
|
||||
export const CAccountId: EditAccountId = CPrimitive
|
||||
export const CBytes: EditBytes = CPrimitive
|
||||
export const CBitSeq: EditBitSeq = CPrimitive
|
||||
|
||||
export const COption: EditOption = ({ path, value, inner }) => {
|
||||
const isActive = useStateObservable(isActive$(path.join(".")))
|
||||
|
||||
31
src/codec-components/EditCodec/EditBitSeq.tsx
Normal file
31
src/codec-components/EditCodec/EditBitSeq.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { type EditBitSeq, NOTIN } from "@polkadot-api/react-builder"
|
||||
import { TextInputField } from "./codec-components"
|
||||
import { useGenericSynchronizeInput } from "@/components/useSynchroniseInput"
|
||||
|
||||
const getValidation = (value: string) =>
|
||||
!!value.match(/^[01]+$/) ? null : `Only "0" and "1" allowed`
|
||||
|
||||
export const CBitSeq: EditBitSeq = ({ value, onValueChanged }) => {
|
||||
const [inputValue, setInputValue] = useGenericSynchronizeInput<
|
||||
Array<0 | 1>,
|
||||
string
|
||||
>(
|
||||
value,
|
||||
onValueChanged,
|
||||
(v) =>
|
||||
getValidation(v) ? NOTIN : (v.split("").map(Number) as Array<0 | 1>),
|
||||
"",
|
||||
(v) => v.join(""),
|
||||
() => true,
|
||||
)
|
||||
|
||||
return (
|
||||
<TextInputField
|
||||
value={inputValue}
|
||||
onChange={setInputValue}
|
||||
placeholder="0101"
|
||||
warn={getValidation(inputValue) !== null}
|
||||
error={getValidation(inputValue)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { BinaryEdit, Focus, TypeIcon, TypeIcons } from "@/components/Icons"
|
||||
import {
|
||||
EditAccountId,
|
||||
EditBigNumber,
|
||||
EditBitSeq,
|
||||
EditBool,
|
||||
EditBytes,
|
||||
EditEthAccount,
|
||||
@@ -47,6 +48,7 @@ export const CBigNumber: EditBigNumber = CPrimitive
|
||||
export const CNumber: EditNumber = CPrimitive
|
||||
export const CAccountId: EditAccountId = CPrimitive
|
||||
export const CBytes: EditBytes = CPrimitive
|
||||
export const CBitSeq: EditBitSeq = CPrimitive
|
||||
|
||||
export const COption: EditOption = ({
|
||||
value,
|
||||
|
||||
@@ -8,3 +8,4 @@ export * from "./CTuple"
|
||||
export * from "./CStr"
|
||||
export * from "./codec-components"
|
||||
export * from "./CEthAccount"
|
||||
export * from "./EditBitSeq"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
ViewBigNumber,
|
||||
ViewBitSeq,
|
||||
ViewBool,
|
||||
ViewEthAccount,
|
||||
ViewNumber,
|
||||
@@ -37,6 +38,13 @@ export const CResult: ViewResult = ({ value, inner }) => {
|
||||
|
||||
export const CStr: ViewStr = ({ value }) => <div>{value}</div>
|
||||
export const CNumber: ViewNumber = ({ value }) => <div>{value}</div>
|
||||
export const CBitSeq: ViewBitSeq = ({ value }) => (
|
||||
<div>
|
||||
{value
|
||||
.map((val, idx) => `${idx > 0 && idx % 4 === 0 ? "_" : ""}${val}`)
|
||||
.join("")}
|
||||
</div>
|
||||
)
|
||||
export const CBigNumber: ViewBigNumber = ({ value }) => (
|
||||
<div>{String(value)}</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user