@waku/rln 0.0.2-c86e056.0 → 0.0.2-ebd7523.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/bundle/index.js +1 -1
  2. package/bundle/packages/interfaces/dist/protocols.js +40 -45
  3. package/bundle/packages/rln/dist/contract/abi.js +648 -0
  4. package/bundle/packages/rln/dist/contract/constants.js +8 -13
  5. package/bundle/packages/rln/dist/contract/rln_contract.js +14 -3
  6. package/bundle/packages/rln/dist/rln.js +29 -11
  7. package/bundle/packages/rln/dist/zerokit.js +22 -16
  8. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +1 -1
  9. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +1 -1
  10. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +2 -2
  11. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +1 -1
  12. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
  13. package/dist/.tsbuildinfo +1 -1
  14. package/dist/contract/{abi/rlnv2.d.ts → abi.d.ts} +22 -18
  15. package/dist/contract/abi.js +647 -0
  16. package/dist/contract/abi.js.map +1 -0
  17. package/dist/contract/constants.d.ts +22 -23
  18. package/dist/contract/constants.js +7 -12
  19. package/dist/contract/constants.js.map +1 -1
  20. package/dist/contract/rln_contract.d.ts +8 -0
  21. package/dist/contract/rln_contract.js +14 -3
  22. package/dist/contract/rln_contract.js.map +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/rln.js +29 -10
  27. package/dist/rln.js.map +1 -1
  28. package/dist/zerokit.d.ts +5 -1
  29. package/dist/zerokit.js +22 -16
  30. package/dist/zerokit.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/contract/abi.ts +646 -0
  33. package/src/contract/constants.ts +8 -14
  34. package/src/contract/rln_contract.ts +16 -3
  35. package/src/index.ts +2 -2
  36. package/src/rln.ts +42 -10
  37. package/src/zerokit.ts +45 -16
  38. package/bundle/packages/rln/dist/contract/abi/rlnv2.js +0 -394
  39. package/dist/contract/abi/rlnv2.js +0 -393
  40. package/dist/contract/abi/rlnv2.js.map +0 -1
  41. package/src/contract/abi/rlnv2.ts +0 -392
package/bundle/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { RLNDecoder, RLNEncoder } from './packages/rln/dist/codec.js';
2
- export { RLN_V2_ABI } from './packages/rln/dist/contract/abi/rlnv2.js';
2
+ export { RLN_ABI } from './packages/rln/dist/contract/abi.js';
3
3
  export { RLNContract } from './packages/rln/dist/contract/rln_contract.js';
4
4
  export { SEPOLIA_CONTRACT } from './packages/rln/dist/contract/constants.js';
5
5
  export { createRLN } from './packages/rln/dist/create.js';
@@ -7,43 +7,24 @@ var Protocols;
7
7
  })(Protocols || (Protocols = {}));
8
8
  var ProtocolError;
