@solana/rpc-graphql 2.0.0-experimental.eb5fd16 → 2.0.0-experimental.fc4e943
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.
- package/LICENSE +1 -1
- package/dist/index.browser.cjs +2128 -3
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +2129 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +2129 -4
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +2128 -3
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +2129 -4
- package/dist/index.node.js.map +1 -1
- package/dist/types/context.d.ts +13 -0
- package/dist/types/schema/account/index.d.ts +3 -0
- package/dist/types/schema/account/query.d.ts +38 -0
- package/dist/types/schema/account/types.d.ts +5 -0
- package/dist/types/schema/block/index.d.ts +3 -0
- package/dist/types/schema/block/query.d.ts +42 -0
- package/dist/types/schema/block/types.d.ts +7 -0
- package/dist/types/schema/inputs.d.ts +9 -0
- package/dist/types/schema/picks.d.ts +36 -0
- package/dist/types/schema/program-accounts/index.d.ts +2 -0
- package/dist/types/schema/program-accounts/query.d.ts +47 -0
- package/dist/types/schema/program-accounts/types.d.ts +3 -0
- package/dist/types/schema/scalars.d.ts +3 -0
- package/dist/types/schema/transaction/index.d.ts +3 -0
- package/dist/types/schema/transaction/query.d.ts +33 -0
- package/dist/types/schema/transaction/types.d.ts +12 -0
- package/package.json +8 -7
package/dist/index.node.cjs
CHANGED
|
@@ -36,10 +36,2132 @@ function createGraphQLCache() {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// src/context.ts
|
|
39
|
+
async function resolveAccount({ address, encoding = "jsonParsed", ...config }, cache, rpc) {
|
|
40
|
+
const requestConfig = { encoding, ...config };
|
|
41
|
+
const cached = cache.get(address, requestConfig);
|
|
42
|
+
if (cached !== null) {
|
|
43
|
+
return cached;
|
|
44
|
+
}
|
|
45
|
+
const account = await rpc.getAccountInfo(address, requestConfig).send().then((res) => res.value).catch((e) => {
|
|
46
|
+
throw e;
|
|
47
|
+
});
|
|
48
|
+
if (account === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const [data, responseEncoding] = Array.isArray(account.data) ? encoding === "jsonParsed" ? [account.data[0], "base64"] : [account.data[0], encoding] : [account.data, "jsonParsed"];
|
|
52
|
+
const queryResponse = {
|
|
53
|
+
...account,
|
|
54
|
+
data,
|
|
55
|
+
encoding: responseEncoding
|
|
56
|
+
};
|
|
57
|
+
cache.insert(address, requestConfig, queryResponse);
|
|
58
|
+
return queryResponse;
|
|
59
|
+
}
|
|
60
|
+
async function resolveBlock({ slot, encoding = "jsonParsed", ...config }, cache, rpc) {
|
|
61
|
+
const requestConfig = { encoding, ...config };
|
|
62
|
+
const cached = cache.get(slot, config);
|
|
63
|
+
if (cached !== null) {
|
|
64
|
+
return cached;
|
|
65
|
+
}
|
|
66
|
+
const block = await rpc.getBlock(slot, requestConfig).send();
|
|
67
|
+
if (block === null) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
cache.insert(slot, config, block);
|
|
71
|
+
return block;
|
|
72
|
+
}
|
|
73
|
+
async function resolveProgramAccounts({ programAddress, encoding = "jsonParsed", ...config }, cache, rpc) {
|
|
74
|
+
const requestConfig = { encoding, ...config };
|
|
75
|
+
const cached = cache.get(programAddress, requestConfig);
|
|
76
|
+
if (cached !== null) {
|
|
77
|
+
return cached;
|
|
78
|
+
}
|
|
79
|
+
const programAccounts = await rpc.getProgramAccounts(programAddress, requestConfig).send().then((res) => {
|
|
80
|
+
if ("value" in res) {
|
|
81
|
+
return res.value;
|
|
82
|
+
}
|
|
83
|
+
return res;
|
|
84
|
+
}).catch((e) => {
|
|
85
|
+
throw e;
|
|
86
|
+
});
|
|
87
|
+
const queryResponse = programAccounts.map((programAccount2) => {
|
|
88
|
+
const [data, responseEncoding] = Array.isArray(programAccount2.account.data) ? encoding === "jsonParsed" ? [programAccount2.account.data[0], "base64"] : [programAccount2.account.data[0], encoding] : [programAccount2.account.data, "jsonParsed"];
|
|
89
|
+
const pubkey = programAccount2.pubkey;
|
|
90
|
+
const account = { ...programAccount2.account, data, encoding: responseEncoding };
|
|
91
|
+
return {
|
|
92
|
+
account,
|
|
93
|
+
pubkey
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
cache.insert(programAddress, requestConfig, queryResponse);
|
|
97
|
+
return queryResponse;
|
|
98
|
+
}
|
|
99
|
+
async function resolveTransaction({ signature, encoding = "jsonParsed", ...config }, cache, rpc) {
|
|
100
|
+
const requestConfig = { encoding, ...config };
|
|
101
|
+
const cached = cache.get(signature, requestConfig);
|
|
102
|
+
if (cached !== null) {
|
|
103
|
+
return cached;
|
|
104
|
+
}
|
|
105
|
+
const transaction = await rpc.getTransaction(signature, requestConfig).send();
|
|
106
|
+
if (transaction === null) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const [transactionData, responseEncoding, responseFormat] = Array.isArray(transaction.transaction) ? encoding === "jsonParsed" ? [transaction.transaction[0], "base64", "unparsed"] : [transaction.transaction[0], encoding, "unparsed"] : encoding === "jsonParsed" ? [transaction.transaction, encoding, "parsed"] : [transaction.transaction, encoding, "unparsed"];
|
|
110
|
+
if (transaction.meta) {
|
|
111
|
+
transaction.meta["format"] = responseFormat;
|
|
112
|
+
}
|
|
113
|
+
if (transactionData.message) {
|
|
114
|
+
transactionData.message["format"] = responseFormat;
|
|
115
|
+
}
|
|
116
|
+
const queryResponse = {
|
|
117
|
+
...transaction,
|
|
118
|
+
encoding: responseEncoding,
|
|
119
|
+
transaction: transactionData
|
|
120
|
+
};
|
|
121
|
+
cache.insert(signature, requestConfig, queryResponse);
|
|
122
|
+
return queryResponse;
|
|
123
|
+
}
|
|
39
124
|
function createSolanaGraphQLContext(rpc) {
|
|
40
125
|
const cache = createGraphQLCache();
|
|
41
|
-
return {
|
|
126
|
+
return {
|
|
127
|
+
cache,
|
|
128
|
+
resolveAccount(args) {
|
|
129
|
+
return resolveAccount(args, this.cache, this.rpc);
|
|
130
|
+
},
|
|
131
|
+
resolveBlock(args) {
|
|
132
|
+
return resolveBlock(args, this.cache, this.rpc);
|
|
133
|
+
},
|
|
134
|
+
resolveProgramAccounts(args) {
|
|
135
|
+
return resolveProgramAccounts(args, this.cache, this.rpc);
|
|
136
|
+
},
|
|
137
|
+
resolveTransaction(args) {
|
|
138
|
+
return resolveTransaction(args, this.cache, this.rpc);
|
|
139
|
+
},
|
|
140
|
+
rpc
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
var BigIntScalar = () => new graphql.GraphQLScalarType({
|
|
144
|
+
name: "BigInt",
|
|
145
|
+
parseLiteral(ast) {
|
|
146
|
+
if (ast.kind === graphql.Kind.STRING) {
|
|
147
|
+
return BigInt(ast.value);
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
},
|
|
151
|
+
parseValue(value) {
|
|
152
|
+
return BigInt(value);
|
|
153
|
+
},
|
|
154
|
+
serialize(value) {
|
|
155
|
+
return BigInt(value);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// src/schema/picks.ts
|
|
160
|
+
function boolean() {
|
|
161
|
+
return { type: graphql.GraphQLBoolean };
|
|
162
|
+
}
|
|
163
|
+
var memoisedBigint;
|
|
164
|
+
function bigint() {
|
|
165
|
+
if (!memoisedBigint)
|
|
166
|
+
memoisedBigint = { type: BigIntScalar() };
|
|
167
|
+
return memoisedBigint;
|
|
168
|
+
}
|
|
169
|
+
function number() {
|
|
170
|
+
return { type: graphql.GraphQLInt };
|
|
42
171
|
}
|
|
172
|
+
function string() {
|
|
173
|
+
return { type: graphql.GraphQLString };
|
|
174
|
+
}
|
|
175
|
+
function type(fieldType) {
|
|
176
|
+
return {
|
|
177
|
+
type: fieldType
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function nonNull(fieldType) {
|
|
181
|
+
return {
|
|
182
|
+
type: new graphql.GraphQLNonNull(fieldType.type)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function list(elementType) {
|
|
186
|
+
return {
|
|
187
|
+
type: new graphql.GraphQLList(elementType.type)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function object(name, fields) {
|
|
191
|
+
return {
|
|
192
|
+
type: new graphql.GraphQLObjectType({
|
|
193
|
+
fields,
|
|
194
|
+
name
|
|
195
|
+
})
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/schema/inputs.ts
|
|
200
|
+
var memoisedAccountEncodingInputType;
|
|
201
|
+
var accountEncodingInputType = () => {
|
|
202
|
+
if (!memoisedAccountEncodingInputType)
|
|
203
|
+
memoisedAccountEncodingInputType = new graphql.GraphQLEnumType({
|
|
204
|
+
name: "AccountEncoding",
|
|
205
|
+
values: {
|
|
206
|
+
base58: {
|
|
207
|
+
value: "base58"
|
|
208
|
+
},
|
|
209
|
+
base64: {
|
|
210
|
+
value: "base64"
|
|
211
|
+
},
|
|
212
|
+
base64Zstd: {
|
|
213
|
+
value: "base64+zstd"
|
|
214
|
+
},
|
|
215
|
+
jsonParsed: {
|
|
216
|
+
value: "jsonParsed"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return memoisedAccountEncodingInputType;
|
|
221
|
+
};
|
|
222
|
+
var memoisedBlockTransactionDetailsInputType;
|
|
223
|
+
var blockTransactionDetailsInputType = () => {
|
|
224
|
+
if (!memoisedBlockTransactionDetailsInputType)
|
|
225
|
+
memoisedBlockTransactionDetailsInputType = new graphql.GraphQLEnumType({
|
|
226
|
+
name: "BlockTransactionDetails",
|
|
227
|
+
values: {
|
|
228
|
+
accounts: {
|
|
229
|
+
value: "accounts"
|
|
230
|
+
},
|
|
231
|
+
full: {
|
|
232
|
+
value: "full"
|
|
233
|
+
},
|
|
234
|
+
none: {
|
|
235
|
+
value: "none"
|
|
236
|
+
},
|
|
237
|
+
signatures: {
|
|
238
|
+
value: "signatures"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
return memoisedBlockTransactionDetailsInputType;
|
|
243
|
+
};
|
|
244
|
+
var memoisedCommitmentInputType;
|
|
245
|
+
var commitmentInputType = () => {
|
|
246
|
+
if (!memoisedCommitmentInputType)
|
|
247
|
+
memoisedCommitmentInputType = new graphql.GraphQLEnumType({
|
|
248
|
+
name: "Commitment",
|
|
249
|
+
values: {
|
|
250
|
+
confirmed: {
|
|
251
|
+
value: "confirmed"
|
|
252
|
+
},
|
|
253
|
+
finalized: {
|
|
254
|
+
value: "finalized"
|
|
255
|
+
},
|
|
256
|
+
processed: {
|
|
257
|
+
value: "processed"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return memoisedCommitmentInputType;
|
|
262
|
+
};
|
|
263
|
+
var memoisedDataSliceInputType;
|
|
264
|
+
var dataSliceInputType = () => {
|
|
265
|
+
if (!memoisedDataSliceInputType)
|
|
266
|
+
memoisedDataSliceInputType = new graphql.GraphQLInputObjectType({
|
|
267
|
+
fields: {
|
|
268
|
+
length: number(),
|
|
269
|
+
offset: number()
|
|
270
|
+
},
|
|
271
|
+
name: "DataSliceConfig"
|
|
272
|
+
});
|
|
273
|
+
return memoisedDataSliceInputType;
|
|
274
|
+
};
|
|
275
|
+
var memoisedMaxSupportedTransactionVersionInputType;
|
|
276
|
+
var maxSupportedTransactionVersionInputType = () => {
|
|
277
|
+
if (!memoisedMaxSupportedTransactionVersionInputType)
|
|
278
|
+
memoisedMaxSupportedTransactionVersionInputType = new graphql.GraphQLEnumType({
|
|
279
|
+
name: "MaxSupportedTransactionVersion",
|
|
280
|
+
values: {
|
|
281
|
+
legacy: {
|
|
282
|
+
value: "legacy"
|
|
283
|
+
},
|
|
284
|
+
zero: {
|
|
285
|
+
value: "0"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return memoisedMaxSupportedTransactionVersionInputType;
|
|
290
|
+
};
|
|
291
|
+
var memoisedProgramAccountFilterInputType;
|
|
292
|
+
var programAccountFilterInputType = () => {
|
|
293
|
+
if (!memoisedProgramAccountFilterInputType)
|
|
294
|
+
memoisedProgramAccountFilterInputType = new graphql.GraphQLInputObjectType({
|
|
295
|
+
fields: {
|
|
296
|
+
bytes: bigint(),
|
|
297
|
+
dataSize: bigint(),
|
|
298
|
+
encoding: string(),
|
|
299
|
+
offset: bigint()
|
|
300
|
+
},
|
|
301
|
+
name: "ProgramAccountFilter"
|
|
302
|
+
});
|
|
303
|
+
return memoisedProgramAccountFilterInputType;
|
|
304
|
+
};
|
|
305
|
+
var memoisedTransactionEncodingInputType;
|
|
306
|
+
var transactionEncodingInputType = () => {
|
|
307
|
+
if (!memoisedTransactionEncodingInputType)
|
|
308
|
+
memoisedTransactionEncodingInputType = new graphql.GraphQLEnumType({
|
|
309
|
+
name: "TransactionEncoding",
|
|
310
|
+
values: {
|
|
311
|
+
base58: {
|
|
312
|
+
value: "base58"
|
|
313
|
+
},
|
|
314
|
+
base64: {
|
|
315
|
+
value: "base64"
|
|
316
|
+
},
|
|
317
|
+
json: {
|
|
318
|
+
value: "json"
|
|
319
|
+
},
|
|
320
|
+
jsonParsed: {
|
|
321
|
+
value: "jsonParsed"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
return memoisedTransactionEncodingInputType;
|
|
326
|
+
};
|
|
327
|
+
var memoisedTokenAmountType;
|
|
328
|
+
var tokenAmountType = () => {
|
|
329
|
+
if (!memoisedTokenAmountType) {
|
|
330
|
+
memoisedTokenAmountType = new graphql.GraphQLObjectType({
|
|
331
|
+
fields: {
|
|
332
|
+
amount: string(),
|
|
333
|
+
decimals: number(),
|
|
334
|
+
uiAmount: bigint(),
|
|
335
|
+
uiAmountString: string()
|
|
336
|
+
},
|
|
337
|
+
name: "TokenAmount"
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
return memoisedTokenAmountType;
|
|
341
|
+
};
|
|
342
|
+
var memoisedAccountInterfaceFields;
|
|
343
|
+
var accountInterfaceFields = () => {
|
|
344
|
+
if (!memoisedAccountInterfaceFields) {
|
|
345
|
+
memoisedAccountInterfaceFields = {
|
|
346
|
+
encoding: string(),
|
|
347
|
+
executable: boolean(),
|
|
348
|
+
lamports: bigint(),
|
|
349
|
+
rentEpoch: bigint()
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
return memoisedAccountInterfaceFields;
|
|
353
|
+
};
|
|
354
|
+
var memoisedAccountInterface;
|
|
355
|
+
var accountInterface = () => {
|
|
356
|
+
if (!memoisedAccountInterface) {
|
|
357
|
+
memoisedAccountInterface = new graphql.GraphQLInterfaceType({
|
|
358
|
+
description: "A Solana account",
|
|
359
|
+
fields: () => ({
|
|
360
|
+
...accountInterfaceFields(),
|
|
361
|
+
owner: type(accountInterface())
|
|
362
|
+
}),
|
|
363
|
+
name: "Account",
|
|
364
|
+
resolveType(account) {
|
|
365
|
+
if (account.encoding === "base58") {
|
|
366
|
+
return "AccountBase58";
|
|
367
|
+
}
|
|
368
|
+
if (account.encoding === "base64") {
|
|
369
|
+
return "AccountBase64";
|
|
370
|
+
}
|
|
371
|
+
if (account.encoding === "base64+zstd") {
|
|
372
|
+
return "AccountBase64Zstd";
|
|
373
|
+
}
|
|
374
|
+
if (account.encoding === "jsonParsed") {
|
|
375
|
+
if (account.data.parsed.type === "mint" && account.data.program === "spl-token") {
|
|
376
|
+
return "MintAccount";
|
|
377
|
+
}
|
|
378
|
+
if (account.data.parsed.type === "account" && account.data.program === "spl-token") {
|
|
379
|
+
return "TokenAccount";
|
|
380
|
+
}
|
|
381
|
+
if (account.data.program === "nonce") {
|
|
382
|
+
return "NonceAccount";
|
|
383
|
+
}
|
|
384
|
+
if (account.data.program === "stake") {
|
|
385
|
+
return "StakeAccount";
|
|
386
|
+
}
|
|
387
|
+
if (account.data.parsed.type === "vote" && account.data.program === "vote") {
|
|
388
|
+
return "VoteAccount";
|
|
389
|
+
}
|
|
390
|
+
if (account.data.parsed.type === "lookupTable" && account.data.program === "address-lookup-table") {
|
|
391
|
+
return "LookupTableAccount";
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return "AccountBase64";
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
return memoisedAccountInterface;
|
|
399
|
+
};
|
|
400
|
+
var accountType = (name, description, data) => new graphql.GraphQLObjectType({
|
|
401
|
+
description,
|
|
402
|
+
fields: {
|
|
403
|
+
...accountInterfaceFields(),
|
|
404
|
+
data,
|
|
405
|
+
owner: {
|
|
406
|
+
args: {
|
|
407
|
+
commitment: type(commitmentInputType()),
|
|
408
|
+
dataSlice: type(dataSliceInputType()),
|
|
409
|
+
encoding: type(accountEncodingInputType()),
|
|
410
|
+
minContextSlot: bigint()
|
|
411
|
+
},
|
|
412
|
+
resolve: (parent, args, context) => context.resolveAccount({ ...args, address: parent.owner }),
|
|
413
|
+
type: accountInterface()
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
interfaces: [accountInterface()],
|
|
417
|
+
name
|
|
418
|
+
});
|
|
419
|
+
var accountDataJsonParsed = (name, parsedInfoFields) => object(name + "Data", {
|
|
420
|
+
parsed: object(name + "DataParsed", {
|
|
421
|
+
info: object(name + "DataParsedInfo", parsedInfoFields),
|
|
422
|
+
type: string()
|
|
423
|
+
}),
|
|
424
|
+
program: string(),
|
|
425
|
+
space: bigint()
|
|
426
|
+
});
|
|
427
|
+
var memoisedAccountBase58;
|
|
428
|
+
var accountBase58 = () => {
|
|
429
|
+
if (!memoisedAccountBase58)
|
|
430
|
+
memoisedAccountBase58 = accountType("AccountBase58", "A Solana account with base58 encoded data", string());
|
|
431
|
+
return memoisedAccountBase58;
|
|
432
|
+
};
|
|
433
|
+
var memoisedAccountBase64;
|
|
434
|
+
var accountBase64 = () => {
|
|
435
|
+
if (!memoisedAccountBase64)
|
|
436
|
+
memoisedAccountBase64 = accountType("AccountBase64", "A Solana account with base64 encoded data", string());
|
|
437
|
+
return memoisedAccountBase64;
|
|
438
|
+
};
|
|
439
|
+
var memoisedAccountBase64Zstd;
|
|
440
|
+
var accountBase64Zstd = () => {
|
|
441
|
+
if (!memoisedAccountBase64Zstd)
|
|
442
|
+
memoisedAccountBase64Zstd = accountType(
|
|
443
|
+
"AccountBase64Zstd",
|
|
444
|
+
"A Solana account with base64 encoded data compressed with zstd",
|
|
445
|
+
string()
|
|
446
|
+
);
|
|
447
|
+
return memoisedAccountBase64Zstd;
|
|
448
|
+
};
|
|
449
|
+
var memoisedAccountNonceAccount;
|
|
450
|
+
var accountNonceAccount = () => {
|
|
451
|
+
if (!memoisedAccountNonceAccount)
|
|
452
|
+
memoisedAccountNonceAccount = accountType(
|
|
453
|
+
"NonceAccount",
|
|
454
|
+
"A nonce account",
|
|
455
|
+
accountDataJsonParsed("Nonce", {
|
|
456
|
+
authority: string(),
|
|
457
|
+
blockhash: string(),
|
|
458
|
+
feeCalculator: object("NonceFeeCalculator", {
|
|
459
|
+
lamportsPerSignature: string()
|
|
460
|
+
})
|
|
461
|
+
})
|
|
462
|
+
);
|
|
463
|
+
return memoisedAccountNonceAccount;
|
|
464
|
+
};
|
|
465
|
+
var memoisedAccountLookupTable;
|
|
466
|
+
var accountLookupTable = () => {
|
|
467
|
+
if (!memoisedAccountLookupTable)
|
|
468
|
+
memoisedAccountLookupTable = accountType(
|
|
469
|
+
"LookupTableAccount",
|
|
470
|
+
"An address lookup table account",
|
|
471
|
+
accountDataJsonParsed("LookupTable", {
|
|
472
|
+
addresses: list(string()),
|
|
473
|
+
authority: string(),
|
|
474
|
+
deactivationSlot: string(),
|
|
475
|
+
lastExtendedSlot: string(),
|
|
476
|
+
lastExtendedSlotStartIndex: number()
|
|
477
|
+
})
|
|
478
|
+
);
|
|
479
|
+
return memoisedAccountLookupTable;
|
|
480
|
+
};
|
|
481
|
+
var memoisedAccountMint;
|
|
482
|
+
var accountMint = () => {
|
|
483
|
+
if (!memoisedAccountMint)
|
|
484
|
+
memoisedAccountMint = accountType(
|
|
485
|
+
"MintAccount",
|
|
486
|
+
"An SPL mint",
|
|
487
|
+
accountDataJsonParsed("Mint", {
|
|
488
|
+
decimals: number(),
|
|
489
|
+
freezeAuthority: string(),
|
|
490
|
+
isInitialized: boolean(),
|
|
491
|
+
mintAuthority: string(),
|
|
492
|
+
supply: string()
|
|
493
|
+
})
|
|
494
|
+
);
|
|
495
|
+
return memoisedAccountMint;
|
|
496
|
+
};
|
|
497
|
+
var memoisedAccountTokenAccount;
|
|
498
|
+
var accountTokenAccount = () => {
|
|
499
|
+
if (!memoisedAccountTokenAccount)
|
|
500
|
+
memoisedAccountTokenAccount = accountType(
|
|
501
|
+
"TokenAccount",
|
|
502
|
+
"An SPL token account",
|
|
503
|
+
accountDataJsonParsed("TokenAccount", {
|
|
504
|
+
isNative: boolean(),
|
|
505
|
+
mint: string(),
|
|
506
|
+
owner: string(),
|
|
507
|
+
state: string(),
|
|
508
|
+
tokenAmount: type(tokenAmountType())
|
|
509
|
+
})
|
|
510
|
+
);
|
|
511
|
+
return memoisedAccountTokenAccount;
|
|
512
|
+
};
|
|
513
|
+
var memoisedAccountStakeAccount;
|
|
514
|
+
var accountStakeAccount = () => {
|
|
515
|
+
if (!memoisedAccountStakeAccount)
|
|
516
|
+
memoisedAccountStakeAccount = accountType(
|
|
517
|
+
"StakeAccount",
|
|
518
|
+
"A stake account",
|
|
519
|
+
accountDataJsonParsed("Stake", {
|
|
520
|
+
meta: object("StakeMeta", {
|
|
521
|
+
authorized: object("StakeMetaAuthorized", {
|
|
522
|
+
staker: string(),
|
|
523
|
+
withdrawer: string()
|
|
524
|
+
}),
|
|
525
|
+
lockup: object("StakeMetaLockup", {
|
|
526
|
+
custodian: string(),
|
|
527
|
+
epoch: bigint(),
|
|
528
|
+
unixTimestamp: bigint()
|
|
529
|
+
}),
|
|
530
|
+
rentExemptReserve: string()
|
|
531
|
+
}),
|
|
532
|
+
stake: object("StakeStake", {
|
|
533
|
+
creditsObserved: bigint(),
|
|
534
|
+
delegation: object("StakeStakeDelegation", {
|
|
535
|
+
activationEpoch: bigint(),
|
|
536
|
+
deactivationEpoch: bigint(),
|
|
537
|
+
stake: string(),
|
|
538
|
+
voter: string(),
|
|
539
|
+
warmupCooldownRate: number()
|
|
540
|
+
})
|
|
541
|
+
})
|
|
542
|
+
})
|
|
543
|
+
);
|
|
544
|
+
return memoisedAccountStakeAccount;
|
|
545
|
+
};
|
|
546
|
+
var memoisedAccountVoteAccount;
|
|
547
|
+
var accountVoteAccount = () => {
|
|
548
|
+
if (!memoisedAccountVoteAccount)
|
|
549
|
+
memoisedAccountVoteAccount = accountType(
|
|
550
|
+
"VoteAccount",
|
|
551
|
+
"A vote account",
|
|
552
|
+
accountDataJsonParsed("Vote", {
|
|
553
|
+
authorizedVoters: list(
|
|
554
|
+
object("VoteAuthorizedVoter", {
|
|
555
|
+
authorizedVoter: string(),
|
|
556
|
+
epoch: bigint()
|
|
557
|
+
})
|
|
558
|
+
),
|
|
559
|
+
authorizedWithdrawer: string(),
|
|
560
|
+
commission: number(),
|
|
561
|
+
epochCredits: list(
|
|
562
|
+
object("VoteEpochCredits", {
|
|
563
|
+
credits: string(),
|
|
564
|
+
epoch: bigint(),
|
|
565
|
+
previousCredits: string()
|
|
566
|
+
})
|
|
567
|
+
),
|
|
568
|
+
lastTimestamp: object("VoteLastTimestamp", {
|
|
569
|
+
slot: bigint(),
|
|
570
|
+
timestamp: bigint()
|
|
571
|
+
}),
|
|
572
|
+
nodePubkey: string(),
|
|
573
|
+
priorVoters: list(string()),
|
|
574
|
+
rootSlot: bigint(),
|
|
575
|
+
votes: list(
|
|
576
|
+
object("VoteVote", {
|
|
577
|
+
confirmationCount: number(),
|
|
578
|
+
slot: bigint()
|
|
579
|
+
})
|
|
580
|
+
)
|
|
581
|
+
})
|
|
582
|
+
);
|
|
583
|
+
return memoisedAccountVoteAccount;
|
|
584
|
+
};
|
|
585
|
+
var memoisedAccountTypes;
|
|
586
|
+
var accountTypes = () => {
|
|
587
|
+
if (!memoisedAccountTypes)
|
|
588
|
+
memoisedAccountTypes = [
|
|
589
|
+
accountBase58(),
|
|
590
|
+
accountBase64(),
|
|
591
|
+
accountBase64Zstd(),
|
|
592
|
+
accountNonceAccount(),
|
|
593
|
+
accountLookupTable(),
|
|
594
|
+
accountMint(),
|
|
595
|
+
accountTokenAccount(),
|
|
596
|
+
accountStakeAccount(),
|
|
597
|
+
accountVoteAccount()
|
|
598
|
+
];
|
|
599
|
+
return memoisedAccountTypes;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
// src/schema/account/query.ts
|
|
603
|
+
var accountQuery = () => ({
|
|
604
|
+
account: {
|
|
605
|
+
args: {
|
|
606
|
+
address: nonNull(string()),
|
|
607
|
+
commitment: type(commitmentInputType()),
|
|
608
|
+
dataSlice: type(dataSliceInputType()),
|
|
609
|
+
encoding: type(accountEncodingInputType()),
|
|
610
|
+
minContextSlot: bigint()
|
|
611
|
+
},
|
|
612
|
+
resolve: (_parent, args, context) => context.resolveAccount(args),
|
|
613
|
+
type: accountInterface()
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
var memoisedTokenBalance;
|
|
617
|
+
var tokenBalance = () => {
|
|
618
|
+
if (!memoisedTokenBalance)
|
|
619
|
+
memoisedTokenBalance = new graphql.GraphQLObjectType({
|
|
620
|
+
fields: {
|
|
621
|
+
accountIndex: number(),
|
|
622
|
+
mint: string(),
|
|
623
|
+
owner: string(),
|
|
624
|
+
programId: string(),
|
|
625
|
+
uiAmountString: string()
|
|
626
|
+
},
|
|
627
|
+
name: "TokenBalance"
|
|
628
|
+
});
|
|
629
|
+
return memoisedTokenBalance;
|
|
630
|
+
};
|
|
631
|
+
var memoisedTransactionStatus;
|
|
632
|
+
var transactionStatus = () => {
|
|
633
|
+
if (!memoisedTransactionStatus)
|
|
634
|
+
memoisedTransactionStatus = new graphql.GraphQLUnionType({
|
|
635
|
+
name: "TransactionStatus",
|
|
636
|
+
types: [
|
|
637
|
+
new graphql.GraphQLObjectType({
|
|
638
|
+
fields: {
|
|
639
|
+
Err: string()
|
|
640
|
+
},
|
|
641
|
+
name: "TransactionStatusError"
|
|
642
|
+
}),
|
|
643
|
+
new graphql.GraphQLObjectType({
|
|
644
|
+
fields: {
|
|
645
|
+
Ok: string()
|
|
646
|
+
},
|
|
647
|
+
name: "TransactionStatusOk"
|
|
648
|
+
})
|
|
649
|
+
]
|
|
650
|
+
});
|
|
651
|
+
return memoisedTransactionStatus;
|
|
652
|
+
};
|
|
653
|
+
var memoisedReward;
|
|
654
|
+
var reward = () => {
|
|
655
|
+
if (!memoisedReward)
|
|
656
|
+
memoisedReward = new graphql.GraphQLObjectType({
|
|
657
|
+
fields: {
|
|
658
|
+
commission: number(),
|
|
659
|
+
lamports: bigint(),
|
|
660
|
+
postBalance: bigint(),
|
|
661
|
+
pubkey: string(),
|
|
662
|
+
rewardType: string()
|
|
663
|
+
},
|
|
664
|
+
name: "Reward"
|
|
665
|
+
});
|
|
666
|
+
return memoisedReward;
|
|
667
|
+
};
|
|
668
|
+
var memoisedAddressTableLookup;
|
|
669
|
+
var addressTableLookup = () => {
|
|
670
|
+
if (!memoisedAddressTableLookup)
|
|
671
|
+
memoisedAddressTableLookup = new graphql.GraphQLObjectType({
|
|
672
|
+
fields: {
|
|
673
|
+
accountKey: string(),
|
|
674
|
+
readableIndexes: list(number()),
|
|
675
|
+
writableIndexes: list(number())
|
|
676
|
+
},
|
|
677
|
+
name: "AddressTableLookup"
|
|
678
|
+
});
|
|
679
|
+
return memoisedAddressTableLookup;
|
|
680
|
+
};
|
|
681
|
+
var memoisedReturnData;
|
|
682
|
+
var returnData = () => {
|
|
683
|
+
if (!memoisedReturnData)
|
|
684
|
+
memoisedReturnData = new graphql.GraphQLObjectType({
|
|
685
|
+
fields: {
|
|
686
|
+
data: string(),
|
|
687
|
+
programId: string()
|
|
688
|
+
},
|
|
689
|
+
name: "ReturnData"
|
|
690
|
+
});
|
|
691
|
+
return memoisedReturnData;
|
|
692
|
+
};
|
|
693
|
+
var memoisedTransactionInstruction;
|
|
694
|
+
var transactionInstruction = () => {
|
|
695
|
+
if (!memoisedTransactionInstruction)
|
|
696
|
+
memoisedTransactionInstruction = new graphql.GraphQLObjectType({
|
|
697
|
+
fields: {
|
|
698
|
+
accounts: list(number()),
|
|
699
|
+
data: string(),
|
|
700
|
+
programIdIndex: number()
|
|
701
|
+
},
|
|
702
|
+
name: "TransactionInstruction"
|
|
703
|
+
});
|
|
704
|
+
return memoisedTransactionInstruction;
|
|
705
|
+
};
|
|
706
|
+
var memoisedTransactionMetaLoadedAddresses;
|
|
707
|
+
var transactionMetaLoadedAddresses = () => {
|
|
708
|
+
if (!memoisedTransactionMetaLoadedAddresses)
|
|
709
|
+
memoisedTransactionMetaLoadedAddresses = new graphql.GraphQLObjectType({
|
|
710
|
+
fields: {
|
|
711
|
+
readonly: list(string()),
|
|
712
|
+
// Base58 encoded addresses
|
|
713
|
+
writable: list(string())
|
|
714
|
+
// Base58 encoded addresses
|
|
715
|
+
},
|
|
716
|
+
name: "TransactionMetaLoadedAddresses"
|
|
717
|
+
});
|
|
718
|
+
return memoisedTransactionMetaLoadedAddresses;
|
|
719
|
+
};
|
|
720
|
+
var memoisedParsedTransactionInstructionInterface;
|
|
721
|
+
var parsedTransactionInstructionInterface = () => {
|
|
722
|
+
if (!memoisedParsedTransactionInstructionInterface)
|
|
723
|
+
memoisedParsedTransactionInstructionInterface = new graphql.GraphQLInterfaceType({
|
|
724
|
+
fields: {
|
|
725
|
+
programId: string()
|
|
726
|
+
},
|
|
727
|
+
name: "ParsedTransactionInstruction",
|
|
728
|
+
resolveType(instruction) {
|
|
729
|
+
if (instruction.program === "address-lookup-table") {
|
|
730
|
+
if (instruction.info.type === "createLookupTable") {
|
|
731
|
+
return "CreateLookupTableInstruction";
|
|
732
|
+
}
|
|
733
|
+
if (instruction.info.type === "freezeLookupTable") {
|
|
734
|
+
return "FreezeLookupTableInstruction";
|
|
735
|
+
}
|
|
736
|
+
if (instruction.info.type === "extendLookupTable") {
|
|
737
|
+
return "ExtendLookupTableInstruction";
|
|
738
|
+
}
|
|
739
|
+
if (instruction.info.type === "deactivateLookupTable") {
|
|
740
|
+
return "DeactivateLookupTableInstruction";
|
|
741
|
+
}
|
|
742
|
+
if (instruction.info.type === "closeLookupTable") {
|
|
743
|
+
return "CloseLookupTableInstruction";
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
if (instruction.program === "bpf-loader") {
|
|
747
|
+
if (instruction.info.type === "write") {
|
|
748
|
+
return "BpfLoaderWriteInstruction";
|
|
749
|
+
}
|
|
750
|
+
if (instruction.info.type === "finalize") {
|
|
751
|
+
return "BpfLoaderFinalizeInstruction";
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (instruction.program === "bpf-upgradeable-loader") {
|
|
755
|
+
if (instruction.info.type === "initializeBuffer") {
|
|
756
|
+
return "BpfUpgradeableLoaderInitializeBufferInstruction";
|
|
757
|
+
}
|
|
758
|
+
if (instruction.info.type === "write") {
|
|
759
|
+
return "BpfUpgradeableLoaderWriteInstruction";
|
|
760
|
+
}
|
|
761
|
+
if (instruction.info.type === "deployWithMaxDataLen") {
|
|
762
|
+
return "BpfUpgradeableLoaderDeployWithMaxDataLenInstruction";
|
|
763
|
+
}
|
|
764
|
+
if (instruction.info.type === "upgrade") {
|
|
765
|
+
return "BpfUpgradeableLoaderUpgradeInstruction";
|
|
766
|
+
}
|
|
767
|
+
if (instruction.info.type === "setAuthority") {
|
|
768
|
+
return "BpfUpgradeableLoaderSetAuthorityInstruction";
|
|
769
|
+
}
|
|
770
|
+
if (instruction.info.type === "setAuthorityChecked") {
|
|
771
|
+
return "BpfUpgradeableLoaderSetAuthorityCheckedInstruction";
|
|
772
|
+
}
|
|
773
|
+
if (instruction.info.type === "close") {
|
|
774
|
+
return "BpfUpgradeableLoaderCloseInstruction";
|
|
775
|
+
}
|
|
776
|
+
if (instruction.info.type === "extendProgram") {
|
|
777
|
+
return "BpfUpgradeableLoaderExtendProgramInstruction";
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (instruction.program === "spl-associated-token-account") {
|
|
781
|
+
if (instruction.info.type === "create") {
|
|
782
|
+
return "SplAssociatedTokenCreateInstruction";
|
|
783
|
+
}
|
|
784
|
+
if (instruction.info.type === "createIdempotent") {
|
|
785
|
+
return "SplAssociatedTokenCreateIdempotentInstruction";
|
|
786
|
+
}
|
|
787
|
+
if (instruction.info.type === "recoverNested") {
|
|
788
|
+
return "SplAssociatedTokenRecoverNestedInstruction";
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
if (instruction.program === "spl-memo") {
|
|
792
|
+
return "SplMemoInstruction";
|
|
793
|
+
}
|
|
794
|
+
if (instruction.program === "spl-token") {
|
|
795
|
+
if (instruction.info.type === "initializeMint") {
|
|
796
|
+
return "SplTokenInitializeMintInstruction";
|
|
797
|
+
}
|
|
798
|
+
if (instruction.info.type === "initializeMint2") {
|
|
799
|
+
return "SplTokenInitializeMint2Instruction";
|
|
800
|
+
}
|
|
801
|
+
if (instruction.info.type === "initializeAccount") {
|
|
802
|
+
return "SplTokenInitializeAccountInstruction";
|
|
803
|
+
}
|
|
804
|
+
if (instruction.info.type === "initializeAccount2") {
|
|
805
|
+
return "SplTokenInitializeAccount2Instruction";
|
|
806
|
+
}
|
|
807
|
+
if (instruction.info.type === "initializeAccount3") {
|
|
808
|
+
return "SplTokenInitializeAccount3Instruction";
|
|
809
|
+
}
|
|
810
|
+
if (instruction.info.type === "initializeMultisig") {
|
|
811
|
+
return "SplTokenInitializeMultisigInstruction";
|
|
812
|
+
}
|
|
813
|
+
if (instruction.info.type === "initializeMultisig2") {
|
|
814
|
+
return "SplTokenInitializeMultisig2Instruction";
|
|
815
|
+
}
|
|
816
|
+
if (instruction.info.type === "transfer") {
|
|
817
|
+
return "SplTokenTransferInstruction";
|
|
818
|
+
}
|
|
819
|
+
if (instruction.info.type === "approve") {
|
|
820
|
+
return "SplTokenApproveInstruction";
|
|
821
|
+
}
|
|
822
|
+
if (instruction.info.type === "revoke") {
|
|
823
|
+
return "SplTokenRevokeInstruction";
|
|
824
|
+
}
|
|
825
|
+
if (instruction.info.type === "setAuthority") {
|
|
826
|
+
return "SplTokenSetAuthorityInstruction";
|
|
827
|
+
}
|
|
828
|
+
if (instruction.info.type === "mintTo") {
|
|
829
|
+
return "SplTokenMintToInstruction";
|
|
830
|
+
}
|
|
831
|
+
if (instruction.info.type === "burn") {
|
|
832
|
+
return "SplTokenBurnInstruction";
|
|
833
|
+
}
|
|
834
|
+
if (instruction.info.type === "closeAccount") {
|
|
835
|
+
return "SplTokenCloseAccountInstruction";
|
|
836
|
+
}
|
|
837
|
+
if (instruction.info.type === "freezeAccount") {
|
|
838
|
+
return "SplTokenFreezeAccountInstruction";
|
|
839
|
+
}
|
|
840
|
+
if (instruction.info.type === "thawAccount") {
|
|
841
|
+
return "SplTokenThawAccountInstruction";
|
|
842
|
+
}
|
|
843
|
+
if (instruction.info.type === "transferChecked") {
|
|
844
|
+
return "SplTokenTransferCheckedInstruction";
|
|
845
|
+
}
|
|
846
|
+
if (instruction.info.type === "approveChecked") {
|
|
847
|
+
return "SplTokenApproveCheckedInstruction";
|
|
848
|
+
}
|
|
849
|
+
if (instruction.info.type === "mintToChecked") {
|
|
850
|
+
return "SplTokenMintToCheckedInstruction";
|
|
851
|
+
}
|
|
852
|
+
if (instruction.info.type === "burnChecked") {
|
|
853
|
+
return "SplTokenBurnCheckedInstruction";
|
|
854
|
+
}
|
|
855
|
+
if (instruction.info.type === "syncNative") {
|
|
856
|
+
return "SplTokenSyncNativeInstruction";
|
|
857
|
+
}
|
|
858
|
+
if (instruction.info.type === "getAccountDataSize") {
|
|
859
|
+
return "SplTokenGetAccountDataSizeInstruction";
|
|
860
|
+
}
|
|
861
|
+
if (instruction.info.type === "initializeImmutableOwner") {
|
|
862
|
+
return "SplTokenInitializeImmutableOwnerInstruction";
|
|
863
|
+
}
|
|
864
|
+
if (instruction.info.type === "amountToUiAmount") {
|
|
865
|
+
return "SplTokenAmountToUiAmountInstruction";
|
|
866
|
+
}
|
|
867
|
+
if (instruction.info.type === "uiAmountToAmount") {
|
|
868
|
+
return "SplTokenUiAmountToAmountInstruction";
|
|
869
|
+
}
|
|
870
|
+
if (instruction.info.type === "initializeMintCloseAuthority") {
|
|
871
|
+
return "SplTokenInitializeMintCloseAuthorityInstruction";
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (instruction.program === "stake") {
|
|
875
|
+
if (instruction.info.type === "initialize") {
|
|
876
|
+
return "StakeInitializeInstruction";
|
|
877
|
+
}
|
|
878
|
+
if (instruction.info.type === "authorize") {
|
|
879
|
+
return "StakeAuthorizeInstruction";
|
|
880
|
+
}
|
|
881
|
+
if (instruction.info.type === "delegate") {
|
|
882
|
+
return "StakeDelegateStakeInstruction";
|
|
883
|
+
}
|
|
884
|
+
if (instruction.info.type === "split") {
|
|
885
|
+
return "StakeSplitInstruction";
|
|
886
|
+
}
|
|
887
|
+
if (instruction.info.type === "withdraw") {
|
|
888
|
+
return "StakeWithdrawInstruction";
|
|
889
|
+
}
|
|
890
|
+
if (instruction.info.type === "deactivate") {
|
|
891
|
+
return "StakeDeactivateInstruction";
|
|
892
|
+
}
|
|
893
|
+
if (instruction.info.type === "setLockup") {
|
|
894
|
+
return "StakeSetLockupInstruction";
|
|
895
|
+
}
|
|
896
|
+
if (instruction.info.type === "merge") {
|
|
897
|
+
return "StakeMergeInstruction";
|
|
898
|
+
}
|
|
899
|
+
if (instruction.info.type === "authorizeWithSeed") {
|
|
900
|
+
return "StakeAuthorizeWithSeedInstruction";
|
|
901
|
+
}
|
|
902
|
+
if (instruction.info.type === "initializeChecked") {
|
|
903
|
+
return "StakeInitializeCheckedInstruction";
|
|
904
|
+
}
|
|
905
|
+
if (instruction.info.type === "authorizeChecked") {
|
|
906
|
+
return "StakeAuthorizeCheckedInstruction";
|
|
907
|
+
}
|
|
908
|
+
if (instruction.info.type === "authorizeCheckedWithSeed") {
|
|
909
|
+
return "StakeAuthorizeCheckedWithSeedInstruction";
|
|
910
|
+
}
|
|
911
|
+
if (instruction.info.type === "setLockupChecked") {
|
|
912
|
+
return "StakeSetLockupCheckedInstruction";
|
|
913
|
+
}
|
|
914
|
+
if (instruction.info.type === "deactivateDelinquent") {
|
|
915
|
+
return "StakeDeactivateDelinquentInstruction";
|
|
916
|
+
}
|
|
917
|
+
if (instruction.info.type === "redelegate") {
|
|
918
|
+
return "StakeRedelegateInstruction";
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
if (instruction.program === "system") {
|
|
922
|
+
if (instruction.info.type === "createAccount") {
|
|
923
|
+
return "CreateAccountInstruction";
|
|
924
|
+
}
|
|
925
|
+
if (instruction.info.type === "assign") {
|
|
926
|
+
return "AssignInstruction";
|
|
927
|
+
}
|
|
928
|
+
if (instruction.info.type === "transfer") {
|
|
929
|
+
return "TransferInstruction";
|
|
930
|
+
}
|
|
931
|
+
if (instruction.info.type === "createAccountWithSeed") {
|
|
932
|
+
return "CreateAccountWithSeedInstruction";
|
|
933
|
+
}
|
|
934
|
+
if (instruction.info.type === "advanceNonceAccount") {
|
|
935
|
+
return "AdvanceNonceAccountInstruction";
|
|
936
|
+
}
|
|
937
|
+
if (instruction.info.type === "withdrawNonceAccount") {
|
|
938
|
+
return "WithdrawNonceAccountInstruction";
|
|
939
|
+
}
|
|
940
|
+
if (instruction.info.type === "initializeNonceAccount") {
|
|
941
|
+
return "InitializeNonceAccountInstruction";
|
|
942
|
+
}
|
|
943
|
+
if (instruction.info.type === "authorizeNonceAccount") {
|
|
944
|
+
return "AuthorizeNonceAccountInstruction";
|
|
945
|
+
}
|
|
946
|
+
if (instruction.info.type === "upgradeNonceAccount") {
|
|
947
|
+
return "UpgradeNonceAccountInstruction";
|
|
948
|
+
}
|
|
949
|
+
if (instruction.info.type === "allocate") {
|
|
950
|
+
return "AllocateInstruction";
|
|
951
|
+
}
|
|
952
|
+
if (instruction.info.type === "allocateWithSeed") {
|
|
953
|
+
return "AllocateWithSeedInstruction";
|
|
954
|
+
}
|
|
955
|
+
if (instruction.info.type === "assignWithSeed") {
|
|
956
|
+
return "AssignWithSeedInstruction";
|
|
957
|
+
}
|
|
958
|
+
if (instruction.info.type === "transferWithSeed") {
|
|
959
|
+
return "TransferWithSeedInstruction";
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (instruction.program === "vote") {
|
|
963
|
+
if (instruction.info.type === "initialize") {
|
|
964
|
+
return "VoteInitializeAccountInstruction";
|
|
965
|
+
}
|
|
966
|
+
if (instruction.info.type === "authorize") {
|
|
967
|
+
return "VoteAuthorizeInstruction";
|
|
968
|
+
}
|
|
969
|
+
if (instruction.info.type === "authorizeWithSeed") {
|
|
970
|
+
return "VoteAuthorizeWithSeedInstruction";
|
|
971
|
+
}
|
|
972
|
+
if (instruction.info.type === "authorizeCheckedWithSeed") {
|
|
973
|
+
return "VoteAuthorizeCheckedWithSeedInstruction";
|
|
974
|
+
}
|
|
975
|
+
if (instruction.info.type === "vote") {
|
|
976
|
+
return "VoteVoteInstruction";
|
|
977
|
+
}
|
|
978
|
+
if (instruction.info.type === "updatevotestate") {
|
|
979
|
+
return "VoteUpdateVoteStateInstruction";
|
|
980
|
+
}
|
|
981
|
+
if (instruction.info.type === "updatevotestateswitch") {
|
|
982
|
+
return "VoteUpdateVoteStateSwitchInstruction";
|
|
983
|
+
}
|
|
984
|
+
if (instruction.info.type === "compactupdatevotestate") {
|
|
985
|
+
return "VoteCompactUpdateVoteStateInstruction";
|
|
986
|
+
}
|
|
987
|
+
if (instruction.info.type === "compactupdatevotestateswitch") {
|
|
988
|
+
return "VoteCompactUpdateVoteStateSwitchInstruction";
|
|
989
|
+
}
|
|
990
|
+
if (instruction.info.type === "withdraw") {
|
|
991
|
+
return "VoteWithdrawInstruction";
|
|
992
|
+
}
|
|
993
|
+
if (instruction.info.type === "updateValidatorIdentity") {
|
|
994
|
+
return "VoteUpdateValidatorIdentityInstruction";
|
|
995
|
+
}
|
|
996
|
+
if (instruction.info.type === "updateCommission") {
|
|
997
|
+
return "VoteUpdateCommissionInstruction";
|
|
998
|
+
}
|
|
999
|
+
if (instruction.info.type === "voteSwitch") {
|
|
1000
|
+
return "VoteVoteSwitchInstruction";
|
|
1001
|
+
}
|
|
1002
|
+
if (instruction.info.type === "authorizeChecked") {
|
|
1003
|
+
return "VoteAuthorizeCheckedInstruction";
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return "PartiallyDecodedInstruction";
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
return memoisedParsedTransactionInstructionInterface;
|
|
1010
|
+
};
|
|
1011
|
+
var parsedTransactionInstructionType = (name, parsedInfoFields) => new graphql.GraphQLObjectType({
|
|
1012
|
+
fields: {
|
|
1013
|
+
parsed: object(name + "Parsed", {
|
|
1014
|
+
info: object(name + "ParsedInfo", parsedInfoFields),
|
|
1015
|
+
type: string()
|
|
1016
|
+
}),
|
|
1017
|
+
program: string(),
|
|
1018
|
+
programId: string()
|
|
1019
|
+
},
|
|
1020
|
+
interfaces: [parsedTransactionInstructionInterface()],
|
|
1021
|
+
name
|
|
1022
|
+
});
|
|
1023
|
+
var memoisedPartiallyDecodedTransactionInstruction;
|
|
1024
|
+
var partiallyDecodedTransactionInstruction = () => {
|
|
1025
|
+
if (!memoisedPartiallyDecodedTransactionInstruction)
|
|
1026
|
+
memoisedPartiallyDecodedTransactionInstruction = new graphql.GraphQLObjectType({
|
|
1027
|
+
fields: {
|
|
1028
|
+
accounts: list(string()),
|
|
1029
|
+
data: string(),
|
|
1030
|
+
programId: string()
|
|
1031
|
+
},
|
|
1032
|
+
interfaces: [parsedTransactionInstructionInterface()],
|
|
1033
|
+
name: "PartiallyDecodedInstruction"
|
|
1034
|
+
});
|
|
1035
|
+
return memoisedPartiallyDecodedTransactionInstruction;
|
|
1036
|
+
};
|
|
1037
|
+
var memoisedParsedInstructionsAddressLookupTable;
|
|
1038
|
+
var parsedInstructionsAddressLookupTable = () => {
|
|
1039
|
+
if (!memoisedParsedInstructionsAddressLookupTable)
|
|
1040
|
+
memoisedParsedInstructionsAddressLookupTable = [
|
|
1041
|
+
parsedTransactionInstructionType("CreateLookupTableInstruction", {
|
|
1042
|
+
bumpSeed: number(),
|
|
1043
|
+
lookupTableAccount: string(),
|
|
1044
|
+
lookupTableAuthority: string(),
|
|
1045
|
+
payerAccount: string(),
|
|
1046
|
+
recentSlot: bigint(),
|
|
1047
|
+
systemProgram: string()
|
|
1048
|
+
}),
|
|
1049
|
+
parsedTransactionInstructionType("FreezeLookupTableInstruction", {
|
|
1050
|
+
lookupTableAccount: string(),
|
|
1051
|
+
lookupTableAuthority: string()
|
|
1052
|
+
}),
|
|
1053
|
+
parsedTransactionInstructionType("ExtendLookupTableInstruction", {
|
|
1054
|
+
lookupTableAccount: string(),
|
|
1055
|
+
lookupTableAuthority: string(),
|
|
1056
|
+
newAddresses: list(string()),
|
|
1057
|
+
payerAccount: string(),
|
|
1058
|
+
systemProgram: string()
|
|
1059
|
+
}),
|
|
1060
|
+
parsedTransactionInstructionType("DeactivateLookupTableInstruction", {
|
|
1061
|
+
lookupTableAccount: string(),
|
|
1062
|
+
lookupTableAuthority: string()
|
|
1063
|
+
}),
|
|
1064
|
+
parsedTransactionInstructionType("CloseLookupTableInstruction", {
|
|
1065
|
+
lookupTableAccount: string(),
|
|
1066
|
+
lookupTableAuthority: string(),
|
|
1067
|
+
recipient: string()
|
|
1068
|
+
})
|
|
1069
|
+
];
|
|
1070
|
+
return memoisedParsedInstructionsAddressLookupTable;
|
|
1071
|
+
};
|
|
1072
|
+
var memoisedParsedInstructionsBpfLoader;
|
|
1073
|
+
var parsedInstructionsBpfLoader = () => {
|
|
1074
|
+
if (!memoisedParsedInstructionsBpfLoader)
|
|
1075
|
+
memoisedParsedInstructionsBpfLoader = [
|
|
1076
|
+
parsedTransactionInstructionType("BpfLoaderWriteInstruction", {
|
|
1077
|
+
account: string(),
|
|
1078
|
+
bytes: string(),
|
|
1079
|
+
offset: number()
|
|
1080
|
+
}),
|
|
1081
|
+
parsedTransactionInstructionType("BpfLoaderFinalizeInstruction", {
|
|
1082
|
+
account: string()
|
|
1083
|
+
})
|
|
1084
|
+
];
|
|
1085
|
+
return memoisedParsedInstructionsBpfLoader;
|
|
1086
|
+
};
|
|
1087
|
+
var memoisedParsedInstructionsBpfUpgradeableLoader;
|
|
1088
|
+
var parsedInstructionsBpfUpgradeableLoader = () => {
|
|
1089
|
+
if (!memoisedParsedInstructionsBpfUpgradeableLoader)
|
|
1090
|
+
memoisedParsedInstructionsBpfUpgradeableLoader = [
|
|
1091
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderInitializeBufferInstruction", {
|
|
1092
|
+
account: string()
|
|
1093
|
+
}),
|
|
1094
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderWriteInstruction", {
|
|
1095
|
+
account: string(),
|
|
1096
|
+
authority: string(),
|
|
1097
|
+
bytes: string(),
|
|
1098
|
+
offset: number()
|
|
1099
|
+
}),
|
|
1100
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderDeployWithMaxDataLenInstruction", {
|
|
1101
|
+
authority: string(),
|
|
1102
|
+
bufferAccount: string(),
|
|
1103
|
+
clockSysvar: string(),
|
|
1104
|
+
maxDataLen: bigint(),
|
|
1105
|
+
payerAccount: string(),
|
|
1106
|
+
programAccount: string(),
|
|
1107
|
+
programDataAccount: string(),
|
|
1108
|
+
rentSysvar: string()
|
|
1109
|
+
}),
|
|
1110
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderUpgradeInstruction", {
|
|
1111
|
+
authority: string(),
|
|
1112
|
+
bufferAccount: string(),
|
|
1113
|
+
clockSysvar: string(),
|
|
1114
|
+
programAccount: string(),
|
|
1115
|
+
programDataAccount: string(),
|
|
1116
|
+
rentSysvar: string(),
|
|
1117
|
+
spillAccount: string()
|
|
1118
|
+
}),
|
|
1119
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityInstruction", {
|
|
1120
|
+
account: string(),
|
|
1121
|
+
authority: string(),
|
|
1122
|
+
newAuthority: string()
|
|
1123
|
+
}),
|
|
1124
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderSetAuthorityCheckedInstruction", {
|
|
1125
|
+
account: string(),
|
|
1126
|
+
authority: string(),
|
|
1127
|
+
newAuthority: string()
|
|
1128
|
+
}),
|
|
1129
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderCloseInstruction", {
|
|
1130
|
+
account: string(),
|
|
1131
|
+
authority: string(),
|
|
1132
|
+
programAccount: string(),
|
|
1133
|
+
recipient: string()
|
|
1134
|
+
}),
|
|
1135
|
+
parsedTransactionInstructionType("BpfUpgradeableLoaderExtendProgramInstruction", {
|
|
1136
|
+
additionalBytes: bigint(),
|
|
1137
|
+
payerAccount: string(),
|
|
1138
|
+
programAccount: string(),
|
|
1139
|
+
programDataAccount: string(),
|
|
1140
|
+
systemProgram: string()
|
|
1141
|
+
})
|
|
1142
|
+
];
|
|
1143
|
+
return memoisedParsedInstructionsBpfUpgradeableLoader;
|
|
1144
|
+
};
|
|
1145
|
+
var memoisedParsedInstructionsSplAssociatedToken;
|
|
1146
|
+
var parsedInstructionsSplAssociatedToken = () => {
|
|
1147
|
+
if (!memoisedParsedInstructionsSplAssociatedToken)
|
|
1148
|
+
memoisedParsedInstructionsSplAssociatedToken = [
|
|
1149
|
+
parsedTransactionInstructionType("SplAssociatedTokenCreateInstruction", {
|
|
1150
|
+
account: string(),
|
|
1151
|
+
mint: string(),
|
|
1152
|
+
source: string(),
|
|
1153
|
+
systemProgram: string(),
|
|
1154
|
+
tokenProgram: string(),
|
|
1155
|
+
wallet: string()
|
|
1156
|
+
}),
|
|
1157
|
+
parsedTransactionInstructionType("SplAssociatedTokenCreateIdempotentInstruction", {
|
|
1158
|
+
account: string(),
|
|
1159
|
+
mint: string(),
|
|
1160
|
+
source: string(),
|
|
1161
|
+
systemProgram: string(),
|
|
1162
|
+
tokenProgram: string(),
|
|
1163
|
+
wallet: string()
|
|
1164
|
+
}),
|
|
1165
|
+
parsedTransactionInstructionType("SplAssociatedTokenRecoverNestedInstruction", {
|
|
1166
|
+
destination: string(),
|
|
1167
|
+
nestedMint: string(),
|
|
1168
|
+
nestedOwner: string(),
|
|
1169
|
+
nestedSource: string(),
|
|
1170
|
+
ownerMint: string(),
|
|
1171
|
+
tokenProgram: string(),
|
|
1172
|
+
wallet: string()
|
|
1173
|
+
})
|
|
1174
|
+
];
|
|
1175
|
+
return memoisedParsedInstructionsSplAssociatedToken;
|
|
1176
|
+
};
|
|
1177
|
+
var memoisedParsedInstructionSplMemo;
|
|
1178
|
+
var parsedInstructionSplMemo = () => {
|
|
1179
|
+
if (!memoisedParsedInstructionSplMemo)
|
|
1180
|
+
memoisedParsedInstructionSplMemo = new graphql.GraphQLObjectType({
|
|
1181
|
+
fields: {
|
|
1182
|
+
parsed: string(),
|
|
1183
|
+
program: string(),
|
|
1184
|
+
programId: string()
|
|
1185
|
+
},
|
|
1186
|
+
interfaces: [parsedTransactionInstructionInterface()],
|
|
1187
|
+
name: "SplMemoInstruction"
|
|
1188
|
+
});
|
|
1189
|
+
return memoisedParsedInstructionSplMemo;
|
|
1190
|
+
};
|
|
1191
|
+
var memoisedParsedInstructionsSplToken;
|
|
1192
|
+
var parsedInstructionsSplToken = () => {
|
|
1193
|
+
if (!memoisedParsedInstructionsSplToken)
|
|
1194
|
+
memoisedParsedInstructionsSplToken = [
|
|
1195
|
+
parsedTransactionInstructionType("SplTokenInitializeMintInstruction", {
|
|
1196
|
+
decimals: number(),
|
|
1197
|
+
freezeAuthority: string(),
|
|
1198
|
+
mint: string(),
|
|
1199
|
+
mintAuthority: string(),
|
|
1200
|
+
rentSysvar: string()
|
|
1201
|
+
}),
|
|
1202
|
+
parsedTransactionInstructionType("SplTokenInitializeMint2Instruction", {
|
|
1203
|
+
decimals: number(),
|
|
1204
|
+
freezeAuthority: string(),
|
|
1205
|
+
mint: string(),
|
|
1206
|
+
mintAuthority: string()
|
|
1207
|
+
}),
|
|
1208
|
+
parsedTransactionInstructionType("SplTokenInitializeAccountInstruction", {
|
|
1209
|
+
account: string(),
|
|
1210
|
+
mint: string(),
|
|
1211
|
+
owner: string(),
|
|
1212
|
+
rentSysvar: string()
|
|
1213
|
+
}),
|
|
1214
|
+
parsedTransactionInstructionType("SplTokenInitializeAccount2Instruction", {
|
|
1215
|
+
account: string(),
|
|
1216
|
+
mint: string(),
|
|
1217
|
+
owner: string(),
|
|
1218
|
+
rentSysvar: string()
|
|
1219
|
+
}),
|
|
1220
|
+
parsedTransactionInstructionType("SplTokenInitializeAccount3Instruction", {
|
|
1221
|
+
account: string(),
|
|
1222
|
+
mint: string(),
|
|
1223
|
+
owner: string()
|
|
1224
|
+
}),
|
|
1225
|
+
parsedTransactionInstructionType("SplTokenInitializeMultisigInstruction", {
|
|
1226
|
+
m: number(),
|
|
1227
|
+
multisig: string(),
|
|
1228
|
+
rentSysvar: string(),
|
|
1229
|
+
signers: list(string())
|
|
1230
|
+
}),
|
|
1231
|
+
parsedTransactionInstructionType("SplTokenInitializeMultisig2Instruction", {
|
|
1232
|
+
m: number(),
|
|
1233
|
+
multisig: string(),
|
|
1234
|
+
signers: list(string())
|
|
1235
|
+
}),
|
|
1236
|
+
parsedTransactionInstructionType("SplTokenTransferInstruction", {
|
|
1237
|
+
amount: string(),
|
|
1238
|
+
authority: string(),
|
|
1239
|
+
destination: string(),
|
|
1240
|
+
multisigAuthority: string(),
|
|
1241
|
+
source: string()
|
|
1242
|
+
}),
|
|
1243
|
+
parsedTransactionInstructionType("SplTokenApproveInstruction", {
|
|
1244
|
+
amount: string(),
|
|
1245
|
+
delegate: string(),
|
|
1246
|
+
multisigOwner: string(),
|
|
1247
|
+
owner: string(),
|
|
1248
|
+
source: string()
|
|
1249
|
+
}),
|
|
1250
|
+
parsedTransactionInstructionType("SplTokenRevokeInstruction", {
|
|
1251
|
+
multisigOwner: string(),
|
|
1252
|
+
owner: string(),
|
|
1253
|
+
source: string()
|
|
1254
|
+
}),
|
|
1255
|
+
parsedTransactionInstructionType("SplTokenSetAuthorityInstruction", {
|
|
1256
|
+
authority: string(),
|
|
1257
|
+
authorityType: string(),
|
|
1258
|
+
multisigAuthority: string(),
|
|
1259
|
+
newAuthority: string()
|
|
1260
|
+
}),
|
|
1261
|
+
parsedTransactionInstructionType("SplTokenMintToInstruction", {
|
|
1262
|
+
account: string(),
|
|
1263
|
+
amount: string(),
|
|
1264
|
+
authority: string(),
|
|
1265
|
+
mint: string(),
|
|
1266
|
+
mintAuthority: string(),
|
|
1267
|
+
multisigMintAuthority: string()
|
|
1268
|
+
}),
|
|
1269
|
+
parsedTransactionInstructionType("SplTokenBurnInstruction", {
|
|
1270
|
+
account: string(),
|
|
1271
|
+
amount: string(),
|
|
1272
|
+
authority: string(),
|
|
1273
|
+
mint: string(),
|
|
1274
|
+
multisigAuthority: string()
|
|
1275
|
+
}),
|
|
1276
|
+
parsedTransactionInstructionType("SplTokenCloseAccountInstruction", {
|
|
1277
|
+
account: string(),
|
|
1278
|
+
destination: string(),
|
|
1279
|
+
multisigOwner: string(),
|
|
1280
|
+
owner: string()
|
|
1281
|
+
}),
|
|
1282
|
+
parsedTransactionInstructionType("SplTokenFreezeAccountInstruction", {
|
|
1283
|
+
account: string(),
|
|
1284
|
+
freezeAuthority: string(),
|
|
1285
|
+
mint: string(),
|
|
1286
|
+
multisigFreezeAuthority: string()
|
|
1287
|
+
}),
|
|
1288
|
+
parsedTransactionInstructionType("SplTokenThawAccountInstruction", {
|
|
1289
|
+
account: string(),
|
|
1290
|
+
freezeAuthority: string(),
|
|
1291
|
+
mint: string(),
|
|
1292
|
+
multisigFreezeAuthority: string()
|
|
1293
|
+
}),
|
|
1294
|
+
parsedTransactionInstructionType("SplTokenTransferCheckedInstruction", {
|
|
1295
|
+
authority: string(),
|
|
1296
|
+
destination: string(),
|
|
1297
|
+
mint: string(),
|
|
1298
|
+
multisigAuthority: string(),
|
|
1299
|
+
source: string(),
|
|
1300
|
+
tokenAmount: string()
|
|
1301
|
+
}),
|
|
1302
|
+
parsedTransactionInstructionType("SplTokenApproveCheckedInstruction", {
|
|
1303
|
+
delegate: string(),
|
|
1304
|
+
mint: string(),
|
|
1305
|
+
multisigOwner: string(),
|
|
1306
|
+
owner: string(),
|
|
1307
|
+
source: string(),
|
|
1308
|
+
tokenAmount: string()
|
|
1309
|
+
}),
|
|
1310
|
+
parsedTransactionInstructionType("SplTokenMintToCheckedInstruction", {
|
|
1311
|
+
account: string(),
|
|
1312
|
+
authority: string(),
|
|
1313
|
+
mint: string(),
|
|
1314
|
+
mintAuthority: string(),
|
|
1315
|
+
multisigMintAuthority: string(),
|
|
1316
|
+
tokenAmount: string()
|
|
1317
|
+
}),
|
|
1318
|
+
parsedTransactionInstructionType("SplTokenBurnCheckedInstruction", {
|
|
1319
|
+
account: string(),
|
|
1320
|
+
authority: string(),
|
|
1321
|
+
mint: string(),
|
|
1322
|
+
multisigAuthority: string(),
|
|
1323
|
+
tokenAmount: string()
|
|
1324
|
+
}),
|
|
1325
|
+
parsedTransactionInstructionType("SplTokenSyncNativeInstruction", {
|
|
1326
|
+
account: string()
|
|
1327
|
+
}),
|
|
1328
|
+
parsedTransactionInstructionType("SplTokenGetAccountDataSizeInstruction", {
|
|
1329
|
+
extensionTypes: list(string()),
|
|
1330
|
+
mint: string()
|
|
1331
|
+
}),
|
|
1332
|
+
parsedTransactionInstructionType("SplTokenInitializeImmutableOwnerInstruction", {
|
|
1333
|
+
account: string()
|
|
1334
|
+
}),
|
|
1335
|
+
parsedTransactionInstructionType("SplTokenAmountToUiAmountInstruction", {
|
|
1336
|
+
amount: string(),
|
|
1337
|
+
mint: string()
|
|
1338
|
+
}),
|
|
1339
|
+
parsedTransactionInstructionType("SplTokenUiAmountToAmountInstruction", {
|
|
1340
|
+
mint: string(),
|
|
1341
|
+
uiAmount: string()
|
|
1342
|
+
}),
|
|
1343
|
+
parsedTransactionInstructionType("SplTokenInitializeMintCloseAuthorityInstruction", {
|
|
1344
|
+
mint: string(),
|
|
1345
|
+
newAuthority: string()
|
|
1346
|
+
})
|
|
1347
|
+
// TODO: Extensions!
|
|
1348
|
+
// - TransferFeeExtension
|
|
1349
|
+
// - ConfidentialTransferFeeExtension
|
|
1350
|
+
// - DefaultAccountStateExtension
|
|
1351
|
+
// - Reallocate
|
|
1352
|
+
// - MemoTransferExtension
|
|
1353
|
+
// - CreateNativeMint
|
|
1354
|
+
// - InitializeNonTransferableMint
|
|
1355
|
+
// - InterestBearingMintExtension
|
|
1356
|
+
// - CpiGuardExtension
|
|
1357
|
+
// - InitializePermanentDelegate
|
|
1358
|
+
// - TransferHookExtension
|
|
1359
|
+
// - ConfidentialTransferFeeExtension
|
|
1360
|
+
// - WithdrawExcessLamports
|
|
1361
|
+
// - MetadataPointerExtension
|
|
1362
|
+
];
|
|
1363
|
+
return memoisedParsedInstructionsSplToken;
|
|
1364
|
+
};
|
|
1365
|
+
var memoisedLockup;
|
|
1366
|
+
var lockup = () => {
|
|
1367
|
+
if (!memoisedLockup)
|
|
1368
|
+
memoisedLockup = new graphql.GraphQLObjectType({
|
|
1369
|
+
fields: {
|
|
1370
|
+
custodian: string(),
|
|
1371
|
+
epoch: bigint(),
|
|
1372
|
+
unixTimestamp: bigint()
|
|
1373
|
+
},
|
|
1374
|
+
name: "Lockup"
|
|
1375
|
+
});
|
|
1376
|
+
return memoisedLockup;
|
|
1377
|
+
};
|
|
1378
|
+
var memoisedParsedInstructionsStake;
|
|
1379
|
+
var parsedInstructionsStake = () => {
|
|
1380
|
+
if (!memoisedParsedInstructionsStake)
|
|
1381
|
+
memoisedParsedInstructionsStake = [
|
|
1382
|
+
parsedTransactionInstructionType("StakeInitializeInstruction", {
|
|
1383
|
+
authorized: object("StakeInitializeInstructionAuthorized", {
|
|
1384
|
+
staker: string(),
|
|
1385
|
+
withdrawer: string()
|
|
1386
|
+
}),
|
|
1387
|
+
lockup: object("StakeInitializeInstructionLockup", {
|
|
1388
|
+
custodian: string(),
|
|
1389
|
+
epoch: bigint(),
|
|
1390
|
+
unixTimestamp: bigint()
|
|
1391
|
+
}),
|
|
1392
|
+
rentSysvar: string(),
|
|
1393
|
+
stakeAccount: string()
|
|
1394
|
+
}),
|
|
1395
|
+
parsedTransactionInstructionType("StakeAuthorizeInstruction", {
|
|
1396
|
+
authority: string(),
|
|
1397
|
+
authorityType: string(),
|
|
1398
|
+
clockSysvar: string(),
|
|
1399
|
+
custodian: string(),
|
|
1400
|
+
newAuthority: string(),
|
|
1401
|
+
stakeAccount: string()
|
|
1402
|
+
}),
|
|
1403
|
+
parsedTransactionInstructionType("StakeDelegateStakeInstruction", {
|
|
1404
|
+
clockSysvar: string(),
|
|
1405
|
+
stakeAccount: string(),
|
|
1406
|
+
stakeAuthority: string(),
|
|
1407
|
+
stakeConfigAccount: string(),
|
|
1408
|
+
stakeHistorySysvar: string(),
|
|
1409
|
+
voteAccount: string()
|
|
1410
|
+
}),
|
|
1411
|
+
parsedTransactionInstructionType("StakeSplitInstruction", {
|
|
1412
|
+
lamports: bigint(),
|
|
1413
|
+
newSplitAccount: string(),
|
|
1414
|
+
stakeAccount: string(),
|
|
1415
|
+
stakeAuthority: string()
|
|
1416
|
+
}),
|
|
1417
|
+
parsedTransactionInstructionType("StakeWithdrawInstruction", {
|
|
1418
|
+
clockSysvar: string(),
|
|
1419
|
+
destination: string(),
|
|
1420
|
+
lamports: bigint(),
|
|
1421
|
+
stakeAccount: string(),
|
|
1422
|
+
withdrawAuthority: string()
|
|
1423
|
+
}),
|
|
1424
|
+
parsedTransactionInstructionType("StakeDeactivateInstruction", {
|
|
1425
|
+
clockSysvar: string(),
|
|
1426
|
+
stakeAccount: string(),
|
|
1427
|
+
stakeAuthority: string()
|
|
1428
|
+
}),
|
|
1429
|
+
parsedTransactionInstructionType("StakeSetLockupInstruction", {
|
|
1430
|
+
custodian: string(),
|
|
1431
|
+
lockup: type(lockup()),
|
|
1432
|
+
stakeAccount: string()
|
|
1433
|
+
}),
|
|
1434
|
+
parsedTransactionInstructionType("StakeMergeInstruction", {
|
|
1435
|
+
clockSysvar: string(),
|
|
1436
|
+
destination: string(),
|
|
1437
|
+
source: string(),
|
|
1438
|
+
stakeAuthority: string(),
|
|
1439
|
+
stakeHistorySysvar: string()
|
|
1440
|
+
}),
|
|
1441
|
+
parsedTransactionInstructionType("StakeAuthorizeWithSeedInstruction", {
|
|
1442
|
+
authorityBase: string(),
|
|
1443
|
+
authorityOwner: string(),
|
|
1444
|
+
authoritySeed: string(),
|
|
1445
|
+
authorityType: string(),
|
|
1446
|
+
clockSysvar: string(),
|
|
1447
|
+
custodian: string(),
|
|
1448
|
+
newAuthorized: string(),
|
|
1449
|
+
stakeAccount: string()
|
|
1450
|
+
}),
|
|
1451
|
+
parsedTransactionInstructionType("StakeInitializeCheckedInstruction", {
|
|
1452
|
+
rentSysvar: string(),
|
|
1453
|
+
stakeAccount: string(),
|
|
1454
|
+
staker: string(),
|
|
1455
|
+
withdrawer: string()
|
|
1456
|
+
}),
|
|
1457
|
+
parsedTransactionInstructionType("StakeAuthorizeCheckedInstruction", {
|
|
1458
|
+
authority: string(),
|
|
1459
|
+
authorityType: string(),
|
|
1460
|
+
clockSysvar: string(),
|
|
1461
|
+
custodian: string(),
|
|
1462
|
+
newAuthority: string(),
|
|
1463
|
+
stakeAccount: string()
|
|
1464
|
+
}),
|
|
1465
|
+
parsedTransactionInstructionType("StakeAuthorizeCheckedWithSeedInstruction", {
|
|
1466
|
+
authorityBase: string(),
|
|
1467
|
+
authorityOwner: string(),
|
|
1468
|
+
authoritySeed: string(),
|
|
1469
|
+
authorityType: string(),
|
|
1470
|
+
clockSysvar: string(),
|
|
1471
|
+
custodian: string(),
|
|
1472
|
+
newAuthorized: string(),
|
|
1473
|
+
stakeAccount: string()
|
|
1474
|
+
}),
|
|
1475
|
+
parsedTransactionInstructionType("StakeSetLockupCheckedInstruction", {
|
|
1476
|
+
custodian: string(),
|
|
1477
|
+
lockup: type(lockup()),
|
|
1478
|
+
stakeAccount: string()
|
|
1479
|
+
}),
|
|
1480
|
+
parsedTransactionInstructionType("StakeDeactivateDelinquentInstruction", {
|
|
1481
|
+
referenceVoteAccount: string(),
|
|
1482
|
+
stakeAccount: string(),
|
|
1483
|
+
voteAccount: string()
|
|
1484
|
+
}),
|
|
1485
|
+
parsedTransactionInstructionType("StakeRedelegateInstruction", {
|
|
1486
|
+
newStakeAccount: string(),
|
|
1487
|
+
stakeAccount: string(),
|
|
1488
|
+
stakeAuthority: string(),
|
|
1489
|
+
stakeConfigAccount: string(),
|
|
1490
|
+
voteAccount: string()
|
|
1491
|
+
})
|
|
1492
|
+
];
|
|
1493
|
+
return memoisedParsedInstructionsStake;
|
|
1494
|
+
};
|
|
1495
|
+
var memoisedParsedInstructionsSystem;
|
|
1496
|
+
var parsedInstructionsSystem = () => {
|
|
1497
|
+
if (!memoisedParsedInstructionsSystem)
|
|
1498
|
+
memoisedParsedInstructionsSystem = [
|
|
1499
|
+
parsedTransactionInstructionType("CreateAccountInstruction", {
|
|
1500
|
+
lamports: bigint(),
|
|
1501
|
+
newAccount: string(),
|
|
1502
|
+
owner: string(),
|
|
1503
|
+
source: string(),
|
|
1504
|
+
space: bigint()
|
|
1505
|
+
}),
|
|
1506
|
+
parsedTransactionInstructionType("AssignInstruction", {
|
|
1507
|
+
owner: string()
|
|
1508
|
+
}),
|
|
1509
|
+
parsedTransactionInstructionType("TransferInstruction", {
|
|
1510
|
+
amount: string(),
|
|
1511
|
+
lamports: number(),
|
|
1512
|
+
source: string()
|
|
1513
|
+
}),
|
|
1514
|
+
parsedTransactionInstructionType("CreateAccountWithSeedInstruction", {
|
|
1515
|
+
base: string(),
|
|
1516
|
+
lamports: bigint(),
|
|
1517
|
+
owner: string(),
|
|
1518
|
+
seed: string(),
|
|
1519
|
+
space: bigint()
|
|
1520
|
+
}),
|
|
1521
|
+
parsedTransactionInstructionType("AdvanceNonceAccountInstruction", {
|
|
1522
|
+
nonceAccount: string(),
|
|
1523
|
+
nonceAuthority: string(),
|
|
1524
|
+
recentBlockhashesSysvar: string()
|
|
1525
|
+
}),
|
|
1526
|
+
parsedTransactionInstructionType("WithdrawNonceAccountInstruction", {
|
|
1527
|
+
destination: string(),
|
|
1528
|
+
lamports: bigint(),
|
|
1529
|
+
nonceAccount: string(),
|
|
1530
|
+
nonceAuthority: string(),
|
|
1531
|
+
recentBlockhashesSysvar: string(),
|
|
1532
|
+
rentSysvar: string()
|
|
1533
|
+
}),
|
|
1534
|
+
parsedTransactionInstructionType("InitializeNonceAccountInstruction", {
|
|
1535
|
+
nonceAccount: string(),
|
|
1536
|
+
nonceAuthority: string(),
|
|
1537
|
+
recentBlockhashesSysvar: string(),
|
|
1538
|
+
rentSysvar: string()
|
|
1539
|
+
}),
|
|
1540
|
+
parsedTransactionInstructionType("AuthorizeNonceAccountInstruction", {
|
|
1541
|
+
newAuthorized: string(),
|
|
1542
|
+
nonceAccount: string(),
|
|
1543
|
+
nonceAuthority: string()
|
|
1544
|
+
}),
|
|
1545
|
+
parsedTransactionInstructionType("UpgradeNonceAccountInstruction", {
|
|
1546
|
+
nonceAccount: string()
|
|
1547
|
+
}),
|
|
1548
|
+
parsedTransactionInstructionType("AllocateInstruction", {
|
|
1549
|
+
account: string(),
|
|
1550
|
+
space: bigint()
|
|
1551
|
+
}),
|
|
1552
|
+
parsedTransactionInstructionType("AllocateWithSeedInstruction", {
|
|
1553
|
+
account: string(),
|
|
1554
|
+
base: string(),
|
|
1555
|
+
owner: string(),
|
|
1556
|
+
seed: string(),
|
|
1557
|
+
space: bigint()
|
|
1558
|
+
}),
|
|
1559
|
+
parsedTransactionInstructionType("AssignWithSeedInstruction", {
|
|
1560
|
+
account: string(),
|
|
1561
|
+
base: string(),
|
|
1562
|
+
owner: string(),
|
|
1563
|
+
seed: string()
|
|
1564
|
+
}),
|
|
1565
|
+
parsedTransactionInstructionType("TransferWithSeedInstruction", {
|
|
1566
|
+
destination: string(),
|
|
1567
|
+
lamports: bigint(),
|
|
1568
|
+
source: string(),
|
|
1569
|
+
sourceBase: string(),
|
|
1570
|
+
sourceOwner: string(),
|
|
1571
|
+
sourceSeed: string()
|
|
1572
|
+
})
|
|
1573
|
+
];
|
|
1574
|
+
return memoisedParsedInstructionsSystem;
|
|
1575
|
+
};
|
|
1576
|
+
var memoisedVote;
|
|
1577
|
+
var vote = () => {
|
|
1578
|
+
if (!memoisedVote)
|
|
1579
|
+
memoisedVote = new graphql.GraphQLObjectType({
|
|
1580
|
+
fields: {
|
|
1581
|
+
hash: string(),
|
|
1582
|
+
slots: list(bigint()),
|
|
1583
|
+
timestamp: bigint()
|
|
1584
|
+
},
|
|
1585
|
+
name: "Vote"
|
|
1586
|
+
});
|
|
1587
|
+
return memoisedVote;
|
|
1588
|
+
};
|
|
1589
|
+
var memoisedVoteStateUpdate;
|
|
1590
|
+
var voteStateUpdate = () => {
|
|
1591
|
+
if (!memoisedVoteStateUpdate)
|
|
1592
|
+
memoisedVoteStateUpdate = new graphql.GraphQLObjectType({
|
|
1593
|
+
fields: {
|
|
1594
|
+
hash: string(),
|
|
1595
|
+
lockouts: list(
|
|
1596
|
+
object("VoteStateUpdateLockout", {
|
|
1597
|
+
confirmationCount: number(),
|
|
1598
|
+
slot: bigint()
|
|
1599
|
+
})
|
|
1600
|
+
),
|
|
1601
|
+
root: bigint(),
|
|
1602
|
+
timestamp: bigint()
|
|
1603
|
+
},
|
|
1604
|
+
name: "VoteStateUpdate"
|
|
1605
|
+
});
|
|
1606
|
+
return memoisedVoteStateUpdate;
|
|
1607
|
+
};
|
|
1608
|
+
var memoisedParsedInstructionsVote;
|
|
1609
|
+
var parsedInstructionsVote = () => {
|
|
1610
|
+
if (!memoisedParsedInstructionsVote)
|
|
1611
|
+
memoisedParsedInstructionsVote = [
|
|
1612
|
+
parsedTransactionInstructionType("VoteInitializeAccountInstruction", {
|
|
1613
|
+
authorizedVoter: string(),
|
|
1614
|
+
authorizedWithdrawer: string(),
|
|
1615
|
+
clockSysvar: string(),
|
|
1616
|
+
commission: number(),
|
|
1617
|
+
node: string(),
|
|
1618
|
+
rentSysvar: string(),
|
|
1619
|
+
voteAccount: string()
|
|
1620
|
+
}),
|
|
1621
|
+
parsedTransactionInstructionType("VoteAuthorizeInstruction", {
|
|
1622
|
+
authority: string(),
|
|
1623
|
+
authorityType: string(),
|
|
1624
|
+
clockSysvar: string(),
|
|
1625
|
+
newAuthority: string(),
|
|
1626
|
+
voteAccount: string()
|
|
1627
|
+
}),
|
|
1628
|
+
parsedTransactionInstructionType("VoteAuthorizeWithSeedInstruction", {
|
|
1629
|
+
authorityBaseKey: string(),
|
|
1630
|
+
authorityOwner: string(),
|
|
1631
|
+
authoritySeed: string(),
|
|
1632
|
+
authorityType: string(),
|
|
1633
|
+
clockSysvar: string(),
|
|
1634
|
+
newAuthority: string(),
|
|
1635
|
+
voteAccount: string()
|
|
1636
|
+
}),
|
|
1637
|
+
parsedTransactionInstructionType("VoteAuthorizeCheckedWithSeedInstruction", {
|
|
1638
|
+
authorityBaseKey: string(),
|
|
1639
|
+
authorityOwner: string(),
|
|
1640
|
+
authoritySeed: string(),
|
|
1641
|
+
authorityType: string(),
|
|
1642
|
+
clockSysvar: string(),
|
|
1643
|
+
newAuthority: string(),
|
|
1644
|
+
voteAccount: string()
|
|
1645
|
+
}),
|
|
1646
|
+
parsedTransactionInstructionType("VoteVoteInstruction", {
|
|
1647
|
+
clockSysvar: string(),
|
|
1648
|
+
slotHashedSysvar: string(),
|
|
1649
|
+
vote: type(vote()),
|
|
1650
|
+
voteAccount: string(),
|
|
1651
|
+
voteAuthority: string()
|
|
1652
|
+
}),
|
|
1653
|
+
parsedTransactionInstructionType("VoteUpdateVoteStateInstruction", {
|
|
1654
|
+
hash: string(),
|
|
1655
|
+
voteAccount: string(),
|
|
1656
|
+
voteAuthority: string(),
|
|
1657
|
+
voteStateUpdate: type(voteStateUpdate())
|
|
1658
|
+
}),
|
|
1659
|
+
parsedTransactionInstructionType("VoteUpdateVoteStateSwitchInstruction", {
|
|
1660
|
+
hash: string(),
|
|
1661
|
+
voteAccount: string(),
|
|
1662
|
+
voteAuthority: string(),
|
|
1663
|
+
voteStateUpdate: type(voteStateUpdate())
|
|
1664
|
+
}),
|
|
1665
|
+
parsedTransactionInstructionType("VoteCompactUpdateVoteStateInstruction", {
|
|
1666
|
+
hash: string(),
|
|
1667
|
+
voteAccount: string(),
|
|
1668
|
+
voteAuthority: string(),
|
|
1669
|
+
voteStateUpdate: type(voteStateUpdate())
|
|
1670
|
+
}),
|
|
1671
|
+
parsedTransactionInstructionType("VoteCompactUpdateVoteStateSwitchInstruction", {
|
|
1672
|
+
hash: string(),
|
|
1673
|
+
voteAccount: string(),
|
|
1674
|
+
voteAuthority: string(),
|
|
1675
|
+
voteStateUpdate: type(voteStateUpdate())
|
|
1676
|
+
}),
|
|
1677
|
+
parsedTransactionInstructionType("VoteWithdrawInstruction", {
|
|
1678
|
+
destination: string(),
|
|
1679
|
+
lamports: bigint(),
|
|
1680
|
+
voteAccount: string(),
|
|
1681
|
+
withdrawAuthority: string()
|
|
1682
|
+
}),
|
|
1683
|
+
parsedTransactionInstructionType("VoteUpdateValidatorIdentityInstruction", {
|
|
1684
|
+
newValidatorIdentity: string(),
|
|
1685
|
+
voteAccount: string(),
|
|
1686
|
+
withdrawAuthority: string()
|
|
1687
|
+
}),
|
|
1688
|
+
parsedTransactionInstructionType("VoteUpdateCommissionInstruction", {
|
|
1689
|
+
commission: string(),
|
|
1690
|
+
voteAccount: string(),
|
|
1691
|
+
withdrawAuthority: string()
|
|
1692
|
+
}),
|
|
1693
|
+
parsedTransactionInstructionType("VoteVoteSwitchInstruction", {
|
|
1694
|
+
clockSysvar: string(),
|
|
1695
|
+
hash: string(),
|
|
1696
|
+
slotHashesSysvar: string(),
|
|
1697
|
+
vote: type(vote()),
|
|
1698
|
+
voteAccount: string(),
|
|
1699
|
+
voteAuthority: string()
|
|
1700
|
+
}),
|
|
1701
|
+
parsedTransactionInstructionType("VoteAuthorizeCheckedInstruction", {
|
|
1702
|
+
authority: string(),
|
|
1703
|
+
authorityType: string(),
|
|
1704
|
+
clockSysvar: string(),
|
|
1705
|
+
newAuthority: string(),
|
|
1706
|
+
voteAccount: string()
|
|
1707
|
+
})
|
|
1708
|
+
];
|
|
1709
|
+
return memoisedParsedInstructionsVote;
|
|
1710
|
+
};
|
|
1711
|
+
var memoisedTransactionMetaInterfaceFields;
|
|
1712
|
+
var transactionMetaInterfaceFields = () => {
|
|
1713
|
+
if (!memoisedTransactionMetaInterfaceFields)
|
|
1714
|
+
memoisedTransactionMetaInterfaceFields = {
|
|
1715
|
+
computeUnitsConsumed: bigint(),
|
|
1716
|
+
err: string(),
|
|
1717
|
+
fee: bigint(),
|
|
1718
|
+
format: string(),
|
|
1719
|
+
loadedAddresses: type(transactionMetaLoadedAddresses()),
|
|
1720
|
+
logMessages: list(string()),
|
|
1721
|
+
postBalances: list(bigint()),
|
|
1722
|
+
postTokenBalances: list(type(tokenBalance())),
|
|
1723
|
+
preBalances: list(bigint()),
|
|
1724
|
+
preTokenBalances: list(type(tokenBalance())),
|
|
1725
|
+
returnData: type(returnData()),
|
|
1726
|
+
rewards: list(type(reward())),
|
|
1727
|
+
status: type(transactionStatus())
|
|
1728
|
+
};
|
|
1729
|
+
return memoisedTransactionMetaInterfaceFields;
|
|
1730
|
+
};
|
|
1731
|
+
var memoisedTransactionMetaInterface;
|
|
1732
|
+
var transactionMetaInterface = () => {
|
|
1733
|
+
if (!memoisedTransactionMetaInterface)
|
|
1734
|
+
memoisedTransactionMetaInterface = new graphql.GraphQLInterfaceType({
|
|
1735
|
+
fields: {
|
|
1736
|
+
...transactionMetaInterfaceFields()
|
|
1737
|
+
},
|
|
1738
|
+
name: "TransactionMeta",
|
|
1739
|
+
resolveType(meta) {
|
|
1740
|
+
if (meta.format === "parsed") {
|
|
1741
|
+
return "TransactionMetaParsed";
|
|
1742
|
+
}
|
|
1743
|
+
return "TransactionMetaUnparsed";
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
return memoisedTransactionMetaInterface;
|
|
1747
|
+
};
|
|
1748
|
+
var transactionMetaType = (name, description, innerInstructions) => new graphql.GraphQLObjectType({
|
|
1749
|
+
description,
|
|
1750
|
+
fields: {
|
|
1751
|
+
...transactionMetaInterfaceFields(),
|
|
1752
|
+
innerInstructions
|
|
1753
|
+
},
|
|
1754
|
+
interfaces: [transactionMetaInterface()],
|
|
1755
|
+
name
|
|
1756
|
+
});
|
|
1757
|
+
var memoisedTransactionMetaUnparsed;
|
|
1758
|
+
var transactionMetaUnparsed = () => {
|
|
1759
|
+
if (!memoisedTransactionMetaUnparsed)
|
|
1760
|
+
memoisedTransactionMetaUnparsed = transactionMetaType(
|
|
1761
|
+
"TransactionMetaUnparsed",
|
|
1762
|
+
"Non-parsed transaction meta",
|
|
1763
|
+
list(
|
|
1764
|
+
object("TransactionMetaInnerInstructionsUnparsed", {
|
|
1765
|
+
index: number(),
|
|
1766
|
+
instructions: list(
|
|
1767
|
+
object("TransactionMetaInnerInstructionsUnparsedInstruction", {
|
|
1768
|
+
index: number(),
|
|
1769
|
+
instructions: list(type(transactionInstruction()))
|
|
1770
|
+
})
|
|
1771
|
+
)
|
|
1772
|
+
})
|
|
1773
|
+
)
|
|
1774
|
+
);
|
|
1775
|
+
return memoisedTransactionMetaUnparsed;
|
|
1776
|
+
};
|
|
1777
|
+
var memoisedTransactionMetaParsed;
|
|
1778
|
+
var transactionMetaParsed = () => {
|
|
1779
|
+
if (!memoisedTransactionMetaParsed)
|
|
1780
|
+
memoisedTransactionMetaParsed = transactionMetaType(
|
|
1781
|
+
"TransactionMetaParsed",
|
|
1782
|
+
"Parsed transaction meta",
|
|
1783
|
+
list(
|
|
1784
|
+
object("TransactionMetaInnerInstructionsParsed", {
|
|
1785
|
+
index: number(),
|
|
1786
|
+
instructions: list(type(parsedTransactionInstructionInterface()))
|
|
1787
|
+
})
|
|
1788
|
+
)
|
|
1789
|
+
);
|
|
1790
|
+
return memoisedTransactionMetaParsed;
|
|
1791
|
+
};
|
|
1792
|
+
var memoisedTransactionMessageInterfaceFields;
|
|
1793
|
+
var transactionMessageInterfaceFields = () => {
|
|
1794
|
+
if (!memoisedTransactionMessageInterfaceFields)
|
|
1795
|
+
memoisedTransactionMessageInterfaceFields = {
|
|
1796
|
+
addressTableLookups: list(type(addressTableLookup())),
|
|
1797
|
+
format: string(),
|
|
1798
|
+
header: object("TransactionJsonTransactionHeader", {
|
|
1799
|
+
numReadonlySignedAccounts: number(),
|
|
1800
|
+
numReadonlyUnsignedAccounts: number(),
|
|
1801
|
+
numRequiredSignatures: number()
|
|
1802
|
+
}),
|
|
1803
|
+
recentBlockhash: string()
|
|
1804
|
+
};
|
|
1805
|
+
return memoisedTransactionMessageInterfaceFields;
|
|
1806
|
+
};
|
|
1807
|
+
var memoisedTransactionMessageInterface;
|
|
1808
|
+
var transactionMessageInterface = () => {
|
|
1809
|
+
if (!memoisedTransactionMessageInterface)
|
|
1810
|
+
memoisedTransactionMessageInterface = new graphql.GraphQLInterfaceType({
|
|
1811
|
+
fields: {
|
|
1812
|
+
...transactionMessageInterfaceFields()
|
|
1813
|
+
},
|
|
1814
|
+
name: "TransactionMessage",
|
|
1815
|
+
resolveType(message) {
|
|
1816
|
+
if (message.format === "parsed") {
|
|
1817
|
+
return "TransactionMessageParsed";
|
|
1818
|
+
}
|
|
1819
|
+
return "TransactionMessageUnparsed";
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
return memoisedTransactionMessageInterface;
|
|
1823
|
+
};
|
|
1824
|
+
var transactionMessageType = (name, description, accountKeys, instructions) => new graphql.GraphQLObjectType({
|
|
1825
|
+
description,
|
|
1826
|
+
fields: {
|
|
1827
|
+
...transactionMessageInterfaceFields(),
|
|
1828
|
+
accountKeys,
|
|
1829
|
+
instructions
|
|
1830
|
+
},
|
|
1831
|
+
interfaces: [transactionMessageInterface()],
|
|
1832
|
+
name
|
|
1833
|
+
});
|
|
1834
|
+
var memoisedTransactionMessageUnparsed;
|
|
1835
|
+
var transactionMessageUnparsed = () => {
|
|
1836
|
+
if (!memoisedTransactionMessageUnparsed)
|
|
1837
|
+
memoisedTransactionMessageUnparsed = transactionMessageType(
|
|
1838
|
+
"TransactionMessageUnparsed",
|
|
1839
|
+
"Non-parsed transaction message",
|
|
1840
|
+
list(string()),
|
|
1841
|
+
list(type(transactionInstruction()))
|
|
1842
|
+
);
|
|
1843
|
+
return memoisedTransactionMessageUnparsed;
|
|
1844
|
+
};
|
|
1845
|
+
var memoisedTransactionMessageParsed;
|
|
1846
|
+
var transactionMessageParsed = () => {
|
|
1847
|
+
if (!memoisedTransactionMessageParsed)
|
|
1848
|
+
memoisedTransactionMessageParsed = transactionMessageType(
|
|
1849
|
+
"TransactionMessageParsed",
|
|
1850
|
+
"Parsed transaction message",
|
|
1851
|
+
list(
|
|
1852
|
+
object("transactionMessageParsedAccountKey", {
|
|
1853
|
+
pubkey: string(),
|
|
1854
|
+
signer: boolean(),
|
|
1855
|
+
source: string(),
|
|
1856
|
+
writable: boolean()
|
|
1857
|
+
})
|
|
1858
|
+
),
|
|
1859
|
+
list(type(parsedTransactionInstructionInterface()))
|
|
1860
|
+
);
|
|
1861
|
+
return memoisedTransactionMessageParsed;
|
|
1862
|
+
};
|
|
1863
|
+
var memoisedTransactionTransaction;
|
|
1864
|
+
var transactionTransaction = () => {
|
|
1865
|
+
if (!memoisedTransactionTransaction)
|
|
1866
|
+
memoisedTransactionTransaction = new graphql.GraphQLObjectType({
|
|
1867
|
+
fields: {
|
|
1868
|
+
message: type(transactionMessageInterface()),
|
|
1869
|
+
signatures: list(string())
|
|
1870
|
+
},
|
|
1871
|
+
name: "TransactionTransaction"
|
|
1872
|
+
});
|
|
1873
|
+
return memoisedTransactionTransaction;
|
|
1874
|
+
};
|
|
1875
|
+
var memoisedTransactionInterfaceFields;
|
|
1876
|
+
var transactionInterfaceFields = () => {
|
|
1877
|
+
if (!memoisedTransactionInterfaceFields)
|
|
1878
|
+
memoisedTransactionInterfaceFields = {
|
|
1879
|
+
blockTime: bigint(),
|
|
1880
|
+
encoding: string(),
|
|
1881
|
+
meta: type(transactionMetaInterface()),
|
|
1882
|
+
slot: bigint()
|
|
1883
|
+
};
|
|
1884
|
+
return memoisedTransactionInterfaceFields;
|
|
1885
|
+
};
|
|
1886
|
+
var memoisedTransactionInterface;
|
|
1887
|
+
var transactionInterface = () => {
|
|
1888
|
+
if (!memoisedTransactionInterface)
|
|
1889
|
+
memoisedTransactionInterface = new graphql.GraphQLInterfaceType({
|
|
1890
|
+
fields: {
|
|
1891
|
+
...transactionInterfaceFields()
|
|
1892
|
+
},
|
|
1893
|
+
name: "Transaction",
|
|
1894
|
+
resolveType(transaction) {
|
|
1895
|
+
if (transaction.encoding === "base58") {
|
|
1896
|
+
return "TransactionBase58";
|
|
1897
|
+
}
|
|
1898
|
+
if (transaction.encoding === "base64") {
|
|
1899
|
+
return "TransactionBase64";
|
|
1900
|
+
}
|
|
1901
|
+
if (transaction.encoding === "json") {
|
|
1902
|
+
return "TransactionJson";
|
|
1903
|
+
}
|
|
1904
|
+
return "TransactionJsonParsed";
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
return memoisedTransactionInterface;
|
|
1908
|
+
};
|
|
1909
|
+
var transactionType = (name, description, transaction) => new graphql.GraphQLObjectType({
|
|
1910
|
+
description,
|
|
1911
|
+
fields: {
|
|
1912
|
+
...transactionInterfaceFields(),
|
|
1913
|
+
transaction
|
|
1914
|
+
},
|
|
1915
|
+
interfaces: [transactionInterface()],
|
|
1916
|
+
name
|
|
1917
|
+
});
|
|
1918
|
+
var memoisedTransactionBase58;
|
|
1919
|
+
var transactionBase58 = () => {
|
|
1920
|
+
if (!memoisedTransactionBase58)
|
|
1921
|
+
memoisedTransactionBase58 = transactionType(
|
|
1922
|
+
"TransactionBase58",
|
|
1923
|
+
"A Solana transaction as base58 encoded data",
|
|
1924
|
+
string()
|
|
1925
|
+
);
|
|
1926
|
+
return memoisedTransactionBase58;
|
|
1927
|
+
};
|
|
1928
|
+
var memoisedTransactionBase64;
|
|
1929
|
+
var transactionBase64 = () => {
|
|
1930
|
+
if (!memoisedTransactionBase64)
|
|
1931
|
+
memoisedTransactionBase64 = transactionType(
|
|
1932
|
+
"TransactionBase64",
|
|
1933
|
+
"A Solana transaction as base64 encoded data",
|
|
1934
|
+
string()
|
|
1935
|
+
);
|
|
1936
|
+
return memoisedTransactionBase64;
|
|
1937
|
+
};
|
|
1938
|
+
var memoisedTransactionJson;
|
|
1939
|
+
var transactionJson = () => {
|
|
1940
|
+
if (!memoisedTransactionJson)
|
|
1941
|
+
memoisedTransactionJson = transactionType(
|
|
1942
|
+
"TransactionJson",
|
|
1943
|
+
"A Solana transaction as a JSON object",
|
|
1944
|
+
type(transactionTransaction())
|
|
1945
|
+
);
|
|
1946
|
+
return memoisedTransactionJson;
|
|
1947
|
+
};
|
|
1948
|
+
var memoisedTransactionJsonParsed;
|
|
1949
|
+
var transactionJsonParsed = () => {
|
|
1950
|
+
if (!memoisedTransactionJsonParsed)
|
|
1951
|
+
memoisedTransactionJsonParsed = transactionType(
|
|
1952
|
+
"TransactionJsonParsed",
|
|
1953
|
+
"A Solana transaction as a parsed JSON object",
|
|
1954
|
+
type(transactionTransaction())
|
|
1955
|
+
);
|
|
1956
|
+
return memoisedTransactionJsonParsed;
|
|
1957
|
+
};
|
|
1958
|
+
var memoisedTransactionTypes;
|
|
1959
|
+
var transactionTypes = () => {
|
|
1960
|
+
if (!memoisedTransactionTypes)
|
|
1961
|
+
memoisedTransactionTypes = [
|
|
1962
|
+
partiallyDecodedTransactionInstruction(),
|
|
1963
|
+
...parsedInstructionsAddressLookupTable(),
|
|
1964
|
+
...parsedInstructionsBpfLoader(),
|
|
1965
|
+
...parsedInstructionsBpfUpgradeableLoader(),
|
|
1966
|
+
...parsedInstructionsStake(),
|
|
1967
|
+
...parsedInstructionsSplAssociatedToken(),
|
|
1968
|
+
parsedInstructionSplMemo(),
|
|
1969
|
+
...parsedInstructionsSplToken(),
|
|
1970
|
+
...parsedInstructionsSystem(),
|
|
1971
|
+
...parsedInstructionsVote(),
|
|
1972
|
+
transactionMetaUnparsed(),
|
|
1973
|
+
transactionMetaParsed(),
|
|
1974
|
+
transactionMessageUnparsed(),
|
|
1975
|
+
transactionMessageParsed(),
|
|
1976
|
+
transactionBase58(),
|
|
1977
|
+
transactionBase64(),
|
|
1978
|
+
transactionJson(),
|
|
1979
|
+
transactionJsonParsed()
|
|
1980
|
+
];
|
|
1981
|
+
return memoisedTransactionTypes;
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
// src/schema/transaction/query.ts
|
|
1985
|
+
var transactionQuery = () => ({
|
|
1986
|
+
transaction: {
|
|
1987
|
+
args: {
|
|
1988
|
+
commitment: type(commitmentInputType()),
|
|
1989
|
+
encoding: type(transactionEncodingInputType()),
|
|
1990
|
+
maxSupportedTransactionVersion: type(maxSupportedTransactionVersionInputType()),
|
|
1991
|
+
signature: nonNull(string())
|
|
1992
|
+
},
|
|
1993
|
+
resolve: (_parent, args, context) => context.resolveTransaction(args),
|
|
1994
|
+
type: transactionInterface()
|
|
1995
|
+
}
|
|
1996
|
+
});
|
|
1997
|
+
|
|
1998
|
+
// src/schema/block/types.ts
|
|
1999
|
+
var memoisedTransactionForAccounts;
|
|
2000
|
+
var transactionForAccounts = () => {
|
|
2001
|
+
if (!memoisedTransactionForAccounts)
|
|
2002
|
+
memoisedTransactionForAccounts = new graphql.GraphQLObjectType({
|
|
2003
|
+
fields: {
|
|
2004
|
+
meta: object("TransactionMetaForAccounts", {
|
|
2005
|
+
computeUnitsUsed: bigint(),
|
|
2006
|
+
err: string(),
|
|
2007
|
+
fee: bigint(),
|
|
2008
|
+
format: string(),
|
|
2009
|
+
loadedAddresses: type(transactionMetaLoadedAddresses()),
|
|
2010
|
+
logMessages: list(string()),
|
|
2011
|
+
postBalances: list(bigint()),
|
|
2012
|
+
postTokenBalances: list(type(tokenBalance())),
|
|
2013
|
+
preBalances: list(bigint()),
|
|
2014
|
+
preTokenBalances: list(type(tokenBalance())),
|
|
2015
|
+
returnData: type(returnData()),
|
|
2016
|
+
rewards: list(type(reward())),
|
|
2017
|
+
status: type(transactionStatus())
|
|
2018
|
+
}),
|
|
2019
|
+
transaction: type(transactionInterface()),
|
|
2020
|
+
// TODO
|
|
2021
|
+
version: string()
|
|
2022
|
+
},
|
|
2023
|
+
name: "TransactionForAccounts"
|
|
2024
|
+
});
|
|
2025
|
+
return memoisedTransactionForAccounts;
|
|
2026
|
+
};
|
|
2027
|
+
var memoisedBlockInterfaceFields;
|
|
2028
|
+
var blockInterfaceFields = () => {
|
|
2029
|
+
if (!memoisedBlockInterfaceFields)
|
|
2030
|
+
memoisedBlockInterfaceFields = {
|
|
2031
|
+
blockHeight: bigint(),
|
|
2032
|
+
blockTime: bigint(),
|
|
2033
|
+
blockhash: string(),
|
|
2034
|
+
parentSlot: bigint(),
|
|
2035
|
+
previousBlockhash: string(),
|
|
2036
|
+
rewards: list(type(reward()))
|
|
2037
|
+
};
|
|
2038
|
+
return memoisedBlockInterfaceFields;
|
|
2039
|
+
};
|
|
2040
|
+
var memoisedBlockInterface;
|
|
2041
|
+
var blockInterface = () => {
|
|
2042
|
+
if (!memoisedBlockInterface)
|
|
2043
|
+
memoisedBlockInterface = new graphql.GraphQLInterfaceType({
|
|
2044
|
+
fields: {
|
|
2045
|
+
...blockInterfaceFields()
|
|
2046
|
+
},
|
|
2047
|
+
name: "Block",
|
|
2048
|
+
resolveType(block) {
|
|
2049
|
+
if (block.transactionDetails === "signatures") {
|
|
2050
|
+
return "BlockWithSignatures";
|
|
2051
|
+
}
|
|
2052
|
+
if (block.transactionDetails === "accounts") {
|
|
2053
|
+
return "BlockWithAccounts";
|
|
2054
|
+
}
|
|
2055
|
+
if (block.transactionDetails === "none") {
|
|
2056
|
+
return "BlockWithNoTransactions";
|
|
2057
|
+
}
|
|
2058
|
+
return "BlockWithTransactions";
|
|
2059
|
+
}
|
|
2060
|
+
});
|
|
2061
|
+
return memoisedBlockInterface;
|
|
2062
|
+
};
|
|
2063
|
+
var memoisedBlockWithNoTransactions;
|
|
2064
|
+
var blockWithNoTransactions = () => {
|
|
2065
|
+
if (!memoisedBlockWithNoTransactions)
|
|
2066
|
+
memoisedBlockWithNoTransactions = new graphql.GraphQLObjectType({
|
|
2067
|
+
fields: {
|
|
2068
|
+
...blockInterfaceFields()
|
|
2069
|
+
},
|
|
2070
|
+
interfaces: [blockInterface()],
|
|
2071
|
+
name: "BlockWithNoTransactions"
|
|
2072
|
+
});
|
|
2073
|
+
return memoisedBlockWithNoTransactions;
|
|
2074
|
+
};
|
|
2075
|
+
var memoisedBlockWithSignatures;
|
|
2076
|
+
var blockWithSignatures = () => {
|
|
2077
|
+
if (!memoisedBlockWithSignatures)
|
|
2078
|
+
memoisedBlockWithSignatures = new graphql.GraphQLObjectType({
|
|
2079
|
+
fields: {
|
|
2080
|
+
...blockInterfaceFields(),
|
|
2081
|
+
signatures: list(string())
|
|
2082
|
+
},
|
|
2083
|
+
interfaces: [blockInterface()],
|
|
2084
|
+
name: "BlockWithSignatures"
|
|
2085
|
+
});
|
|
2086
|
+
return memoisedBlockWithSignatures;
|
|
2087
|
+
};
|
|
2088
|
+
var memoisedBlockWithAccounts;
|
|
2089
|
+
var blockWithAccounts = () => {
|
|
2090
|
+
if (!memoisedBlockWithAccounts)
|
|
2091
|
+
memoisedBlockWithAccounts = new graphql.GraphQLObjectType({
|
|
2092
|
+
fields: {
|
|
2093
|
+
...blockInterfaceFields(),
|
|
2094
|
+
transactions: list(type(transactionForAccounts()))
|
|
2095
|
+
},
|
|
2096
|
+
interfaces: [blockInterface()],
|
|
2097
|
+
name: "BlockWithAccounts"
|
|
2098
|
+
});
|
|
2099
|
+
return memoisedBlockWithAccounts;
|
|
2100
|
+
};
|
|
2101
|
+
var memoisedBlockWithTransactions;
|
|
2102
|
+
var blockWithTransactions = () => {
|
|
2103
|
+
if (!memoisedBlockWithTransactions)
|
|
2104
|
+
memoisedBlockWithTransactions = new graphql.GraphQLObjectType({
|
|
2105
|
+
fields: {
|
|
2106
|
+
...blockInterfaceFields(),
|
|
2107
|
+
transactions: list(type(transactionInterface()))
|
|
2108
|
+
},
|
|
2109
|
+
interfaces: [blockInterface()],
|
|
2110
|
+
name: "BlockWithTransactions"
|
|
2111
|
+
});
|
|
2112
|
+
return memoisedBlockWithTransactions;
|
|
2113
|
+
};
|
|
2114
|
+
var memoisedBlockTypes;
|
|
2115
|
+
var blockTypes = () => {
|
|
2116
|
+
if (!memoisedBlockTypes)
|
|
2117
|
+
memoisedBlockTypes = [
|
|
2118
|
+
blockWithNoTransactions(),
|
|
2119
|
+
blockWithSignatures(),
|
|
2120
|
+
blockWithAccounts(),
|
|
2121
|
+
blockWithTransactions()
|
|
2122
|
+
];
|
|
2123
|
+
return memoisedBlockTypes;
|
|
2124
|
+
};
|
|
2125
|
+
|
|
2126
|
+
// src/schema/block/query.ts
|
|
2127
|
+
var blockQuery = () => ({
|
|
2128
|
+
block: {
|
|
2129
|
+
args: {
|
|
2130
|
+
commitment: type(commitmentInputType()),
|
|
2131
|
+
encoding: type(transactionEncodingInputType()),
|
|
2132
|
+
maxSupportedTransactionVersion: string(),
|
|
2133
|
+
rewards: boolean(),
|
|
2134
|
+
slot: nonNull(bigint()),
|
|
2135
|
+
transactionDetails: type(blockTransactionDetailsInputType())
|
|
2136
|
+
},
|
|
2137
|
+
resolve: (_parent, args, context) => context.resolveBlock(args),
|
|
2138
|
+
type: blockInterface()
|
|
2139
|
+
}
|
|
2140
|
+
});
|
|
2141
|
+
var programAccount = () => new graphql.GraphQLObjectType({
|
|
2142
|
+
fields: {
|
|
2143
|
+
account: type(accountInterface()),
|
|
2144
|
+
pubkey: string()
|
|
2145
|
+
},
|
|
2146
|
+
name: "ProgramAccount"
|
|
2147
|
+
});
|
|
2148
|
+
|
|
2149
|
+
// src/schema/program-accounts/query.ts
|
|
2150
|
+
var programAccountsQuery = () => ({
|
|
2151
|
+
programAccounts: {
|
|
2152
|
+
args: {
|
|
2153
|
+
commitment: type(commitmentInputType()),
|
|
2154
|
+
dataSlice: type(dataSliceInputType()),
|
|
2155
|
+
encoding: type(accountEncodingInputType()),
|
|
2156
|
+
filters: list(type(programAccountFilterInputType())),
|
|
2157
|
+
minContextSlot: bigint(),
|
|
2158
|
+
programAddress: nonNull(string()),
|
|
2159
|
+
withContext: string()
|
|
2160
|
+
},
|
|
2161
|
+
resolve: (_parent, args, context) => context.resolveProgramAccounts(args),
|
|
2162
|
+
type: new graphql.GraphQLList(programAccount())
|
|
2163
|
+
}
|
|
2164
|
+
});
|
|
43
2165
|
|
|
44
2166
|
// src/rpc.ts
|
|
45
2167
|
function createRpcGraphQL(rpc) {
|
|
@@ -47,11 +2169,14 @@ function createRpcGraphQL(rpc) {
|
|
|
47
2169
|
const schema = new graphql.GraphQLSchema({
|
|
48
2170
|
query: new graphql.GraphQLObjectType({
|
|
49
2171
|
fields: {
|
|
50
|
-
|
|
2172
|
+
...accountQuery(),
|
|
2173
|
+
...blockQuery(),
|
|
2174
|
+
...programAccountsQuery(),
|
|
2175
|
+
...transactionQuery()
|
|
51
2176
|
},
|
|
52
2177
|
name: "RootQuery"
|
|
53
2178
|
}),
|
|
54
|
-
types: []
|
|
2179
|
+
types: [...accountTypes(), ...blockTypes(), ...transactionTypes()]
|
|
55
2180
|
});
|
|
56
2181
|
return {
|
|
57
2182
|
context,
|