mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-08-10 04:35:46 +00:00
971df8edba
- Remove all 3rd party parachain configurations from endpoints: - productionRelayPolkadot.ts: Keep only system parachains - productionRelayDicle.ts: Keep only system parachains - testingRelayZagros.ts: Keep only system parachains - testingRelayTeyrChain.ts: Keep only system parachains - Update domain references: - polkadot.js.org → pezkuwichain.app - wiki.polkadot.network → wiki.pezkuwichain.io - dotapps.io → pezkuwichain.app - statement.polkadot.network → docs.pezkuwichain.io/statement - support.polkadot.network → docs.pezkuwichain.io - Update repository references: - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap - Rename system parachains to Pezkuwi ecosystem: - PolkadotAssetHub → PezkuwiAssetHub - polkadotBridgeHub → pezkuwiBridgeHub - polkadotCollectives → pezkuwiCollectives - polkadotCoretime → pezkuwiCoretime - polkadotPeople → pezkuwiPeople - Update network name in claims utility: - Polkadot → Pezkuwi
47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
// Copyright 2017-2026 @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 { PezpalletBountiesBounty, PezpalletBountiesBountyStatus } 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 = (): PezpalletBountiesBounty =>
|
|
this.#registry.createType<PezpalletBountiesBounty>('Bounty');
|
|
|
|
public aBountyStatus = (status: string): PezpalletBountiesBountyStatus =>
|
|
this.#registry.createType('PezpalletBountiesBountyStatus', status);
|
|
|
|
public bountyStatusWith = ({ curator = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', status = 'Active', updateDue = 100000 } = {}): PezpalletBountiesBountyStatus => {
|
|
if (status === 'Active') {
|
|
return this.#registry.createType('PezpalletBountiesBountyStatus', { active: { curator, updateDue }, status });
|
|
}
|
|
|
|
if (status === 'CuratorProposed') {
|
|
return this.#registry.createType('PezpalletBountiesBountyStatus', { curatorProposed: { curator }, status });
|
|
}
|
|
|
|
throw new Error('Unsupported status');
|
|
};
|
|
|
|
public bountyWith = ({ status = 'Proposed', value = 1 } = {}): PezpalletBountiesBounty =>
|
|
this.aBounty({ status: this.aBountyStatus(status), value: balanceOf(value) });
|
|
|
|
public aBounty = ({ fee = balanceOf(10), status = this.aBountyStatus('Proposed'), value = balanceOf(500) }: Partial<PezpalletBountiesBounty> = {}): PezpalletBountiesBounty =>
|
|
this.#registry.createType<PezpalletBountiesBounty>('Bounty', { fee, status, value });
|
|
}
|