Installation
Evix provides SDKs for TypeScript and Rust. You can also integrate directly at the Solidity level.
TypeScript SDK
- npm
- pnpm
- yarn
npm install @inductiv/evix-sdk
pnpm add @inductiv/evix-sdk
yarn add @inductiv/evix-sdk
Peer Dependencies
The TypeScript SDK requires viem v2.21.0 or later:
npm install viem
Exports
import {
EvixClient, // Main client class
evixAbi, // Contract ABI (for direct viem usage)
} from "@inductiv/evix-sdk";
import type {
SwapParams, // Swap input parameters
SwapResult, // Swap execution result
EvixClientConfig, // Client constructor config
} from "@inductiv/evix-sdk";
Rust SDK
Add to your Cargo.toml:
[dependencies]
evix-sdk = { git = "https://github.com/inductiv/evix", path = "sdk/rust" }
alloy = { version = "0.9", features = ["full"] }
tokio = { version = "1", features = ["full"] }
Exports
use evix_sdk::{
EvixClient, // Main client struct
SwapParams, // Swap input parameters
SwapResult, // Swap execution result
EvixError, // Error types
};
Direct Solidity Integration
If you prefer to call the contract directly without an SDK, use the interface:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
interface IEvix {
function swap(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 deadline,
uint256 minAmountOut,
address recipient
) external payable returns (uint256 amountOut);
}
Call it from your contract:
import {IEvix} from "./interfaces/IEvix.sol";
contract MyProtocol {
IEvix public immutable evix;
constructor(address _evix) {
evix = IEvix(_evix);
}
function executeSwap(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 minAmountOut
) external returns (uint256) {
IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn);
IERC20(tokenIn).approve(address(evix), amountIn);
return evix.swap(
tokenIn,
tokenOut,
amountIn,
block.timestamp + 120,
minAmountOut,
msg.sender
);
}
}
Requirements
| Component | Requirement |
|---|---|
| TypeScript SDK | Node.js 18+, viem ^2.21.0 |
| Rust SDK | Rust 1.75+, alloy 0.9 |
| Solidity | Solc ^0.8.28 |