UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

35 lines (29 loc) • 1.19 kB
// AUTO-GENERATED from manifest.json — do not edit by hand. // Regenerate with: yarn workspace @lifi/composer-sdk generate import type { TypedGuard } from '../types.js'; import type { BandGuardConfig, CoreNumericInvariantGuardConfig, SlippageGuardConfig, } from './config.generated.js'; /** Assert that output amounts are within a slippage tolerance in basis points */ export const slippage = <P extends string>( config: Omit<SlippageGuardConfig, 'port'> & { port: P }, ): TypedGuard<P> => ({ kind: 'slippage', ...config, }); /** Assert a numeric (uint256) handle output of the target op satisfies a comparison against a constant threshold. Emits one IR1 binary invariant; reverts the run on violation. */ export const coreNumericInvariant = <P extends string>( config: Omit<CoreNumericInvariantGuardConfig, 'port'> & { port: P }, ): TypedGuard<P> => ({ kind: 'core.numericInvariant', ...config, }); /** Assert that an output stays within a tolerance in basis points of its simulated value, in both directions */ export const band = <P extends string>( config: Omit<BandGuardConfig, 'port'> & { port: P }, ): TypedGuard<P> => ({ kind: 'band', ...config, });