Contract Methods

Methods for deploying, reading, writing, and simulating GenLayer intelligent contracts.

getContractCode

Retrieves the source code of a deployed contract.

ParameterTypeRequiredDescription
addressAddressyes

Returns: string


getContractSchema

Gets the schema (methods and constructor) of a deployed contract.

ParameterTypeRequiredDescription
addressAddressyes

Returns: ContractSchema


getContractSchemaForCode

Generates a schema for contract code without deploying it.

ParameterTypeRequiredDescription
contractCodestring | Uint8Arrayyes

Returns: ContractSchema


readContract

Executes a read-only contract call without modifying state.

ParameterTypeRequiredDescription
accountAccountno
addressAddressyes
functionNamestringyes
argsCalldataEncodable[]no
kwargsMap<string, CalldataEncodable> | {[key: string]: CalldataEncodable}no
rawReturnRawReturnno
jsonSafeReturnbooleanno
leaderOnlybooleanno
transactionHashVariantTransactionHashVariantno

Returns: RawReturn extends true ? 0x${string} : CalldataEncodable


simulateWriteContract

Simulates a state-modifying contract call without executing on-chain.

ParameterTypeRequiredDescription
accountAccountno
addressAddressyes
functionNamestringyes
argsCalldataEncodable[]no
kwargsMap<string, CalldataEncodable> | {[key: string]: CalldataEncodable}no
rawReturnRawReturnno
includeReceiptIncludeReceiptno
valueBigNumberishno
leaderOnlybooleanno
feesTransactionFeeOptionsno
transactionHashVariantTransactionHashVariantno

Returns: IncludeReceipt extends true ? SimulateWriteContractResult<RawReturn> : RawReturn extends true ? 0x${string} : CalldataEncodable


writeContract

Executes a state-modifying function on a contract through consensus. Returns the transaction hash.

ParameterTypeRequiredDescription
accountAccountno
addressAddressyes
functionNamestringyes
argsCalldataEncodable[]no
kwargsMap<string, CalldataEncodable> | {[key: string]: CalldataEncodable}no
valuebigintno
leaderOnlybooleanno
consensusMaxRotationsnumberno
validUntilBigNumberishno
feesTransactionFeeOptionsno

Returns: 0x${string}


deployContract

Deploys a new intelligent contract to GenLayer. Returns the transaction hash.

ParameterTypeRequiredDescription
accountAccountno
codestring | Uint8Arrayyes
argsCalldataEncodable[]no
kwargsMap<string, CalldataEncodable> | {[key: string]: CalldataEncodable}no
leaderOnlybooleanno
consensusMaxRotationsnumberno
validUntilBigNumberishno
feesTransactionFeeOptionsno

getCurrentFeePolicy

Returns the active fee price policy used to build user-side caps.

No parameters.

Returns: FeePolicyQuote


estimateFeesDistribution

Builds a fee distribution with caps derived from the active fee policy. Omitted rotations fund the chain's configured consensus maximum.

ParameterTypeRequiredDescription
argsFeeEstimateOptionsno

Returns: FeesDistribution


estimateTransactionFees

Builds a complete transaction fees object, including feeValue. Studio has no on-chain FeeManager in the chain definition, so this uses the same deterministic round-fee math as Studio trusted mode there.

ParameterTypeRequiredDescription
argsFeeEstimateOptionsno

Returns: TransactionFeeEstimate


estimateTransactionFeesFromSimulation

Builds a trusted fee preset from a representative Studio simulation. This turns the returned fee accounting/report into execution and message budgets while preserving mode-2 message allocations when the simulation was run with them.

ParameterTypeRequiredDescription
argsSimulationFeeEstimateOptionsyes

Returns: TransactionFeeEstimate


estimateTransactionFeesForWrite

Builds a trusted fee preset for a concrete write call in one step. The method first gives the simulation a baseline fee budget, then uses the returned Studio/GenVM fee accounting to derive the preset the dapp should pass with the real transaction.

ParameterTypeRequiredDescription
argsWriteFeeEstimateOptionsyes

Returns: TransactionFeeEstimate


