feat: add swidge (swap/bridge) via LI.FI SDK#30
Merged
Merged
Conversation
Add cross-chain swap/bridge capability powered by @lifi/sdk: - New `companion-wallet swidge` CLI operation for manual bridging - Auto-detect insufficient funds in sendTransaction() and bridge from another chain (prompts in TTY, auto-bridges in pipe mode) - Pre-flight balance warning in WalletConnect CLI send-transaction - Core module: checkSufficiency, findBestSource, executeLifiRoute - Supports ETH, USDC, WCT across Ethereum, Base, Optimism Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
companion-wallet swidgeCLI operation for manual cross-chain bridging powered by @lifi/sdksendTransaction()— detects insufficient funds and bridges from another chain (prompts in TTY, auto-bridges in pipe/agent mode)send-transactionfor EVM chainsDemo: Bridge ETH from Optimism to Base
{"fromChain":"eip155:10","toChain":"eip155:8453","fromToken":"ETH","toToken":"ETH","fromAmount":"0.0001","toAmount":"0.000099614025","txHash":"0xa4f1746c..."}New files
packages/companion-wallet/src/swidge.tspackages/companion-wallet/test/swidge.test.ts.changeset/swidge-feature.mdKey changes
companion-wallet/package.json@lifi/sdkdependencycompanion-wallet/src/types.ts"swidge"operationcompanion-wallet/src/chains.tsresolveChainByNumericId()companion-wallet/src/tokens.tsgetLifiTokenAddress(),findTokenSymbolByAddress()companion-wallet/src/prompt.tsask()with configurable output streamcompanion-wallet/src/rpc.tssendTransaction()companion-wallet/src/cli.tshandleSwidge()handlercli-sdk/src/cli.tsTest plan
npm run build)npm run test)npm run lint)companion-wallet swidgeUSDC Base → Optimism (needs gas on Base)send-transactionon underfunded chain🤖 Generated with Claude Code