Add motions to bounty derive (#3016)
* Add proposals to BountyDerive * Extract filterBountiesProposals method * Apply review suggestions
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user