Blockchain Traits

This commit is contained in:
Jim Hamill
2025-04-20 02:22:30 +00:00
parent b097abbd1c
commit 22bff76a55
13 changed files with 302 additions and 189 deletions
+24
View File
@@ -0,0 +1,24 @@
import { type BaseBlockchain } from './base-blockchain.js';
export type BlockchainLockscriptSubscribable<CallbackPayload = undefined> =
Pick<
BaseBlockchain<CallbackPayload>,
'subscribeLockscript' | 'unsubscribeLockscript'
>;
export type BlockchainAddressSubscribable<CallbackPayload = undefined> = Pick<
BaseBlockchain<CallbackPayload>,
'subscribeAddress' | 'unsubscribeAddress'
>;
export type BlockchainTransactionSubscribable<CallbackPayload = undefined> =
Pick<
BaseBlockchain<CallbackPayload>,
'subscribeTransaction' | 'unsubscribeTransaction'
>;
// TODO: We may have a fetchTokenHistory in future, but Fulcrum does not currently support indexing tokens.
// There are actually a few functional discrepancies with the adapters: different adapters grant different capabilities.
// For example, Chaingraph can fetch token and address history. But BCHN P2P network cannot even fetch address history.
// We might want to handle this by having multiple BlockchainInterfaces (e.g. IBlockchainAddressSubscriptions) that describe capabilities.
// But we should return to that later.