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

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