Skip to content

Commit

Permalink
feat(tooling-sdk): Sync json/graphql rpc schema changes to TS SDK (#3637
Browse files Browse the repository at this point in the history
)

* feat(tooling-sdk): Sync json/graphql rpc schema changes to TS SDK

* fix: replace protocolPubKey with authorityPubKey

---------

Co-authored-by: Begoña Alvarez <[email protected]>
  • Loading branch information
msarcev and begonaalvarezd authored Oct 24, 2024
1 parent 4db2c12 commit 3dd596f
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 77 deletions.
32 changes: 13 additions & 19 deletions sdk/graphql-transport/src/generated/queries.ts

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions sdk/graphql-transport/src/mappers/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ export function mapGraphQlValidatorToRpcValidator(
nextEpochP2pAddress: validator.nextEpochCredentials?.p2PAddress,
nextEpochPrimaryAddress: validator.nextEpochCredentials?.primaryAddress,
nextEpochProofOfPossession: validator.nextEpochCredentials?.proofOfPossession,
nextEpochProtocolPubkeyBytes: validator.nextEpochCredentials?.protocolPubKey,
nextEpochAuthorityPubkeyBytes: validator.nextEpochCredentials?.authorityPubKey,
nextEpochStake: validator.nextEpochStake!,
nextEpochWorkerAddress: validator.nextEpochCredentials?.workerAddress,
nextEpochWorkerPubkeyBytes: validator.nextEpochCredentials?.workerPubKey,
nextEpochProtocolPubkeyBytes: validator.nextEpochCredentials?.protocolPubKey,
operationCapId: validator.operationCap?.address!,
p2pAddress: validator.credentials?.p2PAddress!,
pendingTotalIotaWithdraw: validator.pendingTotalIotaWithdraw,
Expand All @@ -39,14 +38,13 @@ export function mapGraphQlValidatorToRpcValidator(
primaryAddress: validator.credentials?.primaryAddress!,
projectUrl: validator.projectUrl!,
proofOfPossessionBytes: validator.credentials?.proofOfPossession,
authorityPubkeyBytes: validator.credentials?.authorityPubKey,
protocolPubkeyBytes: validator.credentials?.protocolPubKey,
rewardsPool: validator.rewardsPool,
stakingPoolId: validator.stakingPool?.address!,
stakingPoolActivationEpoch: validator.stakingPoolActivationEpoch?.toString(),
stakingPoolIotaBalance: validator.stakingPoolIotaBalance,
iotaAddress: validator.address.address,
votingPower: validator.votingPower?.toString()!,
workerAddress: validator.credentials?.workerAddress!,
workerPubkeyBytes: validator.credentials?.workerPubKey,
};
}
2 changes: 1 addition & 1 deletion sdk/graphql-transport/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ export const RPC_METHODS: {
return {
epoch: epochId.toString(),
validators: validatorSet?.activeValidators?.nodes.map((val) => [
val.credentials?.protocolPubKey!,
val.credentials?.authorityPubKey!,
String(val.votingPower),
])!,
};
Expand Down
2 changes: 1 addition & 1 deletion sdk/graphql-transport/src/queries/getCommitteeInfo.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ query getCommitteeInfo($epochId: UInt53, $after: String) {
}
nodes {
credentials {
protocolPubKey
authorityPubKey
}
votingPower
}
Expand Down
3 changes: 1 addition & 2 deletions sdk/graphql-transport/src/queries/getCurrentEpoch.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ fragment RPC_CREDENTIAL_FIELDS on ValidatorCredentials {
networkPubKey
p2PAddress
primaryAddress
workerPubKey
workerAddress
authorityPubKey
proofOfPossession
protocolPubKey
}
98 changes: 60 additions & 38 deletions sdk/move-bytecode-template/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions sdk/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@
"eslint:fix": "pnpm run eslint:check --fix",
"lint": "pnpm run eslint:check && pnpm run prettier:check",
"lint:fix": "pnpm run eslint:fix && pnpm run prettier:fix",
"update-graphql-schema": "pnpm run generate-schema -c src/graphql/generated/2024.10/tsconfig.tada.json",
"update-graphql-schemas": "pnpm tsx scripts/update-graphql-schemas.ts",
"update-open-rpc-schema": "pnpm tsx scripts/generate.ts",
"update-open-rpc-client-types": "pnpm tsx scripts/generate.ts",
"generate-schema": "gql.tada generate-output"
},
"bugs": {
Expand Down
8 changes: 3 additions & 5 deletions sdk/typescript/src/client/types/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ export type IotaTransactionBlockBuilderMode = 'Commit' | 'DevInspect';
* fields so that they are decoupled from the internal definitions.
*/
export interface IotaValidatorSummary {
authorityPubkeyBytes: string;
commissionRate: string;
description: string;
/** ID of the exchange rate table object. */
Expand All @@ -812,6 +813,7 @@ export interface IotaValidatorSummary {
name: string;
netAddress: string;
networkPubkeyBytes: string;
nextEpochAuthorityPubkeyBytes?: string | null;
nextEpochCommissionRate: string;
nextEpochGasPrice: string;
nextEpochNetAddress?: string | null;
Expand All @@ -821,8 +823,6 @@ export interface IotaValidatorSummary {
nextEpochProofOfPossession?: string | null;
nextEpochProtocolPubkeyBytes?: string | null;
nextEpochStake: string;
nextEpochWorkerAddress?: string | null;
nextEpochWorkerPubkeyBytes?: string | null;
operationCapId: string;
p2pAddress: string;
/** Pending pool token withdrawn during the current epoch, emptied at epoch boundaries. */
Expand All @@ -848,8 +848,6 @@ export interface IotaValidatorSummary {
/** The total number of IOTA tokens in this pool. */
stakingPoolIotaBalance: string;
votingPower: string;
workerAddress: string;
workerPubkeyBytes: string;
}
export interface MoveCallMetrics {
/** The count of calls of each function in the last 30 days. */
Expand Down Expand Up @@ -1114,7 +1112,7 @@ export type ObjectResponseError =
code: 'unknown';
}
| {
code: 'displayError';
code: 'display';
error: string;
};
export interface IotaObjectResponseQuery {
Expand Down
5 changes: 2 additions & 3 deletions sdk/typescript/src/graphql/generated/2024.10/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3dd596f

Please sign in to comment.