Developers
Integration guide
Read a wallet balance, connect a wallet and prepare staking calls from your own code.
Last updated 11 November 2026
Connect a wallet
The app wraps its tree in the Solana wallet adapter providers and opens a single picker for every supported wallet. Components read the connection with the useWallet hook.
import { useWallet } from '@solana/wallet-adapter-react'
export function Account() {
const { publicKey, connected, disconnect } = useWallet()
if (!connected || !publicKey) return null
return <button onClick={() => disconnect()}>{publicKey.toBase58()}</button>
}Read a VIVI balance
VIVI is a Token-2022 token, so the associated token address must be derived with the Token-2022 program ID. A missing account means the wallet holds none.
import { getAccount, getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
const ata = getAssociatedTokenAddressSync(mint, owner, false, TOKEN_2022_PROGRAM_ID)
const account = await getAccount(connection, ata, 'confirmed', TOKEN_2022_PROGRAM_ID)
const balance = Number(account.amount) / 10 ** 9Staking calls
Staking, unstaking, claiming and delegation are exposed as async functions that return a signature. Until the program is deployed they resolve with a simulated signature prefixed SIMULATED so they can never be mistaken for a real transaction.
| Function | Description |
|---|---|
| stakeVivi | Lock an amount for 0, 3, 6 or 12 months. |
| unstakeVivi | Withdraw an unlocked, undelegated amount. |
| claimRewards | Transfer accrued rewards to the owner wallet. |
| delegateToProvider | Delegate an amount to a provider. An amount of zero removes the delegation. |
Safety checklist
- Verify the mint address before any transaction and fail closed if it is not configured.
- Simulate every transaction and show the user the result before they sign.
- Validate amounts on the client and again in the program. Never trust a client-side balance.
- Use idempotent flows and surface failures; never silently retry a signed transaction.