@solana/rpc-graphql 2.0.0-experimental.278784a → 2.0.0-experimental.38794f3

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.
@@ -36,10 +36,2263 @@ function createGraphQLCache() {
36
36
  }
37
37
 
38
38
  // src/context.ts
39
+ async function resolveAccount({ address, encoding = "jsonParsed", ...config }, cache, rpc, info) {
40
+ if (info && info.fieldNodes[0].selectionSet) {
41
+ const selectionSet = info.fieldNodes[0].selectionSet;
42
+ const requestedFields = selectionSet.selections.map((field) => {
43
+ if (field.kind === "Field") {
44
+ return field.name.value;
45
+ }
46
+ return null;
47
+ });
48
+ if (requestedFields && requestedFields.length === 1 && requestedFields[0] === "address") {
49
+ return { address };
50
+ }
51
+ }
52
+ const requestConfig = { encoding, ...config };
53
+ const cached = cache.get(address, requestConfig);
54
+ if (cached !== null) {
55
+ return cached;
56
+ }
57
+ const account = await rpc.getAccountInfo(address, requestConfig).send().then((res) => res.value).catch((e) => {
58
+ throw e;
59
+ });
60
+ if (account === null) {
61
+ return {
62
+ address
63
+ };
64
+ }
65
+ const [data, responseEncoding] = Array.isArray(account.data) ? encoding === "jsonParsed" ? [account.data[0], "base64"] : [account.data[0], encoding] : [account.data, "jsonParsed"];
66
+ const queryResponse = {
67
+ ...account,
68
+ address,
69
+ data,
70
+ encoding: responseEncoding
71
+ };
72
+ cache.insert(address, requestConfig, queryResponse);
73
+ return queryResponse;
74
+ }
75
+ async function resolveBlock({ slot, encoding = "jsonParsed", ...config }, cache, rpc) {
76
+ const requestConfig = { encoding, ...config };
77
+ const cached = cache.get(slot, config);
78
+ if (cached !== null) {
79
+ return cached;
80
+ }
81
+ const block = await rpc.getBlock(slot, requestConfig).send();
82
+ if (block === null) {
83
+ return null;
84
+ }
85
+ cache.insert(slot, config, block);
86
+ return block;
87
+ }
88
+ async function resolveProgramAccounts({ programAddress, encoding = "jsonParsed", ...config }, cache, rpc) {
89
+ const requestConfig = { encoding, ...config };
90
+ const cached = cache.get(programAddress, requestConfig);
91
+ if (cached !== null) {
92
+ return cached;
93
+ }
94
+ const programAccounts = await rpc.getProgramAccounts(programAddress, requestConfig).send().then((res) => {
95
+ if ("value" in res) {
96
+ return res.value;
97
+ }
98
+ return res;
99
+ }).catch((e) => {
100
+ throw e;
101
+ });
102
+ const queryResponse = programAccounts.map((programAccount) => {
103
+ const [data, responseEncoding] = Array.isArray(programAccount.account.data) ? encoding === "jsonParsed" ? [programAccount.account.data[0], "base64"] : [programAccount.account.data[0], encoding] : [programAccount.account.data, "jsonParsed"];
104
+ const pubkey = programAccount.pubkey;
105
+ return {
106
+ ...programAccount.account,
107
+ address: pubkey,
108
+ data,
109
+ encoding: responseEncoding
110
+ };
111
+ });
112
+ cache.insert(programAddress, requestConfig, queryResponse);
113
+ return queryResponse;
114
+ }
115
+ async function resolveTransaction({ signature, encoding = "jsonParsed", ...config }, cache, rpc) {
116
+ const requestConfig = { encoding, ...config };
117
+ const cached = cache.get(signature, requestConfig);
118
+ if (cached !== null) {
119
+ return cached;
120
+ }
121
+ const transaction = await rpc.getTransaction(signature, requestConfig).send();
122
+ if (transaction === null) {
123
+ return null;
124
+ }
125
+ const [transactionData, responseEncoding, responseFormat] = Array.isArray(transaction.transaction) ? encoding === "jsonParsed" ? [transaction.transaction[0], "base64", "unparsed"] : [transaction.transaction[0], encoding, "unparsed"] : encoding === "jsonParsed" ? [transaction.transaction, encoding, "parsed"] : [transaction.transaction, encoding, "unparsed"];
126
+ if (transaction.meta) {
127
+ transaction.meta["format"] = responseFormat;
128
+ }
129
+ if (transactionData.message) {
130
+ transactionData.message["format"] = responseFormat;
131
+ }
132
+ const queryResponse = {
133
+ ...transaction,
134
+ encoding: responseEncoding,
135
+ transaction: transactionData
136
+ };
137
+ cache.insert(signature, requestConfig, queryResponse);
138
+ return queryResponse;
139
+ }
39
140
  function createSolanaGraphQLContext(rpc) {
40
141
  const cache = createGraphQLCache();
41
- return { cache, rpc };
142
+ return {
143
+ cache,
144
+ resolveAccount(args, info) {
145
+ return resolveAccount(args, this.cache, this.rpc, info);
146
+ },
147
+ resolveBlock(args) {
148
+ return resolveBlock(args, this.cache, this.rpc);
149
+ },
150
+ resolveProgramAccounts(args) {
151
+ return resolveProgramAccounts(args, this.cache, this.rpc);
152
+ },
153
+ resolveTransaction(args) {
154
+ return resolveTransaction(args, this.cache, this.rpc);
155
+ },
156
+ rpc
157
+ };
158
+ }
159
+ var BigIntScalar = () => new graphql.GraphQLScalarType({
160
+ name: "BigInt",
161
+ parseLiteral(ast) {
162
+ if (ast.kind === graphql.Kind.STRING) {
163
+ return BigInt(ast.value);
164
+ }
165
+ return null;
166
+ },
167
+ parseValue(value) {
168
+ return BigInt(value);
169
+ },
170
+ serialize(value) {
171
+ return BigInt(value);
172
+ }
173
+ });
174
+
175
+ // src/schema/picks.ts
176
+ function boolean() {
177
+ return { type: graphql.GraphQLBoolean };
42
178
  }
179
+ var memoisedBigint;
180
+ function bigint() {
181
+ if (!memoisedBigint)
182
+ memoisedBigint = { type: BigIntScalar() };
183
+ return memoisedBigint;
184
+ }
185
+ function number() {
186
+ return { type: graphql.GraphQLInt };
187
+ }
188
+ function string() {
189
+ return { type: graphql.GraphQLString };
190
+ }
191
+ function type(fieldType) {
192
+ return {
193
+ type: fieldType
194
+ };
195
+ }
196
+ function nonNull(fieldType) {
197
+ return {
198
+ type: new graphql.GraphQLNonNull(fieldType.type)
199
+ };
200
+ }
201
+ function list(elementType) {
202
+ return {
203
+ type: new graphql.GraphQLList(elementType.type)
204
+ };
205
+ }
206
+ function object(name, fields) {
207
+ return {
208
+ type: new graphql.GraphQLObjectType({
209
+ fields,
210
+ name
211
+ })
212
+ };
213
+ }
214
+
215
+ // src/schema/inputs.ts
216
+ var memoisedAccountEncodingInputType;
217
+ var accountEncodingInputType = () => {
218
+ if (!memoisedAccountEncodingInputType)
219
+ memoisedAccountEncodingInputType = new graphql.GraphQLEnumType({
220
+ name: "AccountEncoding",
221
+ values: {
222
+ base58: {
223
+ value: "base58"
224
+ },
225
+ base64: {
226
+ value: "base64"
227
+ },
228
+ base64Zstd: {
229
+ value: "base64+zstd"
230
+ },
231
+ jsonParsed: {
232
+ value: "jsonParsed"
233
+ }
234
+ }
235
+ });
236
+ return memoisedAccountEncodingInputType;
237
+ };
238
+ var memoisedBlockTransactionDetailsInputType;
239
+ var blockTransactionDetailsInputType = () => {
240
+ if (!memoisedBlockTransactionDetailsInputType)
241
+ memoisedBlockTransactionDetailsInputType = new graphql.GraphQLEnumType({
242
+ name: "BlockTransactionDetails",
243
+ values: {
244
+ accounts: {
245
+ value: "accounts"
246
+ },
247
+ full: {
248
+ value: "full"
249
+ },
250
+ none: {
251
+ value: "none"
252
+ },
253
+ signatures: {
254
+ value: "signatures"
255
+ }
256
+ }
257
+ });
258
+ return memoisedBlockTransactionDetailsInputType;
259
+ };
260
+ var memoisedCommitmentInputType;
261
+ var commitmentInputType = () => {
262
+ if (!memoisedCommitmentInputType)
263
+ memoisedCommitmentInputType = new graphql.GraphQLEnumType({
264
+ name: "Commitment",
265
+ values: {
266
+ confirmed: {
267
+ value: "confirmed"
268
+ },
269
+ finalized: {
270
+ value: "finalized"
271
+ },
272
+ processed: {
273
+ value: "processed"
274
+ }
275
+ }
276
+ });
277
+ return memoisedCommitmentInputType;
278
+ };
279
+ var memoisedDataSliceInputType;
280
+ var dataSliceInputType = () => {
281
+ if (!memoisedDataSliceInputType)
282
+ memoisedDataSliceInputType = new graphql.GraphQLInputObjectType({
283
+ fields: {
284
+ length: number(),
285
+ offset: number()
286
+ },
287
+ name: "DataSliceConfig"
288
+ });
289
+ return memoisedDataSliceInputType;
290
+ };
291
+ var memoisedMaxSupportedTransactionVersionInputType;
292
+ var maxSupportedTransactionVersionInputType = () => {
293
+ if (!memoisedMaxSupportedTransactionVersionInputType)
294
+ memoisedMaxSupportedTransactionVersionInputType = new graphql.GraphQLEnumType({
295
+ name: "MaxSupportedTransactionVersion",
296
+ values: {
297
+ legacy: {
298
+ value: "legacy"
299
+ },
300
+ zero: {
301
+ value: "0"
302
+ }
303
+ }
304
+ });
305
+ return memoisedMaxSupportedTransactionVersionInputType;
306
+ };
307
+ var memoisedProgramAccountFilterInputType;
308
+ var programAccountFilterInputType = () => {
309
+ if (!memoisedProgramAccountFilterInputType)
310
+ memoisedProgramAccountFilterInputType = new graphql.GraphQLInputObjectType({
311
+ fields: {
312
+ bytes: bigint(),
313
+ dataSize: bigint(),
314
+ encoding: string(),
315
+ offset: bigint()
316
+ },
317
+ name: "ProgramAccountFilter"
318
+ });
319
+ return memoisedProgramAccountFilterInputType;
320
+ };
321
+ var memoisedTransactionEncodingInputType;
322
+ var transactionEncodingInputType = () => {
323
+ if (!memoisedTransactionEncodingInputType)
324
+ memoisedTransactionEncodingInputType = new graphql.GraphQLEnumType({
325
+ name: "TransactionEncoding",
326
+ values: {
327
+ base58: {
328
+ value: "base58"
329
+ },
330
+ base64: {
331
+ value: "base64"
332
+ },
333
+ json: {
334
+ value: "json"
335
+ },
336
+ jsonParsed: {
337
+ value: "jsonParsed"
338
+ }
339
+ }
340
+ });
341
+ return memoisedTransactionEncodingInputType;
342
+ };
343
+ var memoisedTokenAmountType;
344
+ var tokenAmountType = () => {
345
+ if (!memoisedTokenAmountType) {
346
+ memoisedTokenAmountType = new graphql.GraphQLObjectType({
347
+ fields: {
348
+ amount: string(),
349
+ decimals: number(),
350
+ uiAmount: bigint(),
351
+ uiAmountString: string()
352
+ },
353
+ name: "TokenAmount"
354
+ });
355
+ }
356
+ return memoisedTokenAmountType;
357
+ };
358
+ var memoisedAccountInterfaceFields;
359
+ var accountInterfaceFields = () => {
360
+ if (!memoisedAccountInterfaceFields) {
361
+ memoisedAccountInterfaceFields = {
362
+ address: string(),
363
+ encoding: string(),
364
+ executable: boolean(),
365
+ lamports: bigint(),
366
+ rentEpoch: bigint()
367
+ };
368
+ }
369
+ return memoisedAccountInterfaceFields;
370
+ };
371
+ var memoisedAccountInterface;
372
+ var accountInterface = () => {
373
+ if (!memoisedAccountInterface) {
374
+ memoisedAccountInterface = new graphql.GraphQLInterfaceType({
375
+ description: "A Solana account",
376
+ fields: () => ({
377
+ ...accountInterfaceFields(),
378
+ owner: type(accountInterface())
379
+ }),
380
+ name: "Account",
381
+ resolveType(account) {
382
+ if (account.encoding === "base58") {
383
+ return "AccountBase58";
384
+ }
385
+ if (account.encoding === "base64") {
386
+ return "AccountBase64";
387
+ }
388
+ if (account.encoding === "base64+zstd") {
389
+ return "AccountBase64Zstd";
390
+ }
391
+ if (account.encoding === "jsonParsed") {
392
+ if (account.data.parsed.type === "mint" && account.data.program === "spl-token") {
393
+ return "MintAccount";
394
+ }
395
+ if (account.data.parsed.type === "account" && account.data.program === "spl-token") {
396
+ return "TokenAccount";
397
+ }
398
+ if (account.data.program === "nonce") {
399
+ return "NonceAccount";
400
+ }
401
+ if (account.data.program === "stake") {
402
+ return "StakeAccount";
403
+ }
404
+ if (account.data.parsed.type === "vote" && account.data.program === "vote") {
405
+ return "VoteAccount";
406
+ }
407
+ if (account.data.parsed.type === "lookupTable" && account.data.program === "address-lookup-table") {
408
+ return "LookupTableAccount";
409
+ }
410
+ }
411
+ return "AccountBase64";
412
+ }
413
+ });
414
+ }
415
+ return memoisedAccountInterface;
416
+ };
417
+ var accountType = (name, description, data) => new graphql.GraphQLObjectType({
418
+ description,
419
+ fields: {
420
+ ...accountInterfaceFields(),
421
+ data,
422
+ // Nested Account interface
423
+ owner: {
424
+ args: {
425
+ commitment: type(commitmentInputType()),
426
+ dataSlice: type(dataSliceInputType()),
427
+ encoding: type(accountEncodingInputType()),
428
+ minContextSlot: bigint()
429
+ },
430
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.owner }, info),
431
+ type: accountInterface()
432
+ }
433
+ },
434
+ interfaces: [accountInterface()],
435
+ name
436
+ });
437
+ var accountDataJsonParsed = (name, parsedInfoFields) => object(name + "Data", {
438
+ parsed: object(name + "DataParsed", {
439
+ info: object(name + "DataParsedInfo", parsedInfoFields),
440
+ type: string()
441
+ }),
442
+ program: string(),
443
+ space: bigint()
444
+ });
445
+ var memoisedAccountBase58;
446
+ var accountBase58 = () => {
447
+ if (!memoisedAccountBase58)
448
+ memoisedAccountBase58 = accountType("AccountBase58", "A Solana account with base58 encoded data", string());
449
+ return memoisedAccountBase58;
450
+ };
451
+ var memoisedAccountBase64;
452
+ var accountBase64 = () => {
453
+ if (!memoisedAccountBase64)
454
+ memoisedAccountBase64 = accountType("AccountBase64", "A Solana account with base64 encoded data", string());
455
+ return memoisedAccountBase64;
456
+ };
457
+ var memoisedAccountBase64Zstd;
458
+ var accountBase64Zstd = () => {
459
+ if (!memoisedAccountBase64Zstd)
460
+ memoisedAccountBase64Zstd = accountType(
461
+ "AccountBase64Zstd",
462
+ "A Solana account with base64 encoded data compressed with zstd",
463
+ string()
464
+ );
465
+ return memoisedAccountBase64Zstd;
466
+ };
467
+ var memoisedAccountNonceAccount;
468
+ var accountNonceAccount = () => {
469
+ if (!memoisedAccountNonceAccount)
470
+ memoisedAccountNonceAccount = accountType(
471
+ "NonceAccount",
472
+ "A nonce account",
473
+ accountDataJsonParsed("Nonce", {
474
+ // Nested Account interface
475
+ authority: {
476
+ args: {
477
+ commitment: type(commitmentInputType()),
478
+ dataSlice: type(dataSliceInputType()),
479
+ encoding: type(accountEncodingInputType()),
480
+ minContextSlot: bigint()
481
+ },
482
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
483
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.authority }, info),
484
+ type: accountInterface()
485
+ },
486
+ blockhash: string(),
487
+ feeCalculator: object("NonceFeeCalculator", {
488
+ lamportsPerSignature: string()
489
+ })
490
+ })
491
+ );
492
+ return memoisedAccountNonceAccount;
493
+ };
494
+ var memoisedAccountLookupTable;
495
+ var accountLookupTable = () => {
496
+ if (!memoisedAccountLookupTable)
497
+ memoisedAccountLookupTable = accountType(
498
+ "LookupTableAccount",
499
+ "An address lookup table account",
500
+ accountDataJsonParsed("LookupTable", {
501
+ addresses: list(string()),
502
+ // Nested Account interface
503
+ authority: {
504
+ args: {
505
+ commitment: type(commitmentInputType()),
506
+ dataSlice: type(dataSliceInputType()),
507
+ encoding: type(accountEncodingInputType()),
508
+ minContextSlot: bigint()
509
+ },
510
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
511
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.authority }, info),
512
+ type: accountInterface()
513
+ },
514
+ deactivationSlot: string(),
515
+ lastExtendedSlot: string(),
516
+ lastExtendedSlotStartIndex: number()
517
+ })
518
+ );
519
+ return memoisedAccountLookupTable;
520
+ };
521
+ var memoisedAccountMint;
522
+ var accountMint = () => {
523
+ if (!memoisedAccountMint)
524
+ memoisedAccountMint = accountType(
525
+ "MintAccount",
526
+ "An SPL mint",
527
+ accountDataJsonParsed("Mint", {
528
+ decimals: number(),
529
+ freezeAuthority: string(),
530
+ isInitialized: boolean(),
531
+ // Nested Account interface
532
+ mintAuthority: {
533
+ args: {
534
+ commitment: type(commitmentInputType()),
535
+ dataSlice: type(dataSliceInputType()),
536
+ encoding: type(accountEncodingInputType()),
537
+ minContextSlot: bigint()
538
+ },
539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
540
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.mintAuthority }, info),
541
+ type: accountInterface()
542
+ },
543
+ supply: string()
544
+ })
545
+ );
546
+ return memoisedAccountMint;
547
+ };
548
+ var memoisedAccountTokenAccount;
549
+ var accountTokenAccount = () => {
550
+ if (!memoisedAccountTokenAccount)
551
+ memoisedAccountTokenAccount = accountType(
552
+ "TokenAccount",
553
+ "An SPL token account",
554
+ accountDataJsonParsed("TokenAccount", {
555
+ isNative: boolean(),
556
+ mint: string(),
557
+ // Nested Account interface
558
+ owner: {
559
+ args: {
560
+ commitment: type(commitmentInputType()),
561
+ dataSlice: type(dataSliceInputType()),
562
+ encoding: type(accountEncodingInputType()),
563
+ minContextSlot: bigint()
564
+ },
565
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
566
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.owner }, info),
567
+ type: accountInterface()
568
+ },
569
+ state: string(),
570
+ tokenAmount: type(tokenAmountType())
571
+ })
572
+ );
573
+ return memoisedAccountTokenAccount;
574
+ };
575
+ var memoisedAccountStakeAccount;
576
+ var accountStakeAccount = () => {
577
+ if (!memoisedAccountStakeAccount)
578
+ memoisedAccountStakeAccount = accountType(
579
+ "StakeAccount",
580
+ "A stake account",
581
+ accountDataJsonParsed("Stake", {
582
+ meta: object("StakeMeta", {
583
+ authorized: object("StakeMetaAuthorized", {
584
+ // Nested Account interface
585
+ staker: {
586
+ args: {
587
+ commitment: type(commitmentInputType()),
588
+ dataSlice: type(dataSliceInputType()),
589
+ encoding: type(accountEncodingInputType()),
590
+ minContextSlot: bigint()
591
+ },
592
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
593
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.staker }, info),
594
+ type: accountInterface()
595
+ },
596
+ // Nested Account interface
597
+ withdrawer: {
598
+ args: {
599
+ commitment: type(commitmentInputType()),
600
+ dataSlice: type(dataSliceInputType()),
601
+ encoding: type(accountEncodingInputType()),
602
+ minContextSlot: bigint()
603
+ },
604
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
605
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.withdrawer }, info),
606
+ type: accountInterface()
607
+ }
608
+ }),
609
+ lockup: object("StakeMetaLockup", {
610
+ // Nested Account interface
611
+ custodian: {
612
+ args: {
613
+ commitment: type(commitmentInputType()),
614
+ dataSlice: type(dataSliceInputType()),
615
+ encoding: type(accountEncodingInputType()),
616
+ minContextSlot: bigint()
617
+ },
618
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
619
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.custodian }, info),
620
+ type: accountInterface()
621
+ },
622
+ epoch: bigint(),
623
+ unixTimestamp: bigint()
624
+ }),
625
+ rentExemptReserve: string()
626
+ }),
627
+ stake: object("StakeStake", {
628
+ creditsObserved: bigint(),
629
+ delegation: object("StakeStakeDelegation", {
630
+ activationEpoch: bigint(),
631
+ deactivationEpoch: bigint(),
632
+ stake: string(),
633
+ // Nested Account interface
634
+ voter: {
635
+ args: {
636
+ commitment: type(commitmentInputType()),
637
+ dataSlice: type(dataSliceInputType()),
638
+ encoding: type(accountEncodingInputType()),
639
+ minContextSlot: bigint()
640
+ },
641
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
642
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.voter }, info),
643
+ type: accountInterface()
644
+ },
645
+ warmupCooldownRate: number()
646
+ })
647
+ })
648
+ })
649
+ );
650
+ return memoisedAccountStakeAccount;
651
+ };
652
+ var memoisedAccountVoteAccount;
653
+ var accountVoteAccount = () => {
654
+ if (!memoisedAccountVoteAccount)
655
+ memoisedAccountVoteAccount = accountType(
656
+ "VoteAccount",
657
+ "A vote account",
658
+ accountDataJsonParsed("Vote", {
659
+ authorizedVoters: list(
660
+ object("VoteAuthorizedVoter", {
661
+ // Nested Account interface
662
+ authorizedVoter: {
663
+ args: {
664
+ commitment: type(commitmentInputType()),
665
+ dataSlice: type(dataSliceInputType()),
666
+ encoding: type(accountEncodingInputType()),
667
+ minContextSlot: bigint()
668
+ },
669
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
670
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.authorizedVoter }, info),
671
+ type: accountInterface()
672
+ },
673
+ epoch: bigint()
674
+ })
675
+ ),
676
+ // Nested Account interface
677
+ authorizedWithdrawer: {
678
+ args: {
679
+ commitment: type(commitmentInputType()),
680
+ dataSlice: type(dataSliceInputType()),
681
+ encoding: type(accountEncodingInputType()),
682
+ minContextSlot: bigint()
683
+ },
684
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
685
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.authorizedWithdrawer }, info),
686
+ type: accountInterface()
687
+ },
688
+ commission: number(),
689
+ epochCredits: list(
690
+ object("VoteEpochCredits", {
691
+ credits: string(),
692
+ epoch: bigint(),
693
+ previousCredits: string()
694
+ })
695
+ ),
696
+ lastTimestamp: object("VoteLastTimestamp", {
697
+ slot: bigint(),
698
+ timestamp: bigint()
699
+ }),
700
+ // Nested Account interface
701
+ node: {
702
+ args: {
703
+ commitment: type(commitmentInputType()),
704
+ dataSlice: type(dataSliceInputType()),
705
+ encoding: type(accountEncodingInputType()),
706
+ minContextSlot: bigint()
707
+ },
708
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
709
+ resolve: (parent, args, context, info) => context.resolveAccount({ ...args, address: parent.nodePubkey }, info),
710
+ type: accountInterface()
711
+ },
712
+ priorVoters: list(string()),
713
+ rootSlot: bigint(),
714
+ votes: list(
715
+ object("VoteVote", {
716
+ confirmationCount: number(),
717
+ slot: bigint()
718
+ })
719
+ )
720
+ })
721
+ );
722
+ return memoisedAccountVoteAccount;
723
+ };
724
+ var memoisedAccountTypes;
725
+ var accountTypes = () => {
726
+ if (!memoisedAccountTypes)
727
+ memoisedAccountTypes = [
728
+ accountBase58(),
729
+ accountBase64(),
730
+ accountBase64Zstd(),
731
+ accountNonceAccount(),
732
+ accountLookupTable(),
733
+ accountMint(),
734
+ accountTokenAccount(),
735
+ accountStakeAccount(),
736
+ accountVoteAccount()
737
+ ];
738
+ return memoisedAccountTypes;
739
+ };
740
+
741
+ // src/schema/account/query.ts
742
+ var accountQuery = () => ({
743
+ account: {
744
+ args: {
745
+ address: nonNull(string()),
746
+ commitment: type(commitmentInputType()),
747
+ dataSlice: type(dataSliceInputType()),
748
+ encoding: type(accountEncodingInputType()),
749
+ minContextSlot: bigint()
750
+ },
751
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
752
+ resolve: (_parent, args, context, info) => context.resolveAccount(args, info),
753
+ type: accountInterface()
754
+ }
755
+ });
756
+ var memoisedTokenBalance;
757
+ var tokenBalance = () => {
758
+ if (!memoisedTokenBalance)
759
+ memoisedTokenBalance = new graphql.GraphQLObjectType({
760
+ fields: {
761
+ accountIndex: number(),
762
+ mint: string(),
763
+ owner: string(),
764
+ programId: string(),
765
+ uiAmountString: string()
766
+ },
767
+ name: "TokenBalance"
768
+ });
769
+ return memoisedTokenBalance;
770
+ };
771
+ var memoisedTransactionStatus;
772
+ var transactionStatus = () => {
773
+ if (!memoisedTransactionStatus)
774
+ memoisedTransactionStatus = new graphql.GraphQLUnionType({
775
+ name: "TransactionStatus",
776
+ types: [
777
+ new graphql.GraphQLObjectType({
778
+ fields: {
779
+ Err: string()
780
+ },
781
+ name: "TransactionStatusError"
782
+ }),
783
+ new graphql.GraphQLObjectType({
784
+ fields: {
785
+ Ok: string()
786
+ },
787
+ name: "TransactionStatusOk"
788
+ })
789
+ ]
790
+ });
791
+ return memoisedTransactionStatus;
792
+ };
793
+ var memoisedReward;
794
+ var reward = () => {
795
+ if (!memoisedReward)
796
+ memoisedReward = new graphql.GraphQLObjectType({
797
+ fields: {
798
+ commission: number(),
799
+ lamports: bigint(),
800
+ postBalance: bigint(),
801
+ pubkey: string(),
802
+ rewardType: string()
803
+ },
804
+ name: "Reward"
805
+ });
806
+ return memoisedReward;
807
+ };
808
+ var memoisedAddressTableLookup;
809
+ var addressTableLookup = () => {
810
+ if (!memoisedAddressTableLookup)
811
+ memoisedAddressTableLookup = new graphql.GraphQLObjectType({
812
+ fields: {
813
+ accountKey: string(),
814
+ readableIndexes: list(number()),
815
+ writableIndexes: list(number())
816
+ },
817
+ name: "AddressTableLookup"
818
+ });
819
+ return memoisedAddressTableLookup;
820
+ };
821
+ var memoisedReturnData;
822
+ var returnData = () => {
823
+ if (!memoisedReturnData)
824
+ memoisedReturnData = new graphql.GraphQLObjectType({
825
+ fields: {
826
+ data: string(),
827
+ programId: string()
828
+ },
829
+ name: "ReturnData"
830
+ });
831
+ return memoisedReturnData;
832
+ };
833
+ var memoisedTransactionInstruction;
834
+ var transactionInstruction = () => {
835
+ if (!memoisedTransactionInstruction)
836
+ memoisedTransactionInstruction = new graphql.GraphQLObjectType({
837
+ fields: {
838
+ accounts: list(number()),
839
+ data: string(),
840
+ programIdIndex: number()
841
+ },
842
+ name: "TransactionInstruction"
843
+ });
844
+ return memoisedTransactionInstruction;
845
+ };
846
+ var memoisedTransactionMetaLoadedAddresses;
847
+ var transactionMetaLoadedAddresses = () => {
848
+ if (!memoisedTransactionMetaLoadedAddresses)
849
+ memoisedTransactionMetaLoadedAddresses = new graphql.GraphQLObjectType({
850
+ fields: {
851
+ readonly: list(string()),
852
+ // Base58 encoded addresses
853
+ writable: list(string())
854
+ // Base58 encoded addresses
855
+ },
856
+ name: "TransactionMetaLoadedAddresses"
857
+ });
858
+ return memoisedTransactionMetaLoadedAddresses;
859
+ };
860
+ var memoisedParsedTransactionInstructionInterface;
861
+ var parsedTransactionInstructionInterface = () => {
862
+ if (!memoisedParsedTransactionInstructionInterface)
863
+ memoisedParsedTransactionInstructionInterface = new graphql.GraphQLInterfaceType({
864
+ fields: {
865
+ programId: string()
866
+ },
867
+ name: "ParsedTransactionInstruction",
868
+ resolveType(instruction) {
869
+ if (instruction.program === "address-lookup-table") {
870
+ if (instruction.info.type === "createLookupTable") {
871
+ return "CreateLookupTableInstruction";
872
+ }
873
+ if (instruction.info.type === "freezeLookupTable") {
874
+ return "FreezeLookupTableInstruction";
875
+ }
876
+ if (instruction.info.type === "extendLookupTable") {
877
+ return "ExtendLookupTableInstruction";
878
+ }
879
+ if (instruction.info.type === "deactivateLookupTable") {
880
+ return "DeactivateLookupTableInstruction";
881
+ }
882
+ if (instruction.info.type === "closeLookupTable") {
883
+ return "CloseLookupTableInstruction";
884
+ }
885
+ }
886
+ if (instruction.program === "bpf-loader") {
887
+ if (instruction.info.type === "write") {
888
+ return "BpfLoaderWriteInstruction";
889
+ }
890
+ if (instruction.info.type === "finalize") {
891
+ return "BpfLoaderFinalizeInstruction";
892
+ }
893
+ }
894
+ if (instruction.program === "bpf-upgradeable-loader") {
895
+ if (instruction.info.type === "initializeBuffer") {
896
+ return "BpfUpgradeableLoaderInitializeBufferInstruction";
897
+ }
898
+ if (instruction.info.type === "write") {
899
+ return "BpfUpgradeableLoaderWriteInstruction";
900
+ }
901
+ if (instruction.info.type === "deployWithMaxDataLen") {
902
+ return "BpfUpgradeableLoaderDeployWithMaxDataLenInstruction";
903
+ }
904
+ if (instruction.info.type === "upgrade") {
905
+ return "BpfUpgradeableLoaderUpgradeInstruction";
906
+ }
907
+ if (instruction.info.type === "setAuthority") {
908
+ return "BpfUpgradeableLoaderSetAuthorityInstruction";
909
+ }
910
+ if (instruction.info.type === "setAuthorityChecked") {
911
+ return "BpfUpgradeableLoaderSetAuthorityCheckedInstruction";
912
+ }
913
+ if (instruction.info.type === "close") {
914
+ return "BpfUpgradeableLoaderCloseInstruction";
915
+ }
916
+ if (instruction.info.type === "extendProgram") {
917
+ return "BpfUpgradeableLoaderExtendProgramInstruction";
918
+ }
919
+ }
920
+ if (instruction.program === "spl-associated-token-account") {
921
+ if (instruction.info.type === "create") {
922
+ return "SplAssociatedTokenCreateInstruction";
923
+ }
924
+ if (instruction.info.type === "createIdempotent") {
925
+ return "SplAssociatedTokenCreateIdempotentInstruction";
926
+ }
927
+ if (instruction.info.type === "recoverNested") {
928
+ return "SplAssociatedTokenRecoverNestedInstruction";
929
+ }
930
+ }
931
+ if (instruction.program === "spl-memo") {
932
+ return "SplMemoInstruction";
933
+ }
934
+ if (instruction.program === "spl-token") {
935
+ if (instruction.info.type === "initializeMint") {
936
+ return "SplTokenInitializeMintInstruction";
937
+ }
938
+ if (instruction.info.type === "initializeMint2") {
939
+ return "SplTokenInitializeMint2Instruction";
940
+ }
941
+ if (instruction.info.type === "initializeAccount") {
942
+ return "SplTokenInitializeAccountInstruction";
943
+ }
944
+ if (instruction.info.type === "initializeAccount2") {
945
+ return "SplTokenInitializeAccount2Instruction";
946
+ }
947
+ if (instruction.info.type === "initializeAccount3") {
948
+ return "SplTokenInitializeAccount3Instruction";
949
+ }
950
+ if (instruction.info.type === "initializeMultisig") {
951
+ return "SplTokenInitializeMultisigInstruction";
952
+ }
953
+ if (instruction.info.type === "initializeMultisig2") {
954
+ return "SplTokenInitializeMultisig2Instruction";
955
+ }
956
+ if (instruction.info.type === "transfer") {
957
+ return "SplTokenTransferInstruction";
958
+ }
959
+ if (instruction.info.type === "approve") {
960
+ return "SplTokenApproveInstruction";
961
+ }
962
+ if (instruction.info.type === "revoke") {
963
+ return "SplTokenRevokeInstruction";
964
+ }
965
+ if (instruction.info.type === "setAuthority") {
966
+ return "SplTokenSetAuthorityInstruction";
967
+ }
968
+ if (instruction.info.type === "mintTo") {
969
+ return "SplTokenMintToInstruction";
970
+ }
971
+ if (instruction.info.type === "burn") {
972
+ return "SplTokenBurnInstruction";
973
+ }
974
+ if (instruction.info.type === "closeAccount") {
975
+ return "SplTokenCloseAccountInstruction";
976
+ }
977
+ if (instruction.info.type === "freezeAccount") {
978
+ return "SplTokenFreezeAccountInstruction";
979
+ }
980
+ if (instruction.info.type === "thawAccount") {
981
+ return "SplTokenThawAccountInstruction";
982
+ }
983
+ if (instruction.info.type === "transferChecked") {
984
+ return "SplTokenTransferCheckedInstruction";
985
+ }
986
+ if (instruction.info.type === "approveChecked") {
987
+ return "SplTokenApproveCheckedInstruction";
988
+ }
989
+ if (instruction.info.type === "mintToChecked") {
990
+ return "SplTokenMintToCheckedInstruction";
991
+ }
992
+ if (instruction.info.type === "burnChecked") {
993
+ return "SplTokenBurnCheckedInstruction";
994
+ }
995
+ if (instruction.info.type === "syncNative") {
996
+ return "SplTokenSyncNativeInstruction";
997
+ }
998
+ if (instruction.info.type === "getAccountDataSize") {
999
+ return "SplTokenGetAccountDataSizeInstruction";
1000
+ }
1001
+ if (instruction.info.type === "initializeImmutableOwner") {
1002
+ return "SplTokenInitializeImmutableOwnerInstruction";
1003
+ }
1004
+ if (instruction.info.type === "amountToUiAmount") {
1005
+ return "SplTokenAmountToUiAmountInstruction";
1006
+ }
1007
+ if (instruction.info.type === "uiAmountToAmount") {
1008
+ return "SplTokenUiAmountToAmountInstruction";
1009
+ }
1010
+ if (instruction.info.type === "initializeMintCloseAuthority") {
1011
+ return "SplTokenInitializeMintCloseAuthorityInstruction";
1012
+ }
1013
+ }
1014
+ if (instruction.program === "stake") {
1015
+ if (instruction.info.type === "initialize") {
1016
+ return "StakeInitializeInstruction";
1017
+ }
1018
+ if (instruction.info.type === "authorize") {
1019
+ return "StakeAuthorizeInstruction";
1020
+ }
1021
+ if (instruction.info.type === "delegate") {
1022
+ return "StakeDelegateStakeInstruction";
1023
+ }
1024
+ if (instruction.info.type === "split") {
1025
+ return "StakeSplitInstruction";
1026
+ }
1027
+ if (instruction.info.type === "withdraw") {
1028
+ return "StakeWithdrawInstruction";
1029
+ }
1030
+ if (instruction.info.type === "deactivate") {
1031
+ return "StakeDeactivateInstruction";
1032
+ }
1033
+ if (instruction.info.type === "setLockup") {
1034
+ return "StakeSetLockupInstruction";
1035
+ }
1036
+ if (instruction.info.type === "merge") {
1037
+ return "StakeMergeInstruction";
1038
+ }
1039
+ if (instruction.info.type === "authorizeWithSeed") {
1040
+ return "StakeAuthorizeWithSeedInstruction";
1041
+ }
1042
+ if (instruction.info.type === "initializeChecked") {
1043
+ return "StakeInitializeCheckedInstruction";
1044
+ }
1045
+ if (instruction.info.type === "authorizeChecked") {
1046
+ return "StakeAuthorizeCheckedInstruction";
1047
+ }
1048
+ if (instruction.info.type === "authorizeCheckedWithSeed") {
1049
+ return "StakeAuthorizeCheckedWithSeedInstruction";
1050
+ }
1051
+ if (instruction.info.type === "setLockupChecked") {
1052
+ return "StakeSetLockupCheckedInstruction";
1053
+ }
1054
+ if (instruction.info.type === "deactivateDelinquent") {
1055
+ return "StakeDeactivateDelinquentInstruction";
1056
+ }
1057
+ if (instruction.info.type === "redelegate") {
1058
+ return "StakeRedelegateInstruction";
1059
+ }
1060
+ }
1061
+ if (instruction.program === "system") {
1062
+ if (instruction.info.type === "createAccount") {
1063
+ return "CreateAccountInstruction";
1064
+ }
1065
+ if (instruction.info.type === "assign") {
1066
+ return "AssignInstruction";
1067
+ }
1068
+ if (instruction.info.type === "transfer") {
1069
+ return "TransferInstruction";
1070
+ }
1071
+ if (instruction.info.type === "createAccountWithSeed") {
1072
+ return "CreateAccountWithSeedInstruction";
1073
+ }
1074
+ if (instruction.info.type === "advanceNonceAccount") {
1075
+ return "AdvanceNonceAccountInstruction";
1076
+ }
1077
+ if (instruction.info.type === "withdrawNonceAccount") {
1078
+ return "WithdrawNonceAccountInstruction";
1079
+ }
1080
+ if (instruction.info.type === "initializeNonceAccount") {
1081
+ return "InitializeNonceAccountInstruction";
1082
+ }
1083
+ if (instruction.info.type === "authorizeNonceAccount") {
1084
+ return "AuthorizeNonceAccountInstruction";
1085
+ }
1086
+ if (instruction.info.type === "upgradeNonceAccount") {
1087
+ return "UpgradeNonceAccountInstruction";
1088
+ }
1089
+ if (instruction.info.type === "allocate") {
1090
+ return "AllocateInstruction";
1091
+ }
1092
+ if (instruction.info.type === "allocateWithSeed") {
1093
+ return "AllocateWithSeedInstruction";
1094
+ }
1095
+ if (instruction.info.type === "assignWithSeed") {
1096
+ return "AssignWithSeedInstruction";
1097
+ }
1098
+ if (instruction.info.type === "transferWithSeed") {
1099
+ return "TransferWithSeedInstruction";
1100
+ }
1101
+ }
1102
+ if (instruction.program === "vote") {
1103
+ if (instruction.info.type === "initialize") {
1104
+ return "VoteInitializeAccountInstruction";
1105
+ }
1106
+ if (instruction.info.type === "authorize") {
1107
+ return "VoteAuthorizeInstruction";
1108
+ }
1109
+ if (instruction.info.type === "authorizeWithSeed") {
1110
+ return "VoteAuthorizeWithSeedInstruction";
1111
+ }
1112
+ if (instruction.info.type === "authorizeCheckedWithSeed") {
1113
+ return "VoteAuthorizeCheckedWithSeedInstruction";
1114
+ }
1115
+ if (instruction.info.type === "vote") {
1116
+ return "VoteVoteInstruction";
1117
+ }
1118
+ if (instruction.info.type === "updatevotestate") {
1119
+ return "VoteUpdateVoteStateInstruction";
1120
+ }
1121
+ if (instruction.info.type === "updatevotestateswitch") {
1122
+ return "VoteUpdateVoteStateSwitchInstruction";
1123
+ }
1124
+ if (instruction.info.type === "compactupdatevotestate") {
1125
+ return "VoteCompactUpdateVoteStateInstruction";
1126
+ }
1127
+ if (instruction.info.type === "compactupdatevotestateswitch") {
1128
+ return "VoteCompactUpdateVoteStateSwitchInstruction";
1129
+ }
1130
+ if (instruction.info.type === "withdraw") {
1131
+ return "VoteWithdrawInstruction";
1132
+ }
1133
+ if (instruction.info.type === "updateValidatorIdentity") {
1134
+ return "VoteUpdateValidatorIdentityInstruction";
1135
+ }
1136
+ if (instruction.info.type === "updateCommission") {
1137
+ return "VoteUpdateCommissionInstruction";
1138
+ }
1139
+ if (instruction.info.type === "voteSwitch") {
1140
+ return "VoteVoteSwitchInstruction";
1141
+ }
1142
+ if (instruction.info.type === "authorizeChecked") {
1143
+ return "VoteAuthorizeCheckedInstruction";
1144
+ }
1145
+ }
1146
+ return "PartiallyDecodedInstruction";
1147
+ }
1148
+ });
1149
+ return memoisedParsedTransactionInstructionInterface;
1150
+ };
1151
+ var parsedTransactionInstructionType = (name, parsedInfoFields) => new graphql.GraphQLObjectType({
1152
+ fields: {
1153
+ parsed: object(name + "Parsed", {
1154
+ info: object(name + "ParsedInfo", parsedInfoFields),
1155
+ type: string()
1156
+ }),
1157
+ program: string(),
1158
+ programId: string()
1159
+ },
1160
+ interfaces: [parsedTransactionInstructionInterface()],
1161
+ name
1162
+ });
1163
+ var memoisedPartiallyDecodedTransactionInstruction;
1164
+ var partiallyDecodedTransactionInstruction = () => {
1165
+ if (!memoisedPartiallyDecodedTransactionInstruction)
1166
+ memoisedPartiallyDecodedTransactionInstruction = new graphql.GraphQLObjectType({
1167
+ fields: {
1168
+ accounts: list(string()),
1169
+ data: string(),
1170
+ programId: string()
1171
+ },
1172
+ interfaces: [parsedTransactionInstructionInterface()],
1173
+ name: "PartiallyDecodedInstruction"
1174
+ });
1175
+ return memoisedPartiallyDecodedTransactionInstruction;
1176
+ };
1177
+ var memoisedParsedInstructionsAddressLookupTable;
1178
+ var parsedInstructionsAddressLookupTable = () => {
1179
+ if (!memoisedParsedInstructionsAddressLookupTable)
1180
+ memoisedParsedInstructionsAddressLookupTable = [
1181
+ parsedTransactionInstructionType("CreateLookupTableInstruction", {
1182
+ bumpSeed: number(),
1183
+ lookupTableAccount: string(),
1184
+ lookupTableAuthority: string(),
1185
+ payerAccount: string(),
1186
+ recentSlot: bigint(),
1187
+ systemProgram: string()
1188
+ }),
1189
+ parsedTransactionInstructionType("FreezeLookupTableInstruction", {
1190
+ lookupTableAccount: string(),
1191
+ lookupTableAuthority: string()
1192
+ }),
1193
+ parsedTransactionInstructionType("ExtendLookupTableInstruction", {
1194
+ lookupTableAccount: string(),
1195
+ lookupTableAuthority: string(),
1196
+ newAddresses: list(string()),
1197
+ payerAccount: string(),
1198
+ systemProgram: string()
1199
+ }),
1200
+ parsedTransactionInstructionType("DeactivateLookupTableInstruction", {
1201
+ lookupTableAccount: string(),
1202
+ lookupTableAuthority: string()
1203
+ }),
1204
+ parsedTransactionInstructionType("CloseLookupTableInstruction", {
1205
+ lookupTableAccount: string(),
1206
+ lookupTableAuthority: string(),
1207
+ recipient: string()
1208
+ })
1209
+ ];
1210
+ return memoisedParsedInstructionsAddressLookupTable;
1211
+ };
1212
+ var memoisedParsedInstructionsBpfLoader;
1213
+ var parsedInstructionsBpfLoader = () => {
1214
+ if (!memoisedParsedInstructionsBpfLoader)
1215
+ memoisedParsedInstructionsBpfLoader = [
1216
+ parsedTransactionInstructionType("BpfLoaderWriteInstruction", {
1217
+ account: string(),
1218
+ bytes: string(),
1219
+ offset: number()
1220
+ }),
1221
+ parsedTransactionInstructionType("BpfLoaderFinalizeInstruction", {
1222
+ account: string()
1223
+ })
1224
+ ];
1225
+ return memoisedParsedInstructionsBpfLoader;
1226
+ };
1227
+ var memoisedParsedInstructionsBpfUpgradeableLoader;
1228
+ var parsedInstructionsBpfUpgradeableLoader = () => {
1229
+ if (!memoisedParsedInstructionsBpfUpgradeableLoader)
1230
+ memoisedParsedInstructionsBpfUpgradeableLoader = [
1231
+ parsedTransactionInstructionType("BpfUpgradeableLoaderInitializeBufferInstruction", {
1232
+ account: string()
1233
+ }),
1234
+ parsedTransactionInstructionType("BpfUpgradeableLoaderWriteInstruction", {
1235
+ account: string(),
1236
+ authority: string(),
1237
+ bytes: string(),
1238
+ offset: number()
1239
+ }),
1240
+ parsedTransactionInstructionType("BpfUpgradeableLoaderDeployWithMaxDataLenInstruction", {
1241
+ authority: string(),
1242
+ bufferAccount: string(),
1243
+ clockSysvar: string(),
1244
+ maxDataLen: bigint(),
1245
+ payerAccount: string(),
1246
+ programAccount: string(),
1247
+ programDataAccount: string(),
1248
+ rentSysvar: string()
1249
+ }),
1250
+ parsedTransactionInstructionType("BpfUpgradeableLoaderUpgradeInstruction", {
1251
+ authority: string(),
1252
+ bufferAccount: string(),
1253
+ clockSysvar: string(),
1254
+ programAccount: string(),
1255
+ programDataAccount: string(),
1256
+ rentSysvar: string(),
1257
+ spillAccount: string()
1258
+ }),
1259
+ parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityInstruction", {
1260
+ account: string(),
1261
+ authority: string(),
1262
+ newAuthority: string()
1263
+ }),
1264
+ parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityCheckedInstruction", {
1265
+ account: string(),
1266
+ authority: string(),
1267
+ newAuthority: string()
1268
+ }),
1269
+ parsedTransactionInstructionType("BpfUpgradeableLoaderCloseInstruction", {
1270
+ account: string(),
1271
+ authority: string(),
1272
+ programAccount: string(),
1273
+ recipient: string()
1274
+ }),
1275
+ parsedTransactionInstructionType("BpfUpgradeableLoaderExtendProgramInstruction", {
1276
+ additionalBytes: bigint(),
1277
+ payerAccount: string(),
1278
+ programAccount: string(),
1279
+ programDataAccount: string(),
1280
+ systemProgram: string()
1281
+ })
1282
+ ];
1283
+ return memoisedParsedInstructionsBpfUpgradeableLoader;
1284
+ };
1285
+ var memoisedParsedInstructionsSplAssociatedToken;
1286
+ var parsedInstructionsSplAssociatedToken = () => {
1287
+ if (!memoisedParsedInstructionsSplAssociatedToken)
1288
+ memoisedParsedInstructionsSplAssociatedToken = [
1289
+ parsedTransactionInstructionType("SplAssociatedTokenCreateInstruction", {
1290
+ account: string(),
1291
+ mint: string(),
1292
+ source: string(),
1293
+ systemProgram: string(),
1294
+ tokenProgram: string(),
1295
+ wallet: string()
1296
+ }),
1297
+ parsedTransactionInstructionType("SplAssociatedTokenCreateIdempotentInstruction", {
1298
+ account: string(),
1299
+ mint: string(),
1300
+ source: string(),
1301
+ systemProgram: string(),
1302
+ tokenProgram: string(),
1303
+ wallet: string()
1304
+ }),
1305
+ parsedTransactionInstructionType("SplAssociatedTokenRecoverNestedInstruction", {
1306
+ destination: string(),
1307
+ nestedMint: string(),
1308
+ nestedOwner: string(),
1309
+ nestedSource: string(),
1310
+ ownerMint: string(),
1311
+ tokenProgram: string(),
1312
+ wallet: string()
1313
+ })
1314
+ ];
1315
+ return memoisedParsedInstructionsSplAssociatedToken;
1316
+ };
1317
+ var memoisedParsedInstructionSplMemo;
1318
+ var parsedInstructionSplMemo = () => {
1319
+ if (!memoisedParsedInstructionSplMemo)
1320
+ memoisedParsedInstructionSplMemo = new graphql.GraphQLObjectType({
1321
+ fields: {
1322
+ parsed: string(),
1323
+ program: string(),
1324
+ programId: string()
1325
+ },
1326
+ interfaces: [parsedTransactionInstructionInterface()],
1327
+ name: "SplMemoInstruction"
1328
+ });
1329
+ return memoisedParsedInstructionSplMemo;
1330
+ };
1331
+ var memoisedParsedInstructionsSplToken;
1332
+ var parsedInstructionsSplToken = () => {
1333
+ if (!memoisedParsedInstructionsSplToken)
1334
+ memoisedParsedInstructionsSplToken = [
1335
+ parsedTransactionInstructionType("SplTokenInitializeMintInstruction", {
1336
+ decimals: number(),
1337
+ freezeAuthority: string(),
1338
+ mint: string(),
1339
+ mintAuthority: string(),
1340
+ rentSysvar: string()
1341
+ }),
1342
+ parsedTransactionInstructionType("SplTokenInitializeMint2Instruction", {
1343
+ decimals: number(),
1344
+ freezeAuthority: string(),
1345
+ mint: string(),
1346
+ mintAuthority: string()
1347
+ }),
1348
+ parsedTransactionInstructionType("SplTokenInitializeAccountInstruction", {
1349
+ account: string(),
1350
+ mint: string(),
1351
+ owner: string(),
1352
+ rentSysvar: string()
1353
+ }),
1354
+ parsedTransactionInstructionType("SplTokenInitializeAccount2Instruction", {
1355
+ account: string(),
1356
+ mint: string(),
1357
+ owner: string(),
1358
+ rentSysvar: string()
1359
+ }),
1360
+ parsedTransactionInstructionType("SplTokenInitializeAccount3Instruction", {
1361
+ account: string(),
1362
+ mint: string(),
1363
+ owner: string()
1364
+ }),
1365
+ parsedTransactionInstructionType("SplTokenInitializeMultisigInstruction", {
1366
+ m: number(),
1367
+ multisig: string(),
1368
+ rentSysvar: string(),
1369
+ signers: list(string())
1370
+ }),
1371
+ parsedTransactionInstructionType("SplTokenInitializeMultisig2Instruction", {
1372
+ m: number(),
1373
+ multisig: string(),
1374
+ signers: list(string())
1375
+ }),
1376
+ parsedTransactionInstructionType("SplTokenTransferInstruction", {
1377
+ amount: string(),
1378
+ authority: string(),
1379
+ destination: string(),
1380
+ multisigAuthority: string(),
1381
+ source: string()
1382
+ }),
1383
+ parsedTransactionInstructionType("SplTokenApproveInstruction", {
1384
+ amount: string(),
1385
+ delegate: string(),
1386
+ multisigOwner: string(),
1387
+ owner: string(),
1388
+ source: string()
1389
+ }),
1390
+ parsedTransactionInstructionType("SplTokenRevokeInstruction", {
1391
+ multisigOwner: string(),
1392
+ owner: string(),
1393
+ source: string()
1394
+ }),
1395
+ parsedTransactionInstructionType("SplTokenSetAuthorityInstruction", {
1396
+ authority: string(),
1397
+ authorityType: string(),
1398
+ multisigAuthority: string(),
1399
+ newAuthority: string()
1400
+ }),
1401
+ parsedTransactionInstructionType("SplTokenMintToInstruction", {
1402
+ account: string(),
1403
+ amount: string(),
1404
+ authority: string(),
1405
+ mint: string(),
1406
+ mintAuthority: string(),
1407
+ multisigMintAuthority: string()
1408
+ }),
1409
+ parsedTransactionInstructionType("SplTokenBurnInstruction", {
1410
+ account: string(),
1411
+ amount: string(),
1412
+ authority: string(),
1413
+ mint: string(),
1414
+ multisigAuthority: string()
1415
+ }),
1416
+ parsedTransactionInstructionType("SplTokenCloseAccountInstruction", {
1417
+ account: string(),
1418
+ destination: string(),
1419
+ multisigOwner: string(),
1420
+ owner: string()
1421
+ }),
1422
+ parsedTransactionInstructionType("SplTokenFreezeAccountInstruction", {
1423
+ account: string(),
1424
+ freezeAuthority: string(),
1425
+ mint: string(),
1426
+ multisigFreezeAuthority: string()
1427
+ }),
1428
+ parsedTransactionInstructionType("SplTokenThawAccountInstruction", {
1429
+ account: string(),
1430
+ freezeAuthority: string(),
1431
+ mint: string(),
1432
+ multisigFreezeAuthority: string()
1433
+ }),
1434
+ parsedTransactionInstructionType("SplTokenTransferCheckedInstruction", {
1435
+ authority: string(),
1436
+ destination: string(),
1437
+ mint: string(),
1438
+ multisigAuthority: string(),
1439
+ source: string(),
1440
+ tokenAmount: string()
1441
+ }),
1442
+ parsedTransactionInstructionType("SplTokenApproveCheckedInstruction", {
1443
+ delegate: string(),
1444
+ mint: string(),
1445
+ multisigOwner: string(),
1446
+ owner: string(),
1447
+ source: string(),
1448
+ tokenAmount: string()
1449
+ }),
1450
+ parsedTransactionInstructionType("SplTokenMintToCheckedInstruction", {
1451
+ account: string(),
1452
+ authority: string(),
1453
+ mint: string(),
1454
+ mintAuthority: string(),
1455
+ multisigMintAuthority: string(),
1456
+ tokenAmount: string()
1457
+ }),
1458
+ parsedTransactionInstructionType("SplTokenBurnCheckedInstruction", {
1459
+ account: string(),
1460
+ authority: string(),
1461
+ mint: string(),
1462
+ multisigAuthority: string(),
1463
+ tokenAmount: string()
1464
+ }),
1465
+ parsedTransactionInstructionType("SplTokenSyncNativeInstruction", {
1466
+ account: string()
1467
+ }),
1468
+ parsedTransactionInstructionType("SplTokenGetAccountDataSizeInstruction", {
1469
+ extensionTypes: list(string()),
1470
+ mint: string()
1471
+ }),
1472
+ parsedTransactionInstructionType("SplTokenInitializeImmutableOwnerInstruction", {
1473
+ account: string()
1474
+ }),
1475
+ parsedTransactionInstructionType("SplTokenAmountToUiAmountInstruction", {
1476
+ amount: string(),
1477
+ mint: string()
1478
+ }),
1479
+ parsedTransactionInstructionType("SplTokenUiAmountToAmountInstruction", {
1480
+ mint: string(),
1481
+ uiAmount: string()
1482
+ }),
1483
+ parsedTransactionInstructionType("SplTokenInitializeMintCloseAuthorityInstruction", {
1484
+ mint: string(),
1485
+ newAuthority: string()
1486
+ })
1487
+ // TODO: Extensions!
1488
+ // - TransferFeeExtension
1489
+ // - ConfidentialTransferFeeExtension
1490
+ // - DefaultAccountStateExtension
1491
+ // - Reallocate
1492
+ // - MemoTransferExtension
1493
+ // - CreateNativeMint
1494
+ // - InitializeNonTransferableMint
1495
+ // - InterestBearingMintExtension
1496
+ // - CpiGuardExtension
1497
+ // - InitializePermanentDelegate
1498
+ // - TransferHookExtension
1499
+ // - ConfidentialTransferFeeExtension
1500
+ // - WithdrawExcessLamports
1501
+ // - MetadataPointerExtension
1502
+ ];
1503
+ return memoisedParsedInstructionsSplToken;
1504
+ };
1505
+ var memoisedLockup;
1506
+ var lockup = () => {
1507
+ if (!memoisedLockup)
1508
+ memoisedLockup = new graphql.GraphQLObjectType({
1509
+ fields: {
1510
+ custodian: string(),
1511
+ epoch: bigint(),
1512
+ unixTimestamp: bigint()
1513
+ },
1514
+ name: "Lockup"
1515
+ });
1516
+ return memoisedLockup;
1517
+ };
1518
+ var memoisedParsedInstructionsStake;
1519
+ var parsedInstructionsStake = () => {
1520
+ if (!memoisedParsedInstructionsStake)
1521
+ memoisedParsedInstructionsStake = [
1522
+ parsedTransactionInstructionType("StakeInitializeInstruction", {
1523
+ authorized: object("StakeInitializeInstructionAuthorized", {
1524
+ staker: string(),
1525
+ withdrawer: string()
1526
+ }),
1527
+ lockup: object("StakeInitializeInstructionLockup", {
1528
+ custodian: string(),
1529
+ epoch: bigint(),
1530
+ unixTimestamp: bigint()
1531
+ }),
1532
+ rentSysvar: string(),
1533
+ stakeAccount: string()
1534
+ }),
1535
+ parsedTransactionInstructionType("StakeAuthorizeInstruction", {
1536
+ authority: string(),
1537
+ authorityType: string(),
1538
+ clockSysvar: string(),
1539
+ custodian: string(),
1540
+ newAuthority: string(),
1541
+ stakeAccount: string()
1542
+ }),
1543
+ parsedTransactionInstructionType("StakeDelegateStakeInstruction", {
1544
+ clockSysvar: string(),
1545
+ stakeAccount: string(),
1546
+ stakeAuthority: string(),
1547
+ stakeConfigAccount: string(),
1548
+ stakeHistorySysvar: string(),
1549
+ voteAccount: string()
1550
+ }),
1551
+ parsedTransactionInstructionType("StakeSplitInstruction", {
1552
+ lamports: bigint(),
1553
+ newSplitAccount: string(),
1554
+ stakeAccount: string(),
1555
+ stakeAuthority: string()
1556
+ }),
1557
+ parsedTransactionInstructionType("StakeWithdrawInstruction", {
1558
+ clockSysvar: string(),
1559
+ destination: string(),
1560
+ lamports: bigint(),
1561
+ stakeAccount: string(),
1562
+ withdrawAuthority: string()
1563
+ }),
1564
+ parsedTransactionInstructionType("StakeDeactivateInstruction", {
1565
+ clockSysvar: string(),
1566
+ stakeAccount: string(),
1567
+ stakeAuthority: string()
1568
+ }),
1569
+ parsedTransactionInstructionType("StakeSetLockupInstruction", {
1570
+ custodian: string(),
1571
+ lockup: type(lockup()),
1572
+ stakeAccount: string()
1573
+ }),
1574
+ parsedTransactionInstructionType("StakeMergeInstruction", {
1575
+ clockSysvar: string(),
1576
+ destination: string(),
1577
+ source: string(),
1578
+ stakeAuthority: string(),
1579
+ stakeHistorySysvar: string()
1580
+ }),
1581
+ parsedTransactionInstructionType("StakeAuthorizeWithSeedInstruction", {
1582
+ authorityBase: string(),
1583
+ authorityOwner: string(),
1584
+ authoritySeed: string(),
1585
+ authorityType: string(),
1586
+ clockSysvar: string(),
1587
+ custodian: string(),
1588
+ newAuthorized: string(),
1589
+ stakeAccount: string()
1590
+ }),
1591
+ parsedTransactionInstructionType("StakeInitializeCheckedInstruction", {
1592
+ rentSysvar: string(),
1593
+ stakeAccount: string(),
1594
+ staker: string(),
1595
+ withdrawer: string()
1596
+ }),
1597
+ parsedTransactionInstructionType("StakeAuthorizeCheckedInstruction", {
1598
+ authority: string(),
1599
+ authorityType: string(),
1600
+ clockSysvar: string(),
1601
+ custodian: string(),
1602
+ newAuthority: string(),
1603
+ stakeAccount: string()
1604
+ }),
1605
+ parsedTransactionInstructionType("StakeAuthorizeCheckedWithSeedInstruction", {
1606
+ authorityBase: string(),
1607
+ authorityOwner: string(),
1608
+ authoritySeed: string(),
1609
+ authorityType: string(),
1610
+ clockSysvar: string(),
1611
+ custodian: string(),
1612
+ newAuthorized: string(),
1613
+ stakeAccount: string()
1614
+ }),
1615
+ parsedTransactionInstructionType("StakeSetLockupCheckedInstruction", {
1616
+ custodian: string(),
1617
+ lockup: type(lockup()),
1618
+ stakeAccount: string()
1619
+ }),
1620
+ parsedTransactionInstructionType("StakeDeactivateDelinquentInstruction", {
1621
+ referenceVoteAccount: string(),
1622
+ stakeAccount: string(),
1623
+ voteAccount: string()
1624
+ }),
1625
+ parsedTransactionInstructionType("StakeRedelegateInstruction", {
1626
+ newStakeAccount: string(),
1627
+ stakeAccount: string(),
1628
+ stakeAuthority: string(),
1629
+ stakeConfigAccount: string(),
1630
+ voteAccount: string()
1631
+ })
1632
+ ];
1633
+ return memoisedParsedInstructionsStake;
1634
+ };
1635
+ var memoisedParsedInstructionsSystem;
1636
+ var parsedInstructionsSystem = () => {
1637
+ if (!memoisedParsedInstructionsSystem)
1638
+ memoisedParsedInstructionsSystem = [
1639
+ parsedTransactionInstructionType("CreateAccountInstruction", {
1640
+ lamports: bigint(),
1641
+ newAccount: string(),
1642
+ owner: string(),
1643
+ source: string(),
1644
+ space: bigint()
1645
+ }),
1646
+ parsedTransactionInstructionType("AssignInstruction", {
1647
+ owner: string()
1648
+ }),
1649
+ parsedTransactionInstructionType("TransferInstruction", {
1650
+ amount: string(),
1651
+ lamports: number(),
1652
+ source: string()
1653
+ }),
1654
+ parsedTransactionInstructionType("CreateAccountWithSeedInstruction", {
1655
+ base: string(),
1656
+ lamports: bigint(),
1657
+ owner: string(),
1658
+ seed: string(),
1659
+ space: bigint()
1660
+ }),
1661
+ parsedTransactionInstructionType("AdvanceNonceAccountInstruction", {
1662
+ nonceAccount: string(),
1663
+ nonceAuthority: string(),
1664
+ recentBlockhashesSysvar: string()
1665
+ }),
1666
+ parsedTransactionInstructionType("WithdrawNonceAccountInstruction", {
1667
+ destination: string(),
1668
+ lamports: bigint(),
1669
+ nonceAccount: string(),
1670
+ nonceAuthority: string(),
1671
+ recentBlockhashesSysvar: string(),
1672
+ rentSysvar: string()
1673
+ }),
1674
+ parsedTransactionInstructionType("InitializeNonceAccountInstruction", {
1675
+ nonceAccount: string(),
1676
+ nonceAuthority: string(),
1677
+ recentBlockhashesSysvar: string(),
1678
+ rentSysvar: string()
1679
+ }),
1680
+ parsedTransactionInstructionType("AuthorizeNonceAccountInstruction", {
1681
+ newAuthorized: string(),
1682
+ nonceAccount: string(),
1683
+ nonceAuthority: string()
1684
+ }),
1685
+ parsedTransactionInstructionType("UpgradeNonceAccountInstruction", {
1686
+ nonceAccount: string()
1687
+ }),
1688
+ parsedTransactionInstructionType("AllocateInstruction", {
1689
+ account: string(),
1690
+ space: bigint()
1691
+ }),
1692
+ parsedTransactionInstructionType("AllocateWithSeedInstruction", {
1693
+ account: string(),
1694
+ base: string(),
1695
+ owner: string(),
1696
+ seed: string(),
1697
+ space: bigint()
1698
+ }),
1699
+ parsedTransactionInstructionType("AssignWithSeedInstruction", {
1700
+ account: string(),
1701
+ base: string(),
1702
+ owner: string(),
1703
+ seed: string()
1704
+ }),
1705
+ parsedTransactionInstructionType("TransferWithSeedInstruction", {
1706
+ destination: string(),
1707
+ lamports: bigint(),
1708
+ source: string(),
1709
+ sourceBase: string(),
1710
+ sourceOwner: string(),
1711
+ sourceSeed: string()
1712
+ })
1713
+ ];
1714
+ return memoisedParsedInstructionsSystem;
1715
+ };
1716
+ var memoisedVote;
1717
+ var vote = () => {
1718
+ if (!memoisedVote)
1719
+ memoisedVote = new graphql.GraphQLObjectType({
1720
+ fields: {
1721
+ hash: string(),
1722
+ slots: list(bigint()),
1723
+ timestamp: bigint()
1724
+ },
1725
+ name: "Vote"
1726
+ });
1727
+ return memoisedVote;
1728
+ };
1729
+ var memoisedVoteStateUpdate;
1730
+ var voteStateUpdate = () => {
1731
+ if (!memoisedVoteStateUpdate)
1732
+ memoisedVoteStateUpdate = new graphql.GraphQLObjectType({
1733
+ fields: {
1734
+ hash: string(),
1735
+ lockouts: list(
1736
+ object("VoteStateUpdateLockout", {
1737
+ confirmationCount: number(),
1738
+ slot: bigint()
1739
+ })
1740
+ ),
1741
+ root: bigint(),
1742
+ timestamp: bigint()
1743
+ },
1744
+ name: "VoteStateUpdate"
1745
+ });
1746
+ return memoisedVoteStateUpdate;
1747
+ };
1748
+ var memoisedParsedInstructionsVote;
1749
+ var parsedInstructionsVote = () => {
1750
+ if (!memoisedParsedInstructionsVote)
1751
+ memoisedParsedInstructionsVote = [
1752
+ parsedTransactionInstructionType("VoteInitializeAccountInstruction", {
1753
+ authorizedVoter: string(),
1754
+ authorizedWithdrawer: string(),
1755
+ clockSysvar: string(),
1756
+ commission: number(),
1757
+ node: string(),
1758
+ rentSysvar: string(),
1759
+ voteAccount: string()
1760
+ }),
1761
+ parsedTransactionInstructionType("VoteAuthorizeInstruction", {
1762
+ authority: string(),
1763
+ authorityType: string(),
1764
+ clockSysvar: string(),
1765
+ newAuthority: string(),
1766
+ voteAccount: string()
1767
+ }),
1768
+ parsedTransactionInstructionType("VoteAuthorizeWithSeedInstruction", {
1769
+ authorityBaseKey: string(),
1770
+ authorityOwner: string(),
1771
+ authoritySeed: string(),
1772
+ authorityType: string(),
1773
+ clockSysvar: string(),
1774
+ newAuthority: string(),
1775
+ voteAccount: string()
1776
+ }),
1777
+ parsedTransactionInstructionType("VoteAuthorizeCheckedWithSeedInstruction", {
1778
+ authorityBaseKey: string(),
1779
+ authorityOwner: string(),
1780
+ authoritySeed: string(),
1781
+ authorityType: string(),
1782
+ clockSysvar: string(),
1783
+ newAuthority: string(),
1784
+ voteAccount: string()
1785
+ }),
1786
+ parsedTransactionInstructionType("VoteVoteInstruction", {
1787
+ clockSysvar: string(),
1788
+ slotHashedSysvar: string(),
1789
+ vote: type(vote()),
1790
+ voteAccount: string(),
1791
+ voteAuthority: string()
1792
+ }),
1793
+ parsedTransactionInstructionType("VoteUpdateVoteStateInstruction", {
1794
+ hash: string(),
1795
+ voteAccount: string(),
1796
+ voteAuthority: string(),
1797
+ voteStateUpdate: type(voteStateUpdate())
1798
+ }),
1799
+ parsedTransactionInstructionType("VoteUpdateVoteStateSwitchInstruction", {
1800
+ hash: string(),
1801
+ voteAccount: string(),
1802
+ voteAuthority: string(),
1803
+ voteStateUpdate: type(voteStateUpdate())
1804
+ }),
1805
+ parsedTransactionInstructionType("VoteCompactUpdateVoteStateInstruction", {
1806
+ hash: string(),
1807
+ voteAccount: string(),
1808
+ voteAuthority: string(),
1809
+ voteStateUpdate: type(voteStateUpdate())
1810
+ }),
1811
+ parsedTransactionInstructionType("VoteCompactUpdateVoteStateSwitchInstruction", {
1812
+ hash: string(),
1813
+ voteAccount: string(),
1814
+ voteAuthority: string(),
1815
+ voteStateUpdate: type(voteStateUpdate())
1816
+ }),
1817
+ parsedTransactionInstructionType("VoteWithdrawInstruction", {
1818
+ destination: string(),
1819
+ lamports: bigint(),
1820
+ voteAccount: string(),
1821
+ withdrawAuthority: string()
1822
+ }),
1823
+ parsedTransactionInstructionType("VoteUpdateValidatorIdentityInstruction", {
1824
+ newValidatorIdentity: string(),
1825
+ voteAccount: string(),
1826
+ withdrawAuthority: string()
1827
+ }),
1828
+ parsedTransactionInstructionType("VoteUpdateCommissionInstruction", {
1829
+ commission: string(),
1830
+ voteAccount: string(),
1831
+ withdrawAuthority: string()
1832
+ }),
1833
+ parsedTransactionInstructionType("VoteVoteSwitchInstruction", {
1834
+ clockSysvar: string(),
1835
+ hash: string(),
1836
+ slotHashesSysvar: string(),
1837
+ vote: type(vote()),
1838
+ voteAccount: string(),
1839
+ voteAuthority: string()
1840
+ }),
1841
+ parsedTransactionInstructionType("VoteAuthorizeCheckedInstruction", {
1842
+ authority: string(),
1843
+ authorityType: string(),
1844
+ clockSysvar: string(),
1845
+ newAuthority: string(),
1846
+ voteAccount: string()
1847
+ })
1848
+ ];
1849
+ return memoisedParsedInstructionsVote;
1850
+ };
1851
+ var memoisedTransactionMetaInterfaceFields;
1852
+ var transactionMetaInterfaceFields = () => {
1853
+ if (!memoisedTransactionMetaInterfaceFields)
1854
+ memoisedTransactionMetaInterfaceFields = {
1855
+ computeUnitsConsumed: bigint(),
1856
+ err: string(),
1857
+ fee: bigint(),
1858
+ format: string(),
1859
+ loadedAddresses: type(transactionMetaLoadedAddresses()),
1860
+ logMessages: list(string()),
1861
+ postBalances: list(bigint()),
1862
+ postTokenBalances: list(type(tokenBalance())),
1863
+ preBalances: list(bigint()),
1864
+ preTokenBalances: list(type(tokenBalance())),
1865
+ returnData: type(returnData()),
1866
+ rewards: list(type(reward())),
1867
+ status: type(transactionStatus())
1868
+ };
1869
+ return memoisedTransactionMetaInterfaceFields;
1870
+ };
1871
+ var memoisedTransactionMetaInterface;
1872
+ var transactionMetaInterface = () => {
1873
+ if (!memoisedTransactionMetaInterface)
1874
+ memoisedTransactionMetaInterface = new graphql.GraphQLInterfaceType({
1875
+ fields: {
1876
+ ...transactionMetaInterfaceFields()
1877
+ },
1878
+ name: "TransactionMeta",
1879
+ resolveType(meta) {
1880
+ if (meta.format === "parsed") {
1881
+ return "TransactionMetaParsed";
1882
+ }
1883
+ return "TransactionMetaUnparsed";
1884
+ }
1885
+ });
1886
+ return memoisedTransactionMetaInterface;
1887
+ };
1888
+ var transactionMetaType = (name, description, innerInstructions) => new graphql.GraphQLObjectType({
1889
+ description,
1890
+ fields: {
1891
+ ...transactionMetaInterfaceFields(),
1892
+ innerInstructions
1893
+ },
1894
+ interfaces: [transactionMetaInterface()],
1895
+ name
1896
+ });
1897
+ var memoisedTransactionMetaUnparsed;
1898
+ var transactionMetaUnparsed = () => {
1899
+ if (!memoisedTransactionMetaUnparsed)
1900
+ memoisedTransactionMetaUnparsed = transactionMetaType(
1901
+ "TransactionMetaUnparsed",
1902
+ "Non-parsed transaction meta",
1903
+ list(
1904
+ object("TransactionMetaInnerInstructionsUnparsed", {
1905
+ index: number(),
1906
+ instructions: list(
1907
+ object("TransactionMetaInnerInstructionsUnparsedInstruction", {
1908
+ index: number(),
1909
+ instructions: list(type(transactionInstruction()))
1910
+ })
1911
+ )
1912
+ })
1913
+ )
1914
+ );
1915
+ return memoisedTransactionMetaUnparsed;
1916
+ };
1917
+ var memoisedTransactionMetaParsed;
1918
+ var transactionMetaParsed = () => {
1919
+ if (!memoisedTransactionMetaParsed)
1920
+ memoisedTransactionMetaParsed = transactionMetaType(
1921
+ "TransactionMetaParsed",
1922
+ "Parsed transaction meta",
1923
+ list(
1924
+ object("TransactionMetaInnerInstructionsParsed", {
1925
+ index: number(),
1926
+ instructions: list(type(parsedTransactionInstructionInterface()))
1927
+ })
1928
+ )
1929
+ );
1930
+ return memoisedTransactionMetaParsed;
1931
+ };
1932
+ var memoisedTransactionMessageInterfaceFields;
1933
+ var transactionMessageInterfaceFields = () => {
1934
+ if (!memoisedTransactionMessageInterfaceFields)
1935
+ memoisedTransactionMessageInterfaceFields = {
1936
+ addressTableLookups: list(type(addressTableLookup())),
1937
+ format: string(),
1938
+ header: object("TransactionJsonTransactionHeader", {
1939
+ numReadonlySignedAccounts: number(),
1940
+ numReadonlyUnsignedAccounts: number(),
1941
+ numRequiredSignatures: number()
1942
+ }),
1943
+ recentBlockhash: string()
1944
+ };
1945
+ return memoisedTransactionMessageInterfaceFields;
1946
+ };
1947
+ var memoisedTransactionMessageInterface;
1948
+ var transactionMessageInterface = () => {
1949
+ if (!memoisedTransactionMessageInterface)
1950
+ memoisedTransactionMessageInterface = new graphql.GraphQLInterfaceType({
1951
+ fields: {
1952
+ ...transactionMessageInterfaceFields()
1953
+ },
1954
+ name: "TransactionMessage",
1955
+ resolveType(message) {
1956
+ if (message.format === "parsed") {
1957
+ return "TransactionMessageParsed";
1958
+ }
1959
+ return "TransactionMessageUnparsed";
1960
+ }
1961
+ });
1962
+ return memoisedTransactionMessageInterface;
1963
+ };
1964
+ var transactionMessageType = (name, description, accountKeys, instructions) => new graphql.GraphQLObjectType({
1965
+ description,
1966
+ fields: {
1967
+ ...transactionMessageInterfaceFields(),
1968
+ accountKeys,
1969
+ instructions
1970
+ },
1971
+ interfaces: [transactionMessageInterface()],
1972
+ name
1973
+ });
1974
+ var memoisedTransactionMessageUnparsed;
1975
+ var transactionMessageUnparsed = () => {
1976
+ if (!memoisedTransactionMessageUnparsed)
1977
+ memoisedTransactionMessageUnparsed = transactionMessageType(
1978
+ "TransactionMessageUnparsed",
1979
+ "Non-parsed transaction message",
1980
+ list(string()),
1981
+ list(type(transactionInstruction()))
1982
+ );
1983
+ return memoisedTransactionMessageUnparsed;
1984
+ };
1985
+ var memoisedTransactionMessageParsed;
1986
+ var transactionMessageParsed = () => {
1987
+ if (!memoisedTransactionMessageParsed)
1988
+ memoisedTransactionMessageParsed = transactionMessageType(
1989
+ "TransactionMessageParsed",
1990
+ "Parsed transaction message",
1991
+ list(
1992
+ object("transactionMessageParsedAccountKey", {
1993
+ pubkey: string(),
1994
+ signer: boolean(),
1995
+ source: string(),
1996
+ writable: boolean()
1997
+ })
1998
+ ),
1999
+ list(type(parsedTransactionInstructionInterface()))
2000
+ );
2001
+ return memoisedTransactionMessageParsed;
2002
+ };
2003
+ var memoisedTransactionTransaction;
2004
+ var transactionTransaction = () => {
2005
+ if (!memoisedTransactionTransaction)
2006
+ memoisedTransactionTransaction = new graphql.GraphQLObjectType({
2007
+ fields: {
2008
+ message: type(transactionMessageInterface()),
2009
+ signatures: list(string())
2010
+ },
2011
+ name: "TransactionTransaction"
2012
+ });
2013
+ return memoisedTransactionTransaction;
2014
+ };
2015
+ var memoisedTransactionInterfaceFields;
2016
+ var transactionInterfaceFields = () => {
2017
+ if (!memoisedTransactionInterfaceFields)
2018
+ memoisedTransactionInterfaceFields = {
2019
+ blockTime: bigint(),
2020
+ encoding: string(),
2021
+ meta: type(transactionMetaInterface()),
2022
+ slot: bigint()
2023
+ };
2024
+ return memoisedTransactionInterfaceFields;
2025
+ };
2026
+ var memoisedTransactionInterface;
2027
+ var transactionInterface = () => {
2028
+ if (!memoisedTransactionInterface)
2029
+ memoisedTransactionInterface = new graphql.GraphQLInterfaceType({
2030
+ fields: {
2031
+ ...transactionInterfaceFields()
2032
+ },
2033
+ name: "Transaction",
2034
+ resolveType(transaction) {
2035
+ if (transaction.encoding === "base58") {
2036
+ return "TransactionBase58";
2037
+ }
2038
+ if (transaction.encoding === "base64") {
2039
+ return "TransactionBase64";
2040
+ }
2041
+ if (transaction.encoding === "json") {
2042
+ return "TransactionJson";
2043
+ }
2044
+ return "TransactionJsonParsed";
2045
+ }
2046
+ });
2047
+ return memoisedTransactionInterface;
2048
+ };
2049
+ var transactionType = (name, description, transaction) => new graphql.GraphQLObjectType({
2050
+ description,
2051
+ fields: {
2052
+ ...transactionInterfaceFields(),
2053
+ transaction
2054
+ },
2055
+ interfaces: [transactionInterface()],
2056
+ name
2057
+ });
2058
+ var memoisedTransactionBase58;
2059
+ var transactionBase58 = () => {
2060
+ if (!memoisedTransactionBase58)
2061
+ memoisedTransactionBase58 = transactionType(
2062
+ "TransactionBase58",
2063
+ "A Solana transaction as base58 encoded data",
2064
+ string()
2065
+ );
2066
+ return memoisedTransactionBase58;
2067
+ };
2068
+ var memoisedTransactionBase64;
2069
+ var transactionBase64 = () => {
2070
+ if (!memoisedTransactionBase64)
2071
+ memoisedTransactionBase64 = transactionType(
2072
+ "TransactionBase64",
2073
+ "A Solana transaction as base64 encoded data",
2074
+ string()
2075
+ );
2076
+ return memoisedTransactionBase64;
2077
+ };
2078
+ var memoisedTransactionJson;
2079
+ var transactionJson = () => {
2080
+ if (!memoisedTransactionJson)
2081
+ memoisedTransactionJson = transactionType(
2082
+ "TransactionJson",
2083
+ "A Solana transaction as a JSON object",
2084
+ type(transactionTransaction())
2085
+ );
2086
+ return memoisedTransactionJson;
2087
+ };
2088
+ var memoisedTransactionJsonParsed;
2089
+ var transactionJsonParsed = () => {
2090
+ if (!memoisedTransactionJsonParsed)
2091
+ memoisedTransactionJsonParsed = transactionType(
2092
+ "TransactionJsonParsed",
2093
+ "A Solana transaction as a parsed JSON object",
2094
+ type(transactionTransaction())
2095
+ );
2096
+ return memoisedTransactionJsonParsed;
2097
+ };
2098
+ var memoisedTransactionTypes;
2099
+ var transactionTypes = () => {
2100
+ if (!memoisedTransactionTypes)
2101
+ memoisedTransactionTypes = [
2102
+ partiallyDecodedTransactionInstruction(),
2103
+ ...parsedInstructionsAddressLookupTable(),
2104
+ ...parsedInstructionsBpfLoader(),
2105
+ ...parsedInstructionsBpfUpgradeableLoader(),
2106
+ ...parsedInstructionsStake(),
2107
+ ...parsedInstructionsSplAssociatedToken(),
2108
+ parsedInstructionSplMemo(),
2109
+ ...parsedInstructionsSplToken(),
2110
+ ...parsedInstructionsSystem(),
2111
+ ...parsedInstructionsVote(),
2112
+ transactionMetaUnparsed(),
2113
+ transactionMetaParsed(),
2114
+ transactionMessageUnparsed(),
2115
+ transactionMessageParsed(),
2116
+ transactionBase58(),
2117
+ transactionBase64(),
2118
+ transactionJson(),
2119
+ transactionJsonParsed()
2120
+ ];
2121
+ return memoisedTransactionTypes;
2122
+ };
2123
+
2124
+ // src/schema/transaction/query.ts
2125
+ var transactionQuery = () => ({
2126
+ transaction: {
2127
+ args: {
2128
+ commitment: type(commitmentInputType()),
2129
+ encoding: type(transactionEncodingInputType()),
2130
+ maxSupportedTransactionVersion: type(maxSupportedTransactionVersionInputType()),
2131
+ signature: nonNull(string())
2132
+ },
2133
+ resolve: (_parent, args, context) => context.resolveTransaction(args),
2134
+ type: transactionInterface()
2135
+ }
2136
+ });
2137
+
2138
+ // src/schema/block/types.ts
2139
+ var memoisedTransactionForAccounts;
2140
+ var transactionForAccounts = () => {
2141
+ if (!memoisedTransactionForAccounts)
2142
+ memoisedTransactionForAccounts = new graphql.GraphQLObjectType({
2143
+ fields: {
2144
+ meta: object("TransactionMetaForAccounts", {
2145
+ computeUnitsUsed: bigint(),
2146
+ err: string(),
2147
+ fee: bigint(),
2148
+ format: string(),
2149
+ loadedAddresses: type(transactionMetaLoadedAddresses()),
2150
+ logMessages: list(string()),
2151
+ postBalances: list(bigint()),
2152
+ postTokenBalances: list(type(tokenBalance())),
2153
+ preBalances: list(bigint()),
2154
+ preTokenBalances: list(type(tokenBalance())),
2155
+ returnData: type(returnData()),
2156
+ rewards: list(type(reward())),
2157
+ status: type(transactionStatus())
2158
+ }),
2159
+ transaction: type(transactionInterface()),
2160
+ // TODO
2161
+ version: string()
2162
+ },
2163
+ name: "TransactionForAccounts"
2164
+ });
2165
+ return memoisedTransactionForAccounts;
2166
+ };
2167
+ var memoisedBlockInterfaceFields;
2168
+ var blockInterfaceFields = () => {
2169
+ if (!memoisedBlockInterfaceFields)
2170
+ memoisedBlockInterfaceFields = {
2171
+ blockHeight: bigint(),
2172
+ blockTime: bigint(),
2173
+ blockhash: string(),
2174
+ parentSlot: bigint(),
2175
+ previousBlockhash: string(),
2176
+ rewards: list(type(reward()))
2177
+ };
2178
+ return memoisedBlockInterfaceFields;
2179
+ };
2180
+ var memoisedBlockInterface;
2181
+ var blockInterface = () => {
2182
+ if (!memoisedBlockInterface)
2183
+ memoisedBlockInterface = new graphql.GraphQLInterfaceType({
2184
+ fields: {
2185
+ ...blockInterfaceFields()
2186
+ },
2187
+ name: "Block",
2188
+ resolveType(block) {
2189
+ if (block.transactionDetails === "signatures") {
2190
+ return "BlockWithSignatures";
2191
+ }
2192
+ if (block.transactionDetails === "accounts") {
2193
+ return "BlockWithAccounts";
2194
+ }
2195
+ if (block.transactionDetails === "none") {
2196
+ return "BlockWithNoTransactions";
2197
+ }
2198
+ return "BlockWithTransactions";
2199
+ }
2200
+ });
2201
+ return memoisedBlockInterface;
2202
+ };
2203
+ var memoisedBlockWithNoTransactions;
2204
+ var blockWithNoTransactions = () => {
2205
+ if (!memoisedBlockWithNoTransactions)
2206
+ memoisedBlockWithNoTransactions = new graphql.GraphQLObjectType({
2207
+ fields: {
2208
+ ...blockInterfaceFields()
2209
+ },
2210
+ interfaces: [blockInterface()],
2211
+ name: "BlockWithNoTransactions"
2212
+ });
2213
+ return memoisedBlockWithNoTransactions;
2214
+ };
2215
+ var memoisedBlockWithSignatures;
2216
+ var blockWithSignatures = () => {
2217
+ if (!memoisedBlockWithSignatures)
2218
+ memoisedBlockWithSignatures = new graphql.GraphQLObjectType({
2219
+ fields: {
2220
+ ...blockInterfaceFields(),
2221
+ signatures: list(string())
2222
+ },
2223
+ interfaces: [blockInterface()],
2224
+ name: "BlockWithSignatures"
2225
+ });
2226
+ return memoisedBlockWithSignatures;
2227
+ };
2228
+ var memoisedBlockWithAccounts;
2229
+ var blockWithAccounts = () => {
2230
+ if (!memoisedBlockWithAccounts)
2231
+ memoisedBlockWithAccounts = new graphql.GraphQLObjectType({
2232
+ fields: {
2233
+ ...blockInterfaceFields(),
2234
+ transactions: list(type(transactionForAccounts()))
2235
+ },
2236
+ interfaces: [blockInterface()],
2237
+ name: "BlockWithAccounts"
2238
+ });
2239
+ return memoisedBlockWithAccounts;
2240
+ };
2241
+ var memoisedBlockWithTransactions;
2242
+ var blockWithTransactions = () => {
2243
+ if (!memoisedBlockWithTransactions)
2244
+ memoisedBlockWithTransactions = new graphql.GraphQLObjectType({
2245
+ fields: {
2246
+ ...blockInterfaceFields(),
2247
+ transactions: list(type(transactionInterface()))
2248
+ },
2249
+ interfaces: [blockInterface()],
2250
+ name: "BlockWithTransactions"
2251
+ });
2252
+ return memoisedBlockWithTransactions;
2253
+ };
2254
+ var memoisedBlockTypes;
2255
+ var blockTypes = () => {
2256
+ if (!memoisedBlockTypes)
2257
+ memoisedBlockTypes = [
2258
+ blockWithNoTransactions(),
2259
+ blockWithSignatures(),
2260
+ blockWithAccounts(),
2261
+ blockWithTransactions()
2262
+ ];
2263
+ return memoisedBlockTypes;
2264
+ };
2265
+
2266
+ // src/schema/block/query.ts
2267
+ var blockQuery = () => ({
2268
+ block: {
2269
+ args: {
2270
+ commitment: type(commitmentInputType()),
2271
+ encoding: type(transactionEncodingInputType()),
2272
+ maxSupportedTransactionVersion: string(),
2273
+ rewards: boolean(),
2274
+ slot: nonNull(bigint()),
2275
+ transactionDetails: type(blockTransactionDetailsInputType())
2276
+ },
2277
+ resolve: (_parent, args, context) => context.resolveBlock(args),
2278
+ type: blockInterface()
2279
+ }
2280
+ });
2281
+ var programAccountsQuery = () => ({
2282
+ programAccounts: {
2283
+ args: {
2284
+ commitment: type(commitmentInputType()),
2285
+ dataSlice: type(dataSliceInputType()),
2286
+ encoding: type(accountEncodingInputType()),
2287
+ filters: list(type(programAccountFilterInputType())),
2288
+ minContextSlot: bigint(),
2289
+ programAddress: nonNull(string()),
2290
+ withContext: string()
2291
+ },
2292
+ resolve: (_parent, args, context) => context.resolveProgramAccounts(args),
2293
+ type: new graphql.GraphQLList(accountInterface())
2294
+ }
2295
+ });
43
2296
 
44
2297
  // src/rpc.ts
45
2298
  function createRpcGraphQL(rpc) {
@@ -47,11 +2300,14 @@ function createRpcGraphQL(rpc) {
47
2300
  const schema = new graphql.GraphQLSchema({
48
2301
  query: new graphql.GraphQLObjectType({
49
2302
  fields: {
50
- /** Root queries */
2303
+ ...accountQuery(),
2304
+ ...blockQuery(),
2305
+ ...programAccountsQuery(),
2306
+ ...transactionQuery()
51
2307
  },
52
2308
  name: "RootQuery"
53
2309
  }),
54
- types: []
2310
+ types: [...accountTypes(), ...blockTypes(), ...transactionTypes()]
55
2311
  });
56
2312
  return {
57
2313
  context,