Data Functions
Used to add data queries into your AxiomREPL circuits
All data fetching results will return a CircuitValue256
. If an input value is of type string
, number
, or bigint
, it will be treated as a constant (regardless of the input to your circuit, it will need to remain the same). If you pass in a CircuitValue
instead, it will be a variable input to your circuit. All inputs defined in the JSON input panel at the bottom of axiom-repl will be auto-converted to CircuitValue
s (or CircuitValue256
if it exceeds 253 bits) and injected into your circuit.
Account Subquery
const account = getAccount(blockNumber, address)
const nonce: CircuitValue256 = account.nonce()
const balance: CircuitValue256 = account.balance()
const storageRoot: CircuitValue256 = account.storageRoot()
const codeHash: CircuitValue256 = account.codeHash()
See for more details and limitations:
Account SubqueryHeader Subquery
const header = getHeader(blockNumber)
const parentHash: CircuitValue256 = header.parentHash()
const sha3Uncles: CircuitValue256 = header.sha3Uncles()
const miner: CircuitValue256 = header.miner()
const stateRoot: CircuitValue256 = header.stateRoot()
const transactionsRoot: CircuitValue256 = header.transactionsRoot()
const receiptsRoot: CircuitValue256 = header.receiptsRoot()
const difficulty: CircuitValue256 = header.difficulty()
const blockNumber: CircuitValue256 = header.number()
const gasLimit: CircuitValue256 = header.gasLimit()
const gasUsed: CircuitValue256 = header.gasUsed()
const timestamp: CircuitValue256 = header.timestamp()
const extraData: CircuitValue256 = header.extraData()
const mixHash: CircuitValue256 = header.mixHash()
const nonce: CircuitValue256 = header.nonce()
const baseFeePerGas: CircuitValue256 = header.baseFeePerGas()
//gets the 32 bytes chunk of logsBloom, idx in [0, 8)
const logsBloom: CircuitValue256 = header.logsBloom(bytes32Idx)
See for more details and limitations:
Header SubquerySolidity Nested Mapping Subquery
const mapping: Mapping = getSolidityMapping(blockNumber, address, slot)
/**
* Retrieves the value of a specific key in the mapping.
*
* @param key - The key of the mapping. Can be string | number | bigint or
* can be CircuitValue | CircuitValue256
* @returns A `CircuitValue256` representing the value of the key in the mapping.
*/
const val: CircuitValue256 = mapping.key(key)
/**
* Retrieves the value of a specific set of keys in a nested mapping.
*
* @param keys - Each key can be string | number | bigint or
* can be CircuitValue | CircuitValue256
* @returns A `CircuitValue256` representing the value.
*/
const nestedVal: CircuitValue256 = mapping.nested([key1, key2, key3])
See for more details and limitations:
Solidity Nested Mapping SubqueryReceipt Subquery
const receipt: Receipt = getReceipt(blockNumber, txIdx);
const txType: CircuitValue256 = receipt.txType();
const blockNumber: CircuitValue256 = receipt.blockNumber();
const txIdx: CircuitValue256 = receipt.txIdx();
// gets the 32 bytes chunk of logsBloom, idx in [0, 8)
const logsBloom: CircuitValue256 = receipt.logsBloom(bytes32Idx)
// retrieves a log entry in the receipt
const log: Log = receipt.log(logIdx)
// gets the address from which the event was emitted from
const address: CircuitValue256 = log.address()
// gets the value of a log topic, with an event given by eventSchema
const topic: CircuitValue256 = log.topic(topicIdx, eventSchema)
// gets a 32 byte chunk of the logs data at the specified offset
const data: CircuitValue256 = log.data(bytes32Idx)
See for more details and limitations:
Receipt SubqueryTransaction Subquery
const tx: Tx = getTx(blockNumber, txIdx)
const chainId: CircuitValue256 = tx.chainId();
const nonce: CircuitValue256 = tx.nonce();
const maxPriorityFeePerGas: CircuitValue256 = tx.maxPriorityFeePerGas();
const maxFeePerGas: CircuitValue256 = tx.maxFeePerGas();
const gasLimit: CircuitValue256 = tx.gasLimit();
const to: CircuitValue256 = tx.to();
const value: CircuitValue256 = tx.value();
const data: CircuitValue256 = tx.data();
const gasPrice: CircuitValue256 = tx.gasPrice();
const v: CircuitValue256 = tx.v();
const r: CircuitValue256 = tx.r();
const s: CircuitValue256 = tx.s();
const type: CircuitValue256 = tx.type();
const blockNumber: CircuitValue256 = tx.blockNumber();
const txIdx: CircuitValue256 = tx.txIdx();
const functionSelector: CircuitValue256 = tx.functionSelector();
// retrieves a 32 byte chunk of the transaction calldata at a specified offset
const calldata: CircuitValue256 = tx.calldata(bytes32Idx);
// retrieves a 32 byte chunk of the transaction calldata if it was a contract
// deployment transaction
const contractData: CircuitValue256 = tx.contractData(bytes32Idx)
To find a the index of a transaction from its transaction hash, open up the transaction in Etherscan, and then click on more details. The txIdx is labeled "Position in Block":

See for more details and limitations:
Transaction SubqueryStorage Subquery
const storage: Storage = getStorage(blockNumber, address)
// gets the value of the specified slot in the contract's storage
const slotValue: CircuitValue256 = storage.slot(slot);
See for more details and limitations:
Storage SubqueryLast updated