Skip to main content

Transfer LYX

Transfering 0.5 LYXt between two Universal Profiles
Transfering 0.5 LYXt between two Universal Profiles.

info

The full code of this example can be found in the πŸ‘Ύ lukso-playground repository.

The πŸ†™ Universal Profile Extension magically wraps all the calls internally so you don't have to craft custom transactions.

This makes it easy to send transaction like LYX transfer (= native token transfers). Simply use eth_sendTransaction as you always did while working with wallets and smart accounts that used EOAs.

No need to make contract calls to instruct the smart contract of the Universal Profile what to do. The Browser Extension handles all of that behind the scene for you!

Setup Dependencies​

npm install ethers

Code Examples​

import { ethers } from 'ethers';

const provider = new ethers.BrowserProvider(window.lukso);

await provider.send('eth_requestAccounts', []);

const signer = await provider.getSigner();
const account = await signer.getAddress();

// Send transaction
const tx = await signer.sendTransaction({
from: account, // The Universal Profile address
to: '0x...', // Receiving address, can be a UP or EOA
value: ethers.parseEther('0.5'), // 0.5 amount in ETH, in wei unit
});