From 03e7cc4736306b0ec2a737043b574f5dd5c1d4af Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Fri, 9 Jan 2026 00:15:30 +0300 Subject: [PATCH] refactor: rename polkadotIcon to pezkuwiIcon and update identicon themes - Rename polkadot.ts to pezkuwi.ts in ui-shared - Rename polkadotIcon function to pezkuwiIcon - Rename Polkadot.tsx to Pezkuwi.tsx in all identicon packages - Update Components mapping to use pezkuwi theme - Add bizinikiwi theme as substrate replacement - Update IconTheme type definitions - Update Ledger app text to Pezkuwi --- packages/react-identicon/src/Identicon.tsx | 6 +- .../react-identicon/src/icons/Pezkuwi.tsx | 47 +++++++++++++++ .../react-identicon/src/icons/Polkadot.tsx | 59 ------------------- packages/react-identicon/src/icons/index.ts | 2 +- packages/react-identicon/src/types.ts | 2 +- .../reactnative-identicon/src/Identicon.tsx | 10 ++-- .../src/icons/{Polkadot.tsx => Pezkuwi.tsx} | 4 +- .../reactnative-identicon/src/icons/index.ts | 2 +- packages/ui-settings/src/defaults/ledger.ts | 2 +- packages/ui-settings/src/defaults/type.ts | 2 +- packages/ui-shared/src/icons/index.ts | 2 +- .../{polkadot.spec.ts => pezkuwi.spec.ts} | 6 +- .../src/icons/{polkadot.ts => pezkuwi.ts} | 9 +-- packages/vue-identicon/src/Identicon.ts | 24 +++++--- .../src/icons/{Polkadot.ts => Pezkuwi.ts} | 10 ++-- packages/vue-identicon/src/icons/index.ts | 4 +- 16 files changed, 92 insertions(+), 99 deletions(-) create mode 100644 packages/react-identicon/src/icons/Pezkuwi.tsx delete mode 100644 packages/react-identicon/src/icons/Polkadot.tsx rename packages/reactnative-identicon/src/icons/{Polkadot.tsx => Pezkuwi.tsx} (90%) rename packages/ui-shared/src/icons/{polkadot.spec.ts => pezkuwi.spec.ts} (90%) rename packages/ui-shared/src/icons/{polkadot.ts => pezkuwi.ts} (91%) rename packages/vue-identicon/src/icons/{Polkadot.ts => Pezkuwi.ts} (73%) diff --git a/packages/react-identicon/src/Identicon.tsx b/packages/react-identicon/src/Identicon.tsx index 18c986af..983f6ea7 100644 --- a/packages/react-identicon/src/Identicon.tsx +++ b/packages/react-identicon/src/Identicon.tsx @@ -11,7 +11,7 @@ import { ICON_DEFAULT_HOST, settings } from '@pezkuwi/ui-settings'; import { isHex, isU8a, u8aToHex } from '@pezkuwi/util'; import { decodeAddress, encodeAddress, ethereumEncode } from '@pezkuwi/util-crypto'; -import { Beachball, Empty, Ethereum, Jdenticon, Polkadot } from './icons/index.js'; +import { Beachball, Empty, Ethereum, Jdenticon, Pezkuwi } from './icons/index.js'; import { styled } from './styled.js'; const Fallback = Beachball; @@ -24,11 +24,11 @@ interface State { const DEFAULT_SIZE = 64; const Components: Record> = { beachball: Beachball, + bizinikiwi: Jdenticon, empty: Empty, ethereum: Ethereum, jdenticon: Jdenticon, - polkadot: Polkadot, - substrate: Jdenticon + pezkuwi: Pezkuwi }; class BaseIcon extends React.PureComponent { diff --git a/packages/react-identicon/src/icons/Pezkuwi.tsx b/packages/react-identicon/src/icons/Pezkuwi.tsx new file mode 100644 index 00000000..424c83e3 --- /dev/null +++ b/packages/react-identicon/src/icons/Pezkuwi.tsx @@ -0,0 +1,47 @@ +// Copyright 2018-2025 @pezkuwi/react-identicon authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// Originally from: https://github.com/paritytech/oo7/tree/master/packages/polkadot-identicon +// Copyright 2018 Paritytech - Adapted for PezkuwiChain ecosystem + +import type { Circle } from '@pezkuwi/ui-shared/icons/types'; +import type { Props } from '../types.js'; + +import React, { useMemo } from 'react'; + +import { pezkuwiIcon } from '@pezkuwi/ui-shared'; + +function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNode { + return ( + + ); +} + +function Identicon ({ address, className = '', isAlternative = false, size, style = {} }: Props): React.ReactElement { + const circles = useMemo( + () => pezkuwiIcon(address, { isAlternative }), + [address, isAlternative] + ); + + return ( + + {circles.map(renderCircle)} + + ); +} + +export const Pezkuwi = React.memo(Identicon); diff --git a/packages/react-identicon/src/icons/Polkadot.tsx b/packages/react-identicon/src/icons/Polkadot.tsx deleted file mode 100644 index 8fe50165..00000000 --- a/packages/react-identicon/src/icons/Polkadot.tsx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2018-2025 @pezkuwi/react-identicon authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -// Copyright 2018 Paritytech via paritytech/oo7/polkadot-identicon - -// This has been converted from the original version that can be found at -// -// https://github.com/paritytech/oo7/blob/251ba2b7c45503b68eab4320c270b5afa9bccb60/packages/polkadot-identicon/src/index.jsx -// -// Here we have done the following to convert the component - -// - Converted the code to TypeScript -// - Removed the oo7 dependencies (since not initialised properly, it makes calls to wrong endpoints) -// - Remove encoding functionality, these are catered for in the base -// - Remove copy functionality (this is catered from in the base components) -// - Split calculations into relevant functions -// - Move constants to file-level -// - Overall it is now just a static component, expecting an address as an input value - -import type { Circle } from '@pezkuwi/ui-shared/icons/types'; -import type { Props } from '../types.js'; - -import React, { useMemo } from 'react'; - -import { polkadotIcon } from '@pezkuwi/ui-shared'; - -function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNode { - return ( - - ); -} - -function Identicon ({ address, className = '', isAlternative = false, size, style = {} }: Props): React.ReactElement { - const circles = useMemo( - () => polkadotIcon(address, { isAlternative }), - [address, isAlternative] - ); - - return ( - - {circles.map(renderCircle)} - - ); -} - -export const Polkadot = React.memo(Identicon); diff --git a/packages/react-identicon/src/icons/index.ts b/packages/react-identicon/src/icons/index.ts index 6c3c7203..eeec4ac5 100644 --- a/packages/react-identicon/src/icons/index.ts +++ b/packages/react-identicon/src/icons/index.ts @@ -5,4 +5,4 @@ export { Beachball } from './Beachball.js'; export { Empty } from './Empty.js'; export { Ethereum } from './Ethereum.js'; export { Jdenticon } from './Jdenticon.js'; -export { Polkadot } from './Polkadot.js'; +export { Pezkuwi } from './Pezkuwi.js'; diff --git a/packages/react-identicon/src/types.ts b/packages/react-identicon/src/types.ts index 897f64a0..3ca51185 100644 --- a/packages/react-identicon/src/types.ts +++ b/packages/react-identicon/src/types.ts @@ -27,4 +27,4 @@ export interface IdentityProps extends BaseProps { value?: string | Uint8Array | null; } -export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate'; +export type IconTheme = 'beachball' | 'bizinikiwi' | 'empty' | 'ethereum' | 'jdenticon' | 'pezkuwi'; diff --git a/packages/reactnative-identicon/src/Identicon.tsx b/packages/reactnative-identicon/src/Identicon.tsx index fe444787..fdf20f9e 100644 --- a/packages/reactnative-identicon/src/Identicon.tsx +++ b/packages/reactnative-identicon/src/Identicon.tsx @@ -9,14 +9,14 @@ import React from 'react'; import { isHex, isU8a, u8aToHex } from '@pezkuwi/util'; import { decodeAddress, encodeAddress } from '@pezkuwi/util-crypto'; -import { Empty, Polkadot } from './icons/index.js'; +import { Empty, Pezkuwi } from './icons/index.js'; -const Fallback = Polkadot; +const Fallback = Pezkuwi; interface Props { prefix?: Prefix; size?: number; - theme?: 'polkadot'; + theme?: 'pezkuwi'; value?: string | Uint8Array | null; } @@ -26,10 +26,10 @@ interface State { } const DEFAULT_SIZE = 64; -const DEFAULT_THEME = 'polkadot'; +const DEFAULT_THEME = 'pezkuwi'; const Components: Record> = { - polkadot: Polkadot + pezkuwi: Pezkuwi }; export default class IdentityIcon extends React.PureComponent { diff --git a/packages/reactnative-identicon/src/icons/Polkadot.tsx b/packages/reactnative-identicon/src/icons/Pezkuwi.tsx similarity index 90% rename from packages/reactnative-identicon/src/icons/Polkadot.tsx rename to packages/reactnative-identicon/src/icons/Pezkuwi.tsx index 72a84e33..5d359791 100644 --- a/packages/reactnative-identicon/src/icons/Polkadot.tsx +++ b/packages/reactnative-identicon/src/icons/Pezkuwi.tsx @@ -8,7 +8,7 @@ import React, { useMemo } from 'react'; import { View } from 'react-native'; import { Circle as SvgCircle, Svg } from 'react-native-svg'; -import { polkadotIcon } from '@pezkuwi/ui-shared'; +import { pezkuwiIcon } from '@pezkuwi/ui-shared'; function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.ReactNode { return ( @@ -24,7 +24,7 @@ function renderCircle ({ cx, cy, fill, r }: CircleType, key: number): React.Reac export default function Identicon ({ address, isAlternative = false, size }: Props): React.ReactElement { const circles = useMemo( - () => polkadotIcon(address, { isAlternative }), + () => pezkuwiIcon(address, { isAlternative }), [address, isAlternative] ); diff --git a/packages/reactnative-identicon/src/icons/index.ts b/packages/reactnative-identicon/src/icons/index.ts index ca3c52d0..9aac3b69 100644 --- a/packages/reactnative-identicon/src/icons/index.ts +++ b/packages/reactnative-identicon/src/icons/index.ts @@ -2,4 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 export { default as Empty } from './Empty.js'; -export { default as Polkadot } from './Polkadot.js'; +export { default as Pezkuwi } from './Pezkuwi.js'; diff --git a/packages/ui-settings/src/defaults/ledger.ts b/packages/ui-settings/src/defaults/ledger.ts index 9684cf70..da7da9be 100644 --- a/packages/ui-settings/src/defaults/ledger.ts +++ b/packages/ui-settings/src/defaults/ledger.ts @@ -34,7 +34,7 @@ export const LEDGER_APP_DEFAULT = 'generic'; export const LEDGER_APP: Option[] = [ { info: 'generic', - text: 'Use the Ledger Polkadot Generic App', + text: 'Use the Ledger Pezkuwi Generic App', value: 'generic' }, { diff --git a/packages/ui-settings/src/defaults/type.ts b/packages/ui-settings/src/defaults/type.ts index 4eb0c187..40b17004 100644 --- a/packages/ui-settings/src/defaults/type.ts +++ b/packages/ui-settings/src/defaults/type.ts @@ -4,5 +4,5 @@ // matches https://pezkuwichain.io & https://*.pezkuwichain.io export const isPezkuwi = typeof window !== 'undefined' && window.location.host.includes('pezkuwi'); -// Backward compatibility alias +// Alias for compatibility with code using old variable name export const isPolkadot = isPezkuwi; diff --git a/packages/ui-shared/src/icons/index.ts b/packages/ui-shared/src/icons/index.ts index 0116758a..7f212b84 100644 --- a/packages/ui-shared/src/icons/index.ts +++ b/packages/ui-shared/src/icons/index.ts @@ -2,4 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 export { beachballIcon } from './beachball/index.js'; -export { polkadotIcon } from './polkadot.js'; +export { pezkuwiIcon } from './pezkuwi.js'; diff --git a/packages/ui-shared/src/icons/polkadot.spec.ts b/packages/ui-shared/src/icons/pezkuwi.spec.ts similarity index 90% rename from packages/ui-shared/src/icons/polkadot.spec.ts rename to packages/ui-shared/src/icons/pezkuwi.spec.ts index 1e73ae47..d3c64cc7 100644 --- a/packages/ui-shared/src/icons/polkadot.spec.ts +++ b/packages/ui-shared/src/icons/pezkuwi.spec.ts @@ -3,12 +3,12 @@ /// -import { polkadotIcon } from './polkadot.js'; +import { pezkuwiIcon } from './pezkuwi.js'; -describe('polkadotIcon', (): void => { +describe('pezkuwiIcon', (): void => { it('generates the correct points from known', (): void => { expect( - polkadotIcon('5Dqvi1p4C7EhPPFKCixpF3QiaJEaDwWrR9gfWR5eUsfC39TX', { isAlternative: false }) + pezkuwiIcon('5Dqvi1p4C7EhPPFKCixpF3QiaJEaDwWrR9gfWR5eUsfC39TX', { isAlternative: false }) ).toEqual([ { cx: 32, cy: 32, fill: '#eee', r: 32 }, { cx: 32, cy: 8, fill: 'hsl(196, 65%, 53%)', r: 5 }, diff --git a/packages/ui-shared/src/icons/polkadot.ts b/packages/ui-shared/src/icons/pezkuwi.ts similarity index 91% rename from packages/ui-shared/src/icons/polkadot.ts rename to packages/ui-shared/src/icons/pezkuwi.ts index eb2e38f7..71fd2e6b 100644 --- a/packages/ui-shared/src/icons/polkadot.ts +++ b/packages/ui-shared/src/icons/pezkuwi.ts @@ -1,11 +1,8 @@ // Copyright 2018-2025 @pezkuwi/ui-shared authors & contributors // SPDX-License-Identifier: Apache-2.0 -// Copyright 2018 Paritytech via paritytech/oo7/polkadot-identicon - -// This has been converted from the original version that can be found at -// -// https://github.com/paritytech/oo7/blob/251ba2b7c45503b68eab4320c270b5afa9bccb60/packages/polkadot-identicon/src/index.jsx +// Originally from: https://github.com/paritytech/oo7/tree/master/packages/polkadot-identicon +// Copyright 2018 Paritytech - Adapted for PezkuwiChain ecosystem import type { Circle, Options } from './types.js'; @@ -134,7 +131,7 @@ function getColors (address: string): string[] { /** * @description Generates an array of the circles that make up an identicon */ -export function polkadotIcon (address: string, { isAlternative }: Options): Circle[] { +export function pezkuwiIcon (address: string, { isAlternative }: Options): Circle[] { const xy = getCircleXY(isAlternative); let colors: string[]; diff --git a/packages/vue-identicon/src/Identicon.ts b/packages/vue-identicon/src/Identicon.ts index 260afebe..08c3c0fe 100644 --- a/packages/vue-identicon/src/Identicon.ts +++ b/packages/vue-identicon/src/Identicon.ts @@ -9,7 +9,7 @@ import { defineComponent, h } from 'vue'; import { isHex, isU8a, u8aToHex } from '@pezkuwi/util'; import { decodeAddress, encodeAddress, isEthereumAddress } from '@pezkuwi/util-crypto'; -import { Beachball, Empty, Jdenticon, Polkadot } from './icons/index.js'; +import { Beachball, Empty, Jdenticon, Pezkuwi } from './icons/index.js'; import { adaptVNodeAttrs } from './util.js'; interface Account { @@ -22,7 +22,7 @@ interface Data { iconSize: number; isAlternativeIcon: boolean; publicKey: string; - type: 'beachball' | 'empty' | 'jdenticon' | 'polkadot' | 'substrate'; + type: 'beachball' | 'empty' | 'jdenticon' | 'pezkuwi' | 'bizinikiwi'; } const DEFAULT_SIZE = 64; @@ -53,7 +53,7 @@ export function encodeAccount (value: string | Uint8Array, prefix?: Prefix): Acc * @description The main Identicon component, taking a number of properties * @example * ```html - * + * * ``` */ export const Identicon = defineComponent({ @@ -61,7 +61,7 @@ export const Identicon = defineComponent({ Beachball, Empty, Jdenticon, - Polkadot + Pezkuwi }, created: function (): void { this.createData(); @@ -110,16 +110,24 @@ export const Identicon = defineComponent({ } ) }, []); - } else if (type === 'substrate') { - throw new Error('substrate type is not supported'); + } else if (type === 'bizinikiwi') { + return h(Jdenticon, { + ...adaptVNodeAttrs( + { + key: address, + publicKey, + size: iconSize + } + ) + }, []); } const cmp = type.charAt(0).toUpperCase() + type.slice(1); - if (['Beachball', 'Polkadot'].includes(cmp)) { + if (['Beachball', 'Pezkuwi'].includes(cmp)) { const component = cmp === 'Beachball' ? Beachball - : Polkadot; + : Pezkuwi; return h(component, { ...adaptVNodeAttrs({ diff --git a/packages/vue-identicon/src/icons/Polkadot.ts b/packages/vue-identicon/src/icons/Pezkuwi.ts similarity index 73% rename from packages/vue-identicon/src/icons/Polkadot.ts rename to packages/vue-identicon/src/icons/Pezkuwi.ts index d6670624..edbb0796 100644 --- a/packages/vue-identicon/src/icons/Polkadot.ts +++ b/packages/vue-identicon/src/icons/Pezkuwi.ts @@ -5,7 +5,7 @@ import type { VNode } from 'vue'; import { defineComponent, h } from 'vue'; -import { polkadotIcon } from '@pezkuwi/ui-shared'; +import { pezkuwiIcon } from '@pezkuwi/ui-shared'; import { adaptVNodeAttrs } from '../util.js'; @@ -16,14 +16,14 @@ interface propsType { } /** - * @name Polkadot - * @description The Polkadot default identicon + * @name Pezkuwi + * @description The Pezkuwi default identicon */ -export const Polkadot = defineComponent({ +export const Pezkuwi = defineComponent({ props: ['address', 'isAlternative', 'size'], render (): VNode { const { address, isAlternative, size } = this.$props as propsType; - const circles = polkadotIcon(address, { isAlternative }).map(({ cx, cy, fill, r }) => + const circles = pezkuwiIcon(address, { isAlternative }).map(({ cx, cy, fill, r }) => h('circle', { ...adaptVNodeAttrs({ cx, cy, fill, r }) }, []) ); diff --git a/packages/vue-identicon/src/icons/index.ts b/packages/vue-identicon/src/icons/index.ts index 7933d590..d3da7784 100644 --- a/packages/vue-identicon/src/icons/index.ts +++ b/packages/vue-identicon/src/icons/index.ts @@ -1,7 +1,7 @@ -// Copyright 2017-2025 @pezkuwi/reactnative-identicon authors & contributors +// Copyright 2017-2025 @pezkuwi/vue-identicon authors & contributors // SPDX-License-Identifier: Apache-2.0 export * from './Beachball.js'; export * from './Empty.js'; export * from './Jdenticon.js'; -export * from './Polkadot.js'; +export * from './Pezkuwi.js';