Class: IotaClient
Constructors
Constructor
new IotaClient(options): IotaClient;
Establish a connection to an IOTA RPC endpoint
Parameters
| Parameter | Type | Description |
|---|---|---|
options | NetworkOrTransport | configuration options for the API Client |
Returns
IotaClient
Properties
| Property | Modifier | Type |
|---|---|---|
transport | protected | IotaTransport |
Methods
getRpcApiVersion()
getRpcApiVersion(__namedParameters?): Promise<string | undefined>;
Parameters
| Parameter | Type |
|---|---|
__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
| Parameter | Type |
|---|---|
input | GetCoinsParams |
Returns
Promise<PaginatedCoins>
getAllCoins()
getAllCoins(input): Promise<PaginatedCoins>;
Get all Coin objects owned by an address.
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
input | GetAllBalancesParams |
Returns
Promise<CoinBalance[]>
getCoinMetadata()
getCoinMetadata(input): Promise<CoinMetadata | null>;
Fetch CoinMetadata for a given coin type
Parameters
| Parameter | Type |
|---|---|
input | GetCoinMetadataParams |
Returns
Promise<CoinMetadata | null>
getTotalSupply()
getTotalSupply(input): Promise<CoinSupply>;
Fetch total supply for a coin
Parameters
| Parameter | Type |
|---|---|
input | GetTotalSupplyParams |
Returns
Promise<CoinSupply>
getCirculatingSupply()
getCirculatingSupply(__namedParameters?): Promise<IotaCirculatingSupply>;
Fetch circulating supply for a coin
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<IotaCirculatingSupply>
call()
call<T>(
method,
params,
args?): Promise<T>;
Invoke any RPC method
Type Parameters
| Type Parameter | Default type |
|---|---|
T | unknown |
Parameters
| Parameter | Type | Description |
|---|---|---|
method | string | the method to be invoked |
params | unknown[] | - |
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
| Parameter | Type |
|---|---|
input | GetMoveFunctionArgTypesParams |
Returns
Promise<IotaMoveFunctionArgType[]>
getNormalizedMoveModulesByPackage()
getNormalizedMoveModulesByPackage(input): Promise<IotaMoveNormalizedModules>;
Get a map from module name to structured representations of Move modules
Parameters
| Parameter | Type |
|---|---|
input | GetNormalizedMoveModulesByPackageParams |
Returns
Promise<IotaMoveNormalizedModules>
getNormalizedMoveModule()
getNormalizedMoveModule(input): Promise<IotaMoveNormalizedModule>;
Get a structured representation of Move module
Parameters
| Parameter | Type |
|---|---|
input | GetNormalizedMoveModuleParams |
Returns
Promise<IotaMoveNormalizedModule>
getNormalizedMoveFunction()
getNormalizedMoveFunction(input): Promise<IotaMoveNormalizedFunction>;
Get a structured representation of Move function
Parameters
| Parameter | Type |
|---|---|
input | GetNormalizedMoveFunctionParams |
Returns
Promise<IotaMoveNormalizedFunction>
getNormalizedMoveStruct()
getNormalizedMoveStruct(input): Promise<IotaMoveNormalizedStruct>;
Get a structured representation of Move struct
Parameters
| Parameter | Type |
|---|---|
input | GetNormalizedMoveStructParams |
Returns
Promise<IotaMoveNormalizedStruct>
getOwnedObjects()
getOwnedObjects(input): Promise<PaginatedObjectsResponse>;
Get all objects owned by an address
Parameters
| Parameter | Type |
|---|---|
input | GetOwnedObjectsParams |
Returns
Promise<PaginatedObjectsResponse>
getObject()
getObject(input): Promise<IotaObjectResponse>;
Get details about an object
Parameters
| Parameter | Type |
|---|---|
input | GetObjectParams |
Returns
Promise<IotaObjectResponse>
tryGetPastObject()
tryGetPastObject(input): Promise<ObjectRead>;
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
input | MultiGetObjectsParams |
Returns
Promise<IotaObjectResponse[]>
queryTransactionBlocks()
queryTransactionBlocks(input): Promise<PaginatedTransactionResponse>;
Get transaction blocks for a given query criteria
Parameters
| Parameter | Type |
|---|---|
input | QueryTransactionBlocksParams |
Returns
Promise<PaginatedTransactionResponse>
getTransactionBlock()
getTransactionBlock(input): Promise<IotaTransactionBlockResponse>;
Parameters
| Parameter | Type |
|---|---|
input | GetTransactionBlockParams |
Returns
Promise<IotaTransactionBlockResponse>
multiGetTransactionBlocks()
multiGetTransactionBlocks(input): Promise<IotaTransactionBlockResponse[]>;
Parameters
| Parameter | Type |
|---|---|
input | MultiGetTransactionBlocksParams |
Returns
Promise<IotaTransactionBlockResponse[]>
executeTransactionBlock()
executeTransactionBlock(__namedParameters): Promise<IotaTransactionBlockResponse>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | ExecuteTransactionBlockParams |
Returns
Promise<IotaTransactionBlockResponse>
signAndExecuteTransaction()
signAndExecuteTransaction(__namedParameters): Promise<IotaTransactionBlockResponse>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | object & Omit<ExecuteTransactionBlockParams, "transactionBlock" | "signature"> |
Returns
Promise<IotaTransactionBlockResponse>
getTotalTransactionBlocks()
getTotalTransactionBlocks(__namedParameters?): Promise<bigint>;
Get total number of transactions
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<bigint>
getReferenceGasPrice()
getReferenceGasPrice(__namedParameters?): Promise<bigint>;
Getting the reference gas price for the network
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<bigint>
getStakes()
getStakes(input): Promise<DelegatedStake[]>;
Return the delegated stakes for an address
Parameters
| Parameter | Type |
|---|---|
input | GetStakesParams |
Returns
Promise<DelegatedStake[]>
getTimelockedStakes()
getTimelockedStakes(input): Promise<DelegatedTimelockedStake[]>;
Return the timelocked delegated stakes for an address
Parameters
| Parameter | Type |
|---|---|
input | GetTimelockedStakesParams |
Returns
Promise<DelegatedTimelockedStake[]>
getStakesByIds()
getStakesByIds(input): Promise<DelegatedStake[]>;
Return the delegated stakes queried by id.
Parameters
| Parameter | Type |
|---|---|
input | GetStakesByIdsParams |
Returns
Promise<DelegatedStake[]>
getTimelockedStakesByIds()
getTimelockedStakesByIds(input): Promise<DelegatedTimelockedStake[]>;
Return the timelocked delegated stakes queried by id.
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
__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
| Parameter | Type |
|---|---|
__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
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<LatestIotaSystemStateSummary>
queryEvents()
queryEvents(input): Promise<PaginatedEvents>;
Get events for a given query criteria
Parameters
| Parameter | Type |
|---|---|
input | QueryEventsParams |
Returns
Promise<PaginatedEvents>
subscribeEvent()
subscribeEvent(input): Promise<Unsubscribe>;
Subscribe to get notifications whenever an event matching the filter occurs
Parameters
| Parameter | Type |
|---|---|
input | SubscribeEventParams & object |
Returns
Promise<Unsubscribe>
Deprecated
subscribeTransaction()
subscribeTransaction(input): Promise<Unsubscribe>;
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
input | DevInspectTransactionBlockParams |
Returns
Promise<DevInspectResults>
dryRunTransactionBlock()
dryRunTransactionBlock(input): Promise<DryRunTransactionBlockResponse>;
Dry run a transaction block and return the result.
Parameters
| Parameter | Type |
|---|---|
input | DryRunTransactionBlockParams |
Returns
Promise<DryRunTransactionBlockResponse>
getDynamicFields()
getDynamicFields(input): Promise<DynamicFieldPage>;
Return the list of dynamic field objects owned by an object
Parameters
| Parameter | Type |
|---|---|
input | GetDynamicFieldsParams |
Returns
Promise<DynamicFieldPage>
getDynamicFieldObject()
getDynamicFieldObject(input): Promise<IotaObjectResponse>;
Return the dynamic field object information for a specified object Uses the V2.
Parameters
| Parameter | Type |
|---|---|
input | GetDynamicFieldObjectV2Params |
Returns
Promise<IotaObjectResponse>
getDynamicFieldObjectV1()
getDynamicFieldObjectV1(input): Promise<IotaObjectResponse>;
Return the dynamic field object information for a specified object
Parameters
| Parameter | Type |
|---|---|
input | GetDynamicFieldObjectParams |
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
| Parameter | Type |
|---|---|
input | GetDynamicFieldObjectV2Params |
Returns
Promise<IotaObjectResponse>
getLatestCheckpointSequenceNumber()
getLatestCheckpointSequenceNumber(__namedParameters?): Promise<string>;
Get the sequence number of the latest checkpoint that has been executed
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<string>
getCheckpoint()
getCheckpoint(input): Promise<Checkpoint>;
Returns information about a given checkpoint
Parameters
| Parameter | Type |
|---|---|
input | GetCheckpointParams |
Returns
Promise<Checkpoint>
getCheckpoints()
getCheckpoints(input): Promise<CheckpointPage>;
Returns historical checkpoints paginated
Parameters
| Parameter | Type |
|---|---|
input | PaginationArguments<string | null> & GetCheckpointsParams |
Returns
Promise<CheckpointPage>
getCommitteeInfo()
getCommitteeInfo(input?): Promise<CommitteeInfo>;
Return the committee information for the asked epoch
Parameters
| Parameter | Type |
|---|---|
input? | GetCommitteeInfoParams |
Returns
Promise<CommitteeInfo>
getNetworkMetrics()
getNetworkMetrics(__namedParameters?): Promise<NetworkMetrics>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<NetworkMetrics>
getAddressMetrics()
getAddressMetrics(__namedParameters?): Promise<AddressMetrics>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<AddressMetrics>
getEpochMetrics()
getEpochMetrics(input?): Promise<EpochMetricsPage>;
Parameters
| Parameter | Type |
|---|---|
input? | object & PaginationArguments<string | null> |
Returns
Promise<EpochMetricsPage>
getAllEpochAddressMetrics()
getAllEpochAddressMetrics(input?): Promise<AllEpochsAddressMetrics>;
Parameters
| Parameter | Type |
|---|---|
input? | { descendingOrder?: boolean; signal?: AbortSignal; } |
input.descendingOrder? | boolean |
input.signal? | AbortSignal |
Returns
Promise<AllEpochsAddressMetrics>
getCheckpointAddressMetrics()
getCheckpointAddressMetrics(input?): Promise<AddressMetrics>;
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
input? | object & PaginationArguments<string | null> |
Returns
Promise<EpochPage>
getMoveCallMetrics()
getMoveCallMetrics(__namedParameters?): Promise<MoveCallMetrics>;
Returns list of top move calls by usage
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<MoveCallMetrics>
getCurrentEpoch()
getCurrentEpoch(__namedParameters?): Promise<EpochInfo>;
Return the committee information for the asked epoch
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<EpochInfo>
getTotalTransactions()
getTotalTransactions(__namedParameters?): Promise<string>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<string>
getValidatorsApy()
getValidatorsApy(__namedParameters?): Promise<ValidatorsApy>;
Return the Validators APYs
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<ValidatorsApy>
getChainIdentifier()
getChainIdentifier(__namedParameters?): Promise<string>;
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { signal?: AbortSignal; } |
__namedParameters.signal? | AbortSignal |
Returns
Promise<string>
getProtocolConfig()
getProtocolConfig(input?): Promise<ProtocolConfig>;
Parameters
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
__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
| Parameter | Type |
|---|---|
__namedParameters | object & GetTransactionBlockParams |
Returns
Promise<IotaTransactionBlockResponse>
iotaNamesLookup()
iotaNamesLookup(input): Promise<IotaNameRecord | undefined>;
Return the resolved record for the given name.
Parameters
| Parameter | Type |
|---|---|
input | IotaNamesLookupParams |
Returns
Promise<IotaNameRecord | undefined>
iotaNamesReverseLookup()
iotaNamesReverseLookup(input): Promise<string | undefined>;
Return the resolved name for the given address.
Parameters
| Parameter | Type |
|---|---|
input | IotaNamesReverseLookupParams |
Returns
Promise<string | undefined>
iotaNamesFindAllRegistrationNFTs()
iotaNamesFindAllRegistrationNFTs(input): Promise<PaginatedObjectsResponse>;
Find all registration NFTs for the given address.
Parameters
| Parameter | Type |
|---|---|
input | IotaNamesFindAllRegistrationNFTsParams |
Returns
Promise<PaginatedObjectsResponse>
isTransactionIndexedOnNode()
isTransactionIndexedOnNode(input): Promise<boolean>;
Check if a Transaction has been indexed on the Node.
Parameters
| Parameter | Type |
|---|---|
input | IsTransactionIndexedOnNodeParams |
Returns
Promise<boolean>
view()
view(input): Promise<IotaMoveViewCallResults>;
Calls a move view function.
Parameters
| Parameter | Type |
|---|---|
input | ViewParams |
Returns
Promise<IotaMoveViewCallResults>