# Data Types

This section provides a comprehensive reference for all the custom data structures, input parameters, and response objects used throughout the OCAP Client API. Understanding these types is essential for effectively interacting with the OCAP blockchain.


## Core Types

These are fundamental data structures used across various API calls.

### Any

A generic container for protobuf messages, allowing for flexible data structures.

<x-field-group>
  <x-field data-name="typeUrl" data-type="string" data-desc="A URL-like string that uniquely identifies the type of the serialized message."></x-field>
  <x-field data-name="value" data-type="string" data-desc="The serialized message content as a string."></x-field>
</x-field-group>

### Multisig

Represents a multi-signature, often used in transactions requiring multiple approvals.

<x-field-group>
  <x-field data-name="signer" data-type="string" data-desc="The address of the signer."></x-field>
  <x-field data-name="pk" data-type="string" data-desc="The public key of the signer."></x-field>
  <x-field data-name="signature" data-type="string" data-desc="The signature generated by the signer."></x-field>
  <x-field data-name="delegator" data-type="string" data-desc="The address of the delegator, if the signature is delegated."></x-field>
  <x-field data-name="data" data-type="Any" data-desc="Optional arbitrary data associated with the signature."></x-field>
</x-field-group>

### PageInfo

Contains pagination details for list-based query responses.

<x-field-group>
  <x-field data-name="cursor" data-type="string" data-desc="A cursor for fetching the next page of results."></x-field>
  <x-field data-name="next" data-type="boolean" data-desc="Indicates if there is a next page of results available."></x-field>
  <x-field data-name="total" data-type="number" data-desc="The total number of items matching the query."></x-field>
</x-field-group>

### StateContext

Provides context about the creation and last modification of a state object.

<x-field-group>
  <x-field data-name="genesisTx" data-type="TransactionInfo" data-desc="The transaction that created this state object."></x-field>
  <x-field data-name="renaissanceTx" data-type="TransactionInfo" data-desc="The transaction that last updated this state object."></x-field>
  <x-field data-name="genesisTime" data-type="string" data-desc="The timestamp when the state object was created."></x-field>
  <x-field data-name="renaissanceTime" data-type="string" data-desc="The timestamp when the state object was last updated."></x-field>
</x-field-group>

### Wallet Objects

These types define the structure of wallets used for signing transactions.

#### WalletObject

<x-field-group>
  <x-field data-name="publicKey" data-type="string"></x-field>
  <x-field data-name="secretKey" data-type="string"></x-field>
  <x-field data-name="type" data-type="WalletTypeObject"></x-field>
</x-field-group>

#### WalletTypeObject

<x-field-group>
  <x-field data-name="pk" data-type="number"></x-field>
  <x-field data-name="role" data-type="number"></x-field>
  <x-field data-name="hash" data-type="number"></x-field>
  <x-field data-name="address" data-type="number" data-desc="Defaults to base58btc"></x-field>
</x-field-group>

#### WalletType

<x-field-group>
  <x-field data-name="pk" data-type="KeyType"></x-field>
  <x-field data-name="hash" data-type="HashType"></x-field>
  <x-field data-name="address" data-type="EncodingType"></x-field>
  <x-field data-name="role" data-type="RoleType"></x-field>
</x-field-group>


## Input & Filter Types

These objects are used to provide parameters and filters for GraphQL queries.

### General Filter Inputs

<x-field-group>
  <x-field data-name="AccountFilterInput" data-type="object">
    <x-field data-name="accounts" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="AddressFilterInput" data-type="object">
    <x-field data-name="sender" data-type="string"></x-field>
    <x-field data-name="receiver" data-type="string"></x-field>
    <x-field data-name="direction" data-type="Direction"></x-field>
  </x-field>
  <x-field data-name="AssetFilterInput" data-type="object">
    <x-field data-name="assets" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="DelegationFilterInput" data-type="object">
    <x-field data-name="delegations" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="FactoryFilterInput" data-type="object">
    <x-field data-name="factories" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="RangeFilterInput" data-type="object">
    <x-field data-name="from" data-type="string"></x-field>
    <x-field data-name="to" data-type="string"></x-field>
  </x-field>
  <x-field data-name="RollupFilterInput" data-type="object">
    <x-field data-name="rollups" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="StakeFilterInput" data-type="object">
    <x-field data-name="stakes" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="TimeFilterInput" data-type="object">
    <x-field data-name="startDateTime" data-type="string"></x-field>
    <x-field data-name="endDateTime" data-type="string"></x-field>
    <x-field data-name="field" data-type="string"></x-field>
  </x-field>
  <x-field data-name="TokenFactoryFilterInput" data-type="object">
    <x-field data-name="tokenFactories" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="TokenFilterInput" data-type="object">
    <x-field data-name="tokens" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="TxFilterInput" data-type="object">
    <x-field data-name="txs" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="TypeFilterInput" data-type="object">
    <x-field data-name="types" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="ValidatorFilterInput" data-type="object">
    <x-field data-name="validators" data-type="array<string>"></x-field>
  </x-field>
  <x-field data-name="ValidityFilterInput" data-type="object">
    <x-field data-name="validity" data-type="Validity"></x-field>
  </x-field>
