Options
Transaction timeout in seconds.
Maximum fee in stroops (1 XLM = 10,000,000 stroops).
Tip: openTxModal() opens a built-in modal that handles step 2 for you.
import { PollarClient } from '@pollar/core'; const client = new PollarClient({ apiKey, baseUrl }); await client.ready(); // build → sign → submit in one call await client.runTx('payment', { destination: 'G...', asset: { type: 'native', }, amount: '0', }); // …or run the steps yourself (see the React panel split): // const built = await client.buildTx('payment', { destination: 'G...', asset: { type: 'native', }, amount: '0', }); // await client.signAndSubmitTx(built.buildData.unsignedXdr);
const { buildTx } = usePollar(); await buildTx('payment', { destination: 'G...', asset: { type: 'native', }, amount: '0', });
const { signAndSubmitTx } = usePollar(); // available after buildTx resolves await signAndSubmitTx(unsignedXdr);
Submit a transaction to see its state here.
@pollar/react — hook & values used
All of these come from the usePollar() hook — the react layer built on top of getClient().
usePollar()hookparams: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.
returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.
buildTx(operation, params, options?)asyncparams: Same as client.buildTx — operation, params, options?.
returns: Promise<BuildOutcome> — builds the tx and drives the reactive tx state; the unsigned XDR lands in tx.buildData.
signAndSubmitTx(unsignedXdr?)asyncparams: unsignedXdr?: string — from the previous buildTx; omit for custodial flows.
returns: Promise<SubmitOutcome> — signs the built tx and broadcasts it.
openTxModal()syncparams: No arguments.
returns: void — opens a built-in modal that handles signing + submitting the built tx for you.
txreactive valueparams: Not a function — a value of type TransactionState read from usePollar().
returns: Re-renders your component through building → signing → submitting → success. Mirrors getClient().getTransactionState().
@pollar/core — functions used
All of these are methods on the client returned by getClient() — the underlying PollarClient instance.
buildTx(operation, params, options?)asyncparams: operation: TxBuildBody['operation'] (e.g. 'payment'); params: the operation body; options?: optional build flags (timeout, maxFee, memo).
returns: Promise<BuildOutcome> — builds the transaction and returns the unsigned XDR (or a custodial built tx) without submitting.
signAndSubmitTx(unsignedXdr?)asyncparams: unsignedXdr?: string — the XDR from buildTx. Omit it for custodial flows, where the SDK submits the built tx for you.
returns: Promise<SubmitOutcome> — { status: 'success' | 'pending' | 'error', hash, … }.
runTx(operation, params, options?)asyncparams: Same arguments as buildTx.
returns: Promise<SubmitOutcome> — one-shot build → sign → submit. Use it when you don't need the unsigned XDR in between.
getTransactionState()syncparams: No arguments.
returns: TransactionState — the current build/sign/submit progress; null before any tx runs.