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