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

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