@solana/rpc-graphql 2.0.0-experimental.ee4214c → 2.0.0-experimental.efe6f4d

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