@solana/rpc-graphql 2.0.0-experimental.fb51adb → 2.0.0-experimental.fb655dd
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/dist/index.browser.cjs +783 -610
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +783 -610
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +783 -610
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +783 -610
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +783 -610
- package/dist/index.node.js.map +1 -1
- package/dist/types/loaders/account.d.ts +5 -0
- package/dist/types/loaders/account.d.ts.map +1 -1
- package/dist/types/loaders/block.d.ts.map +1 -1
- package/dist/types/loaders/coalescer.d.ts +55 -0
- package/dist/types/loaders/coalescer.d.ts.map +1 -0
- package/dist/types/loaders/loader.d.ts +14 -8
- package/dist/types/loaders/loader.d.ts.map +1 -1
- package/dist/types/loaders/program-accounts.d.ts +5 -1
- package/dist/types/loaders/program-accounts.d.ts.map +1 -1
- package/dist/types/loaders/transaction.d.ts.map +1 -1
- package/dist/types/resolvers/block.d.ts +95 -11
- package/dist/types/resolvers/block.d.ts.map +1 -1
- package/dist/types/resolvers/instruction.d.ts +256 -4
- package/dist/types/resolvers/instruction.d.ts.map +1 -1
- package/dist/types/resolvers/program-accounts.d.ts +11 -3
- package/dist/types/resolvers/program-accounts.d.ts.map +1 -1
- package/dist/types/resolvers/resolve-info/account.d.ts +2 -1
- package/dist/types/resolvers/resolve-info/account.d.ts.map +1 -1
- package/dist/types/resolvers/resolve-info/block.d.ts +13 -0
- package/dist/types/resolvers/resolve-info/block.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 -1
- package/dist/types/resolvers/resolve-info/program-accounts.d.ts +20 -0
- package/dist/types/resolvers/resolve-info/program-accounts.d.ts.map +1 -0
- package/dist/types/resolvers/resolve-info/transaction.d.ts +15 -0
- package/dist/types/resolvers/resolve-info/transaction.d.ts.map +1 -0
- package/dist/types/resolvers/transaction.d.ts +32 -9
- package/dist/types/resolvers/transaction.d.ts.map +1 -1
- package/dist/types/resolvers/types.d.ts +4 -11
- package/dist/types/resolvers/types.d.ts.map +1 -1
- package/dist/types/schema/block.d.ts +1 -1
- package/dist/types/schema/block.d.ts.map +1 -1
- package/dist/types/schema/instruction.d.ts +1 -1
- package/dist/types/schema/root.d.ts +1 -1
- package/dist/types/schema/root.d.ts.map +1 -1
- package/dist/types/schema/transaction.d.ts +1 -1
- package/dist/types/schema/transaction.d.ts.map +1 -1
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/schema/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.browser.cjs
CHANGED
|
@@ -20,6 +20,151 @@ function replacer(_, value) {
|
|
|
20
20
|
}
|
|
21
21
|
var cacheKeyFn = (obj) => stringify__default.default(obj, { replacer });
|
|
22
22
|
|
|
23
|
+
// src/loaders/coalescer.ts
|
|
24
|
+
var hashOmit = (args, omit) => {
|
|
25
|
+
const argsObj = {};
|
|
26
|
+
for (const [key, value] of Object.entries(args)) {
|
|
27
|
+
if (!omit.includes(key)) {
|
|
28
|
+
argsObj[key] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return cacheKeyFn(argsObj);
|
|
32
|
+
};
|
|
33
|
+
function buildCoalescedFetchesByArgsHash(toFetchMap, orphanConfig) {
|
|
34
|
+
const fetchesByArgsHash = {};
|
|
35
|
+
const orphanedFetches = {};
|
|
36
|
+
Object.entries(toFetchMap).forEach(([signature, toFetch]) => {
|
|
37
|
+
toFetch.forEach(({ args, promiseCallback }) => {
|
|
38
|
+
if (orphanConfig.criteria(args)) {
|
|
39
|
+
const toFetch2 = orphanedFetches[signature] ||= [];
|
|
40
|
+
toFetch2.push({ args, promiseCallback });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const argsHash = hashOmit(args, []);
|
|
44
|
+
const transactionFetches = fetchesByArgsHash[argsHash] ||= {
|
|
45
|
+
args,
|
|
46
|
+
fetches: {}
|
|
47
|
+
};
|
|
48
|
+
const { callbacks: promiseCallbacksForSignature } = transactionFetches.fetches[signature] ||= {
|
|
49
|
+
callbacks: []
|
|
50
|
+
};
|
|
51
|
+
promiseCallbacksForSignature.push(promiseCallback);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
Object.entries(orphanedFetches).forEach(([signature, toFetch]) => {
|
|
55
|
+
toFetch.forEach(({ args: orphanArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
56
|
+
if (Object.keys(fetchesByArgsHash).length !== 0) {
|
|
57
|
+
for (const { fetches, args: args2 } of Object.values(fetchesByArgsHash)) {
|
|
58
|
+
if (hashOmit(orphanArgs, orphanConfig.hashOmit) === hashOmit(args2, orphanConfig.hashOmit)) {
|
|
59
|
+
const { callbacks: promiseCallbacksForSignature2 } = fetches[signature] ||= {
|
|
60
|
+
callbacks: []
|
|
61
|
+
};
|
|
62
|
+
promiseCallbacksForSignature2.push(orphanPromiseCallback);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const args = orphanConfig.defaults(orphanArgs);
|
|
68
|
+
const argsHash = hashOmit(args, []);
|
|
69
|
+
const transactionFetches = fetchesByArgsHash[argsHash] ||= {
|
|
70
|
+
args,
|
|
71
|
+
fetches: {}
|
|
72
|
+
};
|
|
73
|
+
const { callbacks: promiseCallbacksForSignature } = transactionFetches.fetches[signature] ||= {
|
|
74
|
+
callbacks: []
|
|
75
|
+
};
|
|
76
|
+
promiseCallbacksForSignature.push(orphanPromiseCallback);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
return fetchesByArgsHash;
|
|
80
|
+
}
|
|
81
|
+
function buildCoalescedFetchesByArgsHashWithDataSlice(toFetchMap, maxDataSliceByteRange) {
|
|
82
|
+
const fetchesByArgsHash = {};
|
|
83
|
+
const orphanedFetches = {};
|
|
84
|
+
Object.entries(toFetchMap).forEach(([address, toFetch]) => {
|
|
85
|
+
toFetch.forEach(({ args, promiseCallback }) => {
|
|
86
|
+
if (!args.encoding) {
|
|
87
|
+
const toFetch2 = orphanedFetches[address] ||= [];
|
|
88
|
+
toFetch2.push({ args, promiseCallback });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (args.encoding != "base64+zstd" && args.dataSlice) {
|
|
92
|
+
const r = args.dataSlice;
|
|
93
|
+
for (const { fetches: fetchAddresses, args: fetchArgs } of Object.values(fetchesByArgsHash)) {
|
|
94
|
+
const addCallbackWithDataSlice = (updateDataSlice) => {
|
|
95
|
+
const { callbacks: promiseCallbacksForAddress2 } = fetchAddresses[address] ||= {
|
|
96
|
+
callbacks: []
|
|
97
|
+
};
|
|
98
|
+
promiseCallbacksForAddress2.push({
|
|
99
|
+
callback: promiseCallback,
|
|
100
|
+
dataSlice: args.dataSlice ?? null
|
|
101
|
+
});
|
|
102
|
+
if (fetchArgs.dataSlice && updateDataSlice) {
|
|
103
|
+
fetchArgs.dataSlice = updateDataSlice;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
if (hashOmit(args, ["dataSlice"]) === hashOmit(fetchArgs, ["dataSlice"])) {
|
|
107
|
+
if (fetchArgs.dataSlice) {
|
|
108
|
+
const g = fetchArgs.dataSlice;
|
|
109
|
+
if (r.offset <= g.offset && g.offset - r.offset + r.length <= maxDataSliceByteRange) {
|
|
110
|
+
const length = Math.max(r.length, g.offset + g.length - r.offset);
|
|
111
|
+
const offset = r.offset;
|
|
112
|
+
addCallbackWithDataSlice({ length, offset });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (r.offset >= g.offset && r.offset - g.offset + g.length <= maxDataSliceByteRange) {
|
|
116
|
+
const length = Math.max(g.length, r.offset + r.length - g.offset);
|
|
117
|
+
const offset = g.offset;
|
|
118
|
+
addCallbackWithDataSlice({ length, offset });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
const { length, offset } = r;
|
|
123
|
+
addCallbackWithDataSlice({ length, offset });
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const argsHash = hashOmit(args, []);
|
|
130
|
+
const accountFetches = fetchesByArgsHash[argsHash] ||= {
|
|
131
|
+
args,
|
|
132
|
+
fetches: {}
|
|
133
|
+
};
|
|
134
|
+
const { callbacks: promiseCallbacksForAddress } = accountFetches.fetches[address] ||= {
|
|
135
|
+
callbacks: []
|
|
136
|
+
};
|
|
137
|
+
promiseCallbacksForAddress.push({ callback: promiseCallback, dataSlice: args.dataSlice ?? null });
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
Object.entries(orphanedFetches).forEach(([address, toFetch]) => {
|
|
141
|
+
toFetch.forEach(({ args: orphanedArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
142
|
+
if (Object.keys(fetchesByArgsHash).length !== 0) {
|
|
143
|
+
for (const { fetches, args: args2 } of Object.values(fetchesByArgsHash)) {
|
|
144
|
+
if (hashOmit(orphanedArgs, ["encoding", "dataSlice"]) === hashOmit(args2, ["encoding", "dataSlice"])) {
|
|
145
|
+
const { callbacks: promiseCallbacksForAddress2 } = fetches[address] ||= {
|
|
146
|
+
callbacks: []
|
|
147
|
+
};
|
|
148
|
+
promiseCallbacksForAddress2.push({ callback: orphanPromiseCallback });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const args = { ...orphanedArgs, encoding: "base64" };
|
|
154
|
+
const argsHash = hashOmit(args, []);
|
|
155
|
+
const accountFetches = fetchesByArgsHash[argsHash] ||= {
|
|
156
|
+
args,
|
|
157
|
+
fetches: {}
|
|
158
|
+
};
|
|
159
|
+
const { callbacks: promiseCallbacksForAddress } = accountFetches.fetches[address] ||= {
|
|
160
|
+
callbacks: []
|
|
161
|
+
};
|
|
162
|
+
promiseCallbacksForAddress.push({ callback: orphanPromiseCallback });
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
return fetchesByArgsHash;
|
|
166
|
+
}
|
|
167
|
+
|
|
23
168
|
// src/loaders/account.ts
|
|
24
169
|
function getCodec(encoding) {
|
|
25
170
|
switch (encoding) {
|
|
@@ -63,15 +208,6 @@ async function loadAccount(rpc, { address, ...config }) {
|
|
|
63
208
|
async function loadMultipleAccounts(rpc, { addresses, ...config }) {
|
|
64
209
|
return await rpc.getMultipleAccounts(addresses, config).send().then((res) => res.value);
|
|
65
210
|
}
|
|
66
|
-
var hashOmit = (args, omit) => {
|
|
67
|
-
const argsObj = {};
|
|
68
|
-
for (const [key, value] of Object.entries(args)) {
|
|
69
|
-
if (!omit.includes(key)) {
|
|
70
|
-
argsObj[key] = value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return cacheKeyFn(argsObj);
|
|
74
|
-
};
|
|
75
211
|
function createAccountBatchLoadFn(rpc, config) {
|
|
76
212
|
const resolveAccountUsingRpc = loadAccount.bind(null, rpc);
|
|
77
213
|
const resolveMultipleAccountsUsingRpc = loadMultipleAccounts.bind(null, rpc);
|
|
@@ -91,92 +227,11 @@ function createAccountBatchLoadFn(rpc, config) {
|
|
|
91
227
|
);
|
|
92
228
|
} finally {
|
|
93
229
|
const { maxDataSliceByteRange, maxMultipleAccountsBatchSize } = config;
|
|
94
|
-
const accountFetchesByArgsHash =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const toFetch2 = orphanedFetches[address] ||= [];
|
|
100
|
-
toFetch2.push({ args, promiseCallback });
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (args.encoding != "base64+zstd" && args.dataSlice) {
|
|
104
|
-
const r = args.dataSlice;
|
|
105
|
-
for (const { addresses: fetchAddresses, args: fetchArgs } of Object.values(
|
|
106
|
-
accountFetchesByArgsHash
|
|
107
|
-
)) {
|
|
108
|
-
const addCallbackWithDataSlice = (updateDataSlice) => {
|
|
109
|
-
const { callbacks: promiseCallbacksForAddress2 } = fetchAddresses[address] ||= {
|
|
110
|
-
callbacks: []
|
|
111
|
-
};
|
|
112
|
-
promiseCallbacksForAddress2.push({
|
|
113
|
-
callback: promiseCallback,
|
|
114
|
-
dataSlice: args.dataSlice ?? null
|
|
115
|
-
});
|
|
116
|
-
if (fetchArgs.dataSlice && updateDataSlice) {
|
|
117
|
-
fetchArgs.dataSlice = updateDataSlice;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
if (hashOmit(args, ["dataSlice"]) === hashOmit(fetchArgs, ["dataSlice"])) {
|
|
121
|
-
if (fetchArgs.dataSlice) {
|
|
122
|
-
const g = fetchArgs.dataSlice;
|
|
123
|
-
if (r.offset <= g.offset && g.offset - r.offset + r.length <= maxDataSliceByteRange) {
|
|
124
|
-
const length = Math.max(r.length, g.offset + g.length - r.offset);
|
|
125
|
-
const offset = r.offset;
|
|
126
|
-
addCallbackWithDataSlice({ length, offset });
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (r.offset >= g.offset && r.offset - g.offset + g.length <= maxDataSliceByteRange) {
|
|
130
|
-
const length = Math.max(g.length, r.offset + r.length - g.offset);
|
|
131
|
-
const offset = g.offset;
|
|
132
|
-
addCallbackWithDataSlice({ length, offset });
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
const { length, offset } = r;
|
|
137
|
-
addCallbackWithDataSlice({ length, offset });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const argsHash = hashOmit(args, []);
|
|
144
|
-
const accountFetches = accountFetchesByArgsHash[argsHash] ||= {
|
|
145
|
-
addresses: {},
|
|
146
|
-
args
|
|
147
|
-
};
|
|
148
|
-
const { callbacks: promiseCallbacksForAddress } = accountFetches.addresses[address] ||= {
|
|
149
|
-
callbacks: []
|
|
150
|
-
};
|
|
151
|
-
promiseCallbacksForAddress.push({ callback: promiseCallback, dataSlice: args.dataSlice ?? null });
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
Object.entries(orphanedFetches).forEach(([address, toFetch]) => {
|
|
155
|
-
toFetch.forEach(({ args: orphanedArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
156
|
-
if (Object.keys(accountFetchesByArgsHash).length !== 0) {
|
|
157
|
-
for (const { addresses, args: args2 } of Object.values(accountFetchesByArgsHash)) {
|
|
158
|
-
if (hashOmit(orphanedArgs, ["encoding", "dataSlice"]) === hashOmit(args2, ["encoding", "dataSlice"])) {
|
|
159
|
-
const { callbacks: promiseCallbacksForAddress2 } = addresses[address] ||= {
|
|
160
|
-
callbacks: []
|
|
161
|
-
};
|
|
162
|
-
promiseCallbacksForAddress2.push({ callback: orphanPromiseCallback });
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const args = { ...orphanedArgs, encoding: "base64" };
|
|
168
|
-
const argsHash = hashOmit(args, []);
|
|
169
|
-
const accountFetches = accountFetchesByArgsHash[argsHash] ||= {
|
|
170
|
-
addresses: {},
|
|
171
|
-
args
|
|
172
|
-
};
|
|
173
|
-
const { callbacks: promiseCallbacksForAddress } = accountFetches.addresses[address] ||= {
|
|
174
|
-
callbacks: []
|
|
175
|
-
};
|
|
176
|
-
promiseCallbacksForAddress.push({ callback: orphanPromiseCallback });
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
Object.values(accountFetchesByArgsHash).map(({ args, addresses: addressCallbacks }) => {
|
|
230
|
+
const accountFetchesByArgsHash = buildCoalescedFetchesByArgsHashWithDataSlice(
|
|
231
|
+
accountsToFetch,
|
|
232
|
+
maxDataSliceByteRange
|
|
233
|
+
);
|
|
234
|
+
Object.values(accountFetchesByArgsHash).map(({ args, fetches: addressCallbacks }) => {
|
|
180
235
|
const addresses = Object.keys(addressCallbacks);
|
|
181
236
|
if (addresses.length === 1) {
|
|
182
237
|
const address = addresses[0];
|
|
@@ -231,23 +286,6 @@ function createAccountLoader(rpc, config) {
|
|
|
231
286
|
loadMany: async (args) => loader.loadMany(args)
|
|
232
287
|
};
|
|
233
288
|
}
|
|
234
|
-
function applyDefaultArgs({
|
|
235
|
-
slot,
|
|
236
|
-
commitment,
|
|
237
|
-
encoding = "jsonParsed",
|
|
238
|
-
maxSupportedTransactionVersion = 0,
|
|
239
|
-
rewards,
|
|
240
|
-
transactionDetails = "full"
|
|
241
|
-
}) {
|
|
242
|
-
return {
|
|
243
|
-
commitment,
|
|
244
|
-
encoding,
|
|
245
|
-
maxSupportedTransactionVersion,
|
|
246
|
-
rewards,
|
|
247
|
-
slot,
|
|
248
|
-
transactionDetails
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
289
|
async function loadBlock(rpc, { slot, ...config }) {
|
|
252
290
|
return await rpc.getBlock(
|
|
253
291
|
slot,
|
|
@@ -257,30 +295,50 @@ async function loadBlock(rpc, { slot, ...config }) {
|
|
|
257
295
|
}
|
|
258
296
|
function createBlockBatchLoadFn(rpc) {
|
|
259
297
|
const resolveBlockUsingRpc = loadBlock.bind(null, rpc);
|
|
260
|
-
return async (blockQueryArgs) =>
|
|
298
|
+
return async (blockQueryArgs) => {
|
|
299
|
+
const blocksToFetch = {};
|
|
300
|
+
try {
|
|
301
|
+
return Promise.all(blockQueryArgs.map(
|
|
302
|
+
({ slot, ...args }) => new Promise((resolve, reject) => {
|
|
303
|
+
const blockRecords = blocksToFetch[slot.toString()] ||= [];
|
|
304
|
+
if (!args.commitment) {
|
|
305
|
+
args.commitment = "confirmed";
|
|
306
|
+
}
|
|
307
|
+
blockRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
308
|
+
})
|
|
309
|
+
));
|
|
310
|
+
} finally {
|
|
311
|
+
const blockFetchesByArgsHash = buildCoalescedFetchesByArgsHash(blocksToFetch, {
|
|
312
|
+
criteria: (args) => args.encoding === void 0 && args.transactionDetails !== "signatures",
|
|
313
|
+
defaults: (args) => ({
|
|
314
|
+
...args,
|
|
315
|
+
transactionDetails: "none"
|
|
316
|
+
}),
|
|
317
|
+
hashOmit: ["encoding", "transactionDetails"]
|
|
318
|
+
});
|
|
319
|
+
Object.values(blockFetchesByArgsHash).map(({ args, fetches: blockCallbacks }) => {
|
|
320
|
+
return Object.entries(blockCallbacks).map(([slot, { callbacks }]) => {
|
|
321
|
+
return Array.from({ length: 1 }, async () => {
|
|
322
|
+
try {
|
|
323
|
+
const result = await resolveBlockUsingRpc({
|
|
324
|
+
slot: BigInt(slot),
|
|
325
|
+
...args
|
|
326
|
+
});
|
|
327
|
+
callbacks.forEach((c) => c.resolve(result));
|
|
328
|
+
} catch (e) {
|
|
329
|
+
callbacks.forEach((c) => c.reject(e));
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
};
|
|
261
336
|
}
|
|
262
337
|
function createBlockLoader(rpc) {
|
|
263
338
|
const loader = new DataLoader__default.default(createBlockBatchLoadFn(rpc), { cacheKeyFn });
|
|
264
339
|
return {
|
|
265
|
-
load: async (args) => loader.load(
|
|
266
|
-
loadMany: async (args) => loader.loadMany(args.map(
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
function applyDefaultArgs2({
|
|
270
|
-
commitment,
|
|
271
|
-
dataSlice,
|
|
272
|
-
encoding = "jsonParsed",
|
|
273
|
-
filters,
|
|
274
|
-
minContextSlot,
|
|
275
|
-
programAddress
|
|
276
|
-
}) {
|
|
277
|
-
return {
|
|
278
|
-
commitment,
|
|
279
|
-
dataSlice,
|
|
280
|
-
encoding,
|
|
281
|
-
filters,
|
|
282
|
-
minContextSlot,
|
|
283
|
-
programAddress
|
|
340
|
+
load: async (args) => loader.load({ ...args, maxSupportedTransactionVersion: 0 }),
|
|
341
|
+
loadMany: async (args) => loader.loadMany(args.map((a) => ({ ...a, maxSupportedTransactionVersion: 0 })))
|
|
284
342
|
};
|
|
285
343
|
}
|
|
286
344
|
async function loadProgramAccounts(rpc, { programAddress, ...config }) {
|
|
@@ -290,26 +348,50 @@ async function loadProgramAccounts(rpc, { programAddress, ...config }) {
|
|
|
290
348
|
config
|
|
291
349
|
).send();
|
|
292
350
|
}
|
|
293
|
-
function createProgramAccountsBatchLoadFn(rpc) {
|
|
351
|
+
function createProgramAccountsBatchLoadFn(rpc, config) {
|
|
294
352
|
const resolveProgramAccountsUsingRpc = loadProgramAccounts.bind(null, rpc);
|
|
295
|
-
return async (
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
353
|
+
return async (accountQueryArgs) => {
|
|
354
|
+
const programAccountsToFetch = {};
|
|
355
|
+
try {
|
|
356
|
+
return Promise.all(accountQueryArgs.map(
|
|
357
|
+
({ programAddress, ...args }) => new Promise((resolve, reject) => {
|
|
358
|
+
const accountRecords = programAccountsToFetch[programAddress] ||= [];
|
|
359
|
+
if (!args.commitment) {
|
|
360
|
+
args.commitment = "confirmed";
|
|
361
|
+
}
|
|
362
|
+
accountRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
363
|
+
})
|
|
364
|
+
));
|
|
365
|
+
} finally {
|
|
366
|
+
const { maxDataSliceByteRange } = config;
|
|
367
|
+
const programAccountsFetchesByArgsHash = buildCoalescedFetchesByArgsHashWithDataSlice(programAccountsToFetch, maxDataSliceByteRange);
|
|
368
|
+
Object.values(programAccountsFetchesByArgsHash).map(({ args, fetches: programAddressCallbacks }) => {
|
|
369
|
+
return Object.entries(programAddressCallbacks).map(([programAddress, { callbacks }]) => {
|
|
370
|
+
return Array.from({ length: 1 }, async () => {
|
|
371
|
+
try {
|
|
372
|
+
const result = await resolveProgramAccountsUsingRpc({
|
|
373
|
+
programAddress,
|
|
374
|
+
...args
|
|
375
|
+
});
|
|
376
|
+
callbacks.forEach(({ callback, dataSlice }) => {
|
|
377
|
+
callback.resolve(sliceData(result, dataSlice, args.dataSlice));
|
|
378
|
+
});
|
|
379
|
+
} catch (e) {
|
|
380
|
+
callbacks.forEach(({ callback }) => {
|
|
381
|
+
callback.reject(e);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
302
388
|
};
|
|
303
389
|
}
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
encoding = "jsonParsed",
|
|
307
|
-
signature
|
|
308
|
-
}) {
|
|
390
|
+
function createProgramAccountsLoader(rpc, config) {
|
|
391
|
+
const loader = new DataLoader__default.default(createProgramAccountsBatchLoadFn(rpc, config), { cacheKeyFn });
|
|
309
392
|
return {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
signature
|
|
393
|
+
load: async (args) => loader.load(args),
|
|
394
|
+
loadMany: async (args) => loader.loadMany(args)
|
|
313
395
|
};
|
|
314
396
|
}
|
|
315
397
|
async function loadTransaction(rpc, { signature, ...config }) {
|
|
@@ -321,13 +403,47 @@ async function loadTransaction(rpc, { signature, ...config }) {
|
|
|
321
403
|
}
|
|
322
404
|
function createTransactionBatchLoadFn(rpc) {
|
|
323
405
|
const resolveTransactionUsingRpc = loadTransaction.bind(null, rpc);
|
|
324
|
-
return async (transactionQueryArgs) =>
|
|
406
|
+
return async (transactionQueryArgs) => {
|
|
407
|
+
const transactionsToFetch = {};
|
|
408
|
+
try {
|
|
409
|
+
return Promise.all(transactionQueryArgs.map(
|
|
410
|
+
({ signature, ...args }) => new Promise((resolve, reject) => {
|
|
411
|
+
const transactionRecords = transactionsToFetch[signature] ||= [];
|
|
412
|
+
if (!args.commitment) {
|
|
413
|
+
args.commitment = "confirmed";
|
|
414
|
+
}
|
|
415
|
+
transactionRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
416
|
+
})
|
|
417
|
+
));
|
|
418
|
+
} finally {
|
|
419
|
+
const transactionFetchesByArgsHash = buildCoalescedFetchesByArgsHash(transactionsToFetch, {
|
|
420
|
+
criteria: (args) => args.encoding === void 0,
|
|
421
|
+
defaults: (args) => ({ ...args, encoding: "base64" }),
|
|
422
|
+
hashOmit: ["encoding"]
|
|
423
|
+
});
|
|
424
|
+
Object.values(transactionFetchesByArgsHash).map(({ args, fetches: transactionCallbacks }) => {
|
|
425
|
+
return Object.entries(transactionCallbacks).map(([signature, { callbacks }]) => {
|
|
426
|
+
return Array.from({ length: 1 }, async () => {
|
|
427
|
+
try {
|
|
428
|
+
const result = await resolveTransactionUsingRpc({
|
|
429
|
+
signature,
|
|
430
|
+
...args
|
|
431
|
+
});
|
|
432
|
+
callbacks.forEach((c) => c.resolve(result));
|
|
433
|
+
} catch (e) {
|
|
434
|
+
callbacks.forEach((c) => c.reject(e));
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
};
|
|
325
441
|
}
|
|
326
442
|
function createTransactionLoader(rpc) {
|
|
327
443
|
const loader = new DataLoader__default.default(createTransactionBatchLoadFn(rpc), { cacheKeyFn });
|
|
328
444
|
return {
|
|
329
|
-
load: async (args) => loader.load(
|
|
330
|
-
loadMany: async (args) => loader.loadMany(args
|
|
445
|
+
load: async (args) => loader.load(args),
|
|
446
|
+
loadMany: async (args) => loader.loadMany(args)
|
|
331
447
|
};
|
|
332
448
|
}
|
|
333
449
|
|
|
@@ -337,7 +453,7 @@ function createSolanaGraphQLContext(rpc, config) {
|
|
|
337
453
|
loaders: {
|
|
338
454
|
account: createAccountLoader(rpc, config),
|
|
339
455
|
block: createBlockLoader(rpc),
|
|
340
|
-
programAccounts: createProgramAccountsLoader(rpc),
|
|
456
|
+
programAccounts: createProgramAccountsLoader(rpc, config),
|
|
341
457
|
transaction: createTransactionLoader(rpc)
|
|
342
458
|
}
|
|
343
459
|
};
|
|
@@ -427,7 +543,7 @@ function parseAccountDataSliceArgument(argumentNodes, variableValues) {
|
|
|
427
543
|
return void 0;
|
|
428
544
|
}
|
|
429
545
|
}
|
|
430
|
-
function
|
|
546
|
+
function buildAccountArgSetWithVisitor(args, info) {
|
|
431
547
|
const argSet = [args];
|
|
432
548
|
function buildArgSetWithVisitor(root) {
|
|
433
549
|
injectableRootVisitor(info, root, {
|
|
@@ -459,6 +575,93 @@ function buildAccountLoaderArgSetFromResolveInfo(args, info) {
|
|
|
459
575
|
buildArgSetWithVisitor(null);
|
|
460
576
|
return argSet;
|
|
461
577
|
}
|
|
578
|
+
function buildAccountLoaderArgSetFromResolveInfo(args, info) {
|
|
579
|
+
return buildAccountArgSetWithVisitor(args, info);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/resolvers/resolve-info/transaction.ts
|
|
583
|
+
function findArgumentNodeByName2(argumentNodes, name) {
|
|
584
|
+
return argumentNodes.find((argumentNode) => argumentNode.name.value === name);
|
|
585
|
+
}
|
|
586
|
+
function parseTransactionEncodingArgument(argumentNodes, variableValues) {
|
|
587
|
+
const argumentNode = findArgumentNodeByName2(argumentNodes, "encoding");
|
|
588
|
+
if (argumentNode) {
|
|
589
|
+
if (argumentNode.value.kind === "EnumValue") {
|
|
590
|
+
if (argumentNode.value.value === "BASE_58") {
|
|
591
|
+
return "base58";
|
|
592
|
+
}
|
|
593
|
+
if (argumentNode.value.value === "BASE_64") {
|
|
594
|
+
return "base64";
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (argumentNode.value.kind === "Variable") {
|
|
598
|
+
return variableValues[argumentNode.value.name.value];
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
return void 0;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function buildTransactionArgSetWithVisitor(args, info) {
|
|
605
|
+
const argSet = [args];
|
|
606
|
+
function buildArgSetWithVisitor(root) {
|
|
607
|
+
injectableRootVisitor(info, root, {
|
|
608
|
+
fieldNodeOperation(info2, node) {
|
|
609
|
+
if (node.name.value === "message" || node.name.value === "meta") {
|
|
610
|
+
argSet.push({ ...args, encoding: "jsonParsed" });
|
|
611
|
+
} else if (node.name.value === "data") {
|
|
612
|
+
if (node.arguments) {
|
|
613
|
+
const { variableValues } = info2;
|
|
614
|
+
const encoding = parseTransactionEncodingArgument(
|
|
615
|
+
node.arguments,
|
|
616
|
+
variableValues
|
|
617
|
+
);
|
|
618
|
+
argSet.push({ ...args, encoding });
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
fragmentSpreadNodeOperation(_info, fragment) {
|
|
623
|
+
buildArgSetWithVisitor(fragment);
|
|
624
|
+
},
|
|
625
|
+
inlineFragmentNodeOperation(_info, _node) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
buildArgSetWithVisitor(null);
|
|
631
|
+
return argSet;
|
|
632
|
+
}
|
|
633
|
+
function buildTransactionLoaderArgSetFromResolveInfo(args, info) {
|
|
634
|
+
return buildTransactionArgSetWithVisitor(args, info);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// src/resolvers/resolve-info/block.ts
|
|
638
|
+
function buildBlockLoaderArgSetFromResolveInfo(args, info) {
|
|
639
|
+
const argSet = [args];
|
|
640
|
+
function buildArgSetWithVisitor(root) {
|
|
641
|
+
injectableRootVisitor(info, root, {
|
|
642
|
+
fieldNodeOperation(info2, node) {
|
|
643
|
+
if (node.name.value === "signatures") {
|
|
644
|
+
argSet.push({ ...args, transactionDetails: "signatures" });
|
|
645
|
+
} else if (node.name.value === "transactions") {
|
|
646
|
+
argSet.push(...buildTransactionArgSetWithVisitor({ ...args, transactionDetails: "full" }, info2));
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
fragmentSpreadNodeOperation(_info, fragment) {
|
|
650
|
+
buildArgSetWithVisitor(fragment);
|
|
651
|
+
},
|
|
652
|
+
inlineFragmentNodeOperation(_info, _node) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
buildArgSetWithVisitor(null);
|
|
658
|
+
return argSet;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// src/resolvers/resolve-info/program-accounts.ts
|
|
662
|
+
function buildProgramAccountsLoaderArgSetFromResolveInfo(args, info) {
|
|
663
|
+
return buildAccountArgSetWithVisitor(args, info);
|
|
664
|
+
}
|
|
462
665
|
|
|
463
666
|
// src/resolvers/account.ts
|
|
464
667
|
var resolveAccountData = () => {
|
|
@@ -611,147 +814,207 @@ var accountResolvers = {
|
|
|
611
814
|
};
|
|
612
815
|
|
|
613
816
|
// src/resolvers/transaction.ts
|
|
614
|
-
function
|
|
615
|
-
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
817
|
+
function mapJsonParsedInstructions(instructions) {
|
|
818
|
+
return instructions.map((instruction) => {
|
|
819
|
+
if ("parsed" in instruction) {
|
|
820
|
+
if (typeof instruction.parsed === "string" && instruction.program === "spl-memo") {
|
|
821
|
+
const { parsed: memo, program: programName2, programId: programId2 } = instruction;
|
|
822
|
+
const instructionType2 = "memo";
|
|
823
|
+
const jsonParsedConfigs2 = {
|
|
824
|
+
instructionType: instructionType2,
|
|
825
|
+
programId: programId2,
|
|
826
|
+
programName: programName2
|
|
827
|
+
};
|
|
828
|
+
return { jsonParsedConfigs: jsonParsedConfigs2, memo, programId: programId2 };
|
|
829
|
+
}
|
|
830
|
+
const {
|
|
831
|
+
parsed: { info: data, type: instructionType },
|
|
832
|
+
program: programName,
|
|
833
|
+
programId
|
|
834
|
+
} = instruction;
|
|
835
|
+
const jsonParsedConfigs = {
|
|
836
|
+
instructionType,
|
|
837
|
+
programId,
|
|
838
|
+
programName
|
|
839
|
+
};
|
|
840
|
+
return { jsonParsedConfigs, ...data, programId };
|
|
841
|
+
} else {
|
|
842
|
+
return instruction;
|
|
843
|
+
}
|
|
638
844
|
});
|
|
639
|
-
return [transactionData, transactionMeta];
|
|
640
845
|
}
|
|
641
|
-
function
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
[transaction.transaction[0], transaction.meta]
|
|
648
|
-
) : (
|
|
649
|
-
// The transaction was either partially parsed or
|
|
650
|
-
// fully JSON-parsed, which will be sorted later.
|
|
651
|
-
transformParsedTransaction(transaction)
|
|
652
|
-
);
|
|
653
|
-
transaction.data = transactionData;
|
|
654
|
-
transaction.encoding = encoding;
|
|
655
|
-
transaction.meta = transactionMeta;
|
|
656
|
-
return transaction;
|
|
846
|
+
function mapJsonParsedInnerInstructions(innerInstructions) {
|
|
847
|
+
return innerInstructions.map(({ index, instructions }) => ({
|
|
848
|
+
index,
|
|
849
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
850
|
+
instructions: mapJsonParsedInstructions(instructions)
|
|
851
|
+
}));
|
|
657
852
|
}
|
|
853
|
+
var resolveTransactionData = () => {
|
|
854
|
+
return (parent, args) => {
|
|
855
|
+
return parent === null ? null : parent.encodedData ? parent.encodedData[cacheKeyFn(args)] : null;
|
|
856
|
+
};
|
|
857
|
+
};
|
|
658
858
|
function resolveTransaction(fieldName) {
|
|
659
859
|
return async (parent, args, context, info) => {
|
|
660
860
|
const signature = fieldName ? parent[fieldName] : args.signature;
|
|
661
|
-
if (
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return null;
|
|
670
|
-
}
|
|
671
|
-
if (args.encoding !== "jsonParsed") {
|
|
672
|
-
const transactionJsonParsed = await context.loaders.transaction.load({
|
|
673
|
-
...args,
|
|
674
|
-
encoding: "jsonParsed",
|
|
861
|
+
if (signature) {
|
|
862
|
+
if (onlyFieldsRequested(["signature"], info)) {
|
|
863
|
+
return { signature };
|
|
864
|
+
}
|
|
865
|
+
const argsSet = buildTransactionLoaderArgSetFromResolveInfo({ ...args, signature }, info);
|
|
866
|
+
const loadedTransactions = await context.loaders.transaction.loadMany(argsSet);
|
|
867
|
+
let result = {
|
|
868
|
+
encodedData: {},
|
|
675
869
|
signature
|
|
870
|
+
};
|
|
871
|
+
loadedTransactions.forEach((loadedTransaction, i) => {
|
|
872
|
+
if (loadedTransaction instanceof Error) {
|
|
873
|
+
console.error(loadedTransaction);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (loadedTransaction === null) {
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
if (!result.slot) {
|
|
880
|
+
result = {
|
|
881
|
+
...result,
|
|
882
|
+
...loadedTransaction
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const { transaction: data } = loadedTransaction;
|
|
886
|
+
const { encoding } = argsSet[i];
|
|
887
|
+
if (encoding && result.encodedData) {
|
|
888
|
+
if (Array.isArray(data)) {
|
|
889
|
+
result.encodedData[cacheKeyFn({
|
|
890
|
+
encoding
|
|
891
|
+
})] = data[0];
|
|
892
|
+
} else if (typeof data === "object") {
|
|
893
|
+
const jsonParsedData = data;
|
|
894
|
+
jsonParsedData.message.instructions = mapJsonParsedInstructions(
|
|
895
|
+
jsonParsedData.message.instructions
|
|
896
|
+
);
|
|
897
|
+
const loadedInnerInstructions = loadedTransaction.meta?.innerInstructions;
|
|
898
|
+
if (loadedInnerInstructions) {
|
|
899
|
+
const innerInstructions = mapJsonParsedInnerInstructions(loadedInnerInstructions);
|
|
900
|
+
const jsonParsedMeta = {
|
|
901
|
+
...loadedTransaction.meta,
|
|
902
|
+
innerInstructions
|
|
903
|
+
};
|
|
904
|
+
result = {
|
|
905
|
+
...result,
|
|
906
|
+
...jsonParsedData,
|
|
907
|
+
meta: jsonParsedMeta
|
|
908
|
+
};
|
|
909
|
+
} else {
|
|
910
|
+
result = {
|
|
911
|
+
...result,
|
|
912
|
+
...jsonParsedData
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
676
917
|
});
|
|
677
|
-
|
|
678
|
-
return null;
|
|
679
|
-
}
|
|
680
|
-
transaction.meta = transactionJsonParsed.meta;
|
|
918
|
+
return result;
|
|
681
919
|
}
|
|
682
|
-
return
|
|
920
|
+
return null;
|
|
683
921
|
};
|
|
684
922
|
}
|
|
685
923
|
var transactionResolvers = {
|
|
686
924
|
Transaction: {
|
|
687
|
-
|
|
688
|
-
switch (transaction.encoding) {
|
|
689
|
-
case "base58":
|
|
690
|
-
return "TransactionBase58";
|
|
691
|
-
case "base64":
|
|
692
|
-
return "TransactionBase64";
|
|
693
|
-
default:
|
|
694
|
-
return "TransactionParsed";
|
|
695
|
-
}
|
|
696
|
-
}
|
|
925
|
+
data: resolveTransactionData()
|
|
697
926
|
}
|
|
698
927
|
};
|
|
699
928
|
|
|
700
929
|
// src/resolvers/block.ts
|
|
701
|
-
function transformLoadedBlock({
|
|
702
|
-
block,
|
|
703
|
-
encoding = "jsonParsed",
|
|
704
|
-
transactionDetails = "full"
|
|
705
|
-
}) {
|
|
706
|
-
const transformedBlock = block;
|
|
707
|
-
if (typeof block === "object" && "transactions" in block) {
|
|
708
|
-
transformedBlock.transactions = block.transactions.map((transaction) => {
|
|
709
|
-
if (transactionDetails === "accounts") {
|
|
710
|
-
return {
|
|
711
|
-
data: transaction.transaction,
|
|
712
|
-
meta: transaction.meta,
|
|
713
|
-
version: transaction.version
|
|
714
|
-
};
|
|
715
|
-
} else {
|
|
716
|
-
return transformLoadedTransaction({ encoding, transaction });
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
block.encoding = encoding;
|
|
721
|
-
block.transactionDetails = transactionDetails;
|
|
722
|
-
return block;
|
|
723
|
-
}
|
|
724
930
|
var resolveBlock = (fieldName) => {
|
|
725
931
|
return async (parent, args, context, info) => {
|
|
726
932
|
const slot = fieldName ? parent[fieldName] : args.slot;
|
|
727
|
-
if (
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
933
|
+
if (slot) {
|
|
934
|
+
if (onlyFieldsRequested(["slot"], info)) {
|
|
935
|
+
return { slot };
|
|
936
|
+
}
|
|
937
|
+
const argsSet = buildBlockLoaderArgSetFromResolveInfo({ ...args, slot }, info);
|
|
938
|
+
const loadedBlocks = await context.loaders.block.loadMany(argsSet);
|
|
939
|
+
let result = {
|
|
940
|
+
slot
|
|
941
|
+
};
|
|
942
|
+
loadedBlocks.forEach((loadedBlock, i) => {
|
|
943
|
+
if (loadedBlock instanceof Error) {
|
|
944
|
+
console.error(loadedBlock);
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
if (loadedBlock === null) {
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
if (!result.blockhash) {
|
|
951
|
+
result = {
|
|
952
|
+
...result,
|
|
953
|
+
...loadedBlock
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
if (!result.signatures && loadedBlock.signatures) {
|
|
957
|
+
result = {
|
|
958
|
+
...result,
|
|
959
|
+
// @ts-expect-error FIX ME: https://github.com/solana-labs/solana-web3.js/pull/2052
|
|
960
|
+
signatures: loadedBlock.signatures
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
if (!result.transactionResults && loadedBlock.transactions) {
|
|
964
|
+
result.transactionResults = Array.from({ length: loadedBlock.transactions.length }, (_, i2) => ({
|
|
965
|
+
[i2]: { encodedData: {} }
|
|
966
|
+
}));
|
|
967
|
+
}
|
|
968
|
+
const { transactions } = loadedBlock;
|
|
969
|
+
const { encoding } = argsSet[i];
|
|
970
|
+
if (encoding) {
|
|
971
|
+
transactions.forEach((loadedTransaction, j) => {
|
|
972
|
+
const { transaction: data } = loadedTransaction;
|
|
973
|
+
if (result.transactionResults) {
|
|
974
|
+
const thisTransactionResult = result.transactionResults[j] ||= {
|
|
975
|
+
encodedData: {}
|
|
976
|
+
};
|
|
977
|
+
if (Array.isArray(data)) {
|
|
978
|
+
const thisEncodedData = thisTransactionResult.encodedData ||= {};
|
|
979
|
+
thisEncodedData[cacheKeyFn({
|
|
980
|
+
encoding
|
|
981
|
+
})] = data[0];
|
|
982
|
+
} else if (typeof data === "object") {
|
|
983
|
+
const jsonParsedData = data;
|
|
984
|
+
jsonParsedData.message.instructions = mapJsonParsedInstructions(
|
|
985
|
+
jsonParsedData.message.instructions
|
|
986
|
+
);
|
|
987
|
+
const loadedInnerInstructions = loadedTransaction.meta?.innerInstructions;
|
|
988
|
+
if (loadedInnerInstructions) {
|
|
989
|
+
const innerInstructions = mapJsonParsedInnerInstructions(loadedInnerInstructions);
|
|
990
|
+
const jsonParsedMeta = {
|
|
991
|
+
...loadedTransaction.meta,
|
|
992
|
+
innerInstructions
|
|
993
|
+
};
|
|
994
|
+
result.transactionResults[j] = {
|
|
995
|
+
...thisTransactionResult,
|
|
996
|
+
...jsonParsedData,
|
|
997
|
+
meta: jsonParsedMeta
|
|
998
|
+
};
|
|
999
|
+
} else {
|
|
1000
|
+
result.transactionResults[j] = {
|
|
1001
|
+
...thisTransactionResult,
|
|
1002
|
+
...jsonParsedData
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
return result;
|
|
736
1011
|
}
|
|
737
|
-
|
|
738
|
-
return transformLoadedBlock({ block, encoding, transactionDetails });
|
|
1012
|
+
return null;
|
|
739
1013
|
};
|
|
740
1014
|
};
|
|
741
1015
|
var blockResolvers = {
|
|
742
1016
|
Block: {
|
|
743
|
-
|
|
744
|
-
switch (block.transactionDetails) {
|
|
745
|
-
case "accounts":
|
|
746
|
-
return "BlockWithAccounts";
|
|
747
|
-
case "none":
|
|
748
|
-
return "BlockWithNone";
|
|
749
|
-
case "signatures":
|
|
750
|
-
return "BlockWithSignatures";
|
|
751
|
-
default:
|
|
752
|
-
return "BlockWithFull";
|
|
753
|
-
}
|
|
754
|
-
}
|
|
1017
|
+
transactions: (parent) => parent?.transactionResults ? Object.values(parent.transactionResults) : null
|
|
755
1018
|
}
|
|
756
1019
|
};
|
|
757
1020
|
|
|
@@ -759,7 +1022,8 @@ var blockResolvers = {
|
|
|
759
1022
|
var instructionResolvers = {
|
|
760
1023
|
AdvanceNonceAccountInstruction: {
|
|
761
1024
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
762
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1025
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1026
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar")
|
|
763
1027
|
},
|
|
764
1028
|
AllocateInstruction: {
|
|
765
1029
|
account: resolveAccount("account")
|
|
@@ -796,9 +1060,11 @@ var instructionResolvers = {
|
|
|
796
1060
|
BpfUpgradeableLoaderDeployWithMaxDataLenInstruction: {
|
|
797
1061
|
authority: resolveAccount("authority"),
|
|
798
1062
|
bufferAccount: resolveAccount("bufferAccount"),
|
|
1063
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
799
1064
|
payerAccount: resolveAccount("payerAccount"),
|
|
800
1065
|
programAccount: resolveAccount("programAccount"),
|
|
801
|
-
programDataAccount: resolveAccount("programDataAccount")
|
|
1066
|
+
programDataAccount: resolveAccount("programDataAccount"),
|
|
1067
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
802
1068
|
},
|
|
803
1069
|
BpfUpgradeableLoaderExtendProgramInstruction: {
|
|
804
1070
|
payerAccount: resolveAccount("payerAccount"),
|
|
@@ -822,8 +1088,10 @@ var instructionResolvers = {
|
|
|
822
1088
|
BpfUpgradeableLoaderUpgradeInstruction: {
|
|
823
1089
|
authority: resolveAccount("authority"),
|
|
824
1090
|
bufferAccount: resolveAccount("bufferAccount"),
|
|
1091
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
825
1092
|
programAccount: resolveAccount("programAccount"),
|
|
826
|
-
programDataAccount: resolveAccount("programDataAccount")
|
|
1093
|
+
programDataAccount: resolveAccount("programDataAccount"),
|
|
1094
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
827
1095
|
},
|
|
828
1096
|
BpfUpgradeableLoaderWriteInstruction: {
|
|
829
1097
|
account: resolveAccount("account"),
|
|
@@ -866,7 +1134,9 @@ var instructionResolvers = {
|
|
|
866
1134
|
},
|
|
867
1135
|
InitializeNonceAccountInstruction: {
|
|
868
1136
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
869
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1137
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1138
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar"),
|
|
1139
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
870
1140
|
},
|
|
871
1141
|
Lockup: {
|
|
872
1142
|
custodian: resolveAccount("custodian")
|
|
@@ -942,7 +1212,8 @@ var instructionResolvers = {
|
|
|
942
1212
|
SplTokenInitializeAccount2Instruction: {
|
|
943
1213
|
account: resolveAccount("account"),
|
|
944
1214
|
mint: resolveAccount("mint"),
|
|
945
|
-
owner: resolveAccount("owner")
|
|
1215
|
+
owner: resolveAccount("owner"),
|
|
1216
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
946
1217
|
},
|
|
947
1218
|
SplTokenInitializeAccount3Instruction: {
|
|
948
1219
|
account: resolveAccount("account"),
|
|
@@ -952,7 +1223,8 @@ var instructionResolvers = {
|
|
|
952
1223
|
SplTokenInitializeAccountInstruction: {
|
|
953
1224
|
account: resolveAccount("account"),
|
|
954
1225
|
mint: resolveAccount("mint"),
|
|
955
|
-
owner: resolveAccount("owner")
|
|
1226
|
+
owner: resolveAccount("owner"),
|
|
1227
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
956
1228
|
},
|
|
957
1229
|
SplTokenInitializeMint2Instruction: {
|
|
958
1230
|
freezeAuthority: resolveAccount("freezeAuthority"),
|
|
@@ -966,13 +1238,15 @@ var instructionResolvers = {
|
|
|
966
1238
|
SplTokenInitializeMintInstruction: {
|
|
967
1239
|
freezeAuthority: resolveAccount("freezeAuthority"),
|
|
968
1240
|
mint: resolveAccount("mint"),
|
|
969
|
-
mintAuthority: resolveAccount("mintAuthority")
|
|
1241
|
+
mintAuthority: resolveAccount("mintAuthority"),
|
|
1242
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
970
1243
|
},
|
|
971
1244
|
SplTokenInitializeMultisig2Instruction: {
|
|
972
1245
|
multisig: resolveAccount("multisig")
|
|
973
1246
|
},
|
|
974
1247
|
SplTokenInitializeMultisigInstruction: {
|
|
975
|
-
multisig: resolveAccount("multisig")
|
|
1248
|
+
multisig: resolveAccount("multisig"),
|
|
1249
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
976
1250
|
},
|
|
977
1251
|
SplTokenMintToCheckedInstruction: {
|
|
978
1252
|
account: resolveAccount("account"),
|
|
@@ -1025,6 +1299,7 @@ var instructionResolvers = {
|
|
|
1025
1299
|
},
|
|
1026
1300
|
StakeAuthorizeCheckedInstruction: {
|
|
1027
1301
|
authority: resolveAccount("authority"),
|
|
1302
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1028
1303
|
custodian: resolveAccount("custodian"),
|
|
1029
1304
|
newAuthority: resolveAccount("newAuthority"),
|
|
1030
1305
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1032,12 +1307,14 @@ var instructionResolvers = {
|
|
|
1032
1307
|
StakeAuthorizeCheckedWithSeedInstruction: {
|
|
1033
1308
|
authorityBase: resolveAccount("authorityBase"),
|
|
1034
1309
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1310
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1035
1311
|
custodian: resolveAccount("custodian"),
|
|
1036
1312
|
newAuthorized: resolveAccount("newAuthorized"),
|
|
1037
1313
|
stakeAccount: resolveAccount("stakeAccount")
|
|
1038
1314
|
},
|
|
1039
1315
|
StakeAuthorizeInstruction: {
|
|
1040
1316
|
authority: resolveAccount("authority"),
|
|
1317
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1041
1318
|
custodian: resolveAccount("custodian"),
|
|
1042
1319
|
newAuthority: resolveAccount("newAuthority"),
|
|
1043
1320
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1045,6 +1322,7 @@ var instructionResolvers = {
|
|
|
1045
1322
|
StakeAuthorizeWithSeedInstruction: {
|
|
1046
1323
|
authorityBase: resolveAccount("authorityBase"),
|
|
1047
1324
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1325
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1048
1326
|
custodian: resolveAccount("custodian"),
|
|
1049
1327
|
newAuthorized: resolveAccount("newAuthorized"),
|
|
1050
1328
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1055,20 +1333,28 @@ var instructionResolvers = {
|
|
|
1055
1333
|
voteAccount: resolveAccount("voteAccount")
|
|
1056
1334
|
},
|
|
1057
1335
|
StakeDeactivateInstruction: {
|
|
1336
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1058
1337
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1059
1338
|
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1060
1339
|
},
|
|
1061
1340
|
StakeDelegateStakeInstruction: {
|
|
1341
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1062
1342
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1063
1343
|
stakeAuthority: resolveAccount("stakeAuthority"),
|
|
1064
1344
|
stakeConfigAccount: resolveAccount("stakeConfigAccount"),
|
|
1345
|
+
stakeHistorySysvar: resolveAccount("stakeHistorySysvar"),
|
|
1065
1346
|
voteAccount: resolveAccount("voteAccount")
|
|
1066
1347
|
},
|
|
1348
|
+
StakeInitializeCheckedInstruction: {
|
|
1349
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1350
|
+
stakeAccount: resolveAccount("stakeAccount")
|
|
1351
|
+
},
|
|
1067
1352
|
StakeInitializeCheckedInstructionDataAuthorized: {
|
|
1068
1353
|
staker: resolveAccount("staker"),
|
|
1069
1354
|
withdrawer: resolveAccount("withdrawer")
|
|
1070
1355
|
},
|
|
1071
1356
|
StakeInitializeInstruction: {
|
|
1357
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1072
1358
|
stakeAccount: resolveAccount("stakeAccount")
|
|
1073
1359
|
},
|
|
1074
1360
|
StakeInitializeInstructionDataAuthorized: {
|
|
@@ -1076,9 +1362,11 @@ var instructionResolvers = {
|
|
|
1076
1362
|
withdrawer: resolveAccount("withdrawer")
|
|
1077
1363
|
},
|
|
1078
1364
|
StakeMergeInstruction: {
|
|
1365
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1079
1366
|
destination: resolveAccount("destination"),
|
|
1080
1367
|
source: resolveAccount("source"),
|
|
1081
|
-
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1368
|
+
stakeAuthority: resolveAccount("stakeAuthority"),
|
|
1369
|
+
stakeHistorySysvar: resolveAccount("stakeHistorySysvar")
|
|
1082
1370
|
},
|
|
1083
1371
|
StakeRedelegateInstruction: {
|
|
1084
1372
|
newStakeAccount: resolveAccount("newStakeAccount"),
|
|
@@ -1101,287 +1389,289 @@ var instructionResolvers = {
|
|
|
1101
1389
|
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1102
1390
|
},
|
|
1103
1391
|
StakeWithdrawInstruction: {
|
|
1392
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1104
1393
|
destination: resolveAccount("destination"),
|
|
1105
1394
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1106
1395
|
withdrawAuthority: resolveAccount("withdrawAuthority")
|
|
1107
1396
|
},
|
|
1108
1397
|
TransactionInstruction: {
|
|
1109
|
-
__resolveType(
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1398
|
+
__resolveType(instructionResult) {
|
|
1399
|
+
const { jsonParsedConfigs } = instructionResult;
|
|
1400
|
+
if (jsonParsedConfigs) {
|
|
1401
|
+
if (jsonParsedConfigs.programName === "address-lookup-table") {
|
|
1402
|
+
if (jsonParsedConfigs.instructionType === "createLookupTable") {
|
|
1113
1403
|
return "CreateLookupTableInstruction";
|
|
1114
1404
|
}
|
|
1115
|
-
if (
|
|
1405
|
+
if (jsonParsedConfigs.instructionType === "freezeLookupTable") {
|
|
1116
1406
|
return "FreezeLookupTableInstruction";
|
|
1117
1407
|
}
|
|
1118
|
-
if (
|
|
1408
|
+
if (jsonParsedConfigs.instructionType === "extendLookupTable") {
|
|
1119
1409
|
return "ExtendLookupTableInstruction";
|
|
1120
1410
|
}
|
|
1121
|
-
if (
|
|
1411
|
+
if (jsonParsedConfigs.instructionType === "deactivateLookupTable") {
|
|
1122
1412
|
return "DeactivateLookupTableInstruction";
|
|
1123
1413
|
}
|
|
1124
|
-
if (
|
|
1414
|
+
if (jsonParsedConfigs.instructionType === "closeLookupTable") {
|
|
1125
1415
|
return "CloseLookupTableInstruction";
|
|
1126
1416
|
}
|
|
1127
1417
|
}
|
|
1128
|
-
if (
|
|
1129
|
-
if (
|
|
1418
|
+
if (jsonParsedConfigs.programName === "bpf-loader") {
|
|
1419
|
+
if (jsonParsedConfigs.instructionType === "write") {
|
|
1130
1420
|
return "BpfLoaderWriteInstruction";
|
|
1131
1421
|
}
|
|
1132
|
-
if (
|
|
1422
|
+
if (jsonParsedConfigs.instructionType === "finalize") {
|
|
1133
1423
|
return "BpfLoaderFinalizeInstruction";
|
|
1134
1424
|
}
|
|
1135
1425
|
}
|
|
1136
|
-
if (
|
|
1137
|
-
if (
|
|
1426
|
+
if (jsonParsedConfigs.programName === "bpf-upgradeable-loader") {
|
|
1427
|
+
if (jsonParsedConfigs.instructionType === "initializeBuffer") {
|
|
1138
1428
|
return "BpfUpgradeableLoaderInitializeBufferInstruction";
|
|
1139
1429
|
}
|
|
1140
|
-
if (
|
|
1430
|
+
if (jsonParsedConfigs.instructionType === "write") {
|
|
1141
1431
|
return "BpfUpgradeableLoaderWriteInstruction";
|
|
1142
1432
|
}
|
|
1143
|
-
if (
|
|
1433
|
+
if (jsonParsedConfigs.instructionType === "deployWithMaxDataLen") {
|
|
1144
1434
|
return "BpfUpgradeableLoaderDeployWithMaxDataLenInstruction";
|
|
1145
1435
|
}
|
|
1146
|
-
if (
|
|
1436
|
+
if (jsonParsedConfigs.instructionType === "upgrade") {
|
|
1147
1437
|
return "BpfUpgradeableLoaderUpgradeInstruction";
|
|
1148
1438
|
}
|
|
1149
|
-
if (
|
|
1439
|
+
if (jsonParsedConfigs.instructionType === "setAuthority") {
|
|
1150
1440
|
return "BpfUpgradeableLoaderSetAuthorityInstruction";
|
|
1151
1441
|
}
|
|
1152
|
-
if (
|
|
1442
|
+
if (jsonParsedConfigs.instructionType === "setAuthorityChecked") {
|
|
1153
1443
|
return "BpfUpgradeableLoaderSetAuthorityCheckedInstruction";
|
|
1154
1444
|
}
|
|
1155
|
-
if (
|
|
1445
|
+
if (jsonParsedConfigs.instructionType === "close") {
|
|
1156
1446
|
return "BpfUpgradeableLoaderCloseInstruction";
|
|
1157
1447
|
}
|
|
1158
|
-
if (
|
|
1448
|
+
if (jsonParsedConfigs.instructionType === "extendProgram") {
|
|
1159
1449
|
return "BpfUpgradeableLoaderExtendProgramInstruction";
|
|
1160
1450
|
}
|
|
1161
1451
|
}
|
|
1162
|
-
if (
|
|
1163
|
-
if (
|
|
1452
|
+
if (jsonParsedConfigs.programName === "spl-associated-token-account") {
|
|
1453
|
+
if (jsonParsedConfigs.instructionType === "create") {
|
|
1164
1454
|
return "SplAssociatedTokenCreateInstruction";
|
|
1165
1455
|
}
|
|
1166
|
-
if (
|
|
1456
|
+
if (jsonParsedConfigs.instructionType === "createIdempotent") {
|
|
1167
1457
|
return "SplAssociatedTokenCreateIdempotentInstruction";
|
|
1168
1458
|
}
|
|
1169
|
-
if (
|
|
1459
|
+
if (jsonParsedConfigs.instructionType === "recoverNested") {
|
|
1170
1460
|
return "SplAssociatedTokenRecoverNestedInstruction";
|
|
1171
1461
|
}
|
|
1172
1462
|
}
|
|
1173
|
-
if (
|
|
1463
|
+
if (jsonParsedConfigs.programName === "spl-memo") {
|
|
1174
1464
|
return "SplMemoInstruction";
|
|
1175
1465
|
}
|
|
1176
|
-
if (
|
|
1177
|
-
if (
|
|
1466
|
+
if (jsonParsedConfigs.programName === "spl-token") {
|
|
1467
|
+
if (jsonParsedConfigs.instructionType === "initializeMint") {
|
|
1178
1468
|
return "SplTokenInitializeMintInstruction";
|
|
1179
1469
|
}
|
|
1180
|
-
if (
|
|
1470
|
+
if (jsonParsedConfigs.instructionType === "initializeMint2") {
|
|
1181
1471
|
return "SplTokenInitializeMint2Instruction";
|
|
1182
1472
|
}
|
|
1183
|
-
if (
|
|
1473
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount") {
|
|
1184
1474
|
return "SplTokenInitializeAccountInstruction";
|
|
1185
1475
|
}
|
|
1186
|
-
if (
|
|
1476
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount2") {
|
|
1187
1477
|
return "SplTokenInitializeAccount2Instruction";
|
|
1188
1478
|
}
|
|
1189
|
-
if (
|
|
1479
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount3") {
|
|
1190
1480
|
return "SplTokenInitializeAccount3Instruction";
|
|
1191
1481
|
}
|
|
1192
|
-
if (
|
|
1482
|
+
if (jsonParsedConfigs.instructionType === "initializeMultisig") {
|
|
1193
1483
|
return "SplTokenInitializeMultisigInstruction";
|
|
1194
1484
|
}
|
|
1195
|
-
if (
|
|
1485
|
+
if (jsonParsedConfigs.instructionType === "initializeMultisig2") {
|
|
1196
1486
|
return "SplTokenInitializeMultisig2Instruction";
|
|
1197
1487
|
}
|
|
1198
|
-
if (
|
|
1488
|
+
if (jsonParsedConfigs.instructionType === "transfer") {
|
|
1199
1489
|
return "SplTokenTransferInstruction";
|
|
1200
1490
|
}
|
|
1201
|
-
if (
|
|
1491
|
+
if (jsonParsedConfigs.instructionType === "approve") {
|
|
1202
1492
|
return "SplTokenApproveInstruction";
|
|
1203
1493
|
}
|
|
1204
|
-
if (
|
|
1494
|
+
if (jsonParsedConfigs.instructionType === "revoke") {
|
|
1205
1495
|
return "SplTokenRevokeInstruction";
|
|
1206
1496
|
}
|
|
1207
|
-
if (
|
|
1497
|
+
if (jsonParsedConfigs.instructionType === "setAuthority") {
|
|
1208
1498
|
return "SplTokenSetAuthorityInstruction";
|
|
1209
1499
|
}
|
|
1210
|
-
if (
|
|
1500
|
+
if (jsonParsedConfigs.instructionType === "mintTo") {
|
|
1211
1501
|
return "SplTokenMintToInstruction";
|
|
1212
1502
|
}
|
|
1213
|
-
if (
|
|
1503
|
+
if (jsonParsedConfigs.instructionType === "burn") {
|
|
1214
1504
|
return "SplTokenBurnInstruction";
|
|
1215
1505
|
}
|
|
1216
|
-
if (
|
|
1506
|
+
if (jsonParsedConfigs.instructionType === "closeAccount") {
|
|
1217
1507
|
return "SplTokenCloseAccountInstruction";
|
|
1218
1508
|
}
|
|
1219
|
-
if (
|
|
1509
|
+
if (jsonParsedConfigs.instructionType === "freezeAccount") {
|
|
1220
1510
|
return "SplTokenFreezeAccountInstruction";
|
|
1221
1511
|
}
|
|
1222
|
-
if (
|
|
1512
|
+
if (jsonParsedConfigs.instructionType === "thawAccount") {
|
|
1223
1513
|
return "SplTokenThawAccountInstruction";
|
|
1224
1514
|
}
|
|
1225
|
-
if (
|
|
1515
|
+
if (jsonParsedConfigs.instructionType === "transferChecked") {
|
|
1226
1516
|
return "SplTokenTransferCheckedInstruction";
|
|
1227
1517
|
}
|
|
1228
|
-
if (
|
|
1518
|
+
if (jsonParsedConfigs.instructionType === "approveChecked") {
|
|
1229
1519
|
return "SplTokenApproveCheckedInstruction";
|
|
1230
1520
|
}
|
|
1231
|
-
if (
|
|
1521
|
+
if (jsonParsedConfigs.instructionType === "mintToChecked") {
|
|
1232
1522
|
return "SplTokenMintToCheckedInstruction";
|
|
1233
1523
|
}
|
|
1234
|
-
if (
|
|
1524
|
+
if (jsonParsedConfigs.instructionType === "burnChecked") {
|
|
1235
1525
|
return "SplTokenBurnCheckedInstruction";
|
|
1236
1526
|
}
|
|
1237
|
-
if (
|
|
1527
|
+
if (jsonParsedConfigs.instructionType === "syncNative") {
|
|
1238
1528
|
return "SplTokenSyncNativeInstruction";
|
|
1239
1529
|
}
|
|
1240
|
-
if (
|
|
1530
|
+
if (jsonParsedConfigs.instructionType === "getAccountDataSize") {
|
|
1241
1531
|
return "SplTokenGetAccountDataSizeInstruction";
|
|
1242
1532
|
}
|
|
1243
|
-
if (
|
|
1533
|
+
if (jsonParsedConfigs.instructionType === "initializeImmutableOwner") {
|
|
1244
1534
|
return "SplTokenInitializeImmutableOwnerInstruction";
|
|
1245
1535
|
}
|
|
1246
|
-
if (
|
|
1536
|
+
if (jsonParsedConfigs.instructionType === "amountToUiAmount") {
|
|
1247
1537
|
return "SplTokenAmountToUiAmountInstruction";
|
|
1248
1538
|
}
|
|
1249
|
-
if (
|
|
1539
|
+
if (jsonParsedConfigs.instructionType === "uiAmountToAmount") {
|
|
1250
1540
|
return "SplTokenUiAmountToAmountInstruction";
|
|
1251
1541
|
}
|
|
1252
|
-
if (
|
|
1542
|
+
if (jsonParsedConfigs.instructionType === "initializeMintCloseAuthority") {
|
|
1253
1543
|
return "SplTokenInitializeMintCloseAuthorityInstruction";
|
|
1254
1544
|
}
|
|
1255
1545
|
}
|
|
1256
|
-
if (
|
|
1257
|
-
if (
|
|
1546
|
+
if (jsonParsedConfigs.programName === "stake") {
|
|
1547
|
+
if (jsonParsedConfigs.instructionType === "initialize") {
|
|
1258
1548
|
return "StakeInitializeInstruction";
|
|
1259
1549
|
}
|
|
1260
|
-
if (
|
|
1550
|
+
if (jsonParsedConfigs.instructionType === "authorize") {
|
|
1261
1551
|
return "StakeAuthorizeInstruction";
|
|
1262
1552
|
}
|
|
1263
|
-
if (
|
|
1553
|
+
if (jsonParsedConfigs.instructionType === "delegate") {
|
|
1264
1554
|
return "StakeDelegateStakeInstruction";
|
|
1265
1555
|
}
|
|
1266
|
-
if (
|
|
1556
|
+
if (jsonParsedConfigs.instructionType === "split") {
|
|
1267
1557
|
return "StakeSplitInstruction";
|
|
1268
1558
|
}
|
|
1269
|
-
if (
|
|
1559
|
+
if (jsonParsedConfigs.instructionType === "withdraw") {
|
|
1270
1560
|
return "StakeWithdrawInstruction";
|
|
1271
1561
|
}
|
|
1272
|
-
if (
|
|
1562
|
+
if (jsonParsedConfigs.instructionType === "deactivate") {
|
|
1273
1563
|
return "StakeDeactivateInstruction";
|
|
1274
1564
|
}
|
|
1275
|
-
if (
|
|
1565
|
+
if (jsonParsedConfigs.instructionType === "setLockup") {
|
|
1276
1566
|
return "StakeSetLockupInstruction";
|
|
1277
1567
|
}
|
|
1278
|
-
if (
|
|
1568
|
+
if (jsonParsedConfigs.instructionType === "merge") {
|
|
1279
1569
|
return "StakeMergeInstruction";
|
|
1280
1570
|
}
|
|
1281
|
-
if (
|
|
1571
|
+
if (jsonParsedConfigs.instructionType === "authorizeWithSeed") {
|
|
1282
1572
|
return "StakeAuthorizeWithSeedInstruction";
|
|
1283
1573
|
}
|
|
1284
|
-
if (
|
|
1574
|
+
if (jsonParsedConfigs.instructionType === "initializeChecked") {
|
|
1285
1575
|
return "StakeInitializeCheckedInstruction";
|
|
1286
1576
|
}
|
|
1287
|
-
if (
|
|
1577
|
+
if (jsonParsedConfigs.instructionType === "authorizeChecked") {
|
|
1288
1578
|
return "StakeAuthorizeCheckedInstruction";
|
|
1289
1579
|
}
|
|
1290
|
-
if (
|
|
1580
|
+
if (jsonParsedConfigs.instructionType === "authorizeCheckedWithSeed") {
|
|
1291
1581
|
return "StakeAuthorizeCheckedWithSeedInstruction";
|
|
1292
1582
|
}
|
|
1293
|
-
if (
|
|
1583
|
+
if (jsonParsedConfigs.instructionType === "setLockupChecked") {
|
|
1294
1584
|
return "StakeSetLockupCheckedInstruction";
|
|
1295
1585
|
}
|
|
1296
|
-
if (
|
|
1586
|
+
if (jsonParsedConfigs.instructionType === "deactivateDelinquent") {
|
|
1297
1587
|
return "StakeDeactivateDelinquentInstruction";
|
|
1298
1588
|
}
|
|
1299
|
-
if (
|
|
1589
|
+
if (jsonParsedConfigs.instructionType === "redelegate") {
|
|
1300
1590
|
return "StakeRedelegateInstruction";
|
|
1301
1591
|
}
|
|
1302
1592
|
}
|
|
1303
|
-
if (
|
|
1304
|
-
if (
|
|
1593
|
+
if (jsonParsedConfigs.programName === "system") {
|
|
1594
|
+
if (jsonParsedConfigs.instructionType === "createAccount") {
|
|
1305
1595
|
return "CreateAccountInstruction";
|
|
1306
1596
|
}
|
|
1307
|
-
if (
|
|
1597
|
+
if (jsonParsedConfigs.instructionType === "assign") {
|
|
1308
1598
|
return "AssignInstruction";
|
|
1309
1599
|
}
|
|
1310
|
-
if (
|
|
1600
|
+
if (jsonParsedConfigs.instructionType === "transfer") {
|
|
1311
1601
|
return "TransferInstruction";
|
|
1312
1602
|
}
|
|
1313
|
-
if (
|
|
1603
|
+
if (jsonParsedConfigs.instructionType === "createAccountWithSeed") {
|
|
1314
1604
|
return "CreateAccountWithSeedInstruction";
|
|
1315
1605
|
}
|
|
1316
|
-
if (
|
|
1606
|
+
if (jsonParsedConfigs.instructionType === "advanceNonceAccount") {
|
|
1317
1607
|
return "AdvanceNonceAccountInstruction";
|
|
1318
1608
|
}
|
|
1319
|
-
if (
|
|
1609
|
+
if (jsonParsedConfigs.instructionType === "withdrawNonceAccount") {
|
|
1320
1610
|
return "WithdrawNonceAccountInstruction";
|
|
1321
1611
|
}
|
|
1322
|
-
if (
|
|
1612
|
+
if (jsonParsedConfigs.instructionType === "initializeNonceAccount") {
|
|
1323
1613
|
return "InitializeNonceAccountInstruction";
|
|
1324
1614
|
}
|
|
1325
|
-
if (
|
|
1615
|
+
if (jsonParsedConfigs.instructionType === "authorizeNonceAccount") {
|
|
1326
1616
|
return "AuthorizeNonceAccountInstruction";
|
|
1327
1617
|
}
|
|
1328
|
-
if (
|
|
1618
|
+
if (jsonParsedConfigs.instructionType === "upgradeNonceAccount") {
|
|
1329
1619
|
return "UpgradeNonceAccountInstruction";
|
|
1330
1620
|
}
|
|
1331
|
-
if (
|
|
1621
|
+
if (jsonParsedConfigs.instructionType === "allocate") {
|
|
1332
1622
|
return "AllocateInstruction";
|
|
1333
1623
|
}
|
|
1334
|
-
if (
|
|
1624
|
+
if (jsonParsedConfigs.instructionType === "allocateWithSeed") {
|
|
1335
1625
|
return "AllocateWithSeedInstruction";
|
|
1336
1626
|
}
|
|
1337
|
-
if (
|
|
1627
|
+
if (jsonParsedConfigs.instructionType === "assignWithSeed") {
|
|
1338
1628
|
return "AssignWithSeedInstruction";
|
|
1339
1629
|
}
|
|
1340
|
-
if (
|
|
1630
|
+
if (jsonParsedConfigs.instructionType === "transferWithSeed") {
|
|
1341
1631
|
return "TransferWithSeedInstruction";
|
|
1342
1632
|
}
|
|
1343
1633
|
}
|
|
1344
|
-
if (
|
|
1345
|
-
if (
|
|
1634
|
+
if (jsonParsedConfigs.programName === "vote") {
|
|
1635
|
+
if (jsonParsedConfigs.instructionType === "initialize") {
|
|
1346
1636
|
return "VoteInitializeAccountInstruction";
|
|
1347
1637
|
}
|
|
1348
|
-
if (
|
|
1638
|
+
if (jsonParsedConfigs.instructionType === "authorize") {
|
|
1349
1639
|
return "VoteAuthorizeInstruction";
|
|
1350
1640
|
}
|
|
1351
|
-
if (
|
|
1641
|
+
if (jsonParsedConfigs.instructionType === "authorizeWithSeed") {
|
|
1352
1642
|
return "VoteAuthorizeWithSeedInstruction";
|
|
1353
1643
|
}
|
|
1354
|
-
if (
|
|
1644
|
+
if (jsonParsedConfigs.instructionType === "authorizeCheckedWithSeed") {
|
|
1355
1645
|
return "VoteAuthorizeCheckedWithSeedInstruction";
|
|
1356
1646
|
}
|
|
1357
|
-
if (
|
|
1647
|
+
if (jsonParsedConfigs.instructionType === "vote") {
|
|
1358
1648
|
return "VoteVoteInstruction";
|
|
1359
1649
|
}
|
|
1360
|
-
if (
|
|
1650
|
+
if (jsonParsedConfigs.instructionType === "updatevotestate") {
|
|
1361
1651
|
return "VoteUpdateVoteStateInstruction";
|
|
1362
1652
|
}
|
|
1363
|
-
if (
|
|
1653
|
+
if (jsonParsedConfigs.instructionType === "updatevotestateswitch") {
|
|
1364
1654
|
return "VoteUpdateVoteStateSwitchInstruction";
|
|
1365
1655
|
}
|
|
1366
|
-
if (
|
|
1656
|
+
if (jsonParsedConfigs.instructionType === "compactupdatevotestate") {
|
|
1367
1657
|
return "VoteCompactUpdateVoteStateInstruction";
|
|
1368
1658
|
}
|
|
1369
|
-
if (
|
|
1659
|
+
if (jsonParsedConfigs.instructionType === "compactupdatevotestateswitch") {
|
|
1370
1660
|
return "VoteCompactUpdateVoteStateSwitchInstruction";
|
|
1371
1661
|
}
|
|
1372
|
-
if (
|
|
1662
|
+
if (jsonParsedConfigs.instructionType === "withdraw") {
|
|
1373
1663
|
return "VoteWithdrawInstruction";
|
|
1374
1664
|
}
|
|
1375
|
-
if (
|
|
1665
|
+
if (jsonParsedConfigs.instructionType === "updateValidatorIdentity") {
|
|
1376
1666
|
return "VoteUpdateValidatorIdentityInstruction";
|
|
1377
1667
|
}
|
|
1378
|
-
if (
|
|
1668
|
+
if (jsonParsedConfigs.instructionType === "updateCommission") {
|
|
1379
1669
|
return "VoteUpdateCommissionInstruction";
|
|
1380
1670
|
}
|
|
1381
|
-
if (
|
|
1671
|
+
if (jsonParsedConfigs.instructionType === "voteSwitch") {
|
|
1382
1672
|
return "VoteVoteSwitchInstruction";
|
|
1383
1673
|
}
|
|
1384
|
-
if (
|
|
1674
|
+
if (jsonParsedConfigs.instructionType === "authorizeChecked") {
|
|
1385
1675
|
return "VoteAuthorizeCheckedInstruction";
|
|
1386
1676
|
}
|
|
1387
1677
|
}
|
|
@@ -1404,21 +1694,25 @@ var instructionResolvers = {
|
|
|
1404
1694
|
},
|
|
1405
1695
|
VoteAuthorizeCheckedInstruction: {
|
|
1406
1696
|
authority: resolveAccount("authority"),
|
|
1697
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1407
1698
|
newAuthority: resolveAccount("newAuthority"),
|
|
1408
1699
|
voteAccount: resolveAccount("voteAccount")
|
|
1409
1700
|
},
|
|
1410
1701
|
VoteAuthorizeCheckedWithSeedInstruction: {
|
|
1411
1702
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1703
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1412
1704
|
newAuthority: resolveAccount("newAuthority"),
|
|
1413
1705
|
voteAccount: resolveAccount("voteAccount")
|
|
1414
1706
|
},
|
|
1415
1707
|
VoteAuthorizeInstruction: {
|
|
1416
1708
|
authority: resolveAccount("authority"),
|
|
1709
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1417
1710
|
newAuthority: resolveAccount("newAuthority"),
|
|
1418
1711
|
voteAccount: resolveAccount("voteAccount")
|
|
1419
1712
|
},
|
|
1420
1713
|
VoteAuthorizeWithSeedInstruction: {
|
|
1421
1714
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1715
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1422
1716
|
newAuthority: resolveAccount("newAuthority"),
|
|
1423
1717
|
voteAccount: resolveAccount("voteAccount")
|
|
1424
1718
|
},
|
|
@@ -1433,7 +1727,9 @@ var instructionResolvers = {
|
|
|
1433
1727
|
VoteInitializeAccountInstruction: {
|
|
1434
1728
|
authorizedVoter: resolveAccount("authorizedVoter"),
|
|
1435
1729
|
authorizedWithdrawer: resolveAccount("authorizedWithdrawer"),
|
|
1730
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1436
1731
|
node: resolveAccount("node"),
|
|
1732
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1437
1733
|
voteAccount: resolveAccount("voteAccount")
|
|
1438
1734
|
},
|
|
1439
1735
|
VoteUpdateCommissionInstruction: {
|
|
@@ -1454,10 +1750,14 @@ var instructionResolvers = {
|
|
|
1454
1750
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1455
1751
|
},
|
|
1456
1752
|
VoteVoteInstruction: {
|
|
1753
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1754
|
+
slotHashesSysvar: resolveAccount("slotHashesSysvar"),
|
|
1457
1755
|
voteAccount: resolveAccount("voteAccount"),
|
|
1458
1756
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1459
1757
|
},
|
|
1460
1758
|
VoteVoteSwitchInstruction: {
|
|
1759
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1760
|
+
slotHashesSysvar: resolveAccount("slotHashesSysvar"),
|
|
1461
1761
|
voteAccount: resolveAccount("voteAccount"),
|
|
1462
1762
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1463
1763
|
},
|
|
@@ -1468,7 +1768,9 @@ var instructionResolvers = {
|
|
|
1468
1768
|
WithdrawNonceAccountInstruction: {
|
|
1469
1769
|
destination: resolveAccount("destination"),
|
|
1470
1770
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
1471
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1771
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1772
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar"),
|
|
1773
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
1472
1774
|
}
|
|
1473
1775
|
};
|
|
1474
1776
|
|
|
@@ -1477,52 +1779,54 @@ function resolveProgramAccounts(fieldName) {
|
|
|
1477
1779
|
return async (parent, args, context, info) => {
|
|
1478
1780
|
const programAddress = fieldName ? parent[fieldName] : args.programAddress;
|
|
1479
1781
|
if (programAddress) {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
const { account, pubkey: address } = programAccount;
|
|
1488
|
-
let result = {
|
|
1489
|
-
...account,
|
|
1490
|
-
address,
|
|
1491
|
-
encodedData: {},
|
|
1492
|
-
ownerProgram: account.owner
|
|
1493
|
-
};
|
|
1494
|
-
const { data } = account;
|
|
1495
|
-
const { encoding, dataSlice } = args;
|
|
1496
|
-
if (result.encodedData) {
|
|
1497
|
-
if (Array.isArray(data)) {
|
|
1498
|
-
result.encodedData[cacheKeyFn({
|
|
1499
|
-
dataSlice,
|
|
1500
|
-
encoding: encoding === "jsonParsed" ? "base64" : encoding ?? "base64"
|
|
1501
|
-
})] = data[0];
|
|
1502
|
-
} else if (typeof data === "string") {
|
|
1503
|
-
result.encodedData[cacheKeyFn({
|
|
1504
|
-
dataSlice,
|
|
1505
|
-
encoding: "base58"
|
|
1506
|
-
})] = data;
|
|
1507
|
-
} else if (typeof data === "object") {
|
|
1508
|
-
const {
|
|
1509
|
-
parsed: { info: parsedData, type: accountType },
|
|
1510
|
-
program: programName,
|
|
1511
|
-
programId
|
|
1512
|
-
} = data;
|
|
1513
|
-
result.jsonParsedConfigs = {
|
|
1514
|
-
accountType,
|
|
1515
|
-
programId,
|
|
1516
|
-
programName
|
|
1517
|
-
};
|
|
1518
|
-
result = {
|
|
1519
|
-
...result,
|
|
1520
|
-
...parsedData
|
|
1521
|
-
};
|
|
1522
|
-
}
|
|
1782
|
+
const argsSet = buildProgramAccountsLoaderArgSetFromResolveInfo({ ...args, programAddress }, info);
|
|
1783
|
+
const loadedProgramAccountsLists = await context.loaders.programAccounts.loadMany(argsSet);
|
|
1784
|
+
const result = {};
|
|
1785
|
+
loadedProgramAccountsLists.forEach((programAccounts, i) => {
|
|
1786
|
+
if (programAccounts instanceof Error) {
|
|
1787
|
+
console.error(programAccounts);
|
|
1788
|
+
return;
|
|
1523
1789
|
}
|
|
1524
|
-
|
|
1790
|
+
programAccounts.forEach((programAccount) => {
|
|
1791
|
+
const { account, pubkey: address } = programAccount;
|
|
1792
|
+
const thisResult = result[address] ||= {
|
|
1793
|
+
...account,
|
|
1794
|
+
address,
|
|
1795
|
+
encodedData: {},
|
|
1796
|
+
ownerProgram: account.owner
|
|
1797
|
+
};
|
|
1798
|
+
const { data } = account;
|
|
1799
|
+
const { encoding, dataSlice } = argsSet[i];
|
|
1800
|
+
if (encoding && thisResult.encodedData) {
|
|
1801
|
+
if (Array.isArray(data)) {
|
|
1802
|
+
thisResult.encodedData[cacheKeyFn({
|
|
1803
|
+
dataSlice,
|
|
1804
|
+
encoding: encoding === "jsonParsed" ? "base64" : encoding
|
|
1805
|
+
})] = data[0];
|
|
1806
|
+
} else if (typeof data === "string") {
|
|
1807
|
+
thisResult.encodedData[cacheKeyFn({
|
|
1808
|
+
dataSlice,
|
|
1809
|
+
encoding: "base58"
|
|
1810
|
+
})] = data;
|
|
1811
|
+
} else if (typeof data === "object") {
|
|
1812
|
+
const {
|
|
1813
|
+
parsed: { info: parsedData, type: accountType },
|
|
1814
|
+
program: programName,
|
|
1815
|
+
programId
|
|
1816
|
+
} = data;
|
|
1817
|
+
thisResult.jsonParsedConfigs = {
|
|
1818
|
+
accountType,
|
|
1819
|
+
programId,
|
|
1820
|
+
programName
|
|
1821
|
+
};
|
|
1822
|
+
for (const key in parsedData) {
|
|
1823
|
+
thisResult[key] = parsedData[key];
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1525
1828
|
});
|
|
1829
|
+
return Object.values(result);
|
|
1526
1830
|
}
|
|
1527
1831
|
return null;
|
|
1528
1832
|
};
|
|
@@ -1553,7 +1857,7 @@ var stringScalarAlias = {
|
|
|
1553
1857
|
};
|
|
1554
1858
|
var bigIntScalarAlias = {
|
|
1555
1859
|
__parseLiteral(ast) {
|
|
1556
|
-
if (ast.kind === graphql.Kind.STRING) {
|
|
1860
|
+
if (ast.kind === graphql.Kind.STRING || ast.kind === graphql.Kind.INT || ast.kind === graphql.Kind.FLOAT) {
|
|
1557
1861
|
return BigInt(ast.value);
|
|
1558
1862
|
}
|
|
1559
1863
|
return null;
|
|
@@ -1576,17 +1880,15 @@ var typeTypeResolvers = {
|
|
|
1576
1880
|
Base64EncodedBytes: stringScalarAlias,
|
|
1577
1881
|
Base64ZstdEncodedBytes: stringScalarAlias,
|
|
1578
1882
|
BigInt: bigIntScalarAlias,
|
|
1579
|
-
BlockTransactionDetails: {
|
|
1580
|
-
ACCOUNTS: "accounts",
|
|
1581
|
-
FULL: "full",
|
|
1582
|
-
NONE: "none",
|
|
1583
|
-
SIGNATURES: "signatures"
|
|
1584
|
-
},
|
|
1585
1883
|
Commitment: {
|
|
1586
1884
|
CONFIRMED: "confirmed",
|
|
1587
1885
|
FINALIZED: "finalized",
|
|
1588
1886
|
PROCESSED: "processed"
|
|
1589
1887
|
},
|
|
1888
|
+
CommitmentWithoutProcessed: {
|
|
1889
|
+
CONFIRMED: "confirmed",
|
|
1890
|
+
FINALIZED: "finalized"
|
|
1891
|
+
},
|
|
1590
1892
|
Signature: stringScalarAlias,
|
|
1591
1893
|
Slot: bigIntScalarAlias,
|
|
1592
1894
|
TokenBalance: {
|
|
@@ -1595,12 +1897,7 @@ var typeTypeResolvers = {
|
|
|
1595
1897
|
},
|
|
1596
1898
|
TransactionEncoding: {
|
|
1597
1899
|
BASE_58: "base58",
|
|
1598
|
-
BASE_64: "base64"
|
|
1599
|
-
PARSED: "jsonParsed"
|
|
1600
|
-
},
|
|
1601
|
-
TransactionVersion: {
|
|
1602
|
-
LEGACY: "legacy",
|
|
1603
|
-
ZERO: 0
|
|
1900
|
+
BASE_64: "base64"
|
|
1604
1901
|
}
|
|
1605
1902
|
};
|
|
1606
1903
|
|
|
@@ -1804,93 +2101,18 @@ var accountTypeDefs = (
|
|
|
1804
2101
|
var blockTypeDefs = (
|
|
1805
2102
|
/* GraphQL */
|
|
1806
2103
|
`
|
|
1807
|
-
type TransactionMetaForAccounts {
|
|
1808
|
-
err: String
|
|
1809
|
-
fee: BigInt
|
|
1810
|
-
postBalances: [BigInt]
|
|
1811
|
-
postTokenBalances: [TokenBalance]
|
|
1812
|
-
preBalances: [BigInt]
|
|
1813
|
-
preTokenBalances: [TokenBalance]
|
|
1814
|
-
status: TransactionStatus
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
type TransactionDataForAccounts {
|
|
1818
|
-
accountKeys: [Address]
|
|
1819
|
-
signatures: [String]
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
type BlockTransactionAccounts {
|
|
1823
|
-
meta: TransactionMetaForAccounts
|
|
1824
|
-
data: TransactionDataForAccounts
|
|
1825
|
-
version: String
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
"""
|
|
1829
|
-
Block interface
|
|
1830
|
-
"""
|
|
1831
|
-
interface Block {
|
|
1832
|
-
blockhash: String
|
|
1833
|
-
blockHeight: BigInt
|
|
1834
|
-
blockTime: BigInt
|
|
1835
|
-
parentSlot: BigInt
|
|
1836
|
-
previousBlockhash: String
|
|
1837
|
-
rewards: [Reward]
|
|
1838
|
-
transactionDetails: String
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
2104
|
"""
|
|
1842
|
-
A block
|
|
2105
|
+
A Solana block
|
|
1843
2106
|
"""
|
|
1844
|
-
type
|
|
2107
|
+
type Block {
|
|
1845
2108
|
blockhash: String
|
|
1846
2109
|
blockHeight: BigInt
|
|
1847
2110
|
blockTime: BigInt
|
|
1848
|
-
parentSlot:
|
|
1849
|
-
previousBlockhash: String
|
|
1850
|
-
rewards: [Reward]
|
|
1851
|
-
transactions: [BlockTransactionAccounts]
|
|
1852
|
-
transactionDetails: String
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
"""
|
|
1856
|
-
A block with full transaction details
|
|
1857
|
-
"""
|
|
1858
|
-
type BlockWithFull implements Block {
|
|
1859
|
-
blockhash: String
|
|
1860
|
-
blockHeight: BigInt
|
|
1861
|
-
blockTime: BigInt
|
|
1862
|
-
parentSlot: BigInt
|
|
2111
|
+
parentSlot: Slot
|
|
1863
2112
|
previousBlockhash: String
|
|
1864
2113
|
rewards: [Reward]
|
|
2114
|
+
signatures: [Signature]
|
|
1865
2115
|
transactions: [Transaction]
|
|
1866
|
-
transactionDetails: String
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
"""
|
|
1870
|
-
A block with no transaction details
|
|
1871
|
-
"""
|
|
1872
|
-
type BlockWithNone implements Block {
|
|
1873
|
-
blockhash: String
|
|
1874
|
-
blockHeight: BigInt
|
|
1875
|
-
blockTime: BigInt
|
|
1876
|
-
parentSlot: BigInt
|
|
1877
|
-
previousBlockhash: String
|
|
1878
|
-
rewards: [Reward]
|
|
1879
|
-
transactionDetails: String
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
"""
|
|
1883
|
-
A block with signature transaction details
|
|
1884
|
-
"""
|
|
1885
|
-
type BlockWithSignatures implements Block {
|
|
1886
|
-
blockhash: String
|
|
1887
|
-
blockHeight: BigInt
|
|
1888
|
-
blockTime: BigInt
|
|
1889
|
-
parentSlot: BigInt
|
|
1890
|
-
previousBlockhash: String
|
|
1891
|
-
rewards: [Reward]
|
|
1892
|
-
signatures: [String]
|
|
1893
|
-
transactionDetails: String
|
|
1894
2116
|
}
|
|
1895
2117
|
`
|
|
1896
2118
|
);
|
|
@@ -2012,12 +2234,12 @@ var instructionTypeDefs = (
|
|
|
2012
2234
|
programId: Address
|
|
2013
2235
|
authority: Account
|
|
2014
2236
|
bufferAccount: Account
|
|
2015
|
-
clockSysvar:
|
|
2237
|
+
clockSysvar: Account
|
|
2016
2238
|
maxDataLen: BigInt
|
|
2017
2239
|
payerAccount: Account
|
|
2018
2240
|
programAccount: Account
|
|
2019
2241
|
programDataAccount: Account
|
|
2020
|
-
rentSysvar:
|
|
2242
|
+
rentSysvar: Account
|
|
2021
2243
|
}
|
|
2022
2244
|
|
|
2023
2245
|
"""
|
|
@@ -2027,10 +2249,10 @@ var instructionTypeDefs = (
|
|
|
2027
2249
|
programId: Address
|
|
2028
2250
|
authority: Account
|
|
2029
2251
|
bufferAccount: Account
|
|
2030
|
-
clockSysvar:
|
|
2252
|
+
clockSysvar: Account
|
|
2031
2253
|
programAccount: Account
|
|
2032
2254
|
programDataAccount: Account
|
|
2033
|
-
rentSysvar:
|
|
2255
|
+
rentSysvar: Account
|
|
2034
2256
|
spillAccount: Account
|
|
2035
2257
|
}
|
|
2036
2258
|
|
|
@@ -2083,7 +2305,7 @@ var instructionTypeDefs = (
|
|
|
2083
2305
|
type SplAssociatedTokenCreateInstruction implements TransactionInstruction {
|
|
2084
2306
|
programId: Address
|
|
2085
2307
|
account: Account
|
|
2086
|
-
mint:
|
|
2308
|
+
mint: Account
|
|
2087
2309
|
source: Account
|
|
2088
2310
|
systemProgram: Account
|
|
2089
2311
|
tokenProgram: Account
|
|
@@ -2096,7 +2318,7 @@ var instructionTypeDefs = (
|
|
|
2096
2318
|
type SplAssociatedTokenCreateIdempotentInstruction implements TransactionInstruction {
|
|
2097
2319
|
programId: Address
|
|
2098
2320
|
account: Account
|
|
2099
|
-
mint:
|
|
2321
|
+
mint: Account
|
|
2100
2322
|
source: Account
|
|
2101
2323
|
systemProgram: Account
|
|
2102
2324
|
tokenProgram: Account
|
|
@@ -2134,7 +2356,7 @@ var instructionTypeDefs = (
|
|
|
2134
2356
|
freezeAuthority: Account
|
|
2135
2357
|
mint: Account
|
|
2136
2358
|
mintAuthority: Account
|
|
2137
|
-
rentSysvar:
|
|
2359
|
+
rentSysvar: Account
|
|
2138
2360
|
}
|
|
2139
2361
|
|
|
2140
2362
|
"""
|
|
@@ -2156,7 +2378,7 @@ var instructionTypeDefs = (
|
|
|
2156
2378
|
account: Account
|
|
2157
2379
|
mint: Account
|
|
2158
2380
|
owner: Account
|
|
2159
|
-
rentSysvar:
|
|
2381
|
+
rentSysvar: Account
|
|
2160
2382
|
}
|
|
2161
2383
|
|
|
2162
2384
|
"""
|
|
@@ -2167,7 +2389,7 @@ var instructionTypeDefs = (
|
|
|
2167
2389
|
account: Account
|
|
2168
2390
|
mint: Account
|
|
2169
2391
|
owner: Account
|
|
2170
|
-
rentSysvar:
|
|
2392
|
+
rentSysvar: Account
|
|
2171
2393
|
}
|
|
2172
2394
|
|
|
2173
2395
|
"""
|
|
@@ -2187,7 +2409,7 @@ var instructionTypeDefs = (
|
|
|
2187
2409
|
programId: Address
|
|
2188
2410
|
m: BigInt # FIXME:*
|
|
2189
2411
|
multisig: Account
|
|
2190
|
-
rentSysvar:
|
|
2412
|
+
rentSysvar: Account
|
|
2191
2413
|
signers: [Address]
|
|
2192
2414
|
}
|
|
2193
2415
|
|
|
@@ -2442,7 +2664,7 @@ var instructionTypeDefs = (
|
|
|
2442
2664
|
programId: Address
|
|
2443
2665
|
authorized: StakeInitializeInstructionDataAuthorized
|
|
2444
2666
|
lockup: Lockup
|
|
2445
|
-
rentSysvar:
|
|
2667
|
+
rentSysvar: Account
|
|
2446
2668
|
stakeAccount: Account
|
|
2447
2669
|
}
|
|
2448
2670
|
|
|
@@ -2453,7 +2675,7 @@ var instructionTypeDefs = (
|
|
|
2453
2675
|
programId: Address
|
|
2454
2676
|
authority: Account
|
|
2455
2677
|
authorityType: String
|
|
2456
|
-
clockSysvar:
|
|
2678
|
+
clockSysvar: Account
|
|
2457
2679
|
custodian: Account
|
|
2458
2680
|
newAuthority: Account
|
|
2459
2681
|
stakeAccount: Account
|
|
@@ -2464,11 +2686,11 @@ var instructionTypeDefs = (
|
|
|
2464
2686
|
"""
|
|
2465
2687
|
type StakeDelegateStakeInstruction implements TransactionInstruction {
|
|
2466
2688
|
programId: Address
|
|
2467
|
-
clockSysvar:
|
|
2689
|
+
clockSysvar: Account
|
|
2468
2690
|
stakeAccount: Account
|
|
2469
2691
|
stakeAuthority: Account
|
|
2470
2692
|
stakeConfigAccount: Account
|
|
2471
|
-
stakeHistorySysvar:
|
|
2693
|
+
stakeHistorySysvar: Account
|
|
2472
2694
|
voteAccount: Account
|
|
2473
2695
|
}
|
|
2474
2696
|
|
|
@@ -2488,7 +2710,7 @@ var instructionTypeDefs = (
|
|
|
2488
2710
|
"""
|
|
2489
2711
|
type StakeWithdrawInstruction implements TransactionInstruction {
|
|
2490
2712
|
programId: Address
|
|
2491
|
-
clockSysvar:
|
|
2713
|
+
clockSysvar: Account
|
|
2492
2714
|
destination: Account
|
|
2493
2715
|
lamports: BigInt
|
|
2494
2716
|
stakeAccount: Account
|
|
@@ -2500,7 +2722,7 @@ var instructionTypeDefs = (
|
|
|
2500
2722
|
"""
|
|
2501
2723
|
type StakeDeactivateInstruction implements TransactionInstruction {
|
|
2502
2724
|
programId: Address
|
|
2503
|
-
clockSysvar:
|
|
2725
|
+
clockSysvar: Account
|
|
2504
2726
|
stakeAccount: Account
|
|
2505
2727
|
stakeAuthority: Account
|
|
2506
2728
|
}
|
|
@@ -2520,11 +2742,11 @@ var instructionTypeDefs = (
|
|
|
2520
2742
|
"""
|
|
2521
2743
|
type StakeMergeInstruction implements TransactionInstruction {
|
|
2522
2744
|
programId: Address
|
|
2523
|
-
clockSysvar:
|
|
2745
|
+
clockSysvar: Account
|
|
2524
2746
|
destination: Account
|
|
2525
2747
|
source: Account
|
|
2526
2748
|
stakeAuthority: Account
|
|
2527
|
-
stakeHistorySysvar:
|
|
2749
|
+
stakeHistorySysvar: Account
|
|
2528
2750
|
}
|
|
2529
2751
|
|
|
2530
2752
|
"""
|
|
@@ -2536,7 +2758,7 @@ var instructionTypeDefs = (
|
|
|
2536
2758
|
authorityOwner: Account
|
|
2537
2759
|
authoritySeed: String
|
|
2538
2760
|
authorityType: String
|
|
2539
|
-
clockSysvar:
|
|
2761
|
+
clockSysvar: Account
|
|
2540
2762
|
custodian: Account
|
|
2541
2763
|
newAuthorized: Account
|
|
2542
2764
|
stakeAccount: Account
|
|
@@ -2553,7 +2775,7 @@ var instructionTypeDefs = (
|
|
|
2553
2775
|
programId: Address
|
|
2554
2776
|
authorized: StakeInitializeCheckedInstructionDataAuthorized
|
|
2555
2777
|
lockup: Lockup
|
|
2556
|
-
rentSysvar:
|
|
2778
|
+
rentSysvar: Account
|
|
2557
2779
|
stakeAccount: Account
|
|
2558
2780
|
}
|
|
2559
2781
|
|
|
@@ -2564,7 +2786,7 @@ var instructionTypeDefs = (
|
|
|
2564
2786
|
programId: Address
|
|
2565
2787
|
authority: Account
|
|
2566
2788
|
authorityType: String
|
|
2567
|
-
clockSysvar:
|
|
2789
|
+
clockSysvar: Account
|
|
2568
2790
|
custodian: Account
|
|
2569
2791
|
newAuthority: Account
|
|
2570
2792
|
stakeAccount: Account
|
|
@@ -2579,7 +2801,7 @@ var instructionTypeDefs = (
|
|
|
2579
2801
|
authorityOwner: Account
|
|
2580
2802
|
authoritySeed: String
|
|
2581
2803
|
authorityType: String
|
|
2582
|
-
clockSysvar:
|
|
2804
|
+
clockSysvar: Account
|
|
2583
2805
|
custodian: Account
|
|
2584
2806
|
newAuthorized: Account
|
|
2585
2807
|
stakeAccount: Account
|
|
@@ -2667,7 +2889,7 @@ var instructionTypeDefs = (
|
|
|
2667
2889
|
programId: Address
|
|
2668
2890
|
nonceAccount: Account
|
|
2669
2891
|
nonceAuthority: Account
|
|
2670
|
-
recentBlockhashesSysvar:
|
|
2892
|
+
recentBlockhashesSysvar: Account
|
|
2671
2893
|
}
|
|
2672
2894
|
|
|
2673
2895
|
"""
|
|
@@ -2679,8 +2901,8 @@ var instructionTypeDefs = (
|
|
|
2679
2901
|
lamports: BigInt
|
|
2680
2902
|
nonceAccount: Account
|
|
2681
2903
|
nonceAuthority: Account
|
|
2682
|
-
recentBlockhashesSysvar:
|
|
2683
|
-
rentSysvar:
|
|
2904
|
+
recentBlockhashesSysvar: Account
|
|
2905
|
+
rentSysvar: Account
|
|
2684
2906
|
}
|
|
2685
2907
|
|
|
2686
2908
|
"""
|
|
@@ -2690,8 +2912,8 @@ var instructionTypeDefs = (
|
|
|
2690
2912
|
programId: Address
|
|
2691
2913
|
nonceAccount: Account
|
|
2692
2914
|
nonceAuthority: Account
|
|
2693
|
-
recentBlockhashesSysvar:
|
|
2694
|
-
rentSysvar:
|
|
2915
|
+
recentBlockhashesSysvar: Account
|
|
2916
|
+
rentSysvar: Account
|
|
2695
2917
|
}
|
|
2696
2918
|
|
|
2697
2919
|
"""
|
|
@@ -2765,10 +2987,10 @@ var instructionTypeDefs = (
|
|
|
2765
2987
|
programId: Address
|
|
2766
2988
|
authorizedVoter: Account
|
|
2767
2989
|
authorizedWithdrawer: Account
|
|
2768
|
-
clockSysvar:
|
|
2990
|
+
clockSysvar: Account
|
|
2769
2991
|
commission: BigInt # FIXME:*
|
|
2770
2992
|
node: Account
|
|
2771
|
-
rentSysvar:
|
|
2993
|
+
rentSysvar: Account
|
|
2772
2994
|
voteAccount: Account
|
|
2773
2995
|
}
|
|
2774
2996
|
|
|
@@ -2779,7 +3001,7 @@ var instructionTypeDefs = (
|
|
|
2779
3001
|
programId: Address
|
|
2780
3002
|
authority: Account
|
|
2781
3003
|
authorityType: String
|
|
2782
|
-
clockSysvar:
|
|
3004
|
+
clockSysvar: Account
|
|
2783
3005
|
newAuthority: Account
|
|
2784
3006
|
voteAccount: Account
|
|
2785
3007
|
}
|
|
@@ -2793,7 +3015,7 @@ var instructionTypeDefs = (
|
|
|
2793
3015
|
authorityOwner: Account
|
|
2794
3016
|
authoritySeed: String
|
|
2795
3017
|
authorityType: String
|
|
2796
|
-
clockSysvar:
|
|
3018
|
+
clockSysvar: Account
|
|
2797
3019
|
newAuthority: Account
|
|
2798
3020
|
voteAccount: Account
|
|
2799
3021
|
}
|
|
@@ -2807,7 +3029,7 @@ var instructionTypeDefs = (
|
|
|
2807
3029
|
authorityOwner: Account
|
|
2808
3030
|
authoritySeed: String
|
|
2809
3031
|
authorityType: String
|
|
2810
|
-
clockSysvar:
|
|
3032
|
+
clockSysvar: Account
|
|
2811
3033
|
newAuthority: Account
|
|
2812
3034
|
voteAccount: Account
|
|
2813
3035
|
}
|
|
@@ -2823,8 +3045,8 @@ var instructionTypeDefs = (
|
|
|
2823
3045
|
"""
|
|
2824
3046
|
type VoteVoteInstruction implements TransactionInstruction {
|
|
2825
3047
|
programId: Address
|
|
2826
|
-
clockSysvar:
|
|
2827
|
-
slotHashesSysvar:
|
|
3048
|
+
clockSysvar: Account
|
|
3049
|
+
slotHashesSysvar: Account
|
|
2828
3050
|
vote: Vote
|
|
2829
3051
|
voteAccount: Account
|
|
2830
3052
|
voteAuthority: Account
|
|
@@ -2921,9 +3143,9 @@ var instructionTypeDefs = (
|
|
|
2921
3143
|
"""
|
|
2922
3144
|
type VoteVoteSwitchInstruction implements TransactionInstruction {
|
|
2923
3145
|
programId: Address
|
|
2924
|
-
clockSysvar:
|
|
3146
|
+
clockSysvar: Account
|
|
2925
3147
|
hash: String
|
|
2926
|
-
slotHashesSysvar:
|
|
3148
|
+
slotHashesSysvar: Account
|
|
2927
3149
|
vote: Vote
|
|
2928
3150
|
voteAccount: Account
|
|
2929
3151
|
voteAuthority: Account
|
|
@@ -2936,7 +3158,7 @@ var instructionTypeDefs = (
|
|
|
2936
3158
|
programId: Address
|
|
2937
3159
|
authority: Account
|
|
2938
3160
|
authorityType: String
|
|
2939
|
-
clockSysvar:
|
|
3161
|
+
clockSysvar: Account
|
|
2940
3162
|
newAuthority: Account
|
|
2941
3163
|
voteAccount: Account
|
|
2942
3164
|
}
|
|
@@ -2949,21 +3171,14 @@ var rootTypeDefs = (
|
|
|
2949
3171
|
`
|
|
2950
3172
|
type Query {
|
|
2951
3173
|
account(address: Address!, commitment: Commitment, minContextSlot: Slot): Account
|
|
2952
|
-
block(
|
|
2953
|
-
slot: Slot!
|
|
2954
|
-
commitment: Commitment
|
|
2955
|
-
encoding: TransactionEncoding
|
|
2956
|
-
transactionDetails: BlockTransactionDetails
|
|
2957
|
-
): Block
|
|
3174
|
+
block(slot: Slot!, commitment: CommitmentWithoutProcessed): Block
|
|
2958
3175
|
programAccounts(
|
|
2959
3176
|
programAddress: Address!
|
|
2960
3177
|
commitment: Commitment
|
|
2961
|
-
dataSlice: DataSlice
|
|
2962
|
-
encoding: AccountEncoding
|
|
2963
3178
|
filters: [ProgramAccountsFilter]
|
|
2964
3179
|
minContextSlot: Slot
|
|
2965
3180
|
): [Account]
|
|
2966
|
-
transaction(signature: Signature!, commitment:
|
|
3181
|
+
transaction(signature: Signature!, commitment: CommitmentWithoutProcessed): Transaction
|
|
2967
3182
|
}
|
|
2968
3183
|
|
|
2969
3184
|
schema {
|
|
@@ -3038,49 +3253,15 @@ var transactionTypeDefs = (
|
|
|
3038
3253
|
}
|
|
3039
3254
|
|
|
3040
3255
|
"""
|
|
3041
|
-
|
|
3256
|
+
A Solana transaction
|
|
3042
3257
|
"""
|
|
3043
|
-
|
|
3258
|
+
type Transaction {
|
|
3044
3259
|
blockTime: BigInt
|
|
3045
|
-
|
|
3046
|
-
slot: BigInt
|
|
3047
|
-
version: String
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
|
-
"""
|
|
3051
|
-
A transaction with base58 encoded data
|
|
3052
|
-
"""
|
|
3053
|
-
type TransactionBase58 implements Transaction {
|
|
3054
|
-
blockTime: BigInt
|
|
3055
|
-
data: Base58EncodedBytes
|
|
3056
|
-
meta: TransactionMeta
|
|
3057
|
-
slot: BigInt
|
|
3058
|
-
version: String
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
"""
|
|
3062
|
-
A transaction with base64 encoded data
|
|
3063
|
-
"""
|
|
3064
|
-
type TransactionBase64 implements Transaction {
|
|
3065
|
-
blockTime: BigInt
|
|
3066
|
-
data: Base64EncodedBytes
|
|
3067
|
-
meta: TransactionMeta
|
|
3068
|
-
slot: BigInt
|
|
3069
|
-
version: String
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
"""
|
|
3073
|
-
A transaction with JSON encoded data
|
|
3074
|
-
"""
|
|
3075
|
-
type TransactionDataParsed {
|
|
3260
|
+
data(encoding: TransactionEncoding!): String
|
|
3076
3261
|
message: TransactionMessage
|
|
3077
|
-
signatures: [String]
|
|
3078
|
-
}
|
|
3079
|
-
type TransactionParsed implements Transaction {
|
|
3080
|
-
blockTime: BigInt
|
|
3081
|
-
data: TransactionDataParsed
|
|
3082
3262
|
meta: TransactionMeta
|
|
3083
|
-
|
|
3263
|
+
signatures: [Signature]
|
|
3264
|
+
slot: Slot
|
|
3084
3265
|
version: String
|
|
3085
3266
|
}
|
|
3086
3267
|
`
|
|
@@ -3106,19 +3287,17 @@ var typeTypeDefs = (
|
|
|
3106
3287
|
|
|
3107
3288
|
scalar BigInt
|
|
3108
3289
|
|
|
3109
|
-
enum BlockTransactionDetails {
|
|
3110
|
-
ACCOUNTS
|
|
3111
|
-
FULL
|
|
3112
|
-
NONE
|
|
3113
|
-
SIGNATURES
|
|
3114
|
-
}
|
|
3115
|
-
|
|
3116
3290
|
enum Commitment {
|
|
3117
3291
|
CONFIRMED
|
|
3118
3292
|
FINALIZED
|
|
3119
3293
|
PROCESSED
|
|
3120
3294
|
}
|
|
3121
3295
|
|
|
3296
|
+
enum CommitmentWithoutProcessed {
|
|
3297
|
+
CONFIRMED
|
|
3298
|
+
FINALIZED
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3122
3301
|
input DataSlice {
|
|
3123
3302
|
offset: Int!
|
|
3124
3303
|
length: Int!
|
|
@@ -3166,12 +3345,6 @@ var typeTypeDefs = (
|
|
|
3166
3345
|
enum TransactionEncoding {
|
|
3167
3346
|
BASE_58
|
|
3168
3347
|
BASE_64
|
|
3169
|
-
PARSED
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
|
-
enum TransactionVersion {
|
|
3173
|
-
LEGACY
|
|
3174
|
-
ZERO
|
|
3175
3348
|
}
|
|
3176
3349
|
`
|
|
3177
3350
|
);
|