* Move api-derive to correct location * Adjust (linting ok) * No composite * ApiDerive split * Adjust * Still WIP, getting closer * It lints * derive build issues sorted * It builds :) * Add system_health to mock * api-augment usage * Cleanups * Adjust paths * linting * Some <'s * Revert <>'s * linting * ordering * Augmentation tweaks * yarn.lock * export
27 lines
812 B
TypeScript
27 lines
812 B
TypeScript
// Copyright 2017-2021 @polkadot/api authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { ApiPromise } from '@polkadot/api';
|
|
import type { SubmittableExtrinsic } from '@polkadot/api-base/types';
|
|
|
|
import { Proposal, ProposalIndex } from '@polkadot/types/interfaces';
|
|
import { Registry } from '@polkadot/types/types';
|
|
|
|
export class ProposalFactory {
|
|
readonly #api: ApiPromise;
|
|
readonly #registry: Registry;
|
|
|
|
constructor (api: ApiPromise) {
|
|
this.#api = api;
|
|
this.#registry = this.#api.registry;
|
|
}
|
|
|
|
public createProposal = (method: SubmittableExtrinsic<'promise'>): Proposal => {
|
|
return this.#registry.createType('Proposal', method);
|
|
};
|
|
|
|
public proposalIndex = (index: number): ProposalIndex => {
|
|
return this.#registry.createType('ProposalIndex', index);
|
|
};
|
|
}
|