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