Skip to content

Commit

Permalink
Merge branch 'HEAD'
Browse files Browse the repository at this point in the history
  • Loading branch information
deanpress committed Dec 16, 2019
2 parents 5a2be70 + d9b8ac1 commit 2451a8e
Show file tree
Hide file tree
Showing 5 changed files with 18,172 additions and 17 deletions.
Empty file removed __tests__/.gitkeep
Empty file.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"private": true,
"name": "@nosplatform/stake-transactions-crypto",
"description": "Provides stake trsanctions crypto logic for Ark Core",
"version": "0.0.1",
"version": "0.1.0-alpha.1",
"contributors": [
"Dean van Dugteren <dean@nos.io>"
],
Expand All @@ -20,7 +19,7 @@
"clean": "del dist",
"docs": "../../node_modules/typedoc/bin/typedoc src --out docs",
"lint": "../../node_modules/tslint/bin/tslint -c ./tslint.json 'src/**/*.ts' '__tests__/**/*.ts' --fix",
"test": "cross-env CORE_ENV=test jest --runInBand --forceExit",
"test": "cross-env CORE_ENV=test jest --runInBand --forceExit --passWithNoTests",
"test:coverage": "cross-env CORE_ENV=test jest --coverage --coveragePathIgnorePatterns='/(defaults.ts|index.ts)$' --runInBand --forceExit",
"test:debug": "cross-env CORE_ENV=test node --inspect-brk ../../node_modules/.bin/jest --runInBand",
"test:watch": "cross-env CORE_ENV=test jest --runInBand --watch",
Expand All @@ -47,7 +46,7 @@
"cross-env": "^6.0.0",
"del-cli": "^3.0.0"
},
"jest": {
"preset": "../../jest-preset.json"
"publishConfig": {
"access": "public"
}
}
}
14 changes: 3 additions & 11 deletions src/transactions/stake-create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ByteBuffer from 'bytebuffer';

import { Managers, Transactions, Utils } from '@arkecosystem/crypto';
import { Transactions, Utils } from '@arkecosystem/crypto';

import { StakeTransactionGroup, StakeTransactionType } from '../enums';
import { IStakeCreateAsset } from '../interfaces';
Expand All @@ -13,12 +13,6 @@ export class StakeCreateTransaction extends Transactions.Transaction {
public static key: string = "stakeCreate";

public static getSchema(): Transactions.schemas.TransactionSchema {
const configManager = Managers.configManager;
const milestone = configManager.getMilestone();
const stakeLevels = [];
for (const duration of Object.keys(milestone.stakeLevels)) {
stakeLevels.push(Number(duration));
}

return schemas.extend(schemas.transactionBaseSchema, {
$id: "stakeCreate",
Expand All @@ -38,12 +32,11 @@ export class StakeCreateTransaction extends Transactions.Transaction {
properties: {
duration: {
type: "integer",
// Duration must exist in stakeLevels keys
enum: stakeLevels,
minimum: 0
},
amount: {
bignumber: {
minimum: milestone.minimumStake,
minimum: 0,
},
},
timestamp: {
Expand All @@ -64,7 +57,6 @@ export class StakeCreateTransaction extends Transactions.Transaction {
const { data } = this;
const stakeCreate = data.asset.stakeCreate as IStakeCreateAsset;

// TODO: Verify that this works
const buffer = new ByteBuffer(24, true);
buffer.writeUint64(+stakeCreate.duration);
buffer.writeUint64(+stakeCreate.amount);
Expand Down
25 changes: 25 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"ban": [
true,
{
"name": ["assert", "equal"],
"message": "Use 'strictEqual' instead."
},
{
"name": ["*", "forEach"],
"message": "Use a regular for loop instead."
}
],
"await-promise": true,
"no-console": false,
"no-default-export": true,
"no-null-keyword": true,
"no-shadowed-variable": false,
"object-literal-sort-keys": false,
"only-arrow-functions": true,
"radix": false,
"return-undefined": true
}
}
Loading

0 comments on commit 2451a8e

Please sign in to comment.