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 CircuitValues (or CircuitValue256 if it exceeds 253 bits) and injected into your circuit.
constheader=getHeader(blockNumber)constparentHash:CircuitValue256=header.parentHash()constsha3Uncles:CircuitValue256=header.sha3Uncles()constminer:CircuitValue256=header.miner()conststateRoot:CircuitValue256=header.stateRoot()consttransactionsRoot:CircuitValue256=header.transactionsRoot()constreceiptsRoot:CircuitValue256=header.receiptsRoot()constdifficulty:CircuitValue256=header.difficulty()constblockNumber:CircuitValue256=header.number()constgasLimit:CircuitValue256=header.gasLimit()constgasUsed:CircuitValue256=header.gasUsed()consttimestamp:CircuitValue256=header.timestamp()constextraData:CircuitValue256=header.extraData()constmixHash:CircuitValue256=header.mixHash()constnonce:CircuitValue256=header.nonce()constbaseFeePerGas:CircuitValue256=header.baseFeePerGas()//gets the 32 bytes chunk of logsBloom, idx in [0, 8)constlogsBloom:CircuitValue256=header.logsBloom(bytes32Idx)
See for more details and limitations:
Solidity Nested Mapping Subquery
constmapping: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.*/constval: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.*/constnestedVal:CircuitValue256=mapping.nested([key1, key2, key3])
See for more details and limitations:
Receipt Subquery
constreceipt:Receipt=getReceipt(blockNumber, txIdx);consttxType:CircuitValue256=receipt.txType();constblockNumber:CircuitValue256=receipt.blockNumber();consttxIdx:CircuitValue256=receipt.txIdx();// gets the 32 bytes chunk of logsBloom, idx in [0, 8)constlogsBloom:CircuitValue256=receipt.logsBloom(bytes32Idx)// retrieves a log entry in the receiptconstlog:Log=receipt.log(logIdx)// gets the address from which the event was emitted fromconstaddress:CircuitValue256=log.address()// gets the value of a log topic, with an event given by eventSchemaconsttopic:CircuitValue256=log.topic(topicIdx, eventSchema)// gets a 32 byte chunk of the logs data at the specified offsetconstdata:CircuitValue256=log.data(bytes32Idx)
See for more details and limitations:
Transaction Subquery
consttx:Tx=getTx(blockNumber, txIdx)constchainId:CircuitValue256=tx.chainId();constnonce:CircuitValue256=tx.nonce();constmaxPriorityFeePerGas:CircuitValue256=tx.maxPriorityFeePerGas();constmaxFeePerGas:CircuitValue256=tx.maxFeePerGas();constgasLimit:CircuitValue256=tx.gasLimit();constto:CircuitValue256=tx.to();constvalue:CircuitValue256=tx.value();constdata:CircuitValue256=tx.data();constgasPrice:CircuitValue256=tx.gasPrice();constv:CircuitValue256=tx.v();constr:CircuitValue256=tx.r();consts:CircuitValue256=tx.s();consttype:CircuitValue256=tx.type();constblockNumber:CircuitValue256=tx.blockNumber();consttxIdx:CircuitValue256=tx.txIdx();constfunctionSelector:CircuitValue256=tx.functionSelector();// retrieves a 32 byte chunk of the transaction calldata at a specified offsetconstcalldata:CircuitValue256=tx.calldata(bytes32Idx);// retrieves a 32 byte chunk of the transaction calldata if it was a contract// deployment transactionconstcontractData: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:
Storage Subquery
conststorage:Storage=getStorage(blockNumber, address)// gets the value of the specified slot in the contract's storageconstslotValue:CircuitValue256=storage.slot(slot);