Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 481 Bytes

File metadata and controls

31 lines (21 loc) · 481 Bytes

getBalance

Check account balance

Method

async function getBalance(): BalanceResponse

Response

interface BalanceResponse {
    balance: number;
    currency?: "sats" | "EUR" | "USD"
}

Example

const provider = (window.$onekey && window.$onekey.webln) || window.webln;

await provider.enable();
const balance = await provider.getBalance();

Demo

{% embed url="https://codepen.io/OneKeyHQ/pen/GRzXmqN" %}