Reference > SDK

SDK reference

Document Quovra TypeScript helper methods.

SDK reference

Quovra exposes TypeScript helper functions in:

text
app/src/lib/quovra-client.ts

Installation

bash
git clone https://github.com/mystiquemide/quovra.git
cd quovra/app
npm install

Initialization

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

NameTypeDescription
PROGRAM_IDPublicKeyQuovra program id from onchain.json
MINTPublicKeyDevnet 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:

ParameterTypeDescription
connectionConnectionSolana connection
walletWalletLikeConnected wallet adapter
marketPubkeystringMarket account address
outcome`01`NO or YES
amountUsdcnumberHuman 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]