-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(sns): Add list
and add-sns-wasm-for-tests
command
#139
feat(sns): Add list
and add-sns-wasm-for-tests
command
#139
Conversation
extensions/sns/src/utils.rs
Outdated
fn get_agent(ic_url: &str) -> Result<Agent> { | ||
Agent::builder() | ||
.with_url(ic_url) | ||
.with_verify_query_signatures(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what this does, but it looks scary, like leaving your house without locking the door. Sure, if there are no evil doers around, everything works just fine. But you still wouldn't do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done
} | ||
}; | ||
|
||
let agent = utils::get_mainnet_agent()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NCR
IIUC, this is only used in one of the branches, specifically, List. Perhaps the list::exec can built agent for itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's tricky because list::exec in the future won't have the necessary information to create the agent
SnsLibSubCommand::DeployTestflight(args) => deploy_testflight(args), | ||
SnsLibSubCommand::InitConfigFile(args) => init_config_file::exec(args), | ||
SnsLibSubCommand::PrepareCanisters(args) => prepare_canisters::exec(args), | ||
SnsLibSubCommand::Propose(args) => propose::exec(args), | ||
SnsLibSubCommand::NeuronIdToCandidSubaccount(args) => { | ||
neuron_id_to_candid_subaccount::exec(args) | ||
} | ||
}?; | ||
Ok(()) | ||
SnsLibSubCommand::AddSnsWasmForTests(args) => add_sns_wasm_for_tests(args), | ||
SnsLibSubCommand::List(args) => list::exec(args, &agent).await, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NCR
Would be nice if all these looked the same. I.e.
X::Y(y) => y::exec(y),
Even better (but more work, and therefore, not recommended now, but next time):
subcommand.unwrap().exec()
where unwrap returns a Box<dyn Exec>
, and Exec
is a new trait that requires fn exec(&self) -> Result<...>;
, and all the args types implement it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this difference is an annoying consequence of the scoping of add_sns_wasm_for_tests
, which can't be fixed in this PR as it's determined by the monorepo :(
fa4a856
to
a7f999a
Compare
31e9a4a
to
fc0789f
Compare
fc0789f
to
02a6247
Compare
This brings it in sync with the monorepo's sns cli.
add-sns-wasm-for-tests
is hidden as it's relatively "developer only" and I don't have a good idea of when it's needed, other than that I know snsdemo uses it.The commands were implemented in the monorepo, and are just called from here.