@solana/rpc-graphql 2.0.0-experimental.0835c79 → 2.0.0-experimental.0898b99

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