Skip to content

Commit

Permalink
remove private key sdk backend method
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrock7 committed Jun 14, 2021
1 parent bab8679 commit 2f07f85
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions react-ui/src/components/Web3_EIP2771_EIP712Sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,58 +182,6 @@ function App() {
setNewQuote(event.target.value);
};

const onSubmitWithPrivateKey = async () => {
if (newQuote != "" && contract) {
setTransactionHash("");
console.log("Sending meta transaction");
let privateKey =
"2ef295b86aa9d40ff8835a9fe852942ccea0b7c757fad5602dfa429bcdaea910";
let userAddress = "0xE1E763551A85F04B4687f0035885E7F710A46aA6";
let txParams = {
from: userAddress,
to: config.contract.address,
data: contract.methods.setQuote(newQuote).encodeABI(),
gasLimit: web3.utils.toHex(300000),
};
const signedTx = await web3.eth.accounts.signTransaction(
txParams,
`0x${privateKey}`
);
const forwardData = await biconomy.getForwardRequestAndMessageToSign(
signedTx.rawTransaction
);
const signature = sigUtil.signTypedMessage(
new Buffer.from(privateKey, "hex"),
{ data: forwardData.eip712Format },
"V4"
);
let rawTransaction = signedTx.rawTransaction;
let data = {
signature: signature,
forwardRequest: forwardData.request,
rawTransaction: rawTransaction,
signatureType: biconomy.EIP712_SIGN,
};

web3.eth
.sendSignedTransaction(data)
.on("transactionHash", (hash) => {
console.log(`Transaction hash is ${hash}`);
showInfoMessage(
`Transaction sent via Biconomy. Waiting for confirmation.`
);
})
.once("confirmation", (confirmation, receipt) => {
console.log(`Transaction Confirmed.`);
console.log(receipt);
setTransactionHash(receipt.transactionHash);
showSuccessMessage("Transaction confirmed");
getQuoteFromNetwork();
});
} else {
showErrorMessage("Please enter the quote");
}
};

const onSubmit = async (event) => {
if (newQuote != "" && contract) {
Expand Down

0 comments on commit 2f07f85

Please sign in to comment.