Skip to content

Commit

Permalink
update deps, update eslint to node.js imports style
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Jan 29, 2020
1 parent 657b4da commit 9ca992b
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 85 deletions.
22 changes: 14 additions & 8 deletions .eslintrc.js
Expand Up @@ -14,14 +14,14 @@ module.exports = {
extends: 'airbnb-base',
settings: {
'import/resolver': {
alias: [
['~/src', './src']
]
alias: [
['~/src', './src']
]
}
},
// // add your custom rules here
rules: {
'indent': ["error", 4],
'indent': ['error', 4],
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
Expand All @@ -37,18 +37,24 @@ module.exports = {
'no-param-reassign': 0,
'no-underscore-dangle': 0,
'no-else-return': 0,
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
'no-unused-vars': ['warn', { 'vars': 'all', 'args': 'after-used', 'ignoreRestSiblings': false }],
'no-use-before-define' : 0,
'object-curly-newline': 0,
'import/prefer-default-export': 1,
'import/extensions': ['error', 'always', {ignorePackages: true} ],
},
overrides: [
{
files: ['examples/*'],
rules: {
"import/no-extraneous-dependencies": 0,
'import/no-extraneous-dependencies': 0,
'no-console': 0,
}
}
},
{
files: ['test/**/*'],
rules: {
'import/extensions': 0,
}
},
]
};
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 7.2.2
- update deps
- minor refactoring

## 7.2.1
- fix `normalizeTxType` to work case insensitive

Expand Down
12 changes: 6 additions & 6 deletions examples/transaction.js
@@ -1,11 +1,11 @@
import axios from 'axios';
import {mPrefixToHex, convertToPip} from 'minterjs-util';
import config from './config';
import MinterTx from '../src/index';
import MinterTxSignature from '../src/tx-signature';
import MinterSendTxData from '../src/tx-data/send';
import {TX_TYPE} from '../src/tx-types';
import {coinToBuffer} from '../src/helpers';
import config from './config.js';
import MinterTx from '../src/index.js';
import MinterTxSignature from '../src/tx-signature.js';
import MinterSendTxData from '../src/tx-data/send.js';
import {TX_TYPE} from '../src/tx-types.js';
import {coinToBuffer} from '../src/helpers.js';

const PRIVATE_KEY = new Buffer('5fa3a8b186f6cc2d748ee2d8c0eb7a905a7b73de0f2c34c5e7857c3b46f187da', 'hex');
const ADDRESS = 'Mx7633980c000139dd3bd24a3f54e06474fa941e16';
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "minterjs-tx",
"version": "7.2.1",
"version": "7.2.2",
"description": "A simple module for creating, manipulating and signing Minter transactions",
"main": "dist/cjs/index.js",
"module": "src/index.js",
Expand Down Expand Up @@ -66,9 +66,9 @@
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.20.0",
"jest": "^25.1.0",
"minterjs-util": "0.15.0",
"minterjs-util": "0.15.1",
"pre-commit": "^1.2.2",
"rollup": "^1.29.1",
"rollup": "^1.30.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/define-properties.js
@@ -1,5 +1,5 @@
import * as rlp from 'rlp';
import {baToJSON, toBuffer, stripZeros} from 'ethereumjs-util/dist/bytes';
import {baToJSON, toBuffer, stripZeros} from 'ethereumjs-util/dist/bytes.js';
import {stripHexPrefix} from 'ethjs-util';
import assert from 'assert';

Expand Down
40 changes: 20 additions & 20 deletions src/index.js
@@ -1,23 +1,23 @@
import Tx from './tx';
import TxSignature from './tx-signature';
import TxData from './tx-data';
import TxDataSend from './tx-data/send';
import TxDataMultisend from './tx-data/multisend';
import TxDataSell from './tx-data/sell';
import TxDataBuy from './tx-data/buy';
import TxDataSellAll from './tx-data/sell-all';
import TxDataCreateCoin from './tx-data/create-coin';
import TxDataDeclareCandidacy from './tx-data/declare-candidacy';
import TxDataEditCandidate from './tx-data/edit-candidate';
import TxDataSetCandidateOn from './tx-data/set-candidate-on';
import TxDataSetCandidateOff from './tx-data/set-candidate-off';
import TxDataDelegate from './tx-data/delegate';
import TxDataUnbond from './tx-data/unbond';
import TxDataRedeemCheck from './tx-data/redeem-check';
import TxDataCreateMultisig from './tx-data/create-multisig';
import {coinToBuffer, bufferToCoin, formatCoin} from './helpers';
import defineProperties from './define-properties';
import {TX_TYPE, TX_TYPE_SEND, TX_TYPE_SELL, TX_TYPE_SELL_ALL, TX_TYPE_BUY, TX_TYPE_CREATE_COIN, TX_TYPE_DECLARE_CANDIDACY, TX_TYPE_SET_CANDIDATE_ON, TX_TYPE_SET_CANDIDATE_OFF, TX_TYPE_DELEGATE, TX_TYPE_UNBOND, TX_TYPE_REDEEM_CHECK, TX_TYPE_CREATE_MULTISIG, TX_TYPE_MULTISEND, TX_TYPE_EDIT_CANDIDATE, txTypeList, normalizeTxType} from './tx-types';
import Tx from './tx.js';
import TxSignature from './tx-signature.js';
import TxData from './tx-data/index.js';
import TxDataSend from './tx-data/send.js';
import TxDataMultisend from './tx-data/multisend.js';
import TxDataSell from './tx-data/sell.js';
import TxDataBuy from './tx-data/buy.js';
import TxDataSellAll from './tx-data/sell-all.js';
import TxDataCreateCoin from './tx-data/create-coin.js';
import TxDataDeclareCandidacy from './tx-data/declare-candidacy.js';
import TxDataEditCandidate from './tx-data/edit-candidate.js';
import TxDataSetCandidateOn from './tx-data/set-candidate-on.js';
import TxDataSetCandidateOff from './tx-data/set-candidate-off.js';
import TxDataDelegate from './tx-data/delegate.js';
import TxDataUnbond from './tx-data/unbond.js';
import TxDataRedeemCheck from './tx-data/redeem-check.js';
import TxDataCreateMultisig from './tx-data/create-multisig.js';
import {coinToBuffer, bufferToCoin, formatCoin} from './helpers.js';
import defineProperties from './define-properties.js';
import {TX_TYPE, TX_TYPE_SEND, TX_TYPE_SELL, TX_TYPE_SELL_ALL, TX_TYPE_BUY, TX_TYPE_CREATE_COIN, TX_TYPE_DECLARE_CANDIDACY, TX_TYPE_SET_CANDIDATE_ON, TX_TYPE_SET_CANDIDATE_OFF, TX_TYPE_DELEGATE, TX_TYPE_UNBOND, TX_TYPE_REDEEM_CHECK, TX_TYPE_CREATE_MULTISIG, TX_TYPE_MULTISEND, TX_TYPE_EDIT_CANDIDATE, txTypeList, normalizeTxType} from './tx-types.js';

