From 9289f456d909885fe40f0199d7b3d775066a5905 Mon Sep 17 00:00:00 2001 From: nikdementev Date: Wed, 9 Jun 2021 17:20:37 +0300 Subject: [PATCH] feat: codegen for instance & proxy --- mustache/templates/base/index.js | 2 +- mustache/templates/instance/create-yaml.js | 5 +++-- mustache/templates/instance/index.js | 2 +- mustache/templates/proxy/index.js | 2 +- package.json | 2 ++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mustache/templates/base/index.js b/mustache/templates/base/index.js index 0f0197d..7739720 100644 --- a/mustache/templates/base/index.js +++ b/mustache/templates/base/index.js @@ -2,7 +2,7 @@ module.exports = { yaml: [ { specVersion: '0.0.2', - repository: 'https://github.com/Synthetixio/synthetix-subgraph', + repository: 'https://github.com/tornadocash/tornado-subgraph', dataSourceKind: 'ethereum/contract', mapping: { kind: 'ethereum/events', diff --git a/mustache/templates/instance/create-yaml.js b/mustache/templates/instance/create-yaml.js index 7046a61..2139f84 100644 --- a/mustache/templates/instance/create-yaml.js +++ b/mustache/templates/instance/create-yaml.js @@ -6,8 +6,9 @@ const Contracts = require('./contracts'); module.exports = { createYaml: (env) => { - const createInstanceBlock = ({ name, startBlocks, address }) => ({ + const createInstanceBlock = ({ name, network, startBlocks, address }) => ({ name, + network, mappingFile: '../src/mapping-instance.ts', startBlock: startBlocks.prod, address, @@ -16,7 +17,7 @@ module.exports = { abis: [ { name: 'Instance', - file: '../abis/Instance.json' + path: '../abis/Instance.json' } ], events: [ diff --git a/mustache/templates/instance/index.js b/mustache/templates/instance/index.js index 6c87df4..8b8315e 100644 --- a/mustache/templates/instance/index.js +++ b/mustache/templates/instance/index.js @@ -1,4 +1,4 @@ module.exports = { description: 'Instance', - schemaFile: './schema.graphql', + schemaFile: '../schema.graphql', }; diff --git a/mustache/templates/proxy/index.js b/mustache/templates/proxy/index.js index 3046f6a..2ff55f4 100644 --- a/mustache/templates/proxy/index.js +++ b/mustache/templates/proxy/index.js @@ -1,4 +1,4 @@ module.exports = { description: 'Proxy', - schemaFile: './schema.graphql', + schemaFile: '../schema.graphql', }; diff --git a/package.json b/package.json index d51170c..8a22887 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "build": "graph build", "yaml:proxy": "node ./create-yaml-file create-yaml -s proxy -e bsc | mustache - mustache/yaml.mustache > subgraphs/proxy-tornado-subgraph.yaml", "yaml:instance": "node ./create-yaml-file create-yaml -s instance -e bsc | mustache - mustache/yaml.mustache > subgraphs/instance-tornado-subgraph.yaml", + "codegen:proxy": "yarn yaml:proxy && yarn codegen -- subgraphs/proxy-tornado-subgraph.yaml", + "codegen:instance": "yarn yaml:instance && yarn codegen -- subgraphs/instance-tornado-subgraph.yaml", "deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ tornadocash/bsc-tornado-subgraph" }, "dependencies": {