@solana/rpc-graphql 2.0.0-experimental.f5d64e6 → 2.0.0-experimental.f8c941c

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