|
@@ -33,7 +33,6 @@ import { Mint, MintId } from "@joystream/types/mint";
|
|
|
import {
|
|
|
Proposal,
|
|
|
ProposalId,
|
|
|
- ProposalDetails,
|
|
|
DiscussionPost,
|
|
|
SpendingParams,
|
|
|
VoteKind,
|
|
@@ -44,6 +43,11 @@ import {
|
|
|
RewardRelationshipId,
|
|
|
} from "@joystream/types/recurring-rewards";
|
|
|
import { WorkerId, Worker } from "@joystream/types/working-group";
|
|
|
+import {
|
|
|
+ ProposalOf,
|
|
|
+ ProposalDetailsOf,
|
|
|
+ WorkerOf,
|
|
|
+} from "@joystream/types/augment-codec/all";
|
|
|
|
|
|
// blocks
|
|
|
export const getBlock = (api: ApiPromise, hash: Hash): Promise<SignedBlock> =>
|
|
@@ -233,7 +237,7 @@ export const getWorker = (
|
|
|
group: string,
|
|
|
hash: Hash,
|
|
|
id: number
|
|
|
-): Promise<Worker> => api.query[group].workerById.at(hash, id);
|
|
|
+): Promise<WorkerOf> => api.query[group].workerById.at(hash, id);
|
|
|
|
|
|
export const getWorkers = (
|
|
|
api: ApiPromise,
|
|
@@ -361,22 +365,22 @@ export const getProposalCount = async (
|
|
|
export const getProposalInfo = async (
|
|
|
api: ApiPromise,
|
|
|
id: ProposalId
|
|
|
-): Promise<Proposal> =>
|
|
|
- (await api.query.proposalsEngine.proposals(id)) as Proposal;
|
|
|
+): Promise<ProposalOf> =>
|
|
|
+ (await api.query.proposalsEngine.proposals(id)) as ProposalOf;
|
|
|
|
|
|
export const getProposalDetails = async (
|
|
|
api: ApiPromise,
|
|
|
id: ProposalId
|
|
|
-): Promise<ProposalDetails> =>
|
|
|
+): Promise<ProposalDetailsOf> =>
|
|
|
(await api.query.proposalsCodex.proposalDetailsByProposalId(
|
|
|
id
|
|
|
- )) as ProposalDetails;
|
|
|
+ )) as ProposalDetailsOf;
|
|
|
|
|
|
export const getProposalType = async (
|
|
|
api: ApiPromise,
|
|
|
id: ProposalId
|
|
|
): Promise<string> => {
|
|
|
- const details = (await getProposalDetails(api, id)) as ProposalDetails;
|
|
|
+ const details = (await getProposalDetails(api, id)) as ProposalDetailsOf;
|
|
|
const [type]: string[] = Object.getOwnPropertyNames(details.toJSON());
|
|
|
return type;
|
|
|
};
|
|
@@ -385,7 +389,7 @@ export const getProposal = async (
|
|
|
api: ApiPromise,
|
|
|
id: ProposalId
|
|
|
): Promise<ProposalDetail> => {
|
|
|
- const proposal = await getProposalInfo(api, id);
|
|
|
+ const proposal: ProposalOf = await getProposalInfo(api, id);
|
|
|
const status: { [key: string]: any } = proposal.status;
|
|
|
const stage: string = status.isActive ? "Active" : "Finalized";
|
|
|
const { finalizedAt, proposalStatus } = status[`as${stage}`];
|
|
@@ -400,10 +404,10 @@ export const getProposal = async (
|
|
|
const exec = proposalStatus ? proposalStatus["Approved"] : null;
|
|
|
|
|
|
const { description, parameters, proposerId, votingResults } = proposal;
|
|
|
- const member = await getMember(api, proposerId);
|
|
|
+ const member: Membership = await getMember(api, proposerId);
|
|
|
const author = String(member ? member.handle : proposerId);
|
|
|
const title = proposal.title.toString();
|
|
|
- const type = await getProposalType(api, id);
|
|
|
+ const type: string = await getProposalType(api, id);
|
|
|
const args: string[] = [String(id), title, type, stage, result, author];
|
|
|
const message: string = ``; //formatProposalMessage(args)
|
|
|
const created: number = Number(proposal.createdAt);
|