@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
74 lines • 2.55 kB
TypeScript
/**
* @purpose Simplified claimBorrower instruction wrapper
*
* Thin convenience wrapper around Codama-generated claimBorrower instruction.
* Allows claiming accumulated ATLAS from a borrower's managed token account.
* When close is true, bundles a closeBorrower instruction to also close the
* managed ATA and BorrowerState in a single transaction.
*/
import { type Address } from '@solana/kit';
import { type SdkConfig } from '../utils/config';
import { type UniversalSigner } from '../utils/signer';
import { prepareInstructions } from '../utils/instructions';
/**
* Parameters for claiming borrower ATLAS refunds
*/
export interface ClaimBorrowerParams {
/**
* Payer for the transaction (signs and pays fees)
* Accepts string address, web3.js Keypair, or @solana/kit signer
*/
payer: UniversalSigner;
/**
* Borrower whose ATLAS to claim (optional)
* If not provided, defaults to the payer's address.
* This allows a third party to pay for the claim transaction
* on behalf of the borrower.
*/
borrower?: Address | string;
/**
* If true, also close the managed ATA and BorrowerState after claiming.
* Bundles a closeBorrower instruction in the same transaction.
* Requires no active rentals **and** that `payer` is the borrower —
* only the borrower may authorize a close.
* @default false
*/
close?: boolean;
/**
* Sets compute units to allocate for the transaction.
* @example 400000
*/
computeUnits?: number;
}
/**
* Claim ATLAS refunds and bonuses owed to a borrower.
*
* Sweeps the borrower's managed ATA — accumulated bid refunds and
* knockoff bonuses from reservations — into their personal wallet.
*
* @param params - Borrower claim parameters
* @param config - Optional SDK configuration overrides
* @returns Kit instruction (or web3.js if PublicKey in config)
*
* @example
* ```typescript
* // Self-claim: payer is the borrower
* const ix = await claimBorrower({
* payer: borrowerWallet,
* });
*
* // Third-party claim: someone else pays
* const ix2 = await claimBorrower({
* payer: relayerWallet,
* borrower: "BORROWER_ADDRESS"
* });
*
* // Claim and close the BorrowerState account
* const ix3 = await claimBorrower({
* payer: borrowerWallet,
* close: true
* });
* ```
*/
export declare function claimBorrower(params: ClaimBorrowerParams, config?: Partial<SdkConfig>): Promise<ReturnType<typeof prepareInstructions>>;
//# sourceMappingURL=claimBorrower.d.ts.map