@graphprotocol/graph-cli 0.45.0-rc-20230404031804-6e0a3c0 → 0.45.0
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/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.45.0
|
|
3
|
+
## 0.45.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -110,6 +110,12 @@
|
|
|
110
110
|
- Updated dependency [`glob@9.3.4` ↗︎](https://www.npmjs.com/package/glob/v/9.3.4) (from `7.1.6`,
|
|
111
111
|
in `dependencies`)
|
|
112
112
|
|
|
113
|
+
- [#1246](https://github.com/graphprotocol/graph-tooling/pull/1246)
|
|
114
|
+
[`8e1409f`](https://github.com/graphprotocol/graph-tooling/commit/8e1409fbd04fa9e34fbc7d49160d9888ef74aebb)
|
|
115
|
+
Thanks [@dimitrovmaksim](https://github.com/dimitrovmaksim)! - Fixes `graph add` overwriting the
|
|
116
|
+
event names in `subgraph.yaml` and the ABI file when existing contracts have events with the same
|
|
117
|
+
name.
|
|
118
|
+
|
|
113
119
|
- [#1207](https://github.com/graphprotocol/graph-tooling/pull/1207)
|
|
114
120
|
[`ad275b3`](https://github.com/graphprotocol/graph-tooling/commit/ad275b31e635dab03cfefda00617ef9f612b01c0)
|
|
115
121
|
Thanks [@saihaj](https://github.com/saihaj)! - bring back short hand for version and help
|
package/dist/commands/add.js
CHANGED
|
@@ -69,9 +69,9 @@ class AddCommand extends core_1.Command {
|
|
|
69
69
|
// If we can't get the start block, we'll just leave it out of the manifest
|
|
70
70
|
// TODO: Ask the user for the start block
|
|
71
71
|
}
|
|
72
|
+
await (0, scaffold_1.writeABI)(ethabi, contractName);
|
|
72
73
|
const { collisionEntities, onlyCollisions, abiData } = updateEventNamesOnCollision(ethabi, entities, contractName, mergeEntities);
|
|
73
74
|
ethabi.data = abiData;
|
|
74
|
-
await (0, scaffold_1.writeABI)(ethabi, contractName);
|
|
75
75
|
await (0, scaffold_1.writeSchema)(ethabi, protocol, result.getIn(['schema', 'file']), collisionEntities, contractName);
|
|
76
76
|
await (0, scaffold_1.writeMapping)(ethabi, protocol, contractName, collisionEntities);
|
|
77
77
|
await (0, scaffold_1.writeTestsFiles)(ethabi, protocol, contractName);
|
|
@@ -168,7 +168,7 @@ const updateEventNamesOnCollision = (ethabi, entities, contractName, mergeEntiti
|
|
|
168
168
|
continue;
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
dataRow.set('
|
|
171
|
+
dataRow.set('collision', true);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
@@ -22,7 +22,9 @@ const mapping = ({ abi, contractName }) => `
|
|
|
22
22
|
language: wasm/assemblyscript
|
|
23
23
|
entities:
|
|
24
24
|
${(0, schema_1.abiEvents)(abi)
|
|
25
|
-
.map(event => `- ${event.get('
|
|
25
|
+
.map(event => `- ${event.get('collision')
|
|
26
|
+
? `${contractName}${event.get('_alias')}`
|
|
27
|
+
: event.get('_alias')}`)
|
|
26
28
|
.join('\n ')}
|
|
27
29
|
abis:
|
|
28
30
|
- name: ${contractName}
|
package/dist/scaffold/schema.js
CHANGED
|
@@ -63,13 +63,13 @@ const generateEventFields = ({ index, input, protocolName, }) => input.type == '
|
|
|
63
63
|
}),
|
|
64
64
|
];
|
|
65
65
|
exports.generateEventFields = generateEventFields;
|
|
66
|
-
const generateEventType = (event, protocolName,
|
|
67
|
-
return `type ${event._alias} @entity(immutable: true) {
|
|
66
|
+
const generateEventType = (event, protocolName, contractName) => {
|
|
67
|
+
return `type ${event.collision ? `${contractName}${event._alias}` : event._alias} @entity(immutable: true) {
|
|
68
68
|
id: Bytes!
|
|
69
69
|
${event.inputs
|
|
70
70
|
.reduce((acc, input, index) => {
|
|
71
71
|
if (Object.values(mapping_1.INPUT_NAMES_BLACKLIST).includes(input.name)) {
|
|
72
|
-
input.name = (0, mapping_1.renameInput)(input.name,
|
|
72
|
+
input.name = (0, mapping_1.renameInput)(input.name, contractName ?? 'contract');
|
|
73
73
|
}
|
|
74
74
|
return acc.concat((0, exports.generateEventFields)({ input, index, protocolName }));
|
|
75
75
|
}, [])
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/graph-cli",
|
|
3
|
-
"version": "0.45.0
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "CLI for building for and deploying to The Graph",
|
|
5
5
|
"license": "(Apache-2.0 OR MIT)",
|
|
6
6
|
"engines": {
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "tsc -b tsconfig.build.json && oclif manifest && copyfiles -u 1 src/**/*.graphql dist/ && chmod +x ./dist/bin.js",
|
|
77
77
|
"test": "jest --verbose",
|
|
78
|
+
"test:add": "jest tests/cli/add.test.ts --verbose",
|
|
78
79
|
"test:init": "jest tests/cli/init.test.ts --verbose",
|
|
79
80
|
"test:validation": "jest tests/cli/validation.test.ts --verbose",
|
|
80
81
|
"type-check": "tsc --noEmit"
|