const MinterTx = Tx;
const MinterTxSignature = TxSignature;
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/buy.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataBuy {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/create-coin.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataCreateCoin {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/create-multisig.js
@@ -1,4 +1,4 @@
import defineProperties from '../define-properties';
import defineProperties from '../define-properties.js';

class TxDataCreateMultisig {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/declare-candidacy.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataDeclareCandidacy {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/delegate.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataDelegate {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/edit-candidate.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataDeclareCandidacy {
constructor(data) {
Expand Down
30 changes: 15 additions & 15 deletions src/tx-data/index.js
@@ -1,19 +1,19 @@
import TxDataSend from './send';
import TxDataMultisend from './multisend';
import TxDataSell from './sell';
import TxDataBuy from './buy';
import TxDataSellAll from './sell-all';
import TxDataCreateCoin from './create-coin';
import TxDataDeclareCandidacy from './declare-candidacy';
import TxDataEditCandidate from './edit-candidate';
import TxDataSetCandidateOn from './set-candidate-on';
import TxDataSetCandidateOff from './set-candidate-off';
import TxDataDelegate from './delegate';
import TxDataUnbond from './unbond';
import TxDataRedeemCheck from './redeem-check';
import TxDataCreateMultisig from './create-multisig';
import TxDataSend from './send.js';
import TxDataMultisend from './multisend.js';
import TxDataSell from './sell.js';
import TxDataBuy from './buy.js';
import TxDataSellAll from './sell-all.js';
import TxDataCreateCoin from './create-coin.js';
import TxDataDeclareCandidacy from './declare-candidacy.js';
import TxDataEditCandidate from './edit-candidate.js';
import TxDataSetCandidateOn from './set-candidate-on.js';
import TxDataSetCandidateOff from './set-candidate-off.js';
import TxDataDelegate from './delegate.js';
import TxDataUnbond from './unbond.js';
import TxDataRedeemCheck from './redeem-check.js';
import TxDataCreateMultisig from './create-multisig.js';

import {TX_TYPE, normalizeTxType} from '../tx-types';
import {TX_TYPE, normalizeTxType} from '../tx-types.js';

const TX_DATA_CONSTRUCTOR = {
[TX_TYPE.SEND]: TxDataSend,
Expand Down
4 changes: 2 additions & 2 deletions src/tx-data/multisend.js
@@ -1,5 +1,5 @@
import defineProperties from '../define-properties';
import TxDataSend from './send';
import defineProperties from '../define-properties.js';
import TxDataSend from './send.js';

class TxDataMultisend {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/redeem-check.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataRedeemCheck {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/sell-all.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataSellAll {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/sell.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataSell {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/send.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataSend {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/set-candidate-off.js
@@ -1,3 +1,3 @@
import TxDataSetCandidateOff from './set-candidate-on';
import TxDataSetCandidateOff from './set-candidate-on.js';

export default TxDataSetCandidateOff;
2 changes: 1 addition & 1 deletion src/tx-data/set-candidate-on.js
@@ -1,4 +1,4 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {defineProperties} from 'ethereumjs-util/dist/object.js';

class TxDataSetCandidateOn {
constructor(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/tx-data/unbond.js
@@ -1,3 +1,3 @@
import TxDataUnbond from './delegate';
import TxDataUnbond from './delegate.js';

export default TxDataUnbond;
4 changes: 2 additions & 2 deletions src/tx-signature.js
@@ -1,5 +1,5 @@
import {defineProperties} from 'ethereumjs-util/dist/object';
import {ecsign} from 'ethereumjs-util/dist/signature';
import {defineProperties} from 'ethereumjs-util/dist/object.js';
import {ecsign} from 'ethereumjs-util/dist/signature.js';

class TxSignature {
constructor(data) {
Expand Down
10 changes: 5 additions & 5 deletions src/tx.js
@@ -1,10 +1,10 @@
import * as rlp from 'rlp';
import BN from 'bn.js';
import {defineProperties} from 'ethereumjs-util/dist/object';
import {rlphash} from 'ethereumjs-util/dist/hash';
import {publicToAddress} from 'ethereumjs-util/dist/account';
import {ecrecover} from 'ethereumjs-util/dist/signature';
import {bufferToInt} from 'ethereumjs-util/dist/bytes';
import {defineProperties} from 'ethereumjs-util/dist/object.js';
import {rlphash} from 'ethereumjs-util/dist/hash.js';
import {publicToAddress} from 'ethereumjs-util/dist/account.js';
import {ecrecover} from 'ethereumjs-util/dist/signature.js';
import {bufferToInt} from 'ethereumjs-util/dist/bytes.js';

// secp256k1n/2
const N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
Expand Down

0 comments on commit 9ca992b

Please sign in to comment.