@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.node.js
CHANGED
|
@@ -13,6 +13,151 @@ function replacer(_, value) {
|
|
|
13
13
|
}
|
|
14
14
|
var cacheKeyFn = (obj) => stringify(obj, { replacer });
|
|
15
15
|
|
|
16
|
+
// src/loaders/coalescer.ts
|
|
17
|
+
var hashOmit = (args, omit) => {
|
|
18
|
+
const argsObj = {};
|
|
19
|
+
for (const [key, value] of Object.entries(args)) {
|
|
20
|
+
if (!omit.includes(key)) {
|
|
21
|
+
argsObj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return cacheKeyFn(argsObj);
|
|
25
|
+
};
|
|
26
|
+
function buildCoalescedFetchesByArgsHash(toFetchMap, orphanConfig) {
|
|
27
|
+
const fetchesByArgsHash = {};
|
|
28
|
+
const orphanedFetches = {};
|
|
29
|
+
Object.entries(toFetchMap).forEach(([signature, toFetch]) => {
|
|
30
|
+
toFetch.forEach(({ args, promiseCallback }) => {
|
|
31
|
+
if (orphanConfig.criteria(args)) {
|
|
32
|
+
const toFetch2 = orphanedFetches[signature] ||= [];
|
|
33
|
+
toFetch2.push({ args, promiseCallback });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const argsHash = hashOmit(args, []);
|
|
37
|
+
const transactionFetches = fetchesByArgsHash[argsHash] ||= {
|
|
38
|
+
args,
|
|
39
|
+
fetches: {}
|
|
40
|
+
};
|
|
41
|
+
const { callbacks: promiseCallbacksForSignature } = transactionFetches.fetches[signature] ||= {
|
|
42
|
+
callbacks: []
|
|
43
|
+
};
|
|
44
|
+
promiseCallbacksForSignature.push(promiseCallback);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
Object.entries(orphanedFetches).forEach(([signature, toFetch]) => {
|
|
48
|
+
toFetch.forEach(({ args: orphanArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
49
|
+
if (Object.keys(fetchesByArgsHash).length !== 0) {
|
|
50
|
+
for (const { fetches, args: args2 } of Object.values(fetchesByArgsHash)) {
|
|
51
|
+
if (hashOmit(orphanArgs, orphanConfig.hashOmit) === hashOmit(args2, orphanConfig.hashOmit)) {
|
|
52
|
+
const { callbacks: promiseCallbacksForSignature2 } = fetches[signature] ||= {
|
|
53
|
+
callbacks: []
|
|
54
|
+
};
|
|
55
|
+
promiseCallbacksForSignature2.push(orphanPromiseCallback);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const args = orphanConfig.defaults(orphanArgs);
|
|
61
|
+
const argsHash = hashOmit(args, []);
|
|
62
|
+
const transactionFetches = fetchesByArgsHash[argsHash] ||= {
|
|
63
|
+
args,
|
|
64
|
+
fetches: {}
|
|
65
|
+
};
|
|
66
|
+
const { callbacks: promiseCallbacksForSignature } = transactionFetches.fetches[signature] ||= {
|
|
67
|
+
callbacks: []
|
|
68
|
+
};
|
|
69
|
+
promiseCallbacksForSignature.push(orphanPromiseCallback);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return fetchesByArgsHash;
|
|
73
|
+
}
|
|
74
|
+
function buildCoalescedFetchesByArgsHashWithDataSlice(toFetchMap, maxDataSliceByteRange) {
|
|
75
|
+
const fetchesByArgsHash = {};
|
|
76
|
+
const orphanedFetches = {};
|
|
77
|
+
Object.entries(toFetchMap).forEach(([address, toFetch]) => {
|
|
78
|
+
toFetch.forEach(({ args, promiseCallback }) => {
|
|
79
|
+
if (!args.encoding) {
|
|
80
|
+
const toFetch2 = orphanedFetches[address] ||= [];
|
|
81
|
+
toFetch2.push({ args, promiseCallback });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (args.encoding != "base64+zstd" && args.dataSlice) {
|
|
85
|
+
const r = args.dataSlice;
|
|
86
|
+
for (const { fetches: fetchAddresses, args: fetchArgs } of Object.values(fetchesByArgsHash)) {
|
|
87
|
+
const addCallbackWithDataSlice = (updateDataSlice) => {
|
|
88
|
+
const { callbacks: promiseCallbacksForAddress2 } = fetchAddresses[address] ||= {
|
|
89
|
+
callbacks: []
|
|
90
|
+
};
|
|
91
|
+
promiseCallbacksForAddress2.push({
|
|
92
|
+
callback: promiseCallback,
|
|
93
|
+
dataSlice: args.dataSlice ?? null
|
|
94
|
+
});
|
|
95
|
+
if (fetchArgs.dataSlice && updateDataSlice) {
|
|
96
|
+
fetchArgs.dataSlice = updateDataSlice;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
if (hashOmit(args, ["dataSlice"]) === hashOmit(fetchArgs, ["dataSlice"])) {
|
|
100
|
+
if (fetchArgs.dataSlice) {
|
|
101
|
+
const g = fetchArgs.dataSlice;
|
|
102
|
+
if (r.offset <= g.offset && g.offset - r.offset + r.length <= maxDataSliceByteRange) {
|
|
103
|
+
const length = Math.max(r.length, g.offset + g.length - r.offset);
|
|
104
|
+
const offset = r.offset;
|
|
105
|
+
addCallbackWithDataSlice({ length, offset });
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (r.offset >= g.offset && r.offset - g.offset + g.length <= maxDataSliceByteRange) {
|
|
109
|
+
const length = Math.max(g.length, r.offset + r.length - g.offset);
|
|
110
|
+
const offset = g.offset;
|
|
111
|
+
addCallbackWithDataSlice({ length, offset });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const { length, offset } = r;
|
|
116
|
+
addCallbackWithDataSlice({ length, offset });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const argsHash = hashOmit(args, []);
|
|
123
|
+
const accountFetches = fetchesByArgsHash[argsHash] ||= {
|
|
124
|
+
args,
|
|
125
|
+
fetches: {}
|
|
126
|
+
};
|
|
127
|
+
const { callbacks: promiseCallbacksForAddress } = accountFetches.fetches[address] ||= {
|
|
128
|
+
callbacks: []
|
|
129
|
+
};
|
|
130
|
+
promiseCallbacksForAddress.push({ callback: promiseCallback, dataSlice: args.dataSlice ?? null });
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
Object.entries(orphanedFetches).forEach(([address, toFetch]) => {
|
|
134
|
+
toFetch.forEach(({ args: orphanedArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
135
|
+
if (Object.keys(fetchesByArgsHash).length !== 0) {
|
|
136
|
+
for (const { fetches, args: args2 } of Object.values(fetchesByArgsHash)) {
|
|
137
|
+
if (hashOmit(orphanedArgs, ["encoding", "dataSlice"]) === hashOmit(args2, ["encoding", "dataSlice"])) {
|
|
138
|
+
const { callbacks: promiseCallbacksForAddress2 } = fetches[address] ||= {
|
|
139
|
+
callbacks: []
|
|
140
|
+
};
|
|
141
|
+
promiseCallbacksForAddress2.push({ callback: orphanPromiseCallback });
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const args = { ...orphanedArgs, encoding: "base64" };
|
|
147
|
+
const argsHash = hashOmit(args, []);
|
|
148
|
+
const accountFetches = fetchesByArgsHash[argsHash] ||= {
|
|
149
|
+
args,
|
|
150
|
+
fetches: {}
|
|
151
|
+
};
|
|
152
|
+
const { callbacks: promiseCallbacksForAddress } = accountFetches.fetches[address] ||= {
|
|
153
|
+
callbacks: []
|
|
154
|
+
};
|
|
155
|
+
promiseCallbacksForAddress.push({ callback: orphanPromiseCallback });
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
return fetchesByArgsHash;
|
|
159
|
+
}
|
|
160
|
+
|
|
16
161
|
// src/loaders/account.ts
|
|
17
162
|
function getCodec(encoding) {
|
|
18
163
|
switch (encoding) {
|
|
@@ -56,15 +201,6 @@ async function loadAccount(rpc, { address, ...config }) {
|
|
|
56
201
|
async function loadMultipleAccounts(rpc, { addresses, ...config }) {
|
|
57
202
|
return await rpc.getMultipleAccounts(addresses, config).send().then((res) => res.value);
|
|
58
203
|
}
|
|
59
|
-
var hashOmit = (args, omit) => {
|
|
60
|
-
const argsObj = {};
|
|
61
|
-
for (const [key, value] of Object.entries(args)) {
|
|
62
|
-
if (!omit.includes(key)) {
|
|
63
|
-
argsObj[key] = value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return cacheKeyFn(argsObj);
|
|
67
|
-
};
|
|
68
204
|
function createAccountBatchLoadFn(rpc, config) {
|
|
69
205
|
const resolveAccountUsingRpc = loadAccount.bind(null, rpc);
|
|
70
206
|
const resolveMultipleAccountsUsingRpc = loadMultipleAccounts.bind(null, rpc);
|
|
@@ -84,92 +220,11 @@ function createAccountBatchLoadFn(rpc, config) {
|
|
|
84
220
|
);
|
|
85
221
|
} finally {
|
|
86
222
|
const { maxDataSliceByteRange, maxMultipleAccountsBatchSize } = config;
|
|
87
|
-
const accountFetchesByArgsHash =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const toFetch2 = orphanedFetches[address] ||= [];
|
|
93
|
-
toFetch2.push({ args, promiseCallback });
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (args.encoding != "base64+zstd" && args.dataSlice) {
|
|
97
|
-
const r = args.dataSlice;
|
|
98
|
-
for (const { addresses: fetchAddresses, args: fetchArgs } of Object.values(
|
|
99
|
-
accountFetchesByArgsHash
|
|
100
|
-
)) {
|
|
101
|
-
const addCallbackWithDataSlice = (updateDataSlice) => {
|
|
102
|
-
const { callbacks: promiseCallbacksForAddress2 } = fetchAddresses[address] ||= {
|
|
103
|
-
callbacks: []
|
|
104
|
-
};
|
|
105
|
-
promiseCallbacksForAddress2.push({
|
|
106
|
-
callback: promiseCallback,
|
|
107
|
-
dataSlice: args.dataSlice ?? null
|
|
108
|
-
});
|
|
109
|
-
if (fetchArgs.dataSlice && updateDataSlice) {
|
|
110
|
-
fetchArgs.dataSlice = updateDataSlice;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
if (hashOmit(args, ["dataSlice"]) === hashOmit(fetchArgs, ["dataSlice"])) {
|
|
114
|
-
if (fetchArgs.dataSlice) {
|
|
115
|
-
const g = fetchArgs.dataSlice;
|
|
116
|
-
if (r.offset <= g.offset && g.offset - r.offset + r.length <= maxDataSliceByteRange) {
|
|
117
|
-
const length = Math.max(r.length, g.offset + g.length - r.offset);
|
|
118
|
-
const offset = r.offset;
|
|
119
|
-
addCallbackWithDataSlice({ length, offset });
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (r.offset >= g.offset && r.offset - g.offset + g.length <= maxDataSliceByteRange) {
|
|
123
|
-
const length = Math.max(g.length, r.offset + r.length - g.offset);
|
|
124
|
-
const offset = g.offset;
|
|
125
|
-
addCallbackWithDataSlice({ length, offset });
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
const { length, offset } = r;
|
|
130
|
-
addCallbackWithDataSlice({ length, offset });
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const argsHash = hashOmit(args, []);
|
|
137
|
-
const accountFetches = accountFetchesByArgsHash[argsHash] ||= {
|
|
138
|
-
addresses: {},
|
|
139
|
-
args
|
|
140
|
-
};
|
|
141
|
-
const { callbacks: promiseCallbacksForAddress } = accountFetches.addresses[address] ||= {
|
|
142
|
-
callbacks: []
|
|
143
|
-
};
|
|
144
|
-
promiseCallbacksForAddress.push({ callback: promiseCallback, dataSlice: args.dataSlice ?? null });
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
Object.entries(orphanedFetches).forEach(([address, toFetch]) => {
|
|
148
|
-
toFetch.forEach(({ args: orphanedArgs, promiseCallback: orphanPromiseCallback }) => {
|
|
149
|
-
if (Object.keys(accountFetchesByArgsHash).length !== 0) {
|
|
150
|
-
for (const { addresses, args: args2 } of Object.values(accountFetchesByArgsHash)) {
|
|
151
|
-
if (hashOmit(orphanedArgs, ["encoding", "dataSlice"]) === hashOmit(args2, ["encoding", "dataSlice"])) {
|
|
152
|
-
const { callbacks: promiseCallbacksForAddress2 } = addresses[address] ||= {
|
|
153
|
-
callbacks: []
|
|
154
|
-
};
|
|
155
|
-
promiseCallbacksForAddress2.push({ callback: orphanPromiseCallback });
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const args = { ...orphanedArgs, encoding: "base64" };
|
|
161
|
-
const argsHash = hashOmit(args, []);
|
|
162
|
-
const accountFetches = accountFetchesByArgsHash[argsHash] ||= {
|
|
163
|
-
addresses: {},
|
|
164
|
-
args
|
|
165
|
-
};
|
|
166
|
-
const { callbacks: promiseCallbacksForAddress } = accountFetches.addresses[address] ||= {
|
|
167
|
-
callbacks: []
|
|
168
|
-
};
|
|
169
|
-
promiseCallbacksForAddress.push({ callback: orphanPromiseCallback });
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
Object.values(accountFetchesByArgsHash).map(({ args, addresses: addressCallbacks }) => {
|
|
223
|
+
const accountFetchesByArgsHash = buildCoalescedFetchesByArgsHashWithDataSlice(
|
|
224
|
+
accountsToFetch,
|
|
225
|
+
maxDataSliceByteRange
|
|
226
|
+
);
|
|
227
|
+
Object.values(accountFetchesByArgsHash).map(({ args, fetches: addressCallbacks }) => {
|
|
173
228
|
const addresses = Object.keys(addressCallbacks);
|
|
174
229
|
if (addresses.length === 1) {
|
|
175
230
|
const address = addresses[0];
|
|
@@ -224,23 +279,6 @@ function createAccountLoader(rpc, config) {
|
|
|
224
279
|
loadMany: async (args) => loader.loadMany(args)
|
|
225
280
|
};
|
|
226
281
|
}
|
|
227
|
-
function applyDefaultArgs({
|
|
228
|
-
slot,
|
|
229
|
-
commitment,
|
|
230
|
-
encoding = "jsonParsed",
|
|
231
|
-
maxSupportedTransactionVersion = 0,
|
|
232
|
-
rewards,
|
|
233
|
-
transactionDetails = "full"
|
|
234
|
-
}) {
|
|
235
|
-
return {
|
|
236
|
-
commitment,
|
|
237
|
-
encoding,
|
|
238
|
-
maxSupportedTransactionVersion,
|
|
239
|
-
rewards,
|
|
240
|
-
slot,
|
|
241
|
-
transactionDetails
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
282
|
async function loadBlock(rpc, { slot, ...config }) {
|
|
245
283
|
return await rpc.getBlock(
|
|
246
284
|
slot,
|
|
@@ -250,30 +288,50 @@ async function loadBlock(rpc, { slot, ...config }) {
|
|
|
250
288
|
}
|
|
251
289
|
function createBlockBatchLoadFn(rpc) {
|
|
252
290
|
const resolveBlockUsingRpc = loadBlock.bind(null, rpc);
|
|
253
|
-
return async (blockQueryArgs) =>
|
|
291
|
+
return async (blockQueryArgs) => {
|
|
292
|
+
const blocksToFetch = {};
|
|
293
|
+
try {
|
|
294
|
+
return Promise.all(blockQueryArgs.map(
|
|
295
|
+
({ slot, ...args }) => new Promise((resolve, reject) => {
|
|
296
|
+
const blockRecords = blocksToFetch[slot.toString()] ||= [];
|
|
297
|
+
if (!args.commitment) {
|
|
298
|
+
args.commitment = "confirmed";
|
|
299
|
+
}
|
|
300
|
+
blockRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
301
|
+
})
|
|
302
|
+
));
|
|
303
|
+
} finally {
|
|
304
|
+
const blockFetchesByArgsHash = buildCoalescedFetchesByArgsHash(blocksToFetch, {
|
|
305
|
+
criteria: (args) => args.encoding === void 0 && args.transactionDetails !== "signatures",
|
|
306
|
+
defaults: (args) => ({
|
|
307
|
+
...args,
|
|
308
|
+
transactionDetails: "none"
|
|
309
|
+
}),
|
|
310
|
+
hashOmit: ["encoding", "transactionDetails"]
|
|
311
|
+
});
|
|
312
|
+
Object.values(blockFetchesByArgsHash).map(({ args, fetches: blockCallbacks }) => {
|
|
313
|
+
return Object.entries(blockCallbacks).map(([slot, { callbacks }]) => {
|
|
314
|
+
return Array.from({ length: 1 }, async () => {
|
|
315
|
+
try {
|
|
316
|
+
const result = await resolveBlockUsingRpc({
|
|
317
|
+
slot: BigInt(slot),
|
|
318
|
+
...args
|
|
319
|
+
});
|
|
320
|
+
callbacks.forEach((c) => c.resolve(result));
|
|
321
|
+
} catch (e) {
|
|
322
|
+
callbacks.forEach((c) => c.reject(e));
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
};
|
|
254
329
|
}
|
|
255
330
|
function createBlockLoader(rpc) {
|
|
256
331
|
const loader = new DataLoader(createBlockBatchLoadFn(rpc), { cacheKeyFn });
|
|
257
332
|
return {
|
|
258
|
-
load: async (args) => loader.load(
|
|
259
|
-
loadMany: async (args) => loader.loadMany(args.map(
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function applyDefaultArgs2({
|
|
263
|
-
commitment,
|
|
264
|
-
dataSlice,
|
|
265
|
-
encoding = "jsonParsed",
|
|
266
|
-
filters,
|
|
267
|
-
minContextSlot,
|
|
268
|
-
programAddress
|
|
269
|
-
}) {
|
|
270
|
-
return {
|
|
271
|
-
commitment,
|
|
272
|
-
dataSlice,
|
|
273
|
-
encoding,
|
|
274
|
-
filters,
|
|
275
|
-
minContextSlot,
|
|
276
|
-
programAddress
|
|
333
|
+
load: async (args) => loader.load({ ...args, maxSupportedTransactionVersion: 0 }),
|
|
334
|
+
loadMany: async (args) => loader.loadMany(args.map((a) => ({ ...a, maxSupportedTransactionVersion: 0 })))
|
|
277
335
|
};
|
|
278
336
|
}
|
|
279
337
|
async function loadProgramAccounts(rpc, { programAddress, ...config }) {
|
|
@@ -283,26 +341,50 @@ async function loadProgramAccounts(rpc, { programAddress, ...config }) {
|
|
|
283
341
|
config
|
|
284
342
|
).send();
|
|
285
343
|
}
|
|
286
|
-
function createProgramAccountsBatchLoadFn(rpc) {
|
|
344
|
+
function createProgramAccountsBatchLoadFn(rpc, config) {
|
|
287
345
|
const resolveProgramAccountsUsingRpc = loadProgramAccounts.bind(null, rpc);
|
|
288
|
-
return async (
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
346
|
+
return async (accountQueryArgs) => {
|
|
347
|
+
const programAccountsToFetch = {};
|
|
348
|
+
try {
|
|
349
|
+
return Promise.all(accountQueryArgs.map(
|
|
350
|
+
({ programAddress, ...args }) => new Promise((resolve, reject) => {
|
|
351
|
+
const accountRecords = programAccountsToFetch[programAddress] ||= [];
|
|
352
|
+
if (!args.commitment) {
|
|
353
|
+
args.commitment = "confirmed";
|
|
354
|
+
}
|
|
355
|
+
accountRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
356
|
+
})
|
|
357
|
+
));
|
|
358
|
+
} finally {
|
|
359
|
+
const { maxDataSliceByteRange } = config;
|
|
360
|
+
const programAccountsFetchesByArgsHash = buildCoalescedFetchesByArgsHashWithDataSlice(programAccountsToFetch, maxDataSliceByteRange);
|
|
361
|
+
Object.values(programAccountsFetchesByArgsHash).map(({ args, fetches: programAddressCallbacks }) => {
|
|
362
|
+
return Object.entries(programAddressCallbacks).map(([programAddress, { callbacks }]) => {
|
|
363
|
+
return Array.from({ length: 1 }, async () => {
|
|
364
|
+
try {
|
|
365
|
+
const result = await resolveProgramAccountsUsingRpc({
|
|
366
|
+
programAddress,
|
|
367
|
+
...args
|
|
368
|
+
});
|
|
369
|
+
callbacks.forEach(({ callback, dataSlice }) => {
|
|
370
|
+
callback.resolve(sliceData(result, dataSlice, args.dataSlice));
|
|
371
|
+
});
|
|
372
|
+
} catch (e) {
|
|
373
|
+
callbacks.forEach(({ callback }) => {
|
|
374
|
+
callback.reject(e);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
295
381
|
};
|
|
296
382
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
encoding = "jsonParsed",
|
|
300
|
-
signature
|
|
301
|
-
}) {
|
|
383
|
+
function createProgramAccountsLoader(rpc, config) {
|
|
384
|
+
const loader = new DataLoader(createProgramAccountsBatchLoadFn(rpc, config), { cacheKeyFn });
|
|
302
385
|
return {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
signature
|
|
386
|
+
load: async (args) => loader.load(args),
|
|
387
|
+
loadMany: async (args) => loader.loadMany(args)
|
|
306
388
|
};
|
|
307
389
|
}
|
|
308
390
|
async function loadTransaction(rpc, { signature, ...config }) {
|
|
@@ -314,13 +396,47 @@ async function loadTransaction(rpc, { signature, ...config }) {
|
|
|
314
396
|
}
|
|
315
397
|
function createTransactionBatchLoadFn(rpc) {
|
|
316
398
|
const resolveTransactionUsingRpc = loadTransaction.bind(null, rpc);
|
|
317
|
-
return async (transactionQueryArgs) =>
|
|
399
|
+
return async (transactionQueryArgs) => {
|
|
400
|
+
const transactionsToFetch = {};
|
|
401
|
+
try {
|
|
402
|
+
return Promise.all(transactionQueryArgs.map(
|
|
403
|
+
({ signature, ...args }) => new Promise((resolve, reject) => {
|
|
404
|
+
const transactionRecords = transactionsToFetch[signature] ||= [];
|
|
405
|
+
if (!args.commitment) {
|
|
406
|
+
args.commitment = "confirmed";
|
|
407
|
+
}
|
|
408
|
+
transactionRecords.push({ args, promiseCallback: { reject, resolve } });
|
|
409
|
+
})
|
|
410
|
+
));
|
|
411
|
+
} finally {
|
|
412
|
+
const transactionFetchesByArgsHash = buildCoalescedFetchesByArgsHash(transactionsToFetch, {
|
|
413
|
+
criteria: (args) => args.encoding === void 0,
|
|
414
|
+
defaults: (args) => ({ ...args, encoding: "base64" }),
|
|
415
|
+
hashOmit: ["encoding"]
|
|
416
|
+
});
|
|
417
|
+
Object.values(transactionFetchesByArgsHash).map(({ args, fetches: transactionCallbacks }) => {
|
|
418
|
+
return Object.entries(transactionCallbacks).map(([signature, { callbacks }]) => {
|
|
419
|
+
return Array.from({ length: 1 }, async () => {
|
|
420
|
+
try {
|
|
421
|
+
const result = await resolveTransactionUsingRpc({
|
|
422
|
+
signature,
|
|
423
|
+
...args
|
|
424
|
+
});
|
|
425
|
+
callbacks.forEach((c) => c.resolve(result));
|
|
426
|
+
} catch (e) {
|
|
427
|
+
callbacks.forEach((c) => c.reject(e));
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
};
|
|
318
434
|
}
|
|
319
435
|
function createTransactionLoader(rpc) {
|
|
320
436
|
const loader = new DataLoader(createTransactionBatchLoadFn(rpc), { cacheKeyFn });
|
|
321
437
|
return {
|
|
322
|
-
load: async (args) => loader.load(
|
|
323
|
-
loadMany: async (args) => loader.loadMany(args
|
|
438
|
+
load: async (args) => loader.load(args),
|
|
439
|
+
loadMany: async (args) => loader.loadMany(args)
|
|
324
440
|
};
|
|
325
441
|
}
|
|
326
442
|
|
|
@@ -330,7 +446,7 @@ function createSolanaGraphQLContext(rpc, config) {
|
|
|
330
446
|
loaders: {
|
|
331
447
|
account: createAccountLoader(rpc, config),
|
|
332
448
|
block: createBlockLoader(rpc),
|
|
333
|
-
programAccounts: createProgramAccountsLoader(rpc),
|
|
449
|
+
programAccounts: createProgramAccountsLoader(rpc, config),
|
|
334
450
|
transaction: createTransactionLoader(rpc)
|
|
335
451
|
}
|
|
336
452
|
};
|
|
@@ -420,7 +536,7 @@ function parseAccountDataSliceArgument(argumentNodes, variableValues) {
|
|
|
420
536
|
return void 0;
|
|
421
537
|
}
|
|
422
538
|
}
|
|
423
|
-
function
|
|
539
|
+
function buildAccountArgSetWithVisitor(args, info) {
|
|
424
540
|
const argSet = [args];
|
|
425
541
|
function buildArgSetWithVisitor(root) {
|
|
426
542
|
injectableRootVisitor(info, root, {
|
|
@@ -452,6 +568,93 @@ function buildAccountLoaderArgSetFromResolveInfo(args, info) {
|
|
|
452
568
|
buildArgSetWithVisitor(null);
|
|
453
569
|
return argSet;
|
|
454
570
|
}
|
|
571
|
+
function buildAccountLoaderArgSetFromResolveInfo(args, info) {
|
|
572
|
+
return buildAccountArgSetWithVisitor(args, info);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// src/resolvers/resolve-info/transaction.ts
|
|
576
|
+
function findArgumentNodeByName2(argumentNodes, name) {
|
|
577
|
+
return argumentNodes.find((argumentNode) => argumentNode.name.value === name);
|
|
578
|
+
}
|
|
579
|
+
function parseTransactionEncodingArgument(argumentNodes, variableValues) {
|
|
580
|
+
const argumentNode = findArgumentNodeByName2(argumentNodes, "encoding");
|
|
581
|
+
if (argumentNode) {
|
|
582
|
+
if (argumentNode.value.kind === "EnumValue") {
|
|
583
|
+
if (argumentNode.value.value === "BASE_58") {
|
|
584
|
+
return "base58";
|
|
585
|
+
}
|
|
586
|
+
if (argumentNode.value.value === "BASE_64") {
|
|
587
|
+
return "base64";
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (argumentNode.value.kind === "Variable") {
|
|
591
|
+
return variableValues[argumentNode.value.name.value];
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
return void 0;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function buildTransactionArgSetWithVisitor(args, info) {
|
|
598
|
+
const argSet = [args];
|
|
599
|
+
function buildArgSetWithVisitor(root) {
|
|
600
|
+
injectableRootVisitor(info, root, {
|
|
601
|
+
fieldNodeOperation(info2, node) {
|
|
602
|
+
if (node.name.value === "message" || node.name.value === "meta") {
|
|
603
|
+
argSet.push({ ...args, encoding: "jsonParsed" });
|
|
604
|
+
} else if (node.name.value === "data") {
|
|
605
|
+
if (node.arguments) {
|
|
606
|
+
const { variableValues } = info2;
|
|
607
|
+
const encoding = parseTransactionEncodingArgument(
|
|
608
|
+
node.arguments,
|
|
609
|
+
variableValues
|
|
610
|
+
);
|
|
611
|
+
argSet.push({ ...args, encoding });
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
fragmentSpreadNodeOperation(_info, fragment) {
|
|
616
|
+
buildArgSetWithVisitor(fragment);
|
|
617
|
+
},
|
|
618
|
+
inlineFragmentNodeOperation(_info, _node) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
buildArgSetWithVisitor(null);
|
|
624
|
+
return argSet;
|
|
625
|
+
}
|
|
626
|
+
function buildTransactionLoaderArgSetFromResolveInfo(args, info) {
|
|
627
|
+
return buildTransactionArgSetWithVisitor(args, info);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/resolvers/resolve-info/block.ts
|
|
631
|
+
function buildBlockLoaderArgSetFromResolveInfo(args, info) {
|
|
632
|
+
const argSet = [args];
|
|
633
|
+
function buildArgSetWithVisitor(root) {
|
|
634
|
+
injectableRootVisitor(info, root, {
|
|
635
|
+
fieldNodeOperation(info2, node) {
|
|
636
|
+
if (node.name.value === "signatures") {
|
|
637
|
+
argSet.push({ ...args, transactionDetails: "signatures" });
|
|
638
|
+
} else if (node.name.value === "transactions") {
|
|
639
|
+
argSet.push(...buildTransactionArgSetWithVisitor({ ...args, transactionDetails: "full" }, info2));
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
fragmentSpreadNodeOperation(_info, fragment) {
|
|
643
|
+
buildArgSetWithVisitor(fragment);
|
|
644
|
+
},
|
|
645
|
+
inlineFragmentNodeOperation(_info, _node) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
buildArgSetWithVisitor(null);
|
|
651
|
+
return argSet;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// src/resolvers/resolve-info/program-accounts.ts
|
|
655
|
+
function buildProgramAccountsLoaderArgSetFromResolveInfo(args, info) {
|
|
656
|
+
return buildAccountArgSetWithVisitor(args, info);
|
|
657
|
+
}
|
|
455
658
|
|
|
456
659
|
// src/resolvers/account.ts
|
|
457
660
|
var resolveAccountData = () => {
|
|
@@ -604,147 +807,207 @@ var accountResolvers = {
|
|
|
604
807
|
};
|
|
605
808
|
|
|
606
809
|
// src/resolvers/transaction.ts
|
|
607
|
-
function
|
|
608
|
-
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
810
|
+
function mapJsonParsedInstructions(instructions) {
|
|
811
|
+
return instructions.map((instruction) => {
|
|
812
|
+
if ("parsed" in instruction) {
|
|
813
|
+
if (typeof instruction.parsed === "string" && instruction.program === "spl-memo") {
|
|
814
|
+
const { parsed: memo, program: programName2, programId: programId2 } = instruction;
|
|
815
|
+
const instructionType2 = "memo";
|
|
816
|
+
const jsonParsedConfigs2 = {
|
|
817
|
+
instructionType: instructionType2,
|
|
818
|
+
programId: programId2,
|
|
819
|
+
programName: programName2
|
|
820
|
+
};
|
|
821
|
+
return { jsonParsedConfigs: jsonParsedConfigs2, memo, programId: programId2 };
|
|
822
|
+
}
|
|
823
|
+
const {
|
|
824
|
+
parsed: { info: data, type: instructionType },
|
|
825
|
+
program: programName,
|
|
826
|
+
programId
|
|
827
|
+
} = instruction;
|
|
828
|
+
const jsonParsedConfigs = {
|
|
829
|
+
instructionType,
|
|
830
|
+
programId,
|
|
831
|
+
programName
|
|
832
|
+
};
|
|
833
|
+
return { jsonParsedConfigs, ...data, programId };
|
|
834
|
+
} else {
|
|
835
|
+
return instruction;
|
|
836
|
+
}
|
|
631
837
|
});
|
|
632
|
-
return [transactionData, transactionMeta];
|
|
633
838
|
}
|
|
634
|
-
function
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
[transaction.transaction[0], transaction.meta]
|
|
641
|
-
) : (
|
|
642
|
-
// The transaction was either partially parsed or
|
|
643
|
-
// fully JSON-parsed, which will be sorted later.
|
|
644
|
-
transformParsedTransaction(transaction)
|
|
645
|
-
);
|
|
646
|
-
transaction.data = transactionData;
|
|
647
|
-
transaction.encoding = encoding;
|
|
648
|
-
transaction.meta = transactionMeta;
|
|
649
|
-
return transaction;
|
|
839
|
+
function mapJsonParsedInnerInstructions(innerInstructions) {
|
|
840
|
+
return innerInstructions.map(({ index, instructions }) => ({
|
|
841
|
+
index,
|
|
842
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
843
|
+
instructions: mapJsonParsedInstructions(instructions)
|
|
844
|
+
}));
|
|
650
845
|
}
|
|
846
|
+
var resolveTransactionData = () => {
|
|
847
|
+
return (parent, args) => {
|
|
848
|
+
return parent === null ? null : parent.encodedData ? parent.encodedData[cacheKeyFn(args)] : null;
|
|
849
|
+
};
|
|
850
|
+
};
|
|
651
851
|
function resolveTransaction(fieldName) {
|
|
652
852
|
return async (parent, args, context, info) => {
|
|
653
853
|
const signature = fieldName ? parent[fieldName] : args.signature;
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
return null;
|
|
663
|
-
}
|
|
664
|
-
if (args.encoding !== "jsonParsed") {
|
|
665
|
-
const transactionJsonParsed = await context.loaders.transaction.load({
|
|
666
|
-
...args,
|
|
667
|
-
encoding: "jsonParsed",
|
|
854
|
+
if (signature) {
|
|
855
|
+
if (onlyFieldsRequested(["signature"], info)) {
|
|
856
|
+
return { signature };
|
|
857
|
+
}
|
|
858
|
+
const argsSet = buildTransactionLoaderArgSetFromResolveInfo({ ...args, signature }, info);
|
|
859
|
+
const loadedTransactions = await context.loaders.transaction.loadMany(argsSet);
|
|
860
|
+
let result = {
|
|
861
|
+
encodedData: {},
|
|
668
862
|
signature
|
|
863
|
+
};
|
|
864
|
+
loadedTransactions.forEach((loadedTransaction, i) => {
|
|
865
|
+
if (loadedTransaction instanceof Error) {
|
|
866
|
+
console.error(loadedTransaction);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
if (loadedTransaction === null) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
if (!result.slot) {
|
|
873
|
+
result = {
|
|
874
|
+
...result,
|
|
875
|
+
...loadedTransaction
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
const { transaction: data } = loadedTransaction;
|
|
879
|
+
const { encoding } = argsSet[i];
|
|
880
|
+
if (encoding && result.encodedData) {
|
|
881
|
+
if (Array.isArray(data)) {
|
|
882
|
+
result.encodedData[cacheKeyFn({
|
|
883
|
+
encoding
|
|
884
|
+
})] = data[0];
|
|
885
|
+
} else if (typeof data === "object") {
|
|
886
|
+
const jsonParsedData = data;
|
|
887
|
+
jsonParsedData.message.instructions = mapJsonParsedInstructions(
|
|
888
|
+
jsonParsedData.message.instructions
|
|
889
|
+
);
|
|
890
|
+
const loadedInnerInstructions = loadedTransaction.meta?.innerInstructions;
|
|
891
|
+
if (loadedInnerInstructions) {
|
|
892
|
+
const innerInstructions = mapJsonParsedInnerInstructions(loadedInnerInstructions);
|
|
893
|
+
const jsonParsedMeta = {
|
|
894
|
+
...loadedTransaction.meta,
|
|
895
|
+
innerInstructions
|
|
896
|
+
};
|
|
897
|
+
result = {
|
|
898
|
+
...result,
|
|
899
|
+
...jsonParsedData,
|
|
900
|
+
meta: jsonParsedMeta
|
|
901
|
+
};
|
|
902
|
+
} else {
|
|
903
|
+
result = {
|
|
904
|
+
...result,
|
|
905
|
+
...jsonParsedData
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
669
910
|
});
|
|
670
|
-
|
|
671
|
-
return null;
|
|
672
|
-
}
|
|
673
|
-
transaction.meta = transactionJsonParsed.meta;
|
|
911
|
+
return result;
|
|
674
912
|
}
|
|
675
|
-
return
|
|
913
|
+
return null;
|
|
676
914
|
};
|
|
677
915
|
}
|
|
678
916
|
var transactionResolvers = {
|
|
679
917
|
Transaction: {
|
|
680
|
-
|
|
681
|
-
switch (transaction.encoding) {
|
|
682
|
-
case "base58":
|
|
683
|
-
return "TransactionBase58";
|
|
684
|
-
case "base64":
|
|
685
|
-
return "TransactionBase64";
|
|
686
|
-
default:
|
|
687
|
-
return "TransactionParsed";
|
|
688
|
-
}
|
|
689
|
-
}
|
|
918
|
+
data: resolveTransactionData()
|
|
690
919
|
}
|
|
691
920
|
};
|
|
692
921
|
|
|
693
922
|
// src/resolvers/block.ts
|
|
694
|
-
function transformLoadedBlock({
|
|
695
|
-
block,
|
|
696
|
-
encoding = "jsonParsed",
|
|
697
|
-
transactionDetails = "full"
|
|
698
|
-
}) {
|
|
699
|
-
const transformedBlock = block;
|
|
700
|
-
if (typeof block === "object" && "transactions" in block) {
|
|
701
|
-
transformedBlock.transactions = block.transactions.map((transaction) => {
|
|
702
|
-
if (transactionDetails === "accounts") {
|
|
703
|
-
return {
|
|
704
|
-
data: transaction.transaction,
|
|
705
|
-
meta: transaction.meta,
|
|
706
|
-
version: transaction.version
|
|
707
|
-
};
|
|
708
|
-
} else {
|
|
709
|
-
return transformLoadedTransaction({ encoding, transaction });
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
block.encoding = encoding;
|
|
714
|
-
block.transactionDetails = transactionDetails;
|
|
715
|
-
return block;
|
|
716
|
-
}
|
|
717
923
|
var resolveBlock = (fieldName) => {
|
|
718
924
|
return async (parent, args, context, info) => {
|
|
719
925
|
const slot = fieldName ? parent[fieldName] : args.slot;
|
|
720
|
-
if (
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
926
|
+
if (slot) {
|
|
927
|
+
if (onlyFieldsRequested(["slot"], info)) {
|
|
928
|
+
return { slot };
|
|
929
|
+
}
|
|
930
|
+
const argsSet = buildBlockLoaderArgSetFromResolveInfo({ ...args, slot }, info);
|
|
931
|
+
const loadedBlocks = await context.loaders.block.loadMany(argsSet);
|
|
932
|
+
let result = {
|
|
933
|
+
slot
|
|
934
|
+
};
|
|
935
|
+
loadedBlocks.forEach((loadedBlock, i) => {
|
|
936
|
+
if (loadedBlock instanceof Error) {
|
|
937
|
+
console.error(loadedBlock);
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (loadedBlock === null) {
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
if (!result.blockhash) {
|
|
944
|
+
result = {
|
|
945
|
+
...result,
|
|
946
|
+
...loadedBlock
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
if (!result.signatures && loadedBlock.signatures) {
|
|
950
|
+
result = {
|
|
951
|
+
...result,
|
|
952
|
+
// @ts-expect-error FIX ME: https://github.com/solana-labs/solana-web3.js/pull/2052
|
|
953
|
+
signatures: loadedBlock.signatures
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
if (!result.transactionResults && loadedBlock.transactions) {
|
|
957
|
+
result.transactionResults = Array.from({ length: loadedBlock.transactions.length }, (_, i2) => ({
|
|
958
|
+
[i2]: { encodedData: {} }
|
|
959
|
+
}));
|
|
960
|
+
}
|
|
961
|
+
const { transactions } = loadedBlock;
|
|
962
|
+
const { encoding } = argsSet[i];
|
|
963
|
+
if (encoding) {
|
|
964
|
+
transactions.forEach((loadedTransaction, j) => {
|
|
965
|
+
const { transaction: data } = loadedTransaction;
|
|
966
|
+
if (result.transactionResults) {
|
|
967
|
+
const thisTransactionResult = result.transactionResults[j] ||= {
|
|
968
|
+
encodedData: {}
|
|
969
|
+
};
|
|
970
|
+
if (Array.isArray(data)) {
|
|
971
|
+
const thisEncodedData = thisTransactionResult.encodedData ||= {};
|
|
972
|
+
thisEncodedData[cacheKeyFn({
|
|
973
|
+
encoding
|
|
974
|
+
})] = data[0];
|
|
975
|
+
} else if (typeof data === "object") {
|
|
976
|
+
const jsonParsedData = data;
|
|
977
|
+
jsonParsedData.message.instructions = mapJsonParsedInstructions(
|
|
978
|
+
jsonParsedData.message.instructions
|
|
979
|
+
);
|
|
980
|
+
const loadedInnerInstructions = loadedTransaction.meta?.innerInstructions;
|
|
981
|
+
if (loadedInnerInstructions) {
|
|
982
|
+
const innerInstructions = mapJsonParsedInnerInstructions(loadedInnerInstructions);
|
|
983
|
+
const jsonParsedMeta = {
|
|
984
|
+
...loadedTransaction.meta,
|
|
985
|
+
innerInstructions
|
|
986
|
+
};
|
|
987
|
+
result.transactionResults[j] = {
|
|
988
|
+
...thisTransactionResult,
|
|
989
|
+
...jsonParsedData,
|
|
990
|
+
meta: jsonParsedMeta
|
|
991
|
+
};
|
|
992
|
+
} else {
|
|
993
|
+
result.transactionResults[j] = {
|
|
994
|
+
...thisTransactionResult,
|
|
995
|
+
...jsonParsedData
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
return result;
|
|
729
1004
|
}
|
|
730
|
-
|
|
731
|
-
return transformLoadedBlock({ block, encoding, transactionDetails });
|
|
1005
|
+
return null;
|
|
732
1006
|
};
|
|
733
1007
|
};
|
|
734
1008
|
var blockResolvers = {
|
|
735
1009
|
Block: {
|
|
736
|
-
|
|
737
|
-
switch (block.transactionDetails) {
|
|
738
|
-
case "accounts":
|
|
739
|
-
return "BlockWithAccounts";
|
|
740
|
-
case "none":
|
|
741
|
-
return "BlockWithNone";
|
|
742
|
-
case "signatures":
|
|
743
|
-
return "BlockWithSignatures";
|
|
744
|
-
default:
|
|
745
|
-
return "BlockWithFull";
|
|
746
|
-
}
|
|
747
|
-
}
|
|
1010
|
+
transactions: (parent) => parent?.transactionResults ? Object.values(parent.transactionResults) : null
|
|
748
1011
|
}
|
|
749
1012
|
};
|
|
750
1013
|
|
|
@@ -752,7 +1015,8 @@ var blockResolvers = {
|
|
|
752
1015
|
var instructionResolvers = {
|
|
753
1016
|
AdvanceNonceAccountInstruction: {
|
|
754
1017
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
755
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1018
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1019
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar")
|
|
756
1020
|
},
|
|
757
1021
|
AllocateInstruction: {
|
|
758
1022
|
account: resolveAccount("account")
|
|
@@ -789,9 +1053,11 @@ var instructionResolvers = {
|
|
|
789
1053
|
BpfUpgradeableLoaderDeployWithMaxDataLenInstruction: {
|
|
790
1054
|
authority: resolveAccount("authority"),
|
|
791
1055
|
bufferAccount: resolveAccount("bufferAccount"),
|
|
1056
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
792
1057
|
payerAccount: resolveAccount("payerAccount"),
|
|
793
1058
|
programAccount: resolveAccount("programAccount"),
|
|
794
|
-
programDataAccount: resolveAccount("programDataAccount")
|
|
1059
|
+
programDataAccount: resolveAccount("programDataAccount"),
|
|
1060
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
795
1061
|
},
|
|
796
1062
|
BpfUpgradeableLoaderExtendProgramInstruction: {
|
|
797
1063
|
payerAccount: resolveAccount("payerAccount"),
|
|
@@ -815,8 +1081,10 @@ var instructionResolvers = {
|
|
|
815
1081
|
BpfUpgradeableLoaderUpgradeInstruction: {
|
|
816
1082
|
authority: resolveAccount("authority"),
|
|
817
1083
|
bufferAccount: resolveAccount("bufferAccount"),
|
|
1084
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
818
1085
|
programAccount: resolveAccount("programAccount"),
|
|
819
|
-
programDataAccount: resolveAccount("programDataAccount")
|
|
1086
|
+
programDataAccount: resolveAccount("programDataAccount"),
|
|
1087
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
820
1088
|
},
|
|
821
1089
|
BpfUpgradeableLoaderWriteInstruction: {
|
|
822
1090
|
account: resolveAccount("account"),
|
|
@@ -859,7 +1127,9 @@ var instructionResolvers = {
|
|
|
859
1127
|
},
|
|
860
1128
|
InitializeNonceAccountInstruction: {
|
|
861
1129
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
862
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1130
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1131
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar"),
|
|
1132
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
863
1133
|
},
|
|
864
1134
|
Lockup: {
|
|
865
1135
|
custodian: resolveAccount("custodian")
|
|
@@ -935,7 +1205,8 @@ var instructionResolvers = {
|
|
|
935
1205
|
SplTokenInitializeAccount2Instruction: {
|
|
936
1206
|
account: resolveAccount("account"),
|
|
937
1207
|
mint: resolveAccount("mint"),
|
|
938
|
-
owner: resolveAccount("owner")
|
|
1208
|
+
owner: resolveAccount("owner"),
|
|
1209
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
939
1210
|
},
|
|
940
1211
|
SplTokenInitializeAccount3Instruction: {
|
|
941
1212
|
account: resolveAccount("account"),
|
|
@@ -945,7 +1216,8 @@ var instructionResolvers = {
|
|
|
945
1216
|
SplTokenInitializeAccountInstruction: {
|
|
946
1217
|
account: resolveAccount("account"),
|
|
947
1218
|
mint: resolveAccount("mint"),
|
|
948
|
-
owner: resolveAccount("owner")
|
|
1219
|
+
owner: resolveAccount("owner"),
|
|
1220
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
949
1221
|
},
|
|
950
1222
|
SplTokenInitializeMint2Instruction: {
|
|
951
1223
|
freezeAuthority: resolveAccount("freezeAuthority"),
|
|
@@ -959,13 +1231,15 @@ var instructionResolvers = {
|
|
|
959
1231
|
SplTokenInitializeMintInstruction: {
|
|
960
1232
|
freezeAuthority: resolveAccount("freezeAuthority"),
|
|
961
1233
|
mint: resolveAccount("mint"),
|
|
962
|
-
mintAuthority: resolveAccount("mintAuthority")
|
|
1234
|
+
mintAuthority: resolveAccount("mintAuthority"),
|
|
1235
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
963
1236
|
},
|
|
964
1237
|
SplTokenInitializeMultisig2Instruction: {
|
|
965
1238
|
multisig: resolveAccount("multisig")
|
|
966
1239
|
},
|
|
967
1240
|
SplTokenInitializeMultisigInstruction: {
|
|
968
|
-
multisig: resolveAccount("multisig")
|
|
1241
|
+
multisig: resolveAccount("multisig"),
|
|
1242
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
969
1243
|
},
|
|
970
1244
|
SplTokenMintToCheckedInstruction: {
|
|
971
1245
|
account: resolveAccount("account"),
|
|
@@ -1018,6 +1292,7 @@ var instructionResolvers = {
|
|
|
1018
1292
|
},
|
|
1019
1293
|
StakeAuthorizeCheckedInstruction: {
|
|
1020
1294
|
authority: resolveAccount("authority"),
|
|
1295
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1021
1296
|
custodian: resolveAccount("custodian"),
|
|
1022
1297
|
newAuthority: resolveAccount("newAuthority"),
|
|
1023
1298
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1025,12 +1300,14 @@ var instructionResolvers = {
|
|
|
1025
1300
|
StakeAuthorizeCheckedWithSeedInstruction: {
|
|
1026
1301
|
authorityBase: resolveAccount("authorityBase"),
|
|
1027
1302
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1303
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1028
1304
|
custodian: resolveAccount("custodian"),
|
|
1029
1305
|
newAuthorized: resolveAccount("newAuthorized"),
|
|
1030
1306
|
stakeAccount: resolveAccount("stakeAccount")
|
|
1031
1307
|
},
|
|
1032
1308
|
StakeAuthorizeInstruction: {
|
|
1033
1309
|
authority: resolveAccount("authority"),
|
|
1310
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1034
1311
|
custodian: resolveAccount("custodian"),
|
|
1035
1312
|
newAuthority: resolveAccount("newAuthority"),
|
|
1036
1313
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1038,6 +1315,7 @@ var instructionResolvers = {
|
|
|
1038
1315
|
StakeAuthorizeWithSeedInstruction: {
|
|
1039
1316
|
authorityBase: resolveAccount("authorityBase"),
|
|
1040
1317
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1318
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1041
1319
|
custodian: resolveAccount("custodian"),
|
|
1042
1320
|
newAuthorized: resolveAccount("newAuthorized"),
|
|
1043
1321
|
stakeAccount: resolveAccount("stakeAccount")
|
|
@@ -1048,20 +1326,28 @@ var instructionResolvers = {
|
|
|
1048
1326
|
voteAccount: resolveAccount("voteAccount")
|
|
1049
1327
|
},
|
|
1050
1328
|
StakeDeactivateInstruction: {
|
|
1329
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1051
1330
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1052
1331
|
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1053
1332
|
},
|
|
1054
1333
|
StakeDelegateStakeInstruction: {
|
|
1334
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1055
1335
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1056
1336
|
stakeAuthority: resolveAccount("stakeAuthority"),
|
|
1057
1337
|
stakeConfigAccount: resolveAccount("stakeConfigAccount"),
|
|
1338
|
+
stakeHistorySysvar: resolveAccount("stakeHistorySysvar"),
|
|
1058
1339
|
voteAccount: resolveAccount("voteAccount")
|
|
1059
1340
|
},
|
|
1341
|
+
StakeInitializeCheckedInstruction: {
|
|
1342
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1343
|
+
stakeAccount: resolveAccount("stakeAccount")
|
|
1344
|
+
},
|
|
1060
1345
|
StakeInitializeCheckedInstructionDataAuthorized: {
|
|
1061
1346
|
staker: resolveAccount("staker"),
|
|
1062
1347
|
withdrawer: resolveAccount("withdrawer")
|
|
1063
1348
|
},
|
|
1064
1349
|
StakeInitializeInstruction: {
|
|
1350
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1065
1351
|
stakeAccount: resolveAccount("stakeAccount")
|
|
1066
1352
|
},
|
|
1067
1353
|
StakeInitializeInstructionDataAuthorized: {
|
|
@@ -1069,9 +1355,11 @@ var instructionResolvers = {
|
|
|
1069
1355
|
withdrawer: resolveAccount("withdrawer")
|
|
1070
1356
|
},
|
|
1071
1357
|
StakeMergeInstruction: {
|
|
1358
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1072
1359
|
destination: resolveAccount("destination"),
|
|
1073
1360
|
source: resolveAccount("source"),
|
|
1074
|
-
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1361
|
+
stakeAuthority: resolveAccount("stakeAuthority"),
|
|
1362
|
+
stakeHistorySysvar: resolveAccount("stakeHistorySysvar")
|
|
1075
1363
|
},
|
|
1076
1364
|
StakeRedelegateInstruction: {
|
|
1077
1365
|
newStakeAccount: resolveAccount("newStakeAccount"),
|
|
@@ -1094,287 +1382,289 @@ var instructionResolvers = {
|
|
|
1094
1382
|
stakeAuthority: resolveAccount("stakeAuthority")
|
|
1095
1383
|
},
|
|
1096
1384
|
StakeWithdrawInstruction: {
|
|
1385
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1097
1386
|
destination: resolveAccount("destination"),
|
|
1098
1387
|
stakeAccount: resolveAccount("stakeAccount"),
|
|
1099
1388
|
withdrawAuthority: resolveAccount("withdrawAuthority")
|
|
1100
1389
|
},
|
|
1101
1390
|
TransactionInstruction: {
|
|
1102
|
-
__resolveType(
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1391
|
+
__resolveType(instructionResult) {
|
|
1392
|
+
const { jsonParsedConfigs } = instructionResult;
|
|
1393
|
+
if (jsonParsedConfigs) {
|
|
1394
|
+
if (jsonParsedConfigs.programName === "address-lookup-table") {
|
|
1395
|
+
if (jsonParsedConfigs.instructionType === "createLookupTable") {
|
|
1106
1396
|
return "CreateLookupTableInstruction";
|
|
1107
1397
|
}
|
|
1108
|
-
if (
|
|
1398
|
+
if (jsonParsedConfigs.instructionType === "freezeLookupTable") {
|
|
1109
1399
|
return "FreezeLookupTableInstruction";
|
|
1110
1400
|
}
|
|
1111
|
-
if (
|
|
1401
|
+
if (jsonParsedConfigs.instructionType === "extendLookupTable") {
|
|
1112
1402
|
return "ExtendLookupTableInstruction";
|
|
1113
1403
|
}
|
|
1114
|
-
if (
|
|
1404
|
+
if (jsonParsedConfigs.instructionType === "deactivateLookupTable") {
|
|
1115
1405
|
return "DeactivateLookupTableInstruction";
|
|
1116
1406
|
}
|
|
1117
|
-
if (
|
|
1407
|
+
if (jsonParsedConfigs.instructionType === "closeLookupTable") {
|
|
1118
1408
|
return "CloseLookupTableInstruction";
|
|
1119
1409
|
}
|
|
1120
1410
|
}
|
|
1121
|
-
if (
|
|
1122
|
-
if (
|
|
1411
|
+
if (jsonParsedConfigs.programName === "bpf-loader") {
|
|
1412
|
+
if (jsonParsedConfigs.instructionType === "write") {
|
|
1123
1413
|
return "BpfLoaderWriteInstruction";
|
|
1124
1414
|
}
|
|
1125
|
-
if (
|
|
1415
|
+
if (jsonParsedConfigs.instructionType === "finalize") {
|
|
1126
1416
|
return "BpfLoaderFinalizeInstruction";
|
|
1127
1417
|
}
|
|
1128
1418
|
}
|
|
1129
|
-
if (
|
|
1130
|
-
if (
|
|
1419
|
+
if (jsonParsedConfigs.programName === "bpf-upgradeable-loader") {
|
|
1420
|
+
if (jsonParsedConfigs.instructionType === "initializeBuffer") {
|
|
1131
1421
|
return "BpfUpgradeableLoaderInitializeBufferInstruction";
|
|
1132
1422
|
}
|
|
1133
|
-
if (
|
|
1423
|
+
if (jsonParsedConfigs.instructionType === "write") {
|
|
1134
1424
|
return "BpfUpgradeableLoaderWriteInstruction";
|
|
1135
1425
|
}
|
|
1136
|
-
if (
|
|
1426
|
+
if (jsonParsedConfigs.instructionType === "deployWithMaxDataLen") {
|
|
1137
1427
|
return "BpfUpgradeableLoaderDeployWithMaxDataLenInstruction";
|
|
1138
1428
|
}
|
|
1139
|
-
if (
|
|
1429
|
+
if (jsonParsedConfigs.instructionType === "upgrade") {
|
|
1140
1430
|
return "BpfUpgradeableLoaderUpgradeInstruction";
|
|
1141
1431
|
}
|
|
1142
|
-
if (
|
|
1432
|
+
if (jsonParsedConfigs.instructionType === "setAuthority") {
|
|
1143
1433
|
return "BpfUpgradeableLoaderSetAuthorityInstruction";
|
|
1144
1434
|
}
|
|
1145
|
-
if (
|
|
1435
|
+
if (jsonParsedConfigs.instructionType === "setAuthorityChecked") {
|
|
1146
1436
|
return "BpfUpgradeableLoaderSetAuthorityCheckedInstruction";
|
|
1147
1437
|
}
|
|
1148
|
-
if (
|
|
1438
|
+
if (jsonParsedConfigs.instructionType === "close") {
|
|
1149
1439
|
return "BpfUpgradeableLoaderCloseInstruction";
|
|
1150
1440
|
}
|
|
1151
|
-
if (
|
|
1441
|
+
if (jsonParsedConfigs.instructionType === "extendProgram") {
|
|
1152
1442
|
return "BpfUpgradeableLoaderExtendProgramInstruction";
|
|
1153
1443
|
}
|
|
1154
1444
|
}
|
|
1155
|
-
if (
|
|
1156
|
-
if (
|
|
1445
|
+
if (jsonParsedConfigs.programName === "spl-associated-token-account") {
|
|
1446
|
+
if (jsonParsedConfigs.instructionType === "create") {
|
|
1157
1447
|
return "SplAssociatedTokenCreateInstruction";
|
|
1158
1448
|
}
|
|
1159
|
-
if (
|
|
1449
|
+
if (jsonParsedConfigs.instructionType === "createIdempotent") {
|
|
1160
1450
|
return "SplAssociatedTokenCreateIdempotentInstruction";
|
|
1161
1451
|
}
|
|
1162
|
-
if (
|
|
1452
|
+
if (jsonParsedConfigs.instructionType === "recoverNested") {
|
|
1163
1453
|
return "SplAssociatedTokenRecoverNestedInstruction";
|
|
1164
1454
|
}
|
|
1165
1455
|
}
|
|
1166
|
-
if (
|
|
1456
|
+
if (jsonParsedConfigs.programName === "spl-memo") {
|
|
1167
1457
|
return "SplMemoInstruction";
|
|
1168
1458
|
}
|
|
1169
|
-
if (
|
|
1170
|
-
if (
|
|
1459
|
+
if (jsonParsedConfigs.programName === "spl-token") {
|
|
1460
|
+
if (jsonParsedConfigs.instructionType === "initializeMint") {
|
|
1171
1461
|
return "SplTokenInitializeMintInstruction";
|
|
1172
1462
|
}
|
|
1173
|
-
if (
|
|
1463
|
+
if (jsonParsedConfigs.instructionType === "initializeMint2") {
|
|
1174
1464
|
return "SplTokenInitializeMint2Instruction";
|
|
1175
1465
|
}
|
|
1176
|
-
if (
|
|
1466
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount") {
|
|
1177
1467
|
return "SplTokenInitializeAccountInstruction";
|
|
1178
1468
|
}
|
|
1179
|
-
if (
|
|
1469
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount2") {
|
|
1180
1470
|
return "SplTokenInitializeAccount2Instruction";
|
|
1181
1471
|
}
|
|
1182
|
-
if (
|
|
1472
|
+
if (jsonParsedConfigs.instructionType === "initializeAccount3") {
|
|
1183
1473
|
return "SplTokenInitializeAccount3Instruction";
|
|
1184
1474
|
}
|
|
1185
|
-
if (
|
|
1475
|
+
if (jsonParsedConfigs.instructionType === "initializeMultisig") {
|
|
1186
1476
|
return "SplTokenInitializeMultisigInstruction";
|
|
1187
1477
|
}
|
|
1188
|
-
if (
|
|
1478
|
+
if (jsonParsedConfigs.instructionType === "initializeMultisig2") {
|
|
1189
1479
|
return "SplTokenInitializeMultisig2Instruction";
|
|
1190
1480
|
}
|
|
1191
|
-
if (
|
|
1481
|
+
if (jsonParsedConfigs.instructionType === "transfer") {
|
|
1192
1482
|
return "SplTokenTransferInstruction";
|
|
1193
1483
|
}
|
|
1194
|
-
if (
|
|
1484
|
+
if (jsonParsedConfigs.instructionType === "approve") {
|
|
1195
1485
|
return "SplTokenApproveInstruction";
|
|
1196
1486
|
}
|
|
1197
|
-
if (
|
|
1487
|
+
if (jsonParsedConfigs.instructionType === "revoke") {
|
|
1198
1488
|
return "SplTokenRevokeInstruction";
|
|
1199
1489
|
}
|
|
1200
|
-
if (
|
|
1490
|
+
if (jsonParsedConfigs.instructionType === "setAuthority") {
|
|
1201
1491
|
return "SplTokenSetAuthorityInstruction";
|
|
1202
1492
|
}
|
|
1203
|
-
if (
|
|
1493
|
+
if (jsonParsedConfigs.instructionType === "mintTo") {
|
|
1204
1494
|
return "SplTokenMintToInstruction";
|
|
1205
1495
|
}
|
|
1206
|
-
if (
|
|
1496
|
+
if (jsonParsedConfigs.instructionType === "burn") {
|
|
1207
1497
|
return "SplTokenBurnInstruction";
|
|
1208
1498
|
}
|
|
1209
|
-
if (
|
|
1499
|
+
if (jsonParsedConfigs.instructionType === "closeAccount") {
|
|
1210
1500
|
return "SplTokenCloseAccountInstruction";
|
|
1211
1501
|
}
|
|
1212
|
-
if (
|
|
1502
|
+
if (jsonParsedConfigs.instructionType === "freezeAccount") {
|
|
1213
1503
|
return "SplTokenFreezeAccountInstruction";
|
|
1214
1504
|
}
|
|
1215
|
-
if (
|
|
1505
|
+
if (jsonParsedConfigs.instructionType === "thawAccount") {
|
|
1216
1506
|
return "SplTokenThawAccountInstruction";
|
|
1217
1507
|
}
|
|
1218
|
-
if (
|
|
1508
|
+
if (jsonParsedConfigs.instructionType === "transferChecked") {
|
|
1219
1509
|
return "SplTokenTransferCheckedInstruction";
|
|
1220
1510
|
}
|
|
1221
|
-
if (
|
|
1511
|
+
if (jsonParsedConfigs.instructionType === "approveChecked") {
|
|
1222
1512
|
return "SplTokenApproveCheckedInstruction";
|
|
1223
1513
|
}
|
|
1224
|
-
if (
|
|
1514
|
+
if (jsonParsedConfigs.instructionType === "mintToChecked") {
|
|
1225
1515
|
return "SplTokenMintToCheckedInstruction";
|
|
1226
1516
|
}
|
|
1227
|
-
if (
|
|
1517
|
+
if (jsonParsedConfigs.instructionType === "burnChecked") {
|
|
1228
1518
|
return "SplTokenBurnCheckedInstruction";
|
|
1229
1519
|
}
|
|
1230
|
-
if (
|
|
1520
|
+
if (jsonParsedConfigs.instructionType === "syncNative") {
|
|
1231
1521
|
return "SplTokenSyncNativeInstruction";
|
|
1232
1522
|
}
|
|
1233
|
-
if (
|
|
1523
|
+
if (jsonParsedConfigs.instructionType === "getAccountDataSize") {
|
|
1234
1524
|
return "SplTokenGetAccountDataSizeInstruction";
|
|
1235
1525
|
}
|
|
1236
|
-
if (
|
|
1526
|
+
if (jsonParsedConfigs.instructionType === "initializeImmutableOwner") {
|
|
1237
1527
|
return "SplTokenInitializeImmutableOwnerInstruction";
|
|
1238
1528
|
}
|
|
1239
|
-
if (
|
|
1529
|
+
if (jsonParsedConfigs.instructionType === "amountToUiAmount") {
|
|
1240
1530
|
return "SplTokenAmountToUiAmountInstruction";
|
|
1241
1531
|
}
|
|
1242
|
-
if (
|
|
1532
|
+
if (jsonParsedConfigs.instructionType === "uiAmountToAmount") {
|
|
1243
1533
|
return "SplTokenUiAmountToAmountInstruction";
|
|
1244
1534
|
}
|
|
1245
|
-
if (
|
|
1535
|
+
if (jsonParsedConfigs.instructionType === "initializeMintCloseAuthority") {
|
|
1246
1536
|
return "SplTokenInitializeMintCloseAuthorityInstruction";
|
|
1247
1537
|
}
|
|
1248
1538
|
}
|
|
1249
|
-
if (
|
|
1250
|
-
if (
|
|
1539
|
+
if (jsonParsedConfigs.programName === "stake") {
|
|
1540
|
+
if (jsonParsedConfigs.instructionType === "initialize") {
|
|
1251
1541
|
return "StakeInitializeInstruction";
|
|
1252
1542
|
}
|
|
1253
|
-
if (
|
|
1543
|
+
if (jsonParsedConfigs.instructionType === "authorize") {
|
|
1254
1544
|
return "StakeAuthorizeInstruction";
|
|
1255
1545
|
}
|
|
1256
|
-
if (
|
|
1546
|
+
if (jsonParsedConfigs.instructionType === "delegate") {
|
|
1257
1547
|
return "StakeDelegateStakeInstruction";
|
|
1258
1548
|
}
|
|
1259
|
-
if (
|
|
1549
|
+
if (jsonParsedConfigs.instructionType === "split") {
|
|
1260
1550
|
return "StakeSplitInstruction";
|
|
1261
1551
|
}
|
|
1262
|
-
if (
|
|
1552
|
+
if (jsonParsedConfigs.instructionType === "withdraw") {
|
|
1263
1553
|
return "StakeWithdrawInstruction";
|
|
1264
1554
|
}
|
|
1265
|
-
if (
|
|
1555
|
+
if (jsonParsedConfigs.instructionType === "deactivate") {
|
|
1266
1556
|
return "StakeDeactivateInstruction";
|
|
1267
1557
|
}
|
|
1268
|
-
if (
|
|
1558
|
+
if (jsonParsedConfigs.instructionType === "setLockup") {
|
|
1269
1559
|
return "StakeSetLockupInstruction";
|
|
1270
1560
|
}
|
|
1271
|
-
if (
|
|
1561
|
+
if (jsonParsedConfigs.instructionType === "merge") {
|
|
1272
1562
|
return "StakeMergeInstruction";
|
|
1273
1563
|
}
|
|
1274
|
-
if (
|
|
1564
|
+
if (jsonParsedConfigs.instructionType === "authorizeWithSeed") {
|
|
1275
1565
|
return "StakeAuthorizeWithSeedInstruction";
|
|
1276
1566
|
}
|
|
1277
|
-
if (
|
|
1567
|
+
if (jsonParsedConfigs.instructionType === "initializeChecked") {
|
|
1278
1568
|
return "StakeInitializeCheckedInstruction";
|
|
1279
1569
|
}
|
|
1280
|
-
if (
|
|
1570
|
+
if (jsonParsedConfigs.instructionType === "authorizeChecked") {
|
|
1281
1571
|
return "StakeAuthorizeCheckedInstruction";
|
|
1282
1572
|
}
|
|
1283
|
-
if (
|
|
1573
|
+
if (jsonParsedConfigs.instructionType === "authorizeCheckedWithSeed") {
|
|
1284
1574
|
return "StakeAuthorizeCheckedWithSeedInstruction";
|
|
1285
1575
|
}
|
|
1286
|
-
if (
|
|
1576
|
+
if (jsonParsedConfigs.instructionType === "setLockupChecked") {
|
|
1287
1577
|
return "StakeSetLockupCheckedInstruction";
|
|
1288
1578
|
}
|
|
1289
|
-
if (
|
|
1579
|
+
if (jsonParsedConfigs.instructionType === "deactivateDelinquent") {
|
|
1290
1580
|
return "StakeDeactivateDelinquentInstruction";
|
|
1291
1581
|
}
|
|
1292
|
-
if (
|
|
1582
|
+
if (jsonParsedConfigs.instructionType === "redelegate") {
|
|
1293
1583
|
return "StakeRedelegateInstruction";
|
|
1294
1584
|
}
|
|
1295
1585
|
}
|
|
1296
|
-
if (
|
|
1297
|
-
if (
|
|
1586
|
+
if (jsonParsedConfigs.programName === "system") {
|
|
1587
|
+
if (jsonParsedConfigs.instructionType === "createAccount") {
|
|
1298
1588
|
return "CreateAccountInstruction";
|
|
1299
1589
|
}
|
|
1300
|
-
if (
|
|
1590
|
+
if (jsonParsedConfigs.instructionType === "assign") {
|
|
1301
1591
|
return "AssignInstruction";
|
|
1302
1592
|
}
|
|
1303
|
-
if (
|
|
1593
|
+
if (jsonParsedConfigs.instructionType === "transfer") {
|
|
1304
1594
|
return "TransferInstruction";
|
|
1305
1595
|
}
|
|
1306
|
-
if (
|
|
1596
|
+
if (jsonParsedConfigs.instructionType === "createAccountWithSeed") {
|
|
1307
1597
|
return "CreateAccountWithSeedInstruction";
|
|
1308
1598
|
}
|
|
1309
|
-
if (
|
|
1599
|
+
if (jsonParsedConfigs.instructionType === "advanceNonceAccount") {
|
|
1310
1600
|
return "AdvanceNonceAccountInstruction";
|
|
1311
1601
|
}
|
|
1312
|
-
if (
|
|
1602
|
+
if (jsonParsedConfigs.instructionType === "withdrawNonceAccount") {
|
|
1313
1603
|
return "WithdrawNonceAccountInstruction";
|
|
1314
1604
|
}
|
|
1315
|
-
if (
|
|
1605
|
+
if (jsonParsedConfigs.instructionType === "initializeNonceAccount") {
|
|
1316
1606
|
return "InitializeNonceAccountInstruction";
|
|
1317
1607
|
}
|
|
1318
|
-
if (
|
|
1608
|
+
if (jsonParsedConfigs.instructionType === "authorizeNonceAccount") {
|
|
1319
1609
|
return "AuthorizeNonceAccountInstruction";
|
|
1320
1610
|
}
|
|
1321
|
-
if (
|
|
1611
|
+
if (jsonParsedConfigs.instructionType === "upgradeNonceAccount") {
|
|
1322
1612
|
return "UpgradeNonceAccountInstruction";
|
|
1323
1613
|
}
|
|
1324
|
-
if (
|
|
1614
|
+
if (jsonParsedConfigs.instructionType === "allocate") {
|
|
1325
1615
|
return "AllocateInstruction";
|
|
1326
1616
|
}
|
|
1327
|
-
if (
|
|
1617
|
+
if (jsonParsedConfigs.instructionType === "allocateWithSeed") {
|
|
1328
1618
|
return "AllocateWithSeedInstruction";
|
|
1329
1619
|
}
|
|
1330
|
-
if (
|
|
1620
|
+
if (jsonParsedConfigs.instructionType === "assignWithSeed") {
|
|
1331
1621
|
return "AssignWithSeedInstruction";
|
|
1332
1622
|
}
|
|
1333
|
-
if (
|
|
1623
|
+
if (jsonParsedConfigs.instructionType === "transferWithSeed") {
|
|
1334
1624
|
return "TransferWithSeedInstruction";
|
|
1335
1625
|
}
|
|
1336
1626
|
}
|
|
1337
|
-
if (
|
|
1338
|
-
if (
|
|
1627
|
+
if (jsonParsedConfigs.programName === "vote") {
|
|
1628
|
+
if (jsonParsedConfigs.instructionType === "initialize") {
|
|
1339
1629
|
return "VoteInitializeAccountInstruction";
|
|
1340
1630
|
}
|
|
1341
|
-
if (
|
|
1631
|
+
if (jsonParsedConfigs.instructionType === "authorize") {
|
|
1342
1632
|
return "VoteAuthorizeInstruction";
|
|
1343
1633
|
}
|
|
1344
|
-
if (
|
|
1634
|
+
if (jsonParsedConfigs.instructionType === "authorizeWithSeed") {
|
|
1345
1635
|
return "VoteAuthorizeWithSeedInstruction";
|
|
1346
1636
|
}
|
|
1347
|
-
if (
|
|
1637
|
+
if (jsonParsedConfigs.instructionType === "authorizeCheckedWithSeed") {
|
|
1348
1638
|
return "VoteAuthorizeCheckedWithSeedInstruction";
|
|
1349
1639
|
}
|
|
1350
|
-
if (
|
|
1640
|
+
if (jsonParsedConfigs.instructionType === "vote") {
|
|
1351
1641
|
return "VoteVoteInstruction";
|
|
1352
1642
|
}
|
|
1353
|
-
if (
|
|
1643
|
+
if (jsonParsedConfigs.instructionType === "updatevotestate") {
|
|
1354
1644
|
return "VoteUpdateVoteStateInstruction";
|
|
1355
1645
|
}
|
|
1356
|
-
if (
|
|
1646
|
+
if (jsonParsedConfigs.instructionType === "updatevotestateswitch") {
|
|
1357
1647
|
return "VoteUpdateVoteStateSwitchInstruction";
|
|
1358
1648
|
}
|
|
1359
|
-
if (
|
|
1649
|
+
if (jsonParsedConfigs.instructionType === "compactupdatevotestate") {
|
|
1360
1650
|
return "VoteCompactUpdateVoteStateInstruction";
|
|
1361
1651
|
}
|
|
1362
|
-
if (
|
|
1652
|
+
if (jsonParsedConfigs.instructionType === "compactupdatevotestateswitch") {
|
|
1363
1653
|
return "VoteCompactUpdateVoteStateSwitchInstruction";
|
|
1364
1654
|
}
|
|
1365
|
-
if (
|
|
1655
|
+
if (jsonParsedConfigs.instructionType === "withdraw") {
|
|
1366
1656
|
return "VoteWithdrawInstruction";
|
|
1367
1657
|
}
|
|
1368
|
-
if (
|
|
1658
|
+
if (jsonParsedConfigs.instructionType === "updateValidatorIdentity") {
|
|
1369
1659
|
return "VoteUpdateValidatorIdentityInstruction";
|
|
1370
1660
|
}
|
|
1371
|
-
if (
|
|
1661
|
+
if (jsonParsedConfigs.instructionType === "updateCommission") {
|
|
1372
1662
|
return "VoteUpdateCommissionInstruction";
|
|
1373
1663
|
}
|
|
1374
|
-
if (
|
|
1664
|
+
if (jsonParsedConfigs.instructionType === "voteSwitch") {
|
|
1375
1665
|
return "VoteVoteSwitchInstruction";
|
|
1376
1666
|
}
|
|
1377
|
-
if (
|
|
1667
|
+
if (jsonParsedConfigs.instructionType === "authorizeChecked") {
|
|
1378
1668
|
return "VoteAuthorizeCheckedInstruction";
|
|
1379
1669
|
}
|
|
1380
1670
|
}
|
|
@@ -1397,21 +1687,25 @@ var instructionResolvers = {
|
|
|
1397
1687
|
},
|
|
1398
1688
|
VoteAuthorizeCheckedInstruction: {
|
|
1399
1689
|
authority: resolveAccount("authority"),
|
|
1690
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1400
1691
|
newAuthority: resolveAccount("newAuthority"),
|
|
1401
1692
|
voteAccount: resolveAccount("voteAccount")
|
|
1402
1693
|
},
|
|
1403
1694
|
VoteAuthorizeCheckedWithSeedInstruction: {
|
|
1404
1695
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1696
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1405
1697
|
newAuthority: resolveAccount("newAuthority"),
|
|
1406
1698
|
voteAccount: resolveAccount("voteAccount")
|
|
1407
1699
|
},
|
|
1408
1700
|
VoteAuthorizeInstruction: {
|
|
1409
1701
|
authority: resolveAccount("authority"),
|
|
1702
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1410
1703
|
newAuthority: resolveAccount("newAuthority"),
|
|
1411
1704
|
voteAccount: resolveAccount("voteAccount")
|
|
1412
1705
|
},
|
|
1413
1706
|
VoteAuthorizeWithSeedInstruction: {
|
|
1414
1707
|
authorityOwner: resolveAccount("authorityOwner"),
|
|
1708
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1415
1709
|
newAuthority: resolveAccount("newAuthority"),
|
|
1416
1710
|
voteAccount: resolveAccount("voteAccount")
|
|
1417
1711
|
},
|
|
@@ -1426,7 +1720,9 @@ var instructionResolvers = {
|
|
|
1426
1720
|
VoteInitializeAccountInstruction: {
|
|
1427
1721
|
authorizedVoter: resolveAccount("authorizedVoter"),
|
|
1428
1722
|
authorizedWithdrawer: resolveAccount("authorizedWithdrawer"),
|
|
1723
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1429
1724
|
node: resolveAccount("node"),
|
|
1725
|
+
rentSysvar: resolveAccount("rentSysvar"),
|
|
1430
1726
|
voteAccount: resolveAccount("voteAccount")
|
|
1431
1727
|
},
|
|
1432
1728
|
VoteUpdateCommissionInstruction: {
|
|
@@ -1447,10 +1743,14 @@ var instructionResolvers = {
|
|
|
1447
1743
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1448
1744
|
},
|
|
1449
1745
|
VoteVoteInstruction: {
|
|
1746
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1747
|
+
slotHashesSysvar: resolveAccount("slotHashesSysvar"),
|
|
1450
1748
|
voteAccount: resolveAccount("voteAccount"),
|
|
1451
1749
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1452
1750
|
},
|
|
1453
1751
|
VoteVoteSwitchInstruction: {
|
|
1752
|
+
clockSysvar: resolveAccount("clockSysvar"),
|
|
1753
|
+
slotHashesSysvar: resolveAccount("slotHashesSysvar"),
|
|
1454
1754
|
voteAccount: resolveAccount("voteAccount"),
|
|
1455
1755
|
voteAuthority: resolveAccount("voteAuthority")
|
|
1456
1756
|
},
|
|
@@ -1461,7 +1761,9 @@ var instructionResolvers = {
|
|
|
1461
1761
|
WithdrawNonceAccountInstruction: {
|
|
1462
1762
|
destination: resolveAccount("destination"),
|
|
1463
1763
|
nonceAccount: resolveAccount("nonceAccount"),
|
|
1464
|
-
nonceAuthority: resolveAccount("nonceAuthority")
|
|
1764
|
+
nonceAuthority: resolveAccount("nonceAuthority"),
|
|
1765
|
+
recentBlockhashesSysvar: resolveAccount("recentBlockhashesSysvar"),
|
|
1766
|
+
rentSysvar: resolveAccount("rentSysvar")
|
|
1465
1767
|
}
|
|
1466
1768
|
};
|
|
1467
1769
|
|
|
@@ -1470,52 +1772,54 @@ function resolveProgramAccounts(fieldName) {
|
|
|
1470
1772
|
return async (parent, args, context, info) => {
|
|
1471
1773
|
const programAddress = fieldName ? parent[fieldName] : args.programAddress;
|
|
1472
1774
|
if (programAddress) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
const { account, pubkey: address } = programAccount;
|
|
1481
|
-
let result = {
|
|
1482
|
-
...account,
|
|
1483
|
-
address,
|
|
1484
|
-
encodedData: {},
|
|
1485
|
-
ownerProgram: account.owner
|
|
1486
|
-
};
|
|
1487
|
-
const { data } = account;
|
|
1488
|
-
const { encoding, dataSlice } = args;
|
|
1489
|
-
if (result.encodedData) {
|
|
1490
|
-
if (Array.isArray(data)) {
|
|
1491
|
-
result.encodedData[cacheKeyFn({
|
|
1492
|
-
dataSlice,
|
|
1493
|
-
encoding: encoding === "jsonParsed" ? "base64" : encoding ?? "base64"
|
|
1494
|
-
})] = data[0];
|
|
1495
|
-
} else if (typeof data === "string") {
|
|
1496
|
-
result.encodedData[cacheKeyFn({
|
|
1497
|
-
dataSlice,
|
|
1498
|
-
encoding: "base58"
|
|
1499
|
-
})] = data;
|
|
1500
|
-
} else if (typeof data === "object") {
|
|
1501
|
-
const {
|
|
1502
|
-
parsed: { info: parsedData, type: accountType },
|
|
1503
|
-
program: programName,
|
|
1504
|
-
programId
|
|
1505
|
-
} = data;
|
|
1506
|
-
result.jsonParsedConfigs = {
|
|
1507
|
-
accountType,
|
|
1508
|
-
programId,
|
|
1509
|
-
programName
|
|
1510
|
-
};
|
|
1511
|
-
result = {
|
|
1512
|
-
...result,
|
|
1513
|
-
...parsedData
|
|
1514
|
-
};
|
|
1515
|
-
}
|
|
1775
|
+
const argsSet = buildProgramAccountsLoaderArgSetFromResolveInfo({ ...args, programAddress }, info);
|
|
1776
|
+
const loadedProgramAccountsLists = await context.loaders.programAccounts.loadMany(argsSet);
|
|
1777
|
+
const result = {};
|
|
1778
|
+
loadedProgramAccountsLists.forEach((programAccounts, i) => {
|
|
1779
|
+
if (programAccounts instanceof Error) {
|
|
1780
|
+
console.error(programAccounts);
|
|
1781
|
+
return;
|
|
1516
1782
|
}
|
|
1517
|
-
|
|
1783
|
+
programAccounts.forEach((programAccount) => {
|
|
1784
|
+
const { account, pubkey: address } = programAccount;
|
|
1785
|
+
const thisResult = result[address] ||= {
|
|
1786
|
+
...account,
|
|
1787
|
+
address,
|
|
1788
|
+
encodedData: {},
|
|
1789
|
+
ownerProgram: account.owner
|
|
1790
|
+
};
|
|
1791
|
+
const { data } = account;
|
|
1792
|
+
const { encoding, dataSlice } = argsSet[i];
|
|
1793
|
+
if (encoding && thisResult.encodedData) {
|
|
1794
|
+
if (Array.isArray(data)) {
|
|
1795
|
+
thisResult.encodedData[cacheKeyFn({
|
|
1796
|
+
dataSlice,
|
|
1797
|
+
encoding: encoding === "jsonParsed" ? "base64" : encoding
|
|
1798
|
+
})] = data[0];
|
|
1799
|
+
} else if (typeof data === "string") {
|
|
1800
|
+
thisResult.encodedData[cacheKeyFn({
|
|
1801
|
+
dataSlice,
|
|
1802
|
+
encoding: "base58"
|
|
1803
|
+
})] = data;
|
|
1804
|
+
} else if (typeof data === "object") {
|
|
1805
|
+
const {
|
|
1806
|
+
parsed: { info: parsedData, type: accountType },
|
|
1807
|
+
program: programName,
|
|
1808
|
+
programId
|
|
1809
|
+
} = data;
|
|
1810
|
+
thisResult.jsonParsedConfigs = {
|
|
1811
|
+
accountType,
|
|
1812
|
+
programId,
|
|
1813
|
+
programName
|
|
1814
|
+
};
|
|
1815
|
+
for (const key in parsedData) {
|
|
1816
|
+
thisResult[key] = parsedData[key];
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1518
1821
|
});
|
|
1822
|
+
return Object.values(result);
|
|
1519
1823
|
}
|
|
1520
1824
|
return null;
|
|
1521
1825
|
};
|
|
@@ -1546,7 +1850,7 @@ var stringScalarAlias = {
|
|
|
1546
1850
|
};
|
|
1547
1851
|
var bigIntScalarAlias = {
|
|
1548
1852
|
__parseLiteral(ast) {
|
|
1549
|
-
if (ast.kind === Kind.STRING) {
|
|
1853
|
+
if (ast.kind === Kind.STRING || ast.kind === Kind.INT || ast.kind === Kind.FLOAT) {
|
|
1550
1854
|
return BigInt(ast.value);
|
|
1551
1855
|
}
|
|
1552
1856
|
return null;
|
|
@@ -1569,17 +1873,15 @@ var typeTypeResolvers = {
|
|
|
1569
1873
|
Base64EncodedBytes: stringScalarAlias,
|
|
1570
1874
|
Base64ZstdEncodedBytes: stringScalarAlias,
|
|
1571
1875
|
BigInt: bigIntScalarAlias,
|
|
1572
|
-
BlockTransactionDetails: {
|
|
1573
|
-
ACCOUNTS: "accounts",
|
|
1574
|
-
FULL: "full",
|
|
1575
|
-
NONE: "none",
|
|
1576
|
-
SIGNATURES: "signatures"
|
|
1577
|
-
},
|
|
1578
1876
|
Commitment: {
|
|
1579
1877
|
CONFIRMED: "confirmed",
|
|
1580
1878
|
FINALIZED: "finalized",
|
|
1581
1879
|
PROCESSED: "processed"
|
|
1582
1880
|
},
|
|
1881
|
+
CommitmentWithoutProcessed: {
|
|
1882
|
+
CONFIRMED: "confirmed",
|
|
1883
|
+
FINALIZED: "finalized"
|
|
1884
|
+
},
|
|
1583
1885
|
Signature: stringScalarAlias,
|
|
1584
1886
|
Slot: bigIntScalarAlias,
|
|
1585
1887
|
TokenBalance: {
|
|
@@ -1588,12 +1890,7 @@ var typeTypeResolvers = {
|
|
|
1588
1890
|
},
|
|
1589
1891
|
TransactionEncoding: {
|
|
1590
1892
|
BASE_58: "base58",
|
|
1591
|
-
BASE_64: "base64"
|
|
1592
|
-
PARSED: "jsonParsed"
|
|
1593
|
-
},
|
|
1594
|
-
TransactionVersion: {
|
|
1595
|
-
LEGACY: "legacy",
|
|
1596
|
-
ZERO: 0
|
|
1893
|
+
BASE_64: "base64"
|
|
1597
1894
|
}
|
|
1598
1895
|
};
|
|
1599
1896
|
|
|
@@ -1797,93 +2094,18 @@ var accountTypeDefs = (
|
|
|
1797
2094
|
var blockTypeDefs = (
|
|
1798
2095
|
/* GraphQL */
|
|
1799
2096
|
`
|
|
1800
|
-
type TransactionMetaForAccounts {
|
|
1801
|
-
err: String
|
|
1802
|
-
fee: BigInt
|
|
1803
|
-
postBalances: [BigInt]
|
|
1804
|
-
postTokenBalances: [TokenBalance]
|
|
1805
|
-
preBalances: [BigInt]
|
|
1806
|
-
preTokenBalances: [TokenBalance]
|
|
1807
|
-
status: TransactionStatus
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
type TransactionDataForAccounts {
|
|
1811
|
-
accountKeys: [Address]
|
|
1812
|
-
signatures: [String]
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
type BlockTransactionAccounts {
|
|
1816
|
-
meta: TransactionMetaForAccounts
|
|
1817
|
-
data: TransactionDataForAccounts
|
|
1818
|
-
version: String
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
"""
|
|
1822
|
-
Block interface
|
|
1823
|
-
"""
|
|
1824
|
-
interface Block {
|
|
1825
|
-
blockhash: String
|
|
1826
|
-
blockHeight: BigInt
|
|
1827
|
-
blockTime: BigInt
|
|
1828
|
-
parentSlot: BigInt
|
|
1829
|
-
previousBlockhash: String
|
|
1830
|
-
rewards: [Reward]
|
|
1831
|
-
transactionDetails: String
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
2097
|
"""
|
|
1835
|
-
A block
|
|
2098
|
+
A Solana block
|
|
1836
2099
|
"""
|
|
1837
|
-
type
|
|
2100
|
+
type Block {
|
|
1838
2101
|
blockhash: String
|
|
1839
2102
|
blockHeight: BigInt
|
|
1840
2103
|
blockTime: BigInt
|
|
1841
|
-
parentSlot:
|
|
1842
|
-
previousBlockhash: String
|
|
1843
|
-
rewards: [Reward]
|
|
1844
|
-
transactions: [BlockTransactionAccounts]
|
|
1845
|
-
transactionDetails: String
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
"""
|
|
1849
|
-
A block with full transaction details
|
|
1850
|
-
"""
|
|
1851
|
-
type BlockWithFull implements Block {
|
|
1852
|
-
blockhash: String
|
|
1853
|
-
blockHeight: BigInt
|
|
1854
|
-
blockTime: BigInt
|
|
1855
|
-
parentSlot: BigInt
|
|
2104
|
+
parentSlot: Slot
|
|
1856
2105
|
previousBlockhash: String
|
|
1857
2106
|
rewards: [Reward]
|
|
2107
|
+
signatures: [Signature]
|
|
1858
2108
|
transactions: [Transaction]
|
|
1859
|
-
transactionDetails: String
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
"""
|
|
1863
|
-
A block with no transaction details
|
|
1864
|
-
"""
|
|
1865
|
-
type BlockWithNone implements Block {
|
|
1866
|
-
blockhash: String
|
|
1867
|
-
blockHeight: BigInt
|
|
1868
|
-
blockTime: BigInt
|
|
1869
|
-
parentSlot: BigInt
|
|
1870
|
-
previousBlockhash: String
|
|
1871
|
-
rewards: [Reward]
|
|
1872
|
-
transactionDetails: String
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
"""
|
|
1876
|
-
A block with signature transaction details
|
|
1877
|
-
"""
|
|
1878
|
-
type BlockWithSignatures implements Block {
|
|
1879
|
-
blockhash: String
|
|
1880
|
-
blockHeight: BigInt
|
|
1881
|
-
blockTime: BigInt
|
|
1882
|
-
parentSlot: BigInt
|
|
1883
|
-
previousBlockhash: String
|
|
1884
|
-
rewards: [Reward]
|
|
1885
|
-
signatures: [String]
|
|
1886
|
-
transactionDetails: String
|
|
1887
2109
|
}
|
|
1888
2110
|
`
|
|
1889
2111
|
);
|
|
@@ -2005,12 +2227,12 @@ var instructionTypeDefs = (
|
|
|
2005
2227
|
programId: Address
|
|
2006
2228
|
authority: Account
|
|
2007
2229
|
bufferAccount: Account
|
|
2008
|
-
clockSysvar:
|
|
2230
|
+
clockSysvar: Account
|
|
2009
2231
|
maxDataLen: BigInt
|
|
2010
2232
|
payerAccount: Account
|
|
2011
2233
|
programAccount: Account
|
|
2012
2234
|
programDataAccount: Account
|
|
2013
|
-
rentSysvar:
|
|
2235
|
+
rentSysvar: Account
|
|
2014
2236
|
}
|
|
2015
2237
|
|
|
2016
2238
|
"""
|
|
@@ -2020,10 +2242,10 @@ var instructionTypeDefs = (
|
|
|
2020
2242
|
programId: Address
|
|
2021
2243
|
authority: Account
|
|
2022
2244
|
bufferAccount: Account
|
|
2023
|
-
clockSysvar:
|
|
2245
|
+
clockSysvar: Account
|
|
2024
2246
|
programAccount: Account
|
|
2025
2247
|
programDataAccount: Account
|
|
2026
|
-
rentSysvar:
|
|
2248
|
+
rentSysvar: Account
|
|
2027
2249
|
spillAccount: Account
|
|
2028
2250
|
}
|
|
2029
2251
|
|
|
@@ -2076,7 +2298,7 @@ var instructionTypeDefs = (
|
|
|
2076
2298
|
type SplAssociatedTokenCreateInstruction implements TransactionInstruction {
|
|
2077
2299
|
programId: Address
|
|
2078
2300
|
account: Account
|
|
2079
|
-
mint:
|
|
2301
|
+
mint: Account
|
|
2080
2302
|
source: Account
|
|
2081
2303
|
systemProgram: Account
|
|
2082
2304
|
tokenProgram: Account
|
|
@@ -2089,7 +2311,7 @@ var instructionTypeDefs = (
|
|
|
2089
2311
|
type SplAssociatedTokenCreateIdempotentInstruction implements TransactionInstruction {
|
|
2090
2312
|
programId: Address
|
|
2091
2313
|
account: Account
|
|
2092
|
-
mint:
|
|
2314
|
+
mint: Account
|
|
2093
2315
|
source: Account
|
|
2094
2316
|
systemProgram: Account
|
|
2095
2317
|
tokenProgram: Account
|
|
@@ -2127,7 +2349,7 @@ var instructionTypeDefs = (
|
|
|
2127
2349
|
freezeAuthority: Account
|
|
2128
2350
|
mint: Account
|
|
2129
2351
|
mintAuthority: Account
|
|
2130
|
-
rentSysvar:
|
|
2352
|
+
rentSysvar: Account
|
|
2131
2353
|
}
|
|
2132
2354
|
|
|
2133
2355
|
"""
|
|
@@ -2149,7 +2371,7 @@ var instructionTypeDefs = (
|
|
|
2149
2371
|
account: Account
|
|
2150
2372
|
mint: Account
|
|
2151
2373
|
owner: Account
|
|
2152
|
-
rentSysvar:
|
|
2374
|
+
rentSysvar: Account
|
|
2153
2375
|
}
|
|
2154
2376
|
|
|
2155
2377
|
"""
|
|
@@ -2160,7 +2382,7 @@ var instructionTypeDefs = (
|
|
|
2160
2382
|
account: Account
|
|
2161
2383
|
mint: Account
|
|
2162
2384
|
owner: Account
|
|
2163
|
-
rentSysvar:
|
|
2385
|
+
rentSysvar: Account
|
|
2164
2386
|
}
|
|
2165
2387
|
|
|
2166
2388
|
"""
|
|
@@ -2180,7 +2402,7 @@ var instructionTypeDefs = (
|
|
|
2180
2402
|
programId: Address
|
|
2181
2403
|
m: BigInt # FIXME:*
|
|
2182
2404
|
multisig: Account
|
|
2183
|
-
rentSysvar:
|
|
2405
|
+
rentSysvar: Account
|
|
2184
2406
|
signers: [Address]
|
|
2185
2407
|
}
|
|
2186
2408
|
|
|
@@ -2435,7 +2657,7 @@ var instructionTypeDefs = (
|
|
|
2435
2657
|
programId: Address
|
|
2436
2658
|
authorized: StakeInitializeInstructionDataAuthorized
|
|
2437
2659
|
lockup: Lockup
|
|
2438
|
-
rentSysvar:
|
|
2660
|
+
rentSysvar: Account
|
|
2439
2661
|
stakeAccount: Account
|
|
2440
2662
|
}
|
|
2441
2663
|
|
|
@@ -2446,7 +2668,7 @@ var instructionTypeDefs = (
|
|
|
2446
2668
|
programId: Address
|
|
2447
2669
|
authority: Account
|
|
2448
2670
|
authorityType: String
|
|
2449
|
-
clockSysvar:
|
|
2671
|
+
clockSysvar: Account
|
|
2450
2672
|
custodian: Account
|
|
2451
2673
|
newAuthority: Account
|
|
2452
2674
|
stakeAccount: Account
|
|
@@ -2457,11 +2679,11 @@ var instructionTypeDefs = (
|
|
|
2457
2679
|
"""
|
|
2458
2680
|
type StakeDelegateStakeInstruction implements TransactionInstruction {
|
|
2459
2681
|
programId: Address
|
|
2460
|
-
clockSysvar:
|
|
2682
|
+
clockSysvar: Account
|
|
2461
2683
|
stakeAccount: Account
|
|
2462
2684
|
stakeAuthority: Account
|
|
2463
2685
|
stakeConfigAccount: Account
|
|
2464
|
-
stakeHistorySysvar:
|
|
2686
|
+
stakeHistorySysvar: Account
|
|
2465
2687
|
voteAccount: Account
|
|
2466
2688
|
}
|
|
2467
2689
|
|
|
@@ -2481,7 +2703,7 @@ var instructionTypeDefs = (
|
|
|
2481
2703
|
"""
|
|
2482
2704
|
type StakeWithdrawInstruction implements TransactionInstruction {
|
|
2483
2705
|
programId: Address
|
|
2484
|
-
clockSysvar:
|
|
2706
|
+
clockSysvar: Account
|
|
2485
2707
|
destination: Account
|
|
2486
2708
|
lamports: BigInt
|
|
2487
2709
|
stakeAccount: Account
|
|
@@ -2493,7 +2715,7 @@ var instructionTypeDefs = (
|
|
|
2493
2715
|
"""
|
|
2494
2716
|
type StakeDeactivateInstruction implements TransactionInstruction {
|
|
2495
2717
|
programId: Address
|
|
2496
|
-
clockSysvar:
|
|
2718
|
+
clockSysvar: Account
|
|
2497
2719
|
stakeAccount: Account
|
|
2498
2720
|
stakeAuthority: Account
|
|
2499
2721
|
}
|
|
@@ -2513,11 +2735,11 @@ var instructionTypeDefs = (
|
|
|
2513
2735
|
"""
|
|
2514
2736
|
type StakeMergeInstruction implements TransactionInstruction {
|
|
2515
2737
|
programId: Address
|
|
2516
|
-
clockSysvar:
|
|
2738
|
+
clockSysvar: Account
|
|
2517
2739
|
destination: Account
|
|
2518
2740
|
source: Account
|
|
2519
2741
|
stakeAuthority: Account
|
|
2520
|
-
stakeHistorySysvar:
|
|
2742
|
+
stakeHistorySysvar: Account
|
|
2521
2743
|
}
|
|
2522
2744
|
|
|
2523
2745
|
"""
|
|
@@ -2529,7 +2751,7 @@ var instructionTypeDefs = (
|
|
|
2529
2751
|
authorityOwner: Account
|
|
2530
2752
|
authoritySeed: String
|
|
2531
2753
|
authorityType: String
|
|
2532
|
-
clockSysvar:
|
|
2754
|
+
clockSysvar: Account
|
|
2533
2755
|
custodian: Account
|
|
2534
2756
|
newAuthorized: Account
|
|
2535
2757
|
stakeAccount: Account
|
|
@@ -2546,7 +2768,7 @@ var instructionTypeDefs = (
|
|
|
2546
2768
|
programId: Address
|
|
2547
2769
|
authorized: StakeInitializeCheckedInstructionDataAuthorized
|
|
2548
2770
|
lockup: Lockup
|
|
2549
|
-
rentSysvar:
|
|
2771
|
+
rentSysvar: Account
|
|
2550
2772
|
stakeAccount: Account
|
|
2551
2773
|
}
|
|
2552
2774
|
|
|
@@ -2557,7 +2779,7 @@ var instructionTypeDefs = (
|
|
|
2557
2779
|
programId: Address
|
|
2558
2780
|
authority: Account
|
|
2559
2781
|
authorityType: String
|
|
2560
|
-
clockSysvar:
|
|
2782
|
+
clockSysvar: Account
|
|
2561
2783
|
custodian: Account
|
|
2562
2784
|
newAuthority: Account
|
|
2563
2785
|
stakeAccount: Account
|
|
@@ -2572,7 +2794,7 @@ var instructionTypeDefs = (
|
|
|
2572
2794
|
authorityOwner: Account
|
|
2573
2795
|
authoritySeed: String
|
|
2574
2796
|
authorityType: String
|
|
2575
|
-
clockSysvar:
|
|
2797
|
+
clockSysvar: Account
|
|
2576
2798
|
custodian: Account
|
|
2577
2799
|
newAuthorized: Account
|
|
2578
2800
|
stakeAccount: Account
|
|
@@ -2660,7 +2882,7 @@ var instructionTypeDefs = (
|
|
|
2660
2882
|
programId: Address
|
|
2661
2883
|
nonceAccount: Account
|
|
2662
2884
|
nonceAuthority: Account
|
|
2663
|
-
recentBlockhashesSysvar:
|
|
2885
|
+
recentBlockhashesSysvar: Account
|
|
2664
2886
|
}
|
|
2665
2887
|
|
|
2666
2888
|
"""
|
|
@@ -2672,8 +2894,8 @@ var instructionTypeDefs = (
|
|
|
2672
2894
|
lamports: BigInt
|
|
2673
2895
|
nonceAccount: Account
|
|
2674
2896
|
nonceAuthority: Account
|
|
2675
|
-
recentBlockhashesSysvar:
|
|
2676
|
-
rentSysvar:
|
|
2897
|
+
recentBlockhashesSysvar: Account
|
|
2898
|
+
rentSysvar: Account
|
|
2677
2899
|
}
|
|
2678
2900
|
|
|
2679
2901
|
"""
|
|
@@ -2683,8 +2905,8 @@ var instructionTypeDefs = (
|
|
|
2683
2905
|
programId: Address
|
|
2684
2906
|
nonceAccount: Account
|
|
2685
2907
|
nonceAuthority: Account
|
|
2686
|
-
recentBlockhashesSysvar:
|
|
2687
|
-
rentSysvar:
|
|
2908
|
+
recentBlockhashesSysvar: Account
|
|
2909
|
+
rentSysvar: Account
|
|
2688
2910
|
}
|
|
2689
2911
|
|
|
2690
2912
|
"""
|
|
@@ -2758,10 +2980,10 @@ var instructionTypeDefs = (
|
|
|
2758
2980
|
programId: Address
|
|
2759
2981
|
authorizedVoter: Account
|
|
2760
2982
|
authorizedWithdrawer: Account
|
|
2761
|
-
clockSysvar:
|
|
2983
|
+
clockSysvar: Account
|
|
2762
2984
|
commission: BigInt # FIXME:*
|
|
2763
2985
|
node: Account
|
|
2764
|
-
rentSysvar:
|
|
2986
|
+
rentSysvar: Account
|
|
2765
2987
|
voteAccount: Account
|
|
2766
2988
|
}
|
|
2767
2989
|
|
|
@@ -2772,7 +2994,7 @@ var instructionTypeDefs = (
|
|
|
2772
2994
|
programId: Address
|
|
2773
2995
|
authority: Account
|
|
2774
2996
|
authorityType: String
|
|
2775
|
-
clockSysvar:
|
|
2997
|
+
clockSysvar: Account
|
|
2776
2998
|
newAuthority: Account
|
|
2777
2999
|
voteAccount: Account
|
|
2778
3000
|
}
|
|
@@ -2786,7 +3008,7 @@ var instructionTypeDefs = (
|
|
|
2786
3008
|
authorityOwner: Account
|
|
2787
3009
|
authoritySeed: String
|
|
2788
3010
|
authorityType: String
|
|
2789
|
-
clockSysvar:
|
|
3011
|
+
clockSysvar: Account
|
|
2790
3012
|
newAuthority: Account
|
|
2791
3013
|
voteAccount: Account
|
|
2792
3014
|
}
|
|
@@ -2800,7 +3022,7 @@ var instructionTypeDefs = (
|
|
|
2800
3022
|
authorityOwner: Account
|
|
2801
3023
|
authoritySeed: String
|
|
2802
3024
|
authorityType: String
|
|
2803
|
-
clockSysvar:
|
|
3025
|
+
clockSysvar: Account
|
|
2804
3026
|
newAuthority: Account
|
|
2805
3027
|
voteAccount: Account
|
|
2806
3028
|
}
|
|
@@ -2816,8 +3038,8 @@ var instructionTypeDefs = (
|
|
|
2816
3038
|
"""
|
|
2817
3039
|
type VoteVoteInstruction implements TransactionInstruction {
|
|
2818
3040
|
programId: Address
|
|
2819
|
-
clockSysvar:
|
|
2820
|
-
slotHashesSysvar:
|
|
3041
|
+
clockSysvar: Account
|
|
3042
|
+
slotHashesSysvar: Account
|
|
2821
3043
|
vote: Vote
|
|
2822
3044
|
voteAccount: Account
|
|
2823
3045
|
voteAuthority: Account
|
|
@@ -2914,9 +3136,9 @@ var instructionTypeDefs = (
|
|
|
2914
3136
|
"""
|
|
2915
3137
|
type VoteVoteSwitchInstruction implements TransactionInstruction {
|
|
2916
3138
|
programId: Address
|
|
2917
|
-
clockSysvar:
|
|
3139
|
+
clockSysvar: Account
|
|
2918
3140
|
hash: String
|
|
2919
|
-
slotHashesSysvar:
|
|
3141
|
+
slotHashesSysvar: Account
|
|
2920
3142
|
vote: Vote
|
|
2921
3143
|
voteAccount: Account
|
|
2922
3144
|
voteAuthority: Account
|
|
@@ -2929,7 +3151,7 @@ var instructionTypeDefs = (
|
|
|
2929
3151
|
programId: Address
|
|
2930
3152
|
authority: Account
|
|
2931
3153
|
authorityType: String
|
|
2932
|
-
clockSysvar:
|
|
3154
|
+
clockSysvar: Account
|
|
2933
3155
|
newAuthority: Account
|
|
2934
3156
|
voteAccount: Account
|
|
2935
3157
|
}
|
|
@@ -2942,21 +3164,14 @@ var rootTypeDefs = (
|
|
|
2942
3164
|
`
|
|
2943
3165
|
type Query {
|
|
2944
3166
|
account(address: Address!, commitment: Commitment, minContextSlot: Slot): Account
|
|
2945
|
-
block(
|
|
2946
|
-
slot: Slot!
|
|
2947
|
-
commitment: Commitment
|
|
2948
|
-
encoding: TransactionEncoding
|
|
2949
|
-
transactionDetails: BlockTransactionDetails
|
|
2950
|
-
): Block
|
|
3167
|
+
block(slot: Slot!, commitment: CommitmentWithoutProcessed): Block
|
|
2951
3168
|
programAccounts(
|
|
2952
3169
|
programAddress: Address!
|
|
2953
3170
|
commitment: Commitment
|
|
2954
|
-
dataSlice: DataSlice
|
|
2955
|
-
encoding: AccountEncoding
|
|
2956
3171
|
filters: [ProgramAccountsFilter]
|
|
2957
3172
|
minContextSlot: Slot
|
|
2958
3173
|
): [Account]
|
|
2959
|
-
transaction(signature: Signature!, commitment:
|
|
3174
|
+
transaction(signature: Signature!, commitment: CommitmentWithoutProcessed): Transaction
|
|
2960
3175
|
}
|
|
2961
3176
|
|
|
2962
3177
|
schema {
|
|
@@ -3031,49 +3246,15 @@ var transactionTypeDefs = (
|
|
|
3031
3246
|
}
|
|
3032
3247
|
|
|
3033
3248
|
"""
|
|
3034
|
-
|
|
3249
|
+
A Solana transaction
|
|
3035
3250
|
"""
|
|
3036
|
-
|
|
3251
|
+
type Transaction {
|
|
3037
3252
|
blockTime: BigInt
|
|
3038
|
-
|
|
3039
|
-
slot: BigInt
|
|
3040
|
-
version: String
|
|
3041
|
-
}
|
|
3042
|
-
|
|
3043
|
-
"""
|
|
3044
|
-
A transaction with base58 encoded data
|
|
3045
|
-
"""
|
|
3046
|
-
type TransactionBase58 implements Transaction {
|
|
3047
|
-
blockTime: BigInt
|
|
3048
|
-
data: Base58EncodedBytes
|
|
3049
|
-
meta: TransactionMeta
|
|
3050
|
-
slot: BigInt
|
|
3051
|
-
version: String
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
"""
|
|
3055
|
-
A transaction with base64 encoded data
|
|
3056
|
-
"""
|
|
3057
|
-
type TransactionBase64 implements Transaction {
|
|
3058
|
-
blockTime: BigInt
|
|
3059
|
-
data: Base64EncodedBytes
|
|
3060
|
-
meta: TransactionMeta
|
|
3061
|
-
slot: BigInt
|
|
3062
|
-
version: String
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
"""
|
|
3066
|
-
A transaction with JSON encoded data
|
|
3067
|
-
"""
|
|
3068
|
-
type TransactionDataParsed {
|
|
3253
|
+
data(encoding: TransactionEncoding!): String
|
|
3069
3254
|
message: TransactionMessage
|
|
3070
|
-
signatures: [String]
|
|
3071
|
-
}
|
|
3072
|
-
type TransactionParsed implements Transaction {
|
|
3073
|
-
blockTime: BigInt
|
|
3074
|
-
data: TransactionDataParsed
|
|
3075
3255
|
meta: TransactionMeta
|
|
3076
|
-
|
|
3256
|
+
signatures: [Signature]
|
|
3257
|
+
slot: Slot
|
|
3077
3258
|
version: String
|
|
3078
3259
|
}
|
|
3079
3260
|
`
|
|
@@ -3099,19 +3280,17 @@ var typeTypeDefs = (
|
|
|
3099
3280
|
|
|
3100
3281
|
scalar BigInt
|
|
3101
3282
|
|
|
3102
|
-
enum BlockTransactionDetails {
|
|
3103
|
-
ACCOUNTS
|
|
3104
|
-
FULL
|
|
3105
|
-
NONE
|
|
3106
|
-
SIGNATURES
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
3283
|
enum Commitment {
|
|
3110
3284
|
CONFIRMED
|
|
3111
3285
|
FINALIZED
|
|
3112
3286
|
PROCESSED
|
|
3113
3287
|
}
|
|
3114
3288
|
|
|
3289
|
+
enum CommitmentWithoutProcessed {
|
|
3290
|
+
CONFIRMED
|
|
3291
|
+
FINALIZED
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3115
3294
|
input DataSlice {
|
|
3116
3295
|
offset: Int!
|
|
3117
3296
|
length: Int!
|
|
@@ -3159,12 +3338,6 @@ var typeTypeDefs = (
|
|
|
3159
3338
|
enum TransactionEncoding {
|
|
3160
3339
|
BASE_58
|
|
3161
3340
|
BASE_64
|
|
3162
|
-
PARSED
|
|
3163
|
-
}
|
|
3164
|
-
|
|
3165
|
-
enum TransactionVersion {
|
|
3166
|
-
LEGACY
|
|
3167
|
-
ZERO
|
|
3168
3341
|
}
|
|
3169
3342
|
`
|
|
3170
3343
|
);
|