Empty bytes handling

This commit is contained in:
Richard Ramos 2018-10-01 11:19:53 -04:00
parent e64f8cd6a5
commit 73f2ea6b85
1 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ export const Messages = {
}; };
const relayerSymmmetricKeyID = "0xd0d905c1c62b810b787141430417caf2b3f54cffadb395b7bb39fdeb8f17266b"; const relayerSymmmetricKeyID = "0xd0d905c1c62b810b787141430417caf2b3f54cffadb395b7bb39fdeb8f17266b";
const emptyBytesSha = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
class StatusGasRelayer { class StatusGasRelayer {
constructor(build, web3) { constructor(build, web3) {
if (arguments.length !== 2 || !this.validateBuild(build)) throw new Error("Invalid build"); if (arguments.length !== 2 || !this.validateBuild(build)) throw new Error("Invalid build");
@ -225,7 +225,7 @@ class IdentityGasRelayedAction extends Action {
hashedMessage = await contract.methods.callGasRelayHash( hashedMessage = await contract.methods.callGasRelayHash(
this.to, this.to,
this.value, this.value,
web3.utils.soliditySha3({t: 'bytes', v: this.data}), this.data == "0x" ? emptyBytesSha : web3.utils.soliditySha3({t: 'bytes', v: this.data}),
nonce, nonce,
this.gasPrice, this.gasPrice,
this.gasLimit, this.gasLimit,
@ -235,7 +235,7 @@ class IdentityGasRelayedAction extends Action {
case Functions.Identity.approveAndCall: case Functions.Identity.approveAndCall:
hashedMessage = await contract.methods.deployGasRelayHash( hashedMessage = await contract.methods.deployGasRelayHash(
this.value, this.value,
web3.utils.soliditySha3({t: 'bytes', v: this.data}), this.data == "0x" ? emptyBytesSha : web3.utils.soliditySha3({t: 'bytes', v: this.data}),
nonce, nonce,
this.gasPrice, this.gasPrice,
this.gasLimit, this.gasLimit,