UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

1 lines • 2.09 kB
{"version":3,"file":"guards.generated.cjs","names":[],"sources":["../../src/generated/guards.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn generate:composer-sdk\n\nimport type { TypedGuard } from '../types.js';\n\nimport type {\n BandGuardConfig,\n CoreNumericInvariantGuardConfig,\n MinAmountGuardConfig,\n SlippageGuardConfig,\n} from './config.generated.js';\n\n/** Assert that output amounts are within a slippage tolerance in basis points */\nexport const slippage = <P extends string>(\n config: Omit<SlippageGuardConfig, 'port'> & { port: P },\n): TypedGuard<P> => ({\n kind: 'slippage',\n ...config,\n});\n\n/** 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. */\nexport const coreNumericInvariant = <P extends string>(\n config: Omit<CoreNumericInvariantGuardConfig, 'port'> & { port: P },\n): TypedGuard<P> => ({\n kind: 'core.numericInvariant',\n ...config,\n});\n\n/** Assert that an output stays within a tolerance in basis points of its simulated value, in both directions */\nexport const band = <P extends string>(\n config: Omit<BandGuardConfig, 'port'> & { port: P },\n): TypedGuard<P> => ({\n kind: 'band',\n ...config,\n});\n\n/** Require a resource output to carry at least `amount`. Emits one on-chain assertGreaterThanEqual. The compile fails with validation_error and a shortfall when the minimum the flow guarantees at the port is below `amount`, and with a simulation revert when the port has no guaranteed minimum and its simulated amount is below `amount`. */\nexport const minAmount = <P extends string>(\n config: Omit<MinAmountGuardConfig, 'port'> & { port: P },\n): TypedGuard<P> => ({\n kind: 'minAmount',\n ...config,\n});\n"],"mappings":";;;;;;;;;AAaA,MAAa,YACX,YACmB;CACnB,MAAM;CACN,GAAG;AACL;;AAGA,MAAa,wBACX,YACmB;CACnB,MAAM;CACN,GAAG;AACL;;AAGA,MAAa,QACX,YACmB;CACnB,MAAM;CACN,GAAG;AACL;;AAGA,MAAa,aACX,YACmB;CACnB,MAAM;CACN,GAAG;AACL"}