mirror of
https://github.com/status-im/snt-gas-relay.git
synced 2025-02-28 05:30:28 +00:00
Small fixes for complying with new message format
This commit is contained in:
parent
888355231b
commit
65a55cede0
@ -77,13 +77,13 @@ class MessageProcessor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let parsedObj = JSON.parse(this.web3.utils.toAscii(message.payload));
|
let parsedObj = JSON.parse(this.web3.utils.toAscii(message));
|
||||||
obj.address = parsedObj.address;
|
obj.address = parsedObj.address;
|
||||||
obj.functionName = parsedObj.encodedFunctionCall.slice(0, 8);
|
obj.functionName = parsedObj.encodedFunctionCall.slice(0, 10);
|
||||||
obj.functionParameters = "0x" + parsedObj.encodedFunctionCall.slice(8);
|
obj.functionParameters = "0x" + parsedObj.encodedFunctionCall.slice(10);
|
||||||
obj.payload = parsedObj.encodedFunctionCall;
|
obj.payload = parsedObj.encodedFunctionCall;
|
||||||
} catch(err){
|
} catch(err){
|
||||||
console.err("Couldn't parse " + message);
|
console.error("Couldn't parse " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -133,7 +133,7 @@ class MessageProcessor {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let input = JSON.parse(web3.utils.toAscii(message));
|
let input = this._extractInput(message.payload);
|
||||||
|
|
||||||
const contract = this.settings.getContractByTopic(message.topic);
|
const contract = this.settings.getContractByTopic(message.topic);
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class MessageProcessor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestBlock = await web3.eth.getBlock("latest");
|
const latestBlock = await this.web3.eth.getBlock("latest");
|
||||||
let estimatedGas = 0;
|
let estimatedGas = 0;
|
||||||
try {
|
try {
|
||||||
estimatedGas = await this._estimateGas(input, latestBlock.gasLimit);
|
estimatedGas = await this._estimateGas(input, latestBlock.gasLimit);
|
||||||
@ -194,7 +194,7 @@ class MessageProcessor {
|
|||||||
to: input.address,
|
to: input.address,
|
||||||
value: 0,
|
value: 0,
|
||||||
data: input.payload,
|
data: input.payload,
|
||||||
gas: gasLimit,
|
gas: gasLimit.toString(),
|
||||||
gasPrice: this.config.gasPrice
|
gasPrice: this.config.gasPrice
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user