Send
Transfer assets to another Stellar address. Pollar renders the asset picker, amount input, review and signing flow inside a modal.
Build, sign and submit the payment yourself with a single runTx('payment', …) call, then read the transaction state.
Connect a wallet to load its held assets — native XLM is shown by default.
runTx('payment')
Functions used
All of these are methods on the client returned by getClient() — the underlying PollarClient instance.
runTx(operation, params, options?)asyncparams: operation: TxBuildBody['operation'] (e.g. 'payment'); params: the operation body — for a payment, { destination, asset, amount }; options?: optional build flags.
returns: Promise<SubmitOutcome> — { status: 'success' | 'pending' | 'error', hash, … }. One-shot build → sign → submit.
getTransactionState()syncparams: No arguments.
returns: TransactionState — the current build/sign/submit progress; null before any tx runs.
onTransactionStateChange(cb)syncparams: cb: (state: TransactionState) => void — invoked on every state transition.
returns: () => void — an unsubscribe function. The react hook's tx value is built on top of this.
Using core from @pollar/react
Prefer @pollar/react? You keep all of core — the same PollarClient sits underneath. Reach it two equivalent ways:
// A — build the client, pass the instance to the provider const client = new PollarClient({ apiKey, baseUrl }); <PollarProvider client={client}>…</PollarProvider> const c = usePollar().getClient(); // ← same instance // B — let the provider build it from config <PollarProvider client={{ apiKey, baseUrl }}>…</PollarProvider> const c = usePollar().getClient(); // ← same instance
Both hand you the identical client, so every @pollar/core method on this page works verbatim. You can even run @pollar/react fully headless (just getClient(), ignore the prebuilt modals) — but its edge is the reactive hooks that re-render your UI for you.
import { PollarClient } from '@pollar/core'; const client = new PollarClient({ apiKey, baseUrl }); await client.ready(); // "Send" is a payment operation: build → sign → submit in one call. const res = await client.runTx('payment', { destination: 'G...', asset: { type: 'native' }, amount: '10', }); // res.status: 'success' | 'pending' | 'error' // res.hash
Fill in destination, asset and amount, then run the payment.