-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reorganize files to avoid circular import
Revert "chore: reorganize files to avoid circular import" This reverts commit 76b7afa. chore: remove wip Reapply "chore: reorganize files to avoid circular import" This reverts commit 22c1fcc.
- Loading branch information
Showing
4 changed files
with
65 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Address, Prisma } from '@prisma/client' | ||
import { TransactionWithAddressAndPrices } from 'services/transactionService' | ||
|
||
export interface BlockchainInfo { | ||
height: number | ||
hash: Uint8Array | string | ||
} | ||
|
||
export interface BlockInfo extends BlockchainInfo { | ||
timestamp: number | ||
} | ||
|
||
export interface GetAddressTransactionsParameters { | ||
addressString: string | ||
start: number | ||
} | ||
|
||
interface InputOutput { | ||
value: Prisma.Decimal | ||
address?: string | ||
} | ||
|
||
export interface TransactionDetails { | ||
hash: string | ||
version: number | ||
inputs: InputOutput[] | ||
outputs: InputOutput[] | ||
block: { | ||
height?: number | ||
hash?: string | ||
timestamp?: string | ||
} | ||
} | ||
|
||
export interface AddressWithTransaction { | ||
address: Address | ||
transaction: Prisma.TransactionUncheckedCreateInput | ||
} | ||
|
||
export interface BlockchainClient { | ||
getBalance: (address: string) => Promise<number> | ||
syncTransactionsForAddress: (addressString: string) => AsyncGenerator<TransactionWithAddressAndPrices[]> | ||
getBlockchainInfo: (networkSlug: string) => Promise<BlockchainInfo> | ||
getBlockInfo: (networkSlug: string, height: number) => Promise<BlockInfo> | ||
getTransactionDetails: (hash: string, networkSlug: string) => Promise<TransactionDetails> | ||
subscribeAddresses: (addresses: Address[]) => Promise<void> | ||
getSubscribedAddresses: () => string[] | ||
} | ||
|
||
export type Networks = 'ecash' | 'bitcoincash' | ||
|
||
export interface NetworkClients{ | ||
ecash?: BlockchainClient | ||
bitcoincash?: BlockchainClient | ||
} | ||
|
||
export interface NodeJsGlobalChronik extends NodeJS.Global { | ||
chronik?: NetworkClients | ||
} |