@solana/rpc-graphql 2.0.0-experimental.ef2569b → 2.0.0-experimental.f025b33

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