Skip to content

Commit ef1fe59

Browse files
committed
fix event type in event handler context
1 parent 9bc5bbc commit ef1fe59

File tree

17 files changed

+750
-290
lines changed

17 files changed

+750
-290
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v0.4.21
2+
- Fix event type in event handler contexts
3+
14
# v0.4.20
25
- Add two new utility functions:
36
- `getClosestTimestamp`

cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from './cli/mod.ts'
1818
import 'https://deno.land/std@0.179.0/dotenv/load.ts'
1919

20-
export const version = 'v0.4.20'
20+
export const version = 'v0.4.21'
2121

2222
const command = new Command()
2323
.name('arkiver')

cli/start/mod.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { colors, mongoose, SchemaComposer } from '../../src/deps.ts'
1212
import { logger } from '../../src/logger.ts'
1313
import { collectRpcUrls } from '../utils.ts'
1414

15-
1615
export const action = async (
1716
options: {
1817
manifest?: string
@@ -133,7 +132,8 @@ export const action = async (
133132
'mongodb://admin:password@localhost:27017'
134133
await mongoose.connect(connectionString, {
135134
dbName: '0-0',
136-
})
135+
// deno-lint-ignore no-explicit-any
136+
} as any)
137137
logger('arkiver').debug(`Connected to database`)
138138

139139
if (!options.gqlOnly) {

deno.lock

+722-268
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/block-handler-vaults/deps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export {
33
createEntity,
44
type EventHandlerFor,
55
Manifest,
6-
} from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
6+
} from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'

examples/block-handler-vaults/handlers/vault.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { formatUnits, getContract } from 'npm:viem'
2-
import { type BlockHandler } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
2+
import { type BlockHandler } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
33
import { VaultSnapshot } from '../entities/vault.ts'
44
import { YEARN_V2_ABI } from '../abis/YearnV2.ts'
55

examples/block-handler-vaults/manifest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
1+
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
22
import { VaultSnapshot } from './entities/vault.ts'
33
import { snapshotVault } from './handlers/vault.ts'
44

examples/erc20-balance-history/entities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createEntity } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
1+
import { createEntity } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
22

33
// @note: "Index: true" enhances graphql queries
44

examples/erc20-balance-history/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { formatUnits, fromHex, numberToHex } from 'npm:viem'
2-
import { type EventHandlerFor } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
2+
import { type EventHandlerFor } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
33
import erc20 from './erc20.ts'
44
import { Balance, BalanceHistory, Transfer } from './entities.ts'
55

examples/erc20-balance-history/manifest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
1+
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
22
import { ERC_20_ABI } from './Erc20.ts'
33
import { Entities } from './entities.ts'
44
import { onTransfer } from './handlers.ts'

examples/erc20-events/entities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createEntity } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
1+
import { createEntity } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
22

33
// @note: "Index: true" enhances graphql queries
44
export const Transfer = createEntity<any>('Transfer', {

examples/erc20-events/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { formatUnits } from 'npm:viem'
2-
import { type EventHandlerFor } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
2+
import { type EventHandlerFor } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
33
import { ERC_20_ABI } from './Erc20.ts'
44
import { Approval, Transfer } from './entities.ts'
55

examples/erc20-events/manifest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
1+
import { Manifest } from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
22
import { ERC_20_ABI } from './Erc20.ts'
33
import { Approval, Transfer } from './entities.ts'
44
import { onApproval, onTransfer } from './handlers.ts'

examples/event-wildcard/deps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export {
33
createEntity,
44
type EventHandlerFor,
55
Manifest,
6-
} from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
6+
} from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'

examples/library/deps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export {
33
createEntity,
44
type EventHandlerFor,
55
Manifest,
6-
} from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
6+
} from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'
77
export {
88
Erc721Lib,
99
type Erc721Opts,
10-
} from 'https://deno.land/x/robo_arkiver@v0.4.20/libs.ts'
10+
} from 'https://deno.land/x/robo_arkiver@v0.4.21/libs.ts'

examples/simple/deps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export {
33
createEntity,
44
type EventHandlerFor,
55
Manifest,
6-
} from 'https://deno.land/x/robo_arkiver@v0.4.20/mod.ts'
6+
} from 'https://deno.land/x/robo_arkiver@v0.4.21/mod.ts'

src/arkiver/types.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,16 @@ export type EventHandlerFor<
105105
TEventName extends ExtractAbiEventNames<TAbi>,
106106
> = EventHandler<ExtractAbiEvent<TAbi, TEventName>, TEventName, TAbi>
107107

108-
type RecursiveNonNullable<T> = T extends Record<string, unknown> ? {
109-
[K in keyof T]-?: RecursiveNonNullable<T[K]>
110-
}
111-
: NonNullable<T>
108+
type RecursiveNonNullable<T> = {
109+
[K in keyof T]-?: RecursiveNonNullable<NonNullable<T[K]>>
110+
}
112111

113-
export type SafeLog<TAbiEvent extends AbiEvent> = RecursiveNonNullable<
114-
Log<bigint, number, TAbiEvent, true, [TAbiEvent]>
112+
export type SafeLog<TAbiEvent extends AbiEvent> = Log<
113+
bigint,
114+
number,
115+
false,
116+
TAbiEvent,
117+
true
115118
>
116119

117120
export type SafeRpcLog = RecursiveNonNullable<RpcLog>

0 commit comments

Comments
 (0)