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