Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix to_subaccount getting deleted and release 0.4.4 #217

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.4.4] - 2024-03-21

- Fixed `quill sns make-proposal` setting some fields to null.

## [0.4.3] - 2024-01-29

- Updated dependencies.
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quill"
version = "0.4.3"
version = "0.4.4"
authors = ["DFINITY Team"]
edition = "2021"
rust-version = "1.75.0"
Expand Down
4 changes: 2 additions & 2 deletions src/commands/sns/make_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
AnyhowResult,
};
use anyhow::Error;
use candid::{Decode, Encode};
use candid::{CandidType, Decode, Encode, TypeEnv};
use candid_parser::parse_idl_args;
use clap::Parser;
use ic_sns_governance::pb::v1::{manage_neuron, ManageNeuron, Proposal};
Expand Down Expand Up @@ -85,6 +85,6 @@ pub fn exec(

fn parse_proposal_from_candid_string(proposal_candid: String) -> AnyhowResult<Proposal> {
let args = parse_idl_args(&proposal_candid)?;
let args: Vec<u8> = args.to_bytes()?;
let args: Vec<u8> = args.to_bytes_with_types(&TypeEnv::default(), &[Proposal::ty()])?;
Decode!(args.as_slice(), Proposal).map_err(Error::msg)
}
29 changes: 29 additions & 0 deletions tests/output/default/sns/make_proposal/with_blob.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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\2f\65\4f\f5\83\35\e5\a2\51\2c\ca\e0\d7\83\9c\74\4b\18\07\a4\7c\96\f5\b9\f3\96\90\69";
command = opt variant {
MakeProposal = record {
url = "example.com";
title = "Transfer ICP from SNS treasury.";
action = opt variant {
TransferSnsTreasuryFunds = record {
from_treasury = 1 : int32;
to_principal = opt principal "rrkah-fqaaa-aaaaa-aaaaq-cai";
to_subaccount = opt record {
subaccount = blob "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\01";
};
memo = null;
amount_e8s = 1_000_000_000 : nat64;
}
};
summary = "";
}
};
},
)
17 changes: 17 additions & 0 deletions tests/output/sns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ fn make_proposal() {
"sns make-proposal {NEURON_ID} --proposal '{proposal}'"
))
.diff("sns/make_proposal/simple.txt");
let proposal_with_blob = r#"
( record {
title = "Transfer ICP from SNS treasury.";
url = "example.com";
summary = "";
action = opt variant { TransferSnsTreasuryFunds = record {
from_treasury = 1 : int32;
to_principal = opt principal "rrkah-fqaaa-aaaaa-aaaaq-cai";
to_subaccount = opt record { subaccount = vec {0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1} };
memo = null;
amount_e8s = 1_000_000_000: nat64
} };
} )"#;
quill_sns_send(&format!(
"sns make-proposal {NEURON_ID} --proposal '{proposal_with_blob}'"
))
.diff("sns/make_proposal/with_blob.txt");
let proposal_bin = asset("sns_proposal.bin");
quill_sns_send(&format!(
"sns make-proposal {NEURON_ID} --proposal-path '{proposal_bin}'",
Expand Down
Loading