p-sdk-wallet
Version:
A comprehensive wallet SDK for React Native (pwc), supporting multi-chain and multi-account features.
69 lines (68 loc) • 2.01 kB
TypeScript
import { TransactionResponse } from '../Vault';
/**
* Represents a recipient for multi-transfer operations.
*/
export interface Recipient {
/** The recipient's address */
address: string;
/** The amount to transfer (human readable string) */
amount: string;
}
/**
* Options for multi-transfer operations.
*/
export interface MultiTransferOptions {
/** Number of transfers to process in each batch (default: 10) */
batchSize?: number;
/** Progress callback function */
onProgress?: (completed: number, total: number, txHash: string) => void;
/** Error callback function for failed transfers */
onError?: (error: Error, recipient: Recipient) => void;
}
/**
* Result of a multi-transfer operation.
*/
export interface MultiTransferResult {
/** Successfully completed transactions */
successful: TransactionResponse[];
/** Failed transfers with error details */
failed: {
recipient: Recipient;
error: Error;
}[];
/** Total gas used across all transactions */
totalGasUsed: bigint;
/** Total amount transferred (sum of all successful transfers) */
totalAmount: string;
/** Total number of recipients processed */
totalRecipients: number;
/** Number of successful transfers */
successfulCount: number;
/** Number of failed transfers */
failedCount: number;
}
/**
* Result of processing a single batch of transfers.
*/
export interface BatchResult {
/** Completed transactions in this batch */
transactions: TransactionResponse[];
/** Failed transfers in this batch */
failed: {
recipient: Recipient;
error: Error;
}[];
/** Gas used for this batch */
gasUsed: bigint;
}
/**
* Validation result for multi-transfer inputs.
*/
export interface ValidationResult {
/** Whether validation passed */
isValid: boolean;
/** Validation errors if any */
errors: string[];
/** Total amount to be transferred */
totalAmount: string;
}