Skip to main content

Class: IotaClient

Constructors

new IotaClient()

new IotaClient(options): IotaClient

Establish a connection to a IOTA RPC endpoint

Parameters

options: NetworkOrTransport

configuration options for the API Client

Returns

IotaClient

Properties

transport

protected transport: IotaTransport

Methods

getRpcApiVersion()

getRpcApiVersion(): Promise<undefined | string>

Returns

Promise<undefined | string>


getCoins()

getCoins(input): Promise<PaginatedCoins>

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

Parameters

input: GetCoinsParams

Returns

Promise<PaginatedCoins>


getAllCoins()

getAllCoins(input): Promise<PaginatedCoins>

Get all Coin objects owned by an address.

Parameters

input: GetAllCoinsParams

Returns

Promise<PaginatedCoins>


getBalance()

getBalance(input): Promise<CoinBalance>

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

Parameters

input: GetBalanceParams

Returns

Promise<CoinBalance>


getAllBalances()

getAllBalances(input): Promise<CoinBalance[]>

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

Parameters

input: GetAllBalancesParams

Returns

Promise<CoinBalance[]>


getCoinMetadata()

getCoinMetadata(input): Promise<null | CoinMetadata>

Fetch CoinMetadata for a given coin type

Parameters

input: GetCoinMetadataParams

Returns

Promise<null | CoinMetadata>


getTotalSupply()

getTotalSupply(input): Promise<CoinSupply>

Fetch total supply for a coin

Parameters

input: GetTotalSupplyParams

Returns

Promise<CoinSupply>


call()

call<T>(method, params): Promise<T>

Invoke any RPC method

Type Parameters

T = unknown

Parameters

method: string

the method to be invoked

params: unknown[]

Returns

Promise<T>


getMoveFunctionArgTypes()

getMoveFunctionArgTypes(input): Promise<IotaMoveFunctionArgType[]>

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

Parameters

input: GetMoveFunctionArgTypesParams

Returns

Promise<IotaMoveFunctionArgType[]>


getNormalizedMoveModulesByPackage()

getNormalizedMoveModulesByPackage(input): Promise<IotaMoveNormalizedModules>

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

Parameters

input: GetNormalizedMoveModulesByPackageParams

Returns

Promise<IotaMoveNormalizedModules>


getNormalizedMoveModule()

getNormalizedMoveModule(input): Promise<IotaMoveNormalizedModule>

Get a structured representation of Move module

Parameters

input: GetNormalizedMoveModuleParams

Returns

Promise<IotaMoveNormalizedModule>


getNormalizedMoveFunction()

getNormalizedMoveFunction(input): Promise<IotaMoveNormalizedFunction>

Get a structured representation of Move function

Parameters

input: GetNormalizedMoveFunctionParams

Returns

Promise<IotaMoveNormalizedFunction>


getNormalizedMoveStruct()

getNormalizedMoveStruct(input): Promise<IotaMoveNormalizedStruct>

Get a structured representation of Move struct

Parameters

input: GetNormalizedMoveStructParams

Returns

Promise<IotaMoveNormalizedStruct>


getOwnedObjects()

getOwnedObjects(input): Promise<PaginatedObjectsResponse>

Get all objects owned by an address

Parameters

input: GetOwnedObjectsParams

Returns

Promise<PaginatedObjectsResponse>


getObject()

getObject(input): Promise<IotaObjectResponse>

Get details about an object

Parameters

input: GetObjectParams

Returns

Promise<IotaObjectResponse>


tryGetPastObject()

tryGetPastObject(input): Promise<ObjectRead>

Parameters

input: TryGetPastObjectParams

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

input: MultiGetObjectsParams

Returns

Promise<IotaObjectResponse[]>


queryTransactionBlocks()

queryTransactionBlocks(input): Promise<PaginatedTransactionResponse>

Get transaction blocks for a given query criteria

Parameters

input: QueryTransactionBlocksParams

Returns

Promise<PaginatedTransactionResponse>


getTransactionBlock()

getTransactionBlock(input): Promise<IotaTransactionBlockResponse>

Parameters

input: GetTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>


multiGetTransactionBlocks()

multiGetTransactionBlocks(input): Promise<IotaTransactionBlockResponse[]>

Parameters

input: MultiGetTransactionBlocksParams

Returns

Promise<IotaTransactionBlockResponse[]>


executeTransactionBlock()

executeTransactionBlock(__namedParameters): Promise<IotaTransactionBlockResponse>

Parameters

__namedParameters: ExecuteTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>


signAndExecuteTransaction()

signAndExecuteTransaction(__namedParameters): Promise<IotaTransactionBlockResponse>

Parameters

__namedParameters: object & Omit<ExecuteTransactionBlockParams, "signature" | "transactionBlock">

Returns

Promise<IotaTransactionBlockResponse>


getTotalTransactionBlocks()

getTotalTransactionBlocks(): Promise<bigint>

Get total number of transactions

Returns

Promise<bigint>


getReferenceGasPrice()

getReferenceGasPrice(): Promise<bigint>

Getting the reference gas price for the network

Returns

Promise<bigint>


getStakes()

getStakes(input): Promise<DelegatedStake[]>

Return the delegated stakes for an address

Parameters

input: GetStakesParams

Returns

Promise<DelegatedStake[]>


getTimelockedStakes()

getTimelockedStakes(input): Promise<DelegatedTimelockedStake[]>

Return the timelocked delegated stakes for an address

Parameters

input: GetTimelockedStakesParams

Returns

Promise<DelegatedTimelockedStake[]>


getStakesByIds()

getStakesByIds(input): Promise<DelegatedStake[]>

Return the delegated stakes queried by id.

Parameters

input: GetStakesByIdsParams

Returns

Promise<DelegatedStake[]>


getTimelockedStakesByIds()

getTimelockedStakesByIds(input): Promise<DelegatedTimelockedStake[]>

Return the timelocked delegated stakes queried by id.

Parameters

input: GetTimelockedStakesByIdsParams

Returns

Promise<DelegatedTimelockedStake[]>


getLatestIotaSystemState()

getLatestIotaSystemState(): Promise<IotaSystemStateSummary>

Return the latest system state content.

Returns

Promise<IotaSystemStateSummary>


queryEvents()

queryEvents(input): Promise<PaginatedEvents>

Get events for a given query criteria

Parameters

input: QueryEventsParams

Returns

Promise<PaginatedEvents>


subscribeEvent()

subscribeEvent(input): Promise<Unsubscribe>

Subscribe to get notifications whenever an event matching the filter occurs

Parameters

input: SubscribeEventParams & object

Returns

Promise<Unsubscribe>

Deprecated


subscribeTransaction()

subscribeTransaction(input): Promise<Unsubscribe>

Parameters

input: SubscribeTransactionParams & 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

input: DevInspectTransactionBlockParams

Returns

Promise<DevInspectResults>


dryRunTransactionBlock()

dryRunTransactionBlock(input): Promise<DryRunTransactionBlockResponse>

Dry run a transaction block and return the result.

Parameters

input: DryRunTransactionBlockParams

Returns

Promise<DryRunTransactionBlockResponse>


getDynamicFields()

getDynamicFields(input): Promise<DynamicFieldPage>

Return the list of dynamic field objects owned by an object

Parameters

input: GetDynamicFieldsParams

Returns

Promise<DynamicFieldPage>


getDynamicFieldObject()

getDynamicFieldObject(input): Promise<IotaObjectResponse>

Return the dynamic field object information for a specified object

Parameters

input: GetDynamicFieldObjectParams

Returns

Promise<IotaObjectResponse>


getLatestCheckpointSequenceNumber()

getLatestCheckpointSequenceNumber(): Promise<string>

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

Returns

Promise<string>


getCheckpoint()

getCheckpoint(input): Promise<Checkpoint>

Returns information about a given checkpoint

Parameters

input: GetCheckpointParams

Returns

Promise<Checkpoint>


getCheckpoints()

getCheckpoints(input): Promise<CheckpointPage>

Returns historical checkpoints paginated

Parameters

input: PaginationArguments<null | string> & GetCheckpointsParams

Returns

Promise<CheckpointPage>


getCommitteeInfo()

getCommitteeInfo(input?): Promise<CommitteeInfo>

Return the committee information for the asked epoch

Parameters

input?: GetCommitteeInfoParams

Returns

Promise<CommitteeInfo>


getNetworkMetrics()

getNetworkMetrics(): Promise<NetworkMetrics>

Returns

Promise<NetworkMetrics>


getAddressMetrics()

getAddressMetrics(): Promise<AddressMetrics>

Returns

Promise<AddressMetrics>


getEpochMetrics()

getEpochMetrics(input?): Promise<EpochMetricsPage>

Parameters

input?: object & PaginationArguments<null | string>

Returns

Promise<EpochMetricsPage>


getAllEpochAddressMetrics()

getAllEpochAddressMetrics(input?): Promise<AllEpochsAddressMetrics>

Parameters

input?

input.descendingOrder?: boolean

Returns

Promise<AllEpochsAddressMetrics>


getCheckpointAddressMetrics()

getCheckpointAddressMetrics(input?): Promise<AddressMetrics>

Parameters

input?

input.checkpoint?: string

Returns

Promise<AddressMetrics>


getEpochs()

getEpochs(input?): Promise<EpochPage>

Return the committee information for the asked epoch

Parameters

input?: object & PaginationArguments<null | string>

Returns

Promise<EpochPage>


getMoveCallMetrics()

getMoveCallMetrics(): Promise<MoveCallMetrics>

Returns list of top move calls by usage

Returns

Promise<MoveCallMetrics>


getCurrentEpoch()

getCurrentEpoch(): Promise<EpochInfo>

Return the committee information for the asked epoch

Returns

Promise<EpochInfo>


getTotalTransactions()

getTotalTransactions(): Promise<string>

Returns

Promise<string>


getValidatorsApy()

getValidatorsApy(): Promise<ValidatorsApy>

Return the Validators APYs

Returns

Promise<ValidatorsApy>


getChainIdentifier()

getChainIdentifier(): Promise<string>

Returns

Promise<string>


getProtocolConfig()

getProtocolConfig(input?): Promise<ProtocolConfig>

Parameters

input?: GetProtocolConfigParams

Returns

Promise<ProtocolConfig>


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

__namedParameters: object & GetTransactionBlockParams

Returns

Promise<IotaTransactionBlockResponse>