JsonRpcProvider

class JsonRpcProvider(val url: String, httpService: HttpService, ignoreUnknownJsonKeys: Boolean) : Provider

A provider for interacting with Starknet using JSON-RPC. You should reuse it in your application to share the httpService or provide it with your own httpService.

Parameters

url

url of the service providing a rpc interface

httpService

service used for making http requests

Constructors

Link copied to clipboard
constructor(url: String, ignoreUnknownJsonKeys: Boolean)
constructor(url: String, httpService: HttpService)
constructor(url: String)
constructor(url: String, httpService: HttpService, ignoreUnknownJsonKeys: Boolean)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val url: String

Functions

Link copied to clipboard
open override fun callContract(call: Call): Request<List<Felt>>
open override fun callContract(call: Call, blockTag: BlockTag): Request<List<Felt>>
open override fun callContract(call: Call, blockHash: Felt): Request<List<Felt>>
open override fun callContract(call: Call, blockNumber: Int): Request<List<Felt>>

Calls a contract deployed on Starknet.

Link copied to clipboard

Declare contract using version 1 transaction.

Declare contract using version 2 transaction.

Declare contract using version 3 transaction.

Link copied to clipboard

Deploy an account contract using version 1 transaction.

Deploy an account contract using version 3 transaction.

Link copied to clipboard

Get the hash and number of the block.

Link copied to clipboard
open override fun getBlockNumber(): Request<Int>

Get the block number.

Link copied to clipboard
open override fun getBlockTransactionCount(blockTag: BlockTag): Request<Int>
open override fun getBlockTransactionCount(blockHash: Felt): Request<Int>
open override fun getBlockTransactionCount(blockNumber: Int): Request<Int>

Get the block transaction count.

Link copied to clipboard
open override fun getBlockWithReceipts(blockHash: Felt): Request<BlockWithReceipts>
open override fun getBlockWithReceipts(blockNumber: Int): Request<BlockWithReceipts>

Get a block with transaction receipts.

Link copied to clipboard

Get a block with transaction hashes.

Link copied to clipboard
open override fun getBlockWithTxs(blockTag: BlockTag): Request<BlockWithTransactions>
open override fun getBlockWithTxs(blockHash: Felt): Request<BlockWithTransactions>
open override fun getBlockWithTxs(blockNumber: Int): Request<BlockWithTransactions>

Get a block with transactions.

Link copied to clipboard
open override fun getChainId(): Request<StarknetChainId>

Get the chain id.

Link copied to clipboard
open override fun getClass(classHash: Felt): Request<ContractClassBase>
open override fun getClass(classHash: Felt, blockTag: BlockTag): Request<ContractClassBase>
open override fun getClass(classHash: Felt, blockHash: Felt): Request<ContractClassBase>
open override fun getClass(classHash: Felt, blockNumber: Int): Request<ContractClassBase>

Get the contract class definition.

Link copied to clipboard
open override fun getClassAt(contractAddress: Felt): Request<ContractClassBase>
open override fun getClassAt(contractAddress: Felt, blockTag: BlockTag): Request<ContractClassBase>
open override fun getClassAt(contractAddress: Felt, blockHash: Felt): Request<ContractClassBase>
open override fun getClassAt(contractAddress: Felt, blockNumber: Int): Request<ContractClassBase>

Get the contract class definition.

Link copied to clipboard
open override fun getClassHashAt(contractAddress: Felt): Request<Felt>
open override fun getClassHashAt(contractAddress: Felt, blockTag: BlockTag): Request<Felt>
open override fun getClassHashAt(contractAddress: Felt, blockHash: Felt): Request<Felt>
open override fun getClassHashAt(contractAddress: Felt, blockNumber: Int): Request<Felt>

Get the contract class hash.

