Test wallet for LTO + WalletConnect
yarn install
yarn run dev
How to support LTO Network for WalletConnect?
import LTO from '@ltonetwork/lto' ;
import { txFromData } from '@ltonetwork/lto/transactions' ;
const seed = "your seed here" ;
const lto = new LTO ( 'T' ) ; // T for testnet, L for mainnet
const account = lto . account ( { seed } ) ;
const chain = lto . networkId === 'T' ? "lto:testnet" : "lto:mainnet" ;
const client = await SignClient . init ( {
// ...
} ) ;
// Starting a session
client . on ( "session_proposal" , async ( proposal ) => {
await client . approve ( {
id : proposal . id ,
namespaces : {
lto : {
accounts : [ `${ chain } :${ account . address } ` ] ,
methods : [ "lto_signTransaction" ] ,
events : [ ] ,
} ,
} ,
} ) ;
} ) ;
// Signing a transaction
client . on ( "session_request" , async ( event ) => {
const { topic, params, id } = event ;
const tx = txFromData ( params . request . params . transaction ) ;
const signedTx = account . sign ( tx ) ;
await client . respond ( {
topic : topic ,
response : {
id : id ,
jsonrpc : "2.0" ,
result : signedTx . toJSON ( ) ,
} ,
} ) ;
} ) ;