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