</x-field-group>

### Pagination Inputs

#### PageInput

<x-field-group>
  <x-field data-name="cursor" data-type="string"></x-field>
  <x-field data-name="size" data-type="number"></x-field>
  <x-field data-name="order" data-type="array<PageOrderInput>"></x-field>
</x-field-group>

#### PageOrderInput

<x-field-group>
  <x-field data-name="field" data-type="string"></x-field>
  <x-field data-name="type" data-type="string"></x-field>
</x-field-group>

### Request-Specific Inputs

These objects are used as parameters for specific query and mutation methods.

<x-field-group>
  <x-field data-name="RequestEstimateGasInput" data-type="object">
    <x-field data-name="typeUrl" data-type="string"></x-field>
    <x-field data-name="tx" data-type="string"></x-field>
  </x-field>
  <x-field data-name="RequestGetAccountStateInput" data-type="object">
    <x-field data-name="address" data-type="string"></x-field>
    <x-field data-name="keys" data-type="array<string>"></x-field>
    <x-field data-name="height" data-type="number"></x-field>
    <x-field data-name="traceMigration" data-type="boolean"></x-field>
  </x-field>
  <x-field data-name="RequestGetAccountTokensInput" data-type="object">
    <x-field data-name="address" data-type="string"></x-field>
    <x-field data-name="token" data-type="string"></x-field>
  </x-field>
  <x-field data-name="RequestGetBlockInput" data-type="object">
    <x-field data-name="height" data-type="number"></x-field>
  </x-field>
  <x-field data-name="RequestGetBlocksInput" data-type="object">
    <x-field data-name="paging" data-type="PageInput"></x-field>
    <x-field data-name="heightFilter" data-type="RangeFilterInput"></x-field>
    <x-field data-name="emptyExcluded" data-type="boolean"></x-field>
  </x-field>
  <x-field data-name="RequestListTransactionsInput" data-type="object">
    <x-field data-name="paging" data-type="PageInput"></x-field>
    <x-field data-name="timeFilter" data-type="TimeFilterInput"></x-field>
    <x-field data-name="addressFilter" data-type="AddressFilterInput"></x-field>
    <x-field data-name="typeFilter" data-type="TypeFilterInput"></x-field>
    <x-field data-name="validityFilter" data-type="ValidityFilterInput"></x-field>
    <x-field data-name="factoryFilter" data-type="FactoryFilterInput"></x-field>
    <x-field data-name="tokenFilter" data-type="TokenFilterInput"></x-field>
    <x-field data-name="assetFilter" data-type="AssetFilterInput"></x-field>
    <x-field data-name="accountFilter" data-type="AccountFilterInput"></x-field>
    <x-field data-name="txFilter" data-type="TxFilterInput"></x-field>
    <x-field data-name="rollupFilter" data-type="RollupFilterInput"></x-field>
    <x-field data-name="stakeFilter" data-type="StakeFilterInput"></x-field>
    <x-field data-name="delegationFilter" data-type="DelegationFilterInput"></x-field>
    <x-field data-name="tokenFactoryFilter" data-type="TokenFactoryFilterInput"></x-field>
  </x-field>
</x-field-group>


## State Objects

These types represent the state of various entities on the blockchain, such as accounts, assets, and tokens.

### AccountState

Represents the state of a user account.

