-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ts
87 lines (82 loc) · 2.83 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
import {
EthereumProject,
EthereumDatasourceKind,
EthereumHandlerKind,
} from "@subql/types-ethereum";
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 !== 'production' ? `.${mode}` : ''}`);
dotenv.config({ path: dotenvPath });
// Can expand the Datasource processor types via the generic param
const project: EthereumProject = {
specVersion: "1.0.0",
version: "0.0.1",
name: "indexer tutorials",
description: "This is a sample implementation of the indexer tutorials",
runner: {
node: {
name: "@subql/node-ethereum",
version: ">=3.0.0",
},
query: {
name: "@subql/query",
version: "*",
},
},
schema: {
file: "./schema.graphql",
},
network: {
/**
* chainId is the EVM Chain ID, for Asset Chain Testnet this is 42421
* https://chainlist.org/chain/42421
*/
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,
},
dataSources: [
{
kind: EthereumDatasourceKind.Runtime,
startBlock: 141381, //The Block Number where your contract was created
options: {
abi: "multitokenlauncher",
// This is the contract address for MultiTokenlauncher
address: "0x6fCc46E73E5B96479F6fA731893534b6Ec6bf5E1",
},
assets: new Map([
["multitokenlauncher", { file: "./abis/multitokenlauncher.abi.json" }],
]),
mapping: {
file: "./dist/index.js",
handlers: [
{
kind: EthereumHandlerKind.Event,
handler: "handleTokenCreated",
filter: {
/**
* Follows standard log filters https://docs.ethers.io/v5/concepts/events/
* address: "0x6fCc46E73E5B96479F6fA731893534b6Ec6bf5E1"
*/
topics: [
"TokenCreated(address indexed tokenAddress, address indexed deployer, string tokenname, string tokensymbol)",
],
},
},
],
},
},
],
repository: "https://github.com/subquery/ethereum-subql-starter", // Replace with your own repository
};
// Must set default to the project instance
export default project;