@harukit/sdk 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Haru SDK
|
|
2
|
+
|
|
3
|
+
Multichain by default. Config-driven. Zero address management.
|
|
4
|
+
|
|
5
|
+
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.**
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
const haru = new Haru({
|
|
9
|
+
apiKey: 'your-api-key',
|
|
10
|
+
config: {
|
|
11
|
+
chains: ['arbitrum', 'base', 'optimism'],
|
|
12
|
+
tokens: ['USDC', 'ETH', 'WETH'],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
// Get swap quote by USD value
|
|
21
|
+
const quote = await haru.swaps.getQuoteByUsd({ userAddress, fromSymbol, fromChain, toSymbol, toChain, usdValue });
|
|
22
|
+
|
|
23
|
+
// Get swap quote by token amount
|
|
24
|
+
const quote = await haru.swaps.getQuoteByAmount({ userAddress, fromSymbol, fromChain, toSymbol, toChain, amount });
|
|
25
|
+
|
|
26
|
+
// Get multi-input quote (dilute flow)
|
|
27
|
+
const quote = await haru.swaps.getMultiInputByUsd({ userAddress, inputs, destinationChain, destinationCurrency });
|
|
28
|
+
|
|
29
|
+
// Get transfer quote
|
|
30
|
+
const transfer = await haru.transfers.getByUsd({ fromUser, toUser, tokenSymbol, fromChain, toChain, usdValue });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Haru7702 (EIP-7702)
|
|
34
|
+
|
|
35
|
+
**Gasless batch execution via custom delegation contract.**
|
|
36
|
+
|
|
37
|
+
Our Haru7702BatchSponsor.sol contract enables EOAs to batch multiple calls into a single gas-sponsored transaction. The relayer pays gas — users just sign.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// Execute a swap
|
|
41
|
+
const results = await haru7702.executeSwap({ quote, wallet, signAuthorization });
|
|
42
|
+
|
|
43
|
+
// Execute a transfer
|
|
44
|
+
const results = await haru7702.executeTransfer({ transfer, wallet, signAuthorization });
|
|
45
|
+
|
|
46
|
+
// Execute a custom batch bundle
|
|
47
|
+
const results = await haru7702.executeBatch({ bundle, wallet, signAuthorization });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
**Perfect for:**
|
|
53
|
+
|
|
54
|
+
- Multiple swaps in one transaction
|
|
55
|
+
- Chained actions (swap → transfer → bridge → yield)
|
|
56
|
+
- Single-chain or multi-chain orchestration
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bun add @harukit/sdk
|
|
62
|
+
# or
|
|
63
|
+
npm install @harukit/sdk
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick Start
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { Haru } from '@harukit/sdk';
|
|
70
|
+
|
|
71
|
+
const haru = new Haru({
|
|
72
|
+
apiKey: 'your_api_key',
|
|
73
|
+
config: {
|
|
74
|
+
chains: ['arbitrum', 'base', 'optimism'],
|
|
75
|
+
tokens: ['USDC', 'ETH', 'WETH'],
|
|
76
|
+
primaryUsd: ['USDC'],
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Features
|
|
82
|
+
|
|
83
|
+
- **Swaps** - Single and multi-input swaps across chains
|
|
84
|
+
- **Transfers** - Same-chain and cross-chain transfers
|
|
85
|
+
- **Balances** - User token balances
|
|
86
|
+
- **Yield** - Aave yield farming
|
|
87
|
+
- **EIP-7702** - Batch transactions with gas sponsorship
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harukit/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Haru SDK - Multichain by default. Config-driven. Zero address management. DeFi orchestration with EIP-7702 gasless batch execution.",
|
|
5
5
|
"keywords": ["haru", "sdk", "web3", "defi", "multichain", "cross-chain", "swaps", "transfers", "eip-7702", "batch-transactions", "chain-abstraction", "orchestration"],
|
|
6
6
|
"type": "module",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"clean": "rm -rf dist",
|
|
20
20
|
"prepublishOnly": "bun run build"
|
|
21
21
|
},
|
|
22
|
-
"files": ["dist"],
|
|
22
|
+
"files": ["dist", "README.md"],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@harukit/types": "
|
|
25
|
-
"@harukit/shared": "
|
|
24
|
+
"@harukit/types": "^1.0.0",
|
|
25
|
+
"@harukit/shared": "^1.0.0",
|
|
26
26
|
"viem": "^2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|