Skip to content

Commit f8d83a9

Browse files
committed
fix lint error
1 parent 568c393 commit f8d83a9

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

hacks/build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# get shell path
2+
SOURCE="$0"
3+
while [ -h "$SOURCE" ]; do
4+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
5+
SOURCE="$(readlink "$SOURCE")"
6+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
7+
done
8+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
9+
10+
cd $DIR/../
11+
yarn build:docker
12+
13+
tag=`date "+%Y-%m-%d-%H_%M"`
14+
15+
docker image tag substrate-api-sidecar registry.cn-hangzhou.aliyuncs.com/wetee_dao/substrate_sidecar:$tag
16+
docker push registry.cn-hangzhou.aliyuncs.com/wetee_dao/substrate_sidecar:$tag
17+
echo registry.cn-hangzhou.aliyuncs.com/wetee_dao/substrate_sidecar:$tag

hacks/dev.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
# 来源于网络,用于获取当前shell文件的路径
4+
SOURCE="$0"
5+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
6+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
7+
SOURCE="$(readlink "$SOURCE")"
8+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
9+
done
10+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
11+
12+
cd "$DIR/../"
13+
14+
export SAS_SUBSTRATE_URL="wss://xiaobai.asyou.me:30001/ws"
15+
# yarn build
16+
yarn dev

src/controllers/contracts/ContractsInkController.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import { ContractPromise } from '@polkadot/api-contract';
18+
import { hexToU8a } from '@polkadot/util';
1819
import { RequestHandler } from 'express';
1920
import { BadRequest } from 'http-errors';
2021

2122
import { validateAddress } from '../../middleware';
2223
import { ContractsInkService } from '../../services';
23-
import { IBodyContractMetadata, IContractDryParams, IContractQueryParam, IPostRequestHandler } from '../../types/requests';
24+
import {
25+
IBodyContractMetadata,
26+
IContractDryParams,
27+
IContractQueryParam,
28+
IPostRequestHandler,
29+
} from '../../types/requests';
2430
import AbstractController from '../AbstractController';
25-
import { hexToU8a } from '@polkadot/util';
2631

2732
export default class ContractsInkController extends AbstractController<ContractsInkService> {
2833
static controllerName = 'ContractsInk';
@@ -72,20 +77,18 @@ export default class ContractsInkController extends AbstractController<Contracts
7277
* @param res
7378
*/
7479
private dryRun: IPostRequestHandler<IBodyContractMetadata, IContractDryParams> = async (
75-
{ params: { address }, query: { caller, payValue = "0", inputData } },
80+
{ params: { address }, query: { caller, payValue = '0', inputData } },
7681
res,
7782
): Promise<void> => {
78-
const dryRunResult: any = await this.api.call.reviveApi.call(
83+
const dryRunResult = await this.api.call.reviveApi.call(
7984
caller,
8085
address,
8186
this.api.registry.createType('Balance', BigInt(payValue)),
8287
null,
8388
null,
8489
hexToU8a(inputData) ?? '',
85-
)
86-
ContractsInkController.sanitizedSend(
87-
res,
88-
dryRunResult.toHuman(),
8990
);
91+
92+
ContractsInkController.sanitizedSend(res, dryRunResult.toHuman());
9093
};
9194
}

0 commit comments

Comments
 (0)