@solana/rpc-graphql 2.0.0-experimental.aa4a701 → 2.0.0-experimental.af584fc

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.
@@ -5,37 +5,6 @@ import { makeExecutableSchema } from '@graphql-tools/schema';
5
5
 
6
6
  // src/rpc.ts
7
7
 
8
- // src/cache.ts
9
- var inMemoryCache = {};
10
- var stringifyValue = (value) => JSON.stringify(value, (_, value2) => {
11
- if (typeof value2 === "bigint") {
12
- return value2.toString() + "n";
13
- }
14
- return value2;
15
- });
16
- var parseValue = (value) => JSON.parse(value, (_, value2) => {
17
- if (typeof value2 === "string" && /\d+n$/.test(value2)) {
18
- return BigInt(value2.slice(0, -1));
19
- }
20
- return value2;
21
- });
22
- var cacheKey = (key, variables) => `GraphQLCache:${stringifyValue(key)}:${stringifyValue(variables)}`;
23
- function createGraphQLCache() {
24
- return {
25
- // Node.js
26
- flush: () => {
27
- Object.keys(inMemoryCache).forEach((key) => delete inMemoryCache[key]);
28
- },
29
- get: (key, variables) => {
30
- const value = inMemoryCache[cacheKey(key, variables)];
31
- return value === void 0 ? null : parseValue(value);
32
- },
33
- insert: (key, variables, value) => {
34
- inMemoryCache[cacheKey(key, variables)] = stringifyValue(value);
35
- }
36
- };
37
- }
38
-
39
8
  // src/loaders/common/resolve-info.ts
40
9
  function onlyPresentFieldRequested(fieldName, info) {
41
10
  if (info && info.fieldNodes[0].selectionSet) {
@@ -116,15 +85,14 @@ function createAccountLoader(rpc) {
116
85
  }
117
86
  };
118
87
  }
119
-
120
- // src/loaders/transaction.ts
121
88
  function normalizeArgs2(args) {
122
- const { commitment, encoding } = args;
89
+ const { commitment, encoding, signature } = args;
123
90
  return {
124
91
  commitment: commitment ?? "confirmed",
125
92
  encoding: encoding ?? "jsonParsed",
126
93
  // Always use 0 to avoid silly errors
127
- maxSupportedTransactionVersion: 0
94
+ maxSupportedTransactionVersion: 0,
95
+ signature
128
96
  };
129
97
  }
130
98
  function refineJsonParsedInstructionData(jsonParsedInstructionData) {
@@ -177,21 +145,16 @@ function refineJsonParsedTransaction({ encoding, transaction }) {
177
145
  function processQueryResponse2({ encoding, transaction }) {
178
146
  return refineJsonParsedTransaction({ encoding, transaction });
179
147
  }
180
- async function loadTransaction({ signature, ...config }, cache, rpc, _info) {
181
- const requestConfig = normalizeArgs2(config);
182
- const { encoding } = requestConfig;
183
- const cached = cache.get(signature, requestConfig);
184
- if (cached !== null) {
185
- return cached;
186
- }
187
- let transaction = await rpc.getTransaction(signature, requestConfig).send().catch((e) => {
148
+ async function loadTransaction(rpc, { signature, ...config }) {
149
+ const { encoding } = config;
150
+ let transaction = await rpc.getTransaction(signature, config).send().catch((e) => {
188
151
  throw e;
189
152
  });
190
153
  if (transaction === null) {
191
154
  return null;
192
155
  }
193
156
  if (encoding !== "jsonParsed") {
194
- const transactionJsonParsed = await rpc.getTransaction(signature, requestConfig).send().catch((e) => {
157
+ const transactionJsonParsed = await rpc.getTransaction(signature, config).send().catch((e) => {
195
158
  throw e;
196
159
  });
197
160
  if (transactionJsonParsed === null) {
@@ -204,18 +167,35 @@ async function loadTransaction({ signature, ...config }, cache, rpc, _info) {
204
167
  };
205
168
  }
206
169
  const queryResponse = processQueryResponse2({ encoding, transaction });
207
- cache.insert(signature, requestConfig, queryResponse);
208
170
  return queryResponse;
209
171
  }
172
+ function createTransactionBatchLoadFn(rpc) {
173
+ const resolveTransactionUsingRpc = loadTransaction.bind(null, rpc);
174
+ return async (transactionQueryArgs) => {
175
+ return await Promise.all(transactionQueryArgs.map(async (args) => await resolveTransactionUsingRpc(args)));
176
+ };
177
+ }
178
+ function createTransactionLoader(rpc) {
179
+ const loader = new DataLoader(createTransactionBatchLoadFn(rpc), { cacheKeyFn: fastStableStringify });
180
+ return {
181
+ load: async (args, info) => {
182
+ if (onlyPresentFieldRequested("signature", info)) {
183
+ return { signature: args.signature };
184
+ }
185
+ return loader.load(normalizeArgs2(args));
186
+ }
187
+ };
188
+ }
210
189
 
211
190
  // src/loaders/block.ts
212
191
  function normalizeArgs3(args) {
213
- const { commitment, encoding, transactionDetails } = args;
192
+ const { commitment, encoding, slot, transactionDetails } = args;
214
193
  return {
215
194
  commitment: commitment ?? "confirmed",
216
195
  encoding: encoding ?? "jsonParsed",
217
196
  // Always use 0 to avoid silly errors
218
197
  maxSupportedTransactionVersion: 0,
198
+ slot,
219
199
  transactionDetails: transactionDetails ?? "full"
220
200
  };
221
201
  }
@@ -250,33 +230,43 @@ function processQueryResponse3({
250
230
  transactionDetails
251
231
  };
252
232
  }
253
- async function loadBlock({ slot, ...config }, cache, rpc, _info) {
254
- const requestConfig = normalizeArgs3(config);
255
- const { encoding, transactionDetails } = requestConfig;
256
- const cached = cache.get(slot, config);
257
- if (cached !== null) {
258
- return cached;
259
- }
260
- const block = await rpc.getBlock(slot, requestConfig).send().catch((e) => {
233
+ async function loadBlock(rpc, { slot, ...config }) {
234
+ const { encoding, transactionDetails } = config;
235
+ const block = await rpc.getBlock(slot, config).send().catch((e) => {
261
236
  throw e;
262
237
  });
263
238
  if (block === null) {
264
239
  return { slot };
265
240
  }
266
241
  const queryResponse = processQueryResponse3({ block, encoding, transactionDetails });
267
- cache.insert(slot, requestConfig, queryResponse);
268
242
  return queryResponse;
269
243
  }
270
-
271
- // src/loaders/program-accounts.ts
244
+ function createBlockBatchLoadFn(rpc) {
245
+ const resolveBlockUsingRpc = loadBlock.bind(null, rpc);
246
+ return async (blockQueryArgs) => {
247
+ return await Promise.all(blockQueryArgs.map(async (args) => await resolveBlockUsingRpc(args)));
248
+ };
249
+ }
250
+ function createBlockLoader(rpc) {
251
+ const loader = new DataLoader(createBlockBatchLoadFn(rpc), { cacheKeyFn: fastStableStringify });
252
+ return {
253
+ load: async (args, info) => {
254
+ if (onlyPresentFieldRequested("slot", info)) {
255
+ return { slot: args.slot };
256
+ }
257
+ return loader.load(normalizeArgs3(args));
258
+ }
259
+ };
260
+ }
272
261
  function normalizeArgs4(args) {
273
- const { commitment, dataSlice, encoding, filters, minContextSlot } = args;
262
+ const { commitment, dataSlice, encoding, filters, minContextSlot, programAddress } = args;
274
263
  return {
275
264
  commitment: commitment ?? "confirmed",
276
265
  dataSlice,
277
266
  encoding: encoding ?? "jsonParsed",
278
267
  filters,
279
- minContextSlot
268
+ minContextSlot,
269
+ programAddress
280
270
  };
281
271
  }
282
272
  function processQueryResponse4({ encoding, programAccounts }) {
@@ -298,14 +288,9 @@ function processQueryResponse4({ encoding, programAccounts }) {
298
288
  };
299
289
  });
300
290
  }
301
- async function loadProgramAccounts({ programAddress, ...config }, cache, rpc, _info) {
302
- const requestConfig = normalizeArgs4(config);
303
- const { encoding } = requestConfig;
304
- const cached = cache.get(programAddress, requestConfig);
305
- if (cached !== null) {
306
- return cached;
307
- }
308
- const programAccounts = await rpc.getProgramAccounts(programAddress, requestConfig).send().then((res) => {
291
+ async function loadProgramAccounts(rpc, { programAddress, ...config }) {
292
+ const { encoding } = config;
293
+ const programAccounts = await rpc.getProgramAccounts(programAddress, config).send().then((res) => {
309
294
  if ("value" in res) {
310
295
  return res.value;
311
296
  }
@@ -314,24 +299,36 @@ async function loadProgramAccounts({ programAddress, ...config }, cache, rpc, _i
314
299
  throw e;
315
300
  });
316
301
  const queryResponse = processQueryResponse4({ encoding, programAccounts });
317
- cache.insert(programAddress, requestConfig, queryResponse);
318
302
  return queryResponse;
319
303
  }
304
+ function createProgramAccountsBatchLoadFn(rpc) {
305
+ const resolveProgramAccountsUsingRpc = loadProgramAccounts.bind(null, rpc);
306
+ return async (programAccountsQueryArgs) => {
307
+ return await Promise.all(
308
+ programAccountsQueryArgs.map(async (args) => await resolveProgramAccountsUsingRpc(args))
309
+ );
310
+ };
311
+ }
312
+ function createProgramAccountsLoader(rpc) {
313
+ const loader = new DataLoader(createProgramAccountsBatchLoadFn(rpc), { cacheKeyFn: fastStableStringify });
314
+ return {
315
+ load: async (args, info) => {
316
+ if (onlyPresentFieldRequested("programAddress", info)) {
317
+ return { programAddress: args.programAddress };
318
+ }
319
+ return loader.load(normalizeArgs4(args));
320
+ }
321
+ };
322
+ }
320
323
 
321
324
  // src/context.ts
322
325
  function createSolanaGraphQLContext(rpc) {
323
- const cache = createGraphQLCache();
324
326
  return {
325
- accountLoader: createAccountLoader(rpc),
326
- cache,
327
- loadBlock(args, info) {
328
- return loadBlock(args, this.cache, this.rpc);
329
- },
330
- loadProgramAccounts(args, info) {
331
- return loadProgramAccounts(args, this.cache, this.rpc);
332
- },
333
- loadTransaction(args, info) {
334
- return loadTransaction(args, this.cache, this.rpc);
327
+ loaders: {
328
+ account: createAccountLoader(rpc),
329
+ block: createBlockLoader(rpc),
330
+ programAccounts: createProgramAccountsLoader(rpc),
331
+ transaction: createTransactionLoader(rpc)
335
332
  },
336
333
  rpc
337
334
  };
@@ -339,7 +336,7 @@ function createSolanaGraphQLContext(rpc) {
339
336
 
340
337
  // src/resolvers/account.ts
341
338
  var resolveAccount = (fieldName) => {
342
- return (parent, args, context, info) => parent[fieldName] === null ? null : context.accountLoader.load({ ...args, address: parent[fieldName] }, info);
339
+ return (parent, args, context, info) => parent[fieldName] === null ? null : context.loaders.account.load({ ...args, address: parent[fieldName] }, info);
343
340
  };
344
341
 
345
342
  // src/schema/account.ts
@@ -348,8 +345,8 @@ var accountTypeDefs = (
348
345
  `
349
346
  # Account interface
350
347
  interface Account {
351
- address: String
352
- encoding: String
348
+ address: Address
349
+ encoding: AccountEncoding
353
350
  executable: Boolean
354
351
  lamports: BigInt
355
352
  owner: Account
@@ -358,9 +355,9 @@ var accountTypeDefs = (
358
355
 
359
356
  # An account with base58 encoded data
360
357
  type AccountBase58 implements Account {
361
- address: String
362
- data: String
363
- encoding: String
358
+ address: Address
359
+ data: Base58EncodedBytes
360
+ encoding: AccountEncoding
364
361
  executable: Boolean
365
362
  lamports: BigInt
366
363
  owner: Account
@@ -369,9 +366,9 @@ var accountTypeDefs = (
369
366
 
370
367
  # An account with base64 encoded data
371
368
  type AccountBase64 implements Account {
372
- address: String
373
- data: String
374
- encoding: String
369
+ address: Address
370
+ data: Base64EncodedBytes
371
+ encoding: AccountEncoding
375
372
  executable: Boolean
376
373
  lamports: BigInt
377
374
  owner: Account
@@ -380,9 +377,9 @@ var accountTypeDefs = (
380
377
 
381
378
  # An account with base64+zstd encoded data
382
379
  type AccountBase64Zstd implements Account {
383
- address: String
384
- data: String
385
- encoding: String
380
+ address: Address
381
+ data: Base64ZstdEncodedBytes
382
+ encoding: AccountEncoding
386
383
  executable: Boolean
387
384
  lamports: BigInt
388
385
  owner: Account
@@ -409,9 +406,9 @@ var accountTypeDefs = (
409
406
  feeCalculator: NonceAccountFeeCalculator
410
407
  }
411
408
  type NonceAccount implements Account & AccountJsonParsed {
412
- address: String
409
+ address: Address
413
410
  data: NonceAccountData
414
- encoding: String
411
+ encoding: AccountEncoding
415
412
  executable: Boolean
416
413
  lamports: BigInt
417
414
  meta: JsonParsedAccountMeta
@@ -428,9 +425,9 @@ var accountTypeDefs = (
428
425
  lastExtendedSlotStartIndex: Int
429
426
  }
430
427
  type LookupTableAccount implements Account & AccountJsonParsed {
431
- address: String
428
+ address: Address
432
429
  data: LookupTableAccountData
433
- encoding: String
430
+ encoding: AccountEncoding
434
431
  executable: Boolean
435
432
  lamports: BigInt
436
433
  meta: JsonParsedAccountMeta
@@ -447,9 +444,9 @@ var accountTypeDefs = (
447
444
  supply: String
448
445
  }
449
446
  type MintAccount implements Account & AccountJsonParsed {
450
- address: String
447
+ address: Address
451
448
  data: MintAccountData
452
- encoding: String
449
+ encoding: AccountEncoding
453
450
  executable: Boolean
454
451
  lamports: BigInt
455
452
  meta: JsonParsedAccountMeta
@@ -466,9 +463,9 @@ var accountTypeDefs = (
466
463
  tokenAmount: TokenAmount
467
464
  }
468
465
  type TokenAccount implements Account & AccountJsonParsed {
469
- address: String
466
+ address: Address
470
467
  data: TokenAccountData
471
- encoding: String
468
+ encoding: AccountEncoding
472
469
  executable: Boolean
473
470
  lamports: BigInt
474
471
  meta: JsonParsedAccountMeta
@@ -507,9 +504,9 @@ var accountTypeDefs = (
507
504
  stake: StakeAccountDataStake
508
505
  }
509
506
  type StakeAccount implements Account & AccountJsonParsed {
510
- address: String
507
+ address: Address
511
508
  data: StakeAccountData
512
- encoding: String
509
+ encoding: AccountEncoding
513
510
  executable: Boolean
514
511
  lamports: BigInt
515
512
  meta: JsonParsedAccountMeta
@@ -547,9 +544,9 @@ var accountTypeDefs = (
547
544
  votes: [VoteAccountDataVote]
548
545
  }
549
546
  type VoteAccount implements Account & AccountJsonParsed {
550
- address: String
547
+ address: Address
551
548
  data: VoteAccountData
552
- encoding: String
549
+ encoding: AccountEncoding
553
550
  executable: Boolean
554
551
  lamports: BigInt
555
552
  meta: JsonParsedAccountMeta
@@ -668,7 +665,7 @@ var blockTypeDefs = (
668
665
  }
669
666
 
670
667
  type TransactionDataForAccounts {
671
- accountKeys: [String]
668
+ accountKeys: [Address]
672
669
  signatures: [String]
673
670
  }
674
671
 
@@ -758,26 +755,6 @@ var blockResolvers = {
758
755
  var inputTypeDefs = (
759
756
  /* GraphQL */
760
757
  `
761
- enum AccountEncoding {
762
- base58
763
- base64
764
- base64Zstd
765
- jsonParsed
766
- }
767
-
768
- enum BlockTransactionDetails {
769
- accounts
770
- full
771
- none
772
- signatures
773
- }
774
-
775
- enum Commitment {
776
- confirmed
777
- finalized
778
- processed
779
- }
780
-
781
758
  input DataSlice {
782
759
  offset: Int
783
760
  length: Int
@@ -786,37 +763,41 @@ var inputTypeDefs = (
786
763
  input ProgramAccountsFilter {
787
764
  bytes: BigInt
788
765
  dataSize: BigInt
789
- encoding: String
766
+ encoding: AccountEncoding
790
767
  offset: BigInt
791
768
  }
792
-
793
- enum TransactionEncoding {
794
- base58
795
- base64
796
- jsonParsed
797
- }
798
-
799
- enum TransactionVersion {
800
- legacy
801
- zero
802
- }
803
769
  `
804
770
  );
805
- var inputResolvers = {
806
- AccountEncoding: {
807
- base64Zstd: "base64+zstd"
808
- },
809
- TransactionVersion: {
810
- zero: 0
811
- }
812
- };
771
+ var inputResolvers = {};
813
772
  var scalarTypeDefs = (
814
773
  /* GraphQL */
815
774
  `
775
+ scalar Address
776
+ scalar Base58EncodedBytes
777
+ scalar Base64EncodedBytes
778
+ scalar Base64ZstdEncodedBytes
816
779
  scalar BigInt
817
780
  `
818
781
  );
782
+ var stringScalarAlias = {
783
+ __parseLiteral(ast) {
784
+ if (ast.kind === Kind.STRING) {
785
+ return ast.value.toString();
786
+ }
787
+ return null;
788
+ },
789
+ __parseValue(value) {
790
+ return value;
791
+ },
792
+ __serialize(value) {
793
+ return value;
794
+ }
795
+ };
819
796
  var scalarResolvers = {
797
+ Address: stringScalarAlias,
798
+ Base58EncodedBytes: stringScalarAlias,
799
+ Base64EncodedBytes: stringScalarAlias,
800
+ Base64ZstdEncodedBytes: stringScalarAlias,
820
801
  BigInt: {
821
802
  __parseLiteral(ast) {
822
803
  if (ast.kind === Kind.STRING) {
@@ -837,16 +818,36 @@ var scalarResolvers = {
837
818
  var commonTypeDefs = (
838
819
  /* GraphQL */
839
820
  `
821
+ enum AccountEncoding {
822
+ BASE_58
823
+ BASE_64
824
+ BASE_64_ZSTD
825
+ PARSED
826
+ }
827
+
828
+ enum BlockTransactionDetails {
829
+ accounts
830
+ full
831
+ none
832
+ signatures
833
+ }
834
+
835
+ enum Commitment {
836
+ confirmed
837
+ finalized
838
+ processed
839
+ }
840
+
840
841
  type ReturnData {
841
- data: String
842
- programId: String
842
+ data: Base64EncodedBytes
843
+ programId: Address
843
844
  }
844
845
 
845
846
  type Reward {
846
847
  commission: Int
847
848
  lamports: BigInt
848
849
  postBalance: BigInt
849
- pubkey: String
850
+ pubkey: Address
850
851
  rewardType: String
851
852
  }
852
853
 
@@ -861,15 +862,41 @@ var commonTypeDefs = (
861
862
  accountIndex: Int
862
863
  mint: Account
863
864
  owner: Account
864
- programId: String
865
+ programId: Address
865
866
  uiTokenAmount: TokenAmount
866
867
  }
868
+
869
+ enum TransactionEncoding {
870
+ BASE_58
871
+ BASE_64
872
+ PARSED
873
+ }
874
+
875
+ enum TransactionVersion {
876
+ LEGACY
877
+ ZERO
878
+ }
867
879
  `
868
880
  );
869
881
  var commonResolvers = {
882
+ AccountEncoding: {
883
+ BASE_58: "base58",
884
+ BASE_64: "base64",
885
+ BASE_64_ZSTD: "base64+zstd",
886
+ PARSED: "jsonParsed"
887
+ },
870
888
  TokenBalance: {
871
889
  mint: resolveAccount("mint"),
872
890
  owner: resolveAccount("owner")
891
+ },
892
+ TransactionEncoding: {
893
+ BASE_58: "base58",
894
+ BASE_64: "base64",
895
+ PARSED: "jsonParsed"
896
+ },
897
+ TransactionVersion: {
898
+ LEGACY: "legacy",
899
+ ZERO: 0
873
900
  }
874
901
  };
875
902
 
@@ -884,14 +911,14 @@ var instructionTypeDefs = (
884
911
 
885
912
  # Transaction instruction interface
886
913
  interface TransactionInstruction {
887
- programId: String
914
+ programId: Address
888
915
  }
889
916
 
890
917
  # Generic transaction instruction
891
918
  type GenericInstruction implements TransactionInstruction {
892
- accounts: [String]
893
- data: String
894
- programId: String
919
+ accounts: [Address]
920
+ data: Base64EncodedBytes
921
+ programId: Address
895
922
  }
896
923
 
897
924
  # AddressLookupTable: CreateLookupTable
@@ -906,21 +933,21 @@ var instructionTypeDefs = (
906
933
  type CreateLookupTableInstruction implements TransactionInstruction {
907
934
  data: CreateLookupTableInstructionData
908
935
  meta: JsonParsedInstructionMeta
909
- programId: String
936
+ programId: Address
910
937
  }
911
938
 
912
939
  # AddressLookupTable: ExtendLookupTable
913
940
  type ExtendLookupTableInstructionData {
914
941
  lookupTableAccount: Account
915
942
  lookupTableAuthority: Account
916
- newAddresses: [String]
943
+ newAddresses: [Address]
917
944
  payerAccount: Account
918
945
  systemProgram: Account
919
946
  }
920
947
  type ExtendLookupTableInstruction implements TransactionInstruction {
921
948
  data: ExtendLookupTableInstructionData
922
949
  meta: JsonParsedInstructionMeta
923
- programId: String
950
+ programId: Address
924
951
  }
925
952
 
926
953
  # AddressLookupTable: FreezeLookupTable
@@ -931,7 +958,7 @@ var instructionTypeDefs = (
931
958
  type FreezeLookupTableInstruction implements TransactionInstruction {
932
959
  data: FreezeLookupTableInstructionData
933
960
  meta: JsonParsedInstructionMeta
934
- programId: String
961
+ programId: Address
935
962
  }
936
963
 
937
964
  # AddressLookupTable: DeactivateLookupTable
@@ -942,7 +969,7 @@ var instructionTypeDefs = (
942
969
  type DeactivateLookupTableInstruction implements TransactionInstruction {
943
970
  data: DeactivateLookupTableInstructionData
944
971
  meta: JsonParsedInstructionMeta
945
- programId: String
972
+ programId: Address
946
973
  }
947
974
 
948
975
  # AddressLookupTable: CloseLookupTable
@@ -954,19 +981,19 @@ var instructionTypeDefs = (
954
981
  type CloseLookupTableInstruction implements TransactionInstruction {
955
982
  data: CloseLookupTableInstructionData
956
983
  meta: JsonParsedInstructionMeta
957
- programId: String
984
+ programId: Address
958
985
  }
959
986
 
960
987
  # BpfLoader: Write
961
988
  type BpfLoaderWriteInstructionData {
962
989
  account: Account
963
- bytes: String
990
+ bytes: Base64EncodedBytes
964
991
  offset: BigInt # FIXME:*
965
992
  }
966
993
  type BpfLoaderWriteInstruction implements TransactionInstruction {
967
994
  data: BpfLoaderWriteInstructionData
968
995
  meta: JsonParsedInstructionMeta
969
- programId: String
996
+ programId: Address
970
997
  }
971
998
 
972
999
  # BpfLoader: Finalize
@@ -976,7 +1003,7 @@ var instructionTypeDefs = (
976
1003
  type BpfLoaderFinalizeInstruction implements TransactionInstruction {
977
1004
  data: BpfLoaderFinalizeInstructionData
978
1005
  meta: JsonParsedInstructionMeta
979
- programId: String
1006
+ programId: Address
980
1007
  }
981
1008
 
982
1009
  # BpfUpgradeableLoader: InitializeBuffer
@@ -986,53 +1013,53 @@ var instructionTypeDefs = (
986
1013
  type BpfUpgradeableLoaderInitializeBufferInstruction implements TransactionInstruction {
987
1014
  data: BpfUpgradeableLoaderInitializeBufferInstructionData
988
1015
  meta: JsonParsedInstructionMeta
989
- programId: String
1016
+ programId: Address
990
1017
  }
991
1018
 
992
1019
  # BpfUpgradeableLoader: Write
993
1020
  type BpfUpgradeableLoaderWriteInstructionData {
994
1021
  account: Account
995
1022
  authority: Account
996
- bytes: String
1023
+ bytes: Base64EncodedBytes
997
1024
  offset: BigInt # FIXME:*
998
1025
  }
999
1026
  type BpfUpgradeableLoaderWriteInstruction implements TransactionInstruction {
1000
1027
  data: BpfUpgradeableLoaderWriteInstructionData
1001
1028
  meta: JsonParsedInstructionMeta
1002
- programId: String
1029
+ programId: Address
1003
1030
  }
1004
1031
 
1005
1032
  # BpfUpgradeableLoader: DeployWithMaxDataLen
1006
1033
  type BpfUpgradeableLoaderDeployWithMaxDataLenInstructionData {
1007
1034
  authority: Account
1008
1035
  bufferAccount: Account
1009
- clockSysvar: String
1036
+ clockSysvar: Address
1010
1037
  maxDataLen: BigInt
1011
1038
  payerAccount: Account
1012
1039
  programAccount: Account
1013
1040
  programDataAccount: Account
1014
- rentSysvar: String
1041
+ rentSysvar: Address
1015
1042
  }
1016
1043
  type BpfUpgradeableLoaderDeployWithMaxDataLenInstruction implements TransactionInstruction {
1017
1044
  data: BpfUpgradeableLoaderDeployWithMaxDataLenInstructionData
1018
1045
  meta: JsonParsedInstructionMeta
1019
- programId: String
1046
+ programId: Address
1020
1047
  }
1021
1048
 
1022
1049
  # BpfUpgradeableLoader: Upgrade
1023
1050
  type BpfUpgradeableLoaderUpgradeInstructionData {
1024
1051
  authority: Account
1025
1052
  bufferAccount: Account
1026
- clockSysvar: String
1053
+ clockSysvar: Address
1027
1054
  programAccount: Account
1028
1055
  programDataAccount: Account
1029
- rentSysvar: String
1056
+ rentSysvar: Address
1030
1057
  spillAccount: Account
1031
1058
  }
1032
1059
  type BpfUpgradeableLoaderUpgradeInstruction implements TransactionInstruction {
1033
1060
  data: BpfUpgradeableLoaderUpgradeInstructionData
1034
1061
  meta: JsonParsedInstructionMeta
1035
- programId: String
1062
+ programId: Address
1036
1063
  }
1037
1064
 
1038
1065
  # BpfUpgradeableLoader: SetAuthority
@@ -1044,7 +1071,7 @@ var instructionTypeDefs = (
1044
1071
  type BpfUpgradeableLoaderSetAuthorityInstruction implements TransactionInstruction {
1045
1072
  data: BpfUpgradeableLoaderSetAuthorityInstructionData
1046
1073
  meta: JsonParsedInstructionMeta
1047
- programId: String
1074
+ programId: Address
1048
1075
  }
1049
1076
 
1050
1077
  # BpfUpgradeableLoader: SetAuthorityChecked
@@ -1056,7 +1083,7 @@ var instructionTypeDefs = (
1056
1083
  type BpfUpgradeableLoaderSetAuthorityCheckedInstruction implements TransactionInstruction {
1057
1084
  data: BpfUpgradeableLoaderSetAuthorityCheckedInstructionData
1058
1085
  meta: JsonParsedInstructionMeta
1059
- programId: String
1086
+ programId: Address
1060
1087
  }
1061
1088
 
1062
1089
  # BpfUpgradeableLoader: Close
@@ -1069,7 +1096,7 @@ var instructionTypeDefs = (
1069
1096
  type BpfUpgradeableLoaderCloseInstruction implements TransactionInstruction {
1070
1097
  data: BpfUpgradeableLoaderCloseInstructionData
1071
1098
  meta: JsonParsedInstructionMeta
1072
- programId: String
1099
+ programId: Address
1073
1100
  }
1074
1101
 
1075
1102
  # BpfUpgradeableLoader: ExtendProgram
@@ -1083,13 +1110,13 @@ var instructionTypeDefs = (
1083
1110
  type BpfUpgradeableLoaderExtendProgramInstruction implements TransactionInstruction {
1084
1111
  data: BpfUpgradeableLoaderExtendProgramInstructionData
1085
1112
  meta: JsonParsedInstructionMeta
1086
- programId: String
1113
+ programId: Address
1087
1114
  }
1088
1115
 
1089
1116
  # SplAssociatedTokenAccount: Create
1090
1117
  type SplAssociatedTokenCreateInstructionData {
1091
1118
  account: Account
1092
- mint: String
1119
+ mint: Address
1093
1120
  source: Account
1094
1121
  systemProgram: Account
1095
1122
  tokenProgram: Account
@@ -1098,13 +1125,13 @@ var instructionTypeDefs = (
1098
1125
  type SplAssociatedTokenCreateInstruction implements TransactionInstruction {
1099
1126
  data: SplAssociatedTokenCreateInstructionData
1100
1127
  meta: JsonParsedInstructionMeta
1101
- programId: String
1128
+ programId: Address
1102
1129
  }
1103
1130
 
1104
1131
  # SplAssociatedTokenAccount: CreateIdempotent
1105
1132
  type SplAssociatedTokenCreateIdempotentInstructionData {
1106
1133
  account: Account
1107
- mint: String
1134
+ mint: Address
1108
1135
  source: Account
1109
1136
  systemProgram: Account
1110
1137
  tokenProgram: Account
@@ -1113,7 +1140,7 @@ var instructionTypeDefs = (
1113
1140
  type SplAssociatedTokenCreateIdempotentInstruction implements TransactionInstruction {
1114
1141
  data: SplAssociatedTokenCreateIdempotentInstructionData
1115
1142
  meta: JsonParsedInstructionMeta
1116
- programId: String
1143
+ programId: Address
1117
1144
  }
1118
1145
 
1119
1146
  # SplAssociatedTokenAccount: RecoverNested
@@ -1129,7 +1156,7 @@ var instructionTypeDefs = (
1129
1156
  type SplAssociatedTokenRecoverNestedInstruction implements TransactionInstruction {
1130
1157
  data: SplAssociatedTokenRecoverNestedInstructionData
1131
1158
  meta: JsonParsedInstructionMeta
1132
- programId: String
1159
+ programId: Address
1133
1160
  }
1134
1161
 
1135
1162
  # SplMemo
@@ -1139,7 +1166,7 @@ var instructionTypeDefs = (
1139
1166
  type SplMemoInstruction implements TransactionInstruction {
1140
1167
  data: SplMemoInstructionData
1141
1168
  meta: JsonParsedInstructionMeta
1142
- programId: String
1169
+ programId: Address
1143
1170
  }
1144
1171
 
1145
1172
  # SplToken: InitializeMint
@@ -1148,12 +1175,12 @@ var instructionTypeDefs = (
1148
1175
  freezeAuthority: Account
1149
1176
  mint: Account
1150
1177
  mintAuthority: Account
1151
- rentSysvar: String
1178
+ rentSysvar: Address
1152
1179
  }
1153
1180
  type SplTokenInitializeMintInstruction implements TransactionInstruction {
1154
1181
  data: SplTokenInitializeMintInstructionData
1155
1182
  meta: JsonParsedInstructionMeta
1156
- programId: String
1183
+ programId: Address
1157
1184
  }
1158
1185
 
1159
1186
  # SplToken: InitializeMint2
@@ -1166,7 +1193,7 @@ var instructionTypeDefs = (
1166
1193
  type SplTokenInitializeMint2Instruction implements TransactionInstruction {
1167
1194
  data: SplTokenInitializeMint2InstructionData
1168
1195
  meta: JsonParsedInstructionMeta
1169
- programId: String
1196
+ programId: Address
1170
1197
  }
1171
1198
 
1172
1199
  # SplToken: InitializeAccount
@@ -1174,12 +1201,12 @@ var instructionTypeDefs = (
1174
1201
  account: Account
1175
1202
  mint: Account
1176
1203
  owner: Account
1177
- rentSysvar: String
1204
+ rentSysvar: Address
1178
1205
  }
1179
1206
  type SplTokenInitializeAccountInstruction implements TransactionInstruction {
1180
1207
  data: SplTokenInitializeAccountInstructionData
1181
1208
  meta: JsonParsedInstructionMeta
1182
- programId: String
1209
+ programId: Address
1183
1210
  }
1184
1211
 
1185
1212
  # SplToken: InitializeAccount2
@@ -1187,12 +1214,12 @@ var instructionTypeDefs = (
1187
1214
  account: Account
1188
1215
  mint: Account
1189
1216
  owner: Account
1190
- rentSysvar: String
1217
+ rentSysvar: Address
1191
1218
  }
1192
1219
  type SplTokenInitializeAccount2Instruction implements TransactionInstruction {
1193
1220
  data: SplTokenInitializeAccount2InstructionData
1194
1221
  meta: JsonParsedInstructionMeta
1195
- programId: String
1222
+ programId: Address
1196
1223
  }
1197
1224
 
1198
1225
  # SplToken: InitializeAccount3
@@ -1204,32 +1231,32 @@ var instructionTypeDefs = (
1204
1231
  type SplTokenInitializeAccount3Instruction implements TransactionInstruction {
1205
1232
  data: SplTokenInitializeAccount3InstructionData
1206
1233
  meta: JsonParsedInstructionMeta
1207
- programId: String
1234
+ programId: Address
1208
1235
  }
1209
1236
 
1210
1237
  # SplToken: InitializeMultisig
1211
1238
  type SplTokenInitializeMultisigInstructionData {
1212
1239
  m: BigInt # FIXME:*
1213
1240
  multisig: Account
1214
- rentSysvar: String
1215
- signers: [String]
1241
+ rentSysvar: Address
1242
+ signers: [Address]
1216
1243
  }
1217
1244
  type SplTokenInitializeMultisigInstruction implements TransactionInstruction {
1218
1245
  data: SplTokenInitializeMultisigInstructionData
1219
1246
  meta: JsonParsedInstructionMeta
1220
- programId: String
1247
+ programId: Address
1221
1248
  }
1222
1249
 
1223
1250
  # SplToken: InitializeMultisig2
1224
1251
  type SplTokenInitializeMultisig2InstructionData {
1225
1252
  m: BigInt # FIXME:*
1226
1253
  multisig: Account
1227
- signers: [String]
1254
+ signers: [Address]
1228
1255
  }
1229
1256
  type SplTokenInitializeMultisig2Instruction implements TransactionInstruction {
1230
1257
  data: SplTokenInitializeMultisig2InstructionData
1231
1258
  meta: JsonParsedInstructionMeta
1232
- programId: String
1259
+ programId: Address
1233
1260
  }
1234
1261
 
1235
1262
  # SplToken: Transfer
@@ -1243,7 +1270,7 @@ var instructionTypeDefs = (
1243
1270
  type SplTokenTransferInstruction implements TransactionInstruction {
1244
1271
  data: SplTokenTransferInstructionData
1245
1272
  meta: JsonParsedInstructionMeta
1246
- programId: String
1273
+ programId: Address
1247
1274
  }
1248
1275
 
1249
1276
  # SplToken: Approve
@@ -1257,7 +1284,7 @@ var instructionTypeDefs = (
1257
1284
  type SplTokenApproveInstruction implements TransactionInstruction {
1258
1285
  data: SplTokenApproveInstructionData
1259
1286
  meta: JsonParsedInstructionMeta
1260
- programId: String
1287
+ programId: Address
1261
1288
  }
1262
1289
 
1263
1290
  # SplToken: Revoke
@@ -1269,7 +1296,7 @@ var instructionTypeDefs = (
1269
1296
  type SplTokenRevokeInstruction implements TransactionInstruction {
1270
1297
  data: SplTokenRevokeInstructionData
1271
1298
  meta: JsonParsedInstructionMeta
1272
- programId: String
1299
+ programId: Address
1273
1300
  }
1274
1301
 
1275
1302
  # SplToken: SetAuthority
@@ -1282,7 +1309,7 @@ var instructionTypeDefs = (
1282
1309
  type SplTokenSetAuthorityInstruction implements TransactionInstruction {
1283
1310
  data: SplTokenSetAuthorityInstructionData
1284
1311
  meta: JsonParsedInstructionMeta
1285
- programId: String
1312
+ programId: Address
1286
1313
  }
1287
1314
 
1288
1315
  # SplToken: MintTo
@@ -1297,7 +1324,7 @@ var instructionTypeDefs = (
1297
1324
  type SplTokenMintToInstruction implements TransactionInstruction {
1298
1325
  data: SplTokenMintToInstructionData
1299
1326
  meta: JsonParsedInstructionMeta
1300
- programId: String
1327
+ programId: Address
1301
1328
  }
1302
1329
 
1303
1330
  # SplToken: Burn
@@ -1311,7 +1338,7 @@ var instructionTypeDefs = (
1311
1338
  type SplTokenBurnInstruction implements TransactionInstruction {
1312
1339
  data: SplTokenBurnInstructionData
1313
1340
  meta: JsonParsedInstructionMeta
1314
- programId: String
1341
+ programId: Address
1315
1342
  }
1316
1343
 
1317
1344
  # SplToken: CloseAccount
@@ -1324,7 +1351,7 @@ var instructionTypeDefs = (
1324
1351
  type SplTokenCloseAccountInstruction implements TransactionInstruction {
1325
1352
  data: SplTokenCloseAccountInstructionData
1326
1353
  meta: JsonParsedInstructionMeta
1327
- programId: String
1354
+ programId: Address
1328
1355
  }
1329
1356
 
1330
1357
  # SplToken: FreezeAccount
@@ -1337,7 +1364,7 @@ var instructionTypeDefs = (
1337
1364
  type SplTokenFreezeAccountInstruction implements TransactionInstruction {
1338
1365
  data: SplTokenFreezeAccountInstructionData
1339
1366
  meta: JsonParsedInstructionMeta
1340
- programId: String
1367
+ programId: Address
1341
1368
  }
1342
1369
 
1343
1370
  # SplToken: ThawAccount
@@ -1350,7 +1377,7 @@ var instructionTypeDefs = (
1350
1377
  type SplTokenThawAccountInstruction implements TransactionInstruction {
1351
1378
  data: SplTokenThawAccountInstructionData
1352
1379
  meta: JsonParsedInstructionMeta
1353
- programId: String
1380
+ programId: Address
1354
1381
  }
1355
1382
 
1356
1383
  # SplToken: TransferChecked
@@ -1367,7 +1394,7 @@ var instructionTypeDefs = (
1367
1394
  type SplTokenTransferCheckedInstruction implements TransactionInstruction {
1368
1395
  data: SplTokenTransferCheckedInstructionData
1369
1396
  meta: JsonParsedInstructionMeta
1370
- programId: String
1397
+ programId: Address
1371
1398
  }
1372
1399
 
1373
1400
  # SplToken: ApproveChecked
@@ -1382,7 +1409,7 @@ var instructionTypeDefs = (
1382
1409
  type SplTokenApproveCheckedInstruction implements TransactionInstruction {
1383
1410
  data: SplTokenApproveCheckedInstructionData
1384
1411
  meta: JsonParsedInstructionMeta
1385
- programId: String
1412
+ programId: Address
1386
1413
  }
1387
1414
 
1388
1415
  # SplToken: MintToChecked
@@ -1397,7 +1424,7 @@ var instructionTypeDefs = (
1397
1424
  type SplTokenMintToCheckedInstruction implements TransactionInstruction {
1398
1425
  data: SplTokenMintToCheckedInstructionData
1399
1426
  meta: JsonParsedInstructionMeta
1400
- programId: String
1427
+ programId: Address
1401
1428
  }
1402
1429
 
1403
1430
  # SplToken: BurnChecked
@@ -1411,7 +1438,7 @@ var instructionTypeDefs = (
1411
1438
  type SplTokenBurnCheckedInstruction implements TransactionInstruction {
1412
1439
  data: SplTokenBurnCheckedInstructionData
1413
1440
  meta: JsonParsedInstructionMeta
1414
- programId: String
1441
+ programId: Address
1415
1442
  }
1416
1443
 
1417
1444
  # SplToken: SyncNative
@@ -1421,7 +1448,7 @@ var instructionTypeDefs = (
1421
1448
  type SplTokenSyncNativeInstruction implements TransactionInstruction {
1422
1449
  data: SplTokenSyncNativeInstructionData
1423
1450
  meta: JsonParsedInstructionMeta
1424
- programId: String
1451
+ programId: Address
1425
1452
  }
1426
1453
 
1427
1454
  # SplToken: GetAccountDataSize
@@ -1432,7 +1459,7 @@ var instructionTypeDefs = (
1432
1459
  type SplTokenGetAccountDataSizeInstruction implements TransactionInstruction {
1433
1460
  data: SplTokenGetAccountDataSizeInstructionData
1434
1461
  meta: JsonParsedInstructionMeta
1435
- programId: String
1462
+ programId: Address
1436
1463
  }
1437
1464
 
1438
1465
  # SplToken: InitializeImmutableOwner
@@ -1442,7 +1469,7 @@ var instructionTypeDefs = (
1442
1469
  type SplTokenInitializeImmutableOwnerInstruction implements TransactionInstruction {
1443
1470
  data: SplTokenInitializeImmutableOwnerInstructionData
1444
1471
  meta: JsonParsedInstructionMeta
1445
- programId: String
1472
+ programId: Address
1446
1473
  }
1447
1474
 
1448
1475
  # SplToken: AmountToUiAmount
@@ -1453,7 +1480,7 @@ var instructionTypeDefs = (
1453
1480
  type SplTokenAmountToUiAmountInstruction implements TransactionInstruction {
1454
1481
  data: SplTokenAmountToUiAmountInstructionData
1455
1482
  meta: JsonParsedInstructionMeta
1456
- programId: String
1483
+ programId: Address
1457
1484
  }
1458
1485
 
1459
1486
  # SplToken: UiAmountToAmount
@@ -1464,7 +1491,7 @@ var instructionTypeDefs = (
1464
1491
  type SplTokenUiAmountToAmountInstruction implements TransactionInstruction {
1465
1492
  data: SplTokenUiAmountToAmountInstructionData
1466
1493
  meta: JsonParsedInstructionMeta
1467
- programId: String
1494
+ programId: Address
1468
1495
  }
1469
1496
 
1470
1497
  # SplToken: InitializeMintCloseAuthority
@@ -1475,7 +1502,7 @@ var instructionTypeDefs = (
1475
1502
  type SplTokenInitializeMintCloseAuthorityInstruction implements TransactionInstruction {
1476
1503
  data: SplTokenInitializeMintCloseAuthorityInstructionData
1477
1504
  meta: JsonParsedInstructionMeta
1478
- programId: String
1505
+ programId: Address
1479
1506
  }
1480
1507
 
1481
1508
  # TODO: Extensions!
@@ -1508,20 +1535,20 @@ var instructionTypeDefs = (
1508
1535
  type StakeInitializeInstructionData {
1509
1536
  authorized: StakeInitializeInstructionDataAuthorized
1510
1537
  lockup: Lockup
1511
- rentSysvar: String
1538
+ rentSysvar: Address
1512
1539
  stakeAccount: Account
1513
1540
  }
1514
1541
  type StakeInitializeInstruction implements TransactionInstruction {
1515
1542
  data: StakeInitializeInstructionData
1516
1543
  meta: JsonParsedInstructionMeta
1517
- programId: String
1544
+ programId: Address
1518
1545
  }
1519
1546
 
1520
1547
  # Stake: Authorize
1521
1548
  type StakeAuthorizeInstructionData {
1522
1549
  authority: Account
1523
1550
  authorityType: String
1524
- clockSysvar: String
1551
+ clockSysvar: Address
1525
1552
  custodian: Account
1526
1553
  newAuthority: Account
1527
1554
  stakeAccount: Account
@@ -1529,22 +1556,22 @@ var instructionTypeDefs = (
1529
1556
  type StakeAuthorizeInstruction implements TransactionInstruction {
1530
1557
  data: StakeAuthorizeInstructionData
1531
1558
  meta: JsonParsedInstructionMeta
1532
- programId: String
1559
+ programId: Address
1533
1560
  }
1534
1561
 
1535
1562
  # Stake: DelegateStake
1536
1563
  type StakeDelegateStakeInstructionData {
1537
- clockSysvar: String
1564
+ clockSysvar: Address
1538
1565
  stakeAccount: Account
1539
1566
  stakeAuthority: Account
1540
1567
  stakeConfigAccount: Account
1541
- stakeHistorySysvar: String
1568
+ stakeHistorySysvar: Address
1542
1569
  voteAccount: Account
1543
1570
  }
1544
1571
  type StakeDelegateStakeInstruction implements TransactionInstruction {
1545
1572
  data: StakeDelegateStakeInstructionData
1546
1573
  meta: JsonParsedInstructionMeta
1547
- programId: String
1574
+ programId: Address
1548
1575
  }
1549
1576
 
1550
1577
  # Stake: Split
@@ -1557,12 +1584,12 @@ var instructionTypeDefs = (
1557
1584
  type StakeSplitInstruction implements TransactionInstruction {
1558
1585
  data: StakeSplitInstructionData
1559
1586
  meta: JsonParsedInstructionMeta
1560
- programId: String
1587
+ programId: Address
1561
1588
  }
1562
1589
 
1563
1590
  # Stake: Withdraw
1564
1591
  type StakeWithdrawInstructionData {
1565
- clockSysvar: String
1592
+ clockSysvar: Address
1566
1593
  destination: Account
1567
1594
  lamports: BigInt
1568
1595
  stakeAccount: Account
@@ -1571,19 +1598,19 @@ var instructionTypeDefs = (
1571
1598
  type StakeWithdrawInstruction implements TransactionInstruction {
1572
1599
  data: StakeWithdrawInstructionData
1573
1600
  meta: JsonParsedInstructionMeta
1574
- programId: String
1601
+ programId: Address
1575
1602
  }
1576
1603
 
1577
1604
  # Stake: Deactivate
1578
1605
  type StakeDeactivateInstructionData {
1579
- clockSysvar: String
1606
+ clockSysvar: Address
1580
1607
  stakeAccount: Account
1581
1608
  stakeAuthority: Account
1582
1609
  }
1583
1610
  type StakeDeactivateInstruction implements TransactionInstruction {
1584
1611
  data: StakeDeactivateInstructionData
1585
1612
  meta: JsonParsedInstructionMeta
1586
- programId: String
1613
+ programId: Address
1587
1614
  }
1588
1615
 
1589
1616
  # Stake: SetLockup
@@ -1595,21 +1622,21 @@ var instructionTypeDefs = (
1595
1622
  type StakeSetLockupInstruction implements TransactionInstruction {
1596
1623
  data: StakeSetLockupInstructionData
1597
1624
  meta: JsonParsedInstructionMeta
1598
- programId: String
1625
+ programId: Address
1599
1626
  }
1600
1627
 
1601
1628
  # Stake: Merge
1602
1629
  type StakeMergeInstructionData {
1603
- clockSysvar: String
1630
+ clockSysvar: Address
1604
1631
  destination: Account
1605
1632
  source: Account
1606
1633
  stakeAuthority: Account
1607
- stakeHistorySysvar: String
1634
+ stakeHistorySysvar: Address
1608
1635
  }
1609
1636
  type StakeMergeInstruction implements TransactionInstruction {
1610
1637
  data: StakeMergeInstructionData
1611
1638
  meta: JsonParsedInstructionMeta
1612
- programId: String
1639
+ programId: Address
1613
1640
  }
1614
1641
 
1615
1642
  # Stake: AuthorizeWithSeed
@@ -1618,7 +1645,7 @@ var instructionTypeDefs = (
1618
1645
  authorityOwner: Account
1619
1646
  authoritySeed: String
1620
1647
  authorityType: String
1621
- clockSysvar: String
1648
+ clockSysvar: Address
1622
1649
  custodian: Account
1623
1650
  newAuthorized: Account
1624
1651
  stakeAccount: Account
@@ -1626,12 +1653,12 @@ var instructionTypeDefs = (
1626
1653
  type StakeAuthorizeWithSeedInstruction implements TransactionInstruction {
1627
1654
  data: StakeAuthorizeWithSeedInstructionData
1628
1655
  meta: JsonParsedInstructionMeta
1629
- programId: String
1656
+ programId: Address
1630
1657
  }
1631
1658
 
1632
1659
  # Stake: InitializeChecked
1633
1660
  type StakeInitializeCheckedInstructionDataAuthorized {
1634
- rentSysvar: String
1661
+ rentSysvar: Address
1635
1662
  stakeAccount: Account
1636
1663
  staker: Account
1637
1664
  withdrawer: Account
@@ -1639,14 +1666,14 @@ var instructionTypeDefs = (
1639
1666
  type StakeInitializeCheckedInstruction implements TransactionInstruction {
1640
1667
  data: StakeInitializeCheckedInstructionDataAuthorized
1641
1668
  meta: JsonParsedInstructionMeta
1642
- programId: String
1669
+ programId: Address
1643
1670
  }
1644
1671
 
1645
1672
  # Stake: AuthorizeChecked
1646
1673
  type StakeAuthorizeCheckedInstructionData {
1647
1674
  authority: Account
1648
1675
  authorityType: String
1649
- clockSysvar: String
1676
+ clockSysvar: Address
1650
1677
  custodian: Account
1651
1678
  newAuthority: Account
1652
1679
  stakeAccount: Account
@@ -1654,7 +1681,7 @@ var instructionTypeDefs = (
1654
1681
  type StakeAuthorizeCheckedInstruction implements TransactionInstruction {
1655
1682
  data: StakeAuthorizeCheckedInstructionData
1656
1683
  meta: JsonParsedInstructionMeta
1657
- programId: String
1684
+ programId: Address
1658
1685
  }
1659
1686
 
1660
1687
  # Stake: AuthorizeCheckedWithSeed
@@ -1663,7 +1690,7 @@ var instructionTypeDefs = (
1663
1690
  authorityOwner: Account
1664
1691
  authoritySeed: String
1665
1692
  authorityType: String
1666
- clockSysvar: String
1693
+ clockSysvar: Address
1667
1694
  custodian: Account
1668
1695
  newAuthorized: Account
1669
1696
  stakeAccount: Account
@@ -1671,7 +1698,7 @@ var instructionTypeDefs = (
1671
1698
  type StakeAuthorizeCheckedWithSeedInstruction implements TransactionInstruction {
1672
1699
  data: StakeAuthorizeCheckedWithSeedInstructionData
1673
1700
  meta: JsonParsedInstructionMeta
1674
- programId: String
1701
+ programId: Address
1675
1702
  }
1676
1703
 
1677
1704
  # Stake: SetLockupChecked
@@ -1683,7 +1710,7 @@ var instructionTypeDefs = (
1683
1710
  type StakeSetLockupCheckedInstruction implements TransactionInstruction {
1684
1711
  data: StakeSetLockupCheckedInstructionData
1685
1712
  meta: JsonParsedInstructionMeta
1686
- programId: String
1713
+ programId: Address
1687
1714
  }
1688
1715
 
1689
1716
  # Stake: DeactivateDelinquent
@@ -1695,7 +1722,7 @@ var instructionTypeDefs = (
1695
1722
  type StakeDeactivateDelinquentInstruction implements TransactionInstruction {
1696
1723
  data: StakeDeactivateDelinquentInstructionData
1697
1724
  meta: JsonParsedInstructionMeta
1698
- programId: String
1725
+ programId: Address
1699
1726
  }
1700
1727
 
1701
1728
  # Stake: Redelegate
@@ -1709,7 +1736,7 @@ var instructionTypeDefs = (
1709
1736
  type StakeRedelegateInstruction implements TransactionInstruction {
1710
1737
  data: StakeRedelegateInstructionData
1711
1738
  meta: JsonParsedInstructionMeta
1712
- programId: String
1739
+ programId: Address
1713
1740
  }
1714
1741
 
1715
1742
  # System: CreateAccount
@@ -1723,7 +1750,7 @@ var instructionTypeDefs = (
1723
1750
  type CreateAccountInstruction implements TransactionInstruction {
1724
1751
  data: CreateAccountInstructionData
1725
1752
  meta: JsonParsedInstructionMeta
1726
- programId: String
1753
+ programId: Address
1727
1754
  }
1728
1755
 
1729
1756
  # System: Assign
@@ -1734,7 +1761,7 @@ var instructionTypeDefs = (
1734
1761
  type AssignInstruction implements TransactionInstruction {
1735
1762
  data: AssignInstructionData
1736
1763
  meta: JsonParsedInstructionMeta
1737
- programId: String
1764
+ programId: Address
1738
1765
  }
1739
1766
 
1740
1767
  # System: Transfer
@@ -1746,7 +1773,7 @@ var instructionTypeDefs = (
1746
1773
  type TransferInstruction implements TransactionInstruction {
1747
1774
  data: TransferInstructionData
1748
1775
  meta: JsonParsedInstructionMeta
1749
- programId: String
1776
+ programId: Address
1750
1777
  }
1751
1778
 
1752
1779
  # System: CreateAccountWithSeed
@@ -1760,19 +1787,19 @@ var instructionTypeDefs = (
1760
1787
  type CreateAccountWithSeedInstruction implements TransactionInstruction {
1761
1788
  data: CreateAccountWithSeedInstructionData
1762
1789
  meta: JsonParsedInstructionMeta
1763
- programId: String
1790
+ programId: Address
1764
1791
  }
1765
1792
 
1766
1793
  # System: AdvanceNonceAccount
1767
1794
  type AdvanceNonceAccountInstructionData {
1768
1795
  nonceAccount: Account
1769
1796
  nonceAuthority: Account
1770
- recentBlockhashesSysvar: String
1797
+ recentBlockhashesSysvar: Address
1771
1798
  }
1772
1799
  type AdvanceNonceAccountInstruction implements TransactionInstruction {
1773
1800
  data: AdvanceNonceAccountInstructionData
1774
1801
  meta: JsonParsedInstructionMeta
1775
- programId: String
1802
+ programId: Address
1776
1803
  }
1777
1804
 
1778
1805
  # System: WithdrawNonceAccount
@@ -1781,26 +1808,26 @@ var instructionTypeDefs = (
1781
1808
  lamports: BigInt
1782
1809
  nonceAccount: Account
1783
1810
  nonceAuthority: Account
1784
- recentBlockhashesSysvar: String
1785
- rentSysvar: String
1811
+ recentBlockhashesSysvar: Address
1812
+ rentSysvar: Address
1786
1813
  }
1787
1814
  type WithdrawNonceAccountInstruction implements TransactionInstruction {
1788
1815
  data: WithdrawNonceAccountInstructionData
1789
1816
  meta: JsonParsedInstructionMeta
1790
- programId: String
1817
+ programId: Address
1791
1818
  }
1792
1819
 
1793
1820
  # System: InitializeNonceAccount
1794
1821
  type InitializeNonceAccountInstructionData {
1795
1822
  nonceAccount: Account
1796
1823
  nonceAuthority: Account
1797
- recentBlockhashesSysvar: String
1798
- rentSysvar: String
1824
+ recentBlockhashesSysvar: Address
1825
+ rentSysvar: Address
1799
1826
  }
1800
1827
  type InitializeNonceAccountInstruction implements TransactionInstruction {
1801
1828
  data: InitializeNonceAccountInstructionData
1802
1829
  meta: JsonParsedInstructionMeta
1803
- programId: String
1830
+ programId: Address
1804
1831
  }
1805
1832
 
1806
1833
  # System: AuthorizeNonceAccount
@@ -1812,7 +1839,7 @@ var instructionTypeDefs = (
1812
1839
  type AuthorizeNonceAccountInstruction implements TransactionInstruction {
1813
1840
  data: AuthorizeNonceAccountInstructionData
1814
1841
  meta: JsonParsedInstructionMeta
1815
- programId: String
1842
+ programId: Address
1816
1843
  }
1817
1844
 
1818
1845
  # System: UpgradeNonceAccount
@@ -1823,7 +1850,7 @@ var instructionTypeDefs = (
1823
1850
  type UpgradeNonceAccountInstruction implements TransactionInstruction {
1824
1851
  data: UpgradeNonceAccountInstructionData
1825
1852
  meta: JsonParsedInstructionMeta
1826
- programId: String
1853
+ programId: Address
1827
1854
  }
1828
1855
 
1829
1856
  # System: Allocate
@@ -1834,13 +1861,13 @@ var instructionTypeDefs = (
1834
1861
  type AllocateInstruction implements TransactionInstruction {
1835
1862
  data: AllocateInstructionData
1836
1863
  meta: JsonParsedInstructionMeta
1837
- programId: String
1864
+ programId: Address
1838
1865
  }
1839
1866
 
1840
1867
  # System: AllocateWithSeed
1841
1868
  type AllocateWithSeedInstructionData {
1842
1869
  account: Account
1843
- base: String
1870
+ base: Address
1844
1871
  owner: Account
1845
1872
  seed: String
1846
1873
  space: BigInt
@@ -1848,20 +1875,20 @@ var instructionTypeDefs = (
1848
1875
  type AllocateWithSeedInstruction implements TransactionInstruction {
1849
1876
  data: AllocateWithSeedInstructionData
1850
1877
  meta: JsonParsedInstructionMeta
1851
- programId: String
1878
+ programId: Address
1852
1879
  }
1853
1880
 
1854
1881
  # System: AssignWithSeed
1855
1882
  type AssignWithSeedInstructionData {
1856
1883
  account: Account
1857
- base: String
1884
+ base: Address
1858
1885
  owner: Account
1859
1886
  seed: String
1860
1887
  }
1861
1888
  type AssignWithSeedInstruction implements TransactionInstruction {
1862
1889
  data: AssignWithSeedInstructionData
1863
1890
  meta: JsonParsedInstructionMeta
1864
- programId: String
1891
+ programId: Address
1865
1892
  }
1866
1893
 
1867
1894
  # System: TransferWithSeed
@@ -1869,76 +1896,76 @@ var instructionTypeDefs = (
1869
1896
  destination: Account
1870
1897
  lamports: BigInt
1871
1898
  source: Account
1872
- sourceBase: String
1899
+ sourceBase: Address
1873
1900
  sourceOwner: Account
1874
1901
  sourceSeed: String
1875
1902
  }
1876
1903
  type TransferWithSeedInstruction implements TransactionInstruction {
1877
1904
  data: TransferWithSeedInstructionData
1878
1905
  meta: JsonParsedInstructionMeta
1879
- programId: String
1906
+ programId: Address
1880
1907
  }
1881
1908
 
1882
1909
  # Vote: InitializeAccount
1883
1910
  type VoteInitializeAccountInstructionData {
1884
1911
  authorizedVoter: Account
1885
1912
  authorizedWithdrawer: Account
1886
- clockSysvar: String
1913
+ clockSysvar: Address
1887
1914
  commission: BigInt # FIXME:*
1888
1915
  node: Account
1889
- rentSysvar: String
1916
+ rentSysvar: Address
1890
1917
  voteAccount: Account
1891
1918
  }
1892
1919
  type VoteInitializeAccountInstruction implements TransactionInstruction {
1893
1920
  data: VoteInitializeAccountInstructionData
1894
1921
  meta: JsonParsedInstructionMeta
1895
- programId: String
1922
+ programId: Address
1896
1923
  }
1897
1924
 
1898
1925
  # Vote: Authorize
1899
1926
  type VoteAuthorizeInstructionData {
1900
1927
  authority: Account
1901
1928
  authorityType: String
1902
- clockSysvar: String
1929
+ clockSysvar: Address
1903
1930
  newAuthority: Account
1904
1931
  voteAccount: Account
1905
1932
  }
1906
1933
  type VoteAuthorizeInstruction implements TransactionInstruction {
1907
1934
  data: VoteAuthorizeInstructionData
1908
1935
  meta: JsonParsedInstructionMeta
1909
- programId: String
1936
+ programId: Address
1910
1937
  }
1911
1938
 
1912
1939
  # Vote: AuthorizeWithSeed
1913
1940
  type VoteAuthorizeWithSeedInstructionData {
1914
- authorityBaseKey: String
1941
+ authorityBaseKey: Address
1915
1942
  authorityOwner: Account
1916
1943
  authoritySeed: String
1917
1944
  authorityType: String
1918
- clockSysvar: String
1945
+ clockSysvar: Address
1919
1946
  newAuthority: Account
1920
1947
  voteAccount: Account
1921
1948
  }
1922
1949
  type VoteAuthorizeWithSeedInstruction implements TransactionInstruction {
1923
1950
  data: VoteAuthorizeWithSeedInstructionData
1924
1951
  meta: JsonParsedInstructionMeta
1925
- programId: String
1952
+ programId: Address
1926
1953
  }
1927
1954
 
1928
1955
  # Vote: AuthorizeCheckedWithSeed
1929
1956
  type VoteAuthorizeCheckedWithSeedInstructionData {
1930
- authorityBaseKey: String
1957
+ authorityBaseKey: Address
1931
1958
  authorityOwner: Account
1932
1959
  authoritySeed: String
1933
1960
  authorityType: String
1934
- clockSysvar: String
1961
+ clockSysvar: Address
1935
1962
  newAuthority: Account
1936
1963
  voteAccount: Account
1937
1964
  }
1938
1965
  type VoteAuthorizeCheckedWithSeedInstruction implements TransactionInstruction {
1939
1966
  data: VoteAuthorizeCheckedWithSeedInstructionData
1940
1967
  meta: JsonParsedInstructionMeta
1941
- programId: String
1968
+ programId: Address
1942
1969
  }
1943
1970
 
1944
1971
  type Vote {
@@ -1949,8 +1976,8 @@ var instructionTypeDefs = (
1949
1976
 
1950
1977
  # Vote: Vote
1951
1978
  type VoteVoteInstructionData {
1952
- clockSysvar: String
1953
- slotHashesSysvar: String
1979
+ clockSysvar: Address
1980
+ slotHashesSysvar: Address
1954
1981
  vote: Vote
1955
1982
  voteAccount: Account
1956
1983
  voteAuthority: Account
@@ -1958,7 +1985,7 @@ var instructionTypeDefs = (
1958
1985
  type VoteVoteInstruction implements TransactionInstruction {
1959
1986
  data: VoteVoteInstructionData
1960
1987
  meta: JsonParsedInstructionMeta
1961
- programId: String
1988
+ programId: Address
1962
1989
  }
1963
1990
 
1964
1991
  type VoteStateUpdateLockout {
@@ -1982,7 +2009,7 @@ var instructionTypeDefs = (
1982
2009
  type VoteUpdateVoteStateInstruction implements TransactionInstruction {
1983
2010
  data: VoteUpdateVoteStateInstructionData
1984
2011
  meta: JsonParsedInstructionMeta
1985
- programId: String
2012
+ programId: Address
1986
2013
  }
1987
2014
 
1988
2015
  # Vote: UpdateVoteStateSwitch
@@ -1995,7 +2022,7 @@ var instructionTypeDefs = (
1995
2022
  type VoteUpdateVoteStateSwitchInstruction implements TransactionInstruction {
1996
2023
  data: VoteUpdateVoteStateSwitchInstructionData
1997
2024
  meta: JsonParsedInstructionMeta
1998
- programId: String
2025
+ programId: Address
1999
2026
  }
2000
2027
 
2001
2028
  # Vote: CompactUpdateVoteState
@@ -2008,7 +2035,7 @@ var instructionTypeDefs = (
2008
2035
  type VoteCompactUpdateVoteStateInstruction implements TransactionInstruction {
2009
2036
  data: VoteCompactUpdateVoteStateInstructionData
2010
2037
  meta: JsonParsedInstructionMeta
2011
- programId: String
2038
+ programId: Address
2012
2039
  }
2013
2040
 
2014
2041
  # Vote: CompactUpdateVoteStateSwitch
@@ -2021,7 +2048,7 @@ var instructionTypeDefs = (
2021
2048
  type VoteCompactUpdateVoteStateSwitchInstruction implements TransactionInstruction {
2022
2049
  data: VoteCompactUpdateVoteStateSwitchInstructionData
2023
2050
  meta: JsonParsedInstructionMeta
2024
- programId: String
2051
+ programId: Address
2025
2052
  }
2026
2053
 
2027
2054
  # Vote: Withdraw
@@ -2034,7 +2061,7 @@ var instructionTypeDefs = (
2034
2061
  type VoteWithdrawInstruction implements TransactionInstruction {
2035
2062
  data: VoteWithdrawInstructionData
2036
2063
  meta: JsonParsedInstructionMeta
2037
- programId: String
2064
+ programId: Address
2038
2065
  }
2039
2066
 
2040
2067
  # Vote: UpdateValidatorIdentity
@@ -2046,7 +2073,7 @@ var instructionTypeDefs = (
2046
2073
  type VoteUpdateValidatorIdentityInstruction implements TransactionInstruction {
2047
2074
  data: VoteUpdateValidatorIdentityInstructionData
2048
2075
  meta: JsonParsedInstructionMeta
2049
- programId: String
2076
+ programId: Address
2050
2077
  }
2051
2078
 
2052
2079
  # Vote: UpdateCommission
@@ -2058,14 +2085,14 @@ var instructionTypeDefs = (
2058
2085
  type VoteUpdateCommissionInstruction implements TransactionInstruction {
2059
2086
  data: VoteUpdateCommissionInstructionData
2060
2087
  meta: JsonParsedInstructionMeta
2061
- programId: String
2088
+ programId: Address
2062
2089
  }
2063
2090
 
2064
2091
  # Vote: VoteSwitch
2065
2092
  type VoteVoteSwitchInstructionData {
2066
- clockSysvar: String
2093
+ clockSysvar: Address
2067
2094
  hash: String
2068
- slotHashesSysvar: String
2095
+ slotHashesSysvar: Address
2069
2096
  vote: Vote
2070
2097
  voteAccount: Account
2071
2098
  voteAuthority: Account
@@ -2073,21 +2100,21 @@ var instructionTypeDefs = (
2073
2100
  type VoteVoteSwitchInstruction implements TransactionInstruction {
2074
2101
  data: VoteVoteSwitchInstructionData
2075
2102
  meta: JsonParsedInstructionMeta
2076
- programId: String
2103
+ programId: Address
2077
2104
  }
2078
2105
 
2079
2106
  # Vote: AuthorizeChecked
2080
2107
  type VoteAuthorizeCheckedInstructionData {
2081
2108
  authority: Account
2082
2109
  authorityType: String
2083
- clockSysvar: String
2110
+ clockSysvar: Address
2084
2111
  newAuthority: Account
2085
2112
  voteAccount: Account
2086
2113
  }
2087
2114
  type VoteAuthorizeCheckedInstruction implements TransactionInstruction {
2088
2115
  data: VoteAuthorizeCheckedInstructionData
2089
2116
  meta: JsonParsedInstructionMeta
2090
- programId: String
2117
+ programId: Address
2091
2118
  }
2092
2119
  `
2093
2120
  );
@@ -2847,14 +2874,14 @@ var transactionTypeDefs = (
2847
2874
  }
2848
2875
 
2849
2876
  type TransactionMessageAccountKey {
2850
- pubkey: String
2877
+ pubkey: Address
2851
2878
  signer: Boolean
2852
2879
  source: String
2853
2880
  writable: Boolean
2854
2881
  }
2855
2882
 
2856
2883
  type TransactionMessageAddressTableLookup {
2857
- accountKey: String
2884
+ accountKey: Address
2858
2885
  readableIndexes: [Int]
2859
2886
  writableIndexes: [Int]
2860
2887
  }
@@ -2876,7 +2903,7 @@ var transactionTypeDefs = (
2876
2903
  # Transaction interface
2877
2904
  interface Transaction {
2878
2905
  blockTime: String
2879
- encoding: String
2906
+ encoding: TransactionEncoding
2880
2907
  meta: TransactionMeta
2881
2908
  slot: BigInt
2882
2909
  version: String
@@ -2885,8 +2912,8 @@ var transactionTypeDefs = (
2885
2912
  # A transaction with base58 encoded data
2886
2913
  type TransactionBase58 implements Transaction {
2887
2914
  blockTime: String
2888
- data: String
2889
- encoding: String
2915
+ data: Base58EncodedBytes
2916
+ encoding: TransactionEncoding
2890
2917
  meta: TransactionMeta
2891
2918
  slot: BigInt
2892
2919
  version: String
@@ -2895,8 +2922,8 @@ var transactionTypeDefs = (
2895
2922
  # A transaction with base64 encoded data
2896
2923
  type TransactionBase64 implements Transaction {
2897
2924
  blockTime: String
2898
- data: String
2899
- encoding: String
2925
+ data: Base64EncodedBytes
2926
+ encoding: TransactionEncoding
2900
2927
  meta: TransactionMeta
2901
2928
  slot: BigInt
2902
2929
  version: String
@@ -2910,7 +2937,7 @@ var transactionTypeDefs = (
2910
2937
  type TransactionParsed implements Transaction {
2911
2938
  blockTime: String
2912
2939
  data: TransactionDataParsed
2913
- encoding: String
2940
+ encoding: TransactionEncoding
2914
2941
  meta: TransactionMeta
2915
2942
  slot: BigInt
2916
2943
  version: String
@@ -2973,16 +3000,16 @@ var schemaTypeDefs = (
2973
3000
  var schemaResolvers = {
2974
3001
  Query: {
2975
3002
  account(_, args, context, info) {
2976
- return context.accountLoader.load(args, info);
3003
+ return context.loaders.account.load(args, info);
2977
3004
  },
2978
3005
  block(_, args, context, info) {
2979
- return context.loadBlock(args, info);
3006
+ return context.loaders.block.load(args, info);
2980
3007
  },
2981
3008
  programAccounts(_, args, context, info) {
2982
- return context.loadProgramAccounts(args, info);
3009
+ return context.loaders.programAccounts.load(args, info);
2983
3010
  },
2984
3011
  transaction(_, args, context, info) {
2985
- return context.loadTransaction(args, info);
3012
+ return context.loaders.transaction.load(args, info);
2986
3013
  }
2987
3014
  }
2988
3015
  };
@@ -3018,14 +3045,12 @@ function createRpcGraphQL(rpc) {
3018
3045
  return {
3019
3046
  context,
3020
3047
  async query(source, variableValues) {
3021
- const result = await graphql({
3048
+ return graphql({
3022
3049
  contextValue: this.context,
3023
3050
  schema: this.schema,
3024
3051
  source,
3025
3052
  variableValues
3026
3053
  });
3027
- this.context.cache.flush();
3028
- return result;
3029
3054
  },
3030
3055
  schema
3031
3056
  };