PollarPollarDemo

Products

WalletTransactionsSessionsDistribution

Integrations

KYCSoonRampNewSwapNew

Wallet Adapters

Stellar Wallets KitPrivyNewAcceslySoon

Built with Pollar

Trustless WorkNiriumNewLumenWipeNew
WalletTransactionsSessionsDistributionKYCSoonRampNewSwapNewStellar Wallets KitPrivyNewAcceslySoonTrustless WorkNiriumNewLumenWipeNew

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.

@pollar/core— framework-agnostic
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);
@pollar/react— hooks & components
1build transaction
const { buildTx } = usePollar();

await buildTx('payment', {
    destination: 'G...',
    asset: {
      type: 'native',
    },
    amount: '0',
  });
2submit signed transaction
const { signAndSubmitTx } = usePollar();

// available after buildTx resolves
await signAndSubmitTx(unsignedXdr);
transaction stateidle

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()hook

    params: 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?)async

    params: 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?)async

    params: unsignedXdr?: string — from the previous buildTx; omit for custodial flows.

    returns: Promise<SubmitOutcome> — signs the built tx and broadcasts it.

  • openTxModal()sync

    params: No arguments.

    returns: void — opens a built-in modal that handles signing + submitting the built tx for you.

  • txreactive value

    params: 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?)async

    params: 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?)async

    params: 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?)async

    params: 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()sync

    params: No arguments.

    returns: TransactionState — the current build/sign/submit progress; null before any tx runs.