diff --git a/packages/rpc-graphql/src/__tests__/transaction-tests.ts b/packages/rpc-graphql/src/__tests__/transaction-tests.ts index 842311b277b3..8efd5a56e727 100644 --- a/packages/rpc-graphql/src/__tests__/transaction-tests.ts +++ b/packages/rpc-graphql/src/__tests__/transaction-tests.ts @@ -841,6 +841,60 @@ describe('transaction', () => { }, }); }); + + it('initialize-transferFee-config', async () => { + expect.assertions(1); + const source = /* GraphQL */ ` + query testQuery($signature: Signature!) { + transaction(signature: $signature) { + message { + instructions { + programId + ... on SplTokenInitializeTransferFeeConfig { + mint { + address + } + transferFeeBasisPoints + maximumFee + transferFeeConfigAuthority { + address + } + withdrawWithheldAuthority { + address + } + } + } + } + } + } + `; + + const result = await rpcGraphQL.query(source, { signature }); + expect(result).toMatchObject({ + data: { + transaction: { + message: { + instructions: expect.arrayContaining([ + { + maximumFee: expect.any(Number), + mint: { + address: expect.any(String), + }, + programId: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', + transferFeeBasisPoints: expect.any(Number), + transferFeeConfigAuthority: { + address: expect.any(String), + }, + withdrawWithheldAuthority: { + address: expect.any(String), + }, + }, + ]), + }, + }, + }, + }); + }); }); }); }); diff --git a/packages/rpc-graphql/src/resolvers/instruction.ts b/packages/rpc-graphql/src/resolvers/instruction.ts index 1906be5a0d82..80589855b709 100644 --- a/packages/rpc-graphql/src/resolvers/instruction.ts +++ b/packages/rpc-graphql/src/resolvers/instruction.ts @@ -239,6 +239,11 @@ export const instructionResolvers = { delegate: resolveAccount('delegate'), mint: resolveAccount('mint'), }, + SplTokenInitializeTransferFeeConfig: { + mint: resolveAccount('mint'), + transferFeeConfigAuthority: resolveAccount('transferFeeConfigAuthority'), + withdrawWithheldAuthority: resolveAccount('withdrawWithheldAuthority'), + }, SplTokenMintToCheckedInstruction: { account: resolveAccount('account'), authority: resolveAccount('authority'), @@ -547,6 +552,9 @@ export const instructionResolvers = { if (jsonParsedConfigs.instructionType === 'updateMetadataPointer') { return 'SplTokenUpdateMetadataPointerInstruction'; } + if (jsonParsedConfigs.instructionType === 'initializeTransferFeeConfig') { + return 'SplTokenInitializeTransferFeeConfig'; + } } 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 b3d8865027a0..c0fc11cd1c96 100644 --- a/packages/rpc-graphql/src/schema/instruction.ts +++ b/packages/rpc-graphql/src/schema/instruction.ts @@ -541,6 +541,18 @@ export const instructionTypeDefs = /* GraphQL */ ` mint: Account } + """ + SplToken-2022: InitializeTransferFeeConfig instruction + """ + type SplTokenInitializeTransferFeeConfig implements TransactionInstruction { + programId: Address + mint: Account + transferFeeBasisPoints: Int + transferFeeConfigAuthority: Account + withdrawWithheldAuthority: Account + maximumFee: Int + } + # TODO: Extensions! # ...