|
/** |
|
* Represents a blockchain provider that can interact with the blockchain. |
|
* @template B The type of the box query used by the provider. |
|
*/ |
|
export interface IBlockchainProvider<I> { |
|
/** |
|
* Get boxes. |
|
*/ |
|
getBoxes(query: BoxQuery<BoxWhere>): Promise<ChainProviderBox<I>[]>; |
|
|
|
/** |
|
* Stream boxes. |
|
*/ |
|
streamBoxes(query: BoxQuery<BoxWhere>): AsyncGenerator<ChainProviderBox<I>[]>; |
|
|
|
/** |
|
* Stream unconfirmed transactions |
|
*/ |
|
streamUnconfirmedTransactions( |
|
query: TransactionQuery<UnconfirmedTransactionWhere> |
|
): AsyncGenerator<ChainProviderUnconfirmedTransaction<I>[]>; |
|
|
|
/** |
|
* Get unconfirmed transactions |
|
*/ |
|
getUnconfirmedTransactions( |
|
query: TransactionQuery<UnconfirmedTransactionWhere> |
|
): Promise<ChainProviderUnconfirmedTransaction<I>[]>; |
|
|
|
/** |
|
* Stream confirmed transactions |
|
*/ |
|
streamConfirmedTransactions( |
|
query: TransactionQuery<ConfirmedTransactionWhere> |
|
): AsyncGenerator<ChainProviderConfirmedTransaction<I>[]>; |
|
|
|
/** |
|
* Get confirmed transactions |
|
*/ |
|
getConfirmedTransactions( |
|
query: TransactionQuery<ConfirmedTransactionWhere> |
|
): Promise<ChainProviderConfirmedTransaction<I>[]>; |
|
|
|
/** |
|
* Get headers. |
|
*/ |
|
getHeaders(query: HeaderQuery): Promise<BlockHeader[]>; |
|
|
|
/** |
|
* Check for transaction validity without broadcasting it to the network. |
|
*/ |
|
checkTransaction(transaction: SignedTransaction): Promise<TransactionEvaluationResult>; |
|
|
|
/** |
|
* Broadcast a transaction to the network. |
|
*/ |
|
submitTransaction(transaction: SignedTransaction): Promise<TransactionEvaluationResult>; |
|
|
|
/** |
|
* Evaluate a transaction and return Base16-encoded evaluation result. |
|
*/ |
|
reduceTransaction(transaction: UnsignedTransaction): Promise<TransactionReductionResult>; |
|
} |
Interface
The package must implement the following interface and throw a
NotSupportedErrorfor not supported operations:fleet/packages/blockchain-providers/src/types/blockchainProvider.ts
Lines 127 to 189 in 02bdf05