Skip to content

Commit

Permalink
Merge branch 'delivan/keplr-739' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunnini committed Feb 4, 2025
2 parents 5b2c0aa + cfccb91 commit 7d49e52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 8 additions & 7 deletions apps/extension/src/pages/sign/ethereum/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export const EthereumSigningView: FunctionComponent<{
case EthSignType.MESSAGE:
// If the message is 32 bytes, it's probably a hash.
if (signingDataBuff.length === 32) {
return signingDataBuff.toString("hex");
return "0x" + signingDataBuff.toString("hex");
} else {
const text = (() => {
const string = signingDataBuff.toString("utf8");
Expand All @@ -294,7 +294,8 @@ export const EthereumSigningView: FunctionComponent<{
const decoder = new TextDecoder("utf-8", { fatal: true });
decoder.decode(new Uint8Array(buf)); // UTF-8 변환 시도
} catch {
return buf.toString("hex");
// 정상적인 utf-8 문자열이 아니면 hex로 변환
return "0x" + buf.toString("hex");
}

return buf.toString("utf8");
Expand All @@ -315,7 +316,7 @@ export const EthereumSigningView: FunctionComponent<{
case EthSignType.EIP712:
return JSON.stringify(JSON.parse(signingDataBuff.toString()), null, 2);
default:
return signingDataBuff.toString("hex");
return "0x" + signingDataBuff.toString("hex");
}
}, [signingDataBuff, signType]);

Expand Down Expand Up @@ -369,7 +370,7 @@ export const EthereumSigningView: FunctionComponent<{
isLedgerInteracting ||
isKeystoneInteracting;

const buttonDisabled = txConfigsValidate.interactionBlocked;
const buttonDisabled = isTxSigning && txConfigsValidate.interactionBlocked;

return (
<HeaderLayout
Expand Down Expand Up @@ -438,7 +439,7 @@ export const EthereumSigningView: FunctionComponent<{
setLedgerInteractingError(undefined);
signature = await handleEthereumPreSignByLedger(
interactionData,
Buffer.from(signingDataText),
signingDataBuff,
{
useWebHID: uiConfigStore.useWebHIDLedger,
}
Expand All @@ -448,7 +449,7 @@ export const EthereumSigningView: FunctionComponent<{
setKeystoneInteractingError(undefined);
signature = await handleEthereumPreSignByKeystone(
interactionData,
Buffer.from(signingDataText),
signingDataBuff,
{
displayQRCode: async (ur: KeystoneUR) => {
setKeystoneUR(ur);
Expand All @@ -463,7 +464,7 @@ export const EthereumSigningView: FunctionComponent<{

await signEthereumInteractionStore.approveWithProceedNext(
interactionData.id,
Buffer.from(signingDataText),
signingDataBuff,
signature,
async (proceedNext) => {
if (!proceedNext) {
Expand Down
6 changes: 4 additions & 2 deletions packages/background/src/keyring-ethereum/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class KeyRingEthereumService {
signature.s,
// The metamask doesn't seem to consider the chain id in this case... (maybe bug on metamask?)
signature.v
? Buffer.from("1c", "hex")
? Buffer.from(signature.v.toString(16), "hex")
: Buffer.from("1b", "hex"),
]),
};
Expand Down Expand Up @@ -600,7 +600,9 @@ export class KeyRingEthereumService {
origin,
currentChainId,
signer,
Buffer.from(message),
message.startsWith("0x")
? Buffer.from(message.slice(2), "hex")
: Buffer.from(message, "utf8"),
EthSignType.MESSAGE
);

Expand Down

0 comments on commit 7d49e52

Please sign in to comment.