@waku/rln 0.1.6 → 0.1.7-36f6884.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.
- package/bundle/index.js +2 -2
- package/bundle/packages/core/dist/lib/connection_manager/connection_limiter.js +17 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +9 -5
- package/bundle/packages/core/dist/lib/connection_manager/dialer.js +17 -0
- package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +17 -0
- package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +2 -2
- package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +17 -0
- package/bundle/packages/core/dist/lib/filter/filter.js +3 -3
- package/bundle/packages/core/dist/lib/light_push/light_push.js +2 -2
- package/bundle/packages/core/dist/lib/message/version_0.js +1 -1
- package/bundle/packages/core/dist/lib/metadata/metadata.js +2 -2
- package/bundle/packages/core/dist/lib/store/store.js +2 -2
- package/bundle/packages/interfaces/dist/connection_manager.js +2 -12
- package/bundle/packages/interfaces/dist/{health_indicator.js → health_status.js} +10 -5
- package/bundle/packages/proto/dist/generated/light_push.js +160 -1
- package/bundle/packages/rln/dist/codec.js +2 -2
- package/bundle/packages/rln/dist/contract/abi/price_calculator.js +95 -0
- package/bundle/packages/rln/dist/contract/constants.js +15 -3
- package/bundle/packages/rln/dist/contract/rln_base_contract.js +25 -6
- package/bundle/packages/rln/dist/contract/rln_contract.js +4 -4
- package/bundle/packages/rln/dist/credentials_manager.js +25 -21
- package/bundle/packages/rln/dist/identity.js +8 -6
- package/bundle/packages/rln/dist/keystore/keystore.js +40 -13
- package/bundle/packages/rln/dist/message.js +1 -1
- package/bundle/packages/rln/dist/proof.js +2 -2
- package/bundle/packages/rln/dist/rln.js +2 -2
- package/bundle/packages/rln/dist/utils/bytes.js +103 -58
- package/bundle/packages/rln/dist/utils/epoch.js +2 -2
- package/bundle/packages/rln/dist/utils/hash.js +3 -3
- package/bundle/packages/rln/dist/zerokit.js +17 -17
- package/bundle/packages/utils/dist/common/sharding/index.js +1 -1
- package/bundle/packages/utils/dist/{logger/index.js → logger.js} +3 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/contract/abi/price_calculator.d.ts +46 -0
- package/dist/contract/abi/price_calculator.js +94 -0
- package/dist/contract/abi/price_calculator.js.map +1 -0
- package/dist/contract/{abi.js → abi/rln.js} +1 -1
- package/dist/contract/abi/rln.js.map +1 -0
- package/dist/contract/constants.d.ts +57 -1
- package/dist/contract/constants.js +14 -2
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_base_contract.d.ts +9 -0
- package/dist/contract/rln_base_contract.js +23 -4
- package/dist/contract/rln_base_contract.js.map +1 -1
- package/dist/contract/rln_contract.js +2 -2
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/contract/{test-setup.d.ts → test_setup.d.ts} +4 -4
- package/dist/contract/{test-setup.js → test_setup.js} +4 -4
- package/dist/contract/{test-setup.js.map → test_setup.js.map} +1 -1
- package/dist/contract/{test-utils.js → test_utils.js} +10 -10
- package/dist/contract/{test-utils.js.map → test_utils.js.map} +1 -1
- package/dist/credentials_manager.d.ts +4 -0
- package/dist/credentials_manager.js +24 -19
- package/dist/credentials_manager.js.map +1 -1
- package/dist/identity.d.ts +5 -2
- package/dist/identity.js +8 -5
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.js +38 -11
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/proof.js +2 -2
- package/dist/proof.js.map +1 -1
- package/dist/utils/bytes.d.ts +42 -20
- package/dist/utils/bytes.js +102 -57
- package/dist/utils/bytes.js.map +1 -1
- package/dist/utils/hash.js +5 -5
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/zerokit.js +17 -17
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -93
- package/src/contract/abi/price_calculator.ts +93 -0
- package/src/contract/constants.ts +18 -2
- package/src/contract/rln_base_contract.ts +38 -5
- package/src/contract/rln_contract.ts +5 -2
- package/src/contract/{test-setup.ts → test_setup.ts} +4 -4
- package/src/contract/{test-utils.ts → test_utils.ts} +9 -9
- package/src/credentials_manager.ts +41 -27
- package/src/identity.ts +11 -7
- package/src/index.ts +3 -3
- package/src/keystore/keystore.ts +52 -23
- package/src/proof.ts +2 -2
- package/src/utils/bytes.ts +118 -72
- package/src/utils/hash.ts +15 -5
- package/src/utils/index.ts +1 -6
- package/src/zerokit.ts +30 -22
- package/dist/contract/abi.js.map +0 -1
- /package/bundle/packages/rln/dist/contract/{abi.js → abi/rln.js} +0 -0
- /package/dist/contract/{abi.d.ts → abi/rln.d.ts} +0 -0
- /package/dist/contract/{test-utils.d.ts → test_utils.d.ts} +0 -0
- /package/src/contract/{abi.ts → abi/rln.ts} +0 -0
package/bundle/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export { RLNDecoder, RLNEncoder } from './packages/rln/dist/codec.js';
|
2
|
-
export { RLN_ABI } from './packages/rln/dist/contract/abi.js';
|
2
|
+
export { RLN_ABI } from './packages/rln/dist/contract/abi/rln.js';
|
3
3
|
export { RLNContract } from './packages/rln/dist/contract/rln_contract.js';
|
4
|
-
export { DEFAULT_RATE_LIMIT,
|
4
|
+
export { DEFAULT_RATE_LIMIT, PRICE_CALCULATOR_CONTRACT, RATE_LIMIT_PARAMS, RATE_LIMIT_TIERS, RLN_CONTRACT, RLN_Q } from './packages/rln/dist/contract/constants.js';
|
5
5
|
export { MembershipState } from './packages/rln/dist/contract/types.js';
|
6
6
|
export { RLNBaseContract } from './packages/rln/dist/contract/rln_base_contract.js';
|
7
7
|
export { createRLN } from './packages/rln/dist/create.js';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
2
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
|
+
|
17
|
+
new Logger("connection-limiter");
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
2
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
1
4
|
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
2
5
|
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
3
6
|
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
@@ -9,11 +12,12 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
9
12
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
10
13
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
11
14
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
12
|
-
import '
|
13
|
-
import '
|
14
|
-
import '
|
15
|
-
import '
|
16
|
-
import { Logger } from '../../../../utils/dist/logger/index.js';
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
|
+
import './connection_limiter.js';
|
17
|
+
import './dialer.js';
|
18
|
+
import './discovery_dialer.js';
|
17
19
|
import './keep_alive_manager.js';
|
20
|
+
import './shard_reader.js';
|
21
|
+
import '../../../../../node_modules/@multiformats/multiaddr/dist/src/registry.js';
|
18
22
|
|
19
23
|
new Logger("connection-manager");
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
2
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
|
+
|
17
|
+
new Logger("dialer");
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
2
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
|
+
|
17
|
+
new Logger("discovery-dialer");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../../../interfaces/dist/protocols.js';
|
2
2
|
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../../../interfaces/dist/
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
5
|
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
6
|
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
@@ -12,7 +12,7 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
12
12
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
13
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
14
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
-
import { Logger } from '../../../../utils/dist/logger
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
16
|
import '../message/version_0.js';
|
17
17
|
|
18
18
|
new Logger("keep-alive");
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import '../../../../interfaces/dist/protocols.js';
|
2
|
+
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
7
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
8
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
9
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
10
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
11
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
12
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
|
+
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
|
+
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
|
+
|
17
|
+
new Logger("shard-reader");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../../../interfaces/dist/protocols.js';
|
2
2
|
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../../../interfaces/dist/
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
5
|
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
6
|
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
@@ -12,7 +12,7 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
12
12
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
13
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
14
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
-
import { Logger } from '../../../../utils/dist/logger
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
16
|
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
17
17
|
import '../../../../proto/dist/generated/message.js';
|
18
18
|
import '../../../../proto/dist/generated/filter.js';
|
@@ -24,4 +24,4 @@ import '../../../../proto/dist/generated/peer_exchange.js';
|
|
24
24
|
import '../../../../proto/dist/generated/metadata.js';
|
25
25
|
import '../../../../proto/dist/generated/sds_message.js';
|
26
26
|
|
27
|
-
new Logger("filter
|
27
|
+
new Logger("filter-core");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../../../interfaces/dist/protocols.js';
|
2
2
|
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../../../interfaces/dist/
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../../proto/dist/generated/message.js';
|
5
5
|
import '../../../../proto/dist/generated/filter.js';
|
6
6
|
import '../../../../proto/dist/generated/topic_only_message.js';
|
@@ -21,7 +21,7 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
21
21
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
22
22
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
23
23
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
24
|
-
import { Logger } from '../../../../utils/dist/logger
|
24
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
25
25
|
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
26
26
|
|
27
27
|
new Logger("light-push");
|
@@ -8,7 +8,7 @@ import '../../../../proto/dist/generated/peer_exchange.js';
|
|
8
8
|
import '../../../../proto/dist/generated/metadata.js';
|
9
9
|
import '../../../../proto/dist/generated/sds_message.js';
|
10
10
|
import { determinePubsubTopic } from '../../../../utils/dist/common/sharding/index.js';
|
11
|
-
import { Logger } from '../../../../utils/dist/logger
|
11
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
12
12
|
|
13
13
|
const log = new Logger("message:version-0");
|
14
14
|
const OneMillion = BigInt(1_000_000);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../../../interfaces/dist/protocols.js';
|
2
2
|
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../../../interfaces/dist/
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../../proto/dist/generated/message.js';
|
5
5
|
import '../../../../proto/dist/generated/filter.js';
|
6
6
|
import '../../../../proto/dist/generated/topic_only_message.js';
|
@@ -21,7 +21,7 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
21
21
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
22
22
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
23
23
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
24
|
-
import { Logger } from '../../../../utils/dist/logger
|
24
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
25
25
|
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
26
26
|
|
27
27
|
new Logger("metadata");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../../../interfaces/dist/protocols.js';
|
2
2
|
import '../../../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../../../interfaces/dist/
|
3
|
+
import '../../../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
5
|
import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
6
|
import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
@@ -12,7 +12,7 @@ import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
12
12
|
import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
13
|
import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
14
|
import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
-
import { Logger } from '../../../../utils/dist/logger
|
15
|
+
import { Logger } from '../../../../utils/dist/logger.js';
|
16
16
|
import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
|
17
17
|
import '../../../../proto/dist/generated/message.js';
|
18
18
|
import '../../../../proto/dist/generated/filter.js';
|
@@ -1,19 +1,9 @@
|
|
1
|
+
// Peer tags
|
1
2
|
var Tags;
|
2
3
|
(function (Tags) {
|
3
4
|
Tags["BOOTSTRAP"] = "bootstrap";
|
4
5
|
Tags["PEER_EXCHANGE"] = "peer-exchange";
|
5
6
|
Tags["LOCAL"] = "local-peer-cache";
|
6
7
|
})(Tags || (Tags = {}));
|
7
|
-
var EPeersByDiscoveryEvents;
|
8
|
-
(function (EPeersByDiscoveryEvents) {
|
9
|
-
EPeersByDiscoveryEvents["PEER_DISCOVERY_BOOTSTRAP"] = "peer:discovery:bootstrap";
|
10
|
-
EPeersByDiscoveryEvents["PEER_DISCOVERY_PEER_EXCHANGE"] = "peer:discovery:peer-exchange";
|
11
|
-
EPeersByDiscoveryEvents["PEER_CONNECT_BOOTSTRAP"] = "peer:connected:bootstrap";
|
12
|
-
EPeersByDiscoveryEvents["PEER_CONNECT_PEER_EXCHANGE"] = "peer:connected:peer-exchange";
|
13
|
-
})(EPeersByDiscoveryEvents || (EPeersByDiscoveryEvents = {}));
|
14
|
-
var EConnectionStateEvents;
|
15
|
-
(function (EConnectionStateEvents) {
|
16
|
-
EConnectionStateEvents["CONNECTION_STATUS"] = "waku:connection";
|
17
|
-
})(EConnectionStateEvents || (EConnectionStateEvents = {}));
|
18
8
|
|
19
|
-
export {
|
9
|
+
export { Tags };
|
@@ -1,12 +1,17 @@
|
|
1
|
-
var HealthStatusChangeEvents;
|
2
|
-
(function (HealthStatusChangeEvents) {
|
3
|
-
HealthStatusChangeEvents["StatusChange"] = "health:change";
|
4
|
-
})(HealthStatusChangeEvents || (HealthStatusChangeEvents = {}));
|
5
1
|
var HealthStatus;
|
6
2
|
(function (HealthStatus) {
|
3
|
+
/**
|
4
|
+
* No peer connections
|
5
|
+
*/
|
7
6
|
HealthStatus["Unhealthy"] = "Unhealthy";
|
7
|
+
/**
|
8
|
+
* At least 1 peer supporting both Filter and LightPush protocols
|
9
|
+
*/
|
8
10
|
HealthStatus["MinimallyHealthy"] = "MinimallyHealthy";
|
11
|
+
/**
|
12
|
+
* At least 2 peers supporting both Filter and LightPush protocols
|
13
|
+
*/
|
9
14
|
HealthStatus["SufficientlyHealthy"] = "SufficientlyHealthy";
|
10
15
|
})(HealthStatus || (HealthStatus = {}));
|
11
16
|
|
12
|
-
export { HealthStatus
|
17
|
+
export { HealthStatus };
|
@@ -87,6 +87,18 @@ var PushResponse;
|
|
87
87
|
w.uint32(18);
|
88
88
|
w.string(obj.info);
|
89
89
|
}
|
90
|
+
if (obj.statusCode != null) {
|
91
|
+
w.uint32(80);
|
92
|
+
w.uint32(obj.statusCode);
|
93
|
+
}
|
94
|
+
if (obj.statusDesc != null) {
|
95
|
+
w.uint32(90);
|
96
|
+
w.string(obj.statusDesc);
|
97
|
+
}
|
98
|
+
if (obj.relayPeerCount != null) {
|
99
|
+
w.uint32(96);
|
100
|
+
w.uint32(obj.relayPeerCount);
|
101
|
+
}
|
90
102
|
if (opts.lengthDelimited !== false) {
|
91
103
|
w.ldelim();
|
92
104
|
}
|
@@ -106,6 +118,18 @@ var PushResponse;
|
|
106
118
|
obj.info = reader.string();
|
107
119
|
break;
|
108
120
|
}
|
121
|
+
case 10: {
|
122
|
+
obj.statusCode = reader.uint32();
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
case 11: {
|
126
|
+
obj.statusDesc = reader.string();
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
case 12: {
|
130
|
+
obj.relayPeerCount = reader.uint32();
|
131
|
+
break;
|
132
|
+
}
|
109
133
|
default: {
|
110
134
|
reader.skipType(tag & 7);
|
111
135
|
break;
|
@@ -190,6 +214,141 @@ var PushRpc$1;
|
|
190
214
|
return decodeMessage(buf, PushRpc.codec(), opts);
|
191
215
|
};
|
192
216
|
})(PushRpc$1 || (PushRpc$1 = {}));
|
217
|
+
var LightPushRequestV3;
|
218
|
+
(function (LightPushRequestV3) {
|
219
|
+
let _codec;
|
220
|
+
LightPushRequestV3.codec = () => {
|
221
|
+
if (_codec == null) {
|
222
|
+
_codec = message((obj, w, opts = {}) => {
|
223
|
+
if (opts.lengthDelimited !== false) {
|
224
|
+
w.fork();
|
225
|
+
}
|
226
|
+
if ((obj.requestId != null && obj.requestId !== '')) {
|
227
|
+
w.uint32(10);
|
228
|
+
w.string(obj.requestId);
|
229
|
+
}
|
230
|
+
if (obj.pubsubTopic != null) {
|
231
|
+
w.uint32(162);
|
232
|
+
w.string(obj.pubsubTopic);
|
233
|
+
}
|
234
|
+
if (obj.message != null) {
|
235
|
+
w.uint32(170);
|
236
|
+
WakuMessage.codec().encode(obj.message, w);
|
237
|
+
}
|
238
|
+
if (opts.lengthDelimited !== false) {
|
239
|
+
w.ldelim();
|
240
|
+
}
|
241
|
+
}, (reader, length, opts = {}) => {
|
242
|
+
const obj = {
|
243
|
+
requestId: ''
|
244
|
+
};
|
245
|
+
const end = length == null ? reader.len : reader.pos + length;
|
246
|
+
while (reader.pos < end) {
|
247
|
+
const tag = reader.uint32();
|
248
|
+
switch (tag >>> 3) {
|
249
|
+
case 1: {
|
250
|
+
obj.requestId = reader.string();
|
251
|
+
break;
|
252
|
+
}
|
253
|
+
case 20: {
|
254
|
+
obj.pubsubTopic = reader.string();
|
255
|
+
break;
|
256
|
+
}
|
257
|
+
case 21: {
|
258
|
+
obj.message = WakuMessage.codec().decode(reader, reader.uint32(), {
|
259
|
+
limits: opts.limits?.message
|
260
|
+
});
|
261
|
+
break;
|
262
|
+
}
|
263
|
+
default: {
|
264
|
+
reader.skipType(tag & 7);
|
265
|
+
break;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|
269
|
+
return obj;
|
270
|
+
});
|
271
|
+
}
|
272
|
+
return _codec;
|
273
|
+
};
|
274
|
+
LightPushRequestV3.encode = (obj) => {
|
275
|
+
return encodeMessage(obj, LightPushRequestV3.codec());
|
276
|
+
};
|
277
|
+
LightPushRequestV3.decode = (buf, opts) => {
|
278
|
+
return decodeMessage(buf, LightPushRequestV3.codec(), opts);
|
279
|
+
};
|
280
|
+
})(LightPushRequestV3 || (LightPushRequestV3 = {}));
|
281
|
+
var LightPushResponseV3;
|
282
|
+
(function (LightPushResponseV3) {
|
283
|
+
let _codec;
|
284
|
+
LightPushResponseV3.codec = () => {
|
285
|
+
if (_codec == null) {
|
286
|
+
_codec = message((obj, w, opts = {}) => {
|
287
|
+
if (opts.lengthDelimited !== false) {
|
288
|
+
w.fork();
|
289
|
+
}
|
290
|
+
if ((obj.requestId != null && obj.requestId !== '')) {
|
291
|
+
w.uint32(10);
|
292
|
+
w.string(obj.requestId);
|
293
|
+
}
|
294
|
+
if ((obj.statusCode != null && obj.statusCode !== 0)) {
|
295
|
+
w.uint32(80);
|
296
|
+
w.uint32(obj.statusCode);
|
297
|
+
}
|
298
|
+
if (obj.statusDesc != null) {
|
299
|
+
w.uint32(90);
|
300
|
+
w.string(obj.statusDesc);
|
301
|
+
}
|
302
|
+
if (obj.relayPeerCount != null) {
|
303
|
+
w.uint32(96);
|
304
|
+
w.uint32(obj.relayPeerCount);
|
305
|
+
}
|
306
|
+
if (opts.lengthDelimited !== false) {
|
307
|
+
w.ldelim();
|
308
|
+
}
|
309
|
+
}, (reader, length, opts = {}) => {
|
310
|
+
const obj = {
|
311
|
+
requestId: '',
|
312
|
+
statusCode: 0
|
313
|
+
};
|
314
|
+
const end = length == null ? reader.len : reader.pos + length;
|
315
|
+
while (reader.pos < end) {
|
316
|
+
const tag = reader.uint32();
|
317
|
+
switch (tag >>> 3) {
|
318
|
+
case 1: {
|
319
|
+
obj.requestId = reader.string();
|
320
|
+
break;
|
321
|
+
}
|
322
|
+
case 10: {
|
323
|
+
obj.statusCode = reader.uint32();
|
324
|
+
break;
|
325
|
+
}
|
326
|
+
case 11: {
|
327
|
+
obj.statusDesc = reader.string();
|
328
|
+
break;
|
329
|
+
}
|
330
|
+
case 12: {
|
331
|
+
obj.relayPeerCount = reader.uint32();
|
332
|
+
break;
|
333
|
+
}
|
334
|
+
default: {
|
335
|
+
reader.skipType(tag & 7);
|
336
|
+
break;
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}
|
340
|
+
return obj;
|
341
|
+
});
|
342
|
+
}
|
343
|
+
return _codec;
|
344
|
+
};
|
345
|
+
LightPushResponseV3.encode = (obj) => {
|
346
|
+
return encodeMessage(obj, LightPushResponseV3.codec());
|
347
|
+
};
|
348
|
+
LightPushResponseV3.decode = (buf, opts) => {
|
349
|
+
return decodeMessage(buf, LightPushResponseV3.codec(), opts);
|
350
|
+
};
|
351
|
+
})(LightPushResponseV3 || (LightPushResponseV3 = {}));
|
193
352
|
var RateLimitProof;
|
194
353
|
(function (RateLimitProof) {
|
195
354
|
let _codec;
|
@@ -388,4 +547,4 @@ var WakuMessage;
|
|
388
547
|
};
|
389
548
|
})(WakuMessage || (WakuMessage = {}));
|
390
549
|
|
391
|
-
export { PushRequest, PushResponse, PushRpc$1 as PushRpc, RateLimitProof, WakuMessage };
|
550
|
+
export { LightPushRequestV3, LightPushResponseV3, PushRequest, PushResponse, PushRpc$1 as PushRpc, RateLimitProof, WakuMessage };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../../interfaces/dist/protocols.js';
|
2
2
|
import '../../interfaces/dist/connection_manager.js';
|
3
|
-
import '../../interfaces/dist/
|
3
|
+
import '../../interfaces/dist/health_status.js';
|
4
4
|
import '../../../node_modules/multiformats/dist/src/bases/base10.js';
|
5
5
|
import '../../../node_modules/multiformats/dist/src/bases/base16.js';
|
6
6
|
import '../../../node_modules/multiformats/dist/src/bases/base2.js';
|
@@ -12,7 +12,7 @@ import '../../../node_modules/multiformats/dist/src/bases/base64.js';
|
|
12
12
|
import '../../../node_modules/multiformats/dist/src/bases/base8.js';
|
13
13
|
import '../../../node_modules/multiformats/dist/src/bases/identity.js';
|
14
14
|
import '../../../node_modules/multiformats/dist/src/codecs/json.js';
|
15
|
-
import { Logger } from '../../utils/dist/logger
|
15
|
+
import { Logger } from '../../utils/dist/logger.js';
|
16
16
|
import { toRLNSignal, RlnMessage } from './message.js';
|
17
17
|
|
18
18
|
const log = new Logger("waku:rln:encoder");
|
@@ -0,0 +1,95 @@
|
|
1
|
+
const PRICE_CALCULATOR_ABI = [
|
2
|
+
{
|
3
|
+
inputs: [
|
4
|
+
{ internalType: "address", name: "_token", type: "address" },
|
5
|
+
{
|
6
|
+
internalType: "uint256",
|
7
|
+
name: "_pricePerMessagePerEpoch",
|
8
|
+
type: "uint256"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
stateMutability: "nonpayable",
|
12
|
+
type: "constructor"
|
13
|
+
},
|
14
|
+
{ inputs: [], name: "OnlyTokensAllowed", type: "error" },
|
15
|
+
{
|
16
|
+
anonymous: false,
|
17
|
+
inputs: [
|
18
|
+
{
|
19
|
+
indexed: true,
|
20
|
+
internalType: "address",
|
21
|
+
name: "previousOwner",
|
22
|
+
type: "address"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
indexed: true,
|
26
|
+
internalType: "address",
|
27
|
+
name: "newOwner",
|
28
|
+
type: "address"
|
29
|
+
}
|
30
|
+
],
|
31
|
+
name: "OwnershipTransferred",
|
32
|
+
type: "event"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
inputs: [{ internalType: "uint32", name: "_rateLimit", type: "uint32" }],
|
36
|
+
name: "calculate",
|
37
|
+
outputs: [
|
38
|
+
{ internalType: "address", name: "", type: "address" },
|
39
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
40
|
+
],
|
41
|
+
stateMutability: "view",
|
42
|
+
type: "function"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
inputs: [],
|
46
|
+
name: "owner",
|
47
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
48
|
+
stateMutability: "view",
|
49
|
+
type: "function"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
inputs: [],
|
53
|
+
name: "pricePerMessagePerEpoch",
|
54
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
55
|
+
stateMutability: "view",
|
56
|
+
type: "function"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
inputs: [],
|
60
|
+
name: "renounceOwnership",
|
61
|
+
outputs: [],
|
62
|
+
stateMutability: "nonpayable",
|
63
|
+
type: "function"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
inputs: [
|
67
|
+
{ internalType: "address", name: "_token", type: "address" },
|
68
|
+
{
|
69
|
+
internalType: "uint256",
|
70
|
+
name: "_pricePerMessagePerEpoch",
|
71
|
+
type: "uint256"
|
72
|
+
}
|
73
|
+
],
|
74
|
+
name: "setTokenAndPrice",
|
75
|
+
outputs: [],
|
76
|
+
stateMutability: "nonpayable",
|
77
|
+
type: "function"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
inputs: [],
|
81
|
+
name: "token",
|
82
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
83
|
+
stateMutability: "view",
|
84
|
+
type: "function"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
88
|
+
name: "transferOwnership",
|
89
|
+
outputs: [],
|
90
|
+
stateMutability: "nonpayable",
|
91
|
+
type: "function"
|
92
|
+
}
|
93
|
+
];
|
94
|
+
|
95
|
+
export { PRICE_CALCULATOR_ABI };
|
@@ -1,10 +1,16 @@
|
|
1
|
-
import {
|
1
|
+
import { PRICE_CALCULATOR_ABI } from './abi/price_calculator.js';
|
2
|
+
import { RLN_ABI } from './abi/rln.js';
|
2
3
|
|
3
|
-
const
|
4
|
+
const RLN_CONTRACT = {
|
4
5
|
chainId: 59141,
|
5
6
|
address: "0xb9cd878c90e49f797b4431fbf4fb333108cb90e6",
|
6
7
|
abi: RLN_ABI
|
7
8
|
};
|
9
|
+
const PRICE_CALCULATOR_CONTRACT = {
|
10
|
+
chainId: 59141,
|
11
|
+
address: "0xBcfC0660Df69f53ab409F32bb18A3fb625fcE644",
|
12
|
+
abi: PRICE_CALCULATOR_ABI
|
13
|
+
};
|
8
14
|
/**
|
9
15
|
* Rate limit tiers (messages per epoch)
|
10
16
|
* Each membership can specify a rate limit within these bounds.
|
@@ -22,6 +28,12 @@ const RATE_LIMIT_PARAMS = {
|
|
22
28
|
MAX_TOTAL_RATE: 160_000, // Maximum total rate limit across all memberships
|
23
29
|
EPOCH_LENGTH: 600 // Epoch length in seconds (10 minutes)
|
24
30
|
};
|
31
|
+
/**
|
32
|
+
* Default Q value for the RLN contract
|
33
|
+
* This is the upper bound for the ID commitment
|
34
|
+
* @see https://github.com/waku-org/specs/blob/master/standards/core/rln-contract.md#implementation-suggestions
|
35
|
+
*/
|
36
|
+
const RLN_Q = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
25
37
|
const DEFAULT_RATE_LIMIT = RATE_LIMIT_PARAMS.MAX_RATE;
|
26
38
|
|
27
|
-
export { DEFAULT_RATE_LIMIT,
|
39
|
+
export { DEFAULT_RATE_LIMIT, PRICE_CALCULATOR_CONTRACT, RATE_LIMIT_PARAMS, RATE_LIMIT_TIERS, RLN_CONTRACT, RLN_Q };
|