feat: adds sig verification for eth_signTransaction
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
"react-error-overlay": "6.0.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethereumjs/tx": "^3.5.0",
|
||||
"@walletconnect/client": "2.0.0-beta.23",
|
||||
"@walletconnect/ethereum-provider": "2.0.0-beta.23",
|
||||
"@walletconnect/qrcode-modal": "^1.7.1",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import React, { useState } from "react";
|
||||
import { version } from "@walletconnect/client/package.json";
|
||||
import * as encoding from "@walletconnect/encoding";
|
||||
import { utils } from "ethers";
|
||||
import { TypedDataField } from "@ethersproject/abstract-signer";
|
||||
import { Transaction } from "@ethereumjs/tx";
|
||||
|
||||
import Banner from "./components/Banner";
|
||||
import Blockchain from "./components/Blockchain";
|
||||
@@ -27,8 +30,6 @@ import {
|
||||
SToggleContainer,
|
||||
} from "./components/app";
|
||||
import { useWalletConnectClient } from "./contexts/ClientContext";
|
||||
import { utils } from "ethers";
|
||||
import { TypedDataField } from "@ethersproject/abstract-signer";
|
||||
|
||||
interface IFormattedRpcResponse {
|
||||
method: string;
|
||||
@@ -129,13 +130,14 @@ export default function App() {
|
||||
};
|
||||
|
||||
// The return signature here is `RLPEncodedTransaction` but it actually returns as string (?).
|
||||
const result = (await web3Provider.eth.signTransaction(tx)) as unknown as string;
|
||||
const signedTx = (await web3Provider.eth.signTransaction(tx)) as unknown as string;
|
||||
const valid = Transaction.fromSerializedTx(signedTx as any).verifySignature();
|
||||
|
||||
return {
|
||||
method: "eth_signTransaction",
|
||||
address,
|
||||
valid: true,
|
||||
result,
|
||||
valid,
|
||||
result: signedTx,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1207,7 +1207,7 @@
|
||||
crc-32 "^1.2.0"
|
||||
ethereumjs-util "^7.1.4"
|
||||
|
||||
"@ethereumjs/tx@^3.3.2":
|
||||
"@ethereumjs/tx@^3.3.2", "@ethereumjs/tx@^3.5.0":
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.0.tgz#783b0aeb08518b9991b23f5155763bbaf930a037"
|
||||
integrity sha512-/+ZNbnJhQhXC83Xuvy6I9k4jT5sXiV0tMR9C+AzSSpcCV64+NB8dTE1m3x98RYMqb8+TLYWA+HML4F5lfXTlJw==
|
||||
|
||||
Reference in New Issue
Block a user