@latticexyz/services 2.0.0-alpha.93 → 2.0.0-foundry-js-c7b0289b

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/README.md CHANGED
@@ -1,138 +1 @@
1
- # Services
2
-
3
- This package contains MUD services -- complimentary software components for enhanced interactions with on-chain state when building with MUD. Services work out-of-the-box with any project built with MUD.
4
-
5
- ## V2 Services
6
-
7
- ### [📄 Docs](#)
8
-
9
- The following services are available for use with MUD V2. For more details on each service, see the linked docs page.
10
-
11
- | Service | Description | Proto / Spec | Default Port |
12
- | ------- | :------------------------------------------------------------------------------------ | :------------------------------- | -----------: |
13
- | mode | A node for MUD. PostgresDB-based indexer of MUD V2 events across chains + MUD worlds. | [mode.proto](./proto/mode.proto) | 50091 |
14
-
15
- ### 🏃 Quickstart
16
-
17
- #### Running the MODE service
18
-
19
- 1. Install Go
20
- 2. Install Postgres
21
- 3. Deside which database you want to use, e.g. `mode` and create the database
22
- 4. Set up logical replication on the database of your choice, e.g. `mode`. Logical replication is used to enable fast MUD state change streaming using the WAL (Write-Ahead Log) of the database. For more infromation on logical replication, see the [Postgres documentation](https://www.postgresql.org/docs/current/logical-replication.html). For this you need to
23
- 1. Modify the DB config to use logical replication. This is done by adding the following to the `postgresql.conf` file:
24
- ```
25
- wal_level = logical
26
- max_replication_slots = 1
27
- max_wal_senders = 1
28
- ```
29
- alternatively you can use the following SQL commands:
30
- ```sql
31
- ALTER SYSTEM SET wal_level = logical;
32
- ALTER SYSTEM SET max_replication_slots = 1;
33
- ALTER SYSTEM SET max_wal_senders = 1;
34
- ```
35
- 2. Restart the DB
36
- 5. Build the source. This will build the MODE service
37
-
38
- ```bash
39
- make mode
40
- ```
41
-
42
- 6. Modify `config.mode.yaml` MODE config file to match your preferences. MODE can be configured either with a config file or via command line arguments (both will do the same thing). In this step you should probably change the `dsn` section to match your database name created in step (3): this is what MODE uses to connect to Postgres. Additionally change the `chains` section in case you'd like to connect and have MODE index a different chain other than a local node. You can also change the `port`s to match your preferences. Example config file:
43
-
44
- ```yaml
45
- chains:
46
- - name: "localhost"
47
- id: "371337"
48
- rpc:
49
- http: "http://localhost:8545"
50
- ws: "ws://localhost:8545"
51
- db:
52
- dsn: "postgresql://localhost:5432/mode_ephemeral?sslmode=disable&replication=database"
53
- wipe: false
54
- sync:
55
- enabled: true
56
- startBlock: 0
57
- blockBatchCount: 10000
58
- ql:
59
- port: 50091
60
- metrics:
61
- port: 6060
62
- ```
63
-
64
- 7. If you're running with the default localhost / `371337` chain, make sure there is a local node running for the chain you want to connect to. For example, a hardhat node or an anvil node.
65
- 8. Run the MODE service
66
-
67
- ```bash
68
- ./bin/mode -config config.mode.yaml
69
- ```
70
-
71
- or
72
-
73
- ```bash
74
- make run-mode
75
- ```
76
-
77
- 9. Optionally, install `grpcurl` to interact with the MODE service API from the command line. For example, on MacOS you can use `brew` to install `grpcurl`:
78
-
79
- ```bash
80
- brew install grpcurl
81
- ```
82
-
83
- 10. MODE exposes a `QueryLayer` gRPC server on port `50091` by default. You can use a gRPC client to interact with the service API. For example, to query for the current state of an indexed MUD world deployed at address `0xff738496c8cd898dC31b670D067162200C5c20A1` and on local chain with ID `371337`, you can use the `GetState` RPC endpoint:
84
-
85
- ```bash
86
- grpcurl -plaintext -d '{"chainTables": [], "worldTables": [], "namespace": {"chainId":"371337", "worldAddress": "0xff738496c8cd898dC31b670D067162200C5c20A1"}}' localhost:50091 mode.QueryLayer/GetState
87
- ```
88
-
89
- After the initial setup, to quickly re-build and run the MODE service, you can use
90
-
91
- ```bash
92
- make mode run-mode
93
- ```
94
-
95
- ## V1 Services
96
-
97
- ### [📄 Docs](./README.v1.md)
98
-
99
- The following services are available for use with MUD V1. For more details on each service, see the linked docs page.
100
-
101
- | Service | Description | Proto / Spec | Default Port |
102
- | ------------ | :--------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- | -----------: |
103
- | ecs-snapshot | Indexer reducing ECS events into a single "current" state for fast snapshot client syncs | [ecs-snapshot.proto](./proto/ecs-snapshot.proto) | 50061 |
104
- | ecs-stream | Multiplexer for subscriptions to receive current block data, ECS events per block, and transaction origination data | [ecs-stream.proto](./proto/ecs-stream.proto) | 50051 |
105
- | ecs-relay | Generic message relayer, supporting signed messages, service-side signature verification, relay conditions for DDoS prevention, and more | [ecs-relay.proto](./proto/ecs-relay.proto) | 50071 |
106
- | faucet | Faucet supporting custom drip amounts, global limits, twitter verification, and integrations with MUD components | [faucet.proto](./proto/faucet.proto) | 50081 |
107
-
108
- ### 🏃 Quickstart
109
-
110
- #### Running the ECS Snapshot, Stream, Relay, and Faucet services
111
-
112
- 1. Install Go
113
- 2. Build the source. This will build all the services
114
-
115
- ```bash
116
- make build
117
- ```
118
-
119
- or to build only specific services
120
-
121
- ```bash
122
- make ecs-snapshot ecs-stream ecs-relay faucet
123
- ```
124
-
125
- 3. If you're running with the default chain, make sure there is a local node running for the chain you want to connect to. For example, a hardhat node or an anvil node.
126
- 4. Run whichever binary via [`Makefile`](./Makefile). For example, to run the snapshot service
127
-
128
- ```bash
129
- make run-ecs-snapshot
130
- ```
131
-
132
- ## Protobuf
133
-
134
- MUD services use [Protocol Buffers](https://developers.google.com/protocol-buffers) to define the data structures and message schemas. The `.proto` files are available in the `/proto` directory at the root of this repo. For more details about `.proto` files and a language guide, see the [Language Guide (proto3)](https://developers.google.com/protocol-buffers/docs/proto3). The package has the protobuf files checked in, but in case you want to regenerate those (based on an updated `.proto` file for instance), run
135
-
136
- ```bash
137
- make protoc
138
- ```
1
+ # DEPRECATED