-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate to TheGraph Studio (#95)
Co-authored-by: MantisClone <[email protected]>
- Loading branch information
1 parent
cb9e380
commit c9b43c4
Showing
13 changed files
with
240 additions
and
792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
NETWORK=goerli | ||
WEB3_URL=https://goerli.infura.io/v3/xxx | ||
NETWORK=sepolia | ||
WEB3_URL=https://sepolia.infura.io/v3/xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,46 @@ | ||
import yargs from "yargs"; | ||
import { deploySubgraph } from "../lib/deploy"; | ||
import networks from "../networks.json"; | ||
import { defaultGraphNodeInfo, graphNodeInfoByNetwork } from "../graph-nodes"; | ||
import { graphNodeInfoByNetwork } from "../graph-nodes"; | ||
|
||
export const command = "deploy [network..]"; | ||
export const desc = "Deploys one subgraph"; | ||
export const builder = (y: yargs.Argv) => | ||
y | ||
.middleware(argv => { | ||
if (process.env.TOKEN) argv.token = process.env.TOKEN; | ||
if (process.env.VERSION) argv.version = process.env.VERSION; | ||
if (process.env.DEPLOY_KEY) argv["deploy-key"] = process.env.DEPLOY_KEY; | ||
if (process.env.VERSION_LABEL) | ||
argv["version-label"] = process.env.VERSION_LABEL; | ||
}, true) | ||
.positional("network", { | ||
desc: "The network to deploy to", | ||
type: "string", | ||
array: true, | ||
choices: networks, | ||
}) | ||
.option("all", { | ||
desc: "Deploy on all networks", | ||
type: "boolean", | ||
}) | ||
.option("token", { | ||
desc: "TheGraph token", | ||
.option("deploy-key", { | ||
desc: "Graph Node deploy key", | ||
type: "string", | ||
}) | ||
.check(({ all, network }) => { | ||
if (all && network) | ||
throw new Error("Cannot specify both -all and positional `network`"); | ||
if (all || network) return true; | ||
throw new Error("One of --all or positional `network` must be specified"); | ||
.option("version-label", { | ||
desc: "The version of the deployed subgraph", | ||
type: "string", | ||
}); | ||
|
||
export const handler = ({ | ||
network, | ||
token, | ||
all, | ||
["deploy-key"]: deployKey, | ||
["version-label"]: versionLabel, | ||
}: Awaited<ReturnType<typeof builder>["argv"]>) => { | ||
const networkList = all ? networks : network || []; | ||
const options = token | ||
? { | ||
"access-token": token, | ||
} | ||
: undefined; | ||
const networkList = network || []; | ||
for (const net of networkList) { | ||
console.log(`Deploy on ${net}`); | ||
deploySubgraph( | ||
`requestnetwork/request-payments-${net}`, | ||
`./subgraph.${net}.yaml`, | ||
{ | ||
ipfs: graphNodeInfoByNetwork[net]?.ipfs || defaultGraphNodeInfo.ipfs, | ||
node: `${graphNodeInfoByNetwork[net]?.deploy || | ||
defaultGraphNodeInfo.deploy}`, | ||
}, | ||
options, | ||
); | ||
deploySubgraph(`request-payments-${net}`, `./subgraph.${net}.yaml`, { | ||
"deploy-key": deployKey, | ||
ipfs: graphNodeInfoByNetwork[net]?.ipfs, | ||
node: graphNodeInfoByNetwork[net]?.deploy, | ||
product: deployKey ? "subgraph-studio" : undefined, | ||
"version-label": versionLabel, | ||
}); | ||
} | ||
}; |
Oops, something went wrong.