@latticexyz/services 2.0.0-alpha.94 → 2.0.0-main-0d434816
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 +107 -4
- package/bin/faucet +0 -0
- package/bin/{ecs-snapshot → mode} +0 -0
- package/dist/ecs-relay.js +683 -0
- package/dist/ecs-relay.js.map +1 -0
- package/dist/ecs-snapshot.js +810 -0
- package/dist/ecs-snapshot.js.map +1 -0
- package/dist/ecs-stream.js +391 -0
- package/dist/ecs-stream.js.map +1 -0
- package/dist/faucet.js +935 -0
- package/dist/faucet.js.map +1 -0
- package/dist/mode.js +1481 -0
- package/dist/mode.js.map +1 -0
- package/package.json +43 -15
- package/protobuf/go/ecs-relay/ecs-relay.pb.go +1 -1
- package/protobuf/go/ecs-relay/ecs-relay_grpc.pb.go +35 -21
- package/protobuf/go/ecs-snapshot/ecs-snapshot.pb.go +1 -1
- package/protobuf/go/ecs-snapshot/ecs-snapshot_grpc.pb.go +24 -13
- package/protobuf/go/ecs-stream/ecs-stream.pb.go +1 -1
- package/protobuf/go/ecs-stream/ecs-stream_grpc.pb.go +6 -2
- package/protobuf/go/faucet/faucet.pb.go +1 -1
- package/protobuf/go/faucet/faucet_grpc.pb.go +28 -17
- package/protobuf/go/mode/mode.pb.go +227 -228
- package/protobuf/go/mode/mode_grpc.pb.go +50 -43
- package/protobuf/ts/ecs-relay/ecs-relay.ts +1 -1
- package/protobuf/ts/ecs-snapshot/ecs-snapshot.ts +1 -1
- package/protobuf/ts/ecs-stream/ecs-stream.ts +1 -1
- package/protobuf/ts/faucet/faucet.ts +1 -1
- package/protobuf/ts/mode/google/protobuf/any.ts +191 -0
- package/protobuf/ts/mode/mode.ts +73 -76
- package/bin/ecs-relay +0 -0
- package/bin/ecs-stream +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,15 @@ The following services are available for use with MUD V2. For more details on ea
|
|
|
14
14
|
|
|
15
15
|
### 🏃 Quickstart
|
|
16
16
|
|
|
17
|
+
#### Running MODE with Docker Compose
|
|
18
|
+
|
|
19
|
+
(Only tested on MacOS for now.)
|
|
20
|
+
|
|
21
|
+
1. Install Docker for Mac (https://docs.docker.com/docker-for-mac/install/)
|
|
22
|
+
2. Install Docker Compose (https://docs.docker.com/compose/install/)
|
|
23
|
+
3. Run `docker-compose -f docker-compose.mode.yaml up`. This will start services for both MODE and PostgresDB.
|
|
24
|
+
4. By default it will connect to a local anvil node at `localhost:8545`. If you want to connect to a different node, you can change the `rpc.http` and `rpc.ws` fields in the `config.mode-docker.yaml` file.
|
|
25
|
+
|
|
17
26
|
#### Running the MODE service
|
|
18
27
|
|
|
19
28
|
1. Install Go
|
|
@@ -44,7 +53,7 @@ make mode
|
|
|
44
53
|
```yaml
|
|
45
54
|
chains:
|
|
46
55
|
- name: "localhost"
|
|
47
|
-
id: "
|
|
56
|
+
id: "31337"
|
|
48
57
|
rpc:
|
|
49
58
|
http: "http://localhost:8545"
|
|
50
59
|
ws: "ws://localhost:8545"
|
|
@@ -61,7 +70,7 @@ metrics:
|
|
|
61
70
|
port: 6060
|
|
62
71
|
```
|
|
63
72
|
|
|
64
|
-
7. If you're running with the default localhost / `
|
|
73
|
+
7. If you're running with the default localhost / `31337` 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
74
|
8. Run the MODE service
|
|
66
75
|
|
|
67
76
|
```bash
|
|
@@ -80,10 +89,10 @@ make run-mode
|
|
|
80
89
|
brew install grpcurl
|
|
81
90
|
```
|
|
82
91
|
|
|
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 `
|
|
92
|
+
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 `31337`, you can use the `GetState` RPC endpoint:
|
|
84
93
|
|
|
85
94
|
```bash
|
|
86
|
-
grpcurl -plaintext -d '{"chainTables": [], "worldTables": [], "namespace": {"chainId":"
|
|
95
|
+
grpcurl -plaintext -d '{"chainTables": [], "worldTables": [], "namespace": {"chainId":"31337", "worldAddress": "0xff738496c8cd898dC31b670D067162200C5c20A1"}}' localhost:50091 mode.QueryLayer/GetState
|
|
87
96
|
```
|
|
88
97
|
|
|
89
98
|
After the initial setup, to quickly re-build and run the MODE service, you can use
|
|
@@ -92,6 +101,100 @@ After the initial setup, to quickly re-build and run the MODE service, you can u
|
|
|
92
101
|
make mode run-mode
|
|
93
102
|
```
|
|
94
103
|
|
|
104
|
+
#### MODE and MUD
|
|
105
|
+
|
|
106
|
+
Certain parts of MODE depend on MUD, specifically the `storecore` package of MODE which allows us to work with data coming from MUD and perfom encoding/decodings between MUD SchemaTypes, Go types, and Postgres types when the data is store in the DB. If modifications are made to MUD StoreCore, MODE `storecore.go` needs to be re-generated. To do this, perform these steps:
|
|
107
|
+
|
|
108
|
+
1. Get the latest MUD StoreCore abi and save it to a file, e.g. `storecore.json` or `storecore.abi`. It should look something like this
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
"anonymous": false,
|
|
114
|
+
"inputs": [
|
|
115
|
+
{
|
|
116
|
+
"indexed": false,
|
|
117
|
+
"internalType": "bytes32",
|
|
118
|
+
"name": "tableId",
|
|
119
|
+
"type": "bytes32"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"indexed": false,
|
|
123
|
+
"internalType": "bytes32[]",
|
|
124
|
+
"name": "key",
|
|
125
|
+
"type": "bytes32[]"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"name": "StoreDeleteRecord",
|
|
129
|
+
"type": "event"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"anonymous": false,
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"indexed": false,
|
|
136
|
+
"internalType": "bytes32",
|
|
137
|
+
"name": "tableId",
|
|
138
|
+
"type": "bytes32"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"indexed": false,
|
|
142
|
+
"internalType": "bytes32[]",
|
|
143
|
+
"name": "key",
|
|
144
|
+
"type": "bytes32[]"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"indexed": false,
|
|
148
|
+
"internalType": "uint8",
|
|
149
|
+
"name": "schemaIndex",
|
|
150
|
+
"type": "uint8"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"indexed": false,
|
|
154
|
+
"internalType": "bytes",
|
|
155
|
+
"name": "data",
|
|
156
|
+
"type": "bytes"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"name": "StoreSetField",
|
|
160
|
+
"type": "event"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"anonymous": false,
|
|
164
|
+
"inputs": [
|
|
165
|
+
{
|
|
166
|
+
"indexed": false,
|
|
167
|
+
"internalType": "bytes32",
|
|
168
|
+
"name": "tableId",
|
|
169
|
+
"type": "bytes32"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"indexed": false,
|
|
173
|
+
"internalType": "bytes32[]",
|
|
174
|
+
"name": "key",
|
|
175
|
+
"type": "bytes32[]"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"indexed": false,
|
|
179
|
+
"internalType": "bytes",
|
|
180
|
+
"name": "data",
|
|
181
|
+
"type": "bytes"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"name": "StoreSetRecord",
|
|
185
|
+
"type": "event"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
2. Run the following command to generate the MODE `storecore.go` file:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
abigen --abi storecore.abi --pkg storecore --out storecore.go
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
3. Copy the generated `storecore.go` file to the MODE `storecore` package. Alternatively, run the command in the storecore package directory and the file will overwrite the existing one.
|
|
197
|
+
|
|
95
198
|
## V1 Services
|
|
96
199
|
|
|
97
200
|
### [📄 Docs](./README.v1.md)
|
package/bin/faucet
CHANGED
|
Binary file
|
|
Binary file
|