@solana/rpc-graphql 2.0.0-experimental.dacecb7 → 2.0.0-experimental.dbe6a73

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