Skip to content

Add Indexed node chain client #186

@arobsn

Description

@arobsn

Interface

The package must implement the following interface and throw a NotSupportedError for not supported operations:

/**
* 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>;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions