Package Manager Installation
Installlifi-contract-typings using your preferred package manager:
Peer Dependencies
LiFi Contract Types requires ethers.js v5 and related packages. These are listed as dependencies in the package and will be installed automatically:Ethers v5 Required: This package is designed for ethers.js version 5.x. If you’re using ethers v6, you’ll need to maintain separate installations or migrate your codebase.
Verify Installation
After installation, verify that the package is working correctly:TypeScript Configuration
Ensure yourtsconfig.json is configured to support the package:
tsconfig.json
Module Exports
The package supports both CommonJS and ES Module imports:Specific Contract Imports
You can also import specific contracts using subpath exports:What’s Included
After installation, you have access to:- Type Definitions: TypeScript interfaces for all LiFi contracts
- Contract Factories: Factory classes to connect to deployed contracts
- Event Types: Typed event listeners for contract events
- Struct Types: Data structures like
BridgeDataStruct,SwapDataStruct, etc.
Next Steps
Quick Start Guide
Learn how to execute your first bridge transaction
Core Concepts
Understand key types and patterns
Troubleshooting
Type Errors with Ethers
If you see type errors related to ethers, ensure you’re using ethers v5:^5.5.2 or compatible.
Module Not Found
If you encounter “Module not found” errors:-
Clear your node_modules and reinstall:
-
Ensure your TypeScript version is up to date: