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