Client methods
Public Solard client methods.
Construction and lifecycle
createSolard(options?)
Create the public Solard client. Importing the module alone does not create persistence.
function createSolard(options: SolardOptions = {}): Solard
type SolardOptions = {
rpcUrl?: string;
dbPath?: string;
cacheTtlMs?: number;
};| Option | Type | Default | Meaning |
|---|---|---|---|
rpcUrl | string? | — | Optional RPC endpoint override passed to the core Solard connection layer. |
dbPath | string? | — | Optional SQLite database path override. |
cacheTtlMs | number? | — | Optional account-cache TTL override. |
createTraderSolard
Alias for <code>createSolard</code>; no extra methods.
const createTraderSolard = createSolardclose()
Close the underlying Solard instance and database/connection resources owned by the client.
close(): voidWallet methods
Wallet methods expose public metadata. Signing does not expose private keys or raw signer objects.
createWallet
Generate a new Solana keypair and persist it encrypted in the canonical Solard database.
createWallet(name?: string): WalletInfo| Option | Type | Default | Meaning |
|---|---|---|---|
name | string? | — | Optional stored wallet alias. |
const wallet = slrd.createWallet("maker");
console.log(wallet.address);createVanityWallet
Search for a public-key suffix, persist the matching keypair as an encrypted wallet, and return generation statistics.
createVanityWallet(
name: string | undefined,
options: VanityMintOptions,
): Promise<{
wallet: WalletInfo;
suffix: string;
attempts: number;
elapsedMs: number;
ratePerSecond: number;
lastMint: string;
}>
type VanityMintOptions = {
suffix: string;
maxAttempts?: number;
timeoutMs?: number;
reportEvery?: number;
onProgress?: (progress: VanityMintProgress) => void;
workers?: number;
signal?: AbortSignal;
};| Option | Type | Default | Meaning |
|---|---|---|---|
name | string | undefined | — | Stored wallet alias. |
options.suffix | string | — | Required public-key suffix target. |
options.maxAttempts | number? | — | Optional attempt budget. |
options.timeoutMs | number? | — | Optional wall-clock timeout. |
options.reportEvery | number? | — | Progress callback interval. |
options.workers | number? | — | Parallel vanity workers. |
options.signal | AbortSignal? | — | Abort the generation search. |
importWallet
Parse a base58 or JSON byte-array private key and persist it encrypted in the wallet database.
importWallet(privateKey: string, name?: string, options?: { overwrite?: boolean }): WalletInfo- Same-address re-imports can update without overwrite. Replacing a different wallet that already uses the requested name requires overwrite=true.
| Option | Type | Default | Meaning |
|---|---|---|---|
privateKey | string | — | Base58 secret key or JSON array of secret-key bytes. |
name | string? | — | Optional wallet alias. |
options.overwrite | boolean? | false | Allow replacing a different wallet that already uses the requested name. |
listWallets
List every stored wallet as public metadata without exposing encrypted-secret fields.
listWallets(): WalletInfo[]Do not cast createSolard() to expose core-only signers, connections, or repositories.
Token registry and account methods
addToken
Read the mint, inspect it through registered venue adapters, and upsert the resulting token record.
addToken(mintRef: string, name?: string, metadata: Partial<TokenRow> = {}): Promise<TokenRow>- The method reads on-chain decimals/token program, merges venue inspection fields, then applies supplied metadata and stores refreshedAtMs.
| Option | Type | Default | Meaning |
|---|---|---|---|
mintRef | string | — | Base58 token mint address. |
name | string? | — | Optional human alias/name override. |
metadata | Partial<TokenRow> | {} | Additional persisted token metadata merged after inspection. |
resolveToken
Resolve a stored token by supported reference form. This does not automatically add an unknown mint.
resolveToken(ref: TokenRef): TokenRowtokenAccounts
List actual token accounts owned by a wallet across both the classic Token program and Token-2022.
tokenAccounts(ref: WalletRef): Promise<OwnedTokenAccount[]>- Each returned account includes address, mint, owner, raw amount, decimals, token program, lamports, associated-account status, account state, and close authority.
snapshotHolders
Take a complete on-chain holder snapshot suitable for payout denominators and accounting.
snapshotHolders(token: TokenRef, options?: Omit<TokenHolderSnapshotOptions, 'token'>): Promise<TokenHolderSnapshot>- The underlying snapshot reads token-program accounts directly rather than stitching websocket deltas.
- Solard automatically passes stored Pump/PumpSwap token metadata into the lower-level snapshot primitive so curve, pool, and sharing-config inventory can be excluded when known.
| Option | Type | Default | Meaning |
|---|---|---|---|
token | TokenRef | — | Stored token reference. |
commitment | confirmed|finalized? | confirmed | Snapshot commitment. |
excludeOwners | Iterable<string|PublicKey>? | — | Explicit owner addresses excluded from the eligible denominator. |
minimumRaw | bigint? | 1n | Exclude balances below this raw-token threshold. |
walletBalances
Read confirmed SOL balance plus balances for the supplied token references.
walletBalances(ref: WalletRef, tokenRefs?: TokenRef[]): Promise<WalletBalanceSnapshot>- When tokenRefs is omitted in core, the method uses the stored token registry. It also refreshes missing decimals when necessary and records position balances in Solard's internal position store.
Market and trading methods
samplePrice
Resolve the token's venue, sample its current quote-per-token price, and persist that price sample.
samplePrice(token: TokenRef): Promise<MarketPrice>buy
Build, simulate by default, submit, and confirm a routed native Solard buy for one wallet.
buy(
token: TokenRef,
wallet: WalletRef,
amount: HumanAmount,
options?: {
slippageBps?: number;
via?: SenderId;
skipSimulation?: boolean;
skipPreflight?: boolean;
},
): Promise<SendReceipt>- The public SDK buy method is an execution method, not a quote-only method. It calls the transaction composer and sends immediately.
- When a PumpSwap preflight fails with the specific retryable 6040 simulation error, the core method rebuilds exactly once so the pool/fee quote is fresh while preserving the requested slippage.
- The SDK wrapper does not impose the CLI's 1500-bps default; omitted options flow to the underlying composer/venue behavior.
| Option | Type | Default | Meaning |
|---|---|---|---|
token | TokenRef | — | Registered token to buy. |
wallet | WalletRef | — | Stored signing wallet reference. |
amount | HumanAmount | — | SOL or raw quote-asset amount accepted by the routed market. |
options.slippageBps | number? | — | Optional slippage override. |
options.via | SenderId? | rpc | Sender lane. |
options.skipSimulation | boolean? | false | Skip Solard's explicit simulation step. |
options.skipPreflight | boolean? | — | Sender preflight preference. |
sell
Build, simulate by default, submit, and confirm a routed sell for one wallet.
sell(
token: TokenRef,
wallet: WalletRef,
options?: {
bps?: number;
slippageBps?: number;
via?: SenderId;
skipSimulation?: boolean;
skipPreflight?: boolean;
},
): Promise<SendReceipt>- The method is an execution method. bps selects the fraction of token balance sold; sender defaults to rpc inside the core method when omitted.
| Option | Type | Default | Meaning |
|---|---|---|---|
token | TokenRef | — | Registered token to sell. |
wallet | WalletRef | — | Stored signing wallet. |
options.bps | number? | — | Balance fraction in basis points. |
options.slippageBps | number? | — | Optional slippage override. |
options.via | SenderId? | rpc | Sender lane. |
options.skipSimulation | boolean? | false | Skip explicit Solard simulation. |
options.skipPreflight | boolean? | — | Sender preflight preference. |