# Query & Mutation Methods

The OCAP Client interacts with the blockchain through GraphQL. Methods are categorized into two main types:

* **Queries**: These are read-only operations used to fetch data from the blockchain, such as retrieving the state of an account, listing transactions, or getting general chain information. They do not alter the state of the chain.
* **Mutations**: These are write operations that modify the state of the blockchain. Sending a transaction is the primary example of a mutation.

This section provides a complete reference for all available query and mutation methods provided by the client.


## Query Methods

Queries are used to retrieve data from the blockchain. Here is a complete list of all available query methods.

### `getAccountState`

Retrieves the current state of a specific account, including its balance, nonce, and other details.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the account to query."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
  <x-field data-name="traceMigration" data-type="boolean" data-required="false" data-desc="If true, traces the account's migration history."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetAccountState" data-type="object" data-desc="An object containing the response code and the account state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response (e.g., 'OK')."></x-field>
  <x-field data-name="state" data-type="AccountState" data-desc="The detailed state of the account."></x-field>
</x-field>

### `getAssetState`

Retrieves the current state of a specific asset (NFT).

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the asset to query."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetAssetState" data-type="object" data-desc="An object containing the response code and the asset state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="AssetState" data-desc="The detailed state of the asset."></x-field>
</x-field>

### `getFactoryState`

Fetches the state of a specific asset factory.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the factory to query."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetFactoryState" data-type="object" data-desc="An object containing the response code and the factory state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="AssetFactoryState" data-desc="The detailed state of the asset factory."></x-field>
</x-field>

### `getDelegateState`

Retrieves the state of a delegation relationship.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the delegation to query."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetDelegateState" data-type="object" data-desc="An object containing the response code and the delegation state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="DelegateState" data-desc="The detailed state of the delegation."></x-field>
</x-field>

### `getTokenState`

Fetches the state of a specific fungible token.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the token to query."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetTokenState" data-type="object" data-desc="An object containing the response code and the token state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="TokenState" data-desc="The detailed state of the token."></x-field>
</x-field>

### `getEvidenceState`

Retrieves an evidence record by its hash.

**Parameters**

<x-field-group>
  <x-field data-name="hash" data-type="string" data-required="true" data-desc="The hash of the evidence to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetEvidenceState" data-type="object" data-desc="An object containing the response code and the evidence state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="EvidenceState" data-desc="The detailed state of the evidence."></x-field>
</x-field>

### `getForgeState`

Fetches the overall configuration and state of the OCAP blockchain.

**Parameters**

<x-field-group>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetForgeState" data-type="object" data-desc="An object containing the response code and the chain state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="ForgeState" data-desc="The detailed state of the OCAP chain."></x-field>
</x-field>

### `getTokenFactoryState`

Retrieves the state of a specific token factory.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the token factory to query."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetTokenFactoryState" data-type="object" data-desc="An object containing the response code and the token factory state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="TokenFactoryState" data-desc="The detailed state of the token factory."></x-field>
</x-field>

### `getTx`

Fetches a single transaction by its hash.

**Parameters**

<x-field-group>
  <x-field data-name="hash" data-type="string" data-required="true" data-desc="The hash of the transaction to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetTx" data-type="object" data-desc="An object containing the response code and transaction details.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="info" data-type="TransactionInfo" data-desc="The detailed information of the transaction."></x-field>
</x-field>

### `getBlock`

Retrieves a single block by its height.

**Parameters**

<x-field-group>
  <x-field data-name="height" data-type="string" data-required="true" data-desc="The height of the block to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetBlock" data-type="object" data-desc="An object containing the response code and block details.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="block" data-type="BlockInfo" data-desc="The detailed information of the block."></x-field>
</x-field>

### `getBlocks`

Retrieves a list of blocks, with optional filters.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="heightFilter" data-type="RangeFilterInput" data-required="false" data-desc="Filter blocks by a height range."></x-field>
  <x-field data-name="emptyExcluded" data-type="boolean" data-required="false" data-desc="If true, blocks with no transactions are excluded."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetBlocks" data-type="object" data-desc="An object containing pagination info and a list of blocks.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="blocks" data-type="BlockInfoSimple[]" data-desc="An array of simplified block objects."></x-field>
</x-field>

