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