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

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