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