@graphprotocol/graph-cli 0.78.0 → 0.79.0-alpha-20240711124603-49edf22
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 +8 -0
- package/dist/protocols/index.d.ts +2 -2
- package/dist/protocols/index.js +21 -2
- package/dist/protocols/subgraph/manifest.graphql +59 -0
- package/dist/protocols/subgraph/scaffold/manifest.d.ts +4 -0
- package/dist/protocols/subgraph/scaffold/manifest.js +12 -0
- package/dist/protocols/subgraph/subgraph.d.ts +10 -0
- package/dist/protocols/subgraph/subgraph.js +20 -0
- package/oclif.manifest.json +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
+
## 0.79.0-alpha-20240711124603-49edf22
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1695](https://github.com/graphprotocol/graph-tooling/pull/1695)
|
|
8
|
+
[`49edf22`](https://github.com/graphprotocol/graph-tooling/commit/49edf22bbfe08902ddf5776d9014a2289fab18d0)
|
|
9
|
+
Thanks [@incrypto32](https://github.com/incrypto32)! - Add subgraph datasources
|
|
10
|
+
|
|
3
11
|
## 0.78.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -8,7 +8,7 @@ export default class Protocol {
|
|
|
8
8
|
config: ProtocolConfig;
|
|
9
9
|
constructor(datasource: any);
|
|
10
10
|
static availableProtocols(): immutable.Collection<ProtocolName, string[]>;
|
|
11
|
-
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams" | "substreams/triggers", immutable.List<string>>;
|
|
11
|
+
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams" | "substreams/triggers" | "subgraph", immutable.List<string>>;
|
|
12
12
|
static normalizeName(name: ProtocolName): ProtocolName;
|
|
13
13
|
displayName(): string;
|
|
14
14
|
isValidKindName(kind: string): boolean;
|
|
@@ -25,7 +25,7 @@ export default class Protocol {
|
|
|
25
25
|
getManifestScaffold(): any;
|
|
26
26
|
getMappingScaffold(): any;
|
|
27
27
|
}
|
|
28
|
-
export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams' | 'substreams/triggers';
|
|
28
|
+
export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams' | 'substreams/triggers' | 'subgraph';
|
|
29
29
|
export interface ProtocolConfig {
|
|
30
30
|
displayName: string;
|
|
31
31
|
abi?: any;
|
package/dist/protocols/index.js
CHANGED
|
@@ -45,8 +45,9 @@ const contract_2 = __importDefault(require("./near/contract"));
|
|
|
45
45
|
const NearManifestScaffold = __importStar(require("./near/scaffold/manifest"));
|
|
46
46
|
const NearMappingScaffold = __importStar(require("./near/scaffold/mapping"));
|
|
47
47
|
const subgraph_4 = __importDefault(require("./near/subgraph"));
|
|
48
|
+
const subgraph_5 = __importDefault(require("./subgraph/subgraph"));
|
|
48
49
|
const SubstreamsManifestScaffold = __importStar(require("./substreams/scaffold/manifest"));
|
|
49
|
-
const
|
|
50
|
+
const subgraph_6 = __importDefault(require("./substreams/subgraph"));
|
|
50
51
|
const protocolDebug = (0, debug_1.default)('graph-cli:protocol');
|
|
51
52
|
class Protocol {
|
|
52
53
|
static fromDataSources(dataSourcesAndTemplates) {
|
|
@@ -60,6 +61,7 @@ class Protocol {
|
|
|
60
61
|
* some other places use datasource object
|
|
61
62
|
*/
|
|
62
63
|
const name = typeof datasource === 'string' ? datasource : datasource.kind;
|
|
64
|
+
protocolDebug('Initializing protocol with datasource %O', datasource);
|
|
63
65
|
this.name = Protocol.normalizeName(name);
|
|
64
66
|
protocolDebug('Initializing protocol %s', this.name);
|
|
65
67
|
switch (this.name) {
|
|
@@ -75,6 +77,9 @@ class Protocol {
|
|
|
75
77
|
case 'near':
|
|
76
78
|
this.config = nearProtocol;
|
|
77
79
|
break;
|
|
80
|
+
case 'subgraph':
|
|
81
|
+
this.config = subgraphProtocol;
|
|
82
|
+
break;
|
|
78
83
|
case 'substreams':
|
|
79
84
|
this.config = substreamsProtocol;
|
|
80
85
|
/**
|
|
@@ -99,6 +104,7 @@ class Protocol {
|
|
|
99
104
|
near: ['near'],
|
|
100
105
|
cosmos: ['cosmos'],
|
|
101
106
|
substreams: ['substreams'],
|
|
107
|
+
subgraph: ['subgraph'],
|
|
102
108
|
});
|
|
103
109
|
}
|
|
104
110
|
static availableNetworks() {
|
|
@@ -153,6 +159,7 @@ class Protocol {
|
|
|
153
159
|
'uni-3', // Juno testnet
|
|
154
160
|
],
|
|
155
161
|
substreams: ['mainnet'],
|
|
162
|
+
subgraph: ['mainnet'],
|
|
156
163
|
});
|
|
157
164
|
}
|
|
158
165
|
static normalizeName(name) {
|
|
@@ -255,6 +262,18 @@ const ethereumProtocol = {
|
|
|
255
262
|
manifestScaffold: EthereumManifestScaffold,
|
|
256
263
|
mappingScaffold: EthereumMappingScaffold,
|
|
257
264
|
};
|
|
265
|
+
const subgraphProtocol = {
|
|
266
|
+
displayName: 'Subgraph',
|
|
267
|
+
abi: undefined,
|
|
268
|
+
contract: undefined,
|
|
269
|
+
getTemplateCodeGen: undefined,
|
|
270
|
+
getTypeGenerator: undefined,
|
|
271
|
+
getSubgraph(options) {
|
|
272
|
+
return new subgraph_5.default(options);
|
|
273
|
+
},
|
|
274
|
+
manifestScaffold: undefined,
|
|
275
|
+
mappingScaffold: undefined,
|
|
276
|
+
};
|
|
258
277
|
const nearProtocol = {
|
|
259
278
|
displayName: 'NEAR',
|
|
260
279
|
abi: undefined,
|
|
@@ -274,7 +293,7 @@ const substreamsProtocol = {
|
|
|
274
293
|
getTypeGenerator: undefined,
|
|
275
294
|
getTemplateCodeGen: undefined,
|
|
276
295
|
getSubgraph(options) {
|
|
277
|
-
return new
|
|
296
|
+
return new subgraph_6.default(options);
|
|
278
297
|
},
|
|
279
298
|
manifestScaffold: SubstreamsManifestScaffold,
|
|
280
299
|
mappingScaffold: undefined,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Each referenced type's in any of the types below must be listed
|
|
2
|
+
# here either as `scalar` or `type` for the validation code to work
|
|
3
|
+
# properly.
|
|
4
|
+
#
|
|
5
|
+
# That's why `String` is listed as a scalar even though it's built-in
|
|
6
|
+
# GraphQL basic types.
|
|
7
|
+
scalar String
|
|
8
|
+
scalar File
|
|
9
|
+
scalar BigInt
|
|
10
|
+
scalar Boolean
|
|
11
|
+
scalar JSON
|
|
12
|
+
|
|
13
|
+
type SubgraphManifest {
|
|
14
|
+
specVersion: String!
|
|
15
|
+
features: [String!]
|
|
16
|
+
schema: Schema!
|
|
17
|
+
description: String
|
|
18
|
+
repository: String
|
|
19
|
+
graft: Graft
|
|
20
|
+
dataSources: [DataSource!]!
|
|
21
|
+
indexerHints: IndexerHints
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Schema {
|
|
25
|
+
file: File!
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type DataSource {
|
|
29
|
+
kind: String!
|
|
30
|
+
name: String!
|
|
31
|
+
network: String
|
|
32
|
+
context: JSON
|
|
33
|
+
source: ContractSource!
|
|
34
|
+
mapping: ContractMapping!
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type ContractSource {
|
|
38
|
+
address: String!
|
|
39
|
+
startBlock: BigInt
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type ContractMapping {
|
|
43
|
+
kind: String
|
|
44
|
+
apiVersion: String!
|
|
45
|
+
language: String!
|
|
46
|
+
file: File!
|
|
47
|
+
entities: [String!]!
|
|
48
|
+
handlers: [EntityHandler!]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type EntityHandler {
|
|
52
|
+
handler: String!
|
|
53
|
+
entity: String!
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type Graft {
|
|
57
|
+
base: String!
|
|
58
|
+
block: BigInt!
|
|
59
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapping = exports.source = void 0;
|
|
4
|
+
const source = ({ spkgPath }) => `
|
|
5
|
+
package:
|
|
6
|
+
moduleName: graph_out
|
|
7
|
+
file: ${spkgPath || 'substreams-eth-block-meta-v0.1.0.spkg'}`;
|
|
8
|
+
exports.source = source;
|
|
9
|
+
const mapping = () => `
|
|
10
|
+
apiVersion: 0.0.5
|
|
11
|
+
kind: substreams/graph-entities`;
|
|
12
|
+
exports.mapping = mapping;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import immutable from 'immutable';
|
|
2
|
+
import { Subgraph, SubgraphOptions } from '../subgraph';
|
|
3
|
+
export default class SubgraphDS implements Subgraph {
|
|
4
|
+
manifest: SubgraphOptions['manifest'];
|
|
5
|
+
resolveFile: SubgraphOptions['resolveFile'];
|
|
6
|
+
protocol: SubgraphOptions['protocol'];
|
|
7
|
+
constructor(options: SubgraphOptions);
|
|
8
|
+
validateManifest(): immutable.List<unknown>;
|
|
9
|
+
handlerTypes(): immutable.List<never>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const immutable_1 = __importDefault(require("immutable"));
|
|
7
|
+
class SubgraphDS {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.manifest = options.manifest;
|
|
10
|
+
this.resolveFile = options.resolveFile;
|
|
11
|
+
this.protocol = options.protocol;
|
|
12
|
+
}
|
|
13
|
+
validateManifest() {
|
|
14
|
+
return immutable_1.default.List();
|
|
15
|
+
}
|
|
16
|
+
handlerTypes() {
|
|
17
|
+
return immutable_1.default.List([]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = SubgraphDS;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.79.0-alpha-20240711124603-49edf22",
|
|
3
3
|
"commands": {
|
|
4
4
|
"add": {
|
|
5
5
|
"id": "add",
|
|
@@ -506,7 +506,8 @@
|
|
|
506
506
|
"ethereum",
|
|
507
507
|
"near",
|
|
508
508
|
"cosmos",
|
|
509
|
-
"substreams"
|
|
509
|
+
"substreams",
|
|
510
|
+
"subgraph"
|
|
510
511
|
]
|
|
511
512
|
},
|
|
512
513
|
"product": {
|