From 62ab72e6c1c3b8a33879764807e2f73d685010f3 Mon Sep 17 00:00:00 2001 From: John Williams Date: Thu, 12 Sep 2024 13:57:28 -0400 Subject: [PATCH] refactor(explored-types): add the ExplorerSiacoinInput and ExplorerSiafundInput types --- .changeset/wicked-kids-sit.md | 5 +++++ libs/explored-types/src/types.ts | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .changeset/wicked-kids-sit.md diff --git a/.changeset/wicked-kids-sit.md b/.changeset/wicked-kids-sit.md new file mode 100644 index 000000000..edfa15fab --- /dev/null +++ b/.changeset/wicked-kids-sit.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/explored-types': minor +--- + +Added the ExplorerSiacoinInput and ExplorerSiafundInput types. diff --git a/libs/explored-types/src/types.ts b/libs/explored-types/src/types.ts index 8d1ed5579..f05d20801 100644 --- a/libs/explored-types/src/types.ts +++ b/libs/explored-types/src/types.ts @@ -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 @@ -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. @@ -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. */ @@ -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[]