Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

slight client light work #89

Merged
merged 28 commits into from
Jun 16, 2020
Merged

slight client light work #89

merged 28 commits into from
Jun 16, 2020

Conversation

4meta5
Copy link
Collaborator

@4meta5 4meta5 commented Jun 11, 2020

  • alice keystring for client with full org functionality
  • replace alice keystring with keystore in substrate-identity (import by git)

module stuff

client stuff

  • add vote module logic to client
  • add bank module logic to client
  • add bounty module logic to client

examples

Might tackle this in a future PR but I want the examples folder to make calls to client AND wait for relevant event emission. The current examples/org makes the issue_shares call but doesn't listen for event emission...

@4meta5
Copy link
Collaborator Author

4meta5 commented Jun 14, 2020

At this point, I'm consistently getting EventNotFound for every call to the client despite the fact that all the event structs exist in srml/org.rs and are imported to sunshine.rs. I have a feeling that the calls to the client no longer return events or rather that they shouldn't because that is not how it is done in substrate-identity...

So right now, we have

/// Issue shares
pub async fn issue_shares(
    &self,
    organization: u64,
    who: AccountId32,
    shares: u64,
) -> Result<SharesIssuedEvent<Runtime>> {
    let signer = self.signer()?;
    self.client
        .clone()
        .issue_shares_and_watch(&signer, organization, &who, shares)
        .await?
        .shares_issued()
        .map_err(|e| substrate_subxt::Error::Codec(e))?
        .ok_or(Error::EventNotFound)
}

and we need to make it like this to match the norms of substrate-identity

/// Issue shares
pub async fn issue_shares(
    &self,
    organization: u64,
    who: AccountId32,
    shares: u64,
) -> Result<()> {
    let signer = self.signer()?;
    self.client
        .issue_shares_and_watch(&signer, organization, &who, shares)
        .await?
        .shares_issued()
        .map_err(|e| substrate_subxt::Error::Codec(e))?;
    Ok(())
}

The annoying part is that this new form does not emit the event. So I feel like the and_watch isn't accurate...

@4meta5 4meta5 marked this pull request as ready for review June 16, 2020 00:50
@4meta5 4meta5 requested a review from dvc94ch June 16, 2020 00:51
@4meta5
Copy link
Collaborator Author

4meta5 commented Jun 16, 2020

This PR has good stuff in it so I will merge it. The client still doesn't work as mentioned in greater detail in the previous comment.

@4meta5 4meta5 merged commit c1ddd78 into master Jun 16, 2020
@4meta5 4meta5 deleted the clight-light-work branch June 16, 2020 22:29
@4meta5
Copy link
Collaborator Author

4meta5 commented Jun 17, 2020

For clarification, #95 was NOT resolved in this PR. The issue is still open for this reason.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant