-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ts
249 lines (244 loc) · 6.29 KB
/
project.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import {
CosmosDatasourceKind,
CosmosHandlerKind,
CosmosProject,
} from "@subql/types-cosmos";
import * as dotenv from 'dotenv';
import path from 'path';
const mode = process.env.NODE_ENV || 'production';
// Load the appropriate .env file
const dotenvPath = path.resolve(__dirname, `.env.${mode}`);
dotenv.config({ path: dotenvPath });
// Can expand the Datasource processor types via the generic param
const project: CosmosProject = {
specVersion: "1.0.0",
version: "0.0.1",
name: "pocketdex",
description:
"Pocketdex is an indexer for the Shannon implementation of the pocket network protocol.",
runner: {
node: {
name: "@subql/node-cosmos",
version: ">=4.0.0",
},
query: {
name: "@subql/query",
version: "*",
},
},
schema: {
file: "./schema.graphql",
},
network: {
/* The unique chainID of the Cosmos Zone */
chainId: process.env.CHAIN_ID!,
/**
* These endpoint(s) should be public non-pruned archive node
* We recommend providing more than one endpoint for improved reliability, performance, and uptime
* Public nodes may be rate limited, which can affect indexing speed
* When developing your project we suggest getting a private API key
* If you use a rate limited endpoint, adjust the --batch-size and --workers parameters
* These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited
*/
endpoint: process.env.ENDPOINT!?.split(',') as string[] | string,
chaintypes: new Map([
[
"cosmos.slashing.v1beta1",
{
file: "./proto/cosmos/slashing/v1beta1/tx.proto",
messages: ["MsgUnjail"],
},
],
[
"cosmos.gov.v1beta1",
{
file: "./proto/cosmos/gov/v1beta1/tx.proto",
messages: ["MsgVoteWeighted"],
},
],
[
"cosmos.gov.v1beta1.gov",
{
file: "./proto/cosmos/gov/v1beta1/gov.proto",
messages: ["WeightedVoteOption"],
},
],
[
"cosmos.base.v1beta1",
{
file: "./proto/cosmos/base/v1beta1/coin.proto",
messages: ["Coin"],
},
],
// --- Application module messages and events
[
"poktroll.application_messages",
{
file: "./proto/poktroll/application/tx.proto",
messages: [
"MsgUpdateParams",
"MsgStakeApplication",
"MsgUnstakeApplication",
"MsgDelegateToGateway",
"MsgUndelegateFromGateway",
],
}
],
[
"poktroll.application_events",
{
file: "./proto/poktroll/application/event.proto",
messages: [
"EventRedelegation"
],
},
],
// --- Gateway module messages
[
"poktroll.gateway",
{
file: "./proto/poktroll/gateway/tx.proto",
messages: [
"MsgUpdateParams",
"MsgStakeGateway",
"MsgUnstakeGateway",
],
},
],
// --- Proof module messages
[
"poktroll.proof",
{
file: "./proto/poktroll/proof/tx.proto",
messages: [
"MsgUpdateParams",
"MsgUpdateParam",
"MsgCreateClaim",
"MsgSubmitProof",
],
},
],
// --- Session module types
[
"poktroll.session",
{
file: "./proto/poktroll/session/session.proto",
messages: [
"SessionHeader",
],
},
],
// // --- Shared module messages
[
"poktroll.shared_messages",
{
file: "./proto/poktroll/shared/tx.proto",
messages: [
"MsgUpdateParams",
"MsgUpdateParam",
],
},
],
// --- Shared module types
[
"poktroll.shared_types",
{
file: "./proto/poktroll/shared/service.proto",
messages: [
"Service",
],
},
],
// --- Supplier module messages
[
"poktroll.supplier",
{
file: "./proto/poktroll/supplier/tx.proto",
messages: [
"MsgUpdateParams",
"MsgStakeSupplier",
"MsgUnstakeSupplier",
],
},
],
// --- Tokenomics module messages
[
"poktroll.tokenomics_messages",
{
file: "./proto/poktroll/tokenomics/tx.proto",
messages: [
"MsgUpdateParams",
"MsgUpdateParam",
],
},
],
// --- Tokenomics module events
[
"poktroll.tokenomics_events",
{
file: "./proto/poktroll/tokenomics/event.proto",
messages: [
"EventClaimSettled",
"EventClaimExpired",
"EventRelayMiningDifficultyUpdated",
],
},
],
]),
},
dataSources: [
{
kind: CosmosDatasourceKind.Runtime,
startBlock: 1,
mapping: {
file: "./dist/index.js",
handlers: [
// --- Primitives
{
handler: "handleBlock",
kind: CosmosHandlerKind.Block,
},
{
handler: "handleTransaction",
kind: CosmosHandlerKind.Transaction,
},
{
handler: "handleMessage",
kind: CosmosHandlerKind.Message,
},
{
handler: "handleEvent",
kind: CosmosHandlerKind.Event,
},
// --- Bank
{
handler: "handleNativeTransfer",
kind: CosmosHandlerKind.Event,
filter: {
type: "transfer",
messageFilter: {
type: "/cosmos.bank.v1beta1.MsgSend"
}
}
},
{
handler: "handleNativeBalanceDecrement",
kind: CosmosHandlerKind.Event,
filter: {
type: "coin_spent",
}
},
{
handler: "handleNativeBalanceIncrement",
kind: CosmosHandlerKind.Event,
filter: {
type: "coin_received",
}
},
],
},
},
],
};
// Must set default to the project instance
export default project;