@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
132 lines • 3.41 kB
TypeScript
import type { Address } from '@solana/kit';
export interface RentalAcceptedEvent {
type: 'RentalAccepted';
rentalState: Address;
contract: Address;
borrower: Address;
escrow: bigint;
rate: bigint;
serviceFee: bigint;
feeBps: number;
startTime: bigint;
endTime: bigint;
slot: bigint;
signature: string;
}
export interface RentalSettledEvent {
type: 'RentalSettled';
rentalState: Address;
contract: Address;
ownerEarned: bigint;
escrowRemaining: bigint;
isFinal: boolean;
slot: bigint;
signature: string;
}
export interface RentalCancelledEvent {
type: 'RentalCancelled';
rentalState: Address;
contract: Address;
borrower: Address;
ownerEarned: bigint;
feeCollected: bigint;
refund: bigint;
newEndTime: bigint;
slot: bigint;
signature: string;
}
export interface RentalClosedEvent {
type: 'RentalClosed';
rentalState: Address;
contract: Address;
borrower: Address;
ownerEarned: bigint;
feeCollected: bigint;
pointsAwarded: bigint;
slot: bigint;
signature: string;
}
export interface OwnerPaidEvent {
type: 'OwnerPaid';
contract: Address;
owner: Address;
amount: bigint;
slot: bigint;
signature: string;
}
export interface FeesPaidEvent {
type: 'FeesPaid';
contract: Address;
feeCollected: bigint;
discount: bigint;
discountBps: number;
slot: bigint;
signature: string;
}
export type AuditEvent = RentalAcceptedEvent | RentalSettledEvent | RentalCancelledEvent | RentalClosedEvent | OwnerPaidEvent | FeesPaidEvent;
export interface RentalReconciliation {
escrow: bigint;
escrowAccounted: bigint;
escrowDelta: bigint;
expectedEscrow: bigint;
escrowCorrect: boolean;
expectedServiceFee: bigint;
serviceFeeCorrect: boolean;
feeRatioBps: number;
expectedFeeBps: number;
feeRatioMatch: boolean;
discountVerified: boolean | null;
actualOwnerEarned: bigint;
actualFeeCollected: bigint;
actualRefund: bigint;
status: 'match' | 'mismatch';
}
export type RentalStatus = 'completed' | 'cancelled' | 'in-progress';
export interface RentalAudit {
status: RentalStatus;
borrower: Address;
startTime: Date;
endTime: Date;
durationSeconds: number;
rate: bigint;
feeBps: number;
escrow: bigint;
serviceFee: bigint;
accepted: RentalAcceptedEvent;
settlements: RentalSettledEvent[];
cancelled?: RentalCancelledEvent;
closed?: RentalClosedEvent;
feesPaid?: FeesPaidEvent;
ownerTransfers: OwnerPaidEvent[];
totalOwnerEarned: bigint;
totalFeeCollected: bigint;
totalDiscount: bigint;
totalRefund: bigint;
reconciliation: RentalReconciliation;
}
export interface ContractAuditReport {
contract: Address;
onChain: {
totalEarned: bigint;
ownerClaimable: bigint;
feeClaimable: bigint;
};
rentals: RentalAudit[];
isFullHistory: boolean;
summary: {
ownerEarned: bigint;
feeCollected: bigint;
discount: bigint;
refunds: bigint;
ownerTransfers: bigint;
matchesTotalEarned: boolean | null;
allRentalsMatch: boolean;
};
}
export interface AuditOptions {
lastN?: number;
since?: number;
all?: boolean;
onProgress?: (msg: string) => void;
}
//# sourceMappingURL=types.d.ts.map