auth.andert.me/src/lib/Send.svelte

33 lines
838 B
Svelte
Raw Normal View History

<script>
2023-07-20 15:07:03 +00:00
export let pkpWallet;
const sendTransaction = async () => {
2023-07-20 15:07:03 +00:00
console.log('transaction initiated');
const from = pkpWallet.address;
const to = '0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A';
const value = BigInt(10000000000000000);
const gasLimit = 21000;
const tx = {
from,
to,
value,
gasLimit
};
console.log('transaction created: ' + tx);
const signedTx = await pkpWallet.signTransaction(tx);
console.log('transaction signed: ' + signedTx);
await pkpWallet.sendTransaction(signedTx);
console.log('transaction sent');
};
</script>
2023-07-20 15:07:03 +00:00
<button
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full shadow-lg focus:outline-none focus:shadow-outline-blue active:bg-blue-800 transition duration-150 ease-in-out"
on:click={sendTransaction}
>
send 0.01 xdai
</button>