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

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