getAppealCharge

Returns the full authoritative appeal charge (bond plus appeal funding).

ParameterTypeRequiredDescription
txId0x${string}yes

Returns: bigint


getMinAppealBond

@deprecated Use getAppealCharge. This legacy name also returns bond plus appeal funding.

ParameterTypeRequiredDescription
txId0x${string}yes

Returns: bigint


getRoundNumber

Returns the current consensus round number for a transaction.

ParameterTypeRequiredDescription
txId0x${string}yes

Returns: bigint


getRoundData

Returns detailed data for a specific consensus round.

ParameterTypeRequiredDescription
txId0x${string}yes
roundbigintyes

getLastRoundData

Returns the current round number and its data for a transaction.

ParameterTypeRequiredDescription
txId0x${string}yes

canAppeal

Checks if a transaction can be appealed.

ParameterTypeRequiredDescription
txId0x${string}yes

Returns: boolean


getDeveloperNft

Returns a developer's NFT reward record, or null when no NFT is registered.

ParameterTypeRequiredDescription
developerAddressyes

Returns: DeveloperNft | null


getClaimableRewardsFromFees

Returns claimable developer-NFT rewards accrued from transaction fees.

ParameterTypeRequiredDescription
nftIdBigNumberishyes

Returns: bigint


getClaimableRewardsFromInflation

Returns claimable developer-NFT rewards accrued from inflation.

ParameterTypeRequiredDescription
nftIdBigNumberishyes
numberOfEpochsToClaimBigNumberishyes

Returns: bigint


claimNftRewards

Claims all currently available rewards for a developer NFT. Returns the EVM transaction hash.

ParameterTypeRequiredDescription
accountAccountno
nftIdBigNumberishyes

Returns: 0x${string}


claimNftEpochs

Claims a bounded number of reward epochs for a developer NFT. Returns the EVM transaction hash.

ParameterTypeRequiredDescription
accountAccountno
nftIdBigNumberishyes
numberOfEpochsToClaimBigNumberishyes

Returns: 0x${string}


appealTransaction

Appeals a consensus transaction to trigger a new round of validation. The call is bound to the active decision on both Studio and contract networks. The schedule-extending entry point is safe for both pre-funded and unfunded appeals, while submitAppeal rejects an unfunded next round. When value is omitted, the authoritative appeal charge is used.

ParameterTypeRequiredDescription
accountAccountno
txId0x${string}yes
valuebigintno

topUpFees

Deposits additional fee budget for an existing consensus transaction. Returns the signed EVM envelope hash on every backend.

ParameterTypeRequiredDescription
accountAccountno
txId0x${string}yes
distributionFeesDistributionInputyes
valuebigintyes

Returns: 0x${string}


topUpAndSubmitAppeal

Deposits appeal fee budget and submits an appeal in the same consensus call. Returns the existing GenLayer transaction id, matching appealTransaction. The call is bound to the active decision on both Studio and contract networks. When value is omitted, the authoritative appeal charge is used.

ParameterTypeRequiredDescription
accountAccountno
txId0x${string}yes
distributionFeesDistributionInputyes
valuebigintno

Returns: 0x${string}


finalizeTransaction

Finalizes a single GenLayer transaction that is ready to be finalized. Returns the EVM transaction hash.

ParameterTypeRequiredDescription
accountAccountno
txId0x${string}yes

Returns: 0x${string}


finalizeIdlenessTxs

@deprecated The train separates attempt-bound resolution from decision-bound finalization. Use resolveTransactions or finalizeDecisions after classifying the lifecycle action.

ParameterTypeRequiredDescription
accountAccountno
txIdsreadonly 0x${string}[]yes

Returns: 0x${string}


resolveTransactions

Resolves a batch of attempt-bound lifecycle actions.

ParameterTypeRequiredDescription
accountAccountno
txIdsreadonly 0x${string}[]yes

Returns: 0x${string}


finalizeDecisions

Finalizes a batch of active, decision-bound transactions.

ParameterTypeRequiredDescription
accountAccountno
txIdsreadonly 0x${string}[]yes

Returns: 0x${string}