mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-11-01 06:09:49 +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:
commit
d21bfb1320
5867 files changed
+329019
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-supports authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { DeriveBalancesAll, DeriveStakingAccount } from '@pezkuwi/api-derive/types';
|
||||
import type { UseAccountInfo } from '@pezkuwi/react-hooks/types';
|
||||
import type { KeyringJson$Meta } from '@pezkuwi/ui-keyring/types';
|
||||
import type { AccountOverrides, Override } from '../types.js';
|
||||
|
||||
export const anAccount = (): AccountOverrides => ({});
|
||||
|
||||
export const anAccountWithBalance = (balance: Override<DeriveBalancesAll>): AccountOverrides => ({
|
||||
balance
|
||||
});
|
||||
|
||||
export const anAccountWithInfo = (info: Override<UseAccountInfo>): AccountOverrides => ({
|
||||
info
|
||||
});
|
||||
|
||||
export const anAccountWithMeta = (meta: Override<KeyringJson$Meta>): AccountOverrides => ({
|
||||
meta
|
||||
});
|
||||
|
||||
export const anAccountWithStaking = (staking: Override<DeriveStakingAccount>): AccountOverrides => ({
|
||||
staking
|
||||
});
|
||||
|
||||
export const anAccountWithBalanceAndMeta = (balance: Override<DeriveBalancesAll>, meta: Override<KeyringJson$Meta>): AccountOverrides => ({
|
||||
balance,
|
||||
meta
|
||||
});
|
||||
|
||||
export const anAccountWithInfoAndMeta = (info: Override<UseAccountInfo>, meta: Override<KeyringJson$Meta>): AccountOverrides => ({
|
||||
info,
|
||||
meta
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-supports authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Registry } from '@pezkuwi/types/types';
|
||||
|
||||
import { TypeRegistry, u128 as U128 } from '@pezkuwi/types';
|
||||
|
||||
export function balanceOf (number: number | string): U128 {
|
||||
// FIXME - ref: https://github.com/pezkuwi-js/apps/pull/11051
|
||||
// Adding support for CJS and ESM correctly has caused some build issues.
|
||||
// This is a hacky type cast to allow the compiler to be happy.
|
||||
return new U128(new TypeRegistry() as unknown as Registry, number);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { BountyIndex } from '@pezkuwi/types/interfaces';
|
||||
import type { PalletBountiesBounty, PalletBountiesBountyStatus } from '@pezkuwi/types/lookup';
|
||||
import type { Registry } from '@pezkuwi/types/types';
|
||||
|
||||
import { balanceOf } from './balance.js';
|
||||
|
||||
export class BountyFactory {
|
||||
readonly #api: ApiPromise;
|
||||
readonly #registry: Registry;
|
||||
|
||||
constructor (api: ApiPromise) {
|
||||
this.#api = api;
|
||||
this.#registry = this.#api.registry;
|
||||
}
|
||||
|
||||
public aBountyIndex = (index = 0): BountyIndex =>
|
||||
this.#registry.createType('BountyIndex', index);
|
||||
|
||||
public defaultBounty = (): PalletBountiesBounty =>
|
||||
this.#registry.createType<PalletBountiesBounty>('Bounty');
|
||||
|
||||
public aBountyStatus = (status: string): PalletBountiesBountyStatus =>
|
||||
this.#registry.createType('PalletBountiesBountyStatus', status);
|
||||
|
||||
public bountyStatusWith = ({ curator = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', status = 'Active', updateDue = 100000 } = {}): PalletBountiesBountyStatus => {
|
||||
if (status === 'Active') {
|
||||
return this.#registry.createType('PalletBountiesBountyStatus', { active: { curator, updateDue }, status });
|
||||
}
|
||||
|
||||
if (status === 'CuratorProposed') {
|
||||
return this.#registry.createType('PalletBountiesBountyStatus', { curatorProposed: { curator }, status });
|
||||
}
|
||||
|
||||
throw new Error('Unsupported status');
|
||||
};
|
||||
|
||||
public bountyWith = ({ status = 'Proposed', value = 1 } = {}): PalletBountiesBounty =>
|
||||
this.aBounty({ status: this.aBountyStatus(status), value: balanceOf(value) });
|
||||
|
||||
public aBounty = ({ fee = balanceOf(10), status = this.aBountyStatus('Proposed'), value = balanceOf(500) }: Partial<PalletBountiesBounty> = {}): PalletBountiesBounty =>
|
||||
this.#registry.createType<PalletBountiesBounty>('Bounty', { fee, status, value });
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-supports authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { DeriveBalancesAll, DeriveStakingAccount } from '@pezkuwi/api-derive/types';
|
||||
import type { UseAccountInfo } from '@pezkuwi/react-hooks/types';
|
||||
import type { KeyringJson$Meta } from '@pezkuwi/ui-keyring/types';
|
||||
import type { AccountOverrides as ContactOverrides, Override } from '../types.js';
|
||||
|
||||
export const aContact = (): ContactOverrides => ({});
|
||||
|
||||
export const aContactWithBalance = (balance: Override<DeriveBalancesAll>): ContactOverrides => ({
|
||||
balance
|
||||
});
|
||||
|
||||
export const aContactWithInfo = (info: Override<UseAccountInfo>): ContactOverrides => ({
|
||||
info
|
||||
});
|
||||
|
||||
export const aContactWithStaking = (staking: Override<DeriveStakingAccount>): ContactOverrides => ({
|
||||
staking
|
||||
});
|
||||
|
||||
export const aContactWithMeta = (meta: Override<KeyringJson$Meta>): ContactOverrides => ({
|
||||
meta
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Hash } from '@pezkuwi/types/interfaces';
|
||||
|
||||
import { PEZKUWI_GENESIS } from '@pezkuwi/apps-config';
|
||||
import { TypeRegistry } from '@pezkuwi/types/create';
|
||||
|
||||
export function aGenesisHash (): Hash {
|
||||
return new TypeRegistry().createType('Hash', PEZKUWI_GENESIS);
|
||||
}
|
||||
|
||||
export function aHash (): Hash {
|
||||
return new TypeRegistry().createType('Hash');
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2017-2025 @pezkuwi/app-bounties authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { PalletStakingStakingLedger } from '@pezkuwi/types/lookup';
|
||||
|
||||
import { TypeRegistry } from '@pezkuwi/types/create';
|
||||
import { BN } from '@pezkuwi/util';
|
||||
|
||||
export function makeStakingLedger (active: BN | number | string): PalletStakingStakingLedger {
|
||||
const reg = new TypeRegistry();
|
||||
|
||||
// Constructing the whole StakingLedger structure is hard,
|
||||
// so we fill out just the fields that are definitely required,
|
||||
// and hope that nothing more is required.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
return {
|
||||
active: reg.createType('Compact<Balance>', reg.createType('Balance', new BN(active)))
|
||||
} as PalletStakingStakingLedger;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { SubmittableExtrinsic } from '@pezkuwi/api/types';
|
||||
import type { DeriveCollectiveProposal } from '@pezkuwi/api-derive/types';
|
||||
|
||||
import { BN_ONE, BN_ZERO } from '@pezkuwi/util';
|
||||
|
||||
import { alice, bob } from '../keyring/addresses.js';
|
||||
import { balanceOf } from './balance.js';
|
||||
import { aHash } from './hashes.js';
|
||||
|
||||
export interface ProposalFactory {
|
||||
aProposal: (extrinsic: SubmittableExtrinsic<'promise'>, ayes?: string[], nays?: string[]) => DeriveCollectiveProposal
|
||||
}
|
||||
|
||||
export function proposalFactory (api: ApiPromise): ProposalFactory {
|
||||
const registry = api.registry;
|
||||
|
||||
return {
|
||||
aProposal: (extrinsic, ayes = [alice], nays = [bob]) => ({
|
||||
hash: aHash(),
|
||||
proposal: registry.createType('Proposal', extrinsic),
|
||||
votes: registry.createType('Votes', {
|
||||
ayes,
|
||||
index: 0,
|
||||
nays,
|
||||
threshold: 4
|
||||
})
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
export const defaultTreasury = {
|
||||
burn: BN_ONE,
|
||||
spendPeriod: BN_ZERO,
|
||||
value: balanceOf(1)
|
||||
};
|
||||
Reference in new issue
Block a user