waku-org / js-rln

Browser library providing the cryptographic functions for Waku RLN Relay https://rfc.vac.dev/spec/17/
Apache License 2.0
5 stars 1 forks source link

Contract handling helper #29

Closed fryorcraken closed 1 year ago

fryorcraken commented 2 years ago

Problem

Retrieving membership details and adding them to the RlnInstance is something that any user of js-rln should do and are likely to copy-paste from https://github.com/waku-org/js-waku-examples/blob/b6d9942b113e51298ba9e4405997c3dc52bec908/rln-js/index.html#L259

Same re listening to contract event add new memberships to RlnInstance.

Same re registering membership in contract: https://github.com/waku-org/js-waku-examples/blob/b6d9942b113e51298ba9e4405997c3dc52bec908/rln-js/index.html#L287

Solution

Provide a function helper that does that.

2 possibilities:

  1. Function helper uses ethers, hence we can set ethers as an optional dependency
  2. Function helper gets passed an object that implement an interface so to give the choice to the user between ethers and web3js.

Not sure (2) is straight forward, might be easier to just go with (1) for now

Acceptance Criteria

weboko commented 1 year ago

I am still not able to determine good API to cover this so @fryorcraken do you see other points for improvement here?

fryorcraken commented 1 year ago

I see you have done improvement already with #43 . Let's use it in the examples and see how it looks.

weboko commented 1 year ago

Ok, so I'll define as follow up item next thing: