@solana/rpc-graphql 2.0.0-experimental.5e737f9 → 2.0.0-experimental.606040b

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