Skip to content

Commit c69e1e2

Browse files
committed
Merge branch 'HEAD'
2 parents efe6258 + 9bb987f commit c69e1e2

File tree

8 files changed

+45
-151
lines changed

8 files changed

+45
-151
lines changed

__tests__/__support__/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Wallets } from '@arkecosystem/core-state';
55
import { Crypto, Identities, Managers, Utils } from '@arkecosystem/crypto';
66
import delay from 'delay';
77
import * as fs from 'fs';
8+
import { createHandyClient } from 'handy-redis';
89
import cloneDeep from 'lodash.clonedeep';
910
import * as path from 'path';
10-
import { createHandyClient } from 'handy-redis';
1111
import { secrets } from '../../../../__tests__/utils/config/nospluginnet/delegates.json';
1212
import { setUpContainer } from '../../../../__tests__/utils/helpers/container';
1313

__tests__/staking.integration.test.ts

Lines changed: 0 additions & 134 deletions
This file was deleted.

__tests__/staking.unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ beforeAll(async () => {
4040
synchronize: true,
4141
});
4242
Managers.configManager.setFromPreset("testnet");
43-
Managers.configManager.setHeight(1);
43+
Managers.configManager.setHeight(2);
4444
Handlers.Registry.registerTransactionHandler(StakeCreateTransactionHandler);
4545
Handlers.Registry.registerTransactionHandler(StakeRedeemTransactionHandler);
4646
});
@@ -304,9 +304,9 @@ describe("Staking Transactions", () => {
304304
);
305305
expect(voter.getAttribute("stakes")[stakeTransaction.id]).toEqual({
306306
id: stakeTransaction.id,
307-
amount: stakeAmount,
307+
amount: stakeAmount.toString(),
308308
duration: 7889400,
309-
weight: stakeAmount.times(configManager.getMilestone().stakeLevels['7889400']).dividedBy(10),
309+
weight: stakeAmount.times(configManager.getMilestone().stakeLevels['7889400']).dividedBy(10).toString(),
310310
redeemableTimestamp: stakeTransaction.data.asset.stakeCreate.timestamp + 7889400,
311311
redeemed: false,
312312
halved: false,

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"private": true,
32
"name": "@nosplatform/stake-transactions",
43
"description": "Provides stake transactions for Ark Core",
54
"version": "0.0.2",
@@ -12,15 +11,15 @@
1211
"dist"
1312
],
1413
"scripts": {
15-
"prepublishOnly": "yarn test && yarn build",
14+
"prepublishOnly": "yarn build",
1615
"pretest": "yarn lint && yarn build",
1716
"compile": "../../node_modules/typescript/bin/tsc",
1817
"build": "yarn clean && yarn compile",
1918
"build:watch": "yarn clean && yarn compile -w",
2019
"clean": "del dist",
2120
"docs": "../../node_modules/typedoc/bin/typedoc src --out docs",
2221
"lint": "../../node_modules/tslint/bin/tslint -c ./tslint.json 'src/**/*.ts' '__tests__/**/*.ts' --fix",
23-
"test": "cross-env CORE_ENV=test jest --runInBand --forceExit",
22+
"test": "cross-env CORE_ENV=test jest --runInBand --forceExit --passWithNoTests",
2423
"test:coverage": "cross-env CORE_ENV=test jest --coverage --coveragePathIgnorePatterns='/(defaults.ts|index.ts)$' --runInBand --forceExit",
2524
"test:debug": "cross-env CORE_ENV=test node --inspect-brk ../../node_modules/.bin/jest --runInBand",
2625
"test:watch": "cross-env CORE_ENV=test jest --runInBand --watch",
@@ -31,10 +30,9 @@
3130
"@arkecosystem/core-interfaces": "^2.6.0-next.7",
3231
"@arkecosystem/core-transactions": "^2.6.0-next.7",
3332
"@arkecosystem/crypto": "^2.6.0-next.7",
34-
"@nosplatform/stake-transactions-crypto": "^0.0.1",
35-
"@nosplatform/storage": "^0.0.2",
36-
"redis": "^2.8.0",
37-
"handy-redis": "^1.7.0"
33+
"@nosplatform/stake-transactions-crypto": "^0.1.0-alpha.3",
34+
"handy-redis": "^1.7.0",
35+
"redis": "^2.8.0"
3836
},
3937
"devDependencies": {
4038
"@sindresorhus/tsconfig": "^0.5.0",
@@ -46,13 +44,18 @@
4644
"jest-extended": "^0.11.2",
4745
"npm-check-updates": "^3.1.0",
4846
"regenerator-runtime": "^0.13.0",
49-
"ts-jest": "^24.0.2",
47+
"ts-jest": "^24.3.0",
5048
"tslint": "^5.12.0",
5149
"tslint-config-prettier": "^1.17.0",
5250
"typedoc": "^0.15.0",
5351
"typescript": "^3.2.4"
5452
},
53+
"publishConfig": {
54+
"access": "public"
55+
},
5556
"jest": {
56-
"preset": "../../jest-preset.json"
57+
"transform": {
58+
"^.+\\.tsx?$": "ts-jest"
59+
}
5760
}
58-
}
61+
}

