Skip to content

Commit

Permalink
rename formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Haimerl authored and Nikolas Haimerl committed Jan 16, 2025
1 parent cf379aa commit 2eb8f7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions backend/bin/deal-observer-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { ethers } from 'ethers'
import assert from 'node:assert/strict'
import timers from 'node:timers/promises'
import slug from 'slug'
import { RPC_URL, rpcHeaders } from '../lib/config.js'
import { GLIF_RPC, rpcHeaders } from '../lib/config.js'
import '../lib/instrument.js'
import {
observeBuiltinActorEvents
DealObserver
} from '../lib/deal-observer.js'
import { createInflux } from '../lib/telemetry.js'

Expand All @@ -16,9 +16,9 @@ assert(INFLUXDB_TOKEN, 'INFLUXDB_TOKEN required')

const pgPool = await createPgPool()

const fetchRequest = new ethers.FetchRequest(RPC_URL)
const fetchRequest = new ethers.FetchRequest(GLIF_RPC)
fetchRequest.setHeader('Authorization', rpcHeaders.Authorization || '')
const provider = new ethers.JsonRpcProvider(fetchRequest, null, { polling: true })
// const provider = new ethers.JsonRpcProvider(fetchRequest, null, { polling: true })

const { recordTelemetry } = createInflux(INFLUXDB_TOKEN)

Expand Down Expand Up @@ -48,7 +48,7 @@ const loop = async (name, fn, interval) => {
await Promise.all([
loop(
'Built-in actor events',
() => observeBuiltinActorEvents(pgPool, provider),
() => new DealObserver(pgPool),
30_000
)
])
4 changes: 2 additions & 2 deletions backend/lib/rpc-service/ipld-schema.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { create } from '@ipld/schema/typed.js'
import { schemaDmt } from './builtin-actor-events-schemas.js'

class IpldSchema {
class IpldSchemaValidator {
// A transformer which takes in a json object and returns a typed ClaimEvent object
#claimEventSchema
#rawActorEventSchema
Expand Down Expand Up @@ -33,5 +33,5 @@ class IpldSchema {
}

export {
IpldSchema
IpldSchemaValidator
}
4 changes: 2 additions & 2 deletions backend/lib/rpc-service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { base64pad } from 'multiformats/bases/base64'
import { encode as cborEncode } from '@ipld/dag-cbor'
import { decode as jsonDecode } from '@ipld/dag-json'
import { request } from 'undici'
import { IpldSchema } from './ipld-schema.js'
import { IpldSchemaValidator } from './ipld-schema.js'
import { rawEventEntriesToEvent } from './utils.js'

const makeRpcRequest = async (method, params) => {
Expand All @@ -30,7 +30,7 @@ class LotusService {
}

async build () {
this.#ipldSchema = await (new IpldSchema()).build()
this.#ipldSchema = await (new IpldSchemaValidator()).build()
return this
}

Expand Down
4 changes: 2 additions & 2 deletions backend/test/observer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { after, before, beforeEach, describe, it } from 'node:test'
import { createPgPool, migrateWithPgClient } from '@filecoin-station/deal-observer-db'
import { IpldSchema } from '../lib/rpc-service/ipld-schema.js'
import { IpldSchemaValidator } from '../lib/rpc-service/ipld-schema.js'
import assert from 'assert'
import { claimTestEvent } from './test_data/claimEvent.js'
import { ActorEventFilter, LotusService } from '../lib/rpc-service/service.js'
Expand Down Expand Up @@ -38,7 +38,7 @@ describe('deal-observer-backend', () => {
claimEvent = parseCIDs(claimTestEvent)
})
it('transforms a claim event payload to a typed object', async () => {
const ipldSchema = await (new IpldSchema().build())
const ipldSchema = await (new IpldSchemaValidator().build())
const typedClaimEvent = ipldSchema.applyType('ClaimEvent', claimEvent)
assert(typedClaimEvent !== undefined, 'typedClaimEvent is undefined')
assert.deepStrictEqual(typedClaimEvent, claimTestEvent)
Expand Down

0 comments on commit 2eb8f7a

Please sign in to comment.