Skip to content

Commit

Permalink
fix: remove hardcoded archive url (#1054)
Browse files Browse the repository at this point in the history
* remvoe harcoded archive url

* remove archive stuff from dockeer-compose

* Add canary specs to fueltankCreated

* add more rules

* fix a tiny issue
  • Loading branch information
justraman authored May 9, 2024
1 parent 98f027e commit f8f0b4a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 62 deletions.
55 changes: 0 additions & 55 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,62 +74,7 @@ services:
- indexer_db
- indexer_redis

archive_db:
container_name: archive_db
image: cockroachdb/cockroach:v22.2.2
restart: unless-stopped
volumes:
- archive_db:/cockroach/cockroach-data
ports:
- "26257:26257"
command: [
"start-single-node",
"--insecure"
]

archive_ingest:
container_name: archive_ingest
image: subsquid/substrate-ingest:firesquid
restart: unless-stopped
depends_on:
- archive_db
command: [
"-e", "wss://archive.matrix.blockchain.enjin.io",
"-c", "40",
"--out", "postgres://root@archive_db:26257/defaultdb"
]

archive_gateway:
container_name: archive_gateway
image: subsquid/substrate-gateway:firesquid
restart: unless-stopped
depends_on:
- archive_db
environment:
DATABASE_MAX_CONNECTIONS: 10
RUST_LOG: "actix_web=info,actix_server=info"
command: [
"--database-url", "postgres://root@archive_db:26257/defaultdb",
"--scan-start-value", "100"
]
ports:
- "8888:8000"

archive_explorer:
container_name: archive_explorer
image: subsquid/substrate-explorer:latest
restart: unless-stopped
environment:
DB_TYPE: cockroach
DB_HOST: archive_db
DB_PORT: "26257"
DB_NAME: "defaultdb"
DB_USER: "root"
ports:
- "4444:3000"

volumes:
indexer_db:
archive_db:
redis_db:

3 changes: 1 addition & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ const config: ProcessorConfig = {
prefix: process.env.CHAIN_PREFIX ? parseInt(process.env.CHAIN_PREFIX, 10) : 1110,
lastBlockHeight: process.env.LAST_BLOCK_HEIGHT ? parseInt(process.env.LAST_BLOCK_HEIGHT, 10) : 0,
genesisHash: process.env.GENESIS_HASH || '0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615',
rpc: process.env.CHAIN_RPC || 'wss://rpc.matrix.blockchain.enjin.io',
dataSource: {
archive: process.env.ARCHIVE_ENDPOINT || 'https://matrixchain.archive.subsquid.io/graphql',
archive: process.env.ARCHIVE_ENDPOINT || 'https://v2.archive.subsquid.io/network/enjin-matrix',
chain: process.env.CHAIN_ENDPOINT || 'wss://archive.matrix.blockchain.enjin.io',
},
redisHost: process.env.REDIS_HOST || 'indexer_redis',
Expand Down
12 changes: 12 additions & 0 deletions src/mappings/fuelTanks/events/fuelTankCreated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ function getCallData(ctx: CommonContext, call: CallItem) {
return calls.fuelTanks.createFuelTank.v602.decode(call)
}

if (calls.fuelTanks.createFuelTank.v601.is(call)) {
return calls.fuelTanks.createFuelTank.v601.decode(call)
}

if (calls.fuelTanks.createFuelTank.v600.is(call)) {
return calls.fuelTanks.createFuelTank.v600.decode(call)
}

if (calls.fuelTanks.createFuelTank.v500.is(call)) {
return calls.fuelTanks.createFuelTank.v500.decode(call)
}

throw new UnknownVersionError(calls.fuelTanks.createFuelTank.name)
}

Expand Down
36 changes: 36 additions & 0 deletions src/mappings/fuelTanks/events/ruleSetInserted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,42 @@ function getCallData(call: CallItem) {
return calls.fuelTanks.insertRuleSet.matrixEnjinV603.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v1005.is(call)) {
return calls.fuelTanks.insertRuleSet.v1005.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v1004.is(call)) {
return calls.fuelTanks.insertRuleSet.v1004.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v1003.is(call)) {
return calls.fuelTanks.insertRuleSet.v1003.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v1000.is(call)) {
return calls.fuelTanks.insertRuleSet.v1000.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v604.is(call)) {
return calls.fuelTanks.insertRuleSet.v604.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v602.is(call)) {
return calls.fuelTanks.insertRuleSet.v602.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v601.is(call)) {
return calls.fuelTanks.insertRuleSet.v601.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v600.is(call)) {
return calls.fuelTanks.insertRuleSet.v600.decode(call)
}

if (calls.fuelTanks.insertRuleSet.v500.is(call)) {
return calls.fuelTanks.insertRuleSet.v500.decode(call)
}

throw new UnknownVersionError(calls.fuelTanks.insertRuleSet.name)
}

Expand Down
2 changes: 1 addition & 1 deletion src/mappings/xcm/events/attempted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
}

if (data.v1003.is(call)) {
callData = data.v1000.decode(call)
callData = data.v1003.decode(call)
}

if (data.v1000.is(call)) {
Expand Down
4 changes: 2 additions & 2 deletions src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import config from './config'
import { events, calls } from './types/generated'

export const processor = new SubstrateBatchProcessor()
.setRpcEndpoint(config.rpc)
.setGateway('https://v2.archive.subsquid.io/network/enjin-matrix')
.setRpcEndpoint(config.dataSource.chain)
.setGateway(config.dataSource.archive)
.setBlockRange({ from: 0 })
.addCall({
name: [calls.identity.setSubs.name, calls.identity.renameSub.name],
Expand Down
3 changes: 1 addition & 2 deletions src/types/custom/processorConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataSource } from "@subsquid/archive-registry"
import { DataSource } from '@subsquid/archive-registry'

type Parameters<T> = T extends (...args: infer T) => any ? T : never

Expand All @@ -13,7 +13,6 @@ export interface ProcessorConfig {
prefix: number | string
lastBlockHeight: number
genesisHash: string
rpc: string
batchSize?: number
redisHost: string
redisDb: number
Expand Down

0 comments on commit f8f0b4a

Please sign in to comment.