IotaGrpcClient
@iota/grpc / IotaGrpcClient
Class: IotaGrpcClient
Defined in: sdk/grpc/src/client.ts:163
Constructors
Constructor
new IotaGrpcClient(
options):IotaGrpcClient
Defined in: sdk/grpc/src/client.ts:177
Parameters
options
Returns
IotaGrpcClient
Properties
maxMessageSizeBytes
readonlymaxMessageSizeBytes:number
Defined in: sdk/grpc/src/client.ts:164
transport
protectedtransport:Transport
Defined in: sdk/grpc/src/client.ts:166
Accessors
[IOTA_GRPC_CLIENT_BRAND]
Get Signature
get [IOTA_GRPC_CLIENT_BRAND]():
boolean
Defined in: sdk/grpc/src/client.ts:173
Returns
boolean
execution
Get Signature
get
protectedexecution():Client<typeofTransactionExecutionService>
Defined in: sdk/grpc/src/client.ts:214
Returns
Client<typeof TransactionExecutionService>
ledger
Get Signature
get
protectedledger():Client<typeofLedgerService>
Defined in: sdk/grpc/src/client.ts:199
Raw generated client for the node's LedgerService. Not public: it hands out frame streams, and reassembly must not be skippable.
Built on first use, so services you never touch are never built.
Returns
Client<typeof LedgerService>
movePackage
Get Signature
get
protectedmovePackage():Client<typeofMovePackageService>
Defined in: sdk/grpc/src/client.ts:209
Returns
Client<typeof MovePackageService>
state
Get Signature
get
protectedstate():Client<typeofStateService>
Defined in: sdk/grpc/src/client.ts:204
Returns
Client<typeof StateService>
Methods
executeTransaction()
executeTransaction(
transaction,options?):Promise<WithMetadata<ExecutedTransaction>>
Defined in: sdk/grpc/src/client.ts:632
Executes one signed transaction. Throws the node's error for it if it failed.
Parameters
transaction
options?
ExecuteOptions
Returns
Promise<WithMetadata<ExecutedTransaction>>
executeTransactions()
executeTransactions(
transactions,options?):Promise<WithMetadata<ItemResult<ExecutedTransaction>[]>>
Defined in: sdk/grpc/src/client.ts:647
Executes signed transactions, one result per transaction in request order. The node submits them concurrently, so a transaction cannot rely on another's effects in the same batch: send dependent ones in separate calls. A failure fails only its slot. Throws when the node answers with a different count or a different transaction at some position.
Parameters
transactions
readonly SignedTransaction[]
options?
ExecuteOptions
Returns
Promise<WithMetadata<ItemResult<ExecutedTransaction>[]>>
getCheckpoint()
getCheckpoint(
id?,options?):Promise<WithMetadata<{checkpoint:Checkpoint;events:Event[];kind:"checkpoint";sequenceNumber:bigint;transactions:ExecutedTransaction[]; }>>
Defined in: sdk/grpc/src/client.ts:372
The latest checkpoint, or the one with the given sequence number or digest.
Parameters
id?
{ sequenceNumber: bigint; } | { digest: string; }
options?
CheckpointOptions
Returns
Promise<WithMetadata<{ checkpoint: Checkpoint; events: Event[]; kind: "checkpoint"; sequenceNumber: bigint; transactions: ExecutedTransaction[]; }>>
getCoinInfo()
getCoinInfo(
coinType,options?):Promise<WithMetadata<GetCoinInfoResponse>>
Defined in: sdk/grpc/src/client.ts:588
Metadata, treasury and regulation info for a coin type such as 0x2::iota::IOTA.
Parameters
coinType
string
options?
signal?
AbortSignal
Returns
Promise<WithMetadata<GetCoinInfoResponse>>
getEpoch()
getEpoch(
options?):Promise<WithMetadata<Epoch>>
Defined in: sdk/grpc/src/client.ts:253
The given epoch, or the current one when epoch is omitted.
Parameters
options?
epoch?
bigint
readMask?
EpochField | readonly EpochField[]
signal?
AbortSignal
Returns
Promise<WithMetadata<Epoch>>
getHealth()
getHealth(
options?):Promise<WithMetadata<GetHealthResponse>>
Defined in: sdk/grpc/src/client.ts:223
Checks that the node is serving recent checkpoints. Throws a TransportError with code
UNAVAILABLE when its latest checkpoint is older than thresholdMs (server default: 5s).
Parameters
options?
signal?
AbortSignal
thresholdMs?
bigint
Returns
Promise<WithMetadata<GetHealthResponse>>
getObjects()
getObjects(
refs,options?):Promise<WithMetadata<ItemResult<Object$>[]>>
Defined in: sdk/grpc/src/client.ts:300
One result per ref, in request order. A missing object (never existed, deleted or pruned)
fails only its own slot with NOT_FOUND. Throws when the node answers with a different
count or a different object at some position.
Parameters
refs
readonly (string | { objectId: string; version?: bigint; })[]
options?
readMask?
ObjectField | readonly ObjectField[]
signal?
AbortSignal
Returns
Promise<WithMetadata<ItemResult<Object$>[]>>
getReferenceGasPrice()
getReferenceGasPrice(
options?):Promise<WithMetadata<bigint>>
Defined in: sdk/grpc/src/client.ts:276
The current epoch's reference gas price, in NANOS.
Parameters
options?
signal?
AbortSignal
Returns
Promise<WithMetadata<bigint>>
getServiceInfo()
getServiceInfo(
options?):Promise<WithMetadata<GetServiceInfoResponse>>
Defined in: sdk/grpc/src/client.ts:238
The node's chain, epoch, checkpoint heights and server version.
Parameters
options?
readMask?
ServiceInfoField | readonly ServiceInfoField[]
signal?
AbortSignal
Returns
Promise<WithMetadata<GetServiceInfoResponse>>
getTransactions()
getTransactions(
digests,options?):Promise<WithMetadata<ItemResult<ExecutedTransaction>[]>>
Defined in: sdk/grpc/src/client.ts:340
One result per digest, in request order. A transaction the node does not have fails only
its own slot with NOT_FOUND. Masks that include input or output objects, balance changes
or object changes fail a slot with FAILED_PRECONDITION once those objects are pruned.
Throws when the node answers with a different count or a different transaction at some
position.
Parameters
digests
readonly string[]
options?
readMask?
TransactionField | readonly TransactionField[]
signal?
AbortSignal
Returns
Promise<WithMetadata<ItemResult<ExecutedTransaction>[]>>
listAllCoins()
listAllCoins(
owner,options?):Promise<WithMetadata<Coin[]>>
Defined in: sdk/grpc/src/client.ts:548
listCoins across every page.
Parameters
owner
string
options?
CollectOptions & object
Returns
Promise<WithMetadata<Coin[]>>
listAllDynamicFields()
listAllDynamicFields(
parent,options?):Promise<WithMetadata<DynamicField[]>>
Defined in: sdk/grpc/src/client.ts:577
listDynamicFields across every page.
Parameters
parent
string
options?
CollectOptions & object
Returns
Promise<WithMetadata<DynamicField[]>>
listAllOwnedObjects()
listAllOwnedObjects(
owner,options?):Promise<WithMetadata<Object$[]>>
Defined in: sdk/grpc/src/client.ts:510
listOwnedObjects across every page.
Parameters
owner
string
options?
CollectOptions & object
Returns
Promise<WithMetadata<Object$[]>>
listAllPackageVersions()
listAllPackageVersions(
packageId,options?):Promise<WithMetadata<PackageVersion[]>>
Defined in: sdk/grpc/src/client.ts:621
listPackageVersions across every page.
Parameters
packageId
string
options?
CollectOptions
Returns
Promise<WithMetadata<PackageVersion[]>>
listCoins()
listCoins(
owner,options?):Promise<WithMetadata<Page<Coin>>>
Defined in: sdk/grpc/src/client.ts:527
Coins owned by an address, decoded. coinType is the T of Coin<T>, such as
0x2::iota::IOTA. Without it, coins of every type are listed.
Parameters
owner
string
options?
PageOptions & object
Returns
Promise<WithMetadata<Page<Coin>>>
listDynamicFields()
listDynamicFields(
parent,options?):Promise<WithMetadata<Page<DynamicField>>>
Defined in: sdk/grpc/src/client.ts:556
The dynamic fields a parent object owns.
Parameters
parent
string
options?
PageOptions & object
Returns
Promise<WithMetadata<Page<DynamicField>>>
listOwnedObjects()
listOwnedObjects(
owner,options?):Promise<WithMetadata<Page<Object$>>>
Defined in: sdk/grpc/src/client.ts:485
Objects owned by an address, optionally only those of objectType. A type with no type
parameters matches every instance: 0x2::coin::Coin lists each Coin<T>.
Parameters
owner
string
options?
PageOptions & object
Returns
Promise<WithMetadata<Page<Object$>>>
listPackageVersions()
listPackageVersions(
packageId,options?):Promise<WithMetadata<Page<PackageVersion>>>
Defined in: sdk/grpc/src/client.ts:601
Every version of a Move package, oldest first. packageId can be any version's ID.
Parameters
packageId
string
options?
PageOptions
Returns
Promise<WithMetadata<Page<PackageVersion>>>
simulateTransaction()
simulateTransaction(
transaction,options?):Promise<WithMetadata<SimulatedTransaction>>
Defined in: sdk/grpc/src/client.ts:687
Runs a transaction without committing it, to preview its effects. An empty gas payment is filled with a mock coin. Throws the node's error for it if it could not be simulated.
Parameters
transaction
options?
SimulateOptions
Returns
Promise<WithMetadata<SimulatedTransaction>>
simulateTransactions()
simulateTransactions(
transactions,options?):Promise<WithMetadata<ItemResult<SimulatedTransaction>[]>>
Defined in: sdk/grpc/src/client.ts:701
Simulates transactions, one result per transaction in request order. Each is simulated on its own against current state, so none sees another's effects. A failure fails only its slot. Throws when the node answers with a different count.
Parameters
transactions
readonly SimulateTransactionInput[]
options?
SimulateOptions
Returns
Promise<WithMetadata<ItemResult<SimulatedTransaction>[]>>
streamCheckpoints()
streamCheckpoints(
options?):StreamWithMetadata<CheckpointStreamItem>
Defined in: sdk/grpc/src/client.ts:423
Checkpoints from startSequenceNumber (default: the latest) up to endSequenceNumber
(default: unbounded, following the chain). With filterCheckpoints, only checkpoints with a
matching transaction or event are sent, and progress items report how far the node has
scanned in between. Nothing is requested until items is read.
Parameters
options?
CheckpointOptions & object
Returns
StreamWithMetadata<CheckpointStreamItem>
viewFunctionCall()
viewFunctionCall(
call,options?):Promise<WithMetadata<ViewFunctionCallOutputs>>
Defined in: sdk/grpc/src/client.ts:738
Calls a Move view function and reads back what it returns, without submitting a
transaction. A call that ran and aborted is not an error: it comes back with
executionResult.case === 'executionError'. Throws when the node refused to run it (an
unknown function, a wrong argument count, a function not declared #[view]).
Parameters
call
options?
ViewFunctionCallOptions
Returns
Promise<WithMetadata<ViewFunctionCallOutputs>>
viewFunctionCalls()
viewFunctionCalls(
calls,options?):Promise<WithMetadata<ItemResult<ViewFunctionCallOutputs>[]>>
Defined in: sdk/grpc/src/client.ts:756
Calls view functions, one result per call. Each runs in its own transaction, so a call the
node refused fails only its slot, and one that aborted still lands in an ok slot. Throws
when the node answers with a different count.
Parameters
calls
readonly ViewFunctionCall[]
options?
ViewFunctionCallOptions
Returns
Promise<WithMetadata<ItemResult<ViewFunctionCallOutputs>[]>>