import { AssetAmount, SwapCtx, TransferValidationReport } from '@galacticcouncil/xc-core'; import { Call } from './platforms'; /** * Transfer source data * * @interface TransferSourceData * @member {AssetAmount} balance Transfer asset balance * @member {AssetAmount} destinationFee Transfer destination fee * @member {AssetAmount} destinationFeeBalance Transfer destination fee asset balance * @member {AssetAmount} fee Transfer fee * @member {AssetAmount} feeBalance Transfer fee asset balance * @member {SwapCtx} feeSwap Transfer fee swap context details * @member {AssetAmount} max Maximum allowed amount of transfer asset to send * @member {AssetAmount} min Minimum required amount of transfer asset to send */ export interface TransferSourceData { balance: AssetAmount; destinationFee: AssetAmount; destinationFeeBalance: AssetAmount; destinationFeeSwap: SwapCtx; fee: AssetAmount; feeBalance: AssetAmount; feeSwap: SwapCtx; max: AssetAmount; min: AssetAmount; } /** * Transfer destination data * * @interface TransferDestinationData * @member {AssetAmount} balance Received asset balance * @member {AssetAmount} fee Transfer destination fee */ export interface TransferDestinationData { balance: AssetAmount; fee: AssetAmount; } /** * Transfer input * * @interface Transfer * @member {TransferSourceData} source Source chain data * @member {TransferDestinationData} destination Destination chain data * @member {boolean} reversible True if a return-trip route is registered. * Consumers may use this to gate UI affordances (swap-direction button, etc.). */ export interface Transfer { source: TransferSourceData; destination: TransferDestinationData; reversible: boolean; /** Next call the sender has to sign, the head of {@link buildCalls}. */ buildCall(amount: bigint | number | string): Promise; /** * Ordered call sequence to execute the transfer, the transfer call being * last. Preceded by prerequisite calls (native wrap, erc20 approve) the * sender has to sign first, each dropping off once executed. */ buildCalls(amount: bigint | number | string): Promise; estimateFee(amount: bigint | number | string): Promise; estimateDestinationFee(amount: bigint | number | string): Promise; validate(fee?: bigint): Promise; } /** * Chain balances snapshot * * @interface ChainBalancesResult * @member {string} chainKey Chain the balances were read from * @member {AssetAmount[]} balances Balances read, empty if the read failed * @member {Error} error Reason the chain could not be read */ export interface ChainBalancesResult { chainKey: string; balances: AssetAmount[]; error?: Error; }