diff --git a/packages/rpc-graphql/src/__tests__/__setup__.ts b/packages/rpc-graphql/src/__tests__/__setup__.ts index bf2ca9df7c11..bd184f65d3bf 100644 --- a/packages/rpc-graphql/src/__tests__/__setup__.ts +++ b/packages/rpc-graphql/src/__tests__/__setup__.ts @@ -2586,6 +2586,21 @@ export const mockTransactionToken2022AllExtensions = { programId: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', stackHeight: null, }, + { + parsed: { + info: { + group: 'FsHcsGiY43QmZc6yTgwYC1DA5U3ZgycXxn3bd2oBjrEZ', + maxSize: 22, + mintAuthority: '2Pwe6Yahh5cbzvCwRMtTYFeboSwYiWeHhYJzZZBsU6eB', + updateAuthority: 'FsHcsGiY43QmZc6yTgwYC1DA5U3ZgycXxn3bd2oBjrEZ', + mint: '2Pwe6Yahh5cbzvCwRMtTYFeboSwYiWeHhYJzZZBsU6eB', + }, + type: 'initializeTokenGroup', + }, + program: 'spl-token', + programId: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', + stackHeight: null, + }, // TODO (more) ... ], recentBlockhash: '6vRS7MoToVccMqfQecdVC6UbmARaT5mha91zhreqnce9', diff --git a/packages/rpc-graphql/src/__tests__/transaction-tests.ts b/packages/rpc-graphql/src/__tests__/transaction-tests.ts index 0f0d7fa846fe..c0162865f14c 100644 --- a/packages/rpc-graphql/src/__tests__/transaction-tests.ts +++ b/packages/rpc-graphql/src/__tests__/transaction-tests.ts @@ -3334,6 +3334,63 @@ describe('transaction', () => { }, }); }); + + it('initialize-token-group', async () => { + expect.assertions(1); + const source = /* GraphQL */ ` + query testQuery($signature: Signature!) { + transaction(signature: $signature) { + message { + instructions { + programId + ... on SplTokenGroupInitializeGroup { + group { + address + } + maxSize + mint { + address + } + mintAuthority { + address + } + updateAuthority { + address + } + } + } + } + } + } + `; + const result = await rpcGraphQL.query(source, { signature }); + expect(result).toMatchObject({ + data: { + transaction: { + message: { + instructions: expect.arrayContaining([ + { + group: { + address: expect.any(String), + }, + maxSize: expect.any(BigInt), + mint: { + address: expect.any(String), + }, + mintAuthority: { + address: expect.any(String), + }, + programId: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', + updateAuthority: { + address: expect.any(String), + }, + }, + ]), + }, + }, + }, + }); + }); }); }); }); diff --git a/packages/rpc-graphql/src/resolvers/instruction.ts b/packages/rpc-graphql/src/resolvers/instruction.ts index cb7296817f4c..aca2eb351974 100644 --- a/packages/rpc-graphql/src/resolvers/instruction.ts +++ b/packages/rpc-graphql/src/resolvers/instruction.ts @@ -290,6 +290,12 @@ export const instructionResolvers = { SplTokenGetAccountDataSizeInstruction: { mint: resolveAccount('mint'), }, + SplTokenGroupInitializeGroup: { + group: resolveAccount('group'), + mint: resolveAccount('mint'), + mintAuthority: resolveAccount('mintAuthority'), + updateAuthority: resolveAccount('updateAuthority'), + }, SplTokenHarvestWithheldConfidentialTransferTokensToMint: { mint: resolveAccount('mint'), }, @@ -882,6 +888,9 @@ export const instructionResolvers = { if (jsonParsedConfigs.instructionType === 'initializeConfidentialTransferFeeConfig') { return 'SplTokenInitializeConfidentialTransferFeeConfig'; } + if (jsonParsedConfigs.instructionType === 'initializeTokenGroup') { + return 'SplTokenGroupInitializeGroup'; + } } if (jsonParsedConfigs.programName === 'stake') { if (jsonParsedConfigs.instructionType === 'initialize') { diff --git a/packages/rpc-graphql/src/schema/instruction.ts b/packages/rpc-graphql/src/schema/instruction.ts index 8d1a60cf0dd0..9fa56f84c217 100644 --- a/packages/rpc-graphql/src/schema/instruction.ts +++ b/packages/rpc-graphql/src/schema/instruction.ts @@ -1014,6 +1014,18 @@ export const instructionTypeDefs = /* GraphQL */ ` withheldAmount: String } + """ + Spl Token Group: InitializeGroup instruction + """ + type SplTokenGroupInitializeGroup implements TransactionInstruction { + programId: Address + group: Account + maxSize: BigInt + mint: Account + mintAuthority: Account + updateAuthority: Account + } + type Lockup { custodian: Account epoch: Epoch