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