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