-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(bridge): comply w/ eslint rules
- Loading branch information
Showing
5 changed files
with
37 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
const ethTx = require('ethereumjs-tx').Transaction | ||
const ethUtils = require('ethereumjs-util') | ||
const rawTransaction = require('./rawTransaction') | ||
const EthTx = require("ethereumjs-tx").Transaction | ||
const ethUtils = require("ethereumjs-util") | ||
const rawTransaction = require("./rawTransaction") | ||
|
||
module.exports = function (json, r, s, gasprice, gaslimit) { | ||
const rawTx = rawTransaction(json, r, s, gasprice, gaslimit) | ||
const tx = new ethTx(rawTx) | ||
const tx = new EthTx(rawTx) | ||
|
||
const res = { | ||
bytecode: rawTx.data, | ||
contractAddr: ethUtils.toChecksumAddress( | ||
'0x' + ethUtils.generateAddress( | ||
tx.getSenderAddress(), | ||
ethUtils.toBuffer(0) | ||
).toString('hex') | ||
), | ||
"0x" + ethUtils.generateAddress( | ||
tx.getSenderAddress(), | ||
ethUtils.toBuffer(0) | ||
).toString("hex") | ||
), | ||
gasLimit: rawTx.gasLimit.toString(), | ||
gasPrice: rawTx.gasPrice.toString(), | ||
rawTx: '0x' + tx.serialize().toString('hex'), | ||
sender: ethUtils.toChecksumAddress('0x' + tx.getSenderAddress().toString('hex')), | ||
}; | ||
return res; | ||
} | ||
rawTx: "0x" + tx.serialize().toString("hex"), | ||
sender: ethUtils.toChecksumAddress("0x" + tx.getSenderAddress().toString("hex")), | ||
} | ||
return res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
generateDeployTx: require('./generateDeployTx'), | ||
traceEvents: require('./traceEvents.js'), | ||
} | ||
generateDeployTx: require("./generateDeployTx"), | ||
traceEvents: require("./traceEvents.js"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = function(addr) { | ||
return addr.substring(0, 6) + ".." + addr.slice(-4); | ||
} | ||
module.exports = function (addr) { | ||
return addr.substring(0, 6) + ".." + addr.slice(-4) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
const shortenAddr = require('./shortenAddr') | ||
const shortenAddr = require("./shortenAddr") | ||
|
||
module.exports = async function (logs, web3) { | ||
for (var i = 0; i < logs.length; i++) { | ||
var event = logs[i].event; | ||
var args = logs[i].args; | ||
var params = "" | ||
for (let i = 0; i < logs.length; i++) { | ||
const event = logs[i].event | ||
const args = logs[i].args | ||
let params = "" | ||
|
||
switch (event) { | ||
case "PostedRequest": | ||
case "PostedResult": | ||
params = `from: ${shortenAddr(args[0])}, id: ${args[1].toString(16)}` | ||
break | ||
|
||
default: | ||
continue; | ||
continue | ||
} | ||
let tabs = "\t" | ||
if (event.length < 13) tabs = "\t\t" | ||
console.log(" ", `>> ${event}${tabs}(${params})`) | ||
} | ||
} | ||
} |