diff --git a/CHANGELOG.md b/CHANGELOG.md index a7864357..84f91260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed - Require `--ticket-creation-time` in `quill sns pay`. (#159) +- `--proposal-path` in the `sns make-proposal` command expects the binary encoding + of the proposal candid record. (#160) ## [0.3.3] - 2023-02-09 diff --git a/src/commands/sns/make_proposal.rs b/src/commands/sns/make_proposal.rs index 615d05f3..57264d42 100644 --- a/src/commands/sns/make_proposal.rs +++ b/src/commands/sns/make_proposal.rs @@ -41,8 +41,8 @@ pub struct MakeProposalOpts { #[clap(long)] proposal: Option, - /// Path to a file containing the proposal. The proposal must be formatted as a string - /// wrapped candid record. + /// Path to a file containing the proposal. The proposal must be the binary encoding of + /// the proposal candid record. #[clap( long, conflicts_with = "proposal", @@ -60,14 +60,12 @@ pub fn exec( let neuron_subaccount = neuron_id.subaccount().map_err(Error::msg)?; let governance_canister_id = sns_canister_ids.governance_canister_id; - let proposal_string = if let Some(proposal) = opts.proposal { - proposal + let proposal = if let Some(proposal) = opts.proposal { + parse_proposal_from_candid_string(proposal)? } else { - fs::read_to_string(opts.proposal_path.unwrap())? + Decode!(&fs::read(opts.proposal_path.unwrap())?, Proposal)? }; - let proposal = parse_proposal_from_candid_string(proposal_string)?; - let args = Encode!(&ManageNeuron { subaccount: neuron_subaccount.to_vec(), command: Some(manage_neuron::Command::MakeProposal(proposal)) diff --git a/tests/commands/sns-make-proposal-from-file.sh b/tests/commands/sns-make-proposal-from-file.sh new file mode 100755 index 00000000..d69b19dc --- /dev/null +++ b/tests/commands/sns-make-proposal-from-file.sh @@ -0,0 +1,3 @@ +NEURON_ID=83a7d2b12f654ff58335e5a2512ccae0d7839c744b1807a47c96f5b9f3969069 +"$QUILL" sns make-proposal $NEURON_ID --proposal-path "outputs/sns_proposal.txt" --canister-ids-file ./sns_canister_ids.json --pem-file - | "$QUILL" send --dry-run - + diff --git a/tests/outputs/sns-make-proposal-from-file.txt b/tests/outputs/sns-make-proposal-from-file.txt new file mode 100644 index 00000000..6469c146 --- /dev/null +++ b/tests/outputs/sns-make-proposal-from-file.txt @@ -0,0 +1,23 @@ +Sending message with + + Call type: update + Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae + Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai + Method name: manage_neuron + Arguments: ( + record { + subaccount = blob "\83\a7\d2\b1/eO\f5\835\e5\a2Q,\ca\e0\d7\83\9ctK\18\07\a4|\96\f5\b9\f3\96\90i"; + command = opt variant { + MakeProposal = record { + url = "https://dfinity.org"; + title = "SNS Launch"; + action = opt variant { + Motion = record { + motion_text = "I hereby raise the motion that the use of the SNS shall commence"; + } + }; + summary = "A motion to start the SNS"; + } + }; + }, +) diff --git a/tests/outputs/sns_proposal.txt b/tests/outputs/sns_proposal.txt new file mode 100644 index 00000000..0a208ce4 Binary files /dev/null and b/tests/outputs/sns_proposal.txt differ