Skip to main content
Use this SDK to add Precommit and Deposit buttons to your website. Connect the user’s Solana wallet, then use the examples below. Only need to show totals and dates? Use the display guide; no SDK required.

Install

Set up

The examples use a connected wallet with publicKey and signTransaction.
Amounts use quote-token base units: for a six-decimal mint, 25 tokens is new BN('25000000'). Read mint.decimals; keep amounts as decimal strings or BN, never floating-point numbers. Users also need SOL for transaction fees and account rent.

Precommit

Refresh the vault before showing an action. Precommits lock funds until conversion or cancellation; users cannot withdraw at will.
Conversion into a deposit is a separate transaction after the live raise starts. Star or your integration operator submits it using buildConvertCommitmentTx.

Deposit during the live raise

Also check the start and end times when displaying the deposit button. The program enforces the live window. For SOL raises, automatic wrapping requires the atom amount to fit within Number.MAX_SAFE_INTEGER. Read positions with fetchCommitmentRecord(connection, vaultAddress, wallet.publicKey, programId) and StarVault.fetchDepositorRecord(...) using the same arguments. Their null result can mean a missing account or a read error.

Withdrawals and refunds

An unconverted commitment is withdrawable only after cancellation:
For eligible cancelled or failed deposits, use claimRefund. After accepted launch allocation, use claimExcessRefund for unclaimed excess:
These return quote tokens. Project-token claims use a separate launchpad integration or the project’s claim link on Star. Disable repeat submissions while signing/sending. Refresh the position and fundraise totals after confirmation. If confirmation times out, check the saved signature before submitting another contribution. Test the package in your production browser bundle; its CommonJS dependencies may require bundler configuration.