@solana/rpc-graphql 2.0.0-experimental.a9e6db3 → 2.0.0-experimental.aa4a701

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.
Files changed (44) hide show
  1. package/README.md +1088 -30
  2. package/dist/index.browser.cjs +2729 -1885
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +2725 -1886
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.native.js +2725 -1886
  7. package/dist/index.native.js.map +1 -1
  8. package/dist/index.node.cjs +2729 -1885
  9. package/dist/index.node.cjs.map +1 -1
  10. package/dist/index.node.js +2725 -1886
  11. package/dist/index.node.js.map +1 -1
  12. package/dist/types/context.d.ts +17 -14
  13. package/dist/types/loaders/account.d.ts +28 -0
  14. package/dist/types/loaders/block.d.ts +6 -0
  15. package/dist/types/loaders/common/resolve-info.d.ts +3 -0
  16. package/dist/types/loaders/program-accounts.d.ts +6 -0
  17. package/dist/types/loaders/transaction.d.ts +16 -0
  18. package/dist/types/resolvers/account.d.ts +8 -0
  19. package/dist/types/rpc.d.ts +7 -2
  20. package/dist/types/schema/account.d.ts +124 -0
  21. package/dist/types/schema/block.d.ts +17 -0
  22. package/dist/types/schema/common/inputs.d.ts +10 -0
  23. package/dist/types/schema/common/scalars.d.ts +13 -0
  24. package/dist/types/schema/common/types.d.ts +12 -0
  25. package/dist/types/schema/index.d.ts +2 -0
  26. package/dist/types/schema/instruction.d.ts +954 -0
  27. package/dist/types/schema/program-accounts.d.ts +12 -0
  28. package/dist/types/schema/transaction.d.ts +16 -0
  29. package/package.json +16 -11
  30. package/dist/types/schema/account/index.d.ts +0 -3
  31. package/dist/types/schema/account/query.d.ts +0 -38
  32. package/dist/types/schema/account/types.d.ts +0 -5
  33. package/dist/types/schema/block/index.d.ts +0 -3
  34. package/dist/types/schema/block/query.d.ts +0 -42
  35. package/dist/types/schema/block/types.d.ts +0 -7
  36. package/dist/types/schema/inputs.d.ts +0 -9
  37. package/dist/types/schema/picks.d.ts +0 -36
  38. package/dist/types/schema/program-accounts/index.d.ts +0 -2
  39. package/dist/types/schema/program-accounts/query.d.ts +0 -47
  40. package/dist/types/schema/program-accounts/types.d.ts +0 -3
  41. package/dist/types/schema/scalars.d.ts +0 -3
  42. package/dist/types/schema/transaction/index.d.ts +0 -3
  43. package/dist/types/schema/transaction/query.d.ts +0 -33
  44. package/dist/types/schema/transaction/types.d.ts +0 -12
@@ -1,4 +1,7 @@
1
- import { GraphQLSchema, GraphQLObjectType, graphql, GraphQLList, GraphQLBoolean, GraphQLString, GraphQLNonNull, GraphQLEnumType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLScalarType, Kind, GraphQLInt, GraphQLUnionType } from 'graphql';
1
+ import { graphql, Kind } from 'graphql';
2
+ import DataLoader from 'dataloader';
3
+ import fastStableStringify from 'fast-stable-stringify';
4
+ import { makeExecutableSchema } from '@graphql-tools/schema';
2
5
 
3
6
  // src/rpc.ts
4
7
 
@@ -33,43 +36,271 @@ function createGraphQLCache() {
33
36
  };
34
37
  }
35
38
 
