@solana/rpc-graphql 2.0.0-experimental.fc4e943 → 2.0.0-experimental.fcff844

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