mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-06-16 16:41:04 +00:00
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:
@@ -0,0 +1,45 @@
|
||||
// Copyright 2017-2025 @pezkuwi/app-contracts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { DropdownItemProps } from 'semantic-ui-react';
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { AbiMessage } from '@pezkuwi/api-contract/types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { ContractPromise } from '@pezkuwi/api-contract';
|
||||
import { getContractAbi } from '@pezkuwi/react-components/util';
|
||||
|
||||
import MessageSignature from '../shared/MessageSignature.js';
|
||||
|
||||
export function findCallMethod (callContract: ContractPromise | null, callMethodIndex = 0): AbiMessage | null {
|
||||
return callContract?.abi.messages[callMethodIndex] || null;
|
||||
}
|
||||
|
||||
export function getContractMethodFn (callContract: ContractPromise | null, callMethodIndex: number | null): AbiMessage | null {
|
||||
const fn = callMethodIndex !== null && callContract?.abi?.messages[callMethodIndex];
|
||||
|
||||
return fn || null;
|
||||
}
|
||||
|
||||
export function getContractForAddress (api: ApiPromise, address: string | null): ContractPromise | null {
|
||||
if (!address) {
|
||||
return null;
|
||||
} else {
|
||||
const abi = getContractAbi(address);
|
||||
|
||||
return abi
|
||||
? new ContractPromise(api, abi, address)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getCallMessageOptions (callContract: ContractPromise | null): DropdownItemProps[] {
|
||||
return callContract?.abi.messages.map((m, index) => ({
|
||||
key: m.identifier,
|
||||
text: (
|
||||
<MessageSignature message={m} />
|
||||
),
|
||||
value: index
|
||||
})) || [];
|
||||
}
|
||||
Reference in New Issue
Block a user