36
- // src/context.ts
37
- async function resolveAccount({ address, encoding = "jsonParsed", ...config }, cache, rpc) {
38
- const requestConfig = { encoding, ...config };
39
- const cached = cache.get(address, requestConfig);
39
+ // src/loaders/common/resolve-info.ts
40
+ function onlyPresentFieldRequested(fieldName, info) {
41
+ if (info && info.fieldNodes[0].selectionSet) {
42
+ const selectionSet = info.fieldNodes[0].selectionSet;
43
+ const requestedFields = selectionSet.selections.map((field) => {
44
+ if (field.kind === "Field") {
45
+ return field.name.value;
46
+ }
47
+ return null;
48
+ });
49
+ if (requestedFields && requestedFields.length === 1 && requestedFields[0] === fieldName) {
50
+ return true;
51
+ }
52
+ }
53
+ return false;
54
+ }
55
+
56
+ // src/loaders/account.ts
57
+ function normalizeArgs(args) {
58
+ const { address, commitment, dataSlice, encoding, minContextSlot } = args;
59
+ return {
60
+ address,
61
+ commitment: commitment ?? "confirmed",
62
+ dataSlice,
63
+ encoding: encoding ?? "jsonParsed",
64
+ minContextSlot
65
+ };
66
+ }
67
+ function refineJsonParsedAccountData(jsonParsedAccountData) {
68
+ const meta = {
69
+ program: jsonParsedAccountData.program,
70
+ space: jsonParsedAccountData.space,
71
+ type: jsonParsedAccountData.parsed.type
72
+ };
73
+ const data = jsonParsedAccountData.parsed.info;
74
+ return { data, meta };
75
+ }
76
+ function processQueryResponse({ address, account, encoding }) {
77
+ const [refinedData, responseEncoding] = Array.isArray(account.data) ? encoding === "jsonParsed" ? [account.data[0], "base64"] : [account.data[0], encoding] : [refineJsonParsedAccountData(account.data), "jsonParsed"];
78
+ const responseBase = {
79
+ ...account,
80
+ address,
81
+ encoding: responseEncoding
82
+ };
83
+ return typeof refinedData === "object" && "meta" in refinedData ? {
84
+ ...responseBase,
85
+ data: refinedData.data,
86
+ meta: refinedData.meta
87
+ } : {
88
+ ...responseBase,
89
+ data: refinedData
90
+ };
91
+ }
92
+ async function loadAccount(rpc, { address, ...config }) {
93
+ const { encoding } = config;
94
+ const account = await rpc.getAccountInfo(address, config).send().then((res) => res.value).catch((e) => {
95
+ throw e;
96
+ });
97
+ if (account === null) {
98
+ return { address };
99
+ }
100
+ return processQueryResponse({ account, address, encoding });
101
+ }
102
+ function createAccountBatchLoadFn(rpc) {
103
+ const resolveAccountUsingRpc = loadAccount.bind(null, rpc);
104
+ return async (accountQueryArgs) => {
105
+ return await Promise.all(accountQueryArgs.map(async (args) => await resolveAccountUsingRpc(args)));
106
+ };
107
+ }
108
+ function createAccountLoader(rpc) {
109
+ const loader = new DataLoader(createAccountBatchLoadFn(rpc), { cacheKeyFn: fastStableStringify });
110
+ return {
111
+ load: async (args, info) => {
112
+ if (onlyPresentFieldRequested("address", info)) {
113
+ return { address: args.address };
114
+ }
115
+ return loader.load(normalizeArgs(args));
116
+ }
117
+ };
118
+ }
119
+
120
+ // src/loaders/transaction.ts
121
+ function normalizeArgs2(args) {
122
+ const { commitment, encoding } = args;
123
+ return {
124
+ commitment: commitment ?? "confirmed",
125
+ encoding: encoding ?? "jsonParsed",
126
+ // Always use 0 to avoid silly errors
127
+ maxSupportedTransactionVersion: 0
128
+ };
129
+ }
130
+ function refineJsonParsedInstructionData(jsonParsedInstructionData) {
131
+ if ("parsed" in jsonParsedInstructionData) {
132
+ const meta = {
133
+ program: jsonParsedInstructionData.program,
134
+ type: jsonParsedInstructionData.parsed.type
135
+ };
136
+ const programId = jsonParsedInstructionData.programId;
137
+ const data = jsonParsedInstructionData.parsed.info;
138
+ return { data, meta, programId };
139
+ } else {
140
+ return jsonParsedInstructionData;
141
+ }
142
+ }
143
+ function refineJsonParsedTransactionData(jsonParsedTransactionData) {
144
+ const refinedInstructions = jsonParsedTransactionData.message.instructions.map(
145
+ (instruction) => refineJsonParsedInstructionData(instruction)
146
+ );
147
+ const message = {
148
+ ...jsonParsedTransactionData.message,
149
+ instructions: refinedInstructions
150
+ };
151
+ return { message, signatures: jsonParsedTransactionData.signatures };
152
+ }
153
+ function refineJsonParsedTransactionMeta(jsonParsedTransactionMeta) {
154
+ const refinedInnerInstructions = jsonParsedTransactionMeta.innerInstructions.map(
155
+ ({ index, instructions }) => {
156
+ return {
157
+ index,
158
+ instructions: instructions.map((instruction) => refineJsonParsedInstructionData(instruction))
159
+ };
160
+ }
161
+ );
162
+ return {
163
+ ...jsonParsedTransactionMeta,
164
+ innerInstructions: refinedInnerInstructions
165
+ };
166
+ }
167
+ function refineJsonParsedTransaction({ encoding, transaction }) {
168
+ const [transactionData, transactionMeta] = Array.isArray(transaction.transaction) ? [transaction.transaction[0], transaction.meta] : [refineJsonParsedTransactionData(transaction.transaction), refineJsonParsedTransactionMeta(transaction.meta)];
169
+ return {
170
+ data: transactionData,
171
+ encoding,
172
+ meta: transactionMeta,
173
+ slot: transaction.slot,
174
+ version: transaction.version
175
+ };
176
+ }
177
+ function processQueryResponse2({ encoding, transaction }) {
178
+ return refineJsonParsedTransaction({ encoding, transaction });
179
+ }
180
+ async function loadTransaction({ signature, ...config }, cache, rpc, _info) {
181
+ const requestConfig = normalizeArgs2(config);
182
+ const { encoding } = requestConfig;
183
+ const cached = cache.get(signature, requestConfig);
40
184
  if (cached !== null) {
41
185
  return cached;
42
186
  }
43
- const account = await rpc.getAccountInfo(address, requestConfig).send().then((res) => res.value).catch((e) => {
187
+ let transaction = await rpc.getTransaction(signature, requestConfig).send().catch((e) => {
44
188
  throw e;
45
189
  });
46
- if (account === null) {
190
+ if (transaction === null) {
47
191
  return null;
48
192
  }
49
- const [data, responseEncoding] = Array.isArray(account.data) ? encoding === "jsonParsed" ? [account.data[0], "base64"] : [account.data[0], encoding] : [account.data, "jsonParsed"];
50
- const queryResponse = {
51
- ...account,
52
- data,
53
- encoding: responseEncoding
54
- };
55
- cache.insert(address, requestConfig, queryResponse);
193
+ if (encoding !== "jsonParsed") {
194
+ const transactionJsonParsed = await rpc.getTransaction(signature, requestConfig).send().catch((e) => {
195
+ throw e;
196
+ });
197
+ if (transactionJsonParsed === null) {
198
+ return null;
199
+ }
200
+ transaction = {
201
+ ...transaction,
202
+ meta: transactionJsonParsed.meta
203
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
204
+ };
205
+ }
206
+ const queryResponse = processQueryResponse2({ encoding, transaction });
207
+ cache.insert(signature, requestConfig, queryResponse);
56
208
  return queryResponse;
57
209
  }
58
- async function resolveBlock({ slot, encoding = "jsonParsed", ...config }, cache, rpc) {
59
- const requestConfig = { encoding, ...config };
210
+
211
+ // src/loaders/block.ts
212
+ function normalizeArgs3(args) {
213
+ const { commitment, encoding, transactionDetails } = args;
214
+ return {
215
+ commitment: commitment ?? "confirmed",
216
+ encoding: encoding ?? "jsonParsed",
217
+ // Always use 0 to avoid silly errors
218
+ maxSupportedTransactionVersion: 0,
219
+ transactionDetails: transactionDetails ?? "full"
220
+ };
221
+ }
222
+ function refineJsonParsedTransactionForAccounts({ transaction }) {
223
+ return {
224
+ data: transaction.transaction,
225
+ meta: transaction.meta,
226
+ version: transaction.version
227
+ };
228
+ }
229
+ function processQueryResponse3({
230
+ encoding,
231
+ block,
232
+ transactionDetails
233
+ }) {
234
+ if (typeof block === "object" && "transactions" in block) {
235
+ const refinedBlock = {
236
+ ...block,
237
+ transactions: block.transactions.map((transaction) => {
238
+ if (transactionDetails === "accounts") {
239
+ return refineJsonParsedTransactionForAccounts({ transaction });
240
+ } else {
241
+ return refineJsonParsedTransaction({ encoding, transaction });
242
+ }
243
+ })
244
+ };
245
+ block = refinedBlock;
246
+ }
247
+ return {
248
+ ...block,
249
+ encoding,
250
+ transactionDetails
251
+ };
252
+ }
253
+ async function loadBlock({ slot, ...config }, cache, rpc, _info) {
254
+ const requestConfig = normalizeArgs3(config);
255
+ const { encoding, transactionDetails } = requestConfig;
60
256
  const cached = cache.get(slot, config);
61
257
  if (cached !== null) {
62
258
  return cached;
63
259
  }
64
- const block = await rpc.getBlock(slot, requestConfig).send();
260
+ const block = await rpc.getBlock(slot, requestConfig).send().catch((e) => {
261
+ throw e;
262
+ });
65
263
  if (block === null) {
66
- return null;
264
+ return { slot };
67
265
  }
68
- cache.insert(slot, config, block);
69
- return block;
266
+ const queryResponse = processQueryResponse3({ block, encoding, transactionDetails });
267
+ cache.insert(slot, requestConfig, queryResponse);
268
+ return queryResponse;
269
+ }
270
+
271
+ // src/loaders/program-accounts.ts
272
+ function normalizeArgs4(args) {
273
+ const { commitment, dataSlice, encoding, filters, minContextSlot } = args;
274
+ return {
275
+ commitment: commitment ?? "confirmed",
276
+ dataSlice,
277
+ encoding: encoding ?? "jsonParsed",
278
+ filters,
279
+ minContextSlot
280
+ };
281
+ }
282
+ function processQueryResponse4({ encoding, programAccounts }) {
283
+ return programAccounts.map((programAccount) => {
284
+ const [refinedData, responseEncoding] = Array.isArray(programAccount.account.data) ? encoding === "jsonParsed" ? [programAccount.account.data[0], "base64"] : [programAccount.account.data[0], encoding] : [refineJsonParsedAccountData(programAccount.account.data), "jsonParsed"];
285
+ const pubkey = programAccount.pubkey;
286
+ const responseBase = {
287
+ ...programAccount.account,
288
+ address: pubkey,
289
+ encoding: responseEncoding
290
+ };
291
+ return typeof refinedData === "object" && "meta" in refinedData ? {
292
+ ...responseBase,
293
+ data: refinedData.data,
294
+ meta: refinedData.meta
295
+ } : {
296
+ ...responseBase,
297
+ data: refinedData
298
+ };
299
+ });
70
300
  }
71
- async function resolveProgramAccounts({ programAddress, encoding = "jsonParsed", ...config }, cache, rpc) {
72
- const requestConfig = { encoding, ...config };
301
+ async function loadProgramAccounts({ programAddress, ...config }, cache, rpc, _info) {
302
+ const requestConfig = normalizeArgs4(config);
303
+ const { encoding } = requestConfig;
73
304
  const cached = cache.get(programAddress, requestConfig);
74
305
  if (cached !== null) {
75
306
  return cached;
@@ -82,2100 +313,2708 @@ async function resolveProgramAccounts({ programAddress, encoding = "jsonParsed",
82
313
  }).catch((e) => {
83
314
  throw e;
84
315
  });
85
- const queryResponse = programAccounts.map((programAccount2) => {
86
- const [data, responseEncoding] = Array.isArray(programAccount2.account.data) ? encoding === "jsonParsed" ? [programAccount2.account.data[0], "base64"] : [programAccount2.account.data[0], encoding] : [programAccount2.account.data, "jsonParsed"];
87
- const pubkey = programAccount2.pubkey;
88
- const account = { ...programAccount2.account, data, encoding: responseEncoding };
89
- return {
90
- account,
91
- pubkey
92
- };
93
- });
316
+ const queryResponse = processQueryResponse4({ encoding, programAccounts });
94
317
  cache.insert(programAddress, requestConfig, queryResponse);
95
318
  return queryResponse;
96
319
  }
97
- async function resolveTransaction({ signature, encoding = "jsonParsed", ...config }, cache, rpc) {
98
- const requestConfig = { encoding, ...config };
99
- const cached = cache.get(signature, requestConfig);
100
- if (cached !== null) {
101
- return cached;
102
- }
103
- const transaction = await rpc.getTransaction(signature, requestConfig).send();
104
- if (transaction === null) {
105
- return null;
106
- }
107
- const [transactionData, responseEncoding, responseFormat] = Array.isArray(transaction.transaction) ? encoding === "jsonParsed" ? [transaction.transaction[0], "base64", "unparsed"] : [transaction.transaction[0], encoding, "unparsed"] : encoding === "jsonParsed" ? [transaction.transaction, encoding, "parsed"] : [transaction.transaction, encoding, "unparsed"];
108
- if (transaction.meta) {
109
- transaction.meta["format"] = responseFormat;
110
- }
111
- if (transactionData.message) {
112
- transactionData.message["format"] = responseFormat;
113
- }
114
- const queryResponse = {
115
- ...transaction,
116
- encoding: responseEncoding,
117
- transaction: transactionData
118
- };
119
- cache.insert(signature, requestConfig, queryResponse);
120
- return queryResponse;
121
- }
320
+
321
+ // src/context.ts
122
322
  function createSolanaGraphQLContext(rpc) {
123
323
  const cache = createGraphQLCache();
124
324
  return {
325
+ accountLoader: createAccountLoader(rpc),
125
326
  cache,
126
- resolveAccount(args) {
127
- return resolveAccount(args, this.cache, this.rpc);
327
+ loadBlock(args, info) {
328
+ return loadBlock(args, this.cache, this.rpc);
128
329
  },
129
- resolveBlock(args) {
130
- return resolveBlock(args, this.cache, this.rpc);
330
+ loadProgramAccounts(args, info) {
331
+ return loadProgramAccounts(args, this.cache, this.rpc);
131
332
  },
132
- resolveProgramAccounts(args) {
133
- return resolveProgramAccounts(args, this.cache, this.rpc);
134
- },
135
- resolveTransaction(args) {
136
- return resolveTransaction(args, this.cache, this.rpc);
333
+ loadTransaction(args, info) {
334
+ return loadTransaction(args, this.cache, this.rpc);
137
335
  },
138
336
  rpc
139
337
  };
140
338
  }
141
- var BigIntScalar = () => new GraphQLScalarType({
142
- name: "BigInt",
143
- parseLiteral(ast) {
144
- if (ast.kind === Kind.STRING) {
145
- return BigInt(ast.value);
339
+
340
+ // src/resolvers/account.ts
341
+ var resolveAccount = (fieldName) => {
342
+ return (parent, args, context, info) => parent[fieldName] === null ? null : context.accountLoader.load({ ...args, address: parent[fieldName] }, info);
343
+ };
344
+
345
+ // src/schema/account.ts
346
+ var accountTypeDefs = (
347
+ /* GraphQL */
348
+ `
349
+ # Account interface
350
+ interface Account {
351
+ address: String
352
+ encoding: String
353
+ executable: Boolean
354
+ lamports: BigInt
355
+ owner: Account
356
+ rentEpoch: BigInt
146
357
  }
147
- return null;
148
- },
149
- parseValue(value) {
150
- return BigInt(value);
151
- },
152
- serialize(value) {
153
- return BigInt(value);
154
- }
155
- });
156
358
 
157
- // src/schema/picks.ts
158
- function boolean() {
159
- return { type: GraphQLBoolean };
160
- }
161
- var memoisedBigint;
162
- function bigint() {
163
- if (!memoisedBigint)
164
- memoisedBigint = { type: BigIntScalar() };
165
- return memoisedBigint;
166
- }
167
- function number() {
168
- return { type: GraphQLInt };
169
- }
170
- function string() {
171
- return { type: GraphQLString };
172
- }
173
- function type(fieldType) {
174
- return {
175
- type: fieldType
176
- };
177
- }
178
- function nonNull(fieldType) {
179
- return {
180
- type: new GraphQLNonNull(fieldType.type)
181
- };
182
- }
183
- function list(elementType) {
184
- return {
185
- type: new GraphQLList(elementType.type)
186
- };
187
- }
188
- function object(name, fields) {
189
- return {
190
- type: new GraphQLObjectType({
191
- fields,
192
- name
193
- })
194
- };
195
- }
359
+ # An account with base58 encoded data
360
+ type AccountBase58 implements Account {
361
+ address: String
362
+ data: String
363
+ encoding: String
364
+ executable: Boolean
365
+ lamports: BigInt
366
+ owner: Account
367
+ rentEpoch: BigInt
368
+ }
196
369
 
197
- // src/schema/inputs.ts
198
- var memoisedAccountEncodingInputType;
199
- var accountEncodingInputType = () => {
200
- if (!memoisedAccountEncodingInputType)
201
- memoisedAccountEncodingInputType = new GraphQLEnumType({
202
- name: "AccountEncoding",
203
- values: {
204
- base58: {
205
- value: "base58"
206
- },
207
- base64: {
208
- value: "base64"
209
- },
210
- base64Zstd: {
211
- value: "base64+zstd"
212
- },
213
- jsonParsed: {
214
- value: "jsonParsed"
215
- }
370
+ # An account with base64 encoded data
371
+ type AccountBase64 implements Account {
372
+ address: String
373
+ data: String
374
+ encoding: String
375
+ executable: Boolean
376
+ lamports: BigInt
377
+ owner: Account
378
+ rentEpoch: BigInt
379
+ }
380
+
381
+ # An account with base64+zstd encoded data
382
+ type AccountBase64Zstd implements Account {
383
+ address: String
384
+ data: String
385
+ encoding: String
386
+ executable: Boolean
387
+ lamports: BigInt
388
+ owner: Account
389
+ rentEpoch: BigInt
390
+ }
391
+
392
+ # Interface for JSON-parsed meta
393
+ type JsonParsedAccountMeta {
394
+ program: String
395
+ space: BigInt
396
+ type: String
397
+ }
398
+ interface AccountJsonParsed {
399
+ meta: JsonParsedAccountMeta
400
+ }
401
+
402
+ # A nonce account
403
+ type NonceAccountFeeCalculator {
404
+ lamportsPerSignature: String
405
+ }
406
+ type NonceAccountData {
407
+ authority: Account
408
+ blockhash: String
409
+ feeCalculator: NonceAccountFeeCalculator
410
+ }
411
+ type NonceAccount implements Account & AccountJsonParsed {
412
+ address: String
413
+ data: NonceAccountData
414
+ encoding: String
415
+ executable: Boolean
416
+ lamports: BigInt
417
+ meta: JsonParsedAccountMeta
418
+ owner: Account
419
+ rentEpoch: BigInt
420
+ }
421
+
422
+ # A lookup table account
423
+ type LookupTableAccountData {
424
+ addresses: [String]
425
+ authority: Account
426
+ deactivationSlot: String
427
+ lastExtendedSlot: String
428
+ lastExtendedSlotStartIndex: Int
429
+ }
430
+ type LookupTableAccount implements Account & AccountJsonParsed {
431
+ address: String
432
+ data: LookupTableAccountData
433
+ encoding: String
434
+ executable: Boolean
435
+ lamports: BigInt
436
+ meta: JsonParsedAccountMeta
437
+ owner: Account
438
+ rentEpoch: BigInt
439
+ }
440
+
441
+ # A mint account
442
+ type MintAccountData {
443
+ decimals: Int
444
+ freezeAuthority: Account
445
+ isInitialized: Boolean
446
+ mintAuthority: Account
447
+ supply: String
448
+ }
449
+ type MintAccount implements Account & AccountJsonParsed {
450
+ address: String
451
+ data: MintAccountData
452
+ encoding: String
453
+ executable: Boolean
454
+ lamports: BigInt
455
+ meta: JsonParsedAccountMeta
456
+ owner: Account
457
+ rentEpoch: BigInt
458
+ }
459
+
460
+ # A token account
461
+ type TokenAccountData {
462
+ isNative: Boolean
463
+ mint: Account
464
+ owner: Account
465
+ state: String
466
+ tokenAmount: TokenAmount
467
+ }
468
+ type TokenAccount implements Account & AccountJsonParsed {
469
+ address: String
470
+ data: TokenAccountData
471
+ encoding: String
472
+ executable: Boolean
473
+ lamports: BigInt
474
+ meta: JsonParsedAccountMeta
475
+ owner: Account
476
+ rentEpoch: BigInt
477
+ }
478
+
479
+ # A stake account
480
+ type StakeAccountDataMetaAuthorized {
481
+ staker: Account
482
+ withdrawer: Account
483
+ }
484
+ type StakeAccountDataMetaLockup {
485
+ custodian: Account
486
+ epoch: BigInt
487
+ unixTimestamp: BigInt
488
+ }
489
+ type StakeAccountDataMeta {
490
+ authorized: StakeAccountDataMetaAuthorized
491
+ lockup: StakeAccountDataMetaLockup
492
+ rentExemptReserve: String
493
+ }
494
+ type StakeAccountDataStakeDelegation {
495
+ activationEpoch: BigInt
496
+ deactivationEpoch: BigInt
497
+ stake: String
498
+ voter: Account
499
+ warmupCooldownRate: Int
500
+ }
501
+ type StakeAccountDataStake {
502
+ creditsObserved: BigInt
503
+ delegation: StakeAccountDataStakeDelegation
504
+ }
505
+ type StakeAccountData {
506
+ meta: StakeAccountDataMeta
507
+ stake: StakeAccountDataStake
508
+ }
509
+ type StakeAccount implements Account & AccountJsonParsed {
510
+ address: String
511
+ data: StakeAccountData
512
+ encoding: String
513
+ executable: Boolean
514
+ lamports: BigInt
515
+ meta: JsonParsedAccountMeta
516
+ owner: Account
517
+ rentEpoch: BigInt
518
+ }
519
+
520
+ # A vote account
521
+ type VoteAccountDataAuthorizedVoter {
522
+ authorizedVoter: Account
523
+ epoch: BigInt
524
+ }
525
+ type VoteAccountDataEpochCredit {
526
+ credits: String
527
+ epoch: BigInt
528
+ previousCredits: String
529
+ }
530
+ type VoteAccountDataLastTimestamp {
531
+ slot: BigInt
532
+ timestamp: BigInt
533
+ }
534
+ type VoteAccountDataVote {
535
+ confirmationCount: Int
536
+ slot: BigInt
537
+ }
538
+ type VoteAccountData {
539
+ authorizedVoters: [VoteAccountDataAuthorizedVoter]
540
+ authorizedWithdrawer: Account
541
+ commission: Int
542
+ epochCredits: [VoteAccountDataEpochCredit]
543
+ lastTimestamp: VoteAccountDataLastTimestamp
544
+ node: Account
545
+ priorVoters: [String]
546
+ rootSlot: BigInt
547
+ votes: [VoteAccountDataVote]
548
+ }
549
+ type VoteAccount implements Account & AccountJsonParsed {
550
+ address: String
551
+ data: VoteAccountData
552
+ encoding: String
553
+ executable: Boolean
554
+ lamports: BigInt
555
+ meta: JsonParsedAccountMeta
556
+ owner: Account
557
+ rentEpoch: BigInt
558
+ }
559
+ `
560
+ );
561
+ var accountResolvers = {
562
+ Account: {
563
+ __resolveType(account) {
564
+ if (account.encoding === "base58") {
565
+ return "AccountBase58";
216
566
  }
217
- });
218
- return memoisedAccountEncodingInputType;
219
- };
220
- var memoisedBlockTransactionDetailsInputType;
221
- var blockTransactionDetailsInputType = () => {
222
- if (!memoisedBlockTransactionDetailsInputType)
223
- memoisedBlockTransactionDetailsInputType = new GraphQLEnumType({
224
- name: "BlockTransactionDetails",
225
- values: {
226
- accounts: {
227
- value: "accounts"
228
- },
229
- full: {
230
- value: "full"
231
- },
232
- none: {
233
- value: "none"
234
- },
235
- signatures: {
236
- value: "signatures"
237
- }
567
+ if (account.encoding === "base64") {
568
+ return "AccountBase64";
238
569
  }
239
- });
240
- return memoisedBlockTransactionDetailsInputType;
241
- };
242
- var memoisedCommitmentInputType;
243
- var commitmentInputType = () => {
244
- if (!memoisedCommitmentInputType)
245
- memoisedCommitmentInputType = new GraphQLEnumType({
246
- name: "Commitment",
247
- values: {
248
- confirmed: {
249
- value: "confirmed"
250
- },
251
- finalized: {
252
- value: "finalized"
253
- },
254
- processed: {
255
- value: "processed"
256
- }
570
+ if (account.encoding === "base64+zstd") {
571
+ return "AccountBase64Zstd";
257
572
  }
258
- });
259
- return memoisedCommitmentInputType;
260
- };
261
- var memoisedDataSliceInputType;
262
- var dataSliceInputType = () => {
263
- if (!memoisedDataSliceInputType)
264
- memoisedDataSliceInputType = new GraphQLInputObjectType({
265
- fields: {
266
- length: number(),
267
- offset: number()
268
- },
269
- name: "DataSliceConfig"
270
- });
271
- return memoisedDataSliceInputType;
272
- };
273
- var memoisedMaxSupportedTransactionVersionInputType;
274
- var maxSupportedTransactionVersionInputType = () => {
275
- if (!memoisedMaxSupportedTransactionVersionInputType)
276
- memoisedMaxSupportedTransactionVersionInputType = new GraphQLEnumType({
277
- name: "MaxSupportedTransactionVersion",
278
- values: {
279
- legacy: {
280
- value: "legacy"
281
- },
282
- zero: {
283
- value: "0"
573
+ if (account.encoding === "jsonParsed") {
574
+ if (account.meta.program === "nonce") {
575
+ return "NonceAccount";
284
576
  }
285
- }
286
- });
287
- return memoisedMaxSupportedTransactionVersionInputType;
288
- };
289
- var memoisedProgramAccountFilterInputType;
290
- var programAccountFilterInputType = () => {
291
- if (!memoisedProgramAccountFilterInputType)
292
- memoisedProgramAccountFilterInputType = new GraphQLInputObjectType({
293
- fields: {
294
- bytes: bigint(),
295
- dataSize: bigint(),
296
- encoding: string(),
297
- offset: bigint()
298
- },
299
- name: "ProgramAccountFilter"
300
- });
301
- return memoisedProgramAccountFilterInputType;
302
- };
303
- var memoisedTransactionEncodingInputType;
304
- var transactionEncodingInputType = () => {
305
- if (!memoisedTransactionEncodingInputType)
306
- memoisedTransactionEncodingInputType = new GraphQLEnumType({
307
- name: "TransactionEncoding",
308
- values: {
309
- base58: {
310
- value: "base58"
311
- },
312
- base64: {
313
- value: "base64"
314
- },
315
- json: {
316
- value: "json"
317
- },
318
- jsonParsed: {
319
- value: "jsonParsed"
577
+ if (account.meta.type === "mint" && account.meta.program === "spl-token") {
578
+ return "MintAccount";
320
579
  }
321
- }
322
- });
323
- return memoisedTransactionEncodingInputType;
324
- };
325
- var memoisedTokenAmountType;
326
- var tokenAmountType = () => {
327
- if (!memoisedTokenAmountType) {
328
- memoisedTokenAmountType = new GraphQLObjectType({
329
- fields: {
330
- amount: string(),
331
- decimals: number(),
332
- uiAmount: bigint(),
333
- uiAmountString: string()
334
- },
335
- name: "TokenAmount"
336
- });
337
- }
338
- return memoisedTokenAmountType;
339
- };
340
- var memoisedAccountInterfaceFields;
341
- var accountInterfaceFields = () => {
342
- if (!memoisedAccountInterfaceFields) {
343
- memoisedAccountInterfaceFields = {
344
- encoding: string(),
345
- executable: boolean(),
346
- lamports: bigint(),
347
- rentEpoch: bigint()
348
- };
349
- }
350
- return memoisedAccountInterfaceFields;
351
- };
352
- var memoisedAccountInterface;
353
- var accountInterface = () => {
354
- if (!memoisedAccountInterface) {
355
- memoisedAccountInterface = new GraphQLInterfaceType({
356
- description: "A Solana account",
357
- fields: () => ({
358
- ...accountInterfaceFields(),
359
- owner: type(accountInterface())
360
- }),
361
- name: "Account",
362
- resolveType(account) {
363
- if (account.encoding === "base58") {
364
- return "AccountBase58";
580
+ if (account.meta.type === "account" && account.meta.program === "spl-token") {
581
+ return "TokenAccount";
365
582
  }
366
- if (account.encoding === "base64") {
367
- return "AccountBase64";
583
+ if (account.meta.program === "stake") {
584
+ return "StakeAccount";
368
585
  }
369
- if (account.encoding === "base64+zstd") {
370
- return "AccountBase64Zstd";
586
+ if (account.meta.type === "vote" && account.meta.program === "vote") {
587
+ return "VoteAccount";
371
588
  }
372
- if (account.encoding === "jsonParsed") {
373
- if (account.data.parsed.type === "mint" && account.data.program === "spl-token") {
374
- return "MintAccount";
375
- }
376
- if (account.data.parsed.type === "account" && account.data.program === "spl-token") {
377
- return "TokenAccount";
378
- }
379
- if (account.data.program === "nonce") {
380
- return "NonceAccount";
381
- }
382
- if (account.data.program === "stake") {
383
- return "StakeAccount";
384
- }
385
- if (account.data.parsed.type === "vote" && account.data.program === "vote") {
386
- return "VoteAccount";
387
- }
388
- if (account.data.parsed.type === "lookupTable" && account.data.program === "address-lookup-table") {
389
- return "LookupTableAccount";
390
- }
589
+ if (account.meta.type === "lookupTable" && account.meta.program === "address-lookup-table") {
590
+ return "LookupTableAccount";
391
591
  }
392
- return "AccountBase64";
393
592
  }
394
- });
593
+ return "AccountBase64";
594
+ }
595
+ },
596
+ AccountBase58: {
597
+ owner: resolveAccount("owner")
598
+ },
599
+ AccountBase64: {
600
+ owner: resolveAccount("owner")
601
+ },
602
+ AccountBase64Zstd: {
603
+ owner: resolveAccount("owner")
604
+ },
605
+ NonceAccountData: {
606
+ authority: resolveAccount("authority")
607
+ },
608
+ NonceAccount: {
609
+ owner: resolveAccount("owner")
610
+ },
611
+ LookupTableAccountData: {
612
+ authority: resolveAccount("authority")
613
+ },
614
+ LookupTableAccount: {
615
+ owner: resolveAccount("owner")
616
+ },
617
+ MintAccountData: {
618
+ freezeAuthority: resolveAccount("freezeAuthority"),
619
+ mintAuthority: resolveAccount("mintAuthority")
620
+ },
621
+ MintAccount: {
622
+ owner: resolveAccount("owner")
623
+ },
624
+ TokenAccountData: {
625
+ mint: resolveAccount("mint"),
626
+ owner: resolveAccount("owner")
627
+ },
628
+ TokenAccount: {
629
+ owner: resolveAccount("owner")
630
+ },
631
+ StakeAccountDataMetaAuthorized: {
632
+ staker: resolveAccount("staker"),
633
+ withdrawer: resolveAccount("withdrawer")
634
+ },
635
+ StakeAccountDataMetaLockup: {
636
+ custodian: resolveAccount("custodian")
637
+ },
638
+ StakeAccountDataStakeDelegation: {
639
+ voter: resolveAccount("voter")
640
+ },
641
+ StakeAccount: {
642
+ owner: resolveAccount("owner")
643
+ },
644
+ VoteAccountDataAuthorizedVoter: {
645
+ authorizedVoter: resolveAccount("authorizedVoter")
646
+ },
647
+ VoteAccountData: {
648
+ authorizedWithdrawer: resolveAccount("authorizedWithdrawer"),
649
+ node: resolveAccount("nodePubkey")
650
+ },
651
+ VoteAccount: {
652
+ owner: resolveAccount("owner")
395
653
  }
396
- return memoisedAccountInterface;
397
- };
398
- var accountType = (name, description, data) => new GraphQLObjectType({
399
- description,
400
- fields: {
401
- ...accountInterfaceFields(),
402
- data,
403
- owner: {
404
- args: {
405
- commitment: type(commitmentInputType()),
406
- dataSlice: type(dataSliceInputType()),
407
- encoding: type(accountEncodingInputType()),
408
- minContextSlot: bigint()
409
- },
410
- resolve: (parent, args, context) => context.resolveAccount({ ...args, address: parent.owner }),
411
- type: accountInterface()
412
- }
413
- },
414
- interfaces: [accountInterface()],
415
- name
416
- });
417
- var accountDataJsonParsed = (name, parsedInfoFields) => object(name + "Data", {
418
- parsed: object(name + "DataParsed", {
419
- info: object(name + "DataParsedInfo", parsedInfoFields),
420
- type: string()
421
- }),
422
- program: string(),
423
- space: bigint()
424
- });
425
- var memoisedAccountBase58;
426
- var accountBase58 = () => {
427
- if (!memoisedAccountBase58)
428
- memoisedAccountBase58 = accountType("AccountBase58", "A Solana account with base58 encoded data", string());
429
- return memoisedAccountBase58;
430
654
  };
431
- var memoisedAccountBase64;
432
- var accountBase64 = () => {
433
- if (!memoisedAccountBase64)
434
- memoisedAccountBase64 = accountType("AccountBase64", "A Solana account with base64 encoded data", string());
435
- return memoisedAccountBase64;
436
- };
437
- var memoisedAccountBase64Zstd;
438
- var accountBase64Zstd = () => {
439
- if (!memoisedAccountBase64Zstd)
440
- memoisedAccountBase64Zstd = accountType(
441
- "AccountBase64Zstd",
442
- "A Solana account with base64 encoded data compressed with zstd",
443
- string()
444
- );
445
- return memoisedAccountBase64Zstd;
655
+
656
+ // src/schema/block.ts
657
+ var blockTypeDefs = (
658
+ /* GraphQL */
659
+ `
660
+ type TransactionMetaForAccounts {
661
+ err: String
662
+ fee: BigInt
663
+ postBalances: [BigInt]
664
+ postTokenBalances: [TokenBalance]
665
+ preBalances: [BigInt]
666
+ preTokenBalances: [TokenBalance]
667
+ status: TransactionStatus
668
+ }
669
+
670
+ type TransactionDataForAccounts {
671
+ accountKeys: [String]
672
+ signatures: [String]
673
+ }
674
+
675
+ type BlockTransactionAccounts {
676
+ meta: TransactionMetaForAccounts
677
+ data: TransactionDataForAccounts
678
+ version: String
679
+ }
680
+
681
+ # Block interface
682
+ interface Block {
683
+ blockhash: String
684
+ blockHeight: BigInt
685
+ blockTime: Int
686
+ parentSlot: BigInt
687
+ previousBlockhash: String
688
+ rewards: [Reward]
689
+ transactionDetails: String
690
+ }
691
+
692
+ # A block with account transaction details
693
+ type BlockWithAccounts implements Block {
694
+ blockhash: String
695
+ blockHeight: BigInt
696
+ blockTime: Int
697
+ parentSlot: BigInt
698
+ previousBlockhash: String
699
+ rewards: [Reward]
700
+ transactions: [BlockTransactionAccounts]
701
+ transactionDetails: String
702
+ }
703
+
704
+ # A block with full transaction details
705
+ type BlockWithFull implements Block {
706
+ blockhash: String
707
+ blockHeight: BigInt
708
+ blockTime: Int
709
+ parentSlot: BigInt
710
+ previousBlockhash: String
711
+ rewards: [Reward]
712
+ transactions: [Transaction]
713
+ transactionDetails: String
714
+ }
715
+
716
+ # A block with none transaction details
717
+ type BlockWithNone implements Block {
718
+ blockhash: String
719
+ blockHeight: BigInt
720
+ blockTime: Int
721
+ parentSlot: BigInt
722
+ previousBlockhash: String
723
+ rewards: [Reward]
724
+ transactionDetails: String
725
+ }
726
+
727
+ # A block with signature transaction details
728
+ type BlockWithSignatures implements Block {
729
+ blockhash: String
730
+ blockHeight: BigInt
731
+ blockTime: Int
732
+ parentSlot: BigInt
733
+ previousBlockhash: String
734
+ rewards: [Reward]
735
+ signatures: [String]
736
+ transactionDetails: String
737
+ }
738
+ `
739
+ );
740
+ var blockResolvers = {
741
+ Block: {
742
+ __resolveType(block) {
743
+ switch (block.transactionDetails) {
744
+ case "accounts":
745
+ return "BlockWithAccounts";
746
+ case "none":
747
+ return "BlockWithNone";
748
+ case "signatures":
749
+ return "BlockWithSignatures";
750
+ default:
751
+ return "BlockWithFull";
752
+ }
753
+ }
754
+ }
446
755
  };
447
- var memoisedAccountNonceAccount;
448
- var accountNonceAccount = () => {
449
- if (!memoisedAccountNonceAccount)
450
- memoisedAccountNonceAccount = accountType(
451
- "NonceAccount",
452
- "A nonce account",
453
- accountDataJsonParsed("Nonce", {
454
- authority: string(),
455
- blockhash: string(),
456
- feeCalculator: object("NonceFeeCalculator", {
457
- lamportsPerSignature: string()
458
- })
459
- })
460
- );
461
- return memoisedAccountNonceAccount;
756
+
757
+ // src/schema/common/inputs.ts
758
+ var inputTypeDefs = (
759
+ /* GraphQL */
760
+ `
761
+ enum AccountEncoding {
762
+ base58
763
+ base64
764
+ base64Zstd
765
+ jsonParsed
766
+ }
767
+
768
+ enum BlockTransactionDetails {
769
+ accounts
770
+ full
771
+ none
772
+ signatures
773
+ }
774
+
775
+ enum Commitment {
776
+ confirmed
777
+ finalized
778
+ processed
779
+ }
780
+
781
+ input DataSlice {
782
+ offset: Int
783
+ length: Int
784
+ }
785
+
786
+ input ProgramAccountsFilter {
787
+ bytes: BigInt
788
+ dataSize: BigInt
789
+ encoding: String
790
+ offset: BigInt
791
+ }
792
+
793
+ enum TransactionEncoding {
794
+ base58
795
+ base64
796
+ jsonParsed
797
+ }
798
+
799
+ enum TransactionVersion {
800
+ legacy
801
+ zero
802
+ }
803
+ `
804
+ );
805
+ var inputResolvers = {
806
+ AccountEncoding: {
807
+ base64Zstd: "base64+zstd"
808
+ },
809
+ TransactionVersion: {
810
+ zero: 0
811
+ }
462
812
  };
463
- var memoisedAccountLookupTable;
464
- var accountLookupTable = () => {
465
- if (!memoisedAccountLookupTable)
466
- memoisedAccountLookupTable = accountType(
467
- "LookupTableAccount",
468
- "An address lookup table account",
469
- accountDataJsonParsed("LookupTable", {
470
- addresses: list(string()),
471
- authority: string(),
472
- deactivationSlot: string(),
473
- lastExtendedSlot: string(),
474
- lastExtendedSlotStartIndex: number()
475
- })
476
- );
477
- return memoisedAccountLookupTable;
478
- };
479
- var memoisedAccountMint;
480
- var accountMint = () => {
481
- if (!memoisedAccountMint)
482
- memoisedAccountMint = accountType(
483
- "MintAccount",
484
- "An SPL mint",
485
- accountDataJsonParsed("Mint", {
486
- decimals: number(),
487
- freezeAuthority: string(),
488
- isInitialized: boolean(),
489
- mintAuthority: string(),
490
- supply: string()
491
- })
492
- );
493
- return memoisedAccountMint;
494
- };
495
- var memoisedAccountTokenAccount;
496
- var accountTokenAccount = () => {
497
- if (!memoisedAccountTokenAccount)
498
- memoisedAccountTokenAccount = accountType(
499
- "TokenAccount",
500
- "An SPL token account",
501
- accountDataJsonParsed("TokenAccount", {
502
- isNative: boolean(),
503
- mint: string(),
504
- owner: string(),
505
- state: string(),
506
- tokenAmount: type(tokenAmountType())
507
- })
508
- );
509
- return memoisedAccountTokenAccount;
510
- };
511
- var memoisedAccountStakeAccount;
512
- var accountStakeAccount = () => {
513
- if (!memoisedAccountStakeAccount)
514
- memoisedAccountStakeAccount = accountType(
515
- "StakeAccount",
516
- "A stake account",
517
- accountDataJsonParsed("Stake", {
518
- meta: object("StakeMeta", {
519
- authorized: object("StakeMetaAuthorized", {
520
- staker: string(),
521
- withdrawer: string()
522
- }),
523
- lockup: object("StakeMetaLockup", {
524
- custodian: string(),
525
- epoch: bigint(),
526
- unixTimestamp: bigint()
527
- }),
528
- rentExemptReserve: string()
529
- }),
530
- stake: object("StakeStake", {
531
- creditsObserved: bigint(),
532
- delegation: object("StakeStakeDelegation", {
533
- activationEpoch: bigint(),
534
- deactivationEpoch: bigint(),
535
- stake: string(),
536
- voter: string(),
537
- warmupCooldownRate: number()
538
- })
539
- })
540
- })
541
- );
542
- return memoisedAccountStakeAccount;
543
- };
544
- var memoisedAccountVoteAccount;
545
- var accountVoteAccount = () => {
546
- if (!memoisedAccountVoteAccount)
547
- memoisedAccountVoteAccount = accountType(
548
- "VoteAccount",
549
- "A vote account",
550
- accountDataJsonParsed("Vote", {
551
- authorizedVoters: list(
552
- object("VoteAuthorizedVoter", {
553
- authorizedVoter: string(),
554
- epoch: bigint()
555
- })
556
- ),
557
- authorizedWithdrawer: string(),
558
- commission: number(),
559
- epochCredits: list(
560
- object("VoteEpochCredits", {
561
- credits: string(),
562
- epoch: bigint(),
563
- previousCredits: string()
564
- })
565
- ),
566
- lastTimestamp: object("VoteLastTimestamp", {
567
- slot: bigint(),
568
- timestamp: bigint()
569
- }),
570
- nodePubkey: string(),
571
- priorVoters: list(string()),
572
- rootSlot: bigint(),
573
- votes: list(
574
- object("VoteVote", {
575
- confirmationCount: number(),
576
- slot: bigint()
577
- })
578
- )
579
- })
580
- );
581
- return memoisedAccountVoteAccount;
813
+ var scalarTypeDefs = (
814
+ /* GraphQL */
815
+ `
816
+ scalar BigInt
817
+ `
818
+ );
819
+ var scalarResolvers = {
820
+ BigInt: {
821
+ __parseLiteral(ast) {
822
+ if (ast.kind === Kind.STRING) {
823
+ return BigInt(ast.value);
824
+ }
825
+ return null;
826
+ },
827
+ __parseValue(value) {
828
+ return BigInt(value);
829
+ },
830
+ __serialize(value) {
831
+ return BigInt(value);
832
+ }
833
+ }
582
834
  };
583
- var memoisedAccountTypes;
584
- var accountTypes = () => {
585
- if (!memoisedAccountTypes)
586
- memoisedAccountTypes = [
587
- accountBase58(),
588
- accountBase64(),
589
- accountBase64Zstd(),
590
- accountNonceAccount(),
591
- accountLookupTable(),
592
- accountMint(),
593
- accountTokenAccount(),
594
- accountStakeAccount(),
595
- accountVoteAccount()
596
- ];
597
- return memoisedAccountTypes;
835
+
836
+ // src/schema/common/types.ts
837
+ var commonTypeDefs = (
838
+ /* GraphQL */
839
+ `
840
+ type ReturnData {
841
+ data: String
842
+ programId: String
843
+ }
844
+
845
+ type Reward {
846
+ commission: Int
847
+ lamports: BigInt
848
+ postBalance: BigInt
849
+ pubkey: String
850
+ rewardType: String
851
+ }
852
+
853
+ type TokenAmount {
854
+ amount: String
855
+ decimals: Int
856
+ uiAmount: BigInt
857
+ uiAmountString: String
858
+ }
859
+
860
+ type TokenBalance {
861
+ accountIndex: Int
862
+ mint: Account
863
+ owner: Account
864
+ programId: String
865
+ uiTokenAmount: TokenAmount
866
+ }
867
+ `
868
+ );
869
+ var commonResolvers = {
870
+ TokenBalance: {
871
+ mint: resolveAccount("mint"),
872
+ owner: resolveAccount("owner")
873
+ }
598
874
  };
599
875
 
600
- // src/schema/account/query.ts
601
- var accountQuery = () => ({
602
- account: {
603
- args: {
604
- address: nonNull(string()),
605
- commitment: type(commitmentInputType()),
606
- dataSlice: type(dataSliceInputType()),
607
- encoding: type(accountEncodingInputType()),
608
- minContextSlot: bigint()
609
- },
610
- resolve: (_parent, args, context) => context.resolveAccount(args),
611
- type: accountInterface()
612
- }
613
- });
614
- var memoisedTokenBalance;
615
- var tokenBalance = () => {
616
- if (!memoisedTokenBalance)
617
- memoisedTokenBalance = new GraphQLObjectType({
618
- fields: {
619
- accountIndex: number(),
620
- mint: string(),
621
- owner: string(),
622
- programId: string(),
623
- uiAmountString: string()
624
- },
625
- name: "TokenBalance"
626
- });
627
- return memoisedTokenBalance;
628
- };
629
- var memoisedTransactionStatus;
630
- var transactionStatus = () => {
631
- if (!memoisedTransactionStatus)
632
- memoisedTransactionStatus = new GraphQLUnionType({
633
- name: "TransactionStatus",
634
- types: [
635
- new GraphQLObjectType({
636
- fields: {
637
- Err: string()
638
- },
639
- name: "TransactionStatusError"
640
- }),
641
- new GraphQLObjectType({
642
- fields: {
643
- Ok: string()
644
- },
645
- name: "TransactionStatusOk"
646
- })
647
- ]
648
- });
649
- return memoisedTransactionStatus;
650
- };
651
- var memoisedReward;
652
- var reward = () => {
653
- if (!memoisedReward)
654
- memoisedReward = new GraphQLObjectType({
655
- fields: {
656
- commission: number(),
657
- lamports: bigint(),
658
- postBalance: bigint(),
659
- pubkey: string(),
660
- rewardType: string()
661
- },
662
- name: "Reward"
663
- });
664
- return memoisedReward;
665
- };
666
- var memoisedAddressTableLookup;
667
- var addressTableLookup = () => {
668
- if (!memoisedAddressTableLookup)
669
- memoisedAddressTableLookup = new GraphQLObjectType({
670
- fields: {
671
- accountKey: string(),
672
- readableIndexes: list(number()),
673
- writableIndexes: list(number())
674
- },
675
- name: "AddressTableLookup"
676
- });
677
- return memoisedAddressTableLookup;
678
- };
679
- var memoisedReturnData;
680
- var returnData = () => {
681
- if (!memoisedReturnData)
682
- memoisedReturnData = new GraphQLObjectType({
683
- fields: {
684
- data: string(),
685
- programId: string()
686
- },
687
- name: "ReturnData"
688
- });
689
- return memoisedReturnData;
690
- };
691
- var memoisedTransactionInstruction;
692
- var transactionInstruction = () => {
693
- if (!memoisedTransactionInstruction)
694
- memoisedTransactionInstruction = new GraphQLObjectType({
695
- fields: {
696
- accounts: list(number()),
697
- data: string(),
698
- programIdIndex: number()
699
- },
700
- name: "TransactionInstruction"
701
- });
702
- return memoisedTransactionInstruction;
703
- };
704
- var memoisedTransactionMetaLoadedAddresses;
705
- var transactionMetaLoadedAddresses = () => {
706
- if (!memoisedTransactionMetaLoadedAddresses)
707
- memoisedTransactionMetaLoadedAddresses = new GraphQLObjectType({
708
- fields: {
709
- readonly: list(string()),
710
- // Base58 encoded addresses
711
- writable: list(string())
712
- // Base58 encoded addresses
713
- },
714
- name: "TransactionMetaLoadedAddresses"
715
- });
716
- return memoisedTransactionMetaLoadedAddresses;
717
- };
718
- var memoisedParsedTransactionInstructionInterface;
719
- var parsedTransactionInstructionInterface = () => {
720
- if (!memoisedParsedTransactionInstructionInterface)
721
- memoisedParsedTransactionInstructionInterface = new GraphQLInterfaceType({
722
- fields: {
723
- programId: string()
724
- },
725
- name: "ParsedTransactionInstruction",
726
- resolveType(instruction) {
727
- if (instruction.program === "address-lookup-table") {
728
- if (instruction.info.type === "createLookupTable") {
876
+ // src/schema/instruction.ts
877
+ var instructionTypeDefs = (
878
+ /* GraphQL */
879
+ `
880
+ type JsonParsedInstructionMeta {
881
+ program: String
882
+ type: String
883
+ }
884
+
885
+ # Transaction instruction interface
886
+ interface TransactionInstruction {
887
+ programId: String
888
+ }
889
+
890
+ # Generic transaction instruction
891
+ type GenericInstruction implements TransactionInstruction {
892
+ accounts: [String]
893
+ data: String
894
+ programId: String
895
+ }
896
+
897
+ # AddressLookupTable: CreateLookupTable
898
+ type CreateLookupTableInstructionData {
899
+ bumpSeed: BigInt # FIXME:*
900
+ lookupTableAccount: Account
901
+ lookupTableAuthority: Account
902
+ payerAccount: Account
903
+ recentSlot: BigInt
904
+ systemProgram: Account
905
+ }
906
+ type CreateLookupTableInstruction implements TransactionInstruction {
907
+ data: CreateLookupTableInstructionData
908
+ meta: JsonParsedInstructionMeta
909
+ programId: String
910
+ }
911
+
912
+ # AddressLookupTable: ExtendLookupTable
913
+ type ExtendLookupTableInstructionData {
914
+ lookupTableAccount: Account
915
+ lookupTableAuthority: Account
916
+ newAddresses: [String]
917
+ payerAccount: Account
918
+ systemProgram: Account
919
+ }
920
+ type ExtendLookupTableInstruction implements TransactionInstruction {
921
+ data: ExtendLookupTableInstructionData
922
+ meta: JsonParsedInstructionMeta
923
+ programId: String
924
+ }
925
+
926
+ # AddressLookupTable: FreezeLookupTable
927
+ type FreezeLookupTableInstructionData {
928
+ lookupTableAccount: Account
929
+ lookupTableAuthority: Account
930
+ }
931
+ type FreezeLookupTableInstruction implements TransactionInstruction {
932
+ data: FreezeLookupTableInstructionData
933
+ meta: JsonParsedInstructionMeta
934
+ programId: String
935
+ }
936
+
937
+ # AddressLookupTable: DeactivateLookupTable
938
+ type DeactivateLookupTableInstructionData {
939
+ lookupTableAccount: Account
940
+ lookupTableAuthority: Account
941
+ }
942
+ type DeactivateLookupTableInstruction implements TransactionInstruction {
943
+ data: DeactivateLookupTableInstructionData
944
+ meta: JsonParsedInstructionMeta
945
+ programId: String
946
+ }
947
+
948
+ # AddressLookupTable: CloseLookupTable
949
+ type CloseLookupTableInstructionData {
950
+ lookupTableAccount: Account
951
+ lookupTableAuthority: Account
952
+ recipient: Account
953
+ }
954
+ type CloseLookupTableInstruction implements TransactionInstruction {
955
+ data: CloseLookupTableInstructionData
956
+ meta: JsonParsedInstructionMeta
957
+ programId: String
958
+ }
959
+
960
+ # BpfLoader: Write
961
+ type BpfLoaderWriteInstructionData {
962
+ account: Account
963
+ bytes: String
964
+ offset: BigInt # FIXME:*
965
+ }
966
+ type BpfLoaderWriteInstruction implements TransactionInstruction {
967
+ data: BpfLoaderWriteInstructionData
968
+ meta: JsonParsedInstructionMeta
969
+ programId: String
970
+ }
971
+
972
+ # BpfLoader: Finalize
973
+ type BpfLoaderFinalizeInstructionData {
974
+ account: Account
975
+ }
976
+ type BpfLoaderFinalizeInstruction implements TransactionInstruction {
977
+ data: BpfLoaderFinalizeInstructionData
978
+ meta: JsonParsedInstructionMeta
979
+ programId: String
980
+ }
981
+
982
+ # BpfUpgradeableLoader: InitializeBuffer
983
+ type BpfUpgradeableLoaderInitializeBufferInstructionData {
984
+ account: Account
985
+ }
986
+ type BpfUpgradeableLoaderInitializeBufferInstruction implements TransactionInstruction {
987
+ data: BpfUpgradeableLoaderInitializeBufferInstructionData
988
+ meta: JsonParsedInstructionMeta
989
+ programId: String
990
+ }
991
+
992
+ # BpfUpgradeableLoader: Write
993
+ type BpfUpgradeableLoaderWriteInstructionData {
994
+ account: Account
995
+ authority: Account
996
+ bytes: String
997
+ offset: BigInt # FIXME:*
998
+ }
999
+ type BpfUpgradeableLoaderWriteInstruction implements TransactionInstruction {
1000
+ data: BpfUpgradeableLoaderWriteInstructionData
1001
+ meta: JsonParsedInstructionMeta
1002
+ programId: String
1003
+ }
1004
+
1005
+ # BpfUpgradeableLoader: DeployWithMaxDataLen
1006
+ type BpfUpgradeableLoaderDeployWithMaxDataLenInstructionData {
1007
+ authority: Account
1008
+ bufferAccount: Account
1009
+ clockSysvar: String
1010
+ maxDataLen: BigInt
1011
+ payerAccount: Account
1012
+ programAccount: Account
1013
+ programDataAccount: Account
1014
+ rentSysvar: String
1015
+ }
1016
+ type BpfUpgradeableLoaderDeployWithMaxDataLenInstruction implements TransactionInstruction {
1017
+ data: BpfUpgradeableLoaderDeployWithMaxDataLenInstructionData
1018
+ meta: JsonParsedInstructionMeta
1019
+ programId: String
1020
+ }
1021
+
1022
+ # BpfUpgradeableLoader: Upgrade
1023
+ type BpfUpgradeableLoaderUpgradeInstructionData {
1024
+ authority: Account
1025
+ bufferAccount: Account
1026
+ clockSysvar: String
1027
+ programAccount: Account
1028
+ programDataAccount: Account
1029
+ rentSysvar: String
1030
+ spillAccount: Account
1031
+ }
1032
+ type BpfUpgradeableLoaderUpgradeInstruction implements TransactionInstruction {
1033
+ data: BpfUpgradeableLoaderUpgradeInstructionData
1034
+ meta: JsonParsedInstructionMeta
1035
+ programId: String
1036
+ }
1037
+
1038
+ # BpfUpgradeableLoader: SetAuthority
1039
+ type BpfUpgradeableLoaderSetAuthorityInstructionData {
1040
+ account: Account
1041
+ authority: Account
1042
+ newAuthority: Account
1043
+ }
1044
+ type BpfUpgradeableLoaderSetAuthorityInstruction implements TransactionInstruction {
1045
+ data: BpfUpgradeableLoaderSetAuthorityInstructionData
1046
+ meta: JsonParsedInstructionMeta
1047
+ programId: String
1048
+ }
1049
+
1050
+ # BpfUpgradeableLoader: SetAuthorityChecked
1051
+ type BpfUpgradeableLoaderSetAuthorityCheckedInstructionData {
1052
+ account: Account
1053
+ authority: Account
1054
+ newAuthority: Account
1055
+ }
1056
+ type BpfUpgradeableLoaderSetAuthorityCheckedInstruction implements TransactionInstruction {
1057
+ data: BpfUpgradeableLoaderSetAuthorityCheckedInstructionData
1058
+ meta: JsonParsedInstructionMeta
1059
+ programId: String
1060
+ }
1061
+
1062
+ # BpfUpgradeableLoader: Close
1063
+ type BpfUpgradeableLoaderCloseInstructionData {
1064
+ account: Account
1065
+ authority: Account
1066
+ programAccount: Account
1067
+ recipient: Account
1068
+ }
1069
+ type BpfUpgradeableLoaderCloseInstruction implements TransactionInstruction {
1070
+ data: BpfUpgradeableLoaderCloseInstructionData
1071
+ meta: JsonParsedInstructionMeta
1072
+ programId: String
1073
+ }
1074
+
1075
+ # BpfUpgradeableLoader: ExtendProgram
1076
+ type BpfUpgradeableLoaderExtendProgramInstructionData {
1077
+ additionalBytes: BigInt
1078
+ payerAccount: Account
1079
+ programAccount: Account
1080
+ programDataAccount: Account
1081
+ systemProgram: Account
1082
+ }
1083
+ type BpfUpgradeableLoaderExtendProgramInstruction implements TransactionInstruction {
1084
+ data: BpfUpgradeableLoaderExtendProgramInstructionData
1085
+ meta: JsonParsedInstructionMeta
1086
+ programId: String
1087
+ }
1088
+
1089
+ # SplAssociatedTokenAccount: Create
1090
+ type SplAssociatedTokenCreateInstructionData {
1091
+ account: Account
1092
+ mint: String
1093
+ source: Account
1094
+ systemProgram: Account
1095
+ tokenProgram: Account
1096
+ wallet: Account
1097
+ }
1098
+ type SplAssociatedTokenCreateInstruction implements TransactionInstruction {
1099
+ data: SplAssociatedTokenCreateInstructionData
1100
+ meta: JsonParsedInstructionMeta
1101
+ programId: String
1102
+ }
1103
+
1104
+ # SplAssociatedTokenAccount: CreateIdempotent
1105
+ type SplAssociatedTokenCreateIdempotentInstructionData {
1106
+ account: Account
1107
+ mint: String
1108
+ source: Account
1109
+ systemProgram: Account
1110
+ tokenProgram: Account
1111
+ wallet: Account
1112
+ }
1113
+ type SplAssociatedTokenCreateIdempotentInstruction implements TransactionInstruction {
1114
+ data: SplAssociatedTokenCreateIdempotentInstructionData
1115
+ meta: JsonParsedInstructionMeta
1116
+ programId: String
1117
+ }
1118
+
1119
+ # SplAssociatedTokenAccount: RecoverNested
1120
+ type SplAssociatedTokenRecoverNestedInstructionData {
1121
+ destination: Account
1122
+ nestedMint: Account
1123
+ nestedOwner: Account
1124
+ nestedSource: Account
1125
+ ownerMint: Account
1126
+ tokenProgram: Account
1127
+ wallet: Account
1128
+ }
1129
+ type SplAssociatedTokenRecoverNestedInstruction implements TransactionInstruction {
1130
+ data: SplAssociatedTokenRecoverNestedInstructionData
1131
+ meta: JsonParsedInstructionMeta
1132
+ programId: String
1133
+ }
1134
+
1135
+ # SplMemo
1136
+ type SplMemoInstructionData {
1137
+ data: String
1138
+ }
1139
+ type SplMemoInstruction implements TransactionInstruction {
1140
+ data: SplMemoInstructionData
1141
+ meta: JsonParsedInstructionMeta
1142
+ programId: String
1143
+ }
1144
+
1145
+ # SplToken: InitializeMint
1146
+ type SplTokenInitializeMintInstructionData {
1147
+ decimals: BigInt # FIXME:*
1148
+ freezeAuthority: Account
1149
+ mint: Account
1150
+ mintAuthority: Account
1151
+ rentSysvar: String
1152
+ }
1153
+ type SplTokenInitializeMintInstruction implements TransactionInstruction {
1154
+ data: SplTokenInitializeMintInstructionData
1155
+ meta: JsonParsedInstructionMeta
1156
+ programId: String
1157
+ }
1158
+
1159
+ # SplToken: InitializeMint2
1160
+ type SplTokenInitializeMint2InstructionData {
1161
+ decimals: BigInt # FIXME:*
1162
+ freezeAuthority: Account
1163
+ mint: Account
1164
+ mintAuthority: Account
1165
+ }
1166
+ type SplTokenInitializeMint2Instruction implements TransactionInstruction {
1167
+ data: SplTokenInitializeMint2InstructionData
1168
+ meta: JsonParsedInstructionMeta
1169
+ programId: String
1170
+ }
1171
+
1172
+ # SplToken: InitializeAccount
1173
+ type SplTokenInitializeAccountInstructionData {
1174
+ account: Account
1175
+ mint: Account
1176
+ owner: Account
1177
+ rentSysvar: String
1178
+ }
1179
+ type SplTokenInitializeAccountInstruction implements TransactionInstruction {
1180
+ data: SplTokenInitializeAccountInstructionData
1181
+ meta: JsonParsedInstructionMeta
1182
+ programId: String
1183
+ }
1184
+
1185
+ # SplToken: InitializeAccount2
1186
+ type SplTokenInitializeAccount2InstructionData {
1187
+ account: Account
1188
+ mint: Account
1189
+ owner: Account
1190
+ rentSysvar: String
1191
+ }
1192
+ type SplTokenInitializeAccount2Instruction implements TransactionInstruction {
1193
+ data: SplTokenInitializeAccount2InstructionData
1194
+ meta: JsonParsedInstructionMeta
1195
+ programId: String
1196
+ }
1197
+
1198
+ # SplToken: InitializeAccount3
1199
+ type SplTokenInitializeAccount3InstructionData {
1200
+ account: Account
1201
+ mint: Account
1202
+ owner: Account
1203
+ }
1204
+ type SplTokenInitializeAccount3Instruction implements TransactionInstruction {
1205
+ data: SplTokenInitializeAccount3InstructionData
1206
+ meta: JsonParsedInstructionMeta
1207
+ programId: String
1208
+ }
1209
+
1210
+ # SplToken: InitializeMultisig
1211
+ type SplTokenInitializeMultisigInstructionData {
1212
+ m: BigInt # FIXME:*
1213
+ multisig: Account
1214
+ rentSysvar: String
1215
+ signers: [String]
1216
+ }
1217
+ type SplTokenInitializeMultisigInstruction implements TransactionInstruction {
1218
+ data: SplTokenInitializeMultisigInstructionData
1219
+ meta: JsonParsedInstructionMeta
1220
+ programId: String
1221
+ }
1222
+
1223
+ # SplToken: InitializeMultisig2
1224
+ type SplTokenInitializeMultisig2InstructionData {
1225
+ m: BigInt # FIXME:*
1226
+ multisig: Account
1227
+ signers: [String]
1228
+ }
1229
+ type SplTokenInitializeMultisig2Instruction implements TransactionInstruction {
1230
+ data: SplTokenInitializeMultisig2InstructionData
1231
+ meta: JsonParsedInstructionMeta
1232
+ programId: String
1233
+ }
1234
+
1235
+ # SplToken: Transfer
1236
+ type SplTokenTransferInstructionData {
1237
+ amount: String
1238
+ authority: Account
1239
+ destination: Account
1240
+ multisigAuthority: Account
1241
+ source: Account
1242
+ }
1243
+ type SplTokenTransferInstruction implements TransactionInstruction {
1244
+ data: SplTokenTransferInstructionData
1245
+ meta: JsonParsedInstructionMeta
1246
+ programId: String
1247
+ }
1248
+
1249
+ # SplToken: Approve
1250
+ type SplTokenApproveInstructionData {
1251
+ amount: String
1252
+ delegate: Account
1253
+ multisigOwner: Account
1254
+ owner: Account
1255
+ source: Account
1256
+ }
1257
+ type SplTokenApproveInstruction implements TransactionInstruction {
1258
+ data: SplTokenApproveInstructionData
1259
+ meta: JsonParsedInstructionMeta
1260
+ programId: String
1261
+ }
1262
+
1263
+ # SplToken: Revoke
1264
+ type SplTokenRevokeInstructionData {
1265
+ multisigOwner: Account
1266
+ owner: Account
1267
+ source: Account
1268
+ }
1269
+ type SplTokenRevokeInstruction implements TransactionInstruction {
1270
+ data: SplTokenRevokeInstructionData
1271
+ meta: JsonParsedInstructionMeta
1272
+ programId: String
1273
+ }
1274
+
1275
+ # SplToken: SetAuthority
1276
+ type SplTokenSetAuthorityInstructionData {
1277
+ authority: Account
1278
+ authorityType: String
1279
+ multisigAuthority: Account
1280
+ newAuthority: Account
1281
+ }
1282
+ type SplTokenSetAuthorityInstruction implements TransactionInstruction {
1283
+ data: SplTokenSetAuthorityInstructionData
1284
+ meta: JsonParsedInstructionMeta
1285
+ programId: String
1286
+ }
1287
+
1288
+ # SplToken: MintTo
1289
+ type SplTokenMintToInstructionData {
1290
+ account: Account
1291
+ amount: String
1292
+ authority: Account
1293
+ mint: Account
1294
+ mintAuthority: Account
1295
+ multisigMintAuthority: Account
1296
+ }
1297
+ type SplTokenMintToInstruction implements TransactionInstruction {
1298
+ data: SplTokenMintToInstructionData
1299
+ meta: JsonParsedInstructionMeta
1300
+ programId: String
1301
+ }
1302
+
1303
+ # SplToken: Burn
1304
+ type SplTokenBurnInstructionData {
1305
+ account: Account
1306
+ amount: String
1307
+ authority: Account
1308
+ mint: Account
1309
+ multisigAuthority: Account
1310
+ }
1311
+ type SplTokenBurnInstruction implements TransactionInstruction {
1312
+ data: SplTokenBurnInstructionData
1313
+ meta: JsonParsedInstructionMeta
1314
+ programId: String
1315
+ }
1316
+
1317
+ # SplToken: CloseAccount
1318
+ type SplTokenCloseAccountInstructionData {
1319
+ account: Account
1320
+ destination: Account
1321
+ multisigOwner: Account
1322
+ owner: Account
1323
+ }
1324
+ type SplTokenCloseAccountInstruction implements TransactionInstruction {
1325
+ data: SplTokenCloseAccountInstructionData
1326
+ meta: JsonParsedInstructionMeta
1327
+ programId: String
1328
+ }
1329
+
1330
+ # SplToken: FreezeAccount
1331
+ type SplTokenFreezeAccountInstructionData {
1332
+ account: Account
1333
+ freezeAuthority: Account
1334
+ mint: Account
1335
+ multisigFreezeAuthority: Account
1336
+ }
1337
+ type SplTokenFreezeAccountInstruction implements TransactionInstruction {
1338
+ data: SplTokenFreezeAccountInstructionData
1339
+ meta: JsonParsedInstructionMeta
1340
+ programId: String
1341
+ }
1342
+
1343
+ # SplToken: ThawAccount
1344
+ type SplTokenThawAccountInstructionData {
1345
+ account: Account
1346
+ freezeAuthority: Account
1347
+ mint: Account
1348
+ multisigFreezeAuthority: Account
1349
+ }
1350
+ type SplTokenThawAccountInstruction implements TransactionInstruction {
1351
+ data: SplTokenThawAccountInstructionData
1352
+ meta: JsonParsedInstructionMeta
1353
+ programId: String
1354
+ }
1355
+
1356
+ # SplToken: TransferChecked
1357
+ type SplTokenTransferCheckedInstructionData {
1358
+ amount: String
1359
+ authority: Account
1360
+ decimals: BigInt # FIXME:*
1361
+ destination: Account
1362
+ mint: Account
1363
+ multisigAuthority: Account
1364
+ source: Account
1365
+ tokenAmount: String
1366
+ }
1367
+ type SplTokenTransferCheckedInstruction implements TransactionInstruction {
1368
+ data: SplTokenTransferCheckedInstructionData
1369
+ meta: JsonParsedInstructionMeta
1370
+ programId: String
1371
+ }
1372
+
1373
+ # SplToken: ApproveChecked
1374
+ type SplTokenApproveCheckedInstructionData {
1375
+ delegate: Account
1376
+ mint: Account
1377
+ multisigOwner: Account
1378
+ owner: Account
1379
+ source: Account
1380
+ tokenAmount: String
1381
+ }
1382
+ type SplTokenApproveCheckedInstruction implements TransactionInstruction {
1383
+ data: SplTokenApproveCheckedInstructionData
1384
+ meta: JsonParsedInstructionMeta
1385
+ programId: String
1386
+ }
1387
+
1388
+ # SplToken: MintToChecked
1389
+ type SplTokenMintToCheckedInstructionData {
1390
+ account: Account
1391
+ authority: Account
1392
+ mint: Account
1393
+ mintAuthority: Account
1394
+ multisigMintAuthority: Account
1395
+ tokenAmount: String
1396
+ }
1397
+ type SplTokenMintToCheckedInstruction implements TransactionInstruction {
1398
+ data: SplTokenMintToCheckedInstructionData
1399
+ meta: JsonParsedInstructionMeta
1400
+ programId: String
1401
+ }
1402
+
1403
+ # SplToken: BurnChecked
1404
+ type SplTokenBurnCheckedInstructionData {
1405
+ account: Account
1406
+ authority: Account
1407
+ mint: Account
1408
+ multisigAuthority: Account
1409
+ tokenAmount: String
1410
+ }
1411
+ type SplTokenBurnCheckedInstruction implements TransactionInstruction {
1412
+ data: SplTokenBurnCheckedInstructionData
1413
+ meta: JsonParsedInstructionMeta
1414
+ programId: String
1415
+ }
1416
+
1417
+ # SplToken: SyncNative
1418
+ type SplTokenSyncNativeInstructionData {
1419
+ account: Account
1420
+ }
1421
+ type SplTokenSyncNativeInstruction implements TransactionInstruction {
1422
+ data: SplTokenSyncNativeInstructionData
1423
+ meta: JsonParsedInstructionMeta
1424
+ programId: String
1425
+ }
1426
+
1427
+ # SplToken: GetAccountDataSize
1428
+ type SplTokenGetAccountDataSizeInstructionData {
1429
+ extensionTypes: [String]
1430
+ mint: Account
1431
+ }
1432
+ type SplTokenGetAccountDataSizeInstruction implements TransactionInstruction {
1433
+ data: SplTokenGetAccountDataSizeInstructionData
1434
+ meta: JsonParsedInstructionMeta
1435
+ programId: String
1436
+ }
1437
+
1438
+ # SplToken: InitializeImmutableOwner
1439
+ type SplTokenInitializeImmutableOwnerInstructionData {
1440
+ account: Account
1441
+ }
1442
+ type SplTokenInitializeImmutableOwnerInstruction implements TransactionInstruction {
1443
+ data: SplTokenInitializeImmutableOwnerInstructionData
1444
+ meta: JsonParsedInstructionMeta
1445
+ programId: String
1446
+ }
1447
+
1448
+ # SplToken: AmountToUiAmount
1449
+ type SplTokenAmountToUiAmountInstructionData {
1450
+ amount: String
1451
+ mint: Account
1452
+ }
1453
+ type SplTokenAmountToUiAmountInstruction implements TransactionInstruction {
1454
+ data: SplTokenAmountToUiAmountInstructionData
1455
+ meta: JsonParsedInstructionMeta
1456
+ programId: String
1457
+ }
1458
+
1459
+ # SplToken: UiAmountToAmount
1460
+ type SplTokenUiAmountToAmountInstructionData {
1461
+ mint: Account
1462
+ uiAmount: String
1463
+ }
1464
+ type SplTokenUiAmountToAmountInstruction implements TransactionInstruction {
1465
+ data: SplTokenUiAmountToAmountInstructionData
1466
+ meta: JsonParsedInstructionMeta
1467
+ programId: String
1468
+ }
1469
+
1470
+ # SplToken: InitializeMintCloseAuthority
1471
+ type SplTokenInitializeMintCloseAuthorityInstructionData {
1472
+ mint: Account
1473
+ newAuthority: Account
1474
+ }
1475
+ type SplTokenInitializeMintCloseAuthorityInstruction implements TransactionInstruction {
1476
+ data: SplTokenInitializeMintCloseAuthorityInstructionData
1477
+ meta: JsonParsedInstructionMeta
1478
+ programId: String
1479
+ }
1480
+
1481
+ # TODO: Extensions!
1482
+ # - TransferFeeExtension
1483
+ # - ConfidentialTransferFeeExtension
1484
+ # - DefaultAccountStateExtension
1485
+ # - Reallocate
1486
+ # - MemoTransferExtension
1487
+ # - CreateNativeMint
1488
+ # - InitializeNonTransferableMint
1489
+ # - InterestBearingMintExtension
1490
+ # - CpiGuardExtension
1491
+ # - InitializePermanentDelegate
1492
+ # - TransferHookExtension
1493
+ # - ConfidentialTransferFeeExtension
1494
+ # - WithdrawExcessLamports
1495
+ # - MetadataPointerExtension
1496
+
1497
+ type Lockup {
1498
+ custodian: Account
1499
+ epoch: BigInt
1500
+ unixTimestamp: BigInt
1501
+ }
1502
+
1503
+ # Stake: Initialize
1504
+ type StakeInitializeInstructionDataAuthorized {
1505
+ staker: Account
1506
+ withdrawer: Account
1507
+ }
1508
+ type StakeInitializeInstructionData {
1509
+ authorized: StakeInitializeInstructionDataAuthorized
1510
+ lockup: Lockup
1511
+ rentSysvar: String
1512
+ stakeAccount: Account
1513
+ }
1514
+ type StakeInitializeInstruction implements TransactionInstruction {
1515
+ data: StakeInitializeInstructionData
1516
+ meta: JsonParsedInstructionMeta
1517
+ programId: String
1518
+ }
1519
+
1520
+ # Stake: Authorize
1521
+ type StakeAuthorizeInstructionData {
1522
+ authority: Account
1523
+ authorityType: String
1524
+ clockSysvar: String
1525
+ custodian: Account
1526
+ newAuthority: Account
1527
+ stakeAccount: Account
1528
+ }
1529
+ type StakeAuthorizeInstruction implements TransactionInstruction {
1530
+ data: StakeAuthorizeInstructionData
1531
+ meta: JsonParsedInstructionMeta
1532
+ programId: String
1533
+ }
1534
+
1535
+ # Stake: DelegateStake
1536
+ type StakeDelegateStakeInstructionData {
1537
+ clockSysvar: String
1538
+ stakeAccount: Account
1539
+ stakeAuthority: Account
1540
+ stakeConfigAccount: Account
1541
+ stakeHistorySysvar: String
1542
+ voteAccount: Account
1543
+ }
1544
+ type StakeDelegateStakeInstruction implements TransactionInstruction {
1545
+ data: StakeDelegateStakeInstructionData
1546
+ meta: JsonParsedInstructionMeta
1547
+ programId: String
1548
+ }
1549
+
1550
+ # Stake: Split
1551
+ type StakeSplitInstructionData {
1552
+ lamports: BigInt
1553
+ newSplitAccount: Account
1554
+ stakeAccount: Account
1555
+ stakeAuthority: Account
1556
+ }
1557
+ type StakeSplitInstruction implements TransactionInstruction {
1558
+ data: StakeSplitInstructionData
1559
+ meta: JsonParsedInstructionMeta
1560
+ programId: String
1561
+ }
1562
+
1563
+ # Stake: Withdraw
1564
+ type StakeWithdrawInstructionData {
1565
+ clockSysvar: String
1566
+ destination: Account
1567
+ lamports: BigInt
1568
+ stakeAccount: Account
1569
+ withdrawAuthority: Account
1570
+ }
1571
+ type StakeWithdrawInstruction implements TransactionInstruction {
1572
+ data: StakeWithdrawInstructionData
1573
+ meta: JsonParsedInstructionMeta
1574
+ programId: String
1575
+ }
1576
+
1577
+ # Stake: Deactivate
1578
+ type StakeDeactivateInstructionData {
1579
+ clockSysvar: String
1580
+ stakeAccount: Account
1581
+ stakeAuthority: Account
1582
+ }
1583
+ type StakeDeactivateInstruction implements TransactionInstruction {
1584
+ data: StakeDeactivateInstructionData
1585
+ meta: JsonParsedInstructionMeta
1586
+ programId: String
1587
+ }
1588
+
1589
+ # Stake: SetLockup
1590
+ type StakeSetLockupInstructionData {
1591
+ custodian: Account
1592
+ lockup: Lockup
1593
+ stakeAccount: Account
1594
+ }
1595
+ type StakeSetLockupInstruction implements TransactionInstruction {
1596
+ data: StakeSetLockupInstructionData
1597
+ meta: JsonParsedInstructionMeta
1598
+ programId: String
1599
+ }
1600
+
1601
+ # Stake: Merge
1602
+ type StakeMergeInstructionData {
1603
+ clockSysvar: String
1604
+ destination: Account
1605
+ source: Account
1606
+ stakeAuthority: Account
1607
+ stakeHistorySysvar: String
1608
+ }
1609
+ type StakeMergeInstruction implements TransactionInstruction {
1610
+ data: StakeMergeInstructionData
1611
+ meta: JsonParsedInstructionMeta
1612
+ programId: String
1613
+ }
1614
+
1615
+ # Stake: AuthorizeWithSeed
1616
+ type StakeAuthorizeWithSeedInstructionData {
1617
+ authorityBase: Account
1618
+ authorityOwner: Account
1619
+ authoritySeed: String
1620
+ authorityType: String
1621
+ clockSysvar: String
1622
+ custodian: Account
1623
+ newAuthorized: Account
1624
+ stakeAccount: Account
1625
+ }
1626
+ type StakeAuthorizeWithSeedInstruction implements TransactionInstruction {
1627
+ data: StakeAuthorizeWithSeedInstructionData
1628
+ meta: JsonParsedInstructionMeta
1629
+ programId: String
1630
+ }
1631
+
1632
+ # Stake: InitializeChecked
1633
+ type StakeInitializeCheckedInstructionDataAuthorized {
1634
+ rentSysvar: String
1635
+ stakeAccount: Account
1636
+ staker: Account
1637
+ withdrawer: Account
1638
+ }
1639
+ type StakeInitializeCheckedInstruction implements TransactionInstruction {
1640
+ data: StakeInitializeCheckedInstructionDataAuthorized
1641
+ meta: JsonParsedInstructionMeta
1642
+ programId: String
1643
+ }
1644
+
1645
+ # Stake: AuthorizeChecked
1646
+ type StakeAuthorizeCheckedInstructionData {
1647
+ authority: Account
1648
+ authorityType: String
1649
+ clockSysvar: String
1650
+ custodian: Account
1651
+ newAuthority: Account
1652
+ stakeAccount: Account
1653
+ }
1654
+ type StakeAuthorizeCheckedInstruction implements TransactionInstruction {
1655
+ data: StakeAuthorizeCheckedInstructionData
1656
+ meta: JsonParsedInstructionMeta
1657
+ programId: String
1658
+ }
1659
+
1660
+ # Stake: AuthorizeCheckedWithSeed
1661
+ type StakeAuthorizeCheckedWithSeedInstructionData {
1662
+ authorityBase: Account
1663
+ authorityOwner: Account
1664
+ authoritySeed: String
1665
+ authorityType: String
1666
+ clockSysvar: String
1667
+ custodian: Account
1668
+ newAuthorized: Account
1669
+ stakeAccount: Account
1670
+ }
1671
+ type StakeAuthorizeCheckedWithSeedInstruction implements TransactionInstruction {
1672
+ data: StakeAuthorizeCheckedWithSeedInstructionData
1673
+ meta: JsonParsedInstructionMeta
1674
+ programId: String
1675
+ }
1676
+
1677
+ # Stake: SetLockupChecked
1678
+ type StakeSetLockupCheckedInstructionData {
1679
+ custodian: Account
1680
+ lockup: Lockup
1681
+ stakeAccount: Account
1682
+ }
1683
+ type StakeSetLockupCheckedInstruction implements TransactionInstruction {
1684
+ data: StakeSetLockupCheckedInstructionData
1685
+ meta: JsonParsedInstructionMeta
1686
+ programId: String
1687
+ }
1688
+
1689
+ # Stake: DeactivateDelinquent
1690
+ type StakeDeactivateDelinquentInstructionData {
1691
+ referenceVoteAccount: Account
1692
+ stakeAccount: Account
1693
+ voteAccount: Account
1694
+ }
1695
+ type StakeDeactivateDelinquentInstruction implements TransactionInstruction {
1696
+ data: StakeDeactivateDelinquentInstructionData
1697
+ meta: JsonParsedInstructionMeta
1698
+ programId: String
1699
+ }
1700
+
1701
+ # Stake: Redelegate
1702
+ type StakeRedelegateInstructionData {
1703
+ newStakeAccount: Account
1704
+ stakeAccount: Account
1705
+ stakeAuthority: Account
1706
+ stakeConfigAccount: Account
1707
+ voteAccount: Account
1708
+ }
1709
+ type StakeRedelegateInstruction implements TransactionInstruction {
1710
+ data: StakeRedelegateInstructionData
1711
+ meta: JsonParsedInstructionMeta
1712
+ programId: String
1713
+ }
1714
+
1715
+ # System: CreateAccount
1716
+ type CreateAccountInstructionData {
1717
+ lamports: BigInt
1718
+ newAccount: Account
1719
+ owner: Account
1720
+ source: Account
1721
+ space: BigInt
1722
+ }
1723
+ type CreateAccountInstruction implements TransactionInstruction {
1724
+ data: CreateAccountInstructionData
1725
+ meta: JsonParsedInstructionMeta
1726
+ programId: String
1727
+ }
1728
+
1729
+ # System: Assign
1730
+ type AssignInstructionData {
1731
+ account: Account
1732
+ owner: Account
1733
+ }
1734
+ type AssignInstruction implements TransactionInstruction {
1735
+ data: AssignInstructionData
1736
+ meta: JsonParsedInstructionMeta
1737
+ programId: String
1738
+ }
1739
+
1740
+ # System: Transfer
1741
+ type TransferInstructionData {
1742
+ destination: Account
1743
+ lamports: BigInt
1744
+ source: Account
1745
+ }
1746
+ type TransferInstruction implements TransactionInstruction {
1747
+ data: TransferInstructionData
1748
+ meta: JsonParsedInstructionMeta
1749
+ programId: String
1750
+ }
1751
+
1752
+ # System: CreateAccountWithSeed
1753
+ type CreateAccountWithSeedInstructionData {
1754
+ base: Account
1755
+ lamports: BigInt
1756
+ owner: Account
1757
+ seed: String
1758
+ space: BigInt
1759
+ }
1760
+ type CreateAccountWithSeedInstruction implements TransactionInstruction {
1761
+ data: CreateAccountWithSeedInstructionData
1762
+ meta: JsonParsedInstructionMeta
1763
+ programId: String
1764
+ }
1765
+
1766
+ # System: AdvanceNonceAccount
1767
+ type AdvanceNonceAccountInstructionData {
1768
+ nonceAccount: Account
1769
+ nonceAuthority: Account
1770
+ recentBlockhashesSysvar: String
1771
+ }
1772
+ type AdvanceNonceAccountInstruction implements TransactionInstruction {
1773
+ data: AdvanceNonceAccountInstructionData
1774
+ meta: JsonParsedInstructionMeta
1775
+ programId: String
1776
+ }
1777
+
1778
+ # System: WithdrawNonceAccount
1779
+ type WithdrawNonceAccountInstructionData {
1780
+ destination: Account
1781
+ lamports: BigInt
1782
+ nonceAccount: Account
1783
+ nonceAuthority: Account
1784
+ recentBlockhashesSysvar: String
1785
+ rentSysvar: String
1786
+ }
1787
+ type WithdrawNonceAccountInstruction implements TransactionInstruction {
1788
+ data: WithdrawNonceAccountInstructionData
1789
+ meta: JsonParsedInstructionMeta
1790
+ programId: String
1791
+ }
1792
+
1793
+ # System: InitializeNonceAccount
1794
+ type InitializeNonceAccountInstructionData {
1795
+ nonceAccount: Account
1796
+ nonceAuthority: Account
1797
+ recentBlockhashesSysvar: String
1798
+ rentSysvar: String
1799
+ }
1800
+ type InitializeNonceAccountInstruction implements TransactionInstruction {
1801
+ data: InitializeNonceAccountInstructionData
1802
+ meta: JsonParsedInstructionMeta
1803
+ programId: String
1804
+ }
1805
+
1806
+ # System: AuthorizeNonceAccount
1807
+ type AuthorizeNonceAccountInstructionData {
1808
+ newAuthorized: Account
1809
+ nonceAccount: Account
1810
+ nonceAuthority: Account
1811
+ }
1812
+ type AuthorizeNonceAccountInstruction implements TransactionInstruction {
1813
+ data: AuthorizeNonceAccountInstructionData
1814
+ meta: JsonParsedInstructionMeta
1815
+ programId: String
1816
+ }
1817
+
1818
+ # System: UpgradeNonceAccount
1819
+ type UpgradeNonceAccountInstructionData {
1820
+ nonceAccount: Account
1821
+ nonceAuthority: Account
1822
+ }
1823
+ type UpgradeNonceAccountInstruction implements TransactionInstruction {
1824
+ data: UpgradeNonceAccountInstructionData
1825
+ meta: JsonParsedInstructionMeta
1826
+ programId: String
1827
+ }
1828
+
1829
+ # System: Allocate
1830
+ type AllocateInstructionData {
1831
+ account: Account
1832
+ space: BigInt
1833
+ }
1834
+ type AllocateInstruction implements TransactionInstruction {
1835
+ data: AllocateInstructionData
1836
+ meta: JsonParsedInstructionMeta
1837
+ programId: String
1838
+ }
1839
+
1840
+ # System: AllocateWithSeed
1841
+ type AllocateWithSeedInstructionData {
1842
+ account: Account
1843
+ base: String
1844
+ owner: Account
1845
+ seed: String
1846
+ space: BigInt
1847
+ }
1848
+ type AllocateWithSeedInstruction implements TransactionInstruction {
1849
+ data: AllocateWithSeedInstructionData
1850
+ meta: JsonParsedInstructionMeta
1851
+ programId: String
1852
+ }
1853
+
1854
+ # System: AssignWithSeed
1855
+ type AssignWithSeedInstructionData {
1856
+ account: Account
1857
+ base: String
1858
+ owner: Account
1859
+ seed: String
1860
+ }
1861
+ type AssignWithSeedInstruction implements TransactionInstruction {
1862
+ data: AssignWithSeedInstructionData
1863
+ meta: JsonParsedInstructionMeta
1864
+ programId: String
1865
+ }
1866
+
1867
+ # System: TransferWithSeed
1868
+ type TransferWithSeedInstructionData {
1869
+ destination: Account
1870
+ lamports: BigInt
1871
+ source: Account
1872
+ sourceBase: String
1873
+ sourceOwner: Account
1874
+ sourceSeed: String
1875
+ }
1876
+ type TransferWithSeedInstruction implements TransactionInstruction {
1877
+ data: TransferWithSeedInstructionData
1878
+ meta: JsonParsedInstructionMeta
1879
+ programId: String
1880
+ }
1881
+
1882
+ # Vote: InitializeAccount
1883
+ type VoteInitializeAccountInstructionData {
1884
+ authorizedVoter: Account
1885
+ authorizedWithdrawer: Account
1886
+ clockSysvar: String
1887
+ commission: BigInt # FIXME:*
1888
+ node: Account
1889
+ rentSysvar: String
1890
+ voteAccount: Account
1891
+ }
1892
+ type VoteInitializeAccountInstruction implements TransactionInstruction {
1893
+ data: VoteInitializeAccountInstructionData
1894
+ meta: JsonParsedInstructionMeta
1895
+ programId: String
1896
+ }
1897
+
1898
+ # Vote: Authorize
1899
+ type VoteAuthorizeInstructionData {
1900
+ authority: Account
1901
+ authorityType: String
1902
+ clockSysvar: String
1903
+ newAuthority: Account
1904
+ voteAccount: Account
1905
+ }
1906
+ type VoteAuthorizeInstruction implements TransactionInstruction {
1907
+ data: VoteAuthorizeInstructionData
1908
+ meta: JsonParsedInstructionMeta
1909
+ programId: String
1910
+ }
1911
+
1912
+ # Vote: AuthorizeWithSeed
1913
+ type VoteAuthorizeWithSeedInstructionData {
1914
+ authorityBaseKey: String
1915
+ authorityOwner: Account
1916
+ authoritySeed: String
1917
+ authorityType: String
1918
+ clockSysvar: String
1919
+ newAuthority: Account
1920
+ voteAccount: Account
1921
+ }
1922
+ type VoteAuthorizeWithSeedInstruction implements TransactionInstruction {
1923
+ data: VoteAuthorizeWithSeedInstructionData
1924
+ meta: JsonParsedInstructionMeta
1925
+ programId: String
1926
+ }
1927
+
1928
+ # Vote: AuthorizeCheckedWithSeed
1929
+ type VoteAuthorizeCheckedWithSeedInstructionData {
1930
+ authorityBaseKey: String
1931
+ authorityOwner: Account
1932
+ authoritySeed: String
1933
+ authorityType: String
1934
+ clockSysvar: String
1935
+ newAuthority: Account
1936
+ voteAccount: Account
1937
+ }
1938
+ type VoteAuthorizeCheckedWithSeedInstruction implements TransactionInstruction {
1939
+ data: VoteAuthorizeCheckedWithSeedInstructionData
1940
+ meta: JsonParsedInstructionMeta
1941
+ programId: String
1942
+ }
1943
+
1944
+ type Vote {
1945
+ hash: String
1946
+ slots: [BigInt]
1947
+ timestamp: BigInt
1948
+ }
1949
+
1950
+ # Vote: Vote
1951
+ type VoteVoteInstructionData {
1952
+ clockSysvar: String
1953
+ slotHashesSysvar: String
1954
+ vote: Vote
1955
+ voteAccount: Account
1956
+ voteAuthority: Account
1957
+ }
1958
+ type VoteVoteInstruction implements TransactionInstruction {
1959
+ data: VoteVoteInstructionData
1960
+ meta: JsonParsedInstructionMeta
1961
+ programId: String
1962
+ }
1963
+
1964
+ type VoteStateUpdateLockout {
1965
+ confirmationCount: BigInt # FIXME:*
1966
+ slot: BigInt
1967
+ }
1968
+ type VoteStateUpdate {
1969
+ hash: String
1970
+ lockouts: [VoteStateUpdateLockout]
1971
+ root: BigInt
1972
+ timestamp: BigInt
1973
+ }
1974
+
1975
+ # Vote: UpdateVoteState
1976
+ type VoteUpdateVoteStateInstructionData {
1977
+ hash: String
1978
+ voteAccount: Account
1979
+ voteAuthority: Account
1980
+ voteStateUpdate: VoteStateUpdate
1981
+ }
1982
+ type VoteUpdateVoteStateInstruction implements TransactionInstruction {
1983
+ data: VoteUpdateVoteStateInstructionData
1984
+ meta: JsonParsedInstructionMeta
1985
+ programId: String
1986
+ }
1987
+
1988
+ # Vote: UpdateVoteStateSwitch
1989
+ type VoteUpdateVoteStateSwitchInstructionData {
1990
+ hash: String
1991
+ voteAccount: Account
1992
+ voteAuthority: Account
1993
+ voteStateUpdate: VoteStateUpdate
1994
+ }
1995
+ type VoteUpdateVoteStateSwitchInstruction implements TransactionInstruction {
1996
+ data: VoteUpdateVoteStateSwitchInstructionData
1997
+ meta: JsonParsedInstructionMeta
1998
+ programId: String
1999
+ }
2000
+
2001
+ # Vote: CompactUpdateVoteState
2002
+ type VoteCompactUpdateVoteStateInstructionData {
2003
+ hash: String
2004
+ voteAccount: Account
2005
+ voteAuthority: Account
2006
+ voteStateUpdate: VoteStateUpdate
2007
+ }
2008
+ type VoteCompactUpdateVoteStateInstruction implements TransactionInstruction {
2009
+ data: VoteCompactUpdateVoteStateInstructionData
2010
+ meta: JsonParsedInstructionMeta
2011
+ programId: String
2012
+ }
2013
+
2014
+ # Vote: CompactUpdateVoteStateSwitch
2015
+ type VoteCompactUpdateVoteStateSwitchInstructionData {
2016
+ hash: String
2017
+ voteAccount: Account
2018
+ voteAuthority: Account
2019
+ voteStateUpdate: VoteStateUpdate
2020
+ }
2021
+ type VoteCompactUpdateVoteStateSwitchInstruction implements TransactionInstruction {
2022
+ data: VoteCompactUpdateVoteStateSwitchInstructionData
2023
+ meta: JsonParsedInstructionMeta
2024
+ programId: String
2025
+ }
2026
+
2027
+ # Vote: Withdraw
2028
+ type VoteWithdrawInstructionData {
2029
+ destination: Account
2030
+ lamports: BigInt
2031
+ voteAccount: Account
2032
+ withdrawAuthority: Account
2033
+ }
2034
+ type VoteWithdrawInstruction implements TransactionInstruction {
2035
+ data: VoteWithdrawInstructionData
2036
+ meta: JsonParsedInstructionMeta
2037
+ programId: String
2038
+ }
2039
+
2040
+ # Vote: UpdateValidatorIdentity
2041
+ type VoteUpdateValidatorIdentityInstructionData {
2042
+ newValidatorIdentity: Account
2043
+ voteAccount: Account
2044
+ withdrawAuthority: Account
2045
+ }
2046
+ type VoteUpdateValidatorIdentityInstruction implements TransactionInstruction {
2047
+ data: VoteUpdateValidatorIdentityInstructionData
2048
+ meta: JsonParsedInstructionMeta
2049
+ programId: String
2050
+ }
2051
+
2052
+ # Vote: UpdateCommission
2053
+ type VoteUpdateCommissionInstructionData {
2054
+ commission: BigInt # FIXME:*
2055
+ voteAccount: Account
2056
+ withdrawAuthority: Account
2057
+ }
2058
+ type VoteUpdateCommissionInstruction implements TransactionInstruction {
2059
+ data: VoteUpdateCommissionInstructionData
2060
+ meta: JsonParsedInstructionMeta
2061
+ programId: String
2062
+ }
2063
+
2064
+ # Vote: VoteSwitch
2065
+ type VoteVoteSwitchInstructionData {
2066
+ clockSysvar: String
2067
+ hash: String
2068
+ slotHashesSysvar: String
2069
+ vote: Vote
2070
+ voteAccount: Account
2071
+ voteAuthority: Account
2072
+ }
2073
+ type VoteVoteSwitchInstruction implements TransactionInstruction {
2074
+ data: VoteVoteSwitchInstructionData
2075
+ meta: JsonParsedInstructionMeta
2076
+ programId: String
2077
+ }
2078
+
2079
+ # Vote: AuthorizeChecked
2080
+ type VoteAuthorizeCheckedInstructionData {
2081
+ authority: Account
2082
+ authorityType: String
2083
+ clockSysvar: String
2084
+ newAuthority: Account
2085
+ voteAccount: Account
2086
+ }
2087
+ type VoteAuthorizeCheckedInstruction implements TransactionInstruction {
2088
+ data: VoteAuthorizeCheckedInstructionData
2089
+ meta: JsonParsedInstructionMeta
2090
+ programId: String
2091
+ }
2092
+ `
2093
+ );
2094
+ var instructionResolvers = {
2095
+ TransactionInstruction: {
2096
+ __resolveType(instruction) {
2097
+ if (instruction.meta) {
2098
+ if (instruction.meta.program === "address-lookup-table") {
2099
+ if (instruction.meta.type === "createLookupTable") {
729
2100
  return "CreateLookupTableInstruction";
730
2101
  }
731
- if (instruction.info.type === "freezeLookupTable") {
2102
+ if (instruction.meta.type === "freezeLookupTable") {
732
2103
  return "FreezeLookupTableInstruction";
733
2104
  }
734
- if (instruction.info.type === "extendLookupTable") {
2105
+ if (instruction.meta.type === "extendLookupTable") {
735
2106
  return "ExtendLookupTableInstruction";
736
2107
  }
737
- if (instruction.info.type === "deactivateLookupTable") {
2108
+ if (instruction.meta.type === "deactivateLookupTable") {
738
2109
  return "DeactivateLookupTableInstruction";
739
2110
  }
740
- if (instruction.info.type === "closeLookupTable") {
2111
+ if (instruction.meta.type === "closeLookupTable") {
741
2112
  return "CloseLookupTableInstruction";
742
2113
  }
743
2114
  }
744
- if (instruction.program === "bpf-loader") {
745
- if (instruction.info.type === "write") {
2115
+ if (instruction.meta.program === "bpf-loader") {
2116
+ if (instruction.meta.type === "write") {
746
2117
  return "BpfLoaderWriteInstruction";
747
2118
  }
748
- if (instruction.info.type === "finalize") {
2119
+ if (instruction.meta.type === "finalize") {
749
2120
  return "BpfLoaderFinalizeInstruction";
750
2121
  }
751
2122
  }
752
- if (instruction.program === "bpf-upgradeable-loader") {
753
- if (instruction.info.type === "initializeBuffer") {
2123
+ if (instruction.meta.program === "bpf-upgradeable-loader") {
2124
+ if (instruction.meta.type === "initializeBuffer") {
754
2125
  return "BpfUpgradeableLoaderInitializeBufferInstruction";
755
2126
  }
756
- if (instruction.info.type === "write") {
2127
+ if (instruction.meta.type === "write") {
757
2128
  return "BpfUpgradeableLoaderWriteInstruction";
758
2129
  }
759
- if (instruction.info.type === "deployWithMaxDataLen") {
2130
+ if (instruction.meta.type === "deployWithMaxDataLen") {
760
2131
  return "BpfUpgradeableLoaderDeployWithMaxDataLenInstruction";
761
2132
  }
762
- if (instruction.info.type === "upgrade") {
2133
+ if (instruction.meta.type === "upgrade") {
763
2134
  return "BpfUpgradeableLoaderUpgradeInstruction";
764
2135
  }
765
- if (instruction.info.type === "setAuthority") {
2136
+ if (instruction.meta.type === "setAuthority") {
766
2137
  return "BpfUpgradeableLoaderSetAuthorityInstruction";
767
2138
  }
768
- if (instruction.info.type === "setAuthorityChecked") {
2139
+ if (instruction.meta.type === "setAuthorityChecked") {
769
2140
  return "BpfUpgradeableLoaderSetAuthorityCheckedInstruction";
770
2141
  }
771
- if (instruction.info.type === "close") {
2142
+ if (instruction.meta.type === "close") {
772
2143
  return "BpfUpgradeableLoaderCloseInstruction";
773
2144
  }
774
- if (instruction.info.type === "extendProgram") {
2145
+ if (instruction.meta.type === "extendProgram") {
775
2146
  return "BpfUpgradeableLoaderExtendProgramInstruction";
776
2147
  }
777
2148
  }
778
- if (instruction.program === "spl-associated-token-account") {
779
- if (instruction.info.type === "create") {
2149
+ if (instruction.meta.program === "spl-associated-token-account") {
2150
+ if (instruction.meta.type === "create") {
780
2151
  return "SplAssociatedTokenCreateInstruction";
781
2152
  }
782
- if (instruction.info.type === "createIdempotent") {
2153
+ if (instruction.meta.type === "createIdempotent") {
783
2154
  return "SplAssociatedTokenCreateIdempotentInstruction";
784
2155
  }
785
- if (instruction.info.type === "recoverNested") {
2156
+ if (instruction.meta.type === "recoverNested") {
786
2157
  return "SplAssociatedTokenRecoverNestedInstruction";
787
2158
  }
788
2159
  }
789
- if (instruction.program === "spl-memo") {
2160
+ if (instruction.meta.program === "spl-memo") {
790
2161
  return "SplMemoInstruction";
791
2162
  }
792
- if (instruction.program === "spl-token") {
793
- if (instruction.info.type === "initializeMint") {
2163
+ if (instruction.meta.program === "spl-token") {
2164
+ if (instruction.meta.type === "initializeMint") {
794
2165
  return "SplTokenInitializeMintInstruction";
795
2166
  }
796
- if (instruction.info.type === "initializeMint2") {
2167
+ if (instruction.meta.type === "initializeMint2") {
797
2168
  return "SplTokenInitializeMint2Instruction";
798
2169
  }
799
- if (instruction.info.type === "initializeAccount") {
2170
+ if (instruction.meta.type === "initializeAccount") {
800
2171
  return "SplTokenInitializeAccountInstruction";
801
2172
  }
802
- if (instruction.info.type === "initializeAccount2") {
2173
+ if (instruction.meta.type === "initializeAccount2") {
803
2174
  return "SplTokenInitializeAccount2Instruction";
804
2175
  }
805
- if (instruction.info.type === "initializeAccount3") {
2176
+ if (instruction.meta.type === "initializeAccount3") {
806
2177
  return "SplTokenInitializeAccount3Instruction";
807
2178
  }
808
- if (instruction.info.type === "initializeMultisig") {
2179
+ if (instruction.meta.type === "initializeMultisig") {
809
2180
  return "SplTokenInitializeMultisigInstruction";
810
2181
  }
811
- if (instruction.info.type === "initializeMultisig2") {
2182
+ if (instruction.meta.type === "initializeMultisig2") {
812
2183
  return "SplTokenInitializeMultisig2Instruction";
813
2184
  }
814
- if (instruction.info.type === "transfer") {
2185
+ if (instruction.meta.type === "transfer") {
815
2186
  return "SplTokenTransferInstruction";
816
2187
  }
817
- if (instruction.info.type === "approve") {
2188
+ if (instruction.meta.type === "approve") {
818
2189
  return "SplTokenApproveInstruction";
819
2190
  }
820
- if (instruction.info.type === "revoke") {
2191
+ if (instruction.meta.type === "revoke") {
821
2192
  return "SplTokenRevokeInstruction";
822
2193
  }
823
- if (instruction.info.type === "setAuthority") {
2194
+ if (instruction.meta.type === "setAuthority") {
824
2195
  return "SplTokenSetAuthorityInstruction";
825
2196
  }
826
- if (instruction.info.type === "mintTo") {
2197
+ if (instruction.meta.type === "mintTo") {
827
2198
  return "SplTokenMintToInstruction";
828
2199
  }
829
- if (instruction.info.type === "burn") {
2200
+ if (instruction.meta.type === "burn") {
830
2201
  return "SplTokenBurnInstruction";
831
2202
  }
832
- if (instruction.info.type === "closeAccount") {
2203
+ if (instruction.meta.type === "closeAccount") {
833
2204
  return "SplTokenCloseAccountInstruction";
834
2205
  }
835
- if (instruction.info.type === "freezeAccount") {
2206
+ if (instruction.meta.type === "freezeAccount") {
836
2207
  return "SplTokenFreezeAccountInstruction";
837
2208
  }
838
- if (instruction.info.type === "thawAccount") {
2209
+ if (instruction.meta.type === "thawAccount") {
839
2210
  return "SplTokenThawAccountInstruction";
840
2211
  }
841
- if (instruction.info.type === "transferChecked") {
2212
+ if (instruction.meta.type === "transferChecked") {
842
2213
  return "SplTokenTransferCheckedInstruction";
843
2214
  }
844
- if (instruction.info.type === "approveChecked") {
2215
+ if (instruction.meta.type === "approveChecked") {
845
2216
  return "SplTokenApproveCheckedInstruction";
846
2217
  }
847
- if (instruction.info.type === "mintToChecked") {
2218
+ if (instruction.meta.type === "mintToChecked") {
848
2219
  return "SplTokenMintToCheckedInstruction";
849
2220
  }
850
- if (instruction.info.type === "burnChecked") {
2221
+ if (instruction.meta.type === "burnChecked") {
851
2222
  return "SplTokenBurnCheckedInstruction";
852
2223
  }
853
- if (instruction.info.type === "syncNative") {
2224
+ if (instruction.meta.type === "syncNative") {
854
2225
  return "SplTokenSyncNativeInstruction";
855
2226
  }
856
- if (instruction.info.type === "getAccountDataSize") {
2227
+ if (instruction.meta.type === "getAccountDataSize") {
857
2228
  return "SplTokenGetAccountDataSizeInstruction";
858
2229
  }
859
- if (instruction.info.type === "initializeImmutableOwner") {
2230
+ if (instruction.meta.type === "initializeImmutableOwner") {
860
2231
  return "SplTokenInitializeImmutableOwnerInstruction";
861
2232
  }
862
- if (instruction.info.type === "amountToUiAmount") {
2233
+ if (instruction.meta.type === "amountToUiAmount") {
863
2234
  return "SplTokenAmountToUiAmountInstruction";
864
2235
  }
865
- if (instruction.info.type === "uiAmountToAmount") {
2236
+ if (instruction.meta.type === "uiAmountToAmount") {
866
2237
  return "SplTokenUiAmountToAmountInstruction";
867
2238
  }
868
- if (instruction.info.type === "initializeMintCloseAuthority") {
2239
+ if (instruction.meta.type === "initializeMintCloseAuthority") {
869
2240
  return "SplTokenInitializeMintCloseAuthorityInstruction";
870
2241
  }
871
2242
  }
872
- if (instruction.program === "stake") {
873
- if (instruction.info.type === "initialize") {
2243
+ if (instruction.meta.program === "stake") {
2244
+ if (instruction.meta.type === "initialize") {
874
2245
  return "StakeInitializeInstruction";
875
2246
  }
876
- if (instruction.info.type === "authorize") {
2247
+ if (instruction.meta.type === "authorize") {
877
2248
  return "StakeAuthorizeInstruction";
878
2249
  }
879
- if (instruction.info.type === "delegate") {
2250
+ if (instruction.meta.type === "delegate") {
880
2251
  return "StakeDelegateStakeInstruction";
881
2252
  }
882
- if (instruction.info.type === "split") {
2253
+ if (instruction.meta.type === "split") {
883
2254
  return "StakeSplitInstruction";
884
2255
  }
885
- if (instruction.info.type === "withdraw") {
2256
+ if (instruction.meta.type === "withdraw") {
886
2257
  return "StakeWithdrawInstruction";
887
2258
  }
888
- if (instruction.info.type === "deactivate") {
2259
+ if (instruction.meta.type === "deactivate") {
889
2260
  return "StakeDeactivateInstruction";
890
2261
  }
891
- if (instruction.info.type === "setLockup") {
2262
+ if (instruction.meta.type === "setLockup") {
892
2263
  return "StakeSetLockupInstruction";
893
2264
  }
894
- if (instruction.info.type === "merge") {
2265
+ if (instruction.meta.type === "merge") {
895
2266
  return "StakeMergeInstruction";
896
2267
  }
897
- if (instruction.info.type === "authorizeWithSeed") {
2268
+ if (instruction.meta.type === "authorizeWithSeed") {
898
2269
  return "StakeAuthorizeWithSeedInstruction";
899
2270
  }
900
- if (instruction.info.type === "initializeChecked") {
2271
+ if (instruction.meta.type === "initializeChecked") {
901
2272
  return "StakeInitializeCheckedInstruction";
902
2273
  }
903
- if (instruction.info.type === "authorizeChecked") {
2274
+ if (instruction.meta.type === "authorizeChecked") {
904
2275
  return "StakeAuthorizeCheckedInstruction";
905
2276
  }
906
- if (instruction.info.type === "authorizeCheckedWithSeed") {
2277
+ if (instruction.meta.type === "authorizeCheckedWithSeed") {
907
2278
  return "StakeAuthorizeCheckedWithSeedInstruction";
908
2279
  }
909
- if (instruction.info.type === "setLockupChecked") {
2280
+ if (instruction.meta.type === "setLockupChecked") {
910
2281
  return "StakeSetLockupCheckedInstruction";
911
2282
  }
912
- if (instruction.info.type === "deactivateDelinquent") {
2283
+ if (instruction.meta.type === "deactivateDelinquent") {
913
2284
  return "StakeDeactivateDelinquentInstruction";
914
2285
  }
915
- if (instruction.info.type === "redelegate") {
2286
+ if (instruction.meta.type === "redelegate") {
916
2287
  return "StakeRedelegateInstruction";
917
2288
  }
918
2289
  }
919
- if (instruction.program === "system") {
920
- if (instruction.info.type === "createAccount") {
2290
+ if (instruction.meta.program === "system") {
2291
+ if (instruction.meta.type === "createAccount") {
921
2292
  return "CreateAccountInstruction";
922
2293
  }
923
- if (instruction.info.type === "assign") {
2294
+ if (instruction.meta.type === "assign") {
924
2295
  return "AssignInstruction";
925
2296
  }
926
- if (instruction.info.type === "transfer") {
2297
+ if (instruction.meta.type === "transfer") {
927
2298
  return "TransferInstruction";
928
2299
  }
929
- if (instruction.info.type === "createAccountWithSeed") {
2300
+ if (instruction.meta.type === "createAccountWithSeed") {
930
2301
  return "CreateAccountWithSeedInstruction";
931
2302
  }
932
- if (instruction.info.type === "advanceNonceAccount") {
2303
+ if (instruction.meta.type === "advanceNonceAccount") {
933
2304
  return "AdvanceNonceAccountInstruction";
934
2305
  }
935
- if (instruction.info.type === "withdrawNonceAccount") {
2306
+ if (instruction.meta.type === "withdrawNonceAccount") {
936
2307
  return "WithdrawNonceAccountInstruction";
937
2308
  }
938
- if (instruction.info.type === "initializeNonceAccount") {
2309
+ if (instruction.meta.type === "initializeNonceAccount") {
939
2310
  return "InitializeNonceAccountInstruction";
940
2311
  }
941
- if (instruction.info.type === "authorizeNonceAccount") {
2312
+ if (instruction.meta.type === "authorizeNonceAccount") {
942
2313
  return "AuthorizeNonceAccountInstruction";
943
2314
  }
944
- if (instruction.info.type === "upgradeNonceAccount") {
2315
+ if (instruction.meta.type === "upgradeNonceAccount") {
945
2316
  return "UpgradeNonceAccountInstruction";
946
2317
  }
947
- if (instruction.info.type === "allocate") {
2318
+ if (instruction.meta.type === "allocate") {
948
2319
  return "AllocateInstruction";
949
2320
  }
950
- if (instruction.info.type === "allocateWithSeed") {
2321
+ if (instruction.meta.type === "allocateWithSeed") {
951
2322
  return "AllocateWithSeedInstruction";
952
2323
  }
953
- if (instruction.info.type === "assignWithSeed") {
2324
+ if (instruction.meta.type === "assignWithSeed") {
954
2325
  return "AssignWithSeedInstruction";
955
2326
  }
956
- if (instruction.info.type === "transferWithSeed") {
2327
+ if (instruction.meta.type === "transferWithSeed") {
957
2328
  return "TransferWithSeedInstruction";
958
2329
  }
959
2330
  }
960
- if (instruction.program === "vote") {
961
- if (instruction.info.type === "initialize") {
2331
+ if (instruction.meta.program === "vote") {
2332
+ if (instruction.meta.type === "initialize") {
962
2333
  return "VoteInitializeAccountInstruction";
963
2334
  }
964
- if (instruction.info.type === "authorize") {
2335
+ if (instruction.meta.type === "authorize") {
965
2336
  return "VoteAuthorizeInstruction";
966
2337
  }
967
- if (instruction.info.type === "authorizeWithSeed") {
2338
+ if (instruction.meta.type === "authorizeWithSeed") {
968
2339
  return "VoteAuthorizeWithSeedInstruction";
969
2340
  }
970
- if (instruction.info.type === "authorizeCheckedWithSeed") {
2341
+ if (instruction.meta.type === "authorizeCheckedWithSeed") {
971
2342
  return "VoteAuthorizeCheckedWithSeedInstruction";
972
2343
  }
973
- if (instruction.info.type === "vote") {
2344
+ if (instruction.meta.type === "vote") {
974
2345
  return "VoteVoteInstruction";
975
2346
  }
976
- if (instruction.info.type === "updatevotestate") {
2347
+ if (instruction.meta.type === "updatevotestate") {
977
2348
  return "VoteUpdateVoteStateInstruction";
978
2349
  }
979
- if (instruction.info.type === "updatevotestateswitch") {
2350
+ if (instruction.meta.type === "updatevotestateswitch") {
980
2351
  return "VoteUpdateVoteStateSwitchInstruction";
981
2352
  }
982
- if (instruction.info.type === "compactupdatevotestate") {
2353
+ if (instruction.meta.type === "compactupdatevotestate") {
983
2354
  return "VoteCompactUpdateVoteStateInstruction";
984
2355
  }
985
- if (instruction.info.type === "compactupdatevotestateswitch") {
2356
+ if (instruction.meta.type === "compactupdatevotestateswitch") {
986
2357
  return "VoteCompactUpdateVoteStateSwitchInstruction";
987
2358
  }
988
- if (instruction.info.type === "withdraw") {
2359
+ if (instruction.meta.type === "withdraw") {
989
2360
  return "VoteWithdrawInstruction";
990
2361
  }
991
- if (instruction.info.type === "updateValidatorIdentity") {
2362
+ if (instruction.meta.type === "updateValidatorIdentity") {
992
2363
  return "VoteUpdateValidatorIdentityInstruction";
993
2364
  }
994
- if (instruction.info.type === "updateCommission") {
2365
+ if (instruction.meta.type === "updateCommission") {
995
2366
  return "VoteUpdateCommissionInstruction";
996
2367
  }
997
- if (instruction.info.type === "voteSwitch") {
2368
+ if (instruction.meta.type === "voteSwitch") {
998
2369
  return "VoteVoteSwitchInstruction";
999
2370
  }
1000
- if (instruction.info.type === "authorizeChecked") {
2371
+ if (instruction.meta.type === "authorizeChecked") {
1001
2372
  return "VoteAuthorizeCheckedInstruction";
1002
2373
  }
1003
2374
  }
1004
- return "PartiallyDecodedInstruction";
1005
- }
1006
- });
1007
- return memoisedParsedTransactionInstructionInterface;
1008
- };
1009
- var parsedTransactionInstructionType = (name, parsedInfoFields) => new GraphQLObjectType({
1010
- fields: {
1011
- parsed: object(name + "Parsed", {
1012
- info: object(name + "ParsedInfo", parsedInfoFields),
1013
- type: string()
1014
- }),
1015
- program: string(),
1016
- programId: string()
1017
- },
1018
- interfaces: [parsedTransactionInstructionInterface()],
1019
- name
1020
- });
1021
- var memoisedPartiallyDecodedTransactionInstruction;
1022
- var partiallyDecodedTransactionInstruction = () => {
1023
- if (!memoisedPartiallyDecodedTransactionInstruction)
1024
- memoisedPartiallyDecodedTransactionInstruction = new GraphQLObjectType({
1025
- fields: {
1026
- accounts: list(string()),
1027
- data: string(),
1028
- programId: string()
1029
- },
1030
- interfaces: [parsedTransactionInstructionInterface()],
1031
- name: "PartiallyDecodedInstruction"
1032
- });
1033
- return memoisedPartiallyDecodedTransactionInstruction;
1034
- };
1035
- var memoisedParsedInstructionsAddressLookupTable;
1036
- var parsedInstructionsAddressLookupTable = () => {
1037
- if (!memoisedParsedInstructionsAddressLookupTable)
1038
- memoisedParsedInstructionsAddressLookupTable = [
1039
- parsedTransactionInstructionType("CreateLookupTableInstruction", {
1040
- bumpSeed: number(),
1041
- lookupTableAccount: string(),
1042
- lookupTableAuthority: string(),
1043
- payerAccount: string(),
1044
- recentSlot: bigint(),
1045
- systemProgram: string()
1046
- }),
1047
- parsedTransactionInstructionType("FreezeLookupTableInstruction", {
1048
- lookupTableAccount: string(),
1049
- lookupTableAuthority: string()
1050
- }),
1051
- parsedTransactionInstructionType("ExtendLookupTableInstruction", {
1052
- lookupTableAccount: string(),
1053
- lookupTableAuthority: string(),
1054
- newAddresses: list(string()),
1055
- payerAccount: string(),
1056
- systemProgram: string()
1057
- }),
1058
- parsedTransactionInstructionType("DeactivateLookupTableInstruction", {
1059
- lookupTableAccount: string(),
1060
- lookupTableAuthority: string()
1061
- }),
1062
- parsedTransactionInstructionType("CloseLookupTableInstruction", {
1063
- lookupTableAccount: string(),
1064
- lookupTableAuthority: string(),
1065
- recipient: string()
1066
- })
1067
- ];
1068
- return memoisedParsedInstructionsAddressLookupTable;
1069
- };
1070
- var memoisedParsedInstructionsBpfLoader;
1071
- var parsedInstructionsBpfLoader = () => {
1072
- if (!memoisedParsedInstructionsBpfLoader)
1073
- memoisedParsedInstructionsBpfLoader = [
1074
- parsedTransactionInstructionType("BpfLoaderWriteInstruction", {
1075
- account: string(),
1076
- bytes: string(),
1077
- offset: number()
1078
- }),
1079
- parsedTransactionInstructionType("BpfLoaderFinalizeInstruction", {
1080
- account: string()
1081
- })
1082
- ];
1083
- return memoisedParsedInstructionsBpfLoader;
1084
- };
1085
- var memoisedParsedInstructionsBpfUpgradeableLoader;
1086
- var parsedInstructionsBpfUpgradeableLoader = () => {
1087
- if (!memoisedParsedInstructionsBpfUpgradeableLoader)
1088
- memoisedParsedInstructionsBpfUpgradeableLoader = [
1089
- parsedTransactionInstructionType("BpfUpgradeableLoaderInitializeBufferInstruction", {
1090
- account: string()
1091
- }),
1092
- parsedTransactionInstructionType("BpfUpgradeableLoaderWriteInstruction", {
1093
- account: string(),
1094
- authority: string(),
1095
- bytes: string(),
1096
- offset: number()
1097
- }),
1098
- parsedTransactionInstructionType("BpfUpgradeableLoaderDeployWithMaxDataLenInstruction", {
1099
- authority: string(),
1100
- bufferAccount: string(),
1101
- clockSysvar: string(),
1102
- maxDataLen: bigint(),
1103
- payerAccount: string(),
1104
- programAccount: string(),
1105
- programDataAccount: string(),
1106
- rentSysvar: string()
1107
- }),
1108
- parsedTransactionInstructionType("BpfUpgradeableLoaderUpgradeInstruction", {
1109
- authority: string(),
1110
- bufferAccount: string(),
1111
- clockSysvar: string(),
1112
- programAccount: string(),
1113
- programDataAccount: string(),
1114
- rentSysvar: string(),
1115
- spillAccount: string()
1116
- }),
1117
- parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityInstruction", {
1118
- account: string(),
1119
- authority: string(),
1120
- newAuthority: string()
1121
- }),
1122
- parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityCheckedInstruction", {
1123
- account: string(),
1124
- authority: string(),
1125
- newAuthority: string()
1126
- }),
1127
- parsedTransactionInstructionType("BpfUpgradeableLoaderCloseInstruction", {
1128
- account: string(),
1129
- authority: string(),
1130
- programAccount: string(),
1131
- recipient: string()
1132
- }),
1133
- parsedTransactionInstructionType("BpfUpgradeableLoaderExtendProgramInstruction", {
1134
- additionalBytes: bigint(),
1135
- payerAccount: string(),
1136
- programAccount: string(),
1137
- programDataAccount: string(),
1138
- systemProgram: string()
1139
- })
1140
- ];
1141
- return memoisedParsedInstructionsBpfUpgradeableLoader;
1142
- };
1143
- var memoisedParsedInstructionsSplAssociatedToken;
1144
- var parsedInstructionsSplAssociatedToken = () => {
1145
- if (!memoisedParsedInstructionsSplAssociatedToken)
1146
- memoisedParsedInstructionsSplAssociatedToken = [
1147
- parsedTransactionInstructionType("SplAssociatedTokenCreateInstruction", {
1148
- account: string(),
1149
- mint: string(),
1150
- source: string(),
1151
- systemProgram: string(),
1152
- tokenProgram: string(),
1153
- wallet: string()
1154
- }),
1155
- parsedTransactionInstructionType("SplAssociatedTokenCreateIdempotentInstruction", {
1156
- account: string(),
1157
- mint: string(),
1158
- source: string(),
1159
- systemProgram: string(),
1160
- tokenProgram: string(),
1161
- wallet: string()
1162
- }),
1163
- parsedTransactionInstructionType("SplAssociatedTokenRecoverNestedInstruction", {
1164
- destination: string(),
1165
- nestedMint: string(),
1166
- nestedOwner: string(),
1167
- nestedSource: string(),
1168
- ownerMint: string(),
1169
- tokenProgram: string(),
1170
- wallet: string()
1171
- })
1172
- ];
1173
- return memoisedParsedInstructionsSplAssociatedToken;
1174
- };
1175
- var memoisedParsedInstructionSplMemo;
1176
- var parsedInstructionSplMemo = () => {
1177
- if (!memoisedParsedInstructionSplMemo)
1178
- memoisedParsedInstructionSplMemo = new GraphQLObjectType({
1179
- fields: {
1180
- parsed: string(),
1181
- program: string(),
1182
- programId: string()
1183
- },
1184
- interfaces: [parsedTransactionInstructionInterface()],
1185
- name: "SplMemoInstruction"
1186
- });
1187
- return memoisedParsedInstructionSplMemo;
1188
- };
1189
- var memoisedParsedInstructionsSplToken;
1190
- var parsedInstructionsSplToken = () => {
1191
- if (!memoisedParsedInstructionsSplToken)
1192
- memoisedParsedInstructionsSplToken = [
1193
- parsedTransactionInstructionType("SplTokenInitializeMintInstruction", {
1194
- decimals: number(),
1195
- freezeAuthority: string(),
1196
- mint: string(),
1197
- mintAuthority: string(),
1198
- rentSysvar: string()
1199
- }),
1200
- parsedTransactionInstructionType("SplTokenInitializeMint2Instruction", {
1201
- decimals: number(),
1202
- freezeAuthority: string(),
1203
- mint: string(),
1204
- mintAuthority: string()
1205
- }),
1206
- parsedTransactionInstructionType("SplTokenInitializeAccountInstruction", {
1207
- account: string(),
1208
- mint: string(),
1209
- owner: string(),
1210
- rentSysvar: string()
1211
- }),
1212
- parsedTransactionInstructionType("SplTokenInitializeAccount2Instruction", {
1213
- account: string(),
1214
- mint: string(),
1215
- owner: string(),
1216
- rentSysvar: string()
1217
- }),
1218
- parsedTransactionInstructionType("SplTokenInitializeAccount3Instruction", {
1219
- account: string(),
1220
- mint: string(),
1221
- owner: string()
1222
- }),
1223
- parsedTransactionInstructionType("SplTokenInitializeMultisigInstruction", {
1224
- m: number(),
1225
- multisig: string(),
1226
- rentSysvar: string(),
1227
- signers: list(string())
1228
- }),
1229
- parsedTransactionInstructionType("SplTokenInitializeMultisig2Instruction", {
1230
- m: number(),
1231
- multisig: string(),
1232
- signers: list(string())
1233
- }),
1234
- parsedTransactionInstructionType("SplTokenTransferInstruction", {
1235
- amount: string(),
1236
- authority: string(),
1237
- destination: string(),
1238
- multisigAuthority: string(),
1239
- source: string()
1240
- }),
1241
- parsedTransactionInstructionType("SplTokenApproveInstruction", {
1242
- amount: string(),
1243
- delegate: string(),
1244
- multisigOwner: string(),
1245
- owner: string(),
1246
- source: string()
1247
- }),
1248
- parsedTransactionInstructionType("SplTokenRevokeInstruction", {
1249
- multisigOwner: string(),
1250
- owner: string(),
1251
- source: string()
1252
- }),
1253
- parsedTransactionInstructionType("SplTokenSetAuthorityInstruction", {
1254
- authority: string(),
1255
- authorityType: string(),
1256
- multisigAuthority: string(),
1257
- newAuthority: string()
1258
- }),
1259
- parsedTransactionInstructionType("SplTokenMintToInstruction", {
1260
- account: string(),
1261
- amount: string(),
1262
- authority: string(),
1263
- mint: string(),
1264
- mintAuthority: string(),
1265
- multisigMintAuthority: string()
1266
- }),
1267
- parsedTransactionInstructionType("SplTokenBurnInstruction", {
1268
- account: string(),
1269
- amount: string(),
1270
- authority: string(),
1271
- mint: string(),
1272
- multisigAuthority: string()
1273
- }),
1274
- parsedTransactionInstructionType("SplTokenCloseAccountInstruction", {
1275
- account: string(),
1276
- destination: string(),
1277
- multisigOwner: string(),
1278
- owner: string()
1279
- }),
1280
- parsedTransactionInstructionType("SplTokenFreezeAccountInstruction", {
1281
- account: string(),
1282
- freezeAuthority: string(),
1283
- mint: string(),
1284
- multisigFreezeAuthority: string()
1285
- }),
1286
- parsedTransactionInstructionType("SplTokenThawAccountInstruction", {
1287
- account: string(),
1288
- freezeAuthority: string(),
1289
- mint: string(),
1290
- multisigFreezeAuthority: string()
1291
- }),
1292
- parsedTransactionInstructionType("SplTokenTransferCheckedInstruction", {
1293
- authority: string(),
1294
- destination: string(),
1295
- mint: string(),
1296
- multisigAuthority: string(),
1297
- source: string(),
1298
- tokenAmount: string()
1299
- }),
1300
- parsedTransactionInstructionType("SplTokenApproveCheckedInstruction", {
1301
- delegate: string(),
1302
- mint: string(),
1303
- multisigOwner: string(),
1304
- owner: string(),
1305
- source: string(),
1306
- tokenAmount: string()
1307
- }),
1308
- parsedTransactionInstructionType("SplTokenMintToCheckedInstruction", {
1309
- account: string(),
1310
- authority: string(),
1311
- mint: string(),
1312
- mintAuthority: string(),
1313
- multisigMintAuthority: string(),
1314
- tokenAmount: string()
1315
- }),
1316
- parsedTransactionInstructionType("SplTokenBurnCheckedInstruction", {
1317
- account: string(),
1318
- authority: string(),
1319
- mint: string(),
1320
- multisigAuthority: string(),
1321
- tokenAmount: string()
1322
- }),
1323
- parsedTransactionInstructionType("SplTokenSyncNativeInstruction", {
1324
- account: string()
1325
- }),
1326
- parsedTransactionInstructionType("SplTokenGetAccountDataSizeInstruction", {
1327
- extensionTypes: list(string()),
1328
- mint: string()
1329
- }),
1330
- parsedTransactionInstructionType("SplTokenInitializeImmutableOwnerInstruction", {
1331
- account: string()
1332
- }),
1333
- parsedTransactionInstructionType("SplTokenAmountToUiAmountInstruction", {
1334
- amount: string(),
1335
- mint: string()
1336
- }),
1337
- parsedTransactionInstructionType("SplTokenUiAmountToAmountInstruction", {
1338
- mint: string(),
1339
- uiAmount: string()
1340
- }),
1341
- parsedTransactionInstructionType("SplTokenInitializeMintCloseAuthorityInstruction", {
1342
- mint: string(),
1343
- newAuthority: string()
1344
- })
1345
- // TODO: Extensions!
1346
- // - TransferFeeExtension
1347
- // - ConfidentialTransferFeeExtension
1348
- // - DefaultAccountStateExtension
1349
- // - Reallocate
1350
- // - MemoTransferExtension
1351
- // - CreateNativeMint
1352
- // - InitializeNonTransferableMint
1353
- // - InterestBearingMintExtension
1354
- // - CpiGuardExtension
1355
- // - InitializePermanentDelegate
1356
- // - TransferHookExtension
1357
- // - ConfidentialTransferFeeExtension
1358
- // - WithdrawExcessLamports
1359
- // - MetadataPointerExtension
1360
- ];
1361
- return memoisedParsedInstructionsSplToken;
1362
- };
1363
- var memoisedLockup;
1364
- var lockup = () => {
1365
- if (!memoisedLockup)
1366
- memoisedLockup = new GraphQLObjectType({
1367
- fields: {
1368
- custodian: string(),
1369
- epoch: bigint(),
1370
- unixTimestamp: bigint()
1371
- },
1372
- name: "Lockup"
1373
- });
1374
- return memoisedLockup;
1375
- };
1376
- var memoisedParsedInstructionsStake;
1377
- var parsedInstructionsStake = () => {
1378
- if (!memoisedParsedInstructionsStake)
1379
- memoisedParsedInstructionsStake = [
1380
- parsedTransactionInstructionType("StakeInitializeInstruction", {
1381
- authorized: object("StakeInitializeInstructionAuthorized", {
1382
- staker: string(),
1383
- withdrawer: string()
1384
- }),
1385
- lockup: object("StakeInitializeInstructionLockup", {
1386
- custodian: string(),
1387
- epoch: bigint(),
1388
- unixTimestamp: bigint()
1389
- }),
1390
- rentSysvar: string(),
1391
- stakeAccount: string()
1392
- }),
1393
- parsedTransactionInstructionType("StakeAuthorizeInstruction", {
1394
- authority: string(),
1395
- authorityType: string(),
1396
- clockSysvar: string(),
1397
- custodian: string(),
1398
- newAuthority: string(),
1399
- stakeAccount: string()
1400
- }),
1401
- parsedTransactionInstructionType("StakeDelegateStakeInstruction", {
1402
- clockSysvar: string(),
1403
- stakeAccount: string(),
1404
- stakeAuthority: string(),
1405
- stakeConfigAccount: string(),
1406
- stakeHistorySysvar: string(),
1407
- voteAccount: string()
1408
- }),
1409
- parsedTransactionInstructionType("StakeSplitInstruction", {
1410
- lamports: bigint(),
1411
- newSplitAccount: string(),
1412
- stakeAccount: string(),
1413
- stakeAuthority: string()
1414
- }),
1415
- parsedTransactionInstructionType("StakeWithdrawInstruction", {
1416
- clockSysvar: string(),
1417
- destination: string(),
1418
- lamports: bigint(),
1419
- stakeAccount: string(),
1420
- withdrawAuthority: string()
1421
- }),
1422
- parsedTransactionInstructionType("StakeDeactivateInstruction", {
1423
- clockSysvar: string(),
1424
- stakeAccount: string(),
1425
- stakeAuthority: string()
1426
- }),
1427
- parsedTransactionInstructionType("StakeSetLockupInstruction", {
1428
- custodian: string(),
1429
- lockup: type(lockup()),
1430
- stakeAccount: string()
1431
- }),
1432
- parsedTransactionInstructionType("StakeMergeInstruction", {
1433
- clockSysvar: string(),
1434
- destination: string(),
1435
- source: string(),
1436
- stakeAuthority: string(),
1437
- stakeHistorySysvar: string()
1438
- }),
1439
- parsedTransactionInstructionType("StakeAuthorizeWithSeedInstruction", {
1440
- authorityBase: string(),
1441
- authorityOwner: string(),
1442
- authoritySeed: string(),
1443
- authorityType: string(),
1444
- clockSysvar: string(),
1445
- custodian: string(),
1446
- newAuthorized: string(),
1447
- stakeAccount: string()
1448
- }),
1449
- parsedTransactionInstructionType("StakeInitializeCheckedInstruction", {
1450
- rentSysvar: string(),
1451
- stakeAccount: string(),
1452
- staker: string(),
1453
- withdrawer: string()
1454
- }),
1455
- parsedTransactionInstructionType("StakeAuthorizeCheckedInstruction", {
1456
- authority: string(),
1457
- authorityType: string(),
1458
- clockSysvar: string(),
1459
- custodian: string(),
1460
- newAuthority: string(),
1461
- stakeAccount: string()
1462
- }),
1463
- parsedTransactionInstructionType("StakeAuthorizeCheckedWithSeedInstruction", {
1464
- authorityBase: string(),
1465
- authorityOwner: string(),
1466
- authoritySeed: string(),
1467
- authorityType: string(),
1468
- clockSysvar: string(),
1469
- custodian: string(),
1470
- newAuthorized: string(),
1471
- stakeAccount: string()
1472
- }),
1473
- parsedTransactionInstructionType("StakeSetLockupCheckedInstruction", {
1474
- custodian: string(),
1475
- lockup: type(lockup()),
1476
- stakeAccount: string()
1477
- }),
1478
- parsedTransactionInstructionType("StakeDeactivateDelinquentInstruction", {
1479
- referenceVoteAccount: string(),
1480
- stakeAccount: string(),
1481
- voteAccount: string()
1482
- }),
1483
- parsedTransactionInstructionType("StakeRedelegateInstruction", {
1484
- newStakeAccount: string(),
1485
- stakeAccount: string(),
1486
- stakeAuthority: string(),
1487
- stakeConfigAccount: string(),
1488
- voteAccount: string()
1489
- })
1490
- ];
1491
- return memoisedParsedInstructionsStake;
1492
- };
1493
- var memoisedParsedInstructionsSystem;
1494
- var parsedInstructionsSystem = () => {
1495
- if (!memoisedParsedInstructionsSystem)
1496
- memoisedParsedInstructionsSystem = [
1497
- parsedTransactionInstructionType("CreateAccountInstruction", {
1498
- lamports: bigint(),
1499
- newAccount: string(),
1500
- owner: string(),
1501
- source: string(),
1502
- space: bigint()
1503
- }),
1504
- parsedTransactionInstructionType("AssignInstruction", {
1505
- owner: string()
1506
- }),
1507
- parsedTransactionInstructionType("TransferInstruction", {
1508
- amount: string(),
1509
- lamports: number(),
1510
- source: string()
1511
- }),
1512
- parsedTransactionInstructionType("CreateAccountWithSeedInstruction", {
1513
- base: string(),
1514
- lamports: bigint(),
1515
- owner: string(),
1516
- seed: string(),
1517
- space: bigint()
1518
- }),
1519
- parsedTransactionInstructionType("AdvanceNonceAccountInstruction", {
1520
- nonceAccount: string(),
1521
- nonceAuthority: string(),
1522
- recentBlockhashesSysvar: string()
1523
- }),
1524
- parsedTransactionInstructionType("WithdrawNonceAccountInstruction", {
1525
- destination: string(),
1526
- lamports: bigint(),
1527
- nonceAccount: string(),
1528
- nonceAuthority: string(),
1529
- recentBlockhashesSysvar: string(),
1530
- rentSysvar: string()
1531
- }),
1532
- parsedTransactionInstructionType("InitializeNonceAccountInstruction", {
1533
- nonceAccount: string(),
1534
- nonceAuthority: string(),
1535
- recentBlockhashesSysvar: string(),
1536
- rentSysvar: string()
1537
- }),
1538
- parsedTransactionInstructionType("AuthorizeNonceAccountInstruction", {
1539
- newAuthorized: string(),
1540
- nonceAccount: string(),
1541
- nonceAuthority: string()
1542
- }),
1543
- parsedTransactionInstructionType("UpgradeNonceAccountInstruction", {
1544
- nonceAccount: string()
1545
- }),
1546
- parsedTransactionInstructionType("AllocateInstruction", {
1547
- account: string(),
1548
- space: bigint()
1549
- }),
1550
- parsedTransactionInstructionType("AllocateWithSeedInstruction", {
1551
- account: string(),
1552
- base: string(),
1553
- owner: string(),
1554
- seed: string(),
1555
- space: bigint()
1556
- }),
1557
- parsedTransactionInstructionType("AssignWithSeedInstruction", {
1558
- account: string(),
1559
- base: string(),
1560
- owner: string(),
1561
- seed: string()
1562
- }),
1563
- parsedTransactionInstructionType("TransferWithSeedInstruction", {
1564
- destination: string(),
1565
- lamports: bigint(),
1566
- source: string(),
1567
- sourceBase: string(),
1568
- sourceOwner: string(),
1569
- sourceSeed: string()
1570
- })
1571
- ];
1572
- return memoisedParsedInstructionsSystem;
1573
- };
1574
- var memoisedVote;
1575
- var vote = () => {
1576
- if (!memoisedVote)
1577
- memoisedVote = new GraphQLObjectType({
1578
- fields: {
1579
- hash: string(),
1580
- slots: list(bigint()),
1581
- timestamp: bigint()
1582
- },
1583
- name: "Vote"
1584
- });
1585
- return memoisedVote;
1586
- };
1587
- var memoisedVoteStateUpdate;
1588
- var voteStateUpdate = () => {
1589
- if (!memoisedVoteStateUpdate)
1590
- memoisedVoteStateUpdate = new GraphQLObjectType({
1591
- fields: {
1592
- hash: string(),
1593
- lockouts: list(
1594
- object("VoteStateUpdateLockout", {
1595
- confirmationCount: number(),
1596
- slot: bigint()
1597
- })
1598
- ),
1599
- root: bigint(),
1600
- timestamp: bigint()
1601
- },
1602
- name: "VoteStateUpdate"
1603
- });
1604
- return memoisedVoteStateUpdate;
1605
- };
1606
- var memoisedParsedInstructionsVote;
1607
- var parsedInstructionsVote = () => {
1608
- if (!memoisedParsedInstructionsVote)
1609
- memoisedParsedInstructionsVote = [
1610
- parsedTransactionInstructionType("VoteInitializeAccountInstruction", {
1611
- authorizedVoter: string(),
1612
- authorizedWithdrawer: string(),
1613
- clockSysvar: string(),
1614
- commission: number(),
1615
- node: string(),
1616
- rentSysvar: string(),
1617
- voteAccount: string()
1618
- }),
1619
- parsedTransactionInstructionType("VoteAuthorizeInstruction", {
1620
- authority: string(),
1621
- authorityType: string(),
1622
- clockSysvar: string(),
1623
- newAuthority: string(),
1624
- voteAccount: string()
1625
- }),
1626
- parsedTransactionInstructionType("VoteAuthorizeWithSeedInstruction", {
1627
- authorityBaseKey: string(),
1628
- authorityOwner: string(),
1629
- authoritySeed: string(),
1630
- authorityType: string(),
1631
- clockSysvar: string(),
1632
- newAuthority: string(),
1633
- voteAccount: string()
1634
- }),
1635
- parsedTransactionInstructionType("VoteAuthorizeCheckedWithSeedInstruction", {
1636
- authorityBaseKey: string(),
1637
- authorityOwner: string(),
1638
- authoritySeed: string(),
1639
- authorityType: string(),
1640
- clockSysvar: string(),
1641
- newAuthority: string(),
1642
- voteAccount: string()
1643
- }),
1644
- parsedTransactionInstructionType("VoteVoteInstruction", {
1645
- clockSysvar: string(),
1646
- slotHashedSysvar: string(),
1647
- vote: type(vote()),
1648
- voteAccount: string(),
1649
- voteAuthority: string()
1650
- }),
1651
- parsedTransactionInstructionType("VoteUpdateVoteStateInstruction", {
1652
- hash: string(),
1653
- voteAccount: string(),
1654
- voteAuthority: string(),
1655
- voteStateUpdate: type(voteStateUpdate())
1656
- }),
1657
- parsedTransactionInstructionType("VoteUpdateVoteStateSwitchInstruction", {
1658
- hash: string(),
1659
- voteAccount: string(),
1660
- voteAuthority: string(),
1661
- voteStateUpdate: type(voteStateUpdate())
1662
- }),
1663
- parsedTransactionInstructionType("VoteCompactUpdateVoteStateInstruction", {
1664
- hash: string(),
1665
- voteAccount: string(),
1666
- voteAuthority: string(),
1667
- voteStateUpdate: type(voteStateUpdate())
1668
- }),
1669
- parsedTransactionInstructionType("VoteCompactUpdateVoteStateSwitchInstruction", {
1670
- hash: string(),
1671
- voteAccount: string(),
1672
- voteAuthority: string(),
1673
- voteStateUpdate: type(voteStateUpdate())
1674
- }),
1675
- parsedTransactionInstructionType("VoteWithdrawInstruction", {
1676
- destination: string(),
1677
- lamports: bigint(),
1678
- voteAccount: string(),
1679
- withdrawAuthority: string()
1680
- }),
1681
- parsedTransactionInstructionType("VoteUpdateValidatorIdentityInstruction", {
1682
- newValidatorIdentity: string(),
1683
- voteAccount: string(),
1684
- withdrawAuthority: string()
1685
- }),
1686
- parsedTransactionInstructionType("VoteUpdateCommissionInstruction", {
1687
- commission: string(),
1688
- voteAccount: string(),
1689
- withdrawAuthority: string()
1690
- }),
1691
- parsedTransactionInstructionType("VoteVoteSwitchInstruction", {
1692
- clockSysvar: string(),
1693
- hash: string(),
1694
- slotHashesSysvar: string(),
1695
- vote: type(vote()),
1696
- voteAccount: string(),
1697
- voteAuthority: string()
1698
- }),
1699
- parsedTransactionInstructionType("VoteAuthorizeCheckedInstruction", {
1700
- authority: string(),
1701
- authorityType: string(),
1702
- clockSysvar: string(),
1703
- newAuthority: string(),
1704
- voteAccount: string()
1705
- })
1706
- ];
1707
- return memoisedParsedInstructionsVote;
1708
- };
1709
- var memoisedTransactionMetaInterfaceFields;
1710
- var transactionMetaInterfaceFields = () => {
1711
- if (!memoisedTransactionMetaInterfaceFields)
1712
- memoisedTransactionMetaInterfaceFields = {
1713
- computeUnitsConsumed: bigint(),
1714
- err: string(),
1715
- fee: bigint(),
1716
- format: string(),
1717
- loadedAddresses: type(transactionMetaLoadedAddresses()),
1718
- logMessages: list(string()),
1719
- postBalances: list(bigint()),
1720
- postTokenBalances: list(type(tokenBalance())),
1721
- preBalances: list(bigint()),
1722
- preTokenBalances: list(type(tokenBalance())),
1723
- returnData: type(returnData()),
1724
- rewards: list(type(reward())),
1725
- status: type(transactionStatus())
1726
- };
1727
- return memoisedTransactionMetaInterfaceFields;
1728
- };
1729
- var memoisedTransactionMetaInterface;
1730
- var transactionMetaInterface = () => {
1731
- if (!memoisedTransactionMetaInterface)
1732
- memoisedTransactionMetaInterface = new GraphQLInterfaceType({
1733
- fields: {
1734
- ...transactionMetaInterfaceFields()
1735
- },
1736
- name: "TransactionMeta",
1737
- resolveType(meta) {
1738
- if (meta.format === "parsed") {
1739
- return "TransactionMetaParsed";
1740
- }
1741
- return "TransactionMetaUnparsed";
1742
- }
1743
- });
1744
- return memoisedTransactionMetaInterface;
1745
- };
1746
- var transactionMetaType = (name, description, innerInstructions) => new GraphQLObjectType({
1747
- description,
1748
- fields: {
1749
- ...transactionMetaInterfaceFields(),
1750
- innerInstructions
1751
- },
1752
- interfaces: [transactionMetaInterface()],
1753
- name
1754
- });
1755
- var memoisedTransactionMetaUnparsed;
1756
- var transactionMetaUnparsed = () => {
1757
- if (!memoisedTransactionMetaUnparsed)
1758
- memoisedTransactionMetaUnparsed = transactionMetaType(
1759
- "TransactionMetaUnparsed",
1760
- "Non-parsed transaction meta",
1761
- list(
1762
- object("TransactionMetaInnerInstructionsUnparsed", {
1763
- index: number(),
1764
- instructions: list(
1765
- object("TransactionMetaInnerInstructionsUnparsedInstruction", {
1766
- index: number(),
1767
- instructions: list(type(transactionInstruction()))
1768
- })
1769
- )
1770
- })
1771
- )
1772
- );
1773
- return memoisedTransactionMetaUnparsed;
1774
- };
1775
- var memoisedTransactionMetaParsed;
1776
- var transactionMetaParsed = () => {
1777
- if (!memoisedTransactionMetaParsed)
1778
- memoisedTransactionMetaParsed = transactionMetaType(
1779
- "TransactionMetaParsed",
1780
- "Parsed transaction meta",
1781
- list(
1782
- object("TransactionMetaInnerInstructionsParsed", {
1783
- index: number(),
1784
- instructions: list(type(parsedTransactionInstructionInterface()))
1785
- })
1786
- )
1787
- );
1788
- return memoisedTransactionMetaParsed;
1789
- };
1790
- var memoisedTransactionMessageInterfaceFields;
1791
- var transactionMessageInterfaceFields = () => {
1792
- if (!memoisedTransactionMessageInterfaceFields)
1793
- memoisedTransactionMessageInterfaceFields = {
1794
- addressTableLookups: list(type(addressTableLookup())),
1795
- format: string(),
1796
- header: object("TransactionJsonTransactionHeader", {
1797
- numReadonlySignedAccounts: number(),
1798
- numReadonlyUnsignedAccounts: number(),
1799
- numRequiredSignatures: number()
1800
- }),
1801
- recentBlockhash: string()
1802
- };
1803
- return memoisedTransactionMessageInterfaceFields;
1804
- };
1805
- var memoisedTransactionMessageInterface;
1806
- var transactionMessageInterface = () => {
1807
- if (!memoisedTransactionMessageInterface)
1808
- memoisedTransactionMessageInterface = new GraphQLInterfaceType({
1809
- fields: {
1810
- ...transactionMessageInterfaceFields()
1811
- },
1812
- name: "TransactionMessage",
1813
- resolveType(message) {
1814
- if (message.format === "parsed") {
1815
- return "TransactionMessageParsed";
1816
- }
1817
- return "TransactionMessageUnparsed";
1818
2375
  }
1819
- });
1820
- return memoisedTransactionMessageInterface;
1821
- };
1822
- var transactionMessageType = (name, description, accountKeys, instructions) => new GraphQLObjectType({
1823
- description,
1824
- fields: {
1825
- ...transactionMessageInterfaceFields(),
1826
- accountKeys,
1827
- instructions
1828
- },
1829
- interfaces: [transactionMessageInterface()],
1830
- name
1831
- });
1832
- var memoisedTransactionMessageUnparsed;
1833
- var transactionMessageUnparsed = () => {
1834
- if (!memoisedTransactionMessageUnparsed)
1835
- memoisedTransactionMessageUnparsed = transactionMessageType(
1836
- "TransactionMessageUnparsed",
1837
- "Non-parsed transaction message",
1838
- list(string()),
1839
- list(type(transactionInstruction()))
1840
- );
1841
- return memoisedTransactionMessageUnparsed;
1842
- };
1843
- var memoisedTransactionMessageParsed;
1844
- var transactionMessageParsed = () => {
1845
- if (!memoisedTransactionMessageParsed)
1846
- memoisedTransactionMessageParsed = transactionMessageType(
1847
- "TransactionMessageParsed",
1848
- "Parsed transaction message",
1849
- list(
1850
- object("transactionMessageParsedAccountKey", {
1851
- pubkey: string(),
1852
- signer: boolean(),
1853
- source: string(),
1854
- writable: boolean()
1855
- })
1856
- ),
1857
- list(type(parsedTransactionInstructionInterface()))
1858
- );
1859
- return memoisedTransactionMessageParsed;
1860
- };
1861
- var memoisedTransactionTransaction;
1862
- var transactionTransaction = () => {
1863
- if (!memoisedTransactionTransaction)
1864
- memoisedTransactionTransaction = new GraphQLObjectType({
1865
- fields: {
1866
- message: type(transactionMessageInterface()),
1867
- signatures: list(string())
1868
- },
1869
- name: "TransactionTransaction"
1870
- });
1871
- return memoisedTransactionTransaction;
1872
- };
1873
- var memoisedTransactionInterfaceFields;
1874
- var transactionInterfaceFields = () => {
1875
- if (!memoisedTransactionInterfaceFields)
1876
- memoisedTransactionInterfaceFields = {
1877
- blockTime: bigint(),
1878
- encoding: string(),
1879
- meta: type(transactionMetaInterface()),
1880
- slot: bigint()
1881
- };
1882
- return memoisedTransactionInterfaceFields;
2376
+ return "GenericInstruction";
2377
+ }
2378
+ },
2379
+ CreateLookupTableInstructionData: {
2380
+ lookupTableAccount: resolveAccount("lookupTableAccount"),
2381
+ lookupTableAuthority: resolveAccount("lookupTableAuthority"),
2382
+ payerAccount: resolveAccount("payerAccount"),
2383
+ systemProgram: resolveAccount("systemProgram")
2384
+ },
2385
+ ExtendLookupTableInstructionData: {
2386
+ lookupTableAccount: resolveAccount("lookupTableAccount"),
2387
+ lookupTableAuthority: resolveAccount("lookupTableAuthority"),
2388
+ payerAccount: resolveAccount("payerAccount"),
2389
+ systemProgram: resolveAccount("systemProgram")
2390
+ },
2391
+ FreezeLookupTableInstructionData: {
2392
+ lookupTableAccount: resolveAccount("lookupTableAccount"),
2393
+ lookupTableAuthority: resolveAccount("lookupTableAuthority")
2394
+ },
2395
+ DeactivateLookupTableInstructionData: {
2396
+ lookupTableAccount: resolveAccount("lookupTableAccount"),
2397
+ lookupTableAuthority: resolveAccount("lookupTableAuthority")
2398
+ },
2399
+ CloseLookupTableInstructionData: {
2400
+ lookupTableAccount: resolveAccount("lookupTableAccount"),
2401
+ lookupTableAuthority: resolveAccount("lookupTableAuthority"),
2402
+ recipient: resolveAccount("recipient")
2403
+ },
2404
+ BpfLoaderWriteInstructionData: {
2405
+ account: resolveAccount("account")
2406
+ },
2407
+ BpfLoaderFinalizeInstructionData: {
2408
+ account: resolveAccount("account")
2409
+ },
2410
+ BpfUpgradeableLoaderInitializeBufferInstructionData: {
2411
+ account: resolveAccount("account")
2412
+ },
2413
+ BpfUpgradeableLoaderWriteInstructionData: {
2414
+ account: resolveAccount("account"),
2415
+ authority: resolveAccount("authority")
2416
+ },
2417
+ BpfUpgradeableLoaderDeployWithMaxDataLenInstructionData: {
2418
+ authority: resolveAccount("authority"),
2419
+ bufferAccount: resolveAccount("bufferAccount"),
2420
+ payerAccount: resolveAccount("payerAccount"),
2421
+ programAccount: resolveAccount("programAccount"),
2422
+ programDataAccount: resolveAccount("programDataAccount")
2423
+ },
2424
+ BpfUpgradeableLoaderUpgradeInstructionData: {
2425
+ authority: resolveAccount("authority"),
2426
+ bufferAccount: resolveAccount("bufferAccount"),
2427
+ programAccount: resolveAccount("programAccount"),
2428
+ programDataAccount: resolveAccount("programDataAccount")
2429
+ },
2430
+ BpfUpgradeableLoaderSetAuthorityInstructionData: {
2431
+ account: resolveAccount("account"),
2432
+ authority: resolveAccount("authority"),
2433
+ newAuthority: resolveAccount("newAuthority")
2434
+ },
2435
+ BpfUpgradeableLoaderSetAuthorityCheckedInstructionData: {
2436
+ account: resolveAccount("account"),
2437
+ authority: resolveAccount("authority"),
2438
+ newAuthority: resolveAccount("newAuthority")
2439
+ },
2440
+ BpfUpgradeableLoaderCloseInstructionData: {
2441
+ account: resolveAccount("account"),
2442
+ authority: resolveAccount("authority"),
2443
+ programAccount: resolveAccount("programAccount"),
2444
+ recipient: resolveAccount("recipient")
2445
+ },
2446
+ BpfUpgradeableLoaderExtendProgramInstructionData: {
2447
+ payerAccount: resolveAccount("payerAccount"),
2448
+ programAccount: resolveAccount("programAccount"),
2449
+ programDataAccount: resolveAccount("programDataAccount"),
2450
+ systemProgram: resolveAccount("systemProgram")
2451
+ },
2452
+ SplAssociatedTokenCreateInstructionData: {
2453
+ account: resolveAccount("account"),
2454
+ mint: resolveAccount("mint"),
2455
+ source: resolveAccount("source"),
2456
+ systemProgram: resolveAccount("systemProgram"),
2457
+ tokenProgram: resolveAccount("tokenProgram"),
2458
+ wallet: resolveAccount("wallet")
2459
+ },
2460
+ SplAssociatedTokenCreateIdempotentInstructionData: {
2461
+ account: resolveAccount("account"),
2462
+ mint: resolveAccount("mint"),
2463
+ source: resolveAccount("source"),
2464
+ systemProgram: resolveAccount("systemProgram"),
2465
+ tokenProgram: resolveAccount("tokenProgram"),
2466
+ wallet: resolveAccount("wallet")
2467
+ },
2468
+ SplAssociatedTokenRecoverNestedInstructionData: {
2469
+ destination: resolveAccount("destination"),
2470
+ nestedMint: resolveAccount("nestedMint"),
2471
+ nestedOwner: resolveAccount("nestedOwner"),
2472
+ nestedSource: resolveAccount("nestedSource"),
2473
+ ownerMint: resolveAccount("ownerMint"),
2474
+ tokenProgram: resolveAccount("tokenProgram"),
2475
+ wallet: resolveAccount("wallet")
2476
+ },
2477
+ SplTokenInitializeMintInstructionData: {
2478
+ freezeAuthority: resolveAccount("freezeAuthority"),
2479
+ mint: resolveAccount("mint"),
2480
+ mintAuthority: resolveAccount("mintAuthority")
2481
+ },
2482
+ SplTokenInitializeMint2InstructionData: {
2483
+ freezeAuthority: resolveAccount("freezeAuthority"),
2484
+ mint: resolveAccount("mint"),
2485
+ mintAuthority: resolveAccount("mintAuthority")
2486
+ },
2487
+ SplTokenInitializeAccountInstructionData: {
2488
+ account: resolveAccount("account"),
2489
+ mint: resolveAccount("mint"),
2490
+ owner: resolveAccount("owner")
2491
+ },
2492
+ SplTokenInitializeAccount2InstructionData: {
2493
+ account: resolveAccount("account"),
2494
+ mint: resolveAccount("mint"),
2495
+ owner: resolveAccount("owner")
2496
+ },
2497
+ SplTokenInitializeAccount3InstructionData: {
2498
+ account: resolveAccount("account"),
2499
+ mint: resolveAccount("mint"),
2500
+ owner: resolveAccount("owner")
2501
+ },
2502
+ SplTokenInitializeMultisigInstructionData: {
2503
+ multisig: resolveAccount("multisig")
2504
+ },
2505
+ SplTokenInitializeMultisig2InstructionData: {
2506
+ multisig: resolveAccount("multisig")
2507
+ },
2508
+ SplTokenTransferInstructionData: {
2509
+ authority: resolveAccount("authority"),
2510
+ destination: resolveAccount("destination"),
2511
+ multisigAuthority: resolveAccount("multisigAuthority"),
2512
+ source: resolveAccount("source")
2513
+ },
2514
+ SplTokenApproveInstructionData: {
2515
+ delegate: resolveAccount("delegate"),
2516
+ multisigOwner: resolveAccount("multisigOwner"),
2517
+ owner: resolveAccount("owner"),
2518
+ source: resolveAccount("source")
2519
+ },
2520
+ SplTokenRevokeInstructionData: {
2521
+ multisigOwner: resolveAccount("multisigOwner"),
2522
+ owner: resolveAccount("owner"),
2523
+ source: resolveAccount("source")
2524
+ },
2525
+ SplTokenSetAuthorityInstructionData: {
2526
+ authority: resolveAccount("authority"),
2527
+ multisigAuthority: resolveAccount("multisigAuthority"),
2528
+ newAuthority: resolveAccount("newAuthority")
2529
+ },
2530
+ SplTokenMintToInstructionData: {
2531
+ account: resolveAccount("account"),
2532
+ authority: resolveAccount("authority"),
2533
+ mint: resolveAccount("mint"),
2534
+ mintAuthority: resolveAccount("mintAuthority"),
2535
+ multisigMintAuthority: resolveAccount("multisigMintAuthority")
2536
+ },
2537
+ SplTokenBurnInstructionData: {
2538
+ account: resolveAccount("account"),
2539
+ authority: resolveAccount("authority"),
2540
+ mint: resolveAccount("mint"),
2541
+ multisigAuthority: resolveAccount("multisigAuthority")
2542
+ },
2543
+ SplTokenCloseAccountInstructionData: {
2544
+ account: resolveAccount("account"),
2545
+ destination: resolveAccount("destination"),
2546
+ multisigOwner: resolveAccount("multisigOwner"),
2547
+ owner: resolveAccount("owner")
2548
+ },
2549
+ SplTokenFreezeAccountInstructionData: {
2550
+ account: resolveAccount("account"),
2551
+ freezeAuthority: resolveAccount("freezeAuthority"),
2552
+ mint: resolveAccount("mint"),
2553
+ multisigFreezeAuthority: resolveAccount("multisigFreezeAuthority")
2554
+ },
2555
+ SplTokenThawAccountInstructionData: {
2556
+ account: resolveAccount("account"),
2557
+ freezeAuthority: resolveAccount("freezeAuthority"),
2558
+ mint: resolveAccount("mint"),
2559
+ multisigFreezeAuthority: resolveAccount("multisigFreezeAuthority")
2560
+ },
2561
+ SplTokenTransferCheckedInstructionData: {
2562
+ authority: resolveAccount("authority"),
2563
+ destination: resolveAccount("destination"),
2564
+ mint: resolveAccount("mint"),
2565
+ multisigAuthority: resolveAccount("multisigAuthority"),
2566
+ source: resolveAccount("source")
2567
+ },
2568
+ SplTokenApproveCheckedInstructionData: {
2569
+ delegate: resolveAccount("delegate"),
2570
+ mint: resolveAccount("mint"),
2571
+ multisigOwner: resolveAccount("multisigOwner"),
2572
+ owner: resolveAccount("owner"),
2573
+ source: resolveAccount("source")
2574
+ },
2575
+ SplTokenMintToCheckedInstructionData: {
2576
+ account: resolveAccount("account"),
2577
+ authority: resolveAccount("authority"),
2578
+ mint: resolveAccount("mint"),
2579
+ mintAuthority: resolveAccount("mintAuthority"),
2580
+ multisigMintAuthority: resolveAccount("multisigMintAuthority")
2581
+ },
2582
+ SplTokenBurnCheckedInstructionData: {
2583
+ account: resolveAccount("account"),
2584
+ authority: resolveAccount("authority"),
2585
+ mint: resolveAccount("mint"),
2586
+ multisigAuthority: resolveAccount("multisigAuthority")
2587
+ },
2588
+ SplTokenSyncNativeInstructionData: {
2589
+ account: resolveAccount("account")
2590
+ },
2591
+ SplTokenGetAccountDataSizeInstructionData: {
2592
+ mint: resolveAccount("mint")
2593
+ },
2594
+ SplTokenAmountToUiAmountInstructionData: {
2595
+ mint: resolveAccount("mint")
2596
+ },
2597
+ SplTokenUiAmountToAmountInstructionData: {
2598
+ mint: resolveAccount("mint")
2599
+ },
2600
+ SplTokenInitializeMintCloseAuthorityInstructionData: {
2601
+ mint: resolveAccount("mint"),
2602
+ newAuthority: resolveAccount("newAuthority")
2603
+ },
2604
+ Lockup: {
2605
+ custodian: resolveAccount("custodian")
2606
+ },
2607
+ StakeInitializeInstructionDataAuthorized: {
2608
+ staker: resolveAccount("staker"),
2609
+ withdrawer: resolveAccount("withdrawer")
2610
+ },
2611
+ StakeInitializeInstructionData: {
2612
+ stakeAccount: resolveAccount("stakeAccount")
2613
+ },
2614
+ StakeAuthorizeInstructionData: {
2615
+ authority: resolveAccount("authority"),
2616
+ custodian: resolveAccount("custodian"),
2617
+ newAuthority: resolveAccount("newAuthority"),
2618
+ stakeAccount: resolveAccount("stakeAccount")
2619
+ },
2620
+ StakeDelegateStakeInstructionData: {
2621
+ stakeAccount: resolveAccount("stakeAccount"),
2622
+ stakeAuthority: resolveAccount("stakeAuthority"),
2623
+ stakeConfigAccount: resolveAccount("stakeConfigAccount"),
2624
+ voteAccount: resolveAccount("voteAccount")
2625
+ },
2626
+ StakeSplitInstructionData: {
2627
+ newSplitAccount: resolveAccount("newSplitAccount"),
2628
+ stakeAccount: resolveAccount("stakeAccount"),
2629
+ stakeAuthority: resolveAccount("stakeAuthority")
2630
+ },
2631
+ StakeWithdrawInstructionData: {
2632
+ destination: resolveAccount("destination"),
2633
+ stakeAccount: resolveAccount("stakeAccount"),
2634
+ withdrawAuthority: resolveAccount("withdrawAuthority")
2635
+ },
2636
+ StakeDeactivateInstructionData: {
2637
+ stakeAccount: resolveAccount("stakeAccount"),
2638
+ stakeAuthority: resolveAccount("stakeAuthority")
2639
+ },
2640
+ StakeSetLockupInstructionData: {
2641
+ custodian: resolveAccount("custodian"),
2642
+ stakeAccount: resolveAccount("stakeAccount")
2643
+ },
2644
+ StakeMergeInstructionData: {
2645
+ destination: resolveAccount("destination"),
2646
+ source: resolveAccount("source"),
2647
+ stakeAuthority: resolveAccount("stakeAuthority")
2648
+ },
2649
+ StakeAuthorizeWithSeedInstructionData: {
2650
+ authorityBase: resolveAccount("authorityBase"),
2651
+ authorityOwner: resolveAccount("authorityOwner"),
2652
+ custodian: resolveAccount("custodian"),
2653
+ newAuthorized: resolveAccount("newAuthorized"),
2654
+ stakeAccount: resolveAccount("stakeAccount")
2655
+ },
2656
+ StakeInitializeCheckedInstructionDataAuthorized: {
2657
+ stakeAccount: resolveAccount("stakeAccount"),
2658
+ staker: resolveAccount("staker"),
2659
+ withdrawer: resolveAccount("withdrawer")
2660
+ },
2661
+ StakeAuthorizeCheckedInstructionData: {
2662
+ authority: resolveAccount("authority"),
2663
+ custodian: resolveAccount("custodian"),
2664
+ newAuthority: resolveAccount("newAuthority"),
2665
+ stakeAccount: resolveAccount("stakeAccount")
2666
+ },
2667
+ StakeAuthorizeCheckedWithSeedInstructionData: {
2668
+ authorityBase: resolveAccount("authorityBase"),
2669
+ authorityOwner: resolveAccount("authorityOwner"),
2670
+ custodian: resolveAccount("custodian"),
2671
+ newAuthorized: resolveAccount("newAuthorized"),
2672
+ stakeAccount: resolveAccount("stakeAccount")
2673
+ },
2674
+ StakeSetLockupCheckedInstructionData: {
2675
+ custodian: resolveAccount("custodian"),
2676
+ stakeAccount: resolveAccount("stakeAccount")
2677
+ },
2678
+ StakeDeactivateDelinquentInstructionData: {
2679
+ referenceVoteAccount: resolveAccount("referenceVoteAccount"),
2680
+ stakeAccount: resolveAccount("stakeAccount"),
2681
+ voteAccount: resolveAccount("voteAccount")
2682
+ },
2683
+ StakeRedelegateInstructionData: {
2684
+ newStakeAccount: resolveAccount("newStakeAccount"),
2685
+ stakeAccount: resolveAccount("stakeAccount"),
2686
+ stakeAuthority: resolveAccount("stakeAuthority"),
2687
+ stakeConfigAccount: resolveAccount("stakeConfigAccount"),
2688
+ voteAccount: resolveAccount("voteAccount")
2689
+ },
2690
+ CreateAccountInstructionData: {
2691
+ newAccount: resolveAccount("newAccount"),
2692
+ owner: resolveAccount("owner"),
2693
+ source: resolveAccount("source")
2694
+ },
2695
+ AssignInstructionData: {
2696
+ account: resolveAccount("account"),
2697
+ owner: resolveAccount("owner")
2698
+ },
2699
+ TransferInstructionData: {
2700
+ destination: resolveAccount("destination"),
2701
+ source: resolveAccount("source")
2702
+ },
2703
+ CreateAccountWithSeedInstructionData: {
2704
+ base: resolveAccount("base"),
2705
+ owner: resolveAccount("owner"),
2706
+ seed: resolveAccount("seed")
2707
+ },
2708
+ AdvanceNonceAccountInstructionData: {
2709
+ nonceAccount: resolveAccount("nonceAccount"),
2710
+ nonceAuthority: resolveAccount("nonceAuthority")
2711
+ },
2712
+ WithdrawNonceAccountInstructionData: {
2713
+ destination: resolveAccount("destination"),
2714
+ nonceAccount: resolveAccount("nonceAccount"),
2715
+ nonceAuthority: resolveAccount("nonceAuthority")
2716
+ },
2717
+ InitializeNonceAccountInstructionData: {
2718
+ nonceAccount: resolveAccount("nonceAccount"),
2719
+ nonceAuthority: resolveAccount("nonceAuthority")
2720
+ },
2721
+ AuthorizeNonceAccountInstructionData: {
2722
+ newAuthorized: resolveAccount("newAuthorized"),
2723
+ nonceAccount: resolveAccount("nonceAccount"),
2724
+ nonceAuthority: resolveAccount("nonceAuthority")
2725
+ },
2726
+ UpgradeNonceAccountInstructionData: {
2727
+ nonceAccount: resolveAccount("nonceAccount"),
2728
+ nonceAuthority: resolveAccount("nonceAuthority")
2729
+ },
2730
+ AllocateInstructionData: {
2731
+ account: resolveAccount("account")
2732
+ },
2733
+ AllocateWithSeedInstructionData: {
2734
+ account: resolveAccount("account"),
2735
+ owner: resolveAccount("owner")
2736
+ },
2737
+ AssignWithSeedInstructionData: {
2738
+ account: resolveAccount("account"),
2739
+ owner: resolveAccount("owner")
2740
+ },
2741
+ TransferWithSeedInstructionData: {
2742
+ destination: resolveAccount("destination"),
2743
+ source: resolveAccount("source"),
2744
+ sourceOwner: resolveAccount("sourceOwner")
2745
+ },
2746
+ VoteInitializeAccountInstructionData: {
2747
+ authorizedVoter: resolveAccount("authorizedVoter"),
2748
+ authorizedWithdrawer: resolveAccount("authorizedWithdrawer"),
2749
+ node: resolveAccount("node"),
2750
+ voteAccount: resolveAccount("voteAccount")
2751
+ },
2752
+ VoteAuthorizeInstructionData: {
2753
+ authority: resolveAccount("authority"),
2754
+ newAuthority: resolveAccount("newAuthority"),
2755
+ voteAccount: resolveAccount("voteAccount")
2756
+ },
2757
+ VoteAuthorizeWithSeedInstructionData: {
2758
+ authorityOwner: resolveAccount("authorityOwner"),
2759
+ newAuthority: resolveAccount("newAuthority"),
2760
+ voteAccount: resolveAccount("voteAccount")
2761
+ },
2762
+ VoteAuthorizeCheckedWithSeedInstructionData: {
2763
+ authorityOwner: resolveAccount("authorityOwner"),
2764
+ newAuthority: resolveAccount("newAuthority"),
2765
+ voteAccount: resolveAccount("voteAccount")
2766
+ },
2767
+ VoteVoteInstructionData: {
2768
+ voteAccount: resolveAccount("voteAccount"),
2769
+ voteAuthority: resolveAccount("voteAuthority")
2770
+ },
2771
+ VoteUpdateVoteStateInstructionData: {
2772
+ voteAccount: resolveAccount("voteAccount"),
2773
+ voteAuthority: resolveAccount("voteAuthority")
2774
+ },
2775
+ VoteUpdateVoteStateSwitchInstructionData: {
2776
+ voteAccount: resolveAccount("voteAccount"),
2777
+ voteAuthority: resolveAccount("voteAuthority")
2778
+ },
2779
+ VoteCompactUpdateVoteStateInstructionData: {
2780
+ voteAccount: resolveAccount("voteAccount"),
2781
+ voteAuthority: resolveAccount("voteAuthority")
2782
+ },
2783
+ VoteCompactUpdateVoteStateSwitchInstructionData: {
2784
+ voteAccount: resolveAccount("voteAccount"),
2785
+ voteAuthority: resolveAccount("voteAuthority")
2786
+ },
2787
+ VoteWithdrawInstructionData: {
2788
+ voteAccount: resolveAccount("voteAccount"),
2789
+ withdrawAuthority: resolveAccount("withdrawAuthority")
2790
+ },
2791
+ VoteUpdateValidatorIdentityInstructionData: {
2792
+ newValidatorIdentity: resolveAccount("newValidatorIdentity"),
2793
+ voteAccount: resolveAccount("voteAccount"),
2794
+ withdrawAuthority: resolveAccount("withdrawAuthority")
2795
+ },
2796
+ VoteUpdateCommissionInstructionData: {
2797
+ voteAccount: resolveAccount("voteAccount"),
2798
+ withdrawAuthority: resolveAccount("withdrawAuthority")
2799
+ },
2800
+ VoteVoteSwitchInstructionData: {
2801
+ voteAccount: resolveAccount("voteAccount"),
2802
+ voteAuthority: resolveAccount("voteAuthority")
2803
+ },
2804
+ VoteAuthorizeCheckedInstructionData: {
2805
+ authority: resolveAccount("authority"),
2806
+ newAuthority: resolveAccount("newAuthority"),
2807
+ voteAccount: resolveAccount("voteAccount")
2808
+ }
1883
2809
  };
1884
- var memoisedTransactionInterface;
1885
- var transactionInterface = () => {
1886
- if (!memoisedTransactionInterface)
1887
- memoisedTransactionInterface = new GraphQLInterfaceType({
1888
- fields: {
1889
- ...transactionInterfaceFields()
1890
- },
1891
- name: "Transaction",
1892
- resolveType(transaction) {
1893
- if (transaction.encoding === "base58") {
2810
+
2811
+ // src/schema/transaction.ts
2812
+ var transactionTypeDefs = (
2813
+ /* GraphQL */
2814
+ `
2815
+ type TransactionStatusOk {
2816
+ Ok: String
2817
+ }
2818
+ type TransactionStatusErr {
2819
+ Err: String
2820
+ }
2821
+ union TransactionStatus = TransactionStatusOk | TransactionStatusErr
2822
+
2823
+ type TransactionLoadedAddresses {
2824
+ readonly: [String]
2825
+ writable: [String]
2826
+ }
2827
+
2828
+ type TransactionInnerInstruction {
2829
+ index: Int
2830
+ instructions: [TransactionInstruction]
2831
+ }
2832
+
2833
+ type TransactionMeta {
2834
+ computeUnitsConsumed: BigInt
2835
+ err: String
2836
+ fee: BigInt
2837
+ innerInstructions: [TransactionInnerInstruction]
2838
+ loadedAddresses: TransactionLoadedAddresses
2839
+ logMessages: [String]
2840
+ postBalances: [BigInt]
2841
+ postTokenBalances: [TokenBalance]
2842
+ preBalances: [BigInt]
2843
+ preTokenBalances: [TokenBalance]
2844
+ returnData: ReturnData
2845
+ rewards: [Reward]
2846
+ status: TransactionStatus
2847
+ }
2848
+
2849
+ type TransactionMessageAccountKey {
2850
+ pubkey: String
2851
+ signer: Boolean
2852
+ source: String
2853
+ writable: Boolean
2854
+ }
2855
+
2856
+ type TransactionMessageAddressTableLookup {
2857
+ accountKey: String
2858
+ readableIndexes: [Int]
2859
+ writableIndexes: [Int]
2860
+ }
2861
+
2862
+ type TransactionMessageHeader {
2863
+ numReadonlySignedAccounts: Int
2864
+ numReadonlyUnsignedAccounts: Int
2865
+ numRequiredSignatures: Int
2866
+ }
2867
+
2868
+ type TransactionMessage {
2869
+ accountKeys: [TransactionMessageAccountKey]
2870
+ addressTableLookups: [TransactionMessageAddressTableLookup]
2871
+ header: TransactionMessageHeader
2872
+ instructions: [TransactionInstruction]
2873
+ recentBlockhash: String
2874
+ }
2875
+
2876
+ # Transaction interface
2877
+ interface Transaction {
2878
+ blockTime: String
2879
+ encoding: String
2880
+ meta: TransactionMeta
2881
+ slot: BigInt
2882
+ version: String
2883
+ }
2884
+
2885
+ # A transaction with base58 encoded data
2886
+ type TransactionBase58 implements Transaction {
2887
+ blockTime: String
2888
+ data: String
2889
+ encoding: String
2890
+ meta: TransactionMeta
2891
+ slot: BigInt
2892
+ version: String
2893
+ }
2894
+
2895
+ # A transaction with base64 encoded data
2896
+ type TransactionBase64 implements Transaction {
2897
+ blockTime: String
2898
+ data: String
2899
+ encoding: String
2900
+ meta: TransactionMeta
2901
+ slot: BigInt
2902
+ version: String
2903
+ }
2904
+
2905
+ # A transaction with JSON encoded data
2906
+ type TransactionDataParsed {
2907
+ message: TransactionMessage
2908
+ signatures: [String]
2909
+ }
2910
+ type TransactionParsed implements Transaction {
2911
+ blockTime: String
2912
+ data: TransactionDataParsed
2913
+ encoding: String
2914
+ meta: TransactionMeta
2915
+ slot: BigInt
2916
+ version: String
2917
+ }
2918
+ `
2919
+ );
2920
+ var transactionResolvers = {
2921
+ Transaction: {
2922
+ __resolveType(transaction) {
2923
+ switch (transaction.encoding) {
2924
+ case "base58":
1894
2925
  return "TransactionBase58";
1895
- }
1896
- if (transaction.encoding === "base64") {
2926
+ case "base64":
1897
2927
  return "TransactionBase64";
1898
- }
1899
- if (transaction.encoding === "json") {
1900
- return "TransactionJson";
1901
- }
1902
- return "TransactionJsonParsed";
2928
+ default:
2929
+ return "TransactionParsed";
1903
2930
  }
1904
- });
1905
- return memoisedTransactionInterface;
1906
- };
1907
- var transactionType = (name, description, transaction) => new GraphQLObjectType({
1908
- description,
1909
- fields: {
1910
- ...transactionInterfaceFields(),
1911
- transaction
1912
- },
1913
- interfaces: [transactionInterface()],
1914
- name
1915
- });
1916
- var memoisedTransactionBase58;
1917
- var transactionBase58 = () => {
1918
- if (!memoisedTransactionBase58)
1919
- memoisedTransactionBase58 = transactionType(
1920
- "TransactionBase58",
1921
- "A Solana transaction as base58 encoded data",
1922
- string()
1923
- );
1924
- return memoisedTransactionBase58;
1925
- };
1926
- var memoisedTransactionBase64;
1927
- var transactionBase64 = () => {
1928
- if (!memoisedTransactionBase64)
1929
- memoisedTransactionBase64 = transactionType(
1930
- "TransactionBase64",
1931
- "A Solana transaction as base64 encoded data",
1932
- string()
1933
- );
1934
- return memoisedTransactionBase64;
1935
- };
1936
- var memoisedTransactionJson;
1937
- var transactionJson = () => {
1938
- if (!memoisedTransactionJson)
1939
- memoisedTransactionJson = transactionType(
1940
- "TransactionJson",
1941
- "A Solana transaction as a JSON object",
1942
- type(transactionTransaction())
1943
- );
1944
- return memoisedTransactionJson;
1945
- };
1946
- var memoisedTransactionJsonParsed;
1947
- var transactionJsonParsed = () => {
1948
- if (!memoisedTransactionJsonParsed)
1949
- memoisedTransactionJsonParsed = transactionType(
1950
- "TransactionJsonParsed",
1951
- "A Solana transaction as a parsed JSON object",
1952
- type(transactionTransaction())
1953
- );
1954
- return memoisedTransactionJsonParsed;
1955
- };
1956
- var memoisedTransactionTypes;
1957
- var transactionTypes = () => {
1958
- if (!memoisedTransactionTypes)
1959
- memoisedTransactionTypes = [
1960
- partiallyDecodedTransactionInstruction(),
1961
- ...parsedInstructionsAddressLookupTable(),
1962
- ...parsedInstructionsBpfLoader(),
1963
- ...parsedInstructionsBpfUpgradeableLoader(),
1964
- ...parsedInstructionsStake(),
1965
- ...parsedInstructionsSplAssociatedToken(),
1966
- parsedInstructionSplMemo(),
1967
- ...parsedInstructionsSplToken(),
1968
- ...parsedInstructionsSystem(),
1969
- ...parsedInstructionsVote(),
1970
- transactionMetaUnparsed(),
1971
- transactionMetaParsed(),
1972
- transactionMessageUnparsed(),
1973
- transactionMessageParsed(),
1974
- transactionBase58(),
1975
- transactionBase64(),
1976
- transactionJson(),
1977
- transactionJsonParsed()
1978
- ];
1979
- return memoisedTransactionTypes;
1980
- };
1981
-
1982
- // src/schema/transaction/query.ts
1983
- var transactionQuery = () => ({
1984
- transaction: {
1985
- args: {
1986
- commitment: type(commitmentInputType()),
1987
- encoding: type(transactionEncodingInputType()),
1988
- maxSupportedTransactionVersion: type(maxSupportedTransactionVersionInputType()),
1989
- signature: nonNull(string())
1990
- },
1991
- resolve: (_parent, args, context) => context.resolveTransaction(args),
1992
- type: transactionInterface()
2931
+ }
1993
2932
  }
1994
- });
1995
-
1996
- // src/schema/block/types.ts
1997
- var memoisedTransactionForAccounts;
1998
- var transactionForAccounts = () => {
1999
- if (!memoisedTransactionForAccounts)
2000
- memoisedTransactionForAccounts = new GraphQLObjectType({
2001
- fields: {
2002
- meta: object("TransactionMetaForAccounts", {
2003
- computeUnitsUsed: bigint(),
2004
- err: string(),
2005
- fee: bigint(),
2006
- format: string(),
2007
- loadedAddresses: type(transactionMetaLoadedAddresses()),
2008
- logMessages: list(string()),
2009
- postBalances: list(bigint()),
2010
- postTokenBalances: list(type(tokenBalance())),
2011
- preBalances: list(bigint()),
2012
- preTokenBalances: list(type(tokenBalance())),
2013
- returnData: type(returnData()),
2014
- rewards: list(type(reward())),
2015
- status: type(transactionStatus())
2016
- }),
2017
- transaction: type(transactionInterface()),
2018
- // TODO
2019
- version: string()
2020
- },
2021
- name: "TransactionForAccounts"
2022
- });
2023
- return memoisedTransactionForAccounts;
2024
- };
2025
- var memoisedBlockInterfaceFields;
2026
- var blockInterfaceFields = () => {
2027
- if (!memoisedBlockInterfaceFields)
2028
- memoisedBlockInterfaceFields = {
2029
- blockHeight: bigint(),
2030
- blockTime: bigint(),
2031
- blockhash: string(),
2032
- parentSlot: bigint(),
2033
- previousBlockhash: string(),
2034
- rewards: list(type(reward()))
2035
- };
2036
- return memoisedBlockInterfaceFields;
2037
- };
2038
- var memoisedBlockInterface;
2039
- var blockInterface = () => {
2040
- if (!memoisedBlockInterface)
2041
- memoisedBlockInterface = new GraphQLInterfaceType({
2042
- fields: {
2043
- ...blockInterfaceFields()
2044
- },
2045
- name: "Block",
2046
- resolveType(block) {
2047
- if (block.transactionDetails === "signatures") {
2048
- return "BlockWithSignatures";
2049
- }
2050
- if (block.transactionDetails === "accounts") {
2051
- return "BlockWithAccounts";
2052
- }
2053
- if (block.transactionDetails === "none") {
2054
- return "BlockWithNoTransactions";
2055
- }
2056
- return "BlockWithTransactions";
2057
- }
2058
- });
2059
- return memoisedBlockInterface;
2060
- };
2061
- var memoisedBlockWithNoTransactions;
2062
- var blockWithNoTransactions = () => {
2063
- if (!memoisedBlockWithNoTransactions)
2064
- memoisedBlockWithNoTransactions = new GraphQLObjectType({
2065
- fields: {
2066
- ...blockInterfaceFields()
2067
- },
2068
- interfaces: [blockInterface()],
2069
- name: "BlockWithNoTransactions"
2070
- });
2071
- return memoisedBlockWithNoTransactions;
2072
- };
2073
- var memoisedBlockWithSignatures;
2074
- var blockWithSignatures = () => {
2075
- if (!memoisedBlockWithSignatures)
2076
- memoisedBlockWithSignatures = new GraphQLObjectType({
2077
- fields: {
2078
- ...blockInterfaceFields(),
2079
- signatures: list(string())
2080
- },
2081
- interfaces: [blockInterface()],
2082
- name: "BlockWithSignatures"
2083
- });
2084
- return memoisedBlockWithSignatures;
2085
- };
2086
- var memoisedBlockWithAccounts;
2087
- var blockWithAccounts = () => {
2088
- if (!memoisedBlockWithAccounts)
2089
- memoisedBlockWithAccounts = new GraphQLObjectType({
2090
- fields: {
2091
- ...blockInterfaceFields(),
2092
- transactions: list(type(transactionForAccounts()))
2093
- },
2094
- interfaces: [blockInterface()],
2095
- name: "BlockWithAccounts"
2096
- });
2097
- return memoisedBlockWithAccounts;
2098
- };
2099
- var memoisedBlockWithTransactions;
2100
- var blockWithTransactions = () => {
2101
- if (!memoisedBlockWithTransactions)
2102
- memoisedBlockWithTransactions = new GraphQLObjectType({
2103
- fields: {
2104
- ...blockInterfaceFields(),
2105
- transactions: list(type(transactionInterface()))
2106
- },
2107
- interfaces: [blockInterface()],
2108
- name: "BlockWithTransactions"
2109
- });
2110
- return memoisedBlockWithTransactions;
2111
- };
2112
- var memoisedBlockTypes;
2113
- var blockTypes = () => {
2114
- if (!memoisedBlockTypes)
2115
- memoisedBlockTypes = [
2116
- blockWithNoTransactions(),
2117
- blockWithSignatures(),
2118
- blockWithAccounts(),
2119
- blockWithTransactions()
2120
- ];
2121
- return memoisedBlockTypes;
2122
2933
  };
2123
2934
 
2124
- // src/schema/block/query.ts
2125
- var blockQuery = () => ({
2126
- block: {
2127
- args: {
2128
- commitment: type(commitmentInputType()),
2129
- encoding: type(transactionEncodingInputType()),
2130
- maxSupportedTransactionVersion: string(),
2131
- rewards: boolean(),
2132
- slot: nonNull(bigint()),
2133
- transactionDetails: type(blockTransactionDetailsInputType())
2134
- },
2135
- resolve: (_parent, args, context) => context.resolveBlock(args),
2136
- type: blockInterface()
2137
- }
2138
- });
2139
- var programAccount = () => new GraphQLObjectType({
2140
- fields: {
2141
- account: type(accountInterface()),
2142
- pubkey: string()
2143
- },
2144
- name: "ProgramAccount"
2145
- });
2935
+ // src/schema/index.ts
2936
+ var schemaTypeDefs = (
2937
+ /* GraphQL */
2938
+ `
2939
+ type Query {
2940
+ account(
2941
+ address: String!
2942
+ commitment: Commitment
2943
+ dataSlice: DataSlice
2944
+ encoding: AccountEncoding
2945
+ minContextSlot: BigInt
2946
+ ): Account
2947
+ block(
2948
+ slot: BigInt!
2949
+ commitment: Commitment
2950
+ encoding: TransactionEncoding
2951
+ transactionDetails: BlockTransactionDetails
2952
+ ): Block
2953
+ programAccounts(
2954
+ programAddress: String!
2955
+ commitment: Commitment
2956
+ dataSlice: DataSlice
2957
+ encoding: AccountEncoding
2958
+ filters: [ProgramAccountsFilter]
2959
+ minContextSlot: BigInt
2960
+ ): [Account]
2961
+ transaction(
2962
+ signature: String!
2963
+ commitment: Commitment
2964
+ encoding: TransactionEncoding
2965
+ ): Transaction
2966
+ }
2146
2967
 
2147
- // src/schema/program-accounts/query.ts
2148
- var programAccountsQuery = () => ({
2149
- programAccounts: {
2150
- args: {
2151
- commitment: type(commitmentInputType()),
2152
- dataSlice: type(dataSliceInputType()),
2153
- encoding: type(accountEncodingInputType()),
2154
- filters: list(type(programAccountFilterInputType())),
2155
- minContextSlot: bigint(),
2156
- programAddress: nonNull(string()),
2157
- withContext: string()
2968
+ schema {
2969
+ query: Query
2970
+ }
2971
+ `
2972
+ );
2973
+ var schemaResolvers = {
2974
+ Query: {
2975
+ account(_, args, context, info) {
2976
+ return context.accountLoader.load(args, info);
2977
+ },
2978
+ block(_, args, context, info) {
2979
+ return context.loadBlock(args, info);
2158
2980
  },
2159
- resolve: (_parent, args, context) => context.resolveProgramAccounts(args),
2160
- type: new GraphQLList(programAccount())
2981
+ programAccounts(_, args, context, info) {
2982
+ return context.loadProgramAccounts(args, info);
2983
+ },
2984
+ transaction(_, args, context, info) {
2985
+ return context.loadTransaction(args, info);
2986
+ }
2161
2987
  }
2162
- });
2988
+ };
2989
+ function createSolanaGraphQLSchema() {
2990
+ return makeExecutableSchema({
2991
+ resolvers: {
2992
+ ...accountResolvers,
2993
+ ...blockResolvers,
2994
+ ...commonResolvers,
2995
+ ...inputResolvers,
2996
+ ...instructionResolvers,
2997
+ ...scalarResolvers,
2998
+ ...schemaResolvers,
2999
+ ...transactionResolvers
3000
+ },
3001
+ typeDefs: [
3002
+ accountTypeDefs,
3003
+ blockTypeDefs,
3004
+ commonTypeDefs,
3005
+ inputTypeDefs,
3006
+ instructionTypeDefs,
3007
+ scalarTypeDefs,
3008
+ schemaTypeDefs,
3009
+ transactionTypeDefs
3010
+ ]
3011
+ });
3012
+ }
2163
3013
 
2164
3014
  // src/rpc.ts
2165
3015
  function createRpcGraphQL(rpc) {
2166
3016
  const context = createSolanaGraphQLContext(rpc);
2167
- const schema = new GraphQLSchema({
2168
- query: new GraphQLObjectType({
2169
- fields: {
2170
- ...accountQuery(),
2171
- ...blockQuery(),
2172
- ...programAccountsQuery(),
2173
- ...transactionQuery()
2174
- },
2175
- name: "RootQuery"
2176
- }),
2177
- types: [...accountTypes(), ...blockTypes(), ...transactionTypes()]
2178
- });
3017
+ const schema = createSolanaGraphQLSchema();
2179
3018
  return {
2180
3019
  context,
2181
3020
  async query(source, variableValues) {