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