Starknet Provider

A Dart package for interacting with Starknet node using JSON-RPC, following the Starknet JSON-RPC specification. Package documentation

Transaction support

FeatureStateVersion
invoke0, 1, 3
declare1, 2, 3
deploy_account1, 3

Supported JSON RPC methods

Version: 0.7.1

Read methods

Name of methods have been extracted from starknet-specs with the following command:

jq .methods[].name ../starknet-specs/api/starknet_api_openrpc.json
NameImplemented
starknet_specVersion
starknet_getBlockWithTxHashes
starknet_getBlockWithTxs
starknet_getBlockWithReceipts
starknet_getStateUpdate
starknet_getStorageAt
starknet_getTransactionStatus
starknet_getTransactionByHash
starknet_getTransactionByBlockIdAndIndex
starknet_getTransactionReceipt
starknet_getClass
starknet_getClassHashAt
starknet_getClassAt
starknet_getBlockTransactionCount
starknet_call
starknet_estimateFee
starknet_estimateMessageFee
starknet_blockNumber
starknet_blockHashAndNumber
starknet_chainId
starknet_syncing
starknet_getEvents
starknet_getNonce

Write methods

Name of methods have been extracted from starknet-specs with the following command:

jq .methods[].name ../starknet-specs/api/starknet_write_api.json
NameImplemented
starknet_addInvokeTransaction
starknet_addDeclareTransaction
starknet_addDeployAccountTransaction

Call read-only method

  • starknet_getBlockWithReceipts: Retrieves block information with transaction receipts. Returns BlockWithReceipts with optional fields. Note: Devnet may return null fields for invalid block IDs instead of throwing BLOCK_NOT_FOUND.

starknet_getTransactionStatus

Get the transaction status (whether it was received, rejected, accepted on L2, or accepted on L1).

Future<TransactionStatus> getTransactionStatus(Felt transactionHash);

Example:

final status = await provider.getTransactionStatus(transactionHash);
print('Transaction status: ${status.finalityStatus}');
print('Execution status: ${status.executionStatus}');

The TransactionStatus model includes:

  • finalityStatus: The finality status of the transaction (RECEIVED, REJECTED, ACCEPTED_ON_L2, ACCEPTED_ON_L1)
  • executionStatus: The execution status of the transaction (SUCCEEDED, REVERTED)