Skip to content

Commit 859379a

Browse files
author
Julien
committed
Remove an old field used by the old daemon, not needed anymore
1 parent cf59b22 commit 859379a

File tree

2 files changed

+6
-36
lines changed

2 files changed

+6
-36
lines changed

src/infura/api-infura.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ export default class API {
6363
* @param config Configuration object with all properties as per
6464
* config.json.template
6565
* @param web3 Initiated and connected web3 instance
66-
* @param privateKey (optional) The private key used to sign the transactions (for using Infura for example)
6766
*
6867
* @return Constructed and initialised instance of this class
6968
*/
70-
static async newInstance(config, web3, privateKey) {
71-
const api = new API(config, web3, privateKey)
69+
static async newInstance(config, web3) {
70+
const api = new API(config, web3)
7271
await api.initialise()
7372
return api
7473
}
@@ -243,12 +242,10 @@ export default class API {
243242
* @param config Configuration object with all properties as per
244243
* config.json.template
245244
* @param web3 Initiated web3 instance for the network to work with.
246-
* @param privateKey (optional) The private key used to sign the transactions (for using Infura for example)
247245
*/
248-
constructor(config, web3, privateKey = undefined) {
246+
constructor(config, web3) {
249247
this.config = config
250248
this.web3 = web3
251-
this.privateKey = privateKey
252249
// Our pushes queue (since we can only push one at a time)
253250
this.pushQueue = []
254251
// When a transaction is pending, that variable will hold the transaction hash

src/infura/cfd-api-infura.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ export default class CFDAPI {
3232
* @param config Configuration object with all properties as per
3333
* config.json.template
3434
* @param web3 Initiated and connected web3 instance
35-
* @param privateKey (optional) The private key used to sign the transactions when using Infura (needed only for the daemon)
3635
*
3736
* @return Constructed and initialised instance of this class
3837
*/
39-
static async newInstance(config, web3, privateKey) {
40-
const api = new CFDAPI(config, web3, privateKey)
38+
static async newInstance(config, web3) {
39+
const api = new CFDAPI(config, web3)
4140
await api.initialise()
4241
return api
4342
}
@@ -483,30 +482,6 @@ export default class CFDAPI {
483482
throw new Error(error)
484483
})
485484
}
486-
/**
487-
* Check for liquidation with a signed transaction (for the daemon)
488-
* @param cfdAddress, Address of the contract
489-
*/
490-
attemptContractLiquidationDaemon(cfdAddress) {
491-
const self = this
492-
return Promise.all([this.web3.eth.getCodeAsync(cfdAddress)])
493-
.then(() => {
494-
// Contract address exists
495-
const cfd = getContract(cfdAddress, self.web3)
496-
return signAndSendTransaction(
497-
self.web3,
498-
self.config.daemonAccountAddr,
499-
self.privateKey,
500-
cfdAddress,
501-
cfd.methods.liquidate().encodeABI(),
502-
self.config.gasPrice,
503-
500000
504-
)
505-
})
506-
.catch(error => {
507-
throw new Error(error)
508-
})
509-
}
510485

511486
/**
512487
* Fulfill a request to change the sale price for a CFD for sale
@@ -925,12 +900,10 @@ export default class CFDAPI {
925900
*
926901
* @param config Configuration object with all properties as per config.json.template
927902
* @param web3 Initiated web3 instance for the network to work with.
928-
* @param privateKey (optional) The private key used to sign the transactions (for using Infura for example)
929903
*/
930-
constructor(config, web3, privateKey = undefined) {
904+
constructor(config, web3) {
931905
this.config = config
932906
this.web3 = web3
933-
this.privateKey = privateKey
934907
this.web3.eth.getCodeAsync = Promise.promisify(this.web3.eth.getCode)
935908
this.web3.eth.getBlockAsync = Promise.promisify(this.web3.eth.getBlock)
936909
}

0 commit comments

Comments
 (0)