### `getUnconfirmedTxs`

Fetches transactions that are in the mempool but not yet confirmed.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetUnconfirmedTxs" data-type="object" data-desc="An object containing pagination info and a list of unconfirmed transactions.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="unconfirmedTxs" data-type="UnconfirmedTxs" data-desc="Details of unconfirmed transactions."></x-field>
</x-field>

### `getChainInfo`

Retrieves general information about the blockchain.

**Parameters**

This method does not take any parameters.

**Returns**

<x-field data-name="ResponseGetChainInfo" data-type="object" data-desc="An object containing the response code and chain information.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="info" data-type="ChainInfo" data-desc="The detailed information of the chain."></x-field>
</x-field>

### `getConfig`

Fetches the node's configuration.

**Parameters**

<x-field-group>
  <x-field data-name="parsed" data-type="boolean" data-required="false" data-desc="If true, returns the parsed configuration."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetConfig" data-type="object" data-desc="An object containing the response code and the configuration.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="config" data-type="string" data-desc="The node's configuration as a string."></x-field>
</x-field>

### `getNetInfo`

Retrieves network information, including connected peers.

**Parameters**

This method does not take any parameters.

**Returns**

<x-field data-name="ResponseGetNetInfo" data-type="object" data-desc="An object containing the response code and network information.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="netInfo" data-type="NetInfo" data-desc="Detailed network information."></x-field>
</x-field>

### `getNodeInfo`

Retrieves information about the specific node being queried.

**Parameters**

This method does not take any parameters.

**Returns**

<x-field data-name="ResponseGetNodeInfo" data-type="object" data-desc="An object containing the response code and node information.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="info" data-type="NodeInfo" data-desc="Detailed information about the node."></x-field>
</x-field>

### `getValidatorsInfo`

Fetches information about the current set of validators.

**Parameters**

This method does not take any parameters.

**Returns**

<x-field data-name="ResponseGetValidatorsInfo" data-type="object" data-desc="An object containing the response code and validators information.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="validatorsInfo" data-type="ValidatorsInfo" data-desc="Detailed information about the validators."></x-field>
</x-field>

### `getForgeStats`

Retrieves various statistics about the blockchain's activity.

**Parameters**

This method does not take any parameters.

**Returns**

<x-field data-name="ResponseGetForgeStats" data-type="object" data-desc="An object containing the response code and chain statistics.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="forgeStats" data-type="ForgeStats" data-desc="Various statistics about the OCAP chain."></x-field>
</x-field>

### `listAssetTransactions`

Lists all transactions related to a specific asset.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the asset."></x-field>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListAssetTransactions" data-type="object" data-desc="An object containing pagination info and a list of transactions.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="transactions" data-type="IndexedTransaction[]" data-desc="An array of transaction objects."></x-field>
</x-field>

### `listAssets`

Lists all assets, with filters for owner or factory.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="ownerAddress" data-type="string" data-required="false" data-desc="Filter assets by the owner's address."></x-field>
  <x-field data-name="factoryAddress" data-type="string" data-required="false" data-desc="Filter assets by the factory's address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter assets by a time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListAssets" data-type="object" data-desc="An object containing pagination info and a list of assets.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="assets" data-type="IndexedAssetState[]" data-desc="An array of asset state objects."></x-field>
</x-field>

### `listBlocks`

Lists blocks with various filtering options.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="proposer" data-type="string" data-required="false" data-desc="Filter blocks by the proposer's address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter blocks by a time range."></x-field>
  <x-field data-name="heightFilter" data-type="RangeFilterInput" data-required="false" data-desc="Filter blocks by a height range."></x-field>
  <x-field data-name="numTxsFilter" data-type="RangeFilterInput" data-required="false" data-desc="Filter blocks by the number of transactions."></x-field>
  <x-field data-name="numInvalidTxsFilter" data-type="RangeFilterInput" data-required="false" data-desc="Filter blocks by the number of invalid transactions."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListBlocks" data-type="object" data-desc="An object containing pagination info and a list of blocks.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="blocks" data-type="IndexedBlock[]" data-desc="An array of block objects."></x-field>
</x-field>

### `listTopAccounts`

