@solana/rpc-graphql 2.0.0-experimental.ee4214c → 2.0.0-experimental.f7d1af1

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