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:49

Fetches multiple substates by ID in a single request.

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:46

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:37

Fetches a single substate by ID and optional version.

string

number | null

Promise<IndexerGetSubstateResponse>


getTemplateDefinition(templateAddress): Promise<GetTemplateDefinitionResponse>

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

Returns the ABI definition for a published template.

string

Promise<GetTemplateDefinitionResponse>


getTransactionResult(transactionId): Promise<IndexerGetTransactionResultResponse>

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

Polls for the result of a previously submitted transaction.

string

Promise<IndexerGetTransactionResultResponse>


listRecentTransactions(params): Promise<ListRecentTransactionsResponse>

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

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:68

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:58

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

string

Promise<IndexerSubmitTransactionResponse>