Skip to content

Commit

Permalink
add ethereum to CLI and Validator (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
guplersaxanoid authored Nov 3, 2022
1 parent fe4896e commit 18e9b12
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@subql/common-algorand": "latest",
"@subql/common-avalanche": "latest",
"@subql/common-cosmos": "latest",
"@subql/common-ethereum": "latest",
"@subql/common-substrate": "workspace:*",
"@subql/common-terra": "latest",
"@subql/utils": "workspace:*",
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/controller/publish-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {ReaderFactory, IPFS_CLUSTER_ENDPOINT, getProjectRootAndManifest} from '@
import {parseAlgorandProjectManifest} from '@subql/common-algorand';
import {parseSubstrateProjectManifest as parseAvalancheProjectManifest} from '@subql/common-avalanche';
import {parseCosmosProjectManifest} from '@subql/common-cosmos';
import {parseEthereumProjectManifest} from '@subql/common-ethereum';
import {parseSubstrateProjectManifest, manifestIsV0_0_1} from '@subql/common-substrate';
import {parseTerraProjectManifest} from '@subql/common-terra';
import {FileReference} from '@subql/types';
Expand Down Expand Up @@ -52,7 +53,11 @@ export async function uploadToIpfs(projectPath: string, authToken: string, ipfsE
try {
manifest = parseAlgorandProjectManifest(schema).asImpl;
} catch (e) {
throw new Error('Unable to pass project manifest');
try {
manifest = parseEthereumProjectManifest(schema).asImpl;
} catch (e) {
throw new Error('Unable to pass project manifest');
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum NETWORK_FAMILY {
terra = 'Terra',
cosmos = 'Cosmos',
algorand = 'Algorand',
ethereum = 'Ethereum',
}

export const runnerMapping = {
Expand Down
1 change: 1 addition & 0 deletions packages/validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@subql/common-cosmos": "latest",
"@subql/common-substrate": "workspace:*",
"@subql/common-terra": "latest",
"@subql/common-ethereum": "latest",
"axios": "^0.24.0",
"js-yaml": "^4.1.0",
"package-json-type": "^1.0.3"
Expand Down
4 changes: 3 additions & 1 deletion packages/validator/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Reader} from '@subql/common';
import {AlgorandProjectManifestVersioned} from '@subql/common-algorand';
import {SubstrateProjectManifestVersioned as AvalancheProjectManifestVersioned} from '@subql/common-avalanche';
import {CosmosProjectManifestVersioned} from '@subql/common-cosmos';
import {EthereumProjectManifestVersioned} from '@subql/common-ethereum';
import {SubstrateProjectManifestVersioned} from '@subql/common-substrate';
import {TerraProjectManifestVersioned} from '@subql/common-terra';
import {IPackageJson} from 'package-json-type';
Expand All @@ -17,7 +18,8 @@ export interface ContextData {
| TerraProjectManifestVersioned
| CosmosProjectManifestVersioned
| AvalancheProjectManifestVersioned
| AlgorandProjectManifestVersioned;
| AlgorandProjectManifestVersioned
| EthereumProjectManifestVersioned;
}

export interface Context {
Expand Down
4 changes: 4 additions & 0 deletions packages/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {getProjectNetwork, NETWORK_FAMILY, Reader, ReaderFactory, ReaderOptions}
import {parseAlgorandProjectManifest} from '@subql/common-algorand';
import {parseSubstrateProjectManifest as parseAvalancheProjectManifest} from '@subql/common-avalanche';
import {parseCosmosProjectManifest} from '@subql/common-cosmos';
import {parseEthereumProjectManifest} from '@subql/common-ethereum';
import {parseSubstrateProjectManifest} from '@subql/common-substrate';
import {parseTerraProjectManifest} from '@subql/common-terra';

Expand Down Expand Up @@ -76,6 +77,9 @@ export class Validator {
case NETWORK_FAMILY.algorand:
schema = parseAlgorandProjectManifest(rawSchema);
break;
case NETWORK_FAMILY.ethereum:
schema = parseEthereumProjectManifest(rawSchema);
break;
default:
console.error(`Load project failed, please check the manifest file.`);
break;
Expand Down
34 changes: 34 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3608,6 +3608,7 @@ __metadata:
"@subql/common-algorand": latest
"@subql/common-avalanche": latest
"@subql/common-cosmos": latest
"@subql/common-ethereum": latest
"@subql/common-substrate": "workspace:*"
"@subql/common-terra": latest
"@subql/utils": "workspace:*"
Expand Down Expand Up @@ -3693,6 +3694,28 @@ __metadata:
languageName: node
linkType: hard

"@subql/common-ethereum@npm:latest":
version: 0.1.0
resolution: "@subql/common-ethereum@npm:0.1.0"
dependencies:
"@polkadot/util": ^8
"@subql/common": latest
"@subql/types-ethereum": 0.1.0
bn.js: 4.11.6
class-transformer: 0.4.0
class-validator: ^0.13.2
flatted: ^3.2.2
graphql: ^15.7.2
graphql-tag: ^2.12.5
js-yaml: ^4.1.0
pino: ^6.13.3
reflect-metadata: ^0.1.13
sequelize: ^6.6.2
vm2: ^3.9.9
checksum: 2f58471ba3d097d48e13304381c5e416dd48bc5f5a766b524ad2ed61d7945accc532947a1f48e07c887e3e4202ea8773b1aab45ca427682482c407badf4bb788
languageName: node
linkType: hard

"@subql/common-substrate@workspace:*, @subql/common-substrate@workspace:packages/common-substrate":
version: 0.0.0-use.local
resolution: "@subql/common-substrate@workspace:packages/common-substrate"
Expand Down Expand Up @@ -3910,6 +3933,17 @@ __metadata:
languageName: node
linkType: hard

"@subql/types-ethereum@npm:0.1.0":
version: 0.1.0
resolution: "@subql/types-ethereum@npm:0.1.0"
dependencies:
"@ethersproject/abstract-provider": ^5.6.1
peerDependencies:
"@polkadot/api": ^9
checksum: 665004b9adfc66a6463dd879a3d6e9aaabde13a7ee3013df6a3cd64caa806ba136a44db39c607dce57fd5aa8df61de2d7a9837917e0294ac35f0f958fab03d94
languageName: node
linkType: hard

"@subql/types-terra@npm:0.4.0":
version: 0.4.0
resolution: "@subql/types-terra@npm:0.4.0"
Expand Down

0 comments on commit 18e9b12

Please sign in to comment.