Link copied to clipboard
open override fun getEstimateFee(payload: List<TransactionPayload>, blockHash: Felt): Request<List<EstimateFeeResponse>>
open override fun getEstimateFee(payload: List<TransactionPayload>, blockNumber: Int): Request<List<EstimateFeeResponse>>
open override fun getEstimateFee(payload: List<TransactionPayload>, blockTag: BlockTag, simulationFlags: Set<SimulationFlagForEstimateFee>): Request<List<EstimateFeeResponse>>
open override fun getEstimateFee(payload: List<TransactionPayload>, blockHash: Felt, simulationFlags: Set<SimulationFlagForEstimateFee>): Request<List<EstimateFeeResponse>>
open override fun getEstimateFee(payload: List<TransactionPayload>, blockNumber: Int, simulationFlags: Set<SimulationFlagForEstimateFee>): Request<List<EstimateFeeResponse>>

Estimate a fee.

Link copied to clipboard
open override fun getEstimateMessageFee(message: MessageL1ToL2, blockHash: Felt): Request<EstimateFeeResponse>
open override fun getEstimateMessageFee(message: MessageL1ToL2, blockNumber: Int): Request<EstimateFeeResponse>

Estimate a message fee.

Link copied to clipboard
open override fun getEvents(payload: GetEventsPayload): Request<GetEventsResult>

Get events

Link copied to clipboard
open override fun getNonce(contractAddress: Felt): Request<Felt>
open override fun getNonce(contractAddress: Felt, blockTag: BlockTag): Request<Felt>
open override fun getNonce(contractAddress: Felt, blockHash: Felt): Request<Felt>
open override fun getNonce(contractAddress: Felt, blockNumber: Int): Request<Felt>

Get a nonce.

Link copied to clipboard
open override fun getSpecVersion(): Request<String>

Get the version of the spec.

Link copied to clipboard
open override fun getStateUpdate(blockTag: BlockTag): Request<StateUpdate>
open override fun getStateUpdate(blockHash: Felt): Request<StateUpdate>
open override fun getStateUpdate(blockNumber: Int): Request<StateUpdate>

Get block state information.

Link copied to clipboard
open override fun getStorageAt(contractAddress: Felt, key: Felt): Request<Felt>
open override fun getStorageAt(contractAddress: Felt, key: Felt, blockTag: BlockTag): Request<Felt>
open override fun getStorageAt(contractAddress: Felt, key: Felt, blockHash: Felt): Request<Felt>
open override fun getStorageAt(contractAddress: Felt, key: Felt, blockNumber: Int): Request<Felt>

Get a value of storage var.

Link copied to clipboard
open override fun getSyncing(): Request<Syncing>

Get the block synchronization status.

Link copied to clipboard
open override fun getTransaction(transactionHash: Felt): Request<Transaction>

Get a transaction.

Link copied to clipboard
open override fun getTransactionByBlockIdAndIndex(blockTag: BlockTag, index: Int): Request<Transaction>
open override fun getTransactionByBlockIdAndIndex(blockHash: Felt, index: Int): Request<Transaction>
open override fun getTransactionByBlockIdAndIndex(blockNumber: Int, index: Int): Request<Transaction>

Get transaction by block id and index.

Link copied to clipboard
open override fun getTransactionReceipt(transactionHash: Felt): Request<out TransactionReceipt>

Get transaction receipt

Link copied to clipboard
open override fun getTransactionStatus(transactionHash: Felt): Request<GetTransactionStatusResponse>

Get transaction status

Link copied to clipboard

Invoke a function using version 1 transaction.

Invoke a function using version 3 transaction.

Link copied to clipboard
open override fun simulateTransactions(transactions: List<TransactionPayload>, blockTag: BlockTag, simulationFlags: Set<SimulationFlag>): Request<List<SimulatedTransaction>>
open override fun simulateTransactions(transactions: List<TransactionPayload>, blockHash: Felt, simulationFlags: Set<SimulationFlag>): Request<List<SimulatedTransaction>>
open override fun simulateTransactions(transactions: List<TransactionPayload>, blockNumber: Int, simulationFlags: Set<SimulationFlag>): Request<List<SimulatedTransaction>>

Simulate executing a list of transactions