9
9
  (function (ProtocolError) {
10
- /** Could not determine the origin of the fault. Best to check connectivity and try again */
10
+ //
11
+ // GENERAL ERRORS SECTION
12
+ //
13
+ /**
14
+ * Could not determine the origin of the fault. Best to check connectivity and try again
15
+ * */
11
16
  ProtocolError["GENERIC_FAIL"] = "Generic error";
12
17
  /**
13
- * Failure to protobuf encode the message. This is not recoverable and needs
14
- * further investigation.
18
+ * The remote peer rejected the message. Information provided by the remote peer
19
+ * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`
20
+ * or `DECODE_FAILED` can be used.
15
21
  */
16
- ProtocolError["ENCODE_FAILED"] = "Failed to encode";
22
+ ProtocolError["REMOTE_PEER_REJECTED"] = "Remote peer rejected";
17
23
  /**
18
24
  * Failure to protobuf decode the message. May be due to a remote peer issue,
19
25
  * ensuring that messages are sent via several peer enable mitigation of this error.
20
26
  */
21
27
  ProtocolError["DECODE_FAILED"] = "Failed to decode";
22
- /**
23
- * The message payload is empty, making the message invalid. Ensure that a non-empty
24
- * payload is set on the outgoing message.
25
- */
26
- ProtocolError["EMPTY_PAYLOAD"] = "Payload is empty";
27
- /**
28
- * The message size is above the maximum message size allowed on the Waku Network.
29
- * Compressing the message or using an alternative strategy for large messages is recommended.
30
- */
31
- ProtocolError["SIZE_TOO_BIG"] = "Size is too big";
32
- /**
33
- * The PubsubTopic passed to the send function is not configured on the Waku node.
34
- * Please ensure that the PubsubTopic is used when initializing the Waku node.
35
- */
36
- ProtocolError["TOPIC_NOT_CONFIGURED"] = "Topic not configured";
37
- /**
38
- * The pubsub topic configured on the decoder does not match the pubsub topic setup on the protocol.
39
- * Ensure that the pubsub topic used for decoder creation is the same as the one used for protocol.
40
- */
41
- ProtocolError["TOPIC_DECODER_MISMATCH"] = "Topic decoder mismatch";
42
- /**
43
- * The topics passed in the decoders do not match each other, or don't exist at all.
44
- * Ensure that all the pubsub topics used in the decoders are valid and match each other.
45
- */
46
- ProtocolError["INVALID_DECODER_TOPICS"] = "Invalid decoder topics";
47
28
  /**
48
29
  * Failure to find a peer with suitable protocols. This may due to a connection issue.
49
30
  * Mitigation can be: retrying after a given time period, display connectivity issue
@@ -61,37 +42,51 @@ var ProtocolError;
61
42
  * or `DECODE_FAILED` can be used.
62
43
  */
63
44
  ProtocolError["NO_RESPONSE"] = "No response received";
45
+ //
46
+ // SEND ERRORS SECTION
47
+ //
64
48
  /**
65
- * The remote peer rejected the message. Information provided by the remote peer
66
- * is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`
67
- * or `DECODE_FAILED` can be used.
49
+ * Failure to protobuf encode the message. This is not recoverable and needs
50
+ * further investigation.
68
51
  */
69
- ProtocolError["REMOTE_PEER_REJECTED"] = "Remote peer rejected";
52
+ ProtocolError["ENCODE_FAILED"] = "Failed to encode";
70
53
  /**
71
- * The protocol request timed out without a response. This may be due to a connection issue.
72
- * Mitigation can be: retrying after a given time period
54
+ * The message payload is empty, making the message invalid. Ensure that a non-empty
55
+ * payload is set on the outgoing message.
73
56
  */
74
- ProtocolError["REQUEST_TIMEOUT"] = "Request timeout";
57
+ ProtocolError["EMPTY_PAYLOAD"] = "Payload is empty";
75
58
  /**
76
- * Missing credentials info message.
77
- * nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L186
59
+ * The message size is above the maximum message size allowed on the Waku Network.
60
+ * Compressing the message or using an alternative strategy for large messages is recommended.
78
61
  */
79
- ProtocolError["RLN_IDENTITY_MISSING"] = "Identity credentials are not set";
62
+ ProtocolError["SIZE_TOO_BIG"] = "Size is too big";
80
63
  /**
81
- * Membership index missing info message.
82
- * nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L188
64
+ * The PubsubTopic passed to the send function is not configured on the Waku node.
65
+ * Please ensure that the PubsubTopic is used when initializing the Waku node.
83
66
  */
84
- ProtocolError["RLN_MEMBERSHIP_INDEX"] = "Membership index is not set";
67
+ ProtocolError["TOPIC_NOT_CONFIGURED"] = "Topic not configured";
85
68
  /**
86
- * Message limit is missing.
87
- * nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L190
69
+ * Fails when
88
70
  */
89
- ProtocolError["RLN_LIMIT_MISSING"] = "User message limit is not set";
71
+ ProtocolError["STREAM_ABORTED"] = "Stream aborted";
90
72
  /**
91
73
  * General proof generation error message.
92
74
  * nwaku: https://github.com/waku-org/nwaku/blob/c3cb06ac6c03f0f382d3941ea53b330f6a8dd127/waku/waku_rln_relay/group_manager/group_manager_base.nim#L201C19-L201C42
93
75
  */
94
76
  ProtocolError["RLN_PROOF_GENERATION"] = "Proof generation failed";
77
+ //
78
+ // RECEIVE ERRORS SECTION
79
+ //
80
+ /**
81
+ * The pubsub topic configured on the decoder does not match the pubsub topic setup on the protocol.
82
+ * Ensure that the pubsub topic used for decoder creation is the same as the one used for protocol.
83
+ */
84
+ ProtocolError["TOPIC_DECODER_MISMATCH"] = "Topic decoder mismatch";
85
+ /**
86
+ * The topics passed in the decoders do not match each other, or don't exist at all.
87
+ * Ensure that all the pubsub topics used in the decoders are valid and match each other.
88
+ */
89
+ ProtocolError["INVALID_DECODER_TOPICS"] = "Invalid decoder topics";
95
90
  })(ProtocolError || (ProtocolError = {}));
96
91
 
97
92
  export { ProtocolError, Protocols };