Reference > SDK
SDK reference
Document Quovra TypeScript helper methods.
SDK reference
Quovra exposes TypeScript helper functions in:
text
app/src/lib/quovra-client.tsInstallation
bash
git clone https://github.com/mystiquemide/quovra.git
cd quovra/app
npm installInitialization
ts
import { Connection } from "@solana/web3.js"
import { useWallet } from "@solana/wallet-adapter-react"
import { deposit, claim, requestFaucet } from "./src/lib/quovra-client"
const connection = new Connection("https://api.devnet.solana.com", "confirmed")
const wallet = useWallet()Constants
| Name | Type | Description |
|---|---|---|
PROGRAM_ID | PublicKey | Quovra program id from onchain.json |
MINT | PublicKey | Devnet test USDC mint from onchain.json |
requestFaucet(wallet)
Mints 100 devnet test USDC to a wallet through /api/faucet.
ts
const signature = await requestFaucet("<wallet>")Return value:
ts
Promise<string>Throws if the endpoint returns an error.
tokenBalance(connection, owner)
Reads the wallet's test USDC balance.
ts
const balance = await tokenBalance(connection, wallet.publicKey)Return value:
ts
Promise<number>Returns 0 if the token account does not exist.
deposit(connection, wallet, marketPubkey, outcome, amountUsdc)
Deposits devnet USDC into a market.
ts
const tx = await deposit(connection, wallet, marketPubkey, 1, 10)Parameters:
| Parameter | Type | Description | |
|---|---|---|---|
connection | Connection | Solana connection | |
wallet | WalletLike | Connected wallet adapter | |
marketPubkey | string | Market account address | |
outcome | `0 | 1` | NO or YES |
amountUsdc | number | Human USDC amount |
Return value:
ts
Promise<string>claim(connection, wallet, marketPubkey)
Claims payout for a winning position.
ts
const tx = await claim(connection, wallet, marketPubkey)Return value:
ts
Promise<string>Examples by language
cURL
bash
curl -X POST https://quovra.xyz/api/faucet \
-H 'Content-Type: application/json' \
-d '{"wallet":"<wallet>"}'JavaScript
js
const { Connection } = require("@solana/web3.js")
const connection = new Connection("https://api.devnet.solana.com", "confirmed")TypeScript
ts
const tx: string = await deposit(connection, wallet, marketPubkey, 1, 10)Python
python
# Use solders/solana-py for read-only integration.
# Wallet-signed deposit and claim are currently TypeScript-first.
from solana.rpc.api import Client
client = Client("https://api.devnet.solana.com")
print(client.get_account_info("2dTzj5v1nhzkS87e5umJkpNWNc7UschvyHwRVkkK4FZV"))Go
go
// Use github.com/gagliardetto/solana-go for read-only account inspection.
// Transaction builders are currently TypeScript-first.Rust
rust
// Use solana_client::rpc_client::RpcClient for account reads.
// Anchor client integration can target the Quovra IDL.Java
java
// Use a Solana JSON-RPC client to read program and transaction data.C#
csharp
// Use Solnet.Rpc for Solana account and transaction reads.Related pages
Search keywords
SDK, TypeScript, JavaScript, deposit, claim, requestFaucet
Last updated: [YYYY-MM-DD]