UNPKG

@funkit/fun-relay

Version:
76 lines 3.32 kB
import { type AdaptedWallet, type ProgressData } from '@relayprotocol/relay-sdk'; import type { Address, Hex, WalletClient } from 'viem'; import type { BitcoinAddress, BitcoinTxHash, BitcoinWallet } from './bitcoin'; import type { RELAY_BITCOIN_CHAIN_ID, RELAY_LIGHTER_CHAIN_ID, RELAY_SOLANA_CHAIN_ID, RELAY_TRON_CHAIN_ID } from './constants'; import type { LighterAccountIndex, LighterWallet } from './lighter'; import type { RelayQuoteResult } from './quote'; import type { SolanaAddress, SolanaTxHash, SolanaWallet } from './solana'; import type { TronAddress, TronTxHash, TronWallet } from './tron'; import type { Logger, RelayExecutionInfo } from './types'; export type RelayExecutionStep = ProgressData['currentStep'] & {}; export declare const RELAY_VM_TYPES: readonly ["bvm", "evm", "hypevm", "svm", "lvm", "tvm"]; export type RelayVmType = (typeof RELAY_VM_TYPES)[number]; export type RelayAddress<VmType extends RelayVmType = RelayVmType> = { bvm: BitcoinAddress; evm: Address; hypevm: Address; svm: SolanaAddress; lvm: LighterAccountIndex; tvm: TronAddress; }[VmType]; export type RelayChainId<VmType extends RelayVmType = RelayVmType> = { bvm: typeof RELAY_BITCOIN_CHAIN_ID; evm: string; hypevm: string; svm: typeof RELAY_SOLANA_CHAIN_ID; lvm: typeof RELAY_LIGHTER_CHAIN_ID; tvm: typeof RELAY_TRON_CHAIN_ID; }[VmType]; export type RelayTxHash<VmType extends RelayVmType = RelayVmType> = { bvm: BitcoinTxHash; evm: Hex; hypevm: Hex; svm: SolanaTxHash; lvm: Hex; tvm: TronTxHash; }[VmType]; export type RelayWallet<VmType extends RelayVmType = RelayVmType> = { bvm: BitcoinWallet; evm: WalletClient | (AdaptedWallet & { vmType: 'evm'; }); hypevm: AdaptedWallet & { vmType: 'hypevm'; }; svm: SolanaWallet; lvm: LighterWallet; tvm: TronWallet; }[VmType]; export interface ExecuteRelayQuoteParams<VmType extends RelayVmType> { logger: Logger; onError: (error: Error) => Promise<void>; onProgress?: (step: RelayExecutionStep | null) => void; /** * Fired when all *input* transactions are confirmed on-chain. */ onTransactionConfirmed?: (txHash: RelayTxHash<VmType>) => Promise<void>; /** * Fired as soon as user has *signed* all input transactions, but before they are confirmed on-chain. * * After this event, no more action should be needed from the user. * However, it is possible that the transactions will be rejected and the execution will NOT continue. */ onUserActionsCompleted?: (txHash: RelayTxHash<VmType>) => Promise<void>; relayQuote: RelayQuoteResult<VmType>; walletClient: RelayWallet<VmType>; /** * Type of transaction being executed * * - `'standard'` - regular transaction (default) * - `'erc4337'` - ERC-4337 smart wallet transaction */ transactionType?: 'standard' | 'erc4337'; } export declare function executeRelayQuote<VmType extends RelayVmType>({ logger, onError, onProgress, onTransactionConfirmed, onUserActionsCompleted, relayQuote, walletClient, transactionType, }: ExecuteRelayQuoteParams<VmType>): Promise<void>; export declare function getRelayExecutionInfo(requestId: string, apiKey: string): Promise<RelayExecutionInfo>; //# sourceMappingURL=execution.d.ts.map