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

Query Cantillon worker's TrustedGetter from js_servcie_encointer (Balance, registrations, meetup info) #14

Closed
brenzi opened this issue Jun 23, 2020 · 3 comments

Comments

@brenzi
Copy link
Member

brenzi commented Jun 23, 2020

For the app to work with Cantillon, we'll need to implement the worker-api for the following Getters:

Assumptions:

  • we use the same on-chain account also as our incognito account for offchain workers for simplicity (rust client can use different keypairs for on-chain and off-chain state)

Rust definitions for TrustedGetter:
https://github.com/encointer/encointer-worker/blob/35ae50a27b293971f2289d71ef3f81b604ae8d33/stf/src/lib.rs#L112-L117

rust client commands:

  1. encointer-client-teeproxy trusted balance .... Rust
  2. encointer-client-teeproxy trusted get_registration .... Rust
  3. encointer-client-teeproxy trusted get_attestations .... Rust
  4. get meetup assignment for claim generation: Rust

The TrustedGetter has to be wrapped multiple times:

  1. into a TrustedGetterSigned (by signing it with our incognito account = polkawallet account)
  2. into a ClientRequest Definition

then send request over websocket to : wss://substratee03.scs.ch
return value will be a hex::encode(SCALE::encode(value)). Can only be decoded if type is known:

  1. Balance is a BalanceType
  2. registration is ParticipantIndexType
  3. attestations is Vec<Attestation>
  4. meetup assignment is (MeetupIndexType, Option<Location>, Option<Moment>)

We may want to query public stats too once they are available. See:
worker #7

@brenzi
Copy link
Member Author

brenzi commented Jun 23, 2020

If possible, we should keep this +- compatible with the explorer in order to solve this one easily afterwards:
encointer/explorer#12

@brenzi
Copy link
Member Author

brenzi commented Jun 24, 2020

since worker v0.6.7 TrustedGetterSigned needs to be wrapped into a Getter before wrapping it into ClientRequest

@clangenb
Copy link
Member

clangenb commented Jul 9, 2020

Basic functionality has been implemented. We are able to talk to the worker.

However, some return values are weird. Track remaining issues in #30

@clangenb clangenb closed this as completed Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants