@solana/rpc-graphql 2.0.0-experimental.dacecb7 → 2.0.0-experimental.e1ca396

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