@quicknode/sdk 1.1.0 → 1.1.1
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/cjs/index.js +130 -190
- package/esm/package.json.js +1 -1
- package/esm/src/api/controllers/contracts.js +6 -8
- package/esm/src/api/controllers/events.js +23 -31
- package/esm/src/api/controllers/nfts.js +44 -61
- package/esm/src/api/controllers/tokens.js +10 -15
- package/esm/src/api/controllers/transactions.js +26 -31
- package/esm/src/api/controllers/utils.js +6 -8
- package/esm/src/api/graphql/generatedTypes.js +1 -41
- package/esm/src/api/graphql/modifyQueryForChain.js +27 -0
- package/esm/src/api/graphql/schema.json.js +1 -1
- package/esm/src/api/index.d.ts +34 -40
- package/index.d.ts +34 -40
- package/package.json +3 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Kind } from 'graphql';
|
|
2
|
+
|
|
3
|
+
// Takes the generated query document and modifies the chain name to the one passed in
|
|
4
|
+
function modifyQueryForChain(chainName, documentNode) {
|
|
5
|
+
documentNode.definitions = documentNode.definitions.map((doc) => {
|
|
6
|
+
if (doc.kind === Kind.OPERATION_DEFINITION) {
|
|
7
|
+
doc.selectionSet.selections = doc.selectionSet.selections.map((selection) => {
|
|
8
|
+
if (selection.kind === Kind.FIELD &&
|
|
9
|
+
selection.name.kind == Kind.NAME &&
|
|
10
|
+
selection.name.value === 'ethereum') {
|
|
11
|
+
const updatedChainSelection = {
|
|
12
|
+
...selection,
|
|
13
|
+
...{
|
|
14
|
+
name: { ...selection.name, value: chainName },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
return updatedChainSelection;
|
|
18
|
+
}
|
|
19
|
+
return selection;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return doc;
|
|
23
|
+
});
|
|
24
|
+
return documentNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { modifyQueryForChain };
|