Skip to content

refactor(explored-types): modify event type to match explored implementation #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nice-melons-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/explored-types': minor
---

Modifed Event type to match developing explored implementation.
42 changes: 38 additions & 4 deletions libs/explored-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,49 @@ export type AddressBalance = {
unspentSiafunds: number
}

export type Event = {
export type EventPayout = {
siacoinElement: ExplorerSiacoinOutput
}

export type EventV1Transaction = {
transaction: ExplorerTransaction
}

export type EventV1ContractResolution = {
parent: ExplorerFileContract
siacoinElement: ExplorerSiacoinOutput
missed: boolean
}

type ExplorerEventBase = {
id: Hash256
index: ChainIndex
timestamp: string
confirmations: number
maturityHeight: number
addresses: Address[]
data: string
timestamp: string
relevant?: Address[]
}

type ExplorerMinerPayoutEvent = ExplorerEventBase & {
type: 'miner'
data: EventPayout
}

type ExplorerV1TransactionEvent = ExplorerEventBase & {
type: 'v1Transaction'
data: EventV1Transaction
}

type ExplorerV1ContractResolutionEvent = ExplorerEventBase & {
type: 'v1ContractResolution'
data: EventV1ContractResolution
}

export type ExplorerEvent =
| ExplorerMinerPayoutEvent
| ExplorerV1TransactionEvent
| ExplorerV1ContractResolutionEvent

export type BlockMetrics = {
index: ChainIndex
difficulty: string
Expand Down
Loading