Lists accounts with the highest balance of a specific token.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="The address of the token. If not provided, it defaults to the native token."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter accounts by a time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListTopAccounts" data-type="object" data-desc="An object containing pagination info and a list of top accounts.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="accounts" data-type="IndexedAccountState[]" data-desc="An array of account state objects."></x-field>
</x-field>

### `listTransactions`

A powerful method to list transactions with a wide range of filters.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter transactions by a time range."></x-field>
  <x-field data-name="addressFilter" data-type="AddressFilterInput" data-required="false" data-desc="Filter transactions by sender or receiver address."></x-field>
  <x-field data-name="typeFilter" data-type="TypeFilterInput" data-required="false" data-desc="Filter by transaction type."></x-field>
  <x-field data-name="validityFilter" data-type="ValidityFilterInput" data-required="false" data-desc="Filter by transaction validity."></x-field>
  <x-field data-name="factoryFilter" data-type="FactoryFilterInput" data-required="false" data-desc="Filter by factory address."></x-field>
  <x-field data-name="tokenFilter" data-type="TokenFilterInput" data-required="false" data-desc="Filter by token address."></x-field>
  <x-field data-name="assetFilter" data-type="AssetFilterInput" data-required="false" data-desc="Filter by asset address."></x-field>
  <x-field data-name="accountFilter" data-type="AccountFilterInput" data-required="false" data-desc="Filter by account address."></x-field>
  <x-field data-name="txFilter" data-type="TxFilterInput" data-required="false" data-desc="Filter by transaction hash."></x-field>
  <x-field data-name="rollupFilter" data-type="RollupFilterInput" data-required="false" data-desc="Filter by rollup address."></x-field>
  <x-field data-name="stakeFilter" data-type="StakeFilterInput" data-required="false" data-desc="Filter by stake address."></x-field>
  <x-field data-name="delegationFilter" data-type="DelegationFilterInput" data-required="false" data-desc="Filter by delegation address."></x-field>
  <x-field data-name="tokenFactoryFilter" data-type="TokenFactoryFilterInput" data-required="false" data-desc="Filter by token factory address."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListTransactions" data-type="object" data-desc="An object containing pagination info and a list of transactions.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="transactions" data-type="IndexedTransaction[]" data-desc="An array of transaction objects."></x-field>
</x-field>

### `listTokens`

Lists all fungible tokens on the chain.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="issuerAddress" data-type="string" data-required="false" data-desc="Filter tokens by the issuer's address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter tokens by a time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListTokens" data-type="object" data-desc="An object containing pagination info and a list of tokens.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="tokens" data-type="IndexedTokenState[]" data-desc="An array of token state objects."></x-field>
</x-field>

### `listFactories`

Lists all asset factories on the chain.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="ownerAddress" data-type="string" data-required="false" data-desc="Filter factories by the owner's address."></x-field>
  <x-field data-name="addressList" data-type="string[]" data-required="false" data-desc="A list of factory addresses to query."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter factories by a time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListFactories" data-type="object" data-desc="An object containing pagination info and a list of factories.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="factories" data-type="IndexedFactoryState[]" data-desc="An array of factory state objects."></x-field>
</x-field>

### `getAccountTokens`

Retrieves the token balances for a specific account.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the account."></x-field>
  <x-field data-name="token" data-type="string" data-required="false" data-desc="Specific token address to query."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetAccountTokens" data-type="object" data-desc="An object containing the response code and a list of account tokens.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="tokens" data-type="AccountToken[]" data-desc="An array of token balance objects."></x-field>
</x-field>

### `getStakeState`

Fetches the state of a specific stake.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the stake to query."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetStakeState" data-type="object" data-desc="An object containing the response code and the stake state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="StakeState" data-desc="The detailed state of the stake."></x-field>
</x-field>

### `listStakes`

Lists all stake records, with optional filters.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="addressFilter" data-type="AddressFilterInput" data-required="false" data-desc="Filter stakes by sender or receiver address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter stakes by a time range."></x-field>
  <x-field data-name="assetFilter" data-type="AssetFilterInput" data-required="false" data-desc="Filter stakes by asset address."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListStakes" data-type="object" data-desc="An object containing pagination info and a list of stakes.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="stakes" data-type="IndexedStakeState[]" data-desc="An array of stake state objects."></x-field>
