Runtime API
External node components handle most of the logic such as peer discovery, transaction pooling, block and transaction propagations, consensus mechanisms, and RPC requests. In some cases, external components require some data that is provided by the Runtime. Thus, the Runtime API allows the Runtime and external components to communicate easily with each other.
The API definitions below are the Runtime APIs supported on the Bifrost Network.
AccountNonceApi
accountNonce(accountId: AccountId): Index
interface:
api.call.accountNonceApi.accountNonceruntime:
AccountNonceApi_account_noncesummary: The API to query account nonce (aka transaction index).
AuraApi
authorities(): Vec<AuthorityId>
interface:
api.call.auraApi.authoritiesruntime:
AuraApi_authoritiessummary: Returns the current set of authorities.
slotDuration(): SlotDuration
interface:
api.call.auraApi.slotDurationruntime:
AuraApi_slot_durationsummary: Returns the slot duration for Aura.
BlockBuilder
applyExtrinsic(extrinsic: Extrinsic): ApplyExtrinsicResult
interface:
api.call.blockBuilder.applyExtrinsicruntime:
BlockBuilder_apply_extrinsicsummary: Applies the given extrinsic.
checkInherents(block: Block, data: InherentData): CheckInherentsResult
interface:
api.call.blockBuilder.checkInherentsruntime:
BlockBuilder_check_inherentssummary: Checks that the inherents are valid.
finalizeBlock(): Header
interface:
api.call.blockBuilder.finalizeBlockruntime:
BlockBuilder_finalize_blocksummary: Finishes the current block.
inherentExtrinsics(inherent: InherentData): Vec<Extrinsic>
interface:
api.call.blockBuilder.inherentExtrinsicsruntime:
BlockBuilder_inherent_extrinsicssummary: Generates inherent extrinsics.
ConvertTransactionRuntimeApi
convertTransaction(transaction: TransactionV2): Extrinsic
interface:
api.call.convertTransactionRuntimeApi.convertTransactionruntime:
ConvertTransactionRuntimeApi_convert_transactionsummary: Converts an Ethereum-style transaction to Extrinsic
Core
executeBlock(block: Block): Null
interface:
api.call.core.executeBlockruntime:
Core_execute_blocksummary: Executes the given block.
initializeBlock(header: Header): Null
interface:
api.call.core.initializeBlockruntime:
Core_initialize_blocksummary: Initializes a block with the given header.
version(): RuntimeVersion
interface:
api.call.core.versionruntime:
Core_versionsummary: Returns the version of the runtime.
DebugRuntimeApi
traceBlock(extrinsics: Vec<Extrinsic>, knownTransactions: Vec<H256>): Result<(), DispatchError>
interface:
api.call.debugRuntimeApi.traceBlockruntime:
DebugRuntimeApi_trace_blocksummary: Traces all block extrinsics.
traceTransaction(extrinsics: Vec<Extrinsic>, transaction: EthTransaction): Result<(), DispatchError>
interface:
api.call.debugRuntimeApi.traceTransactionruntime:
DebugRuntimeApi_trace_transactionsummary: Traces transaction extrinsics.
EthereumRuntimeRPCApi
accountBasic(address: H160): EvmAccount
interface:
api.call.ethereumRuntimeRPCApi.accountBasicruntime:
EthereumRuntimeRPCApi_account_basicsummary: Returns pallet_evm::Accounts basic information by address.
accountCodeAt(address: H160): Bytes
interface:
api.call.ethereumRuntimeRPCApi.accountCodeAtruntime:
EthereumRuntimeRPCApi_account_code_atsummary: Returns pallet_evm::AccountCodes for a given account address.
author(): H160
interface:
api.call.ethereumRuntimeRPCApi.authorruntime:
EthereumRuntimeRPCApi_authorsummary: Returns the converted FindAuthor::find_author authority id.
call(from: H160, to: H160, data: Vec<u8>, value: U256, gasLimit: U256, maxFeePerGas: Option<U256>, maxPriorityFeePerGas: Option<U256>, nonce: Option<U256>, estimate: bool, accessList: Option<Vec<(H160, Vec<H256>)>>): Result<EvmCallInfo, DispatchError>
interface:
api.call.ethereumRuntimeRPCApi.callruntime:
EthereumRuntimeRPCApi_callsummary: Returns a pallet_ethereum::call response.
chainId(): u64
interface:
api.call.ethereumRuntimeRPCApi.chainIdruntime:
EthereumRuntimeRPCApi_chain_idsummary: Returns runtime defined pallet_evm::ChainId.
create(from: H160, data: Vec<u8>, value: U256, gasLimit: U256, maxFeePerGas: Option<U256>, maxPriorityFeePerGas: Option<U256>, nonce: Option<U256>, estimate: bool, accessList: Option<Vec<(H160, Vec<H256>)>>): Result<EvmCreateInfo, DispatchError>
interface:
api.call.ethereumRuntimeRPCApi.createruntime:
EthereumRuntimeRPCApi_createsummary: Returns a pallet_ethereum::call response.
currentAll(): (Option<BlockV2>, Option<Vec<EthReceiptV3>>, Option<Vec<EthTransactionStatus>>)
interface:
api.call.ethereumRuntimeRPCApi.currentAllruntime:
EthereumRuntimeRPCApi_current_allsummary: Returns all the current data for a block in a single runtime call.
currentBlock(): BlockV2
interface:
api.call.ethereumRuntimeRPCApi.currentBlockruntime:
EthereumRuntimeRPCApi_current_blocksummary: Returns the current block.
currentReceipts(): Option<Vec<EthReceiptV3>>
interface:
api.call.ethereumRuntimeRPCApi.currentReceiptsruntime:
EthereumRuntimeRPCApi_current_receiptssummary: Returns the current receipt.
currentTransactionStatuses(): Option<Vec<EthTransactionStatus>>
interface:
api.call.ethereumRuntimeRPCApi.currentTransactionStatusesruntime:
EthereumRuntimeRPCApi_current_transaction_statusessummary: Returns the current transaction status.
elasticity(): Option<Permill>
interface:
api.call.ethereumRuntimeRPCApi.elasticityruntime:
EthereumRuntimeRPCApi_elasticitysummary: Returns the elasticity multiplier.
extrinsicFilter(xts: Vec<Extrinsic>): Vec<TransactionV2>
interface:
api.call.ethereumRuntimeRPCApi.extrinsicFilterruntime:
EthereumRuntimeRPCApi_extrinsic_filtersummary: Receives a
Vec<OpaqueExtrinsic>and filters all the ethereum transactions.
gasPrice(): u256
interface:
api.call.ethereumRuntimeRPCApi.gasPriceruntime:
EthereumRuntimeRPCApi_gas_pricesummary: Returns FixedGasPrice::min_gas_price
storageAt(address: H160, index: u256): H256
interface:
api.call.ethereumRuntimeRPCApi.storageAtruntime:
EthereumRuntimeRPCApi_storage_atsummary: Returns pallet_evm::AccountStorages for a given account address and index.
GrandpaApi
currentSetId(): SetId
interface:
api.call.grandpaApi.currentSetIdruntime:
GrandpaApi_current_set_idsummary: Gets current GRANDPA authority set id.
generateKeyOwnershipProof(setId: SetId, authorityId: AuthorityId): Option<OpaqueKeyOwnershipProof>
interface:
api.call.grandpaApi.generateKeyOwnershipProofruntime:
GrandpaApi_generate_key_ownership_proofsummary: Generates a proof of key ownership for the given authority in the given set.
grandpaAuthorities(): AuthorityList
interface:
api.call.grandpaApi.grandpaAuthoritiesruntime:
GrandpaApi_grandpa_authoritiessummary: Gets the current GRANDPA authorities and weights. This should not change except when changes are scheduled and the corresponding delay has passed.
submitReportEquivocationUnsignedExtrinsic(equivocationProof: GrandpaEquivocationProof, keyOwnerProof: OpaqueKeyOwnershipProof): Option<Null>
interface:
api.call.grandpaApi.submitReportEquivocationUnsignedExtrinsicruntime:
GrandpaApi_submit_report_equivocation_unsigned_extrinsicsummary: Submits an unsigned extrinsic to report an equivocation.
Metadata
metadata(): OpaqueMetadata
interface:
api.call.metadata.metadataruntime:
Metadata_metadatasummary: Returns the metadata of a runtime.
OffchainWorkerApi
offchainWorker(header: Header): Null
interface:
api.call.offchainWorkerApi.offchainWorkerruntime:
OffchainWorkerApi_offchain_workersummary: Starts the off-chain task for the given block header.
SessionKeys
decodeSessionKeys(encoded: Bytes): Option<Vec<(Bytes, KeyTypeId)>>
interface:
api.call.sessionKeys.decodeSessionKeysruntime:
SessionKeys_decode_session_keyssummary: Decodes the given public session keys.
generateSessionKeys(seed: Option<Bytes>): Bytes
interface:
api.call.sessionKeys.generateSessionKeysruntime:
SessionKeys_generate_session_keyssummary: Generates a set of session keys with optionally using the given seed.
TaggedTransactionQueue
validateTransaction(source: TransactionSource, tx: Extrinsic, blockHash: BlockHash): TransactionValidity
interface:
api.call.taggedTransactionQueue.validateTransactionruntime:
TaggedTransactionQueue_validate_transactionsummary: Validates the transaction.
TransactionPaymentApi
queryFeeDetails(uxt: Extrinsic, len: u32): FeeDetails
interface:
api.call.transactionPaymentApi.queryFeeDetailsruntime:
TransactionPaymentApi_query_fee_detailssummary: The transaction fee details.
queryInfo(uxt: Extrinsic, len: u32): RuntimeDispatchInfo
interface:
api.call.transactionPaymentApi.queryInforuntime:
TransactionPaymentApi_query_infosummary: The transaction info.
Last updated