Docs/Start
First payment with the SDK
Install the SDK, unlock a wallet, pay a whitelisted recipient and find the payment from the other side.
This page runs a whole payment in fixture mode, where a fixture server plays the chain and the wallets are public demo actors. The same calls work in real mode with a real wallet, as the last section shows.
#Install
npm install --install-links ./liora-contract-0.2.1.tgz ./liora-sdk-0.2.2.tgzNode 22 or a current browser.
#Unlock
import { createLioraSdk, fixtureWallet } from "@liora/sdk";
const payer = await createLioraSdk({ mode: "fixture", baseUrl, sessionId });
await payer.unlock(fixtureWallet("payer"));
const [sol] = await payer.balances();unlock has the wallet sign one message and derives every key from the signature. balances scans for the notes those keys own:
{ "assetId": "1", "decimals": 9, "symbol": "SOL", "amountLamports": "5000000000" }#Pay
const found = await payer.lookup("mira");
// { state: "found", entry: … }
const paid = await payer.pay(
{ recipient: "mira", assetId: "1", amountLamports: "250000000" },
(state) => console.log(state.state),
);pay looks the recipient up, derives the stealth address and the audit ciphertext, proves, and sends through the relayer. It resolves to the final state:
{
"state": "confirmed",
"kind": "pay",
"signature": "YQ6s1fVTEXF9uivz2j5NPQbFrMaoA97fkBM6kH5vR2WJUBSiwDVXHQYY3vy7rffeswUyjWTrdcaSm9dMvD198FC",
"receipt": {
"stealthAddress": "4ea5904d421ea736de093144f9692238f2bb6b3ab01ca6d6576d7bd10f5d7ba7",
"ephemeralKey": "d396c6e19976f33afbc86ac658b341fcb2c4f75dccd3eea2ec2907b0162db499",
"viewTag": 200,
"auditCiphertext": {
"c1": "85aab4f944351ff6570e71c090c2a9280c1549614fa8a8f3095e4a4c9aadb307",
"c2": "781cb25d17fc78b94163a3a7dc5f0791e661d227ec60aa2a9c5efa447e7b6d06"
},
"whitelistRoot": "073b116d9ea244810fb4b574cf9bac61c35d7d8b2a56b60facf9fcd4ae6608a8",
"signature": "YQ6s1fVTEXF9uivz2j5NPQbFrMaoA97fkBM6kH5vR2WJUBSiwDVXHQYY3vy7rffeswUyjWTrdcaSm9dMvD198FC",
"eventIndex": 0,
"slot": "3",
"blockTime": "2026-11-25T14:32:54.812Z",
"proofVerified": true
}
}The receipt is everything the public can read of this payment. It names no recipient and no amount.
#Find it from the other side
const recipient = await createLioraSdk({ mode: "fixture", baseUrl, sessionId });
await recipient.unlock(fixtureWallet("recipient"));
const inbox = await recipient.scan();[
{ "amountLamports": "250000000", "spendable": true, "signature": "YQ6s1fVTEXF9uivz2j5NPQbFrMaoA97fkBM6kH5vR2WJUBSiwDVXHQYY3vy7rffeswUyjWTrdcaSm9dMvD198FC" },
{ "amountLamports": "1250000000", "spendable": true, "signature": "3Bk4LAuEJc9LfagU6SXnYyU7wmi1HHgY79v5GojytBY8Jf1ENyaAMTGWUiChaRU7EPAYp6JHqyHT86qBtYTJYkeT" }
]The first is the payment just made. The second was on the fixture chain already.
#And as the auditor
import { fixtureAuditorSecret } from "@liora/sdk";
const auditor = await createLioraSdk({ mode: "fixture", baseUrl, sessionId });
await auditor.unlockAudit(fixtureAuditorSecret);
const rows = await auditor.audit();[
{ "signature": "YQ6s1fVTEXF9uivz2j5NPQbFrMaoA97fkBM6kH5vR2WJUBSiwDVXHQYY3vy7rffeswUyjWTrdcaSm9dMvD198FC", "handle": "mira", "amount": "encrypted" },
{ "signature": "3Bk4LAuEJc9LfagU6SXnYyU7wmi1HHgY79v5GojytBY8Jf1ENyaAMTGWUiChaRU7EPAYp6JHqyHT86qBtYTJYkeT", "handle": "mira", "amount": "encrypted" }
]The auditor reads who was paid. The amount stays encrypted.
#Real mode
const liora = await createLioraSdk({ mode: "real", baseUrl: apiOrigin });
await liora.unlock(wallet);wallet is any object with an address, a signMessage and, for deposits, a signTransaction. Everything above works the same, with real proofs and real confirmations. SDK lists every call.