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