Skip to content

Commit a707cb1

Browse files
authored
init, deploy: Allow Studio to have Rinkeby subgraphs (#752)
* init, deploy: Allow Studio to have Rinkeby subgraphs When the Studio got launched, all networks were available for it, but it wasn't/isn't useful, because we only index Ethereum mainnet and Rinkeby for it. So we've added the limitation just for Ethereum mainnet. However Rinkeby was missing and this commit fixes the issue. * 0.22.2
1 parent 6b6b01c commit a707cb1

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/graph-cli",
3-
"version": "0.22.1",
3+
"version": "0.22.2",
44
"description": "CLI for building for and deploying to The Graph",
55
"dependencies": {
66
"assemblyscript": "0.19.10",

src/command-helpers/studio.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
const allowedStudioNetworks = ['mainnet', 'rinkeby']
2+
13
const validateStudioNetwork = ({ studio, product, network }) => {
24
let isStudio = studio || product === 'subgraph-studio'
3-
let isEthereumMainnet = network === 'mainnet'
5+
let isAllowedNetwork = allowedStudioNetworks.includes(network)
46

5-
if (isStudio && !isEthereumMainnet) {
6-
throw new Error(`Non Ethereum mainnet subgraphs should not be deployed to the studio`)
7+
if (isStudio && !isAllowedNetwork) {
8+
throw new Error(`The Subgraph Studio only allows subgraphs for these networks: ${allowedStudioNetworks.join(', ')}`)
79
}
810
}
911

1012
module.exports = {
13+
allowedStudioNetworks,
1114
validateStudioNetwork,
1215
}

src/command-helpers/studio.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { validateStudioNetwork } = require('./studio')
1+
const { validateStudioNetwork, allowedStudioNetworks } = require('./studio')
22

33
describe('Version Command Helpers', () => {
44
describe('validateStudioNetwork', () => {
@@ -9,26 +9,26 @@ describe('Version Command Helpers', () => {
99
network: 'mainnet',
1010
}))
1111
.not
12-
.toThrow(new Error('Non Ethereum mainnet subgraphs should not be deployed to the studio'))
12+
.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${allowedStudioNetworks.join(', ')}`))
1313
})
1414

1515
test("And it's NOT Ethereum mainnet", () => {
1616
expect(() => validateStudioNetwork({
1717
product: 'subgraph-studio',
1818
network: 'xdai',
1919
}))
20-
.toThrow(new Error('Non Ethereum mainnet subgraphs should not be deployed to the studio'))
20+
.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${allowedStudioNetworks.join(', ')}`))
2121
})
2222
})
2323

2424
describe("When it's NOT studio", () => {
25-
test("And it's Ethereum mainnet", () => {
25+
test("And it's Rinkeby", () => {
2626
expect(() => validateStudioNetwork({
2727
studio: false,
28-
network: 'mainnet',
28+
network: 'rinkeby',
2929
}))
3030
.not
31-
.toThrow(new Error('Non Ethereum mainnet subgraphs should not be deployed to the studio'))
31+
.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${allowedStudioNetworks.join(', ')}`))
3232
})
3333

3434
test("And it's NOT Ethereum mainnet", () => {
@@ -37,7 +37,7 @@ describe('Version Command Helpers', () => {
3737
network: 'xdai',
3838
}))
3939
.not
40-
.toThrow(new Error('Non Ethereum mainnet subgraphs should not be deployed to the studio'))
40+
.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${allowedStudioNetworks.join(', ')}`))
4141
})
4242
})
4343
})

0 commit comments

Comments
 (0)