Browse Source

custom ac params pubkey

custom-ac-example
pbca26 7 years ago
parent
commit
e60b7150dd
  1. 2
      gui/EasyDEX-GUI
  2. 2
      main.js
  3. 3
      routes/shepherd.js
  4. 23
      routes/shepherd/auth.js
  5. 11
      routes/shepherd/electrum/auth.js
  6. 8
      routes/shepherd/electrum/network.js
  7. 14
      routes/shepherd/quitDaemon.js
  8. 4
      version
  9. 2
      version_build

2
gui/EasyDEX-GUI

@ -1 +1 @@
Subproject commit b9b1283f55561064794a7ba58bc8ae4371b106fc
Subproject commit 88a8bcf78b2c8d5e400f8a58512195383dd4db8f

2
main.js

@ -294,6 +294,8 @@ function createWindow(status, hideLoadingWindow) {
mainWindow.pinAccess = false;
mainWindow.bip39 = bip39;
mainWindow.isWatchOnly = shepherd.isWatchOnly;
mainWindow.setPubkey = shepherd.setPubkey;
mainWindow.getPubkeys = shepherd.getPubkeys;
for (let i = 0; i < process.argv.length; i++) {
if (process.argv[i].indexOf('nvote') > -1) {

3
routes/shepherd.js

@ -39,6 +39,8 @@ shepherd.appRuntimeSPVLog = [];
shepherd.lockDownAddCoin = false;
shepherd.isWatchOnly = false;
shepherd.staking = {};
// dex cache
shepherd.mmupass = null;
shepherd.mmRatesInterval = null;
@ -61,7 +63,6 @@ shepherd.electrumCoins = {
auth: false,
};
shepherd.electrumKeys = {};
shepherd.electrumCache = {};
shepherd.electrumJSCore = require('./electrumjs/electrumjs.core.js');

23
routes/shepherd/auth.js

@ -63,5 +63,28 @@ module.exports = (shepherd) => {
return shepherd.isWatchOnly;
};
shepherd.setPubkey = (seed, coin) => {
const {
pub,
pubHex,
} = shepherd.seedToWif(seed, 'komodo', true);
shepherd.staking[coin] = {
pub,
pubHex,
};
shepherd.log(`pub key for ${coin} is set`);
shepherd.log(shepherd.staking[coin]);
};
shepherd.getPubkeys = () => {
return shepherd.staking;
};
shepherd.removePubkey = (coin) => {
delete shepherd.staking[coin];
};
return shepherd;
};

11
routes/shepherd/electrum/auth.js

@ -14,14 +14,17 @@ module.exports = (shepherd) => {
let keys;
let isWif = false;
if (req.body.seed.match('^[a-zA-Z0-9]{34}$') &&
if (_seed.match('^[a-zA-Z0-9]{34}$') &&
shepherd.appConfig.experimentalFeatures) {
shepherd.log('watchonly pub addr');
shepherd.electrumKeys[_abbr] = {
priv: req.body.seed,
pub: req.body.seed,
priv: _seed,
pub: _seed,
};
shepherd.isWatchOnly = true;
} else {
shepherd.isWatchOnly = false;
try {
bs58check.decode(_seed);
isWif = true;
@ -42,7 +45,7 @@ module.exports = (shepherd) => {
keys = shepherd.seedToWif(
_seed,
shepherd.findNetworkObj(_abbr),
req.body.iguana
req.body.iguana,
);
}

8
routes/shepherd/electrum/network.js

@ -75,10 +75,10 @@ module.exports = (shepherd) => {
coin === 'BET' ||
coin === 'CRYPTO' ||
coin === 'COQUI' ||
coin === 'GLXT' ||
coin === 'GLXT' ||
coin === 'OOT' ||
coin === 'HODL' ||
coin === 'EQL' ||
coin === 'EQL' ||
coin === 'SHARK' ||
coin === 'MSHARK' ||
coin === 'BOTS' ||
@ -106,9 +106,9 @@ module.exports = (shepherd) => {
coinUC === 'BET' ||
coinUC === 'CRYPTO' ||
coinUC === 'COQUI' ||
coinUC === 'GLXT' ||
coinUC === 'GLXT' ||
coinUC === 'OOT' ||
coinUC === 'EQL' ||
coinUC === 'EQL' ||
coinUC === 'HODL' ||
coinUC === 'SHARK' ||
coinUC === 'MSHARK' ||

14
routes/shepherd/quitDaemon.js

@ -25,7 +25,10 @@ module.exports = (shepherd) => {
let _arg = [];
if (chain &&
!shepherd.nativeCoindList[key.toLowerCase()] && key !== 'CHIPS') {
!shepherd.nativeCoindList[key.toLowerCase()] &&
key !== 'CHIPS') {
shepherd.removePubkey(chain.toLowerCase());
_arg.push(`-ac_name=${chain}`);
if (shepherd.appConfig.dataDir.length) {
@ -46,7 +49,7 @@ module.exports = (shepherd) => {
if (stdout.indexOf('EOF reached') > -1 ||
stderr.indexOf('EOF reached') > -1 ||
(error && error.toString().indexOf('Command failed') > -1 && !stderr) || // win "special snowflake" case
(error && error.toString().indexOf('Command failed') > -1 && !stderr) || // windows
stdout.indexOf('connect to server: unknown (code -1)') > -1 ||
stderr.indexOf('connect to server: unknown (code -1)') > -1) {
delete shepherd.coindInstanceRegistry[key];
@ -91,7 +94,10 @@ module.exports = (shepherd) => {
let _coindQuitCmd = shepherd.komodocliBin;
let _arg = [];
if (_chain) {
shepherd.removePubkey(_chain.toLowerCase());
_arg.push(`-ac_name=${_chain}`);
if (shepherd.appConfig.dataDir.length) {
@ -157,6 +163,10 @@ module.exports = (shepherd) => {
if (req.body.mode === 'native') {
delete shepherd.coindInstanceRegistry[_chain ? _chain : 'komodod'];
if (_chain) {
shepherd.removePubkey(_chain.toLowerCase());
}
const obj = {
msg: 'success',
result: 'result',

4
version

@ -1,3 +1,3 @@
version=0.2.35
version=0.2.36
type=beta
minversion=0.2.35
minversion=0.2.36

2
version_build

@ -1 +1 @@
0.2.35-beta
0.2.36-beta
Loading…
Cancel
Save