Enso 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 1쪽

# Account ID Source: https://docs.enso.build/api-reference/account/account-id /public/openapi.json get /api/v1/account/accountId Gives the Account ID associated with the current user # Approve Enso contract Source: https://docs.enso.build/api-reference/defi-shortcuts/approve-enso-contract /public/openapi.json get /api/v1/wallet/approve Returns a transaction that approves your Enso contracts to spend the given amount of specified tokens. Approve before sending the route transaction on-chain. # Bundle a list of actions Source: https://docs.enso.build/api-reference/defi-shortcuts/bundle-a-list-of-actions /public/openapi.json post /api/v1/shortcuts/bundle Returns a single transaction bundling the submitted actions. For available actions, see `/actions` endpoint. # Get transaction for IPOR shortcut Source: https://docs.enso.build/api-reference/defi-shortcuts/get-transaction-for-ipor-shortcut /public/openapi.json post /api/v1/shortcuts/static/ipor # Optimal route between two tokens Source: https://docs.enso.build/api-reference/defi-shortcuts/optimal-route-between-two-tokens /public/openapi.json get /api/v1/shortcuts/route Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. This single call already quotes internally and returns executable calldata along with `amountOut` and `gas`, so there is no separate quote step to call beforehand. <Tip>To enter a non-tokenized position, use GET&nbsp;`shortcuts/route/nontokenized`.</Tip> # Optimal route between two tokens Source: https://docs.enso.build/api-reference/defi-shortcuts/optimal-route-between-two-tokens-1 /public/openapi.json post /api/v1/shortcuts/route Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. This single call already quotes internally and returns executable calldata along with `amountOut` and `gas`, so there is no separate quote step to call beforehand. <Tip>To enter a non-tokenized position, use the GET&nbsp;`/shortcuts/route/nontokenized`.</Tip> # Quote from a token to another Source: https://docs.enso.build/api-reference/defi-shortcuts/quote-from-a-token-to-another /public/openapi.json get /api/v1/shortcuts/quote Returns the expected output amount and selected route for a token swap without executable transaction calldata. # Returns EnsoWallet-v2 address details Source: https://docs.enso.build/api-reference/defi-shortcuts/returns-ensowallet-v2-address-details /public/openapi.json get /api/v1/wallet Deterministic (CREATE2) EnsoWallet-v2 address for `fromAddress` on `chainId`, and whether it is deployed. The wallet is deployed by the factory inside the first transaction routed through it, so the address can be used as an approval target beforehand. # Routing to a non-tokenized position Source: https://docs.enso.build/api-reference/defi-shortcuts/routing-to-a-non-tokenized-position /public/openapi.json get /api/v1/shortcuts/route/nontokenized Calculates optimal transaction with the best route entering a non-tokenized position, which may involve several actions that interact with various DeFi protocols. # Chain and transactions volume Source: https://docs.enso.build/api-reference/defi/chain-and-transactions-volume /public/openapi.json get /api/v1/volume/{chainId} Returns total USD and transactions volume for the given chainId. # Wallet balances Source: https://docs.enso.build/api-reference/defi/wallet-balances /public/openapi.json get /api/v1/wallet/balances Returns tokens balances for Enso Wallet associated with the given address across all supported chains. <br/>With `useEoa` set to true, it returns balances for the given EOA address instead. # Actions for protocol Source: https://docs.enso.build/api-reference/integration/actions-for-protocol /public/openapi.json get /api/v1/actions/{slug} # Aggregators Source: https://docs.enso.build/api-reference/integration/aggregators /public/openapi.json get /api/v1/aggregators Fetches aggregators supported by Enso # All Protocols Source: https://docs.enso.build/api-reference/integration/all-protocols /public/openapi.json get /api/v1/protocols Returns all available protocols with supported chains # LayerZero pool Source: https://docs.enso.build/api-reference/integration/layerzero-pool /public/openapi.json get /api/v1/layerzero/pool Returns the LayerZero Stargate pool address for a given token address and chain ID. Returns null if no pool exists for the token on that chain. # Networks Source: https://docs.enso.build/api-reference/integration/networks /public/openapi.json get /api/v1/networks Returns networks supported by Enso # Projects Source: https://docs.enso.build/api-reference/integration/projects /public/openapi.json get /api/v1/projects Returns supported projects (e.g. `aave`) or platforms associated with available projects # Protocols in a project Source: https://docs.enso.build/api-reference/integration/protocols-in-a-project /public/openapi.json get /api/v1/projects/{project}/protocols Returns all protocols available within the given project. For supported projects, see the `/projects` endpoint. # Standard per protocol Source: https://docs.enso.build/api-reference/integration/standard-per-protocol /public/openapi.json get /api/v1/standards/{slug} Returns a standard matching the given `slug`, containing supported actions, exact `inputs`, and a list of chains the standard's supported on. # Standards Source: https://docs.enso.build/api-reference/integration/standards /public/openapi.json get /api/v1/standards Returns standards available for bundling. Each element represents a protocol, with list of supported actions and chains the standard's supported on. # Supported actions Source: https://docs.enso.build/api-reference/integration/supported-actions /public/openapi.json get /api/v1/actions Returns actions that can be bundled with `/shortcuts/bundle` endpoint. For specific protocol actions and exact action inputs, see [`/actions/{slug}`](/api-reference/integration/actions-for-a-given-protocol) endpoint. # Simulate already-built transactions (standalone) Source: https://docs.enso.build/api-reference/quote/simulate-already-built-transactions-standalone /public/quoter-openapi.json post /api/v1/simulate Standalone simulator that returns predicted output amounts and gas for transactions that are ALREADY built (from any source). This is NOT part of the routing flow and is NOT a prerequisite for `/shortcuts/route` — `route` already quotes internally and returns executable calldata in a single call. Do not call this before routing. Use it only to independently simulate/validate arbitrary transactions you already have. # Simulate multiple transactions in a single quoter call Source: https://docs.enso.build/api-reference/quote/simulate-multiple-transactions-in-a-single-quoter-call /public/quoter-openapi.json post /api/v1/simulate/batch Standalone batch simulator that returns predicted output amounts and gas for up to 5 transactions that are ALREADY built (from any source). This is NOT part of the routing flow and is NOT a prerequisite for `/shortcuts/route` — `route` already quotes internally and returns executable calldata in a single call. Do not call this before routing. Use it only to independently simulate/validate arbitrary transactions you already have. All transactions share the same tokenIn, tokenOut, and amountIn. Returns one simulationId per transaction for use with `/validate`. # Validate an unsigned transaction matches a prior simulation Source: https://docs.enso.build/api-reference/quote/validate-an-unsigned-transaction-matches-a-prior-simulation /public/quoter-openapi.json post /api/v1/validate Validate an unsigned transaction matches a prior simulation # Nontokenized positions Source: https://docs.enso.build/api-reference/tokens/nontokenized-positions /public/openapi.json get /api/v1/nontokenized Returns a list of all nontokenized positions with details. # Token Price Source: https://docs.enso.build/api-reference/tokens/token-price /public/openapi.json get /api/v1/prices/{chainId}/{address} Returns token price for the given address and chainId. # Tokens Source: https://docs.enso.build/api-reference/tokens/tokens /public/openapi.json get /api/v1/tokens Returns tokens and their details. <Tip>This APi includes cursor-based pagination with default 1000 items per page.</Tip> # Tokens Prices Batched Source: https://docs.enso.build/api-reference/tokens/tokens-prices-batched /public/openapi.json get /api/v1/prices/{chainId} Returns prices for a batch of tokens on a given chain. # Enso Developer Documentation Source: https://docs.enso.build/home Turn DeFi product intent into signer-ready transaction data. Use these docs to launch swaps, vault deposits, tokenized asset flows, and cross-chain actions without rebuilding every protocol integration. Enso handles routing and transaction construction while your product keeps custody, policy, and user experience control. ## Start building <CardGroup> <Card title="1. Get an API key" icon="key" href="/pages/build/get-started/authentication"> Create a key in the Developer Portal, store it securely, and verify authentication. </Card> <Card title="2. Choose Route or Bundle" icon="code-branch" href="/pages/build/get-started/overview#route-api-vs-bundle-api"> Use Route API when Enso should find the path. Use Bundle API when your product controls the ordered actions. </Card> <Card title="3. Build with Route API" icon="route" href="/pages/build/get-started/route"> Request an optimized path into one destination and execute the returned transaction. </Card> <Card title="4. Build with Bundle API" icon="layer-group" href="/pages/build/get-started/bundling-actions"> Compose ordered actions, inspect required approvals, and execute the returned transaction. </Card> </CardGroup> ## Explore Enso <CardGroup> <Card title="Build" icon="terminal" href="/pages/build/get-started/overview"> Use Route, Bundle, cross-chain routing, balances, and protocol data as the standard integration path. </Card> <Card title="Earn" icon="piggy-bank" href="/pages/earn/overview"> Build curated yield experiences with the essential endpoints for catalog, balances, execution, and refreshed balances. </Card> <Card title="Quoter" icon="shield" href="/pages/quoter/overview"> Simulate and validate transactions before signing to predict outcomes. </Card> <Card title="Use Cases" icon="map" href="/pages/use-cases"> Map real product journeys across wallets, yield, LPs, leverage, RWAs, stablecoins, perps, and simulation. </Card> <Card title="API Reference" icon="code" href="/pages/api-reference/overview"> Go directly to endpoint documentation for execution, data, accounts, tokens, and optional Shield validation. </Card> <Card title="Network" icon="globe" href="/pages/network/overview"> Understand participants, network context, and the token layer around Enso-powered execution. </Card> </CardGroup> # Overview Source: https://docs.enso.build/pages/api-reference/overview Learn about Enso API and its capabilities. The Enso API provides developers with a comprehensive set of tools to interact with DeFi protocols and execute complex transactions across multiple blockchain networks. ## Getting Started Explore detailed documentation for each API endpoint using the API sandbox. <Note> The Sandbox doesn't require authentication. For building and production use cases, use a dedicated API key. </Note> ### Authentication In production, all API requests require authentication using an API key. See [Authentication](/pages/build/get-started/authentication) and the [rate-limit FAQ](/pages/build/reference/faq#what-is-the-default-rate-limit-for-the-api). ```bash theme={null} -H "Authorization: Bearer YOUR_API_KEY" ``` 1. Create an account on the [Enso Dashboard](https://developers.enso.build) 2. Generate an API key from your dashboard 3. Use this key in all API requests ## API Groups The Enso API is organized into several functional groups: ### Shortcuts Execute optimized token swaps and complex DeFi operations with single transactions. * [`POST /v1/shortcuts/route`](/api-reference/defi-shortcuts/optimal-route-between-two-tokens-1) - Find optimal swap, zap, and position routes. See the [Route API guide](/pages/build/get-started/route). * [`POST /v1/shortcuts/bundle`](/api-reference/defi-shortcuts/bundle-a-list-of-actions) - Compose ordered actions. See the [Bundle API guide](/pages/build/get-started/bundling-actions) and [Bundle Actions Reference](/pages/build/reference/actions). * [`GET /v1/wallet/approve`](/api-reference/defi-shortcuts/approve-enso-contract) - Approve token spending ### Integration Access metadata about supported protocols, standards, and available actions. * [`GET /v1/standards`](/api-reference/integration/standards) - Get available integration standards * [`GET /v1/actions`](/api-reference/integration/supported-actions) - Get supported DeFi actions * [`GET /v1/protocols`](/api-reference/integration/all-protocols) - Get all supported protocols * [`GET /v1/networks`](/api-reference/integration/networks) - Get supported blockchain networks * [`GET /v1/projects`](/api-reference/integration/projects) - Get protocol project groupings ### Tokens Query token data including positions, prices, and wallet holdings. * [`GET /v1/tokens`](/api-reference/tokens/tokens) - Get token details and metadata * [`GET /v1/nontokenized`](/api-reference/tokens/nontokenized-positions) - Get non-tokenized DeFi positions * [`GET /v1/prices/{chainId}/{address}`](/api-reference/tokens/token-price) - Get token price data ### DeFi Access real-time DeFi metrics and wallet information. * [`GET /v1/wallet/balances`](/api-reference/defi/wallet-balances) - Get wallet token balances * [`GET /v1/volume/{chainId}`](/api-reference/defi/chain-and-transactions-volume) - Get chain trading volume * [`GET /v1/aggregators`](/api-reference/integration/aggregators) - Get supported DEX aggregators ## Key Concepts Before using the Enso API, familiarize yourself with these key concepts: * [Projects, protocols, and standards](/pages/build/reference/concepts) - Understand the structure of Enso's data model * [Shortcuts](/pages/build/examples/shortcuts) - Pre-configured paths for common DeFi operations * [Actions](/pages/build/reference/actions) - Standardized interactions with DeFi protocols * [Routing Strategies](/pages/build/reference/routing-strategies) - Different approaches to transaction execution <div> <p>Updated </p> </div> # SDK Source: https://docs.enso.build/pages/api-reference/sdk Enso SDK is a JavaScript library for interacting with Enso API. 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. The Route API is a highly-efficient DeFi aggregation and smart order routing REST API. With it, developers can easily tap into optimized routes for DeFi tokens/positions and multi-token swaps across various chains. <Card href="https://github.com/EnsoBuild/sdk-ts" icon="github" title="View on GitHub" /> ## Installation Install the Enso SDK using your preferred package manager: <CodeGroup> ```bash npm theme={null} npm install @ensofinance/sdk ``` ```bash yarn theme={null} yarn add @ensofinance/sdk ``` ```bash pnpm theme={null} pnpm add @ensofinance/sdk ``` ```bash bun theme={null} bun add @ensofinance/sdk ``` </CodeGroup> ## Quick Start This example shows how to swap ETH directly to a Yearn vault position: ```typescript theme={null} import { EnsoClient } from '@ensofinance/sdk'; const enso = new EnsoClient({ apiKey: 'YOUR_API_KEY', }); async function enterYearnVault() { // First, get the transaction data const routeData = await enso.getRouteData({ fromAddress: '0xYourWalletAddress', receiver: '0xYourWalletAddress', spender: '0xYourWalletAddress', chainId: 1, amountIn: ['1000000000000000000'], // 1 ETH tokenIn: ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'], // ETH tokenOut: ['0xa258C4606Ca8206D8aA700cE2143D7db854D168c'], // yvWETH slippage: 50, routingStrategy: 'router', }); // The routeData.tx object can now be sent using your preferred web3 library // Example with ethers.js: // const provider = new ethers.providers.Web3Provider(window.ethereum); // const signer = provider.getSigner(); // const tx = await signer.sendTransaction(routeData.tx); // await tx.wait(); console.log('Transaction data:', routeData.tx); console.log('Expected yvWETH amount:', routeData.amountOut); } enterYearnVault(); ``` ## Core Concepts The Enso SDK abstracts complex DeFi operations through several key components: 1. **EnsoClient**: The main entry point for all SDK functionalities 2. **Routing Strategies**: Different execution paths for transactions 3. **Bundle Actions**: Compose multiple DeFi operations in a single transaction 4. **Approvals**: Manage token allowances for DeFi interactions 5. **Token Data**: Retrieve detailed information about tokens and protocols ## Routing Strategies There are 3 routing strategies available depending on your use case: * **`router`** - Uses a single contract which acts as a universal router * **`delegate`** - Returns calldata in the form of delegateCalls for smart accounts * **`delegate-legacy`** - Legacy version of delegate routing * **`router-legacy`** - Legacy version of router routing ## Complete Methods Reference ### Primary Methods #### getRouteData(params: RouteParams) Calculates the optimal route for token swaps or entering/exiting DeFi positions. **Parameters:** * `fromAddress` (Address): Ethereum address of the wallet to send the transaction from * `receiver?` (Address): Ethereum address of the receiver of the tokenOut * `spender?` (Address): Ethereum address of the spender of the tokenIn * `chainId` (number): Chain ID of the network to execute the transaction on * `destinationChainId?` (number): Chain ID of the destination network for cross-chain bridging * `amountIn` (Quantity\[]): Amount of tokenIn to swap in wei * `slippage?` (Quantity): Slippage in basis points (1/10000) * `minAmountOut?` (Quantity\[]): Minimum amount out in wei * `tokenIn` (Address\[]): Ethereum address of the token to swap from * `tokenOut` (Address\[]): Ethereum address of the token to swap to * `routingStrategy` (RoutingStrategy): Routing strategy to use * `ignoreAggregators?` (string\[]): List of swap aggregators to ignore * `ignoreStandards?` (string\[]): List of standards to ignore * `toEoa?` (boolean): Flag indicating if gained tokenOut should be sent to EOA * `referralCode?` (string): Referral code included in on-chain event **Returns:** `Promise<RouteData>` ```typescript theme={null} const routeData = await enso.getRouteData({ fromAddress: '0xYourWalletAddress', receiver: '0xYourWalletAddress', spender: '0xYourWalletAddress', chainId: 1, amountIn: ['1000000000000000000'], // 1 ETH in wei tokenIn: ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'], // ETH tokenOut: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // DAI slippage: 50, // 0.5% routingStrategy: 'router', }); ``` #### getApprovalData(params: ApproveParams) Generates transaction data for approving tokens to be spent by Enso contracts. **Parameters:** * `fromAddress` (Address): Ethereum address of the wallet to send the transaction from * `tokenAddress` (Address): ERC20 token address of the token to approve * `chainId` (number): Chain ID of the network to execute the transaction on * `amount` (Quantity): Amount of tokens to approve in wei **Returns:** `Promise<ApproveData>` ```typescript theme={null} const approvalData = await enso.getApprovalData({ fromAddress: '0xYourWalletAddress', tokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH chainId: 1, amount: '1000000000000000000', // 1 WETH in wei
프로젝트로 돌아가기