@iota/graphql-transport is part of the IOTA Rebased SDK, designed specifically for interacting with the IOTA Rebased protocol.
This package provides a IotaTransport that enables IotaClient to make requests using the RPC 2.0
(GraphQL) API instead of the JSON RPC API.
npm install --save @iota/graphql-transportimport { IotaClientGraphQLTransport } from '@iota/graphql-transport';
import { getFullnodeUrl, getGraphQLUrl, IotaClient } from '@iota/iota-sdk/client';
const client = new IotaClient({
transport: new IotaClientGraphQLTransport({
url: getGraphQLUrl('testnet'),
// When specified, the transport will fallback to JSON RPC for unsupported method and parameters
fallbackFullNodeUrl: getFullnodeUrl('testnet'),
}),
});The following methods are currently unsupported in IotaClientGraphQLTransport, and will either
error, or fallback to the JSON RPC API if a fallbackFullNodeUrl is provided:
subscribeTransactionsubscribeEventscallgetNetworkMetricsgetMoveCallMetricsgetAddressMetricsgetEpochsdryRunTransactionBlockdevInspectTransactionBlockexecuteTransactionBlockgetParticipationMetricsgetCirculatingSupply
Some supported methods in IotaClientGraphQLTransport do not support the full set of parameters
available in the JSON RPC API.
If an unsupported parameter is used, the request will error, or fallback to JSON RPC API if a
fallbackFullNodeUrl is provided.
getOwnedObjects:- missing the
MatchAll,MatchAny,MatchNone, andVersionfilters
- missing the
queryEvents:- missing the
MoveEventField,Module,TimeRange,All,Any,And, andOrfilters
- missing the
queryTransactionBlocks,getTransactionBlock, andmultiGetTransactionBlocks- missing
messageVersion,eventsDigest,sharedObjects,unwrapped,wrapped, andunwrappedThenDeletedin effects - missing
idforevents
- missing
getStakesandgetStakesByIds- missing
validatorAddress
- missing
getLatestIotaSystemStateandgetLatestIotaSystemStateV2- missing
stakingPoolMappingsId,inactivePoolsId,pendingActiveValidatorsId,validatorCandidatesId - missing
reportRecordson validators
- missing
getCurrentEpoch- missing
reportRecordson validators
- missing
queryEvents- missing
idforevents
- missing
getCheckpointandgetCheckpoints- missing
checkpointCommitments
- missing
getCurrentEpoch- missing
epochTotalTransactions
- missing
getDynamicFields- missing
objectId,digestandversionavailable forDynamicObjectbut notDynamicField
- missing
Some may require multiple requests to properly resolve:
getDynamicFieldObjectrequires 2 requestsqueryTransactionBlocks,getTransactionBlock, andmultiGetTransactionBlocks- may require additional requests to load all
objectChanges,balanceChanges,dependenciesandevents
- may require additional requests to load all
getNormalizedMoveModuleandgetNormalizedMoveModulesByPage- may require additional requests to load all
friends,functions, andstructs
- may require additional requests to load all
getCheckpointandgetCheckpoints,- may require additional requests to load all
transactionBlocksandvalidators
- may require additional requests to load all
getLatestIotaSystemState,getLatestIotaSystemStateV2,getCurrentEpoch,getValidatorsApyandgetCommitteeInfo:- may require additional requests to load all
validators
- may require additional requests to load all
Page sizes and limits for paginated methods are based on the defaults and limits of the GraphQL API, so page sizes and limits may be different than those returned by the JSON RPC API