Commit a0e9e6e7 authored by Mahdi Yari's avatar Mahdi Yari

Merge branch 'rebrand-hf24' into 'master'

Rebrand hf24

Closes #11

See merge request !7
parents 77d4a3ee 9120061f
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"address_prefix": "STM", "address_prefix": "STM",
"chain_id": "beeab0de00000000000000000000000000000000000000000000000000000000", "chain_id": "beeab0de00000000000000000000000000000000000000000000000000000000",
"alternative_api_endpoints": ["https://api.hive.blog", "https://anyx.io"], "alternative_api_endpoints": ["https://api.hive.blog", "https://anyx.io"],
"failover_threshold": 3 "failover_threshold": 3,
"rebranded_api": false
} }
...@@ -44,9 +44,12 @@ as ...@@ -44,9 +44,12 @@ as
```js ```js
hive.api.setOptions({ url: 'https://anyx.io' }); hive.api.setOptions({ url: 'https://anyx.io' });
hive.config.set('address_prefix','STM'); hive.config.set('address_prefix','STM');
hive.config.set('chain_id','0000000000000000000000000000000000000000000000000000000000000000'); hive.config.set('chain_id','beeab0de00000000000000000000000000000000000000000000000000000000');
hive.config.set('alternative_api_endpoints', ['https://api.hive.blog', 'https://anyx.io']); hive.config.set('alternative_api_endpoints', ['https://api.hive.blog', 'https://anyx.io']);
``` ```
### rebranded_api
Set `rebranded_api` to `true` for connecting to eclipse (hf24) RPC nodes.
### set ### set
``` ```
hive.config.set('address_prefix','STM'); hive.config.set('address_prefix','STM');
...@@ -975,8 +978,10 @@ const props = { ...@@ -975,8 +978,10 @@ const props = {
"account_subsidy_budget": 10000, // optional "account_subsidy_budget": 10000, // optional
"account_subsidy_decay": 330782, // optional "account_subsidy_decay": 330782, // optional
"maximum_block_size": 65536, // optional "maximum_block_size": 65536, // optional
"sbd_interest_rate": "0.000 HIVE", // optional // "sbd_interest_rate": "0.000 HIVE", // for old api nodes - optional
"sbd_exchange_rate": {"base": "0.250 HBD", "quote": "1.000 HIVE"}, // optional "hbd_interest_rate": "0.000 HIVE", // optional
// "sbd_exchange_rate": {"base": "0.250 HBD", "quote": "1.000 HIVE"}, // for old api nodes - optional
"hbd_exchange_rate": {"base": "0.250 HBD", "quote": "1.000 HIVE"}, // optional
"url": "https://testurl", // optional "url": "https://testurl", // optional
"new_signing_key": "Public Signing Key" // optional "new_signing_key": "Public Signing Key" // optional
} }
...@@ -988,3 +993,13 @@ hive.broadcast.witnessSetProperties('Private Signing Key', owner, witnessOps.pro ...@@ -988,3 +993,13 @@ hive.broadcast.witnessSetProperties('Private Signing Key', owner, witnessOps.pro
}); });
``` ```
### Auto Detect API Version
Get API version and update `rebranded_api` in config.
Note: this will update the config too based on the result.
```
var apiVersion = await hive.utils.autoDetectApiVersion();
console.log(apiVersion);
// => { rebranded_api: true }
```
{ {
"name": "@hiveio/hive-js", "name": "@hiveio/hive-js",
"version": "0.8.1", "version": "0.8.2",
"description": "Hive.js the JavaScript API for Hive blockchain", "description": "Hive.js the JavaScript API for Hive blockchain",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
......
...@@ -20,7 +20,7 @@ import { ...@@ -20,7 +20,7 @@ import {
sign as signRequest sign as signRequest
} from '@steemit/rpc-auth'; } from '@steemit/rpc-auth';
class Steem extends EventEmitter { class Hive extends EventEmitter {
constructor(options = {}) { constructor(options = {}) {
super(options); super(options);
this._setTransport(options); this._setTransport(options);
...@@ -408,6 +408,6 @@ class Steem extends EventEmitter { ...@@ -408,6 +408,6 @@ class Steem extends EventEmitter {
} }
// Export singleton instance // Export singleton instance
const steem = new Steem(config); const hive = new Hive(config);
exports = module.exports = steem; exports = module.exports = hive;
exports.Steem = Steem; exports.Hive = Hive;
...@@ -14,6 +14,16 @@ var Auth = {}; ...@@ -14,6 +14,16 @@ var Auth = {};
var transaction = operations.transaction; var transaction = operations.transaction;
var signed_transaction = operations.signed_transaction; var signed_transaction = operations.signed_transaction;
// this function can be removed after hf24
const updateOperations = () => {
delete require.cache[require.resolve('./serializer/src/operations')];
operations = require('./serializer/src/operations');
transaction = operations.transaction;
signed_transaction = operations.signed_transaction;
}
updateOperations()
Auth.updateOperations = updateOperations
Auth.verify = function (name, password, auths) { Auth.verify = function (name, password, auths) {
var hasKey = false; var hasKey = false;
var roles = []; var roles = [];
...@@ -49,7 +59,7 @@ Auth.generateKeys = function (name, password, roles) { ...@@ -49,7 +59,7 @@ Auth.generateKeys = function (name, password, roles) {
/** /**
@arg {string} name - blockchain account name @arg {string} name - blockchain account name
@arg {string} password - very strong password typically no shorter than a private key @arg {string} password - very strong password typically no shorter than a private key
@arg {array} roles - defaults to standard Steem blockchain-level roles @arg {array} roles - defaults to standard Hive blockchain-level roles
*/ */
Auth.getPrivateKeys = function (name, password, roles = ['owner', 'active', 'posting', 'memo']) { Auth.getPrivateKeys = function (name, password, roles = ['owner', 'active', 'posting', 'memo']) {
var privKeys = {}; var privKeys = {};
......
...@@ -33,6 +33,10 @@ static_variant [ ...@@ -33,6 +33,10 @@ static_variant [
import types from "./types" import types from "./types"
import SerializerImpl from "./serializer" import SerializerImpl from "./serializer"
import config from "../../../config"
const hiveVar = () => config.get("rebranded_api") ? "hive" : "steem"
const hbdVar = () => config.get("rebranded_api") ? "hbd" : "sbd"
const { const {
//id_type, //id_type,
...@@ -88,7 +92,7 @@ const allowed_vote_assets = new Serializer(1, { ...@@ -88,7 +92,7 @@ const allowed_vote_assets = new Serializer(1, {
const smt_generation_unit = new Serializer( const smt_generation_unit = new Serializer(
"smt_generation_unit", { "smt_generation_unit", {
steem_unit: map((string), (uint16)), [hiveVar() + "_unit"]: map((string), (uint16)),
token_unit: map((string), (uint16)) token_unit: map((string), (uint16))
}); });
...@@ -332,7 +336,7 @@ let chain_properties = new Serializer( ...@@ -332,7 +336,7 @@ let chain_properties = new Serializer(
"chain_properties", { "chain_properties", {
account_creation_fee: asset, account_creation_fee: asset,
maximum_block_size: uint32, maximum_block_size: uint32,
sbd_interest_rate: uint16 [hbdVar() + "_interest_rate"]: uint16
} }
); );
...@@ -407,7 +411,7 @@ let comment_options = new Serializer( ...@@ -407,7 +411,7 @@ let comment_options = new Serializer(
author: string, author: string,
permlink: string, permlink: string,
max_accepted_payout: asset, max_accepted_payout: asset,
percent_steem_dollars: uint16, ["percent_" + hiveVar() ? "hbd" : "steem_dollars"]: uint16,
allow_votes: bool, allow_votes: bool,
allow_curation_rewards: bool, allow_curation_rewards: bool,
extensions: set(static_variant([ extensions: set(static_variant([
...@@ -488,8 +492,8 @@ let escrow_transfer = new Serializer( ...@@ -488,8 +492,8 @@ let escrow_transfer = new Serializer(
"escrow_transfer", { "escrow_transfer", {
from: string, from: string,
to: string, to: string,
sbd_amount: asset, [hbdVar() + "_amount"]: asset,
steem_amount: asset, [hiveVar() + "_amount"]: asset,
escrow_id: uint32, escrow_id: uint32,
agent: string, agent: string,
fee: asset, fee: asset,
...@@ -517,8 +521,8 @@ let escrow_release = new Serializer( ...@@ -517,8 +521,8 @@ let escrow_release = new Serializer(
who: string, who: string,
receiver: string, receiver: string,
escrow_id: uint32, escrow_id: uint32,
sbd_amount: asset, [hbdVar() + "_amount"]: asset,
steem_amount: asset [hiveVar() + "_amount"]: asset
} }
); );
...@@ -629,8 +633,8 @@ let set_reset_account = new Serializer( ...@@ -629,8 +633,8 @@ let set_reset_account = new Serializer(
let claim_reward_balance = new Serializer( let claim_reward_balance = new Serializer(
"claim_reward_balance", { "claim_reward_balance", {
account: string, account: string,
reward_steem: asset, ["reward_" + hiveVar()]: asset,
reward_sbd: asset, ["reward_" + hbdVar()]: asset,
reward_vests: asset reward_vests: asset
} }
); );
...@@ -745,7 +749,7 @@ let smt_setup = new Serializer( ...@@ -745,7 +749,7 @@ let smt_setup = new Serializer(
contribution_begin_time: time_point_sec, contribution_begin_time: time_point_sec,
contribution_end_time: time_point_sec, contribution_end_time: time_point_sec,
launch_time: time_point_sec, launch_time: time_point_sec,
steem_units_min: int64, [hiveVar() + "_units_min"]: int64,
min_unit_ratio: uint32, min_unit_ratio: uint32,
max_unit_ratio: uint32, max_unit_ratio: uint32,
extensions: set(future_extensions) extensions: set(future_extensions)
...@@ -777,7 +781,7 @@ let smt_setup_ico_tier = new Serializer( ...@@ -777,7 +781,7 @@ let smt_setup_ico_tier = new Serializer(
"smt_setup_ico_tier", { "smt_setup_ico_tier", {
control_account: string, control_account: string,
symbol: asset_symbol, symbol: asset_symbol,
steem_units_cap: int64, [hiveVar() + "_units_cap"]: int64,
generation_policy: static_variant([ generation_policy: static_variant([
smt_capped_generation_policy smt_capped_generation_policy
]), ]),
...@@ -834,8 +838,8 @@ let author_reward = new Serializer( ...@@ -834,8 +838,8 @@ let author_reward = new Serializer(
"author_reward", { "author_reward", {
author: string, author: string,
permlink: string, permlink: string,
sbd_payout: asset, [hbdVar() + "_payout"]: asset,
steem_payout: asset, [hiveVar() + "_payout"]: asset,
vesting_payout: asset vesting_payout: asset
} }
); );
......
...@@ -10,7 +10,7 @@ const chain_types = require('./ChainTypes') ...@@ -10,7 +10,7 @@ const chain_types = require('./ChainTypes')
import { PublicKey, Address, ecc_config } from "../../ecc" import { PublicKey, Address, ecc_config } from "../../ecc"
import { fromImpliedDecimal } from "./number_utils" import { fromImpliedDecimal } from "./number_utils"
import Config from "../../../config.js" import config from "../../../config.js"
const Types = {} const Types = {}
module.exports = Types module.exports = Types
...@@ -108,7 +108,7 @@ Types.asset = { ...@@ -108,7 +108,7 @@ Types.asset = {
let b_copy = b.copy(b.offset, b.offset + 7) let b_copy = b.copy(b.offset, b.offset + 7)
symbol = new Buffer(b_copy.toBinary(), "binary").toString().replace(/\x00/g, "") symbol = new Buffer(b_copy.toBinary(), "binary").toString().replace(/\x00/g, "")
b.skip(7) b.skip(7)
// "1.000 STEEM" always written with full precision // "1.000 HIVE" always written with full precision
amount_string = fromImpliedDecimal(amount, precision) amount_string = fromImpliedDecimal(amount, precision)
} }
...@@ -132,11 +132,11 @@ Types.asset = { ...@@ -132,11 +132,11 @@ Types.asset = {
{ {
case "@@000000021": case "@@000000021":
precision = 3 precision = 3
symbol = Config.get( "address_prefix" ) == "STM" ? "STEEM" : "TESTS" symbol = config.get( "address_prefix" ) == "STM" ? "STEEM" : "TESTS"
break break
case "@@000000013": case "@@000000013":
precision = 3 precision = 3
symbol = Config.get( "address_prefix" ) == "STM" ? "SBD" : "TBD" symbol = config.get( "address_prefix" ) == "STM" ? "SBD" : "TBD"
break break
case "@@000000037": case "@@000000037":
precision = 6 precision = 6
...@@ -196,7 +196,7 @@ Types.asset = { ...@@ -196,7 +196,7 @@ Types.asset = {
return object return object
}, },
toObject(object, debug = {}){ toObject(object, debug = {}){
if (debug.use_default && object === undefined) { return "0.000 STEEM"; } if (debug.use_default && object === undefined) { return "0.000 HIVE"; }
return object return object
} }
} }
...@@ -252,11 +252,11 @@ Types.asset_symbol = { ...@@ -252,11 +252,11 @@ Types.asset_symbol = {
{ {
case "@@000000021": case "@@000000021":
precision = 3 precision = 3
symbol = Config.get( "address_prefix" ) == "STM" ? "STEEM" : "TESTS" symbol = config.get( "address_prefix" ) == "STM" ? "STEEM" : "TESTS"
break break
case "@@000000013": case "@@000000013":
precision = 3 precision = 3
symbol = Config.get( "address_prefix" ) == "STM" ? "SBD" : "TBD" symbol = config.get( "address_prefix" ) == "STM" ? "SBD" : "TBD"
break break
case "@@000000037": case "@@000000037":
precision = 6 precision = 6
......
import api from '../api'; import api from '../api';
exports = module.exports = steemBroadcast => { exports = module.exports = hiveBroadcast => {
steemBroadcast.addAccountAuth = ({ signingKey, username, authorizedUsername, role = 'posting', weight }, cb) => { hiveBroadcast.addAccountAuth = ({ signingKey, username, authorizedUsername, role = 'posting', weight }, cb) => {
api.getAccounts([username], (err, [userAccount]) => { api.getAccounts([username], (err, [userAccount]) => {
if (err) { return cb(new Error(err), null); } if (err) { return cb(new Error(err), null); }
if (!userAccount) { return cb(new Error('Invalid account name'), null); } if (!userAccount) { return cb(new Error('Invalid account name'), null); }
...@@ -23,7 +23,7 @@ exports = module.exports = steemBroadcast => { ...@@ -23,7 +23,7 @@ exports = module.exports = steemBroadcast => {
const posting = role === 'posting' ? updatedAuthority : undefined; const posting = role === 'posting' ? updatedAuthority : undefined;
/** Add authority on user account */ /** Add authority on user account */
steemBroadcast.accountUpdate( hiveBroadcast.accountUpdate(
signingKey, signingKey,
userAccount.name, userAccount.name,
owner, owner,
...@@ -36,7 +36,7 @@ exports = module.exports = steemBroadcast => { ...@@ -36,7 +36,7 @@ exports = module.exports = steemBroadcast => {
}); });
}; };
steemBroadcast.removeAccountAuth = ({ signingKey, username, authorizedUsername, role = 'posting' }, cb) => { hiveBroadcast.removeAccountAuth = ({ signingKey, username, authorizedUsername, role = 'posting' }, cb) => {
api.getAccounts([username], (err, [userAccount]) => { api.getAccounts([username], (err, [userAccount]) => {
if (err) { return cb(new Error(err), null); } if (err) { return cb(new Error(err), null); }
if (!userAccount) { return cb(new Error('Invalid account name'), null); } if (!userAccount) { return cb(new Error('Invalid account name'), null); }
...@@ -60,7 +60,7 @@ exports = module.exports = steemBroadcast => { ...@@ -60,7 +60,7 @@ exports = module.exports = steemBroadcast => {
const active = role === 'active' ? updatedAuthority : undefined; const active = role === 'active' ? updatedAuthority : undefined;
const posting = role === 'posting' ? updatedAuthority : undefined; const posting = role === 'posting' ? updatedAuthority : undefined;
steemBroadcast.accountUpdate( hiveBroadcast.accountUpdate(
signingKey, signingKey,
userAccount.name, userAccount.name,
owner, owner,
...@@ -73,7 +73,7 @@ exports = module.exports = steemBroadcast => { ...@@ -73,7 +73,7 @@ exports = module.exports = steemBroadcast => {
}); });
}; };
steemBroadcast.addKeyAuth = ({ signingKey, username, authorizedKey, role = 'posting', weight }, cb) => { hiveBroadcast.addKeyAuth = ({ signingKey, username, authorizedKey, role = 'posting', weight }, cb) => {
api.getAccounts([username], (err, [userAccount]) => { api.getAccounts([username], (err, [userAccount]) => {
if (err) { return cb(new Error(err), null); } if (err) { return cb(new Error(err), null); }
if (!userAccount) { return cb(new Error('Invalid account name'), null); } if (!userAccount) { return cb(new Error('Invalid account name'), null); }
...@@ -95,7 +95,7 @@ exports = module.exports = steemBroadcast => { ...@@ -95,7 +95,7 @@ exports = module.exports = steemBroadcast => {
const posting = role === 'posting' ? updatedAuthority : undefined; const posting = role === 'posting' ? updatedAuthority : undefined;
/** Add authority on user account */ /** Add authority on user account */
steemBroadcast.accountUpdate( hiveBroadcast.accountUpdate(
signingKey, signingKey,
userAccount.name, userAccount.name,
owner, owner,
...@@ -108,7 +108,7 @@ exports = module.exports = steemBroadcast => { ...@@ -108,7 +108,7 @@ exports = module.exports = steemBroadcast => {
}); });
}; };
steemBroadcast.removeKeyAuth = ({ signingKey, username, authorizedKey, role = 'posting' }, cb) => { hiveBroadcast.removeKeyAuth = ({ signingKey, username, authorizedKey, role = 'posting' }, cb) => {
api.getAccounts([username], (err, [userAccount]) => { api.getAccounts([username], (err, [userAccount]) => {
if (err) { return cb(new Error(err), null); } if (err) { return cb(new Error(err), null); }
if (!userAccount) { return cb(new Error('Invalid account name'), null); } if (!userAccount) { return cb(new Error('Invalid account name'), null); }
...@@ -132,7 +132,7 @@ exports = module.exports = steemBroadcast => { ...@@ -132,7 +132,7 @@ exports = module.exports = steemBroadcast => {
const active = role === 'active' ? updatedAuthority : undefined; const active = role === 'active' ? updatedAuthority : undefined;
const posting = role === 'posting' ? updatedAuthority : undefined; const posting = role === 'posting' ? updatedAuthority : undefined;
steemBroadcast.accountUpdate( hiveBroadcast.accountUpdate(
signingKey, signingKey,
userAccount.name, userAccount.name,
owner, owner,
......
import Promise from 'bluebird'; import Promise from 'bluebird';
import newDebug from 'debug'; import newDebug from 'debug';
import broadcastHelpers from './helpers'; import broadcastHelpers from './helpers';
import formatterFactory from '../formatter'; import formatterFactory from '../formatter';
import operations from './operations'; import hiveApi from '../api';
import steemApi from '../api'; import hiveAuth from '../auth';
import steemAuth from '../auth';
import { camelCase } from '../utils'; import { camelCase } from '../utils';
var operations = require('./operations');
const config = require('../config') const config = require('../config')
const HF23_CHAIN_ID = '0000000000000000000000000000000000000000000000000000000000000000' const HF23_CHAIN_ID = '0000000000000000000000000000000000000000000000000000000000000000'
const HF24_CHAIN_ID = 'beeab0de00000000000000000000000000000000000000000000000000000000' const HF24_CHAIN_ID = 'beeab0de00000000000000000000000000000000000000000000000000000000'
const debug = newDebug('steem:broadcast'); const debug = newDebug('hive:broadcast');
const noop = function() {} const noop = function() {}
const formatter = formatterFactory(steemApi); const formatter = formatterFactory(hiveApi);
const steemBroadcast = {}; const hiveBroadcast = {};
// Base transaction logic ----------------------------------------------------- // Base transaction logic -----------------------------------------------------
/** /**
* Sign and broadcast transactions on the steem network * Sign and broadcast transactions on the hive network
*/ */
steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) { hiveBroadcast.send = function hiveBroadcast$send(tx, privKeys, callback) {
const resultP = steemBroadcast._prepareTransaction(tx) const resultP = hiveBroadcast._prepareTransaction(tx)
.then((transaction) => { .then((transaction) => {
debug( debug(
'Signing transaction (transaction, transaction.operations)', 'Signing transaction (transaction, transaction.operations)',
...@@ -34,7 +33,7 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) { ...@@ -34,7 +33,7 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) {
); );
return Promise.join( return Promise.join(
transaction, transaction,
steemAuth.signTransaction(transaction, privKeys) hiveAuth.signTransaction(transaction, privKeys)
); );
}) })
.spread((transaction, signedTransaction) => { .spread((transaction, signedTransaction) => {
...@@ -42,7 +41,7 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) { ...@@ -42,7 +41,7 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) {
'Broadcasting transaction (transaction, transaction.operations)', 'Broadcasting transaction (transaction, transaction.operations)',
transaction, transaction.operations transaction, transaction.operations
); );
return steemApi.broadcastTransactionSynchronousAsync( return hiveApi.broadcastTransactionSynchronousAsync(
signedTransaction signedTransaction
).then((result) => { ).then((result) => {
return Object.assign({}, result, signedTransaction); return Object.assign({}, result, signedTransaction);
...@@ -52,11 +51,11 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) { ...@@ -52,11 +51,11 @@ steemBroadcast.send = function steemBroadcast$send(tx, privKeys, callback) {
resultP.nodeify(callback || noop); resultP.nodeify(callback || noop);
}; };
steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction(tx) { hiveBroadcast._prepareTransaction = function hiveBroadcast$_prepareTransaction(tx) {
const propertiesP = steemApi.getDynamicGlobalPropertiesAsync(); const propertiesP = hiveApi.getDynamicGlobalPropertiesAsync();
return propertiesP return propertiesP
.then((properties) => { .then((properties) => {
const hfVersion = steemApi.getHardforkVersionAsync(); const hfVersion = hiveApi.getHardforkVersionAsync();
return hfVersion.then(HFV => { return hfVersion.then(HFV => {
if (HFV == '0.23.0') { if (HFV == '0.23.0') {
config.set('chain_id', HF23_CHAIN_ID) config.set('chain_id', HF23_CHAIN_ID)
...@@ -66,7 +65,7 @@ steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction ...@@ -66,7 +65,7 @@ steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction
// Set defaults on the transaction // Set defaults on the transaction
const chainDate = new Date(properties.time + 'Z'); const chainDate = new Date(properties.time + 'Z');
const refBlockNum = (properties.last_irreversible_block_num - 1) & 0xFFFF; const refBlockNum = (properties.last_irreversible_block_num - 1) & 0xFFFF;
return steemApi.getBlockHeaderAsync(properties.last_irreversible_block_num).then((block) => { return hiveApi.getBlockHeaderAsync(properties.last_irreversible_block_num).then((block) => {
const headBlockId = block ? block.previous : '0000000000000000000000000000000000000000'; const headBlockId = block ? block.previous : '0000000000000000000000000000000000000000';
return Object.assign({ return Object.assign({
ref_block_num: refBlockNum, ref_block_num: refBlockNum,
...@@ -84,51 +83,62 @@ steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction ...@@ -84,51 +83,62 @@ steemBroadcast._prepareTransaction = function steemBroadcast$_prepareTransaction
// Generated wrapper ---------------------------------------------------------- // Generated wrapper ----------------------------------------------------------
// Generate operations from operations.json // Generate operations from operations.json
operations.forEach((operation) => { const updateOperations = () => {
const operationName = camelCase(operation.operation); // This function declaration + module redeclaration can be removed after hf24
const operationParams = operation.params || []; delete require.cache[require.resolve('./operations')];
operations = require('./operations');