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

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