@graphprotocol/graph-cli 0.97.1 → 0.97.2-alpha-20250623231415-dc97cb5879fcc8866ed63acd88b17e966577c678
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 +6 -0
- package/dist/command-helpers/compiler.d.ts +0 -4
- package/dist/command-helpers/compiler.js +2 -16
- package/dist/command-helpers/compiler.test.js +50 -16
- package/dist/command-helpers/file-resolver.js +2 -2
- package/dist/command-helpers/ipfs.d.ts +9 -2
- package/dist/command-helpers/ipfs.js +41 -2
- package/dist/commands/build.js +6 -1
- package/dist/commands/codegen.js +7 -3
- package/dist/commands/deploy.js +13 -6
- package/dist/commands/init.js +14 -7
- package/dist/commands/publish.js +7 -3
- package/dist/type-generator.js +2 -2
- package/oclif.manifest.json +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
+
## 0.97.2-alpha-20250623231415-dc97cb5879fcc8866ed63acd88b17e966577c678
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2055](https://github.com/graphprotocol/graph-tooling/pull/2055) [`dc97cb5`](https://github.com/graphprotocol/graph-tooling/commit/dc97cb5879fcc8866ed63acd88b17e966577c678) Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - updated IPFS endpoints, added deprecation notice when using old ones
|
|
8
|
+
|
|
3
9
|
## 0.97.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -10,9 +10,5 @@ interface CreateCompilerOptions {
|
|
|
10
10
|
blockIpfsMethods?: RegExpMatchArray;
|
|
11
11
|
protocol: Protocol;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Appends /api/v0 to the end of a The Graph IPFS URL
|
|
15
|
-
*/
|
|
16
|
-
export declare function appendApiVersionForGraph(inputString: string): string;
|
|
17
13
|
export declare function createCompiler(manifest: string, { ipfs, headers, outputDir, outputFormat, skipMigrations, blockIpfsMethods, protocol, }: CreateCompilerOptions): Compiler | null;
|
|
18
14
|
export {};
|
|
@@ -3,21 +3,7 @@ import * as toolbox from 'gluegun';
|
|
|
3
3
|
import Compiler from '../compiler/index.js';
|
|
4
4
|
import { GRAPH_CLI_SHARED_HEADERS } from '../constants.js';
|
|
5
5
|
import { createIpfsClient } from '../utils.js';
|
|
6
|
-
|
|
7
|
-
* Appends /api/v0 to the end of a The Graph IPFS URL
|
|
8
|
-
*/
|
|
9
|
-
export function appendApiVersionForGraph(inputString) {
|
|
10
|
-
// Check if the input string is a valid The Graph IPFS URL
|
|
11
|
-
const pattern = /^(https?:\/\/)?([\w-]+\.)+thegraph\.com\/ipfs\/?$/;
|
|
12
|
-
if (pattern.test(inputString)) {
|
|
13
|
-
// account for trailing slash
|
|
14
|
-
if (inputString.endsWith('/')) {
|
|
15
|
-
return inputString.slice(0, -1) + '/api/v0';
|
|
16
|
-
}
|
|
17
|
-
return inputString + '/api/v0';
|
|
18
|
-
}
|
|
19
|
-
return inputString;
|
|
20
|
-
}
|
|
6
|
+
import { getGraphIpfsUrl } from './ipfs.js';
|
|
21
7
|
// Helper function to construct a subgraph compiler
|
|
22
8
|
export function createCompiler(manifest, { ipfs, headers, outputDir, outputFormat, skipMigrations, blockIpfsMethods, protocol, }) {
|
|
23
9
|
// Validate the IPFS URL (if a node address was provided)
|
|
@@ -33,7 +19,7 @@ The IPFS URL must be of the following format: http(s)://host[:port]/[path]`);
|
|
|
33
19
|
// Connect to the IPFS node (if a node address was provided)
|
|
34
20
|
const ipfsClient = ipfs
|
|
35
21
|
? createIpfsClient({
|
|
36
|
-
url:
|
|
22
|
+
url: getGraphIpfsUrl(ipfs.toString()).ipfsUrl,
|
|
37
23
|
headers: {
|
|
38
24
|
...headers,
|
|
39
25
|
...GRAPH_CLI_SHARED_HEADERS,
|
|
@@ -1,25 +1,59 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { getGraphIpfsUrl } from './ipfs.js';
|
|
3
|
+
const DEFAULT_IPFS_URL = 'https://ipfs.thegraph.com/ipfs/api/v0';
|
|
4
|
+
describe('getGraphIpfsUrl', { concurrent: true }, () => {
|
|
5
|
+
it('returns default URL when input is undefined', () => {
|
|
6
|
+
expect(getGraphIpfsUrl(undefined)).toEqual({
|
|
7
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
8
|
+
});
|
|
6
9
|
});
|
|
7
|
-
it('
|
|
8
|
-
expect(
|
|
10
|
+
it('returns default URL when input is empty string', () => {
|
|
11
|
+
expect(getGraphIpfsUrl('')).toEqual({
|
|
12
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
13
|
+
});
|
|
9
14
|
});
|
|
10
|
-
it('
|
|
11
|
-
|
|
15
|
+
it('returns input URL when valid and not deprecated', () => {
|
|
16
|
+
const validUrl = 'https://ipfs.network.example.com';
|
|
17
|
+
expect(getGraphIpfsUrl(validUrl)).toEqual({
|
|
18
|
+
ipfsUrl: validUrl,
|
|
19
|
+
});
|
|
12
20
|
});
|
|
13
|
-
it('
|
|
14
|
-
|
|
21
|
+
it('trim trailing slash from valid url', () => {
|
|
22
|
+
const validUrl = 'https://ipfs.network.example.com/ipfs/';
|
|
23
|
+
expect(getGraphIpfsUrl(validUrl)).toEqual({
|
|
24
|
+
ipfsUrl: 'https://ipfs.network.example.com/ipfs',
|
|
25
|
+
});
|
|
15
26
|
});
|
|
16
|
-
it('
|
|
17
|
-
|
|
27
|
+
it('returns default URL with warning for deprecated api.thegraph.com URL', () => {
|
|
28
|
+
const result = getGraphIpfsUrl('https://api.thegraph.com/ipfs/api/v0');
|
|
29
|
+
expect(result.ipfsUrl).toEqual(DEFAULT_IPFS_URL);
|
|
30
|
+
expect(result.warning).toContain('deprecated');
|
|
18
31
|
});
|
|
19
|
-
it('
|
|
20
|
-
|
|
32
|
+
it('returns default URL with warning for deprecated ipfs.testnet.thegraph.com URL', () => {
|
|
33
|
+
const result = getGraphIpfsUrl('https://ipfs.testnet.thegraph.com/abc');
|
|
34
|
+
expect(result.ipfsUrl).toEqual(DEFAULT_IPFS_URL);
|
|
35
|
+
expect(result.warning).toContain('deprecated');
|
|
21
36
|
});
|
|
22
|
-
it('
|
|
23
|
-
|
|
37
|
+
it('returns default URL with warning for deprecated ipfs.network.thegraph.com URL', () => {
|
|
38
|
+
const result = getGraphIpfsUrl('https://ipfs.network.thegraph.com/xyz');
|
|
39
|
+
expect(result.ipfsUrl).toEqual(DEFAULT_IPFS_URL);
|
|
40
|
+
expect(result.warning).toContain('deprecated');
|
|
41
|
+
});
|
|
42
|
+
it('returns default URL with warning for invalid URL', () => {
|
|
43
|
+
const result = getGraphIpfsUrl('not-a-valid-url');
|
|
44
|
+
expect(result.ipfsUrl).toEqual(DEFAULT_IPFS_URL);
|
|
45
|
+
expect(result.warning).toContain('Invalid IPFS URL');
|
|
46
|
+
});
|
|
47
|
+
it('preserves non-deprecated graph endpoints', () => {
|
|
48
|
+
const url = 'https://ipfs.thegraph.com/ipfs';
|
|
49
|
+
expect(getGraphIpfsUrl(url)).toEqual({
|
|
50
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it('preserves third-party IPFS endpoints', () => {
|
|
54
|
+
const url = 'https://ipfs.example.com/api';
|
|
55
|
+
expect(getGraphIpfsUrl(url)).toEqual({
|
|
56
|
+
ipfsUrl: url,
|
|
57
|
+
});
|
|
24
58
|
});
|
|
25
59
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
|
-
import {
|
|
4
|
+
import { getGraphIpfsUrl } from './ipfs.js';
|
|
5
5
|
export async function resolveFile(source, fileName, timeout = 10_000) {
|
|
6
6
|
const timeoutPromise = new Promise((_, reject) => {
|
|
7
7
|
setTimeout(() => reject(new Error('File download timed out')), timeout);
|
|
@@ -27,7 +27,7 @@ export async function resolveFile(source, fileName, timeout = 10_000) {
|
|
|
27
27
|
try {
|
|
28
28
|
// If it's an IPFS hash (Qm...)
|
|
29
29
|
if (source.startsWith('Qm')) {
|
|
30
|
-
const response = await fetch(`${
|
|
30
|
+
const response = await fetch(`${getGraphIpfsUrl().ipfsUrl}/cat?arg=${source}`);
|
|
31
31
|
if (!response.ok) {
|
|
32
32
|
throw new Error(`failed to fetch from IPFS: ${response.statusText}`);
|
|
33
33
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Validates supplied IPFS URL and provides warnings for deprecated/invalid URLs
|
|
3
|
+
* @param ipfsUrl - The IPFS URL to validate, can be undefined
|
|
4
|
+
* @returns An object with the validated URL and optional warning message
|
|
5
|
+
*/
|
|
6
|
+
export declare function getGraphIpfsUrl(ipfsUrl?: string): {
|
|
7
|
+
ipfsUrl: string;
|
|
8
|
+
warning?: string;
|
|
9
|
+
};
|
|
@@ -1,2 +1,41 @@
|
|
|
1
|
-
const DEFAULT_IPFS_URL = 'https://
|
|
2
|
-
|
|
1
|
+
const DEFAULT_IPFS_URL = 'https://ipfs.thegraph.com/ipfs/api/v0';
|
|
2
|
+
/**
|
|
3
|
+
* Validates supplied IPFS URL and provides warnings for deprecated/invalid URLs
|
|
4
|
+
* @param ipfsUrl - The IPFS URL to validate, can be undefined
|
|
5
|
+
* @returns An object with the validated URL and optional warning message
|
|
6
|
+
*/
|
|
7
|
+
export function getGraphIpfsUrl(ipfsUrl) {
|
|
8
|
+
if (!ipfsUrl) {
|
|
9
|
+
return { ipfsUrl: DEFAULT_IPFS_URL };
|
|
10
|
+
}
|
|
11
|
+
// trim trailing slash
|
|
12
|
+
ipfsUrl = ipfsUrl.replace(/\/+$/, '');
|
|
13
|
+
try {
|
|
14
|
+
new URL(ipfsUrl);
|
|
15
|
+
const deprecatedPatterns = [
|
|
16
|
+
/^https?:\/\/ipfs\.testnet\.thegraph\.com.*/,
|
|
17
|
+
/^https?:\/\/ipfs\.network\.thegraph\.com.*/,
|
|
18
|
+
/^https?:\/\/api\.thegraph\.com\/ipfs.*/,
|
|
19
|
+
];
|
|
20
|
+
const isDeprecated = deprecatedPatterns.some(pattern => pattern.test(ipfsUrl));
|
|
21
|
+
if (isDeprecated) {
|
|
22
|
+
return {
|
|
23
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
24
|
+
warning: `IPFS URL ${ipfsUrl} is deprecated. Using default URL instead: ${DEFAULT_IPFS_URL}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// if default URL - make sure it ends with /api/v0
|
|
28
|
+
if (DEFAULT_IPFS_URL.startsWith(ipfsUrl)) {
|
|
29
|
+
return {
|
|
30
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return { ipfsUrl };
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
return {
|
|
37
|
+
ipfsUrl: DEFAULT_IPFS_URL,
|
|
38
|
+
warning: `Invalid IPFS URL: ${ipfsUrl}. Using default URL instead: ${DEFAULT_IPFS_URL}`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/commands/build.js
CHANGED
|
@@ -2,6 +2,7 @@ import { filesystem } from 'gluegun';
|
|
|
2
2
|
import { Args, Command, Flags } from '@oclif/core';
|
|
3
3
|
import { createCompiler } from '../command-helpers/compiler.js';
|
|
4
4
|
import * as DataSourcesExtractor from '../command-helpers/data-sources.js';
|
|
5
|
+
import { getGraphIpfsUrl } from '../command-helpers/ipfs.js';
|
|
5
6
|
import { updateSubgraphNetwork } from '../command-helpers/network.js';
|
|
6
7
|
import debug from '../debug.js';
|
|
7
8
|
import Protocol from '../protocols/index.js';
|
|
@@ -66,8 +67,12 @@ export default class BuildCommand extends Command {
|
|
|
66
67
|
const identifierName = protocol.getContract().identifierName();
|
|
67
68
|
await updateSubgraphNetwork(manifest, network, networkFile, identifierName);
|
|
68
69
|
}
|
|
70
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
71
|
+
if (warning) {
|
|
72
|
+
this.warn(warning);
|
|
73
|
+
}
|
|
69
74
|
const compiler = createCompiler(manifest, {
|
|
70
|
-
ipfs,
|
|
75
|
+
ipfs: ipfsUrl,
|
|
71
76
|
outputDir,
|
|
72
77
|
outputFormat,
|
|
73
78
|
skipMigrations,
|
package/dist/commands/codegen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { Args, Command, Flags } from '@oclif/core';
|
|
3
3
|
import * as DataSourcesExtractor from '../command-helpers/data-sources.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getGraphIpfsUrl } from '../command-helpers/ipfs.js';
|
|
5
5
|
import { assertGraphTsVersion, assertManifestApiVersion } from '../command-helpers/version.js';
|
|
6
6
|
import debug from '../debug.js';
|
|
7
7
|
import Protocol from '../protocols/index.js';
|
|
@@ -37,7 +37,7 @@ export default class CodegenCommand extends Command {
|
|
|
37
37
|
ipfs: Flags.string({
|
|
38
38
|
summary: 'IPFS node to use for fetching subgraph data.',
|
|
39
39
|
char: 'i',
|
|
40
|
-
default:
|
|
40
|
+
default: getGraphIpfsUrl().ipfsUrl,
|
|
41
41
|
}),
|
|
42
42
|
'uncrashable-config': Flags.file({
|
|
43
43
|
summary: 'Directory for uncrashable config.',
|
|
@@ -70,6 +70,10 @@ export default class CodegenCommand extends Command {
|
|
|
70
70
|
catch (e) {
|
|
71
71
|
this.error(e, { exit: 1 });
|
|
72
72
|
}
|
|
73
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
74
|
+
if (warning) {
|
|
75
|
+
this.warn(warning);
|
|
76
|
+
}
|
|
73
77
|
const generator = new TypeGenerator({
|
|
74
78
|
subgraphManifest: manifest,
|
|
75
79
|
outputDir,
|
|
@@ -78,7 +82,7 @@ export default class CodegenCommand extends Command {
|
|
|
78
82
|
uncrashable,
|
|
79
83
|
subgraphSources,
|
|
80
84
|
uncrashableConfig: uncrashableConfig || 'uncrashable-config.yaml',
|
|
81
|
-
ipfsUrl
|
|
85
|
+
ipfsUrl,
|
|
82
86
|
});
|
|
83
87
|
// Watch working directory for file updates or additions, trigger
|
|
84
88
|
// type generation (if watch argument specified)
|
package/dist/commands/deploy.js
CHANGED
|
@@ -3,9 +3,9 @@ import { URL } from 'node:url';
|
|
|
3
3
|
import { print, prompt } from 'gluegun';
|
|
4
4
|
import { Args, Command, Flags } from '@oclif/core';
|
|
5
5
|
import { identifyDeployKey } from '../command-helpers/auth.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createCompiler } from '../command-helpers/compiler.js';
|
|
7
7
|
import * as DataSourcesExtractor from '../command-helpers/data-sources.js';
|
|
8
|
-
import {
|
|
8
|
+
import { getGraphIpfsUrl } from '../command-helpers/ipfs.js';
|
|
9
9
|
import { createJsonRpcClient } from '../command-helpers/jsonrpc.js';
|
|
10
10
|
import { updateSubgraphNetwork } from '../command-helpers/network.js';
|
|
11
11
|
import { chooseNodeUrl } from '../command-helpers/node.js';
|
|
@@ -55,7 +55,7 @@ export default class DeployCommand extends Command {
|
|
|
55
55
|
ipfs: Flags.string({
|
|
56
56
|
summary: 'Upload build results to an IPFS node.',
|
|
57
57
|
char: 'i',
|
|
58
|
-
default:
|
|
58
|
+
default: getGraphIpfsUrl().ipfsUrl,
|
|
59
59
|
}),
|
|
60
60
|
'ipfs-hash': Flags.string({
|
|
61
61
|
summary: 'IPFS hash of the subgraph manifest to deploy.',
|
|
@@ -190,9 +190,12 @@ export default class DeployCommand extends Command {
|
|
|
190
190
|
};
|
|
191
191
|
// we are provided the IPFS hash, so we deploy directly
|
|
192
192
|
if (ipfsHash) {
|
|
193
|
-
|
|
193
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
194
|
+
if (warning) {
|
|
195
|
+
this.warn(warning);
|
|
196
|
+
}
|
|
194
197
|
const ipfsClient = createIpfsClient({
|
|
195
|
-
url:
|
|
198
|
+
url: ipfsUrl,
|
|
196
199
|
headers: {
|
|
197
200
|
...headers,
|
|
198
201
|
...GRAPH_CLI_SHARED_HEADERS,
|
|
@@ -231,8 +234,12 @@ export default class DeployCommand extends Command {
|
|
|
231
234
|
const identifierName = protocol.getContract().identifierName();
|
|
232
235
|
await updateSubgraphNetwork(manifest, network, networkFile, identifierName);
|
|
233
236
|
}
|
|
237
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
238
|
+
if (warning) {
|
|
239
|
+
this.warn(warning);
|
|
240
|
+
}
|
|
234
241
|
const compiler = createCompiler(manifest, {
|
|
235
|
-
ipfs,
|
|
242
|
+
ipfs: ipfsUrl,
|
|
236
243
|
headers,
|
|
237
244
|
outputDir,
|
|
238
245
|
outputFormat: 'wasm',
|
package/dist/commands/init.js
CHANGED
|
@@ -3,10 +3,9 @@ import os from 'node:os';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { filesystem, print, prompt, system } from 'gluegun';
|
|
5
5
|
import { Args, Command, Flags } from '@oclif/core';
|
|
6
|
-
import { appendApiVersionForGraph } from '../command-helpers/compiler.js';
|
|
7
6
|
import { ContractService } from '../command-helpers/contracts.js';
|
|
8
7
|
import { resolveFile } from '../command-helpers/file-resolver.js';
|
|
9
|
-
import {
|
|
8
|
+
import { getGraphIpfsUrl } from '../command-helpers/ipfs.js';
|
|
10
9
|
import { initNetworksConfig } from '../command-helpers/network.js';
|
|
11
10
|
import { chooseNodeUrl } from '../command-helpers/node.js';
|
|
12
11
|
import { PromptManager } from '../command-helpers/prompt-manager.js';
|
|
@@ -100,7 +99,7 @@ export default class InitCommand extends Command {
|
|
|
100
99
|
ipfs: Flags.string({
|
|
101
100
|
summary: 'IPFS node to use for fetching subgraph data.',
|
|
102
101
|
char: 'i',
|
|
103
|
-
default:
|
|
102
|
+
default: getGraphIpfsUrl().ipfsUrl,
|
|
104
103
|
}),
|
|
105
104
|
};
|
|
106
105
|
async run() {
|
|
@@ -145,6 +144,10 @@ export default class InitCommand extends Command {
|
|
|
145
144
|
codegen: yarn ? 'yarn codegen' : 'npm run codegen',
|
|
146
145
|
deploy: yarn ? 'yarn deploy' : 'npm run deploy',
|
|
147
146
|
};
|
|
147
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
148
|
+
if (warning) {
|
|
149
|
+
this.warn(warning);
|
|
150
|
+
}
|
|
148
151
|
// If all parameters are provided from the command-line,
|
|
149
152
|
// go straight to creating the subgraph from the example
|
|
150
153
|
if (fromExample && subgraphName && directory) {
|
|
@@ -221,7 +224,7 @@ export default class InitCommand extends Command {
|
|
|
221
224
|
spkgPath,
|
|
222
225
|
skipInstall,
|
|
223
226
|
skipGit,
|
|
224
|
-
ipfsUrl
|
|
227
|
+
ipfsUrl,
|
|
225
228
|
}, { commands, addContract: false });
|
|
226
229
|
// Exit with success
|
|
227
230
|
return this.exit(0);
|
|
@@ -255,11 +258,15 @@ export default class InitCommand extends Command {
|
|
|
255
258
|
contractName,
|
|
256
259
|
startBlock,
|
|
257
260
|
spkgPath,
|
|
258
|
-
ipfsUrl
|
|
261
|
+
ipfsUrl,
|
|
259
262
|
});
|
|
260
263
|
if (!answers) {
|
|
261
264
|
this.exit(1);
|
|
262
265
|
}
|
|
266
|
+
const { ipfsUrl: suppliedIpfsUrl, warning } = getGraphIpfsUrl(answers.ipfs);
|
|
267
|
+
if (warning) {
|
|
268
|
+
this.warn(warning);
|
|
269
|
+
}
|
|
263
270
|
await initSubgraphFromContract.bind(this)({
|
|
264
271
|
protocolInstance: answers.protocolInstance,
|
|
265
272
|
subgraphName: answers.subgraphName,
|
|
@@ -274,7 +281,7 @@ export default class InitCommand extends Command {
|
|
|
274
281
|
spkgPath: answers.spkgPath,
|
|
275
282
|
skipInstall,
|
|
276
283
|
skipGit,
|
|
277
|
-
ipfsUrl:
|
|
284
|
+
ipfsUrl: suppliedIpfsUrl,
|
|
278
285
|
}, { commands, addContract: true });
|
|
279
286
|
if (answers.cleanup) {
|
|
280
287
|
answers.cleanup();
|
|
@@ -889,7 +896,7 @@ async function initSubgraphFromContract({ protocolInstance, subgraphName, direct
|
|
|
889
896
|
if (isComposedSubgraph) {
|
|
890
897
|
try {
|
|
891
898
|
const ipfsClient = createIpfsClient({
|
|
892
|
-
url:
|
|
899
|
+
url: ipfsUrl,
|
|
893
900
|
headers: {
|
|
894
901
|
...GRAPH_CLI_SHARED_HEADERS,
|
|
895
902
|
},
|
package/dist/commands/publish.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Args, Command, Flags, ux } from '@oclif/core';
|
|
|
5
5
|
import { URL, URLSearchParams } from '@whatwg-node/fetch';
|
|
6
6
|
import { createCompiler } from '../command-helpers/compiler.js';
|
|
7
7
|
import * as DataSourcesExtractor from '../command-helpers/data-sources.js';
|
|
8
|
-
import {
|
|
8
|
+
import { getGraphIpfsUrl } from '../command-helpers/ipfs.js';
|
|
9
9
|
import Protocol from '../protocols/index.js';
|
|
10
10
|
export default class PublishCommand extends Command {
|
|
11
11
|
static description = 'Publish to the Graph Network';
|
|
@@ -31,7 +31,7 @@ export default class PublishCommand extends Command {
|
|
|
31
31
|
ipfs: Flags.string({
|
|
32
32
|
summary: 'Upload build results to an IPFS node.',
|
|
33
33
|
char: 'i',
|
|
34
|
-
default:
|
|
34
|
+
default: getGraphIpfsUrl().ipfsUrl,
|
|
35
35
|
}),
|
|
36
36
|
'ipfs-hash': Flags.string({
|
|
37
37
|
summary: 'IPFS hash of the subgraph manifest to deploy.',
|
|
@@ -88,6 +88,10 @@ export default class PublishCommand extends Command {
|
|
|
88
88
|
if (subgraphId && !apiKey) {
|
|
89
89
|
ux.error('API key is required to publish to an existing subgraph (`--api-key`).\nSee https://thegraph.com/docs/en/deploying/subgraph-studio-faqs/#2-how-do-i-create-an-api-key', { exit: 1 });
|
|
90
90
|
}
|
|
91
|
+
const { ipfsUrl, warning } = getGraphIpfsUrl(ipfs);
|
|
92
|
+
if (warning) {
|
|
93
|
+
this.warn(warning);
|
|
94
|
+
}
|
|
91
95
|
if (ipfsHash) {
|
|
92
96
|
await this.publishWithBrowser({
|
|
93
97
|
ipfsHash,
|
|
@@ -107,7 +111,7 @@ export default class PublishCommand extends Command {
|
|
|
107
111
|
this.error(e, { exit: 1 });
|
|
108
112
|
}
|
|
109
113
|
const compiler = createCompiler(manifest, {
|
|
110
|
-
ipfs,
|
|
114
|
+
ipfs: ipfsUrl,
|
|
111
115
|
outputDir: 'build/',
|
|
112
116
|
outputFormat: 'wasm',
|
|
113
117
|
skipMigrations: false,
|
package/dist/type-generator.js
CHANGED
|
@@ -8,8 +8,8 @@ import prettier from 'prettier';
|
|
|
8
8
|
import uncrashable from '@float-capital/float-subgraph-uncrashable/src/Index.bs.js';
|
|
9
9
|
import DataSourceTemplateCodeGenerator from './codegen/template.js';
|
|
10
10
|
import { GENERATED_FILE_NOTE } from './codegen/typescript.js';
|
|
11
|
-
import { appendApiVersionForGraph } from './command-helpers/compiler.js';
|
|
12
11
|
import { displayPath } from './command-helpers/fs.js';
|
|
12
|
+
import { getGraphIpfsUrl } from './command-helpers/ipfs.js';
|
|
13
13
|
import { step, withSpinner } from './command-helpers/spinner.js';
|
|
14
14
|
import { GRAPH_CLI_SHARED_HEADERS } from './constants.js';
|
|
15
15
|
import debug from './debug.js';
|
|
@@ -79,7 +79,7 @@ export default class TypeGenerator {
|
|
|
79
79
|
}
|
|
80
80
|
if (this.options.subgraphSources.length > 0) {
|
|
81
81
|
const ipfsClient = createIpfsClient({
|
|
82
|
-
url:
|
|
82
|
+
url: getGraphIpfsUrl(this.options.ipfsUrl.toString()).ipfsUrl,
|
|
83
83
|
headers: {
|
|
84
84
|
...GRAPH_CLI_SHARED_HEADERS,
|
|
85
85
|
},
|
package/oclif.manifest.json
CHANGED
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
"char": "i",
|
|
291
291
|
"name": "ipfs",
|
|
292
292
|
"summary": "IPFS node to use for fetching subgraph data.",
|
|
293
|
-
"default": "https://
|
|
293
|
+
"default": "https://ipfs.thegraph.com/ipfs/api/v0",
|
|
294
294
|
"hasDynamicHelp": false,
|
|
295
295
|
"multiple": false,
|
|
296
296
|
"type": "option"
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
"char": "i",
|
|
441
441
|
"name": "ipfs",
|
|
442
442
|
"summary": "Upload build results to an IPFS node.",
|
|
443
|
-
"default": "https://
|
|
443
|
+
"default": "https://ipfs.thegraph.com/ipfs/api/v0",
|
|
444
444
|
"hasDynamicHelp": false,
|
|
445
445
|
"multiple": false,
|
|
446
446
|
"type": "option"
|
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
"char": "i",
|
|
668
668
|
"name": "ipfs",
|
|
669
669
|
"summary": "IPFS node to use for fetching subgraph data.",
|
|
670
|
-
"default": "https://
|
|
670
|
+
"default": "https://ipfs.thegraph.com/ipfs/api/v0",
|
|
671
671
|
"hasDynamicHelp": false,
|
|
672
672
|
"multiple": false,
|
|
673
673
|
"type": "option"
|
|
@@ -842,7 +842,7 @@
|
|
|
842
842
|
"char": "i",
|
|
843
843
|
"name": "ipfs",
|
|
844
844
|
"summary": "Upload build results to an IPFS node.",
|
|
845
|
-
"default": "https://
|
|
845
|
+
"default": "https://ipfs.thegraph.com/ipfs/api/v0",
|
|
846
846
|
"hasDynamicHelp": false,
|
|
847
847
|
"multiple": false,
|
|
848
848
|
"type": "option"
|
|
@@ -1017,5 +1017,5 @@
|
|
|
1017
1017
|
]
|
|
1018
1018
|
}
|
|
1019
1019
|
},
|
|
1020
|
-
"version": "0.97.
|
|
1020
|
+
"version": "0.97.2-alpha-20250623231415-dc97cb5879fcc8866ed63acd88b17e966577c678"
|
|
1021
1021
|
}
|
package/package.json
CHANGED