import { createComposeSdk, materialisers, resources,} from '@lifi/composer-sdk';const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7';const sdk = createComposeSdk({ baseUrl: 'https://composer.li.quest' });const builder = sdk.flow(1, { name: 'dust-sweep', inputs: { amountIn: resources.erc20(USDC, 1), },});// Split USDC 80/20.// Only the 80% portion (`a`) is consumed by the swap.// The 20% portion (`b`) is intentionally left unbound — it stays on// the proxy as dust and gets swept back to the sender.const { a } = builder.core.split('split', { bind: { source: builder.inputs.amountIn }, config: { bps: 8000 },});// Swap only the 80% portion to USDT.builder.lifi.swap('swap', { bind: { amountIn: a }, config: { resourceOut: resources.erc20(USDT, 1), slippage: 0.03, },});// sweepTo ensures the unused 20% USDC is transferred back to the// sender rather than being stranded on the proxy.// See /composer/composer-api/concepts/sweeping-and-amounts for the full semantics.const result = await builder.compile({ signer: '0xYourSignerAddress', inputs: { amountIn: materialisers.directDeposit({ amount: '10000000' }), // 10 USDC }, sweepTo: builder.context.sender,});