@solana/rpc-graphql 2.0.0-experimental.5586a1b → 2.0.0-experimental.dacecb7

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