Skip to content

Commit

Permalink
refactor(explored-types): add the ExplorerSiacoinInput and ExplorerSi…
Browse files Browse the repository at this point in the history
…afundInput types
  • Loading branch information
telestrial committed Sep 12, 2024
1 parent be553c0 commit 62ab72e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-kids-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/explored-types': minor
---

Added the ExplorerSiacoinInput and ExplorerSiafundInput types.
23 changes: 20 additions & 3 deletions libs/explored-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export type TxpoolTransactions = {
}

// Novel Explored Types - There are three main differences that inform what's below:
// 1. New keys SiacoinOutput and SiafundOutput, which cascades into Transaction and Block.
// 1. New keys ExplorerSiacoinInput/Output and ExplorerSiafundInput/Output, which cascades
// into Transaction and Block.
// 2. The Resolved and Valid keys with a FileContract.
// 3. Payout included with FileContractRevision, where the core type removes payout
// because a revision cannot change this field. This is still true here but included
Expand All @@ -115,6 +116,14 @@ export type TxpoolTransactions = {
*/
type Source = string

/**
* An `ExplorerSiacoinInput` is a core type SiacoinInput with added `address` and `value` keys.
*/
export type ExplorerSiacoinInput = SiacoinInput & {
address: string
value: string
}

/**
* An `ExplorerSiacoinOutput` is a core type `SiacoinElement` with added `source` and
* `spentIndex` keys.
Expand All @@ -124,6 +133,14 @@ export type ExplorerSiacoinOutput = SiacoinElement & {
spentIndex: ChainIndex
}

/**
* An `ExplorerSiafundInput` is a core type SiacoinInput with added `address` and `value` keys.
*/
export type ExplorerSiafundInput = SiafundInput & {
address: string
value: string
}

/**
* An `ExplorerSiafundOutput` is a core type `SiafundElement` with added `spentIndex` keys.
*/
Expand Down Expand Up @@ -154,9 +171,9 @@ export type ExplorerFileContractRevision = ExplorerFileContract & {
*/
export type ExplorerTransaction = {
id: string
siacoinInputs: SiacoinInput[]
siacoinInputs: ExplorerSiacoinInput[]
siacoinOutputs: ExplorerSiacoinOutput[]
siafundInputs: SiafundInput[]
siafundInputs: ExplorerSiafundInput[]
siafundOutputs: ExplorerSiafundOutput[]
fileContracts: ExplorerFileContract[]
fileContractRevisions: ExplorerFileContractRevision[]
Expand Down

0 comments on commit 62ab72e

Please sign in to comment.