Install
@starfun/sdk-vault? Every function keeps its name; import from @starfun/sdk/raise instead.
Set up
The examples use a connectedwallet with publicKey and signTransaction.
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.
Show the right action
Read the raise status withgetVaultStatusKey(vault.account.status) after every refresh, then show the matching action:
- Precommits are binding. Users can only withdraw them if the raise is cancelled.
- A countdown reaching zero doesn’t mean the status changed. Refresh and let the program decide.
- The table says which button to offer. The program still checks each user’s eligibility, so handle rejections.
Precommit
Refresh the vault before showing an action. Precommits lock funds until conversion or cancellation; users cannot withdraw at will.buildConvertCommitmentTx.
Deposit during the live raise
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:claimRefund. After accepted launch allocation, use claimExcessRefund for unclaimed excess:
buildClaimTransaction from the same @starfun/sdk/raise import, or the project’s claim link on Star.
Handle errors
Disable repeat submissions while signing/sending. Refresh the position and fundraise totals after confirmation.
Test the package in your production browser bundle; its CommonJS dependencies may require bundler configuration.