Skip to content

Commit

Permalink
Fix submitProposal (#4535)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Oct 9, 2023
1 parent 6156377 commit 64be779
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions frontend/app/src/components/home/MakeProposalModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@
function onClickPrimary() {
if (step === 0) {
balanceWithRefresh.refresh();
} else if (canSubmit) {
onSubmit();
} else if (step === 1) {
step = 2;
} else if (step === 2) {
onSubmit();
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/openchat-agent/src/services/openchatAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ export class OpenChatAgent extends EventTarget {
}
}

submitProposal(governanceCanisterId: Principal, proposal: CandidateProposal): Promise<SubmitProposalResponse> {
submitProposal(governanceCanisterId: string, proposal: CandidateProposal): Promise<SubmitProposalResponse> {
return this.userClient.submitProposal(governanceCanisterId, proposal);
}
}
1 change: 0 additions & 1 deletion frontend/openchat-agent/src/services/user/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,6 @@ function proposalAction(action: CandidateProposalAction): ProposalToSubmitAction
treasury: action.treasury === "ICP" ? { ICP: null } : { SNS: null }
}};
}
throw new Error("Unexpected proposal action");
}

export function submitProposalResponse(candid: ApiSubmitProposalResponse): SubmitProposalResponse {
Expand Down
4 changes: 2 additions & 2 deletions frontend/openchat-agent/src/services/user/user.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,10 @@ export class UserClient extends CandidService {
);
}

submitProposal(governanceCanisterId: Principal, proposal: CandidateProposal): Promise<SubmitProposalResponse> {
submitProposal(governanceCanisterId: string, proposal: CandidateProposal): Promise<SubmitProposalResponse> {
return this.handleResponse(
this.userService.submit_proposal({
governance_canister_id : governanceCanisterId,
governance_canister_id : Principal.fromText(governanceCanisterId),
proposal : proposalToSubmit(proposal),
}),
submitProposalResponse,
Expand Down
3 changes: 1 addition & 2 deletions frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-case-declarations */
import { Principal } from "@dfinity/principal";
import type { Identity } from "@dfinity/agent";
import { AuthClient } from "@dfinity/auth-client";
import { get, writable } from "svelte/store";
Expand Down Expand Up @@ -4998,7 +4997,7 @@ export class OpenChat extends OpenChatAgentWorker {
submitProposal(governanceCanisterId: string, proposal: CandidateProposal): Promise<boolean> {
return this.sendRequest({
kind: "submitProposal",
governanceCanisterId: Principal.fromText(governanceCanisterId),
governanceCanisterId,
proposal,
})
.then((resp) => {
Expand Down
3 changes: 1 addition & 2 deletions frontend/openchat-shared/src/domain/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ import type {
import type { ChatPermissions } from "./permission";
import type { RegistryValue } from "./registry";
import type { StakeNeuronForSubmittingProposalsResponse } from "./proposalsBot";
import type { Principal } from "@dfinity/principal";
import type { CandidateProposal } from "./proposals";
/**
* Worker request types
Expand Down Expand Up @@ -1326,7 +1325,7 @@ type FollowThread = {
};

type SubmitProposal = {
governanceCanisterId: Principal;
governanceCanisterId: string;
proposal: CandidateProposal;
kind: "submitProposal";
};
Expand Down

0 comments on commit 64be779

Please sign in to comment.