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