@atomiqlabs/sdk
Version:
atomiq labs SDK for cross-chain swaps between smart chains and bitcoin
18 lines (17 loc) • 885 B
TypeScript
import { ISwap } from "../swaps/ISwap";
import { ChainType } from "@atomiqlabs/base";
/**
* Proxy type that auto-injects a smart chain signer into swap methods
*
* @category Swaps/Base
*/
export type SwapWithSigner<T extends ISwap> = {
[K in keyof T]: K extends "commit" ? (abortSignal?: AbortSignal, skipChecks?: boolean) => Promise<string> : K extends "refund" ? (abortSignal?: AbortSignal) => Promise<string> : K extends "claim" ? (abortSignal?: AbortSignal) => Promise<string> : K extends "commitAndClaim" ? (abortSignal?: AbortSignal, skipChecks?: boolean) => Promise<string> : T[K];
};
/**
* Wraps a swap with automatic signer injection for methods like commit, refund, and claim
*
* @category Swaps
* @internal
*/
export declare function wrapSwapWithSigner<C extends ChainType, T extends ISwap<C>>(swap: T, signer: C["Signer"]): SwapWithSigner<T>;