@solana/rpc-graphql 2.0.0-experimental.9e133fd → 2.0.0-experimental.a0b9a27

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