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