Skip to main content

Class: IotaClient

Constructors

Constructor

new IotaClient(options): IotaClient;

Establish a connection to an IOTA RPC endpoint

Parameters

ParameterTypeDescription
optionsNetworkOrTransportconfiguration options for the API Client

Returns

IotaClient

Properties

PropertyModifierType
transportprotectedIotaTransport

Methods

getRpcApiVersion()

getRpcApiVersion(__namedParameters?): Promise<string | undefined>;

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<string | undefined>


getCoins()

getCoins(input): Promise<PaginatedCoins>;

Get all Coin<coin_type> objects owned by an address.

Parameters

ParameterType
inputGetCoinsParams

Returns

Promise<PaginatedCoins>


getAllCoins()

getAllCoins(input): Promise<PaginatedCoins>;

Get all Coin objects owned by an address.

Parameters

ParameterType
inputGetAllCoinsParams

Returns

Promise<PaginatedCoins>


getBalance()

getBalance(input): Promise<CoinBalance>;

Get the total coin balance for one coin type, owned by the address owner.

Parameters

ParameterType
inputGetBalanceParams

Returns

Promise<CoinBalance>


getAllBalances()

getAllBalances(input): Promise<CoinBalance[]>;

Get the total coin balance for all coin types, owned by the address owner.

Parameters

ParameterType
inputGetAllBalancesParams

Returns

Promise<CoinBalance[]>


getCoinMetadata()

getCoinMetadata(input): Promise<CoinMetadata | null>;

Fetch CoinMetadata for a given coin type

Parameters

ParameterType
inputGetCoinMetadataParams

Returns

Promise<CoinMetadata | null>


getTotalSupply()

getTotalSupply(input): Promise<CoinSupply>;

Fetch total supply for a coin

Parameters

ParameterType
inputGetTotalSupplyParams

Returns

Promise<CoinSupply>


getCirculatingSupply()

getCirculatingSupply(__namedParameters?): Promise<IotaCirculatingSupply>;

Fetch circulating supply for a coin

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<IotaCirculatingSupply>


call()

call<T>(
method,
params,
args?): Promise<T>;

Invoke any RPC method

Type Parameters

Type ParameterDefault type
Tunknown

Parameters

ParameterTypeDescription
methodstringthe method to be invoked
paramsunknown[]-
args{ signal?: AbortSignal; }the arguments to be passed to the RPC request
args.signal?AbortSignal-

Returns

Promise<T>


getMoveFunctionArgTypes()

getMoveFunctionArgTypes(input): Promise<IotaMoveFunctionArgType[]>;

Get Move function argument types like read, write and full access

Parameters

ParameterType
inputGetMoveFunctionArgTypesParams

Returns

Promise<IotaMoveFunctionArgType[]>


getNormalizedMoveModulesByPackage()

getNormalizedMoveModulesByPackage(input): Promise<IotaMoveNormalizedModules>;

Get a map from module name to structured representations of Move modules

Parameters

ParameterType
inputGetNormalizedMoveModulesByPackageParams

Returns

Promise<IotaMoveNormalizedModules>


getNormalizedMoveModule()

getNormalizedMoveModule(input): Promise<IotaMoveNormalizedModule>;

Get a structured representation of Move module

Parameters

ParameterType
inputGetNormalizedMoveModuleParams

Returns

Promise<IotaMoveNormalizedModule>


getNormalizedMoveFunction()

getNormalizedMoveFunction(input): Promise<IotaMoveNormalizedFunction>;

Get a structured representation of Move function

Parameters

ParameterType
inputGetNormalizedMoveFunctionParams

Returns

Promise<IotaMoveNormalizedFunction>


getNormalizedMoveStruct()

getNormalizedMoveStruct(input): Promise<IotaMoveNormalizedStruct>;

Get a structured representation of Move struct

Parameters

ParameterType
inputGetNormalizedMoveStructParams

Returns

Promise<IotaMoveNormalizedStruct>


getOwnedObjects()

getOwnedObjects(input): Promise<PaginatedObjectsResponse>;

Get all objects owned by an address

Parameters

ParameterType
inputGetOwnedObjectsParams

Returns

Promise<PaginatedObjectsResponse>


getObject()

getObject(input): Promise<IotaObjectResponse>;

Get details about an object

Parameters

ParameterType
inputGetObjectParams

Returns

Promise<IotaObjectResponse>


tryGetPastObject()

tryGetPastObject(input): Promise<ObjectRead>;

Parameters

ParameterType
inputTryGetPastObjectParams

Returns

Promise<ObjectRead>


multiGetObjects()

multiGetObjects(input): Promise<IotaObjectResponse[]>;

Batch get details about a list of objects. If any of the object ids are duplicates the call will fail

Parameters

ParameterType
inputMultiGetObjectsParams

Returns

Promise<IotaObjectResponse[]>


queryTransactionBlocks()

queryTransactionBlocks(input): Promise<PaginatedTransactionResponse>;

Get transaction blocks for a given query criteria

Parameters

ParameterType
inputQueryTransactionBlocksParams

Returns

Promise<PaginatedTransactionResponse>


getTransactionBlock()

getTransactionBlock(input): Promise<IotaTransactionBlockResponse>;

Parameters

ParameterType
inputGetTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>


multiGetTransactionBlocks()

multiGetTransactionBlocks(input): Promise<IotaTransactionBlockResponse[]>;

Parameters

ParameterType
inputMultiGetTransactionBlocksParams

Returns

Promise<IotaTransactionBlockResponse[]>


executeTransactionBlock()

executeTransactionBlock(__namedParameters): Promise<IotaTransactionBlockResponse>;

Parameters

ParameterType
__namedParametersExecuteTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>


signAndExecuteTransaction()

signAndExecuteTransaction(__namedParameters): Promise<IotaTransactionBlockResponse>;

Parameters

ParameterType
__namedParametersobject & Omit<ExecuteTransactionBlockParams, "transactionBlock" | "signature">

Returns

Promise<IotaTransactionBlockResponse>


getTotalTransactionBlocks()

getTotalTransactionBlocks(__namedParameters?): Promise<bigint>;

Get total number of transactions

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<bigint>


getReferenceGasPrice()

getReferenceGasPrice(__namedParameters?): Promise<bigint>;

Getting the reference gas price for the network

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<bigint>


getStakes()

getStakes(input): Promise<DelegatedStake[]>;

Return the delegated stakes for an address

Parameters

ParameterType
inputGetStakesParams

Returns

Promise<DelegatedStake[]>


getTimelockedStakes()

getTimelockedStakes(input): Promise<DelegatedTimelockedStake[]>;

Return the timelocked delegated stakes for an address

Parameters

ParameterType
inputGetTimelockedStakesParams

Returns

Promise<DelegatedTimelockedStake[]>


getStakesByIds()

getStakesByIds(input): Promise<DelegatedStake[]>;

Return the delegated stakes queried by id.

Parameters

ParameterType
inputGetStakesByIdsParams

Returns

Promise<DelegatedStake[]>


getTimelockedStakesByIds()

getTimelockedStakesByIds(input): Promise<DelegatedTimelockedStake[]>;

Return the timelocked delegated stakes queried by id.

Parameters

ParameterType
inputGetTimelockedStakesByIdsParams

Returns

Promise<DelegatedTimelockedStake[]>


getLatestIotaSystemStateV1()

getLatestIotaSystemStateV1(__namedParameters?): Promise<IotaSystemStateSummaryV1>;

Return the latest IOTA system state object on networks supporting protocol version < 5. These are networks with node software release version < 0.11.

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<IotaSystemStateSummaryV1>

Deprecated

Use getLatestIotaSystemState instead.


getLatestIotaSystemStateV2()

getLatestIotaSystemStateV2(__namedParameters?): Promise<IotaSystemStateSummary>;

Return the latest IOTA system state object on networks supporting protocol version >= 5. These are networks with node software release version >= 0.11.

You probably want to use getLatestIotaSystemState instead to prevent issues with future deprecations or in case the node does not support protocol version >= 5.

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<IotaSystemStateSummary>


getLatestIotaSystemState()

getLatestIotaSystemState(__namedParameters?): Promise<LatestIotaSystemStateSummary>;

Return the latest supported IOTA system state object.

This returns a backwards-compatible system state object that dynamically uses the V1 or V2 depending on the protocol version supported by the node. This method will continue to be supported as more protocol versions are released with changes to the system state.

This is quite useful in case your app does not know in advance what node is it going to be using, this way you as developer dont need to handle each possible system state variant, this is already handled by this method.

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<LatestIotaSystemStateSummary>


queryEvents()

queryEvents(input): Promise<PaginatedEvents>;

Get events for a given query criteria

Parameters

ParameterType
inputQueryEventsParams

Returns

Promise<PaginatedEvents>


subscribeEvent()

subscribeEvent(input): Promise<Unsubscribe>;

Subscribe to get notifications whenever an event matching the filter occurs

Parameters

ParameterType
inputSubscribeEventParams & object

Returns

Promise<Unsubscribe>

Deprecated


subscribeTransaction()

subscribeTransaction(input): Promise<Unsubscribe>;

Parameters

ParameterType
inputSubscribeTransactionParams & object

Returns

Promise<Unsubscribe>

Deprecated


devInspectTransactionBlock()

devInspectTransactionBlock(input): Promise<DevInspectResults>;

Runs the transaction block in dev-inspect mode. Which allows for nearly any transaction (or Move call) with any arguments. Detailed results are provided, including both the transaction effects and any return values.

Parameters

ParameterType
inputDevInspectTransactionBlockParams

Returns

Promise<DevInspectResults>


dryRunTransactionBlock()

dryRunTransactionBlock(input): Promise<DryRunTransactionBlockResponse>;

Dry run a transaction block and return the result.

Parameters

ParameterType
inputDryRunTransactionBlockParams

Returns

Promise<DryRunTransactionBlockResponse>


getDynamicFields()

getDynamicFields(input): Promise<DynamicFieldPage>;

Return the list of dynamic field objects owned by an object

Parameters

ParameterType
inputGetDynamicFieldsParams

Returns

Promise<DynamicFieldPage>


getDynamicFieldObject()

getDynamicFieldObject(input): Promise<IotaObjectResponse>;

Return the dynamic field object information for a specified object Uses the V2.

Parameters

ParameterType
inputGetDynamicFieldObjectV2Params

Returns

Promise<IotaObjectResponse>


getDynamicFieldObjectV1()

getDynamicFieldObjectV1(input): Promise<IotaObjectResponse>;

Return the dynamic field object information for a specified object

Parameters

ParameterType
inputGetDynamicFieldObjectParams

Returns

Promise<IotaObjectResponse>

Deprecated

getDynamicFieldObjectV1 is deprecated, prefer to use getDynamicFieldObject which uses V2.


getDynamicFieldObjectV2()

getDynamicFieldObjectV2(input): Promise<IotaObjectResponse>;

Return the dynamic field object information for a specified object with content options.

Parameters

ParameterType
inputGetDynamicFieldObjectV2Params

Returns

Promise<IotaObjectResponse>


getLatestCheckpointSequenceNumber()

getLatestCheckpointSequenceNumber(__namedParameters?): Promise<string>;

Get the sequence number of the latest checkpoint that has been executed

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<string>


getCheckpoint()

getCheckpoint(input): Promise<Checkpoint>;

Returns information about a given checkpoint

Parameters

ParameterType
inputGetCheckpointParams

Returns

Promise<Checkpoint>


getCheckpoints()

getCheckpoints(input): Promise<CheckpointPage>;

Returns historical checkpoints paginated

Parameters

ParameterType
inputPaginationArguments<string | null> & GetCheckpointsParams

Returns

Promise<CheckpointPage>


getCommitteeInfo()

getCommitteeInfo(input?): Promise<CommitteeInfo>;

Return the committee information for the asked epoch

Parameters

ParameterType
input?GetCommitteeInfoParams

Returns

Promise<CommitteeInfo>


getNetworkMetrics()

getNetworkMetrics(__namedParameters?): Promise<NetworkMetrics>;

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<NetworkMetrics>


getAddressMetrics()

getAddressMetrics(__namedParameters?): Promise<AddressMetrics>;

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<AddressMetrics>


getEpochMetrics()

getEpochMetrics(input?): Promise<EpochMetricsPage>;

Parameters

ParameterType
input?object & PaginationArguments<string | null>

Returns

Promise<EpochMetricsPage>


getAllEpochAddressMetrics()

getAllEpochAddressMetrics(input?): Promise<AllEpochsAddressMetrics>;

Parameters

ParameterType
input?{ descendingOrder?: boolean; signal?: AbortSignal; }
input.descendingOrder?boolean
input.signal?AbortSignal

Returns

Promise<AllEpochsAddressMetrics>


getCheckpointAddressMetrics()

getCheckpointAddressMetrics(input?): Promise<AddressMetrics>;

Parameters

ParameterType
input?{ checkpoint: string; signal?: AbortSignal; }
input.checkpoint?string
input.signal?AbortSignal

Returns

Promise<AddressMetrics>


getEpochs()

getEpochs(input?): Promise<EpochPage>;

Return the committee information for the asked epoch

Parameters

ParameterType
input?object & PaginationArguments<string | null>

Returns

Promise<EpochPage>


getMoveCallMetrics()

getMoveCallMetrics(__namedParameters?): Promise<MoveCallMetrics>;

Returns list of top move calls by usage

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<MoveCallMetrics>


getCurrentEpoch()

getCurrentEpoch(__namedParameters?): Promise<EpochInfo>;

Return the committee information for the asked epoch

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<EpochInfo>


getTotalTransactions()

getTotalTransactions(__namedParameters?): Promise<string>;

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<string>


getValidatorsApy()

getValidatorsApy(__namedParameters?): Promise<ValidatorsApy>;

Return the Validators APYs

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<ValidatorsApy>


getChainIdentifier()

getChainIdentifier(__namedParameters?): Promise<string>;

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<string>


getProtocolConfig()

getProtocolConfig(input?): Promise<ProtocolConfig>;

Parameters

ParameterType
input?GetProtocolConfigParams

Returns

Promise<ProtocolConfig>


getParticipationMetrics()

getParticipationMetrics(__namedParameters?): Promise<ParticipationMetrics>;

Returns the participation metrics (total unique addresses with delegated stake in the current epoch).

Parameters

ParameterType
__namedParameters{ signal?: AbortSignal; }
__namedParameters.signal?AbortSignal

Returns

Promise<ParticipationMetrics>


waitForTransaction()

waitForTransaction(__namedParameters): Promise<IotaTransactionBlockResponse>;

Wait for a transaction block result to be available over the API. This can be used in conjunction with executeTransactionBlock to wait for the transaction to be available via the API. This currently polls the getTransactionBlock API to check for the transaction.

Parameters

ParameterType
__namedParametersobject & GetTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>


iotaNamesLookup()

iotaNamesLookup(input): Promise<IotaNameRecord | undefined>;

Return the resolved record for the given name.

Parameters

ParameterType
inputIotaNamesLookupParams

Returns

Promise<IotaNameRecord | undefined>


iotaNamesReverseLookup()

iotaNamesReverseLookup(input): Promise<string | undefined>;

Return the resolved name for the given address.

Parameters

ParameterType
inputIotaNamesReverseLookupParams

Returns

Promise<string | undefined>


iotaNamesFindAllRegistrationNFTs()

iotaNamesFindAllRegistrationNFTs(input): Promise<PaginatedObjectsResponse>;

Find all registration NFTs for the given address.

Parameters

ParameterType
inputIotaNamesFindAllRegistrationNFTsParams

Returns

Promise<PaginatedObjectsResponse>


isTransactionIndexedOnNode()

isTransactionIndexedOnNode(input): Promise<boolean>;

Check if a Transaction has been indexed on the Node.

Parameters

ParameterType
inputIsTransactionIndexedOnNodeParams

Returns

Promise<boolean>


view()

view(input): Promise<IotaMoveViewCallResults>;

Calls a move view function.

Parameters

ParameterType
inputViewParams

Returns

Promise<IotaMoveViewCallResults>