feat: initial Pezkuwi Apps rebrand from polkadot-apps

Rebranded terminology:
- Polkadot → Pezkuwi
- Kusama → Dicle
- Westend → Zagros
- Rococo → PezkuwiChain
- Substrate → Bizinikiwi
- parachain → teyrchain

Custom logos with Kurdistan brand colors (#e6007a → #86e62a):
- bizinikiwi-hexagon.svg
- sora-bizinikiwi.svg
- hezscanner.svg
- heztreasury.svg
- pezkuwiscan.svg
- pezkuwistats.svg
- pezkuwiassembly.svg
- pezkuwiholic.svg
This commit is contained in:
Kurdistan Tech Ministry committed 2026-01-07 13:05:27 +03:00
commit d21bfb1320
5867 files changed
+329019

No files matched your search

@@ -0,0 +1,54 @@
// Copyright 2017-2025 @pezkuwi/app-storage authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ConstValue } from '@pezkuwi/react-components/InputConsts/types';
import type { ConstantCodec } from '@pezkuwi/types/metadata/decorate/types';
import type { ComponentProps as Props } from '../types.js';
import React, { useCallback, useState } from 'react';
import { Button, InputConsts } from '@pezkuwi/react-components';
import { useApi } from '@pezkuwi/react-hooks';
import { useTranslation } from '../translate.js';
function Consts ({ onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [defaultValue] = useState<ConstValue>((): ConstValue => {
const section = Object.keys(api.consts)[0];
const method = Object.keys(api.consts[section])[0];
return {
meta: (api.consts[section][method] as ConstantCodec).meta,
method,
section
};
});
const [value, setValue] = useState(defaultValue);
const _onAdd = useCallback(
() => onAdd({ isConst: true, key: value }),
[onAdd, value]
);
return (
<section className='storage--actionrow'>
<div className='storage--actionrow-value'>
<InputConsts
defaultValue={defaultValue}
label={t('selected constant query')}
onChange={setValue}
/>
</div>
<div className='storage--actionrow-buttons'>
<Button
icon='plus'
onClick={_onAdd}
/>
</div>
</section>
);
}
export default React.memo(Consts);
@@ -0,0 +1,278 @@
// Copyright 2017-2025 @pezkuwi/app-storage authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiPromise } from '@pezkuwi/api';
import type { QueryableStorageEntry } from '@pezkuwi/api/types';
import type { RawParams, TypeDefExt } from '@pezkuwi/react-params/types';
import type { StorageEntryTypeLatest } from '@pezkuwi/types/interfaces';
import type { Inspect, Registry } from '@pezkuwi/types/types';
import type { ComponentProps as Props } from '../types.js';
import React, { useCallback, useMemo, useState } from 'react';
import { Button, Columar, Input, InputStorage, Inspect as DecodeInspect, Output, styled } from '@pezkuwi/react-components';
import { useApi } from '@pezkuwi/react-hooks';
import Params from '@pezkuwi/react-params';
import { getTypeDef } from '@pezkuwi/types';
import { getSiName } from '@pezkuwi/types/metadata/util';
import { TypeDefInfo } from '@pezkuwi/types/types';
import { compactStripLength, isHex, isNull, isUndefined, u8aToHex } from '@pezkuwi/util';
import { useTranslation } from '../translate.js';
type ParamsType = { name?: string, type: TypeDefExt }[];
interface KeyState {
defaultValues: RawParams | undefined | null;
isIterable: boolean;
key: QueryableStorageEntry<'promise'>;
params: ParamsType;
}
interface ValState {
isValid: boolean;
values: RawParams;
}
interface BlockHash {
blockHash: string | null;
textHash: string;
}
function areParamsValid ({ creator: { meta: { type } } }: QueryableStorageEntry<'promise'>, values: RawParams): boolean {
return values.reduce((isValid: boolean, value) =>
isValid &&
!isUndefined(value) &&
!isUndefined(value.value) &&
value.isValid,
(values.length === (type.isPlain ? 0 : type.asMap.hashers.length)));
}
function expandParams (registry: Registry, st: StorageEntryTypeLatest, isIterable: boolean): ParamsType {
let types: string[] = [];
if (st.isMap) {
const { hashers, key } = st.asMap;
types = hashers.length === 1
? [getSiName(registry.lookup, key)]
: registry.lookup.getSiType(key).def.asTuple.map((k) => getSiName(registry.lookup, k));
}
return types.map((str, index) => {
let name: string | undefined;
let type: TypeDefExt;
if (isIterable && index === (types.length - 1)) {
// name = 'entryKey';
type = getTypeDef(`Option<${str}>`);
type.withOptionActive = true;
} else {
type = getTypeDef(str);
}
return { name, type };
});
}
function checkIterable (registry: Registry, type: StorageEntryTypeLatest): boolean {
// in the case of Option<type> keys, we don't allow map iteration, in this case
// we would have option for the iterable and then option for the key value
if (type.isPlain) {
return true;
}
const { hashers, key } = type.asMap;
if (hashers.length === 1) {
return registry.lookup.getTypeDef(key).info !== TypeDefInfo.Option;
}
const keys = registry.lookup.getSiType(key).def.asTuple;
return registry.lookup.getTypeDef(keys[keys.length - 1]).info !== TypeDefInfo.Option;
}
function expandKey (api: ApiPromise, key: QueryableStorageEntry<'promise'>): KeyState {
const { creator: { meta: { type }, section } } = key;
const isIterable = checkIterable(api.registry, type);
return {
defaultValues: section === 'session' && type.isMap && api.consts.session?.dedupKeyPrefix
? [{ isValid: true, value: api.consts.session.dedupKeyPrefix.toHex() }]
: null,
isIterable,
key,
params: expandParams(api.registry, type, isIterable)
};
}
function extractParams (isIterable: boolean, values: RawParams): [RawParams, boolean] {
const params = values.filter(({ value }, index) => !isIterable || (index !== values.length - 1) || !isNull(value));
return [params, params.length === values.length];
}
function Modules ({ className = '', onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [{ defaultValues, isIterable, key, params }, setKey] = useState<KeyState>(() => ({ defaultValues: undefined, isHeadKey: true, isIterable: false, key: api.query.timestamp?.now || api.query.system.events, params: [] }));
const [{ isValid, values }, setValues] = useState<ValState>(() => ({ isValid: true, values: [] }));
const [{ blockHash, textHash }, setBlockHash] = useState<BlockHash>({ blockHash: null, textHash: '' });
const startValue = useMemo(
() => (
api.query.timestamp?.now ||
api.query.system?.events ||
api.query.bizinikiwi.changesTrieConfig
),
[api]
);
const [isPartialKey, hexKey, inspect] = useMemo(
(): [boolean, string, Inspect | null] => {
if (isValid) {
try {
const [params] = extractParams(isIterable, values);
const args = params.map(({ value }) => value);
const isPartialKey = args.length !== (
key.creator.meta.type.isPlain
? 0
: key.creator.meta.type.asMap.hashers.length
);
const hexKey = isPartialKey && key.creator.iterKey
? key.creator.iterKey(...args).toHex()
: u8aToHex(compactStripLength(key.creator(...args))[1]);
const inspect = isPartialKey
? null
: key.creator.inspect(...args);
return [isPartialKey, hexKey, inspect];
} catch {
// ignore
}
}
return [false, '0x', null];
},
[isIterable, isValid, key, values]
);
const _onAdd = useCallback(
(): void => {
const [params, isAtEnabled] = extractParams(isIterable, values);
isValid && onAdd({
blockHash: isAtEnabled
? blockHash
: null,
isConst: false,
key,
params
});
},
[blockHash, isIterable, isValid, key, onAdd, values]
);
const _onChangeAt = useCallback(
(textHash: string) => setBlockHash({
blockHash: isHex(textHash, 256)
? textHash
: null,
textHash
}),
[]
);
const _onChangeValues = useCallback(
(values: RawParams) => setValues({
isValid: areParamsValid(key, values),
values
}),
[key]
);
const _onChangeKey = useCallback(
(key: QueryableStorageEntry<'promise'>): void => {
setKey(expandKey(api, key));
_onChangeValues([]);
},
[_onChangeValues, api]
);
const isAtAllowed = useMemo(
() => isValid
? extractParams(isIterable, values)[1]
: false,
[isIterable, isValid, values]
);
const { creator: { method, section } } = key;
return (
<StyledSection className={`${className} storage--actionrow`}>
<div className='storage--actionrow-value'>
<InputStorage
defaultValue={startValue}
label={t('selected state query')}
onChange={_onChangeKey}
/>
<Params
key={`${section}.${method}:params` /* force re-render on change */}
onChange={_onChangeValues}
onEnter={_onAdd}
params={params}
values={defaultValues}
/>
<Input
isDisabled={!isValid || !isAtAllowed}
isError={!!textHash && !blockHash}
label={t('blockhash to query at')}
onChange={_onChangeAt}
placeholder={t('0x...')}
/>
<Columar
className='keyColumar'
isPadded={false}
>
<Columar.Column>
<Output
isDisabled
label={isPartialKey
? t('encoded partial key')
: t('encoded storage key')
}
value={hexKey}
withCopy
/>
</Columar.Column>
<Columar.Column>
<DecodeInspect
inspect={inspect}
label={t('encoded key details')}
/>
</Columar.Column>
</Columar>
</div>
<div className='storage--actionrow-buttons'>
<Button
icon='plus'
isDisabled={!isValid}
onClick={_onAdd}
/>
</div>
</StyledSection>
);
}
const StyledSection = styled.section`
.ui--Column:last-child .ui--Labelled {
padding-left: 0.5rem;
label {
left: 2.05rem; /* 3.55 - 1.5 (diff from padding above) */
}
}
`;
export default React.memo(Modules);
@@ -0,0 +1,57 @@
// Copyright 2017-2025 @pezkuwi/app-storage authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ComponentProps as Props } from '../types.js';
import React, { useCallback, useState } from 'react';
import { Button, Input } from '@pezkuwi/react-components';
import { compactAddLength, u8aToU8a } from '@pezkuwi/util';
import { useTranslation } from '../translate.js';
function Raw ({ onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [{ isValid, key }, setValue] = useState<{ isValid: boolean; key: Uint8Array }>(() => ({ isValid: false, key: new Uint8Array([]) }));
const _onAdd = useCallback(
(): void => {
isValid && onAdd({ isConst: false, key });
},
[isValid, key, onAdd]
);
const _onChangeKey = useCallback(
(key: string): void => {
const u8a = u8aToU8a(key);
setValue({
isValid: u8a.length !== 0,
key: compactAddLength(u8a)
});
},
[]
);
return (
<section className='storage--actionrow'>
<div className='storage--actionrow-value'>
<Input
autoFocus
label={t('hex-encoded storage key')}
onChange={_onChangeKey}
onEnter={_onAdd}
/>
</div>
<div className='storage--actionrow-buttons'>
<Button
icon='plus'
isDisabled={!isValid}
onClick={_onAdd}
/>
</div>
</section>
);
}
export default React.memo(Raw);
@@ -0,0 +1,79 @@
// Copyright 2017-2025 @pezkuwi/app-storage authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ParitalQueryTypes, QueryTypes } from '../types.js';
import React, { useCallback, useRef } from 'react';
import { Route, Routes } from 'react-router';
import { Tabs } from '@pezkuwi/react-components';
import { useTranslation } from '../translate.js';
import Consts from './Consts.js';
import Modules from './Modules.js';
import Raw from './Raw.js';
interface Props {
basePath: string;
onAdd: (query: QueryTypes) => void;
}
let id = -1;
function Selection ({ basePath, onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const itemsRef = useRef([
{
isRoot: true,
name: 'modules',
text: t('Storage')
},
{
name: 'constants',
text: t('Constants')
},
{
name: 'raw',
text: t('Raw storage')
}
]);
const _onAdd = useCallback(
(query: ParitalQueryTypes) => onAdd({ ...query, id: ++id }),
[onAdd]
);
return (
<>
<Tabs
basePath={basePath}
items={itemsRef.current}
/>
<Routes>
<Route path={basePath}>
<Route
element={
<Consts onAdd={_onAdd} />
}
path='constants'
/>
<Route
element={
<Raw onAdd={_onAdd} />
}
path='raw'
/>
<Route
element={
<Modules onAdd={_onAdd} />
}
index
/>
</Route>
</Routes>
</>
);
}
export default React.memo(Selection);