-
Notifications
You must be signed in to change notification settings - Fork 8
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: expose proposal api to calimero sdk #911
feat: expose proposal api to calimero sdk #911
Conversation
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.
7c056e9
to
2c03d07
Compare
I added CLI capability, you can test it with: Other options are: Also, had to make some changes in the handlers for the get APIs. todo: better implementation of the |
…expose-proposal-api-to-calimero-sdk
…m:calimero-network/core into feat--expose-proposal-api-to-calimero-sdk
b1952c2
to
7f0ebd6
Compare
…m:calimero-network/core into feat--expose-proposal-api-to-calimero-sdk
c03b79b
to
a91e016
Compare
…expose-proposal-api-to-calimero-sdk
263b2fe
to
683bde5
Compare
…m:calimero-network/core into feat--expose-proposal-api-to-calimero-sdk
@@ -74,6 +75,7 @@ pub struct DraftProposal { | |||
/// The actions to be executed by the proposal. One proposal can contain | |||
/// multiple actions to execute. | |||
actions: Vec<ProposalAction>, | |||
approval: Option<ProposalId>, |
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.
this is needed here
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.
🤦🏽 not needed
…r' of github.com:calimero-network/core into feat--expose-proposal-api-to-calimero-sdk
aadce16
to
c63dcfc
Compare
@@ -1,6 +1,6 @@ | |||
use std::borrow::Cow; | |||
use std::collections::BTreeMap; | |||
use std::time; | |||
use std::{time, vec}; |
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.
?
gas: 300_000_000_000_000, | ||
deposit: 5_000_000_000_000_000_000_000_000, |
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.
highlighting this to come back to it
context_config.network.as_ref().into(), | ||
context_config.contract.as_ref().into(), | ||
) | ||
.propose(proposal_id, signer_id.rt().unwrap(), actions) |
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.
.propose(proposal_id, signer_id.rt().unwrap(), actions) | |
.propose(proposal_id, signer_id.rt().expect("infallible conversion"), actions) |
while we want to avoid panic points, any thing that is "safe" to use unwrap, must define why that's the case
context_config.network.as_ref().into(), | ||
context_config.contract.as_ref().into(), | ||
) | ||
.approve(signer_id.rt().unwrap(), proposal_id) |
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.
same here
@@ -49,6 +51,8 @@ pub enum SubCommands { | |||
App(AppCommand), | |||
Context(ContextCommand), | |||
Identity(IdentityCommand), | |||
JsonRpc(CallCommand), |
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.
bad merge? this reintroduces JsonRpc
drop( | ||
self.ctx_manager | ||
.propose( | ||
context_id, | ||
executor_public_key, | ||
proposal_id.clone(), | ||
actions, | ||
) | ||
.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.
handle the result instead of drop
ping.
drop( | ||
self.ctx_manager | ||
.approve(context_id, executor_public_key, approval.clone()) | ||
.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.
same here
#[derive(Deserialize)] | ||
pub struct ProposalRequest { | ||
pub sender: String, | ||
pub receiver: String, | ||
} |
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.
now unused?
@@ -35,7 +36,7 @@ pub enum ProposalAction { | |||
receiver_id: AccountId, | |||
|
|||
/// The amount of tokens to transfer. | |||
amount: u64, | |||
amount: u128, |
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.
deposit in function call should be u128
too
@@ -74,6 +75,7 @@ pub struct DraftProposal { | |||
/// The actions to be executed by the proposal. One proposal can contain | |||
/// multiple actions to execute. | |||
actions: Vec<ProposalAction>, | |||
approval: Option<ProposalId>, |
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.
🤦🏽 not needed
Exposed wasm
create_proposal
function which creates proposal in proxy contract