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

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