ethers.js example (Node)
Install
pnpm add @lithosphere/sdk ethersRead native balance via LithoClient
LithoClient// read-balance.ts
import { LithoClient, LithoError, ErrorCode } from '@lithosphere/sdk';
const client = new LithoClient('mainnet');
try {
const { formatted, symbol } = await client.getBalance(
'0x22d279d24f0b7ca5d49c5a7a7f032da416f72387',
);
console.log(`${formatted} ${symbol}`);
} catch (err) {
if (err instanceof LithoError && err.code === ErrorCode.RPC_TIMEOUT) {
console.error('RPC slow — retrying or switching endpoint advised');
} else {
throw err;
}
}Read a LEP-100 token balance via ethers
Sign and send a native transfer
Wait for confirmations with LithoClient
LithoClientNotes
Last updated