@iota/graphql-transport 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @iota/graphql-transport
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 864fd32: Rename `getLatestIotaSystemState` to `getLatestIotaSystemStateV1` and add a new
8
+ backwards-compatible and future-proof `getLatestIotaSystemState` method that dynamically calls
9
+ ``getLatestIotaSystemStateV1`or`getLatestIotaSystemStateV2` based on the protocol version of the
10
+ node.
11
+
12
+ ### Patch Changes
13
+
14
+ - f5d40a4: Added type mapping for consensus_gc_depth field of ProtocolConfig
15
+ - Updated dependencies [f4d75c7]
16
+ - Updated dependencies [daa968f]
17
+ - Updated dependencies [864fd32]
18
+ - @iota/iota-sdk@1.0.0
19
+ - @iota/bcs@1.0.0
20
+
21
+ ## 0.4.0
22
+
23
+ ### Minor Changes
24
+
25
+ - bdb736e: Update clients after RPC updates to base64
26
+
27
+ ### Patch Changes
28
+
29
+ - 1ad39f9: Update dependencies
30
+ - Updated dependencies [42898f1]
31
+ - Updated dependencies [1ad39f9]
32
+ - Updated dependencies [bdb736e]
33
+ - Updated dependencies [65a0900]
34
+ - @iota/iota-sdk@0.7.0
35
+
3
36
  ## 0.3.0
4
37
 
5
38
  ### Minor Changes
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  `@iota/graphql-transport` is part of the **IOTA Rebased SDK**, designed specifically for interacting with the IOTA Rebased protocol.
4
4
 
5
- > **Note**: This package is currently supported **only in Testnet and Devnet**, it is **not yet supported in Mainnet**.
6
-
7
5
  This package provides a `IotaTransport` that enables `IotaClient` to make requests using the RPC 2.0
8
6
  (GraphQL) API instead of the JSON RPC API.
9
7
 
@@ -45,6 +43,9 @@ error, or fallback to the JSON RPC API if a `fallbackFullNodeUrl` is provided:
45
43
  - `dryRunTransactionBlock`
46
44
  - `devInspectTransactionBlock`
47
45
  - `executeTransactionBlock`
46
+ - `getParticipationMetrics`
47
+ - `getCirculatingSupply`
48
+ - `getDynamicFieldObjectV2`
48
49
 
49
50
  ### Unsupported parameters
50
51
 
@@ -67,7 +68,7 @@ If an unsupported parameter is used, the request will error, or fallback to JSON
67
68
  - missing `id` for `events`
68
69
  - `getStakes` and `getStakesByIds`
69
70
  - missing `validatorAddress`
70
- - `getLatestIotaSystemState`
71
+ - `getLatestIotaSystemState` and `getLatestIotaSystemStateV2`
71
72
  - missing `stakingPoolMappingsId`, `inactivePoolsId`, `pendingActiveValidatorsId`,
72
73
  `validatorCandidatesId`
73
74
  - missing `reportRecords` on validators
@@ -95,7 +96,7 @@ Some may require multiple requests to properly resolve:
95
96
  - may require additional requests to load all `friends`, `functions`, and `structs`
96
97
  - `getCheckpoint` and `getCheckpoints`,
97
98
  - may require additional requests to load all `transactionBlocks` and `validators`
98
- - `getLatestIotaSystemState`, `getCurrentEpoch`, `getValidatorsApy` and `getCommitteeInfo`:
99
+ - `getLatestIotaSystemState`,`getLatestIotaSystemStateV2`, `getCurrentEpoch`, `getValidatorsApy` and `getCommitteeInfo`:
99
100
  - may require additional requests to load all `validators`
100
101
 
101
102
  ### Pagination
@@ -628,7 +628,7 @@ const RPC_METHODS = {
628
628
  );
629
629
  return (0, import_stakes.mapGraphQLStakeToRpcStake)(stakes);
630
630
  },
631
- async getLatestIotaSystemState(transport) {
631
+ async getLatestIotaSystemStateV2(transport) {
632
632
  const systemState = await transport.graphqlQuery(
633
633
  {
634
634
  query: import_queries.GetLatestIotaSystemStateDocument
@@ -674,56 +674,68 @@ const RPC_METHODS = {
674
674
  afterCommitteeMembers = page.validatorSet?.committeeMembers?.pageInfo.endCursor;
675
675
  }
676
676
  return {
677
- activeValidators: systemState.validatorSet?.activeValidators?.nodes.map(
678
- import_validator.mapGraphQlValidatorToRpcValidator
679
- ),
680
- committeeMembers: systemState.validatorSet?.committeeMembers?.nodes?.map(
681
- import_validator.mapGraphQlValidatorToRpcValidator
682
- ),
683
- atRiskValidators: systemState.validatorSet?.activeValidators.nodes?.filter((validator) => validator.atRisk).map((validator) => [validator.address.address, validator.atRisk.toString()]),
684
- epoch: String(systemState.epochId),
685
- epochDurationMs: String(
686
- new Date(systemState.endTimestamp).getTime() - new Date(systemState.startTimestamp).getTime()
687
- ),
688
- epochStartTimestampMs: String(new Date(systemState.startTimestamp).getTime()),
689
- inactivePoolsSize: String(systemState.validatorSet?.inactivePoolsSize),
690
- iotaTotalSupply: String(systemState.iotaTotalSupply),
691
- iotaTreasuryCapId: String(systemState.iotaTreasuryCapId),
692
- maxValidatorCount: String(systemState.systemParameters?.maxValidatorCount),
693
- minValidatorCount: String(systemState.systemParameters?.minValidatorCount),
694
- minValidatorJoiningStake: String(
695
- systemState.systemParameters?.minValidatorJoiningStake
696
- ),
697
- pendingActiveValidatorsSize: String(
698
- systemState.validatorSet?.pendingActiveValidatorsSize
699
- ),
700
- pendingRemovals: systemState.validatorSet?.pendingRemovals?.map((idx) => String(idx)) ?? [],
701
- protocolVersion: String(systemState.protocolConfigs?.protocolVersion),
702
- referenceGasPrice: String(systemState.referenceGasPrice),
703
- safeMode: systemState.safeMode?.enabled,
704
- safeModeComputationRewards: String(systemState.safeMode?.gasSummary?.computationCost),
705
- safeModeNonRefundableStorageFee: String(
706
- systemState.safeMode?.gasSummary?.nonRefundableStorageFee
707
- ),
708
- safeModeStorageRebates: String(systemState.safeMode?.gasSummary?.storageRebate),
709
- safeModeStorageCharges: String(systemState.safeMode?.gasSummary?.storageCost),
710
- stakingPoolMappingsSize: String(systemState.validatorSet?.stakingPoolMappingsSize),
711
- storageFundNonRefundableBalance: String(systemState.storageFund?.nonRefundableBalance),
712
- storageFundTotalObjectStorageRebates: String(
713
- systemState.storageFund?.totalObjectStorageRebates
714
- ),
715
- systemStateVersion: String(systemState.systemStateVersion),
716
- totalStake: systemState.validatorSet?.totalStake,
717
- validatorCandidatesSize: systemState.validatorSet?.validatorCandidatesSize?.toString(),
718
- validatorLowStakeGracePeriod: systemState.systemParameters?.validatorLowStakeGracePeriod,
719
- validatorLowStakeThreshold: systemState.systemParameters?.validatorLowStakeThreshold,
720
- validatorReportRecords: [],
721
- // TODO
722
- validatorVeryLowStakeThreshold: systemState.systemParameters?.validatorVeryLowStakeThreshold,
723
- validatorCandidatesId: systemState.validatorSet?.validatorCandidatesId,
724
- inactivePoolsId: systemState.validatorSet?.inactivePoolsId,
725
- pendingActiveValidatorsId: systemState.validatorSet?.pendingActiveValidatorsId,
726
- stakingPoolMappingsId: systemState.validatorSet?.stakingPoolMappingsId
677
+ V2: {
678
+ activeValidators: systemState.validatorSet?.activeValidators?.nodes.map(
679
+ import_validator.mapGraphQlValidatorToRpcValidator
680
+ ),
681
+ committeeMembers: systemState.validatorSet?.committeeMembers?.nodes?.map(
682
+ (_, index) => index.toString()
683
+ ),
684
+ atRiskValidators: systemState.validatorSet?.activeValidators.nodes?.filter((validator) => validator.atRisk).map((validator) => [
685
+ validator.address.address,
686
+ validator.atRisk.toString()
687
+ ]),
688
+ epoch: String(systemState.epochId),
689
+ epochDurationMs: String(
690
+ new Date(systemState.endTimestamp).getTime() - new Date(systemState.startTimestamp).getTime()
691
+ ),
692
+ epochStartTimestampMs: String(new Date(systemState.startTimestamp).getTime()),
693
+ inactivePoolsSize: String(systemState.validatorSet?.inactivePoolsSize),
694
+ iotaTotalSupply: String(systemState.iotaTotalSupply),
695
+ iotaTreasuryCapId: String(systemState.iotaTreasuryCapId),
696
+ maxValidatorCount: String(systemState.systemParameters?.maxValidatorCount),
697
+ minValidatorCount: String(systemState.systemParameters?.minValidatorCount),
698
+ minValidatorJoiningStake: String(
699
+ systemState.systemParameters?.minValidatorJoiningStake
700
+ ),
701
+ pendingActiveValidatorsSize: String(
702
+ systemState.validatorSet?.pendingActiveValidatorsSize
703
+ ),
704
+ pendingRemovals: systemState.validatorSet?.pendingRemovals?.map((idx) => String(idx)) ?? [],
705
+ protocolVersion: String(systemState.protocolConfigs?.protocolVersion),
706
+ referenceGasPrice: String(systemState.referenceGasPrice),
707
+ safeMode: systemState.safeMode?.enabled,
708
+ safeModeComputationCharges: String(
709
+ systemState.safeMode?.gasSummary?.computationCost
710
+ ),
711
+ safeModeComputationChargesBurned: String(
712
+ systemState.safeMode?.gasSummary?.computationCostBurned
713
+ ),
714
+ safeModeNonRefundableStorageFee: String(
715
+ systemState.safeMode?.gasSummary?.nonRefundableStorageFee
716
+ ),
717
+ safeModeStorageRebates: String(systemState.safeMode?.gasSummary?.storageRebate),
718
+ safeModeStorageCharges: String(systemState.safeMode?.gasSummary?.storageCost),
719
+ stakingPoolMappingsSize: String(systemState.validatorSet?.stakingPoolMappingsSize),
720
+ storageFundNonRefundableBalance: String(
721
+ systemState.storageFund?.nonRefundableBalance
722
+ ),
723
+ storageFundTotalObjectStorageRebates: String(
724
+ systemState.storageFund?.totalObjectStorageRebates
725
+ ),
726
+ systemStateVersion: String(systemState.systemStateVersion),
727
+ totalStake: systemState.validatorSet?.totalStake,
728
+ validatorCandidatesSize: systemState.validatorSet?.validatorCandidatesSize?.toString(),
729
+ validatorLowStakeGracePeriod: systemState.systemParameters?.validatorLowStakeGracePeriod,
730
+ validatorLowStakeThreshold: systemState.systemParameters?.validatorLowStakeThreshold,
731
+ validatorReportRecords: [],
732
+ // TODO
733
+ validatorVeryLowStakeThreshold: systemState.systemParameters?.validatorVeryLowStakeThreshold,
734
+ validatorCandidatesId: systemState.validatorSet?.validatorCandidatesId,
735
+ inactivePoolsId: systemState.validatorSet?.inactivePoolsId,
736
+ pendingActiveValidatorsId: systemState.validatorSet?.pendingActiveValidatorsId,
737
+ stakingPoolMappingsId: systemState.validatorSet?.stakingPoolMappingsId
738
+ }
727
739
  };
728
740
  },
729
741
  async queryEvents(transport, [query, cursor, limit, descending]) {
@@ -1210,7 +1222,8 @@ const RPC_METHODS = {
1210
1222
  binary_field_instantiations: "u16",
1211
1223
  binary_friend_decls: "u16",
1212
1224
  max_package_dependencies: "u32",
1213
- bridge_should_try_to_finalize_committee: "bool"
1225
+ bridge_should_try_to_finalize_committee: "bool",
1226
+ consensus_gc_depth: "u32"
1214
1227
  };
1215
1228
  for (const { key, value } of protocolConfig.configs) {
1216
1229
  attributes[key] = value === null ? null : {