mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-16 16:41:02 +00:00
Add Pezkuwi SDK UI - Polkadot.js Apps clone
- Clone Polkadot.js Apps repository - Update package.json with Pezkuwi branding - Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944) - Create comprehensive README for SDK UI - Set up project structure with all packages Next steps: - Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme - Replace logos with Pezkuwi branding - Test build and deployment
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// Copyright 2017-2025 @polkadot/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@polkadot/api';
|
||||
import type { DefinitionRpcExt } from '@polkadot/types/types';
|
||||
import type { DropdownOption, DropdownOptions } from '../../util/types.js';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
export default function createOptions (api: ApiPromise, rpcs: Record<string, Record<string, DefinitionRpcExt>>, sectionName: string): DropdownOptions {
|
||||
const section = rpcs[sectionName];
|
||||
|
||||
if (!section || Object.keys((api.rpc as unknown as Record<string, Record<string, unknown>>)[sectionName]).length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Object
|
||||
.keys((api.rpc as unknown as Record<string, Record<string, unknown>>)[sectionName])
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((methodName) => section[methodName])
|
||||
.filter((ext): ext is DefinitionRpcExt => !!ext)
|
||||
.filter(({ isSubscription }) => !isSubscription)
|
||||
.map(({ description, method, params }): DropdownOption => {
|
||||
const inputs = params.map(({ name }) => name).join(', ');
|
||||
|
||||
return {
|
||||
className: 'ui--DropdownLinked-Item',
|
||||
key: `${sectionName}_${method}`,
|
||||
text: [
|
||||
<div
|
||||
className='ui--DropdownLinked-Item-call'
|
||||
key={`${sectionName}_${method}:call`}
|
||||
>
|
||||
{method}({inputs})
|
||||
</div>,
|
||||
<div
|
||||
className='ui--DropdownLinked-Item-text'
|
||||
key={`${sectionName}_${method}:text`}
|
||||
>
|
||||
{description || method}
|
||||
</div>
|
||||
],
|
||||
value: method
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user