-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ts
170 lines (163 loc) · 4.49 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
import { CosmosDatasourceKind, CosmosHandlerKind, CosmosProject } from '@subql/types-cosmos';
const chainTypesU18 = 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'],
},
],
[
'/agoric.swingset.MsgInstallBundle',
{
file: './proto/agoric/swingset/msgs.proto',
messages: ['MsgInstallBundle'],
},
],
]);
const networkConfig = {
local: {
chainId: 'agoriclocal',
endpoint: ['http://localhost:26657'],
chaintypes: chainTypesU18,
startBlock: 1,
},
docker: {
chainId: 'agoriclocal',
endpoint: ['http://host.docker.internal:26657'],
chaintypes: chainTypesU18,
startBlock: 1,
},
/*
This configuration is specifically for the "ci" profile for the agd container.
The reason for using the "ci" profile is because the URL http://host.docker.internal:26657
is not accessible in CI environments. Therefore, we added the a3p service to the Docker
Compose file and assigned it a "ci" profile to ensure it only runs in CI. In the CI environment,
we then use the address http://agd:26657
*/
ci: {
chainId: 'agoriclocal',
endpoint: ['http://a3p:26657'],
chaintypes: chainTypesU18,
startBlock: 1,
},
main: {
chainId: 'agoric-3',
endpoint: ['https://main-a.rpc.agoric.net:443'],
chaintypes: chainTypesU18,
startBlock: 2115669,
},
};
const networkKey = process.env.AGORIC_NET || 'main';
const startBlock = {
local: 1,
docker: 1,
main: 2115669,
/** Launch of Inter Protocol */
upgrade8: 7179262,
};
const startBlockKey = process.env.SUBQL_START_BLOCK || networkKey;
// Can expand the Datasource processor types via the genreic param
const project: CosmosProject = {
specVersion: '1.0.0',
version: '0.0.1',
name: 'agoric-starter',
description: 'This project can be use as a starting point for developing your Cosmos agoric based SubQuery project',
runner: {
node: {
name: '@subql/node-cosmos',
version: '>=3.0.0',
},
query: {
name: '@subql/query',
version: '*',
},
},
schema: {
file: './schema.graphql',
},
network: networkConfig[networkKey],
dataSources: [
{
kind: CosmosDatasourceKind.Runtime,
// TODO document these
// startBlock: 2115669,
// startBlock: 14347000,
// startBlock: 12306806,
// startBlock: 13017175,
// startBlock: 2115669,
startBlock: startBlock[startBlockKey],
mapping: {
file: './dist/index.js',
handlers: [
// {
// Using block handlers slows your project down as they can be executed with each and every block.
// Only use if you need to
// handler: 'handleEvent',
// kind: CosmosHandlerKind.Block,
// },
// {
// handler: "handleEvent",
// kind: CosmosHandlerKind.Event,
// filter: {
// type: "transfer",
// messageFilter: {
// type: "/cosmos.bank.v1beta1.MsgSend",
// },
// },
// },
// {
// handler: "handleIbcSendPacketEvent",
// kind: CosmosHandlerKind.Event,
// filter: {
// type: "send_packet",
// messageFilter: {
// type: "/ibc.applications.transfer.v1.MsgTransfer",
// },
// },
// },
// {
// handler: "handleIbcReceivePacketEvent",
// kind: CosmosHandlerKind.Event,
// filter: {
// type: "recv_packet",
// messageFilter: {
// type: "/ibc.core.channel.v1.MsgRecvPacket",
// },
// },
// },
{
handler: 'handleStateChangeEvent',
kind: CosmosHandlerKind.Event,
filter: {
type: 'state_change',
},
},
{
handler: 'handleBundleInstallMessage',
kind: CosmosHandlerKind.Message,
filter: {
type: '/agoric.swingset.MsgInstallBundle',
},
},
],
},
},
],
};
// Must set default to the project instance
export default project;