@harukit/sdk
v1.0.3
Published
Haru SDK - Multichain by default. Config-driven. Zero address management. DeFi orchestration with EIP-7702 gasless batch execution.
Maintainers
Readme
Haru SDK
Multichain by default. Config-driven. Zero address management.
Haru eliminates the complexity of cross-chain development. Everything happens through a simple config definition — no need to manage token addresses, decimals, or chain IDs.
const haru = new Haru({
apiKey: 'your-api-key',
config: {
chains: ['arbitrum', 'base', 'optimism'],
tokens: ['USDC', 'ETH', 'WETH'],
},
});Swaps & Transfers work across chains out of the box. Support for multi-input across chains — aggregate funds from multiple sources into a single destination with one signature.
// Get swap quote by USD value
const quote = await haru.swaps.getQuoteByUsd({ userAddress, fromSymbol, fromChain, toSymbol, toChain, usdValue });
// Get swap quote by token amount
const quote = await haru.swaps.getQuoteByAmount({ userAddress, fromSymbol, fromChain, toSymbol, toChain, amount });
// Get multi-input quote (dilute flow)
const quote = await haru.swaps.getMultiInputByUsd({ userAddress, inputs, destinationChain, destinationCurrency });
// Get transfer quote
const transfer = await haru.transfers.getByUsd({ fromUser, toUser, tokenSymbol, fromChain, toChain, usdValue });Haru7702 (EIP-7702)
Gasless batch execution via custom delegation contract.
Our Haru7702BatchSponsor.sol contract enables EOAs to batch multiple calls into a single gas-sponsored transaction. The relayer pays gas — users just sign.
// Execute a swap
const results = await haru7702.executeSwap({ quote, wallet, signAuthorization });
// Execute a transfer
const results = await haru7702.executeTransfer({ transfer, wallet, signAuthorization });
// Execute a custom batch bundle
const results = await haru7702.executeBatch({ bundle, wallet, signAuthorization });Every execution is cryptographically bound to a deadline, sponsor address, unique nonce, and chain ID — preventing replay attacks, ensuring transactions expire after their window, and restricting execution to the designated relayer on the intended chain.
Perfect for:
- Multiple swaps in one transaction
- Chained actions (swap → transfer → bridge → yield)
- Single-chain or multi-chain orchestration
Installation
bun add @harukit/sdk
# or
npm install @harukit/sdkQuick Start
import { Haru } from '@harukit/sdk';
const haru = new Haru({
apiKey: 'your_api_key',
config: {
chains: ['arbitrum', 'base', 'optimism'],
tokens: ['USDC', 'ETH', 'WETH'],
primaryUsd: ['USDC'],
},
});Features
- Swaps - Single and multi-input swaps across chains
- Transfers - Same-chain and cross-chain transfers
- Balances - User token balances
- Yield - Aave yield farming
- EIP-7702 - Batch transactions with gas sponsorship
License
MIT
