From 72000503017138c399cb7a98ee71822a1144ec34 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Tue, 18 Jul 2023 16:39:11 +0200 Subject: [PATCH] added 0.001 et txh --- .gitignore | 2 ++ src/app/page.js | 45 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8f322f0..62190d7 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +.env \ No newline at end of file diff --git a/src/app/page.js b/src/app/page.js index 6a174bb..ecf238c 100644 --- a/src/app/page.js +++ b/src/app/page.js @@ -33,7 +33,39 @@ export default function Home() { } - async function sendTX(){ + async function sendTXethereum(){ + + const pkpWallet = new PKPEthersWallet({ + controllerAuthSig: authSig, + pkpPubKey: "046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571", + rpc: "https://rpc.eth.gateway.fm", + }); + await pkpWallet.init(); + console.log(pkpWallet); + + const from = "0x06B6BE47c86cfcDF3f77c0e17e7aD8af750782aE"; + const to = "0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A"; + const value = BigInt(1000000000000000); + const chainId = 1; + const gasLimit = 21000; + + // @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const transactionRequest = { + from, + to, + value, + chainId, + gasLimit, + }; + + const signedTransactionRequest = await pkpWallet.signTransaction( + transactionRequest + ); + + await pkpWallet.sendTransaction(signedTransactionRequest); + } + + async function sendTXgnosis(){ const pkpWallet = new PKPEthersWallet({ controllerAuthSig: authSig, @@ -45,7 +77,7 @@ export default function Home() { const from = "0x06B6BE47c86cfcDF3f77c0e17e7aD8af750782aE"; const to = "0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A"; - const value = BigInt(5000000000000000); + const value = BigInt(1000000000000000); // @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) const transactionRequest = { @@ -105,9 +137,14 @@ export default function Home() {

} - + + + ) }