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

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