</x-field>

### `getRollupState`

Retrieves the state of a specific rollup.

**Parameters**

<x-field-group>
  <x-field data-name="address" data-type="string" data-required="true" data-desc="The address of the rollup to query."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="Query the state at a specific block height."></x-field>
  <x-field data-name="keys" data-type="string[]" data-required="false" data-desc="Specific fields to retrieve."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetRollupState" data-type="object" data-desc="An object containing the response code and the rollup state.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="state" data-type="RollupState" data-desc="The detailed state of the rollup."></x-field>
</x-field>

### `listRollups`

Lists all rollups on the chain.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="Filter rollups by token address."></x-field>
  <x-field data-name="foreignTokenAddress" data-type="string" data-required="false" data-desc="Filter rollups by foreign token address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter rollups by a time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListRollups" data-type="object" data-desc="An object containing pagination info and a list of rollups.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="rollups" data-type="IndexedRollupState[]" data-desc="An array of rollup state objects."></x-field>
</x-field>

### `getRollupBlock`

Fetches a specific block from a rollup sidechain.

**Parameters**

<x-field-group>
  <x-field data-name="hash" data-type="string" data-required="false" data-desc="The hash of the rollup block."></x-field>
  <x-field data-name="height" data-type="string" data-required="false" data-desc="The height of the rollup block."></x-field>
  <x-field data-name="rollupAddress" data-type="string" data-required="true" data-desc="The address of the rollup."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetRollupBlock" data-type="object" data-desc="An object containing the response code and the rollup block.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="block" data-type="RollupBlock" data-desc="The detailed information of the rollup block."></x-field>
</x-field>

### `listRollupBlocks`

Lists blocks from a rollup sidechain.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="rollupAddress" data-type="string" data-required="true" data-desc="The address of the rollup."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="Filter by token address."></x-field>
  <x-field data-name="proposer" data-type="string" data-required="false" data-desc="Filter by proposer address."></x-field>
  <x-field data-name="validatorFilter" data-type="ValidatorFilterInput" data-required="false" data-desc="Filter by validator."></x-field>
  <x-field data-name="txFilter" data-type="TxFilterInput" data-required="false" data-desc="Filter by transaction hash."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter by time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListRollupBlocks" data-type="object" data-desc="An object containing pagination info and a list of rollup blocks.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="blocks" data-type="IndexedRollupBlock[]" data-desc="An array of rollup block objects."></x-field>
</x-field>

### `listRollupValidators`

Lists the validators for a specific rollup.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="rollupAddress" data-type="string" data-required="true" data-desc="The address of the rollup."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListRollupValidators" data-type="object" data-desc="An object containing pagination info and a list of rollup validators.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="validators" data-type="IndexedRollupValidator[]" data-desc="An array of rollup validator objects."></x-field>
</x-field>

### `listDelegations`

Lists all delegation records.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="from" data-type="string" data-required="false" data-desc="Filter by the delegator's address."></x-field>
  <x-field data-name="to" data-type="string" data-required="false" data-desc="Filter by the delegatee's address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter by time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListDelegations" data-type="object" data-desc="An object containing pagination info and a list of delegations.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="delegations" data-type="IndexedDelegationState[]" data-desc="An array of delegation state objects."></x-field>
</x-field>

### `search`

Performs a keyword search for accounts, assets, or transactions.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="keyword" data-type="string" data-required="true" data-desc="The keyword to search for."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseSearch" data-type="object" data-desc="An object containing pagination info and search results.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="results" data-type="SearchResult[]" data-desc="An array of search result objects."></x-field>
</x-field>

### `estimateGas`

Estimates the gas required for a transaction.

**Parameters**

<x-field-group>
  <x-field data-name="typeUrl" data-type="string" data-required="true" data-desc="The type URL of the transaction."></x-field>
  <x-field data-name="tx" data-type="string" data-required="true" data-desc="The encoded transaction string."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseEstimateGas" data-type="object" data-desc="An object containing the response code and the gas estimate.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="estimate" data-type="GasEstimate" data-desc="The estimated gas."></x-field>
</x-field>

### `listTokenFlows`

