Skip to content

Provider

Defined in: ootle/src/provider.ts:22

A Provider reads chain state and submits transactions. It has no signing capability. The canonical implementation is IndexerProvider, which talks to the indexer REST API.

fetchSubstates(requests): Promise<GetSubstatesResponse>

Defined in: ootle/src/provider.ts:61

Fetches multiple substates by ID.

Implementations may split the IDs across several requests and merge the responses; a failure in a later batch throws after earlier batches have already been fetched.

string[]

Promise<GetSubstatesResponse>


getCurrentEpoch(): Promise<number>

Defined in: ootle/src/provider.ts:34

Returns the epoch the network is currently on.

Every transaction carries a mandatory max_epoch, capped at MAX_TRANSACTION_VALIDITY_EPOCHS past this value, so a builder needs the chain tip before it can be constructed: TransactionBuilder.new(network, await provider.getCurrentEpoch() + 10).

Promise<number>


getStealthUtxo(resourceAddress, commitment): Promise<IndexerGetSubstateResponse | null>

Defined in: ootle/src/provider.ts:52

Fetches a stealth UTXO substate by resource address + 32-byte commitment.

The provider owns the utxo_{resourceHex}_{commitmentHex} id format; callers pass the resource and commitment and never string the id themselves. Returns null when the UTXO does not exist (already spent / never created), instead of throwing.

string

Uint8Array

Promise<IndexerGetSubstateResponse | null>


getSubstate(substateId, version?): Promise<IndexerGetSubstateResponse>

Defined in: ootle/src/provider.ts:43

Fetches a single substate by ID and optional version.

string

number | null

Promise<IndexerGetSubstateResponse>

if the substate does not exist, or the version asked for has been spent. Any other failure, such as a transport error or an indexer that is still syncing, is thrown as the provider’s own error.


getTemplateDefinition(templateAddress): Promise<GetTemplateDefinitionResponse>

Defined in: ootle/src/provider.ts:64

Returns the ABI definition for a published template.

string

Promise<GetTemplateDefinitionResponse>


getTransactionResult(transactionId): Promise<IndexerGetTransactionResultResponse>

Defined in: ootle/src/provider.ts:73

Polls for the result of a previously submitted transaction.

string

Promise<IndexerGetTransactionResultResponse>


listRecentTransactions(params): Promise<ListRecentTransactionsResponse>

Defined in: ootle/src/provider.ts:83

Lists recent transactions.

ListRecentTransactionsRequest

Promise<ListRecentTransactionsResponse>


network(): Network

Defined in: ootle/src/provider.ts:24

Returns the network this provider is connected to.

Network


resolveInputs(inputs): Promise<InputDeclaration[]>

Defined in: ootle/src/provider.ts:80

Resolves unversioned inputs by fetching their current version from the indexer. Returns the same list with version filled in for any entry that had version: null, and is_write preserved.

InputDeclaration[]

Promise<InputDeclaration[]>


submitTransaction(envelope): Promise<IndexerSubmitTransactionResponse>

Defined in: ootle/src/provider.ts:70

Submits a BOR+base64-encoded transaction envelope to the network. Encoding is performed by sealTransaction in transaction.ts.

string

Promise<IndexerSubmitTransactionResponse>