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

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