UNPKG

@funkit/fun-relay

Version:
80 lines 2.55 kB
import type { Address } from 'viem'; import type { BitcoinAddress } from '../bitcoin'; import type { LighterAccountIndex } from '../lighter'; import type { SolanaAddress } from '../solana'; import type { ApiFunkitCheckoutActionParams } from '../types'; export type FunAddress = Address | SolanaAddress | BitcoinAddress | LighterAccountIndex; type GenerateActionsParams = (targetAssetAmount: number, config?: { targetAsset: Address; targetChain: string; }) => Promise<ApiFunkitCheckoutActionParams[]>; interface FunkitCheckoutConfig { targetChain: string; targetAsset: Address; targetAssetTicker?: string; iconSrc?: string; generateActionsParams?: GenerateActionsParams; customRecipient?: FunAddress; } export interface DynamicRoutePath { targetChain: FunkitCheckoutConfig['targetChain']; targetAsset: FunkitCheckoutConfig['targetAsset']; targetAssetTicker?: FunkitCheckoutConfig['targetAssetTicker']; iconSrc?: FunkitCheckoutConfig['iconSrc']; generateActionsParams?: (address: Address) => FunkitCheckoutConfig['generateActionsParams']; getCustomRecipient?: (props: { address: Address; l2Address?: string; }) => FunkitCheckoutConfig['customRecipient']; } export interface DynamicRouteConfig { id: string; paths: { [key: string]: DynamicRoutePath; }; } export interface DynamicRoute { id: string; config: DynamicRouteConfig; getPathById: (pathId: string) => DynamicRoutePath | null; } export interface DynamicRoutes { [routeId: string]: DynamicRoute; } type AnyString = string & {}; export type MatchAllCondition = '*'; interface TokenCondition { chainId: AnyString | MatchAllCondition; tokenAddress: AnyString | MatchAllCondition; } interface UseConfig { path: string; badge?: string; bridgeOverride?: 'across' | 'relay'; } interface Rule { when: TokenCondition | MatchAllCondition; use: UseConfig; } export type DynamicRoutingConfig = Array<{ routeId: string; rules: Rule[]; }>; export type RuleDefinition = Rule; export type RuleDefinitions = Rule[]; export interface IndexedDynamicRoutingConfig { [routeId: string]: { route: DynamicRoute; rules: RuleDefinitions; findPath: (params: { chainId: string; tokenAddress: string; }) => { path: DynamicRoutePath; badge: string | undefined; bridgeOverride: 'across' | 'relay' | undefined; } | null; }; } export {}; //# sourceMappingURL=types.d.ts.map