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