pbca26
7 years ago
12 changed files with 58 additions and 169 deletions
@ -1,51 +0,0 @@ |
|||
// remove
|
|||
|
|||
import Config from '../../config'; |
|||
import { checkAC } from '../../components/addcoin/payload'; |
|||
|
|||
export function getPassthruAgent(coin) { |
|||
let passthruAgent; |
|||
|
|||
if (coin === 'KMD') { passthruAgent = 'komodo'; }; |
|||
if (coin === 'ZEC') { passthruAgent = 'zcash'; }; |
|||
|
|||
if (checkAC(coin)) { passthruAgent = 'iguana'; }; |
|||
|
|||
return passthruAgent; |
|||
} |
|||
|
|||
export function iguanaHashHex(data, dispatch) { |
|||
const payload = { |
|||
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, |
|||
agent: 'hash', |
|||
method: 'hex', |
|||
message: data, |
|||
}; |
|||
|
|||
return new Promise((resolve, reject) => { |
|||
// skip iguana hashing in cli mode
|
|||
if (Config.cli.default) { |
|||
resolve(true); |
|||
} else { |
|||
fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { |
|||
method: 'POST', |
|||
body: JSON.stringify(payload), |
|||
}) |
|||
.catch((error) => { |
|||
console.log(error); |
|||
dispatch( |
|||
triggerToaster( |
|||
'iguanaHashHex', |
|||
'Error', |
|||
'error' |
|||
) |
|||
); |
|||
}) |
|||
.then(response => response.json()) |
|||
.then(json => { |
|||
resolve(json.hex); |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
@ -1,77 +0,0 @@ |
|||
// TODO: rewire to work with coind
|
|||
|
|||
import { triggerToaster } from '../actionCreators'; |
|||
import Config from '../../config'; |
|||
|
|||
export function restartIguanaInstance(pmid) { |
|||
return new Promise((resolve, reject) => { |
|||
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/restart?pmid=${pmid}`, { |
|||
method: 'GET', |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
}) |
|||
.catch((error) => { |
|||
console.log(error); |
|||
dispatch( |
|||
triggerToaster( |
|||
'restartIguanaInstance', |
|||
'Error', |
|||
'error' |
|||
) |
|||
); |
|||
}) |
|||
.then(response => response.json()) |
|||
.then(json => resolve(json)) |
|||
}); |
|||
} |
|||
|
|||
export function startIguanaInstance(mode, coin) { |
|||
return new Promise((resolve, reject) => { |
|||
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, { |
|||
method: 'POST', |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
body: JSON.stringify({ |
|||
mode, |
|||
coin, |
|||
}), |
|||
}) |
|||
.catch((error) => { |
|||
console.log(error); |
|||
dispatch( |
|||
triggerToaster( |
|||
'startIguanaInstance', |
|||
'Error', |
|||
'error' |
|||
) |
|||
); |
|||
}) |
|||
.then(response => response.json()) |
|||
.then(json => resolve(json)) |
|||
}); |
|||
} |
|||
|
|||
export function getIguanaInstancesList() { |
|||
return new Promise((resolve, reject) => { |
|||
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, { |
|||
method: 'GET', |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
}) |
|||
.catch((error) => { |
|||
console.log(error); |
|||
dispatch( |
|||
triggerToaster( |
|||
'getIguanaInstanceList', |
|||
'Error', |
|||
'error' |
|||
) |
|||
); |
|||
}) |
|||
.then(response => response.json()) |
|||
.then(json => resolve(json)) |
|||
}); |
|||
} |
Loading…
Reference in new issue