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

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