src/handlers/stake-create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
} from '@nosplatform/stake-transactions-crypto';
1111

1212
import {
13+
LessThanMinimumStakeError,
1314
NotEnoughBalanceError,
1415
StakeAlreadyExistsError,
1516
StakeDurationError,
1617
StakeNotIntegerError,
1718
StakeTimestampError,
18-
LessThanMinimumStakeError,
1919
} from '../errors';
2020
import { ExpireHelper, VoteWeight } from '../helpers';
2121

src/handlers/stake-redeem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
} from '@nosplatform/stake-transactions-crypto';
99

1010
import { StakeAlreadyRedeemedError, StakeNotFoundError, StakeNotYetRedeemableError, WalletHasNoStakeError } from '../errors';
11-
import { StakeCreateTransactionHandler } from './stake-create';
1211
import { ExpireHelper } from '../helpers';
12+
import { StakeCreateTransactionHandler } from './stake-create';
1313

1414
export class StakeRedeemTransactionHandler extends Handlers.TransactionHandler {
1515
public getConstructor(): Transactions.TransactionConstructor {

src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { app } from '@arkecosystem/core-container';
22
import { Container, EventEmitter, Logger } from '@arkecosystem/core-interfaces';
33
import { Handlers } from '@arkecosystem/core-transactions';
44
import { roundCalculator } from '@arkecosystem/core-utils';
5+
import { createHandyClient } from 'handy-redis';
56
import { defaults } from './defaults';
67
import { StakeCreateTransactionHandler } from './handlers/stake-create';
78
import { StakeRedeemTransactionHandler } from './handlers/stake-redeem';
89
import * as StakeHelpers from './helpers';
9-
import { createHandyClient } from 'handy-redis';
1010

1111
const emitter = app.resolvePlugin<EventEmitter.EventEmitter>("event-emitter");
1212
const redis = createHandyClient();

tslint.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": ["tslint:recommended", "tslint-config-prettier"],
3+
"rules": {
4+
"ban": [
5+
true,
6+
{
7+
"name": ["assert", "equal"],
8+
"message": "Use 'strictEqual' instead."
9+
},
10+
{
11+
"name": ["*", "forEach"],
12+
"message": "Use a regular for loop instead."
13+
}
14+
],
15+
"await-promise": true,
16+
"no-console": false,
17+
"no-default-export": true,
18+
"no-null-keyword": false,
19+
"no-shadowed-variable": false,
20+
"object-literal-sort-keys": false,
21+
"only-arrow-functions": true,
22+
"radix": false,
23+
"return-undefined": true
24+
}
25+
}

0 commit comments

Comments
 (0)