@solana/rpc-graphql 2.0.0-experimental.eb5fd16 → 2.0.0-experimental.f7d1af1

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