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