Traces the flow of tokens between accounts.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="accountAddress" data-type="string" data-required="true" data-desc="The address of the account to trace."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="The address of the token to trace."></x-field>
  <x-field data-name="depth" data-type="number" data-required="false" data-desc="The depth of the trace."></x-field>
  <x-field data-name="direction" data-type="TokenFlowDirection" data-required="false" data-desc="The direction of the flow (IN or OUT)."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListTokenFlows" data-type="object" data-desc="An object containing pagination info and token flow data.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="data" data-type="IndexedTokenFlow[]" data-desc="An array of token flow objects."></x-field>
</x-field>

### `verifyAccountRisk`

Assesses the risk profile of a given account.

**Parameters**

<x-field-group>
  <x-field data-name="accountAddress" data-type="string" data-required="true" data-desc="The address of the account to verify."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="The address of the token for context."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseVerifyAccountRisk" data-type="object" data-desc="An object containing the response code and the risk verification result.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="data" data-type="VerifyAccountRiskResult" data-desc="The result of the risk verification."></x-field>
</x-field>

### `getTokenDistribution`

Retrieves the distribution statistics for a given token.

**Parameters**

<x-field-group>
  <x-field data-name="tokenAddress" data-type="string" data-required="true" data-desc="The address of the token."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseGetTokenDistribution" data-type="object" data-desc="An object containing the response code and token distribution data.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="data" data-type="TokenDistribution" data-desc="The token distribution statistics."></x-field>
</x-field>

### `listTokenFactories`

Lists all token factories on the chain.

**Parameters**

<x-field-group>
  <x-field data-name="paging" data-type="PageInput" data-required="false" data-desc="Pagination settings."></x-field>
  <x-field data-name="tokenAddress" data-type="string" data-required="false" data-desc="Filter by token address."></x-field>
  <x-field data-name="reserveAddress" data-type="string" data-required="false" data-desc="Filter by reserve token address."></x-field>
  <x-field data-name="owner" data-type="string" data-required="false" data-desc="Filter by owner address."></x-field>
  <x-field data-name="timeFilter" data-type="TimeFilterInput" data-required="false" data-desc="Filter by time range."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseListTokenFactories" data-type="object" data-desc="An object containing pagination info and a list of token factories.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="page" data-type="PageInfo" data-desc="Pagination information."></x-field>
  <x-field data-name="tokenFactories" data-type="IndexedTokenFactoryState[]" data-desc="An array of token factory state objects."></x-field>
</x-field>


## Mutation Methods

Mutations are used to send transactions that modify the state of the blockchain.

### `sendTx`

Broadcasts a pre-signed transaction to the network. This is the fundamental method for all write operations. For creating and signing transactions, see the [High-level API](./api-reference-transaction-helpers.md) and [Transaction Lifecycle](./core-concepts-transaction-lifecycle.md) guides.

**Parameters**

<x-field-group>
  <x-field data-name="tx" data-type="string" data-required="true" data-desc="The encoded transaction string."></x-field>
  <x-field data-name="wallet" data-type="object" data-required="true" data-desc="The wallet object used for signing."></x-field>
  <x-field data-name="token" data-type="string" data-required="false" data-desc="Authentication token, if required."></x-field>
  <x-field data-name="commit" data-type="boolean" data-required="false" data-default="true" data-desc="If true, waits for the transaction to be committed to a block."></x-field>
  <x-field data-name="extra" data-type="string" data-required="false" data-desc="Extra data to be included."></x-field>
</x-field-group>

**Returns**

<x-field data-name="ResponseSendTx" data-type="object" data-desc="An object containing the response code and the transaction hash.">
  <x-field data-name="code" data-type="string" data-desc="The status code of the response."></x-field>
  <x-field data-name="hash" data-type="string" data-desc="The hash of the submitted transaction."></x-field>
</x-field>

**Example**

```javascript icon=logos:javascript
// This example assumes `signedTx` is a properly encoded and signed transaction string.
// See other guides for how to create it.

const signedTx = '...'; 
const wallet = { ... }; // The wallet that signed the transaction

try {
  const { hash } = await client.sendTx({ tx: signedTx, wallet });
  console.log('Transaction sent successfully! Hash:', hash);
} catch (error) {
  console.error('Failed to send transaction:', error);
}
```
