Skip to content

Commit e7a9297

Browse files
authored
Merge pull request #8 from EnsoBuild/sync-actions
Actions update: - Better support for bridging action - Added `getLayerZeroPool` utility for crosschain routing - Added types for positionID based positions (e.g. Morpho)
2 parents 429293a + d504736 commit e7a9297

File tree

9 files changed

+1278
-94
lines changed

9 files changed

+1278
-94
lines changed

README.md

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Enso SDK
99

10-
The Enso SDK provides a set of tools and methods to interact with the Enso API. It includes functionalities for token approvals, routing, quoting, and balance checking.
10+
The Enso SDK provides a set of tools and methods to interact with the Enso shortcuts. It includes functionalities for automated swap routing, multichain routing, token approvals, quoting, and balance checking.
1111

1212
## Introduction
1313

@@ -65,7 +65,7 @@ There are 3 routing strategies available depending on your use case:
6565

6666
### Token Approvals
6767

68-
Get approval data to allow token spending:
68+
Get approval data to allow token spending when using `router` as `routingStrategy` (not needed when using `delegate`):
6969

7070
```typescript
7171
// Example: Approving USDC for spending
@@ -108,41 +108,6 @@ const balances = await ensoClient.getBalances({
108108
});
109109
```
110110

111-
### Token Data
112-
113-
Get paginated information about tokens:
114-
115-
```typescript
116-
// Example: Get details about wstETH including metadata
117-
const tokenData = await ensoClient.getTokenData({
118-
chainId: 1,
119-
address: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", // wstETH
120-
includeMetadata: true,
121-
type: "defi", // Filter by token type - can be "defi" or "base"
122-
});
123-
```
124-
125-
### Token Pricing
126-
127-
Get token price data:
128-
129-
```typescript
130-
// Example: Get current price of WETH
131-
const priceData = await ensoClient.getPriceData({
132-
chainId: 1,
133-
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
134-
});
135-
136-
// Example: Get prices for multiple tokens
137-
const multiPriceData = await ensoClient.getMultiplePriceData({
138-
chainId: 1,
139-
addresses: [
140-
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
141-
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
142-
],
143-
});
144-
```
145-
146111
### Bundled Transactions
147112

148113
Bundle multiple DeFi actions into a single transaction and use results between transactions.
@@ -182,6 +147,18 @@ const bundleData = await ensoClient.getBundleData(
182147
);
183148
```
184149

150+
### Bridging Pool Address
151+
152+
Use `getLayerZeroPool` to get the correct pool information, and use it as `primaryAddress` for the [`bridge` action](https://docs.enso.build/pages/build/reference/actions#bridge).
153+
154+
```ts
155+
const poolInfo = await client.getLayerZeroPool({
156+
chainId: 42161, // Arbitrum
157+
destinationChainId: 999, // Zora
158+
token: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' // USDT
159+
});
160+
```
161+
185162
### Non-Tokenized Positions
186163

187164
Route to a non-tokenized position:
@@ -200,7 +177,43 @@ const nonTokenizedRoute = await ensoClient.getRouteNonTokenized({
200177
});
201178
```
202179

203-
### Protocol Interactions
180+
181+
### Token Data
182+
183+
Get paginated information about tokens:
184+
185+
```typescript
186+
// Example: Get details about wstETH including metadata
187+
const tokenData = await ensoClient.getTokenData({
188+
chainId: 1,
189+
address: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", // wstETH
190+
includeMetadata: true,
191+
type: "defi", // Filter by token type - can be "defi" or "base"
192+
});
193+
```
194+
195+
### Token Pricing
196+
197+
Get token price data:
198+
199+
```typescript
200+
// Example: Get current price of WETH
201+
const priceData = await ensoClient.getPriceData({
202+
chainId: 1,
203+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
204+
});
205+
206+
// Example: Get prices for multiple tokens
207+
const multiPriceData = await ensoClient.getMultiplePriceData({
208+
chainId: 1,
209+
addresses: [
210+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
211+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
212+
],
213+
});
214+
```
215+
216+
### Protocol Support
204217

205218
Get information about supported protocols:
206219

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ensofinance/sdk",
3-
"version": "1.1.7",
3+
"version": "2.0.0",
44
"license": "MIT",
55
"description": "SDK for interacting with the Enso API",
66
"author": "Enso Finance",
@@ -41,10 +41,11 @@
4141
"@types/jest": "^29.5.14",
4242
"axios-mock-adapter": "^2.1.0",
4343
"jest": "^29.7.0",
44+
"msw": "^2.7.6",
4445
"prettier": "^3.4.2",
4546
"ts-jest": "^29.3.2",
4647
"tsup": "^8.3.5",
4748
"typescript": "^5.7.2",
48-
"msw": "^2.7.6"
49+
"viem": "^2.37.6"
4950
}
5051
}

0 commit comments

Comments
 (0)