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

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