added 0.001 et txh

This commit is contained in:
Samuel Andert 2023-07-18 16:39:11 +02:00
parent 5fdaefac93
commit 7200050301
2 changed files with 43 additions and 4 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ yarn-error.log*
# typescript # typescript
*.tsbuildinfo *.tsbuildinfo
next-env.d.ts next-env.d.ts
.env

View File

@ -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({ const pkpWallet = new PKPEthersWallet({
controllerAuthSig: authSig, controllerAuthSig: authSig,
@ -45,7 +77,7 @@ export default function Home() {
const from = "0x06B6BE47c86cfcDF3f77c0e17e7aD8af750782aE"; const from = "0x06B6BE47c86cfcDF3f77c0e17e7aD8af750782aE";
const to = "0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A"; const to = "0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A";
const value = BigInt(5000000000000000); const value = BigInt(1000000000000000);
// @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) // @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit)
const transactionRequest = { const transactionRequest = {
@ -105,9 +137,14 @@ export default function Home() {
</p> </p>
} }
<ConnectButton /> <ConnectButton />
<button class="btn btn--primary" onClick={() => sendTX()}> <button style={{marginTop: "2rem", padding: "1rem"}} onClick={() => sendTXgnosis()}>
send send 0.001 xdai
</button> </button>
<button style={{marginTop: "2rem", padding: "1rem"}} onClick={() => sendTXethereum()}>
send 0.001 eth
</button>
</main> </main>
) )
} }