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