Skip to content

Commit

Permalink
Merge branch 'subquery:main' into main
Browse files Browse the repository at this point in the history
AK46rocks authored Apr 13, 2024
2 parents 53daf60 + 7e9a725 commit 45dca92
Showing 45 changed files with 861 additions and 1,242 deletions.
Empty file added .yarn/versions/12f2ee2a.yml
Empty file.
2 changes: 2 additions & 0 deletions .yarn/versions/2eebe132.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
undecided:
- "@subql/node-core"
2 changes: 2 additions & 0 deletions .yarn/versions/7c0eab27.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
undecided:
- "@subql/node-core"
2 changes: 2 additions & 0 deletions .yarn/versions/ca56439e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
undecided:
- "@subql/node-core"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
"@types/cron-converter": "^1",
"@types/node": "^18.16.10",
"@types/node-fetch": "2.6.2",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"@typescript-eslint/eslint-plugin": "5",
"@typescript-eslint/parser": "5",
"babel-jest": "^29.5.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
11 changes: 10 additions & 1 deletion packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.5.2] - 2024-04-12
### Fixed
- Deployments failing with `this.jsonEnabled is not a function` (#2351)

## [4.5.1] - 2024-04-11
### Fixed
- Upgrade common dependencies in cli in order to fix build missing `GetOptions` issue

## [4.5.0] - 2024-03-28
### Added
@@ -553,7 +560,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- support subcommand codegen
- support subcommand init

[Unreleased]: https://github.com/subquery/subql/compare/cli/4.5.0...HEAD
[Unreleased]: https://github.com/subquery/subql/compare/cli/4.5.2...HEAD
[4.5.2]: https://github.com/subquery/subql/compare/cli/4.5.1...cli/4.5.2
[4.5.1]: https://github.com/subquery/subql/compare/cli/4.5.0...cli/4.5.1
[4.5.0]: https://github.com/subquery/subql/compare/cli/4.4.1...cli/4.5.0
[4.4.1]: https://github.com/subquery/subql/compare/cli/4.4.0...cli/4.4.1
[4.4.0]: https://github.com/subquery/subql/compare/cli/4.3.0...cli/4.4.0
30 changes: 15 additions & 15 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ $ npm install -g @subql/cli
$ subql COMMAND
running command...
$ subql (--version)
@subql/cli/4.4.2-1 linux-x64 node-v18.19.1
@subql/cli/4.5.2-0 linux-x64 node-v18.20.1
$ subql --help [COMMAND]
USAGE
$ subql COMMAND
@@ -70,7 +70,7 @@ DESCRIPTION
Build this SubQuery project code
```

_See code: [lib/commands/build/index.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/build/index.js)_
_See code: [lib/commands/build/index.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/build/index.js)_

## `subql codegen`

@@ -88,7 +88,7 @@ DESCRIPTION
Generate schemas for graph node
```

_See code: [lib/commands/codegen/index.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/codegen/index.js)_
_See code: [lib/commands/codegen/index.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/codegen/index.js)_

## `subql codegen:generate`

@@ -111,7 +111,7 @@ DESCRIPTION
Generate Project.yaml and mapping functions based on provided ABI
```

_See code: [lib/commands/codegen/generate.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/codegen/generate.js)_
_See code: [lib/commands/codegen/generate.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/codegen/generate.js)_

## `subql deployment`

@@ -159,7 +159,7 @@ DESCRIPTION
Deploy to hosted service
```

_See code: [lib/commands/deployment/index.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/deployment/index.js)_
_See code: [lib/commands/deployment/index.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/deployment/index.js)_

## `subql deployment:delete`

@@ -178,7 +178,7 @@ DESCRIPTION
Delete Deployment
```

_See code: [lib/commands/deployment/delete.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/deployment/delete.js)_
_See code: [lib/commands/deployment/delete.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/deployment/delete.js)_

## `subql deployment:deploy`

@@ -222,7 +222,7 @@ DESCRIPTION
Deployment to hosted service
```

_See code: [lib/commands/deployment/deploy.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/deployment/deploy.js)_
_See code: [lib/commands/deployment/deploy.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/deployment/deploy.js)_

## `subql deployment:promote`

@@ -241,7 +241,7 @@ DESCRIPTION
Promote Deployment
```

_See code: [lib/commands/deployment/promote.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/deployment/promote.js)_
_See code: [lib/commands/deployment/promote.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/deployment/promote.js)_

## `subql init [PROJECTNAME]`

@@ -265,7 +265,7 @@ DESCRIPTION
Initialize a scaffold subquery project
```

_See code: [lib/commands/init.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/init.js)_
_See code: [lib/commands/init.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/init.js)_

## `subql multi-chain:add`

@@ -284,7 +284,7 @@ DESCRIPTION
Add new chain manifest to multi-chain configuration
```

_See code: [lib/commands/multi-chain/add.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/multi-chain/add.js)_
_See code: [lib/commands/multi-chain/add.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/multi-chain/add.js)_

## `subql multi-chain:deploy`

@@ -331,7 +331,7 @@ DESCRIPTION
Multi-chain deployment to hosted service
```

_See code: [lib/commands/multi-chain/deploy.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/multi-chain/deploy.js)_
_See code: [lib/commands/multi-chain/deploy.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/multi-chain/deploy.js)_

## `subql project`

@@ -357,7 +357,7 @@ DESCRIPTION
Create/Delete project
```

_See code: [lib/commands/project/index.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/project/index.js)_
_See code: [lib/commands/project/index.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/project/index.js)_

## `subql project:create-project`

@@ -382,7 +382,7 @@ DESCRIPTION
Create Project on Hosted Service
```

_See code: [lib/commands/project/create-project.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/project/create-project.js)_
_See code: [lib/commands/project/create-project.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/project/create-project.js)_

## `subql project:delete-project`

@@ -400,7 +400,7 @@ DESCRIPTION
Delete Project on Hosted Service
```

_See code: [lib/commands/project/delete-project.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/project/delete-project.js)_
_See code: [lib/commands/project/delete-project.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/project/delete-project.js)_

## `subql publish`

@@ -419,6 +419,6 @@ DESCRIPTION
Upload this SubQuery project to IPFS
```

_See code: [lib/commands/publish.js](https://github.com/packages/cli/blob/v4.4.2-1/lib/commands/publish.js)_
_See code: [lib/commands/publish.js](https://github.com/packages/cli/blob/v4.5.2-0/lib/commands/publish.js)_

<!-- commandsstop -->
16 changes: 8 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@subql/cli",
"description": "cli for subquery",
"version": "4.5.0",
"version": "4.5.2",
"author": "Ian He",
"bin": {
"subql": "./bin/run"
@@ -10,13 +10,13 @@
"dependencies": {
"@oclif/core": "^2.15.0",
"@subql/common": "workspace:*",
"@subql/common-algorand": "^3.1.0",
"@subql/common-concordium": "^3.3.2",
"@subql/common-cosmos": "^4.0.1",
"@subql/common-ethereum": "^3.3.0",
"@subql/common-flare": "^3.1.0",
"@subql/common-near": "^3.0.1",
"@subql/common-stellar": "^3.0.0",
"@subql/common-algorand": "^3.3.0",
"@subql/common-concordium": "^3.5.1",
"@subql/common-cosmos": "^4.2.0",
"@subql/common-ethereum": "^3.5.0",
"@subql/common-flare": "^3.5.0",
"@subql/common-near": "^3.4.0",
"@subql/common-stellar": "^3.4.1",
"@subql/common-substrate": "workspace:*",
"@subql/utils": "workspace:*",
"algosdk": "^1.19.0",
15 changes: 4 additions & 11 deletions packages/cli/src/commands/deployment/deploy.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ import {
ipfsCID_validate,
processEndpoints,
projectsInfo,
splitEndpoints
splitEndpoints,
} from '../../controller/deploy-controller';
import {V3DeploymentIndexerType} from '../../types';
import {addV, checkToken, promptWithDefaultValues, valueOrPrompt} from '../../utils';
@@ -111,29 +111,22 @@ export default class Deploy extends Command {
dictEndpoint: flags.dict,
endpoint: splitEndpoints(flags.endpoint),
flags: flags,
indexerImageVersion: flags.indexerVersion
indexerImageVersion: flags.indexerVersion,
})
);


this.log('Deploying SubQuery project to Hosted Service');

await executeProjectDeployment({
log: this.log,
log: this.log.bind(this),
authToken: authToken,
chains: chains,
flags: flags,
ipfsCID: flags.ipfsCID,
org: flags.org,
projectInfo: flags.projectInfo,
projectName: flags.projectName,
queryVersion: flags.queryVersion
queryVersion: flags.queryVersion,
});






}
}
58 changes: 39 additions & 19 deletions packages/cli/src/commands/multi-chain/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: GPL-3.0

import fs from "fs";
import fs from 'fs';
import path from 'path';
import {Command, Flags} from '@oclif/core';
import {getMultichainManifestPath, getProjectRootAndManifest} from "@subql/common";
import {getMultichainManifestPath, getProjectRootAndManifest} from '@subql/common';
import chalk from 'chalk';
import cli from 'cli-ux';
import inquirer from 'inquirer';
import YAML from 'yaml'
import YAML from 'yaml';
import {ROOT_API_URL_PROD} from '../../constants';
import {
DefaultDeployFlags,
@@ -21,7 +21,7 @@ import {
projectsInfo,
splitMultichainDataFields,
} from '../../controller/deploy-controller';
import {uploadToIpfs} from "../../controller/publish-controller";
import {uploadToIpfs} from '../../controller/publish-controller';
import {MultichainDataFieldType, V3DeploymentIndexerType} from '../../types';
import {addV, checkToken, promptWithDefaultValues, resolveToAbsolutePath, valueOrPrompt} from '../../utils';

@@ -47,13 +47,15 @@ export default class MultiChainDeploy extends Command {

let multichainManifestPath = getMultichainManifestPath(location);
if (!multichainManifestPath) {
throw new Error(chalk.bgRedBright('Selected project is not multi-chain. Please set correct file.\n\n https://academy.subquery.network/build/multi-chain.html'));
throw new Error(
chalk.bgRedBright(
'Selected project is not multi-chain. Please set correct file.\n\n https://academy.subquery.network/build/multi-chain.html'
)
);
}

multichainManifestPath = path.join(project.root, multichainManifestPath);
const multichainManifestObject = YAML.parse(
fs.readFileSync(multichainManifestPath, 'utf8')
)
const multichainManifestObject = YAML.parse(fs.readFileSync(multichainManifestPath, 'utf8'));

const fileToCidMap = await uploadToIpfs(fullPaths, authToken.trim(), multichainManifestPath, flags.ipfs).catch(
(e) => this.error(e)
@@ -81,7 +83,13 @@ export default class MultiChainDeploy extends Command {
ROOT_API_URL_PROD
);
if (!flags.useDefaults) {
flags.queryVersion = await promptWithDefaultValues(inquirer, `Enter query version`, null, queryAvailableVersions, true);
flags.queryVersion = await promptWithDefaultValues(
inquirer,
`Enter query version`,
null,
queryAvailableVersions,
true
);
} else {
flags.queryVersion = queryAvailableVersions[0];
}
@@ -126,50 +134,62 @@ export default class MultiChainDeploy extends Command {

indexerVersions[validator.chainId] = addV(indexerVersions[validator.chainId]);


if (!endpoints[validator.chainId]) {
if (flags.useDefaults) {
throw new Error(chalk.red('Please ensure a endpoint valid is passed using --endpoint flag with syntax chainId:rpc_endpoint,chainId2:rpc_endpoint2...'));
throw new Error(
chalk.red(
'Please ensure a endpoint valid is passed using --endpoint flag with syntax chainId:rpc_endpoint,chainId2:rpc_endpoint2...'
)
);
}

endpoints[validator.chainId] = await promptWithDefaultValues(cli, `Enter endpoint for ${multichainProjectPath}`, undefined, null, true);
endpoints[validator.chainId] = await promptWithDefaultValues(
cli,
`Enter endpoint for ${multichainProjectPath}`,
undefined,
null,
true
);
}


if (!dictionaries[validator.chainId]) {
const validateDictEndpoint = processEndpoints(await dictionaryEndpoints(ROOT_API_URL_PROD), validator.chainId);
if (!flags.useDefaults && !validateDictEndpoint) {
dictionaries[validator.chainId] = await promptWithDefaultValues(cli, `Enter dictionary for ${multichainProjectPath}`, validateDictEndpoint, null, false);
dictionaries[validator.chainId] = await promptWithDefaultValues(
cli,
`Enter dictionary for ${multichainProjectPath}`,
validateDictEndpoint,
null,
false
);
} else {
dictionaries[validator.chainId] = validateDictEndpoint;
}
}


chains.push(
generateDeploymentChain({
cid: multichainProjectCid,
dictEndpoint: dictionaries[validator.chainId],
endpoint: [endpoints[validator.chainId]],
flags: flags,
indexerImageVersion: indexerVersions[validator.chainId]
indexerImageVersion: indexerVersions[validator.chainId],
})
);
}

this.log('Deploying SubQuery multi-chain project to Hosted Service');

await executeProjectDeployment({
log: this.log,
log: this.log.bind(this),
authToken: authToken,
chains: chains,
flags: flags,
ipfsCID: ipfsCID,
org: flags.org,
projectInfo: projectInfo,
projectName: flags.projectName,
queryVersion: flags.queryVersion
queryVersion: flags.queryVersion,
});

}
}
4 changes: 2 additions & 2 deletions packages/common/src/project/versioned/v1_0_0/models.ts
Original file line number Diff line number Diff line change
@@ -79,10 +79,10 @@ export class BlockFilterImpl implements BlockFilter {

export class ParentProjectModel implements ParentProject {
@IsNumber()
@ValidateIf((obj, value) => value != null || obj.unitlBlock === null || obj.untilBlock === undefined)
@ValidateIf((obj, value) => value !== null || obj.unitlBlock === null || obj.untilBlock === undefined)
block: number;
@IsNumber()
@ValidateIf((obj, value) => value != null || obj.block === null || obj.block === undefined)
@ValidateIf((obj, value) => value !== null || obj.block === null || obj.block === undefined)
untilBlock: number;
@IsString()
reference: string;
Loading

0 comments on commit 45dca92

Please sign in to comment.