fix: signatures
This commit is contained in:
parent
5461d6f93c
commit
0a13940742
|
@ -73,6 +73,9 @@ QtObject:
|
||||||
proc hex2Ascii*(self: UtilsView, value: string): string {.slot.} =
|
proc hex2Ascii*(self: UtilsView, value: string): string {.slot.} =
|
||||||
result = string.fromBytes(hexToSeqByte(value))
|
result = string.fromBytes(hexToSeqByte(value))
|
||||||
|
|
||||||
|
proc ascii2Hex*(self: UtilsView, value: string): string {.slot.} =
|
||||||
|
result = "0x" & toHex(value)
|
||||||
|
|
||||||
proc hex2Eth*(self: UtilsView, value: string): string {.slot.} =
|
proc hex2Eth*(self: UtilsView, value: string): string {.slot.} =
|
||||||
return stripTrailingZeroes(status_utils.wei2Eth(stint.fromHex(StUint[256], value)))
|
return stripTrailingZeroes(status_utils.wei2Eth(stint.fromHex(StUint[256], value)))
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,13 @@ Rectangle {
|
||||||
|
|
||||||
signal web3Response(string data);
|
signal web3Response(string data);
|
||||||
|
|
||||||
|
function signValue(input){
|
||||||
|
if(Utils.isHex(input) && Utils.startsWith0x(input)){
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
return utilsModel.ascii2Hex(input)
|
||||||
|
}
|
||||||
|
|
||||||
function postMessage(data) {
|
function postMessage(data) {
|
||||||
var request;
|
var request;
|
||||||
try {
|
try {
|
||||||
|
@ -189,6 +196,12 @@ Rectangle {
|
||||||
signDialog.signMessage = function (enteredPassword) {
|
signDialog.signMessage = function (enteredPassword) {
|
||||||
signDialog.interactedWith = true;
|
signDialog.interactedWith = true;
|
||||||
request.payload.password = enteredPassword;
|
request.payload.password = enteredPassword;
|
||||||
|
switch(request.payload.method){
|
||||||
|
case Constants.personal_sign:
|
||||||
|
request.payload.params[0] = signValue(request.payload.params[0]);
|
||||||
|
case Constants.eth_sign:
|
||||||
|
request.payload.params[1] = signValue(request.payload.params[1]);
|
||||||
|
}
|
||||||
const response = web3Provider.postMessage(JSON.stringify(request));
|
const response = web3Provider.postMessage(JSON.stringify(request));
|
||||||
provider.web3Response(response);
|
provider.web3Response(response);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -34,7 +34,16 @@ ModalPopup {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
stack.reset()
|
}
|
||||||
|
|
||||||
|
function displayValue(input){
|
||||||
|
if(Utils.isHex(input) && Utils.startsWith0x(input)){
|
||||||
|
if (input.length === bytes32Length){
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return utilsModel.hex2Ascii(input)
|
||||||
|
}
|
||||||
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -52,9 +61,9 @@ ModalPopup {
|
||||||
text: {
|
text: {
|
||||||
switch(request.payload.method){
|
switch(request.payload.method){
|
||||||
case Constants.personal_sign:
|
case Constants.personal_sign:
|
||||||
return request.payload.params[0].length === bytes32Length ? request.payload.params[0] : utilsModel.hex2Ascii(request.payload.params[0]);
|
return displayValue(request.payload.params[0]);
|
||||||
case Constants.eth_sign:
|
case Constants.eth_sign:
|
||||||
return request.payload.params[1];
|
return displayValue(request.payload.params[1]);
|
||||||
case Constants.eth_signTypedData:
|
case Constants.eth_signTypedData:
|
||||||
case Constants.eth_signTypedData_v3:
|
case Constants.eth_signTypedData_v3:
|
||||||
return JSON.stringify(request.payload.params[1]); // TODO: requires design
|
return JSON.stringify(request.payload.params[1]); // TODO: requires design
|
||||||
|
|
Loading…
Reference in New Issue