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