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

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