<x-field-group>
  <x-field data-name="balance" data-type="string"></x-field>
  <x-field data-name="nonce" data-type="string"></x-field>
  <x-field data-name="numTxs" data-type="string"></x-field>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="pk" data-type="string"></x-field>
  <x-field data-name="type" data-type="WalletType"></x-field>
  <x-field data-name="moniker" data-type="string"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="issuer" data-type="string"></x-field>
  <x-field data-name="gasBalance" data-type="string"></x-field>
  <x-field data-name="migratedTo" data-type="array<string>"></x-field>
  <x-field data-name="migratedFrom" data-type="array<string>"></x-field>
  <x-field data-name="numAssets" data-type="string"></x-field>
  <x-field data-name="tokens" data-type="array<IndexedTokenInput>"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### AssetState

Represents the state of a non-fungible asset (NFT).

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="owner" data-type="string"></x-field>
  <x-field data-name="moniker" data-type="string"></x-field>
  <x-field data-name="readonly" data-type="boolean"></x-field>
  <x-field data-name="transferrable" data-type="boolean"></x-field>
  <x-field data-name="ttl" data-type="number"></x-field>
  <x-field data-name="consumedTime" data-type="string"></x-field>
  <x-field data-name="issuer" data-type="string"></x-field>
  <x-field data-name="parent" data-type="string"></x-field>
  <x-field data-name="endpoint" data-type="NFTEndpoint"></x-field>
  <x-field data-name="display" data-type="NFTDisplay"></x-field>
  <x-field data-name="tags" data-type="array<string>"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### AssetFactoryState

Represents the state of an asset factory, which is used to mint new assets.

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="owner" data-type="string"></x-field>
  <x-field data-name="name" data-type="string"></x-field>
  <x-field data-name="description" data-type="string"></x-field>
  <x-field data-name="settlement" data-type="string"></x-field>
  <x-field data-name="limit" data-type="number"></x-field>
  <x-field data-name="trustedIssuers" data-type="array<string>"></x-field>
  <x-field data-name="input" data-type="IndexedFactoryInput"></x-field>
  <x-field data-name="output" data-type="CreateAssetTx"></x-field>
  <x-field data-name="hooks" data-type="array<AssetFactoryHook>"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="balance" data-type="string"></x-field>
  <x-field data-name="tokens" data-type="array<IndexedTokenInput>"></x-field>
  <x-field data-name="numMinted" data-type="number"></x-field>
  <x-field data-name="display" data-type="NFTDisplay"></x-field>
  <x-field data-name="lastSettlement" data-type="string"></x-field>
</x-field-group>

### DelegateState

Represents the state of a delegation, where one account authorizes another to perform actions on its behalf.

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="ops" data-type="array<DelegateState_OpsEntry>"></x-field>
  <x-field data-name="from" data-type="string"></x-field>
  <x-field data-name="to" data-type="string"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### StakeState

Represents the state of a stake, which can involve tokens or assets.

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="sender" data-type="string"></x-field>
  <x-field data-name="receiver" data-type="string"></x-field>
  <x-field data-name="tokens" data-type="array<IndexedTokenInput>"></x-field>
  <x-field data-name="assets" data-type="array<string>"></x-field>
  <x-field data-name="revocable" data-type="boolean"></x-field>
  <x-field data-name="message" data-type="string"></x-field>
  <x-field data-name="revokeWaitingPeriod" data-type="number"></x-field>
  <x-field data-name="revokedTokens" data-type="array<IndexedTokenInput>"></x-field>
  <x-field data-name="revokedAssets" data-type="array<string>"></x-field>
  <x-field data-name="slashers" data-type="array<string>"></x-field>
  <x-field data-name="nonce" data-type="string"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### TokenState

Represents the state of a fungible token.

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="issuer" data-type="string"></x-field>
  <x-field data-name="name" data-type="string"></x-field>
  <x-field data-name="description" data-type="string"></x-field>
  <x-field data-name="symbol" data-type="string"></x-field>
  <x-field data-name="unit" data-type="string"></x-field>
  <x-field data-name="decimal" data-type="number"></x-field>
  <x-field data-name="icon" data-type="string"></x-field>
  <x-field data-name="totalSupply" data-type="string"></x-field>
  <x-field data-name="initialSupply" data-type="string"></x-field>
  <x-field data-name="maxTotalSupply" data-type="string"></x-field>
  <x-field data-name="foreignToken" data-type="ForeignToken"></x-field>
  <x-field data-name="tokenFactoryAddress" data-type="string"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### TokenFactoryState

Represents the state of a token factory, used for minting and burning tokens.

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="tokenAddress" data-type="string"></x-field>
  <x-field data-name="reserveAddress" data-type="string"></x-field>
  <x-field data-name="currentSupply" data-type="string"></x-field>
  <x-field data-name="reserveBalance" data-type="string"></x-field>
  <x-field data-name="owner" data-type="string"></x-field>
  <x-field data-name="feeRate" data-type="number"></x-field>
  <x-field data-name="curve" data-type="CurveConfig"></x-field>
  <x-field data-name="context" data-type="StateContext"></x-field>
  <x-field data-name="token" data-type="TokenState"></x-field>
  <x-field data-name="reserveToken" data-type="TokenState"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>


## Transaction Payloads (ITX)

These types define the `itx` (inner transaction) object for various transaction types.

### AccountMigrateTx

<x-field-group>
  <x-field data-name="pk" data-type="string"></x-field>
  <x-field data-name="type" data-type="WalletType"></x-field>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### AcquireAssetV2Tx

<x-field-group>
  <x-field data-name="factory" data-type="string"></x-field>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="assets" data-type="array<string>"></x-field>
  <x-field data-name="variables" data-type="array<VariableInput>"></x-field>
  <x-field data-name="issuer" data-type="NFTIssuer"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### CreateAssetTx

<x-field-group>
  <x-field data-name="moniker" data-type="string"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
  <x-field data-name="readonly" data-type="boolean"></x-field>
  <x-field data-name="transferrable" data-type="boolean"></x-field>
  <x-field data-name="ttl" data-type="number"></x-field>
  <x-field data-name="parent" data-type="string"></x-field>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="issuer" data-type="string"></x-field>
  <x-field data-name="endpoint" data-type="NFTEndpoint"></x-field>
  <x-field data-name="display" data-type="NFTDisplay"></x-field>
  <x-field data-name="tags" data-type="array<string>"></x-field>
</x-field-group>

### DelegateTx

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="to" data-type="string"></x-field>
  <x-field data-name="ops" data-type="array<DelegateOp>"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### ExchangeTx

<x-field-group>
  <x-field data-name="to" data-type="string"></x-field>
  <x-field data-name="sender" data-type="ExchangeInfo"></x-field>
  <x-field data-name="receiver" data-type="ExchangeInfo"></x-field>
  <x-field data-name="expiredAt" data-type="string"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### StakeTx

<x-field-group>
  <x-field data-name="address" data-type="string"></x-field>
  <x-field data-name="receiver" data-type="string"></x-field>
  <x-field data-name="inputs" data-type="array<TransactionInput>"></x-field>
  <x-field data-name="locked" data-type="boolean"></x-field>
  <x-field data-name="message" data-type="string"></x-field>
  <x-field data-name="revokeWaitingPeriod" data-type="number"></x-field>
  <x-field data-name="slashers" data-type="array<string>"></x-field>
  <x-field data-name="nonce" data-type="string"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>

### TransferTx

<x-field-group>
  <x-field data-name="to" data-type="string"></x-field>
  <x-field data-name="value" data-type="string"></x-field>
  <x-field data-name="assets" data-type="array<string>"></x-field>
  <x-field data-name="data" data-type="Any"></x-field>
</x-field-group>


## Response Wrappers

These types are the top-level objects returned by API queries, containing a status code and the requested data.

### ResponseGetAccountState

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="state" data-type="AccountState"></x-field>
</x-field-group>

### ResponseGetAssetState

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="state" data-type="AssetState"></x-field>
</x-field-group>

### ResponseGetBlock

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="block" data-type="BlockInfo"></x-field>
</x-field-group>

### ResponseGetChainInfo

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="info" data-type="ChainInfo"></x-field>
</x-field-group>

### ResponseGetTx

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="info" data-type="TransactionInfo"></x-field>
</x-field-group>

### ResponseListTransactions

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="page" data-type="PageInfo"></x-field>
  <x-field data-name="transactions" data-type="array<IndexedTransaction>"></x-field>
</x-field-group>

### ResponseSendTx

<x-field-group>
  <x-field data-name="code" data-type="string"></x-field>
  <x-field data-name="hash" data-type="string"></x-field>
</x-field-group>
