@solana/rpc-graphql 2.0.0-experimental.fe07532 → 2.0.0-experimental.ff8c65b

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