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