Class: IotaClient
Constructors
Constructor
new IotaClient(
options):IotaClient
Establish a connection to an IOTA RPC endpoint
Parameters
options
NetworkOrTransport
configuration options for the API Client
Returns
IotaClient
Properties
transport
protectedtransport:IotaTransport
Methods
getRpcApiVersion()
getRpcApiVersion(
__namedParameters?):Promise<string|undefined>
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<string | undefined>
getCoins()
getCoins(
input):Promise<PaginatedCoins>
Get all Coin<coin_type> objects owned by an address.
Parameters
input
Returns
Promise<PaginatedCoins>
getAllCoins()
getAllCoins(
input):Promise<PaginatedCoins>
Get all Coin objects owned by an address.
Parameters
input
Returns
Promise<PaginatedCoins>
getBalance()
getBalance(
input):Promise<CoinBalance>
Get the total coin balance for one coin type, owned by the address owner.
Parameters
input
Returns
Promise<CoinBalance>
getAllBalances()
getAllBalances(
input):Promise<CoinBalance[]>
Get the total coin balance for all coin types, owned by the address owner.
Parameters
input
Returns
Promise<CoinBalance[]>
getCoinMetadata()
getCoinMetadata(
input):Promise<CoinMetadata|null>
Fetch CoinMetadata for a given coin type
Parameters
input
Returns
Promise<CoinMetadata | null>
getTotalSupply()
getTotalSupply(
input):Promise<CoinSupply>
Fetch total supply for a coin
Parameters
input
Returns
Promise<CoinSupply>
getCirculatingSupply()
getCirculatingSupply(
__namedParameters?):Promise<IotaCirculatingSupply>
Fetch circulating supply for a coin
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<IotaCirculatingSupply>
call()
call<
T>(method,params,args?):Promise<T>
Invoke any RPC method
Type Parameters
T
T = unknown
Parameters
method
string
the method to be invoked
params
unknown[]
args?
the arguments to be passed to the RPC request
signal?
AbortSignal
Returns
Promise<T>
getMoveFunctionArgTypes()
getMoveFunctionArgTypes(
input):Promise<IotaMoveFunctionArgType[]>
Get Move function argument types like read, write and full access
Parameters
input
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
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
Returns
Promise<IotaMoveNormalizedStruct>
getOwnedObjects()
getOwnedObjects(
input):Promise<PaginatedObjectsResponse>
Get all objects owned by an address
Parameters
input
Returns
Promise<PaginatedObjectsResponse>
getObject()
getObject(
input):Promise<IotaObjectResponse>
Get details about an object
Parameters
input
Returns
Promise<IotaObjectResponse>
tryGetPastObject()
tryGetPastObject(
input):Promise<ObjectRead>
Parameters
input
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
Returns
Promise<IotaObjectResponse[]>
queryTransactionBlocks()
queryTransactionBlocks(
input):Promise<PaginatedTransactionResponse>
Get transaction blocks for a given query criteria
Parameters
input
Returns
Promise<PaginatedTransactionResponse>
getTransactionBlock()
getTransactionBlock(
input):Promise<IotaTransactionBlockResponse>
Parameters
input
Returns
Promise<IotaTransactionBlockResponse>
multiGetTransactionBlocks()
multiGetTransactionBlocks(
input):Promise<IotaTransactionBlockResponse[]>
Parameters
input
MultiGetTransactionBlocksParams
Returns
Promise<IotaTransactionBlockResponse[]>
executeTransactionBlock()
executeTransactionBlock(
__namedParameters):Promise<IotaTransactionBlockResponse>
Parameters
__namedParameters
Returns
Promise<IotaTransactionBlockResponse>
signAndExecuteTransaction()
signAndExecuteTransaction(
__namedParameters):Promise<IotaTransactionBlockResponse>
Parameters
__namedParameters
object & Omit<ExecuteTransactionBlockParams, "transactionBlock" | "signature">
Returns
Promise<IotaTransactionBlockResponse>
getTotalTransactionBlocks()
getTotalTransactionBlocks(
__namedParameters?):Promise<bigint>
Get total number of transactions
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<bigint>
getReferenceGasPrice()
getReferenceGasPrice(
__namedParameters?):Promise<bigint>
Getting the reference gas price for the network
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<bigint>
getStakes()
getStakes(
input):Promise<DelegatedStake[]>
Return the delegated stakes for an address
Parameters
input
Returns
Promise<DelegatedStake[]>
getTimelockedStakes()
getTimelockedStakes(
input):Promise<DelegatedTimelockedStake[]>
Return the timelocked delegated stakes for an address
Parameters
input
Returns
Promise<DelegatedTimelockedStake[]>
getStakesByIds()
getStakesByIds(
input):Promise<DelegatedStake[]>
Return the delegated stakes queried by id.
Parameters
input
Returns
Promise<DelegatedStake[]>
getTimelockedStakesByIds()
getTimelockedStakesByIds(
input):Promise<DelegatedTimelockedStake[]>
Return the timelocked delegated stakes queried by id.
Parameters
input
GetTimelockedStakesByIdsParams
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
__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
__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
__namedParameters?
signal?
AbortSignal
Returns
Promise<LatestIotaSystemStateSummary>
queryEvents()
queryEvents(
input):Promise<PaginatedEvents>
Get events for a given query criteria
Parameters
input
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
Returns
Promise<DryRunTransactionBlockResponse>
getDynamicFields()
getDynamicFields(
input):Promise<DynamicFieldPage>
Return the list of dynamic field objects owned by an object
Parameters
input
Returns
Promise<DynamicFieldPage>
getDynamicFieldObject()
getDynamicFieldObject(
input):Promise<IotaObjectResponse>
Return the dynamic field object information for a specified object Uses the V2.
Parameters
input
Returns
Promise<IotaObjectResponse>
getDynamicFieldObjectV1()
getDynamicFieldObjectV1(
input):Promise<IotaObjectResponse>
Return the dynamic field object information for a specified object
Parameters
input
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
input
Returns
Promise<IotaObjectResponse>
getLatestCheckpointSequenceNumber()
getLatestCheckpointSequenceNumber(
__namedParameters?):Promise<string>
Get the sequence number of the latest checkpoint that has been executed
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<string>
getCheckpoint()
getCheckpoint(
input):Promise<Checkpoint>
Returns information about a given checkpoint
Parameters
input
Returns
Promise<Checkpoint>
getCheckpoints()
getCheckpoints(
input):Promise<CheckpointPage>
Returns historical checkpoints paginated
Parameters
input
PaginationArguments<string | null> & GetCheckpointsParams
Returns
Promise<CheckpointPage>
getCommitteeInfo()
getCommitteeInfo(
input?):Promise<CommitteeInfo>
Return the committee information for the asked epoch
Parameters
input?
Returns
Promise<CommitteeInfo>
getNetworkMetrics()
getNetworkMetrics(
__namedParameters?):Promise<NetworkMetrics>
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<NetworkMetrics>
getAddressMetrics()
getAddressMetrics(
__namedParameters?):Promise<AddressMetrics>
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<AddressMetrics>
getEpochMetrics()
getEpochMetrics(
input?):Promise<EpochMetricsPage>
Parameters
input?
object & PaginationArguments<string | null>
Returns
Promise<EpochMetricsPage>
getAllEpochAddressMetrics()
getAllEpochAddressMetrics(
input?):Promise<AllEpochsAddressMetrics>
Parameters
input?
descendingOrder?
boolean
signal?
AbortSignal
Returns
Promise<AllEpochsAddressMetrics>
getCheckpointAddressMetrics()
getCheckpointAddressMetrics(
input?):Promise<AddressMetrics>
Parameters
input?
checkpoint
string
signal?
AbortSignal
Returns
Promise<AddressMetrics>
getEpochs()
getEpochs(
input?):Promise<EpochPage>
Return the committee information for the asked epoch
Parameters
input?
object & PaginationArguments<string | null>
Returns
Promise<EpochPage>
getMoveCallMetrics()
getMoveCallMetrics(
__namedParameters?):Promise<MoveCallMetrics>
Returns list of top move calls by usage
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<MoveCallMetrics>
getCurrentEpoch()
getCurrentEpoch(
__namedParameters?):Promise<EpochInfo>
Return the committee information for the asked epoch
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<EpochInfo>
getTotalTransactions()
getTotalTransactions(
__namedParameters?):Promise<string>
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<string>
getValidatorsApy()
getValidatorsApy(
__namedParameters?):Promise<ValidatorsApy>
Return the Validators APYs
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<ValidatorsApy>
getChainIdentifier()
getChainIdentifier(
__namedParameters?):Promise<string>
Parameters
__namedParameters?
signal?
AbortSignal
Returns
Promise<string>
getProtocolConfig()
getProtocolConfig(
input?):Promise<ProtocolConfig>
Parameters
input?
Returns
Promise<ProtocolConfig>
getParticipationMetrics()
getParticipationMetrics(
__namedParameters?):Promise<ParticipationMetrics>
Returns the participation metrics (total unique addresses with delegated stake in the current epoch).
Parameters
__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
__namedParameters
object & GetTransactionBlockParams
Returns
Promise<IotaTransactionBlockResponse>
iotaNamesLookup()
iotaNamesLookup(
input):Promise<IotaNameRecord|undefined>
Return the resolved record for the given name.
Parameters
input
Returns
Promise<IotaNameRecord | undefined>
iotaNamesReverseLookup()
iotaNamesReverseLookup(
input):Promise<string|undefined>
Return the resolved name for the given address.
Parameters
input
Returns
Promise<string | undefined>
iotaNamesFindAllRegistrationNFTs()
iotaNamesFindAllRegistrationNFTs(
input):Promise<PaginatedObjectsResponse>
Find all registration NFTs for the given address.
Parameters
input
IotaNamesFindAllRegistrationNFTsParams
Returns
Promise<PaginatedObjectsResponse>
isTransactionIndexedOnNode()
isTransactionIndexedOnNode(
input):Promise<boolean>
Check if a Transaction has been indexed on the Node.
Parameters
input
IsTransactionIndexedOnNodeParams
Returns
Promise<boolean>
view()
view(
input):Promise<IotaMoveViewCallResults>
Calls a move view function.
Parameters
input
Returns
Promise<IotaMoveViewCallResults>