Enso 백서

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

tination tx confirmed inflight --> failed : Execution error inflight --> ready_for_manual_execution : Retry or claim required pending --> failed : Bridge rejection pending --> unknown : Cannot determine ``` * **`pending`** — Source transaction confirmed, bridge protocol hasn't picked it up yet * **`inflight`** — Bridge protocol is processing the cross-chain message * **`delivered`** — Tokens and callbacks successfully delivered on the destination chain * **`failed`** — Bridge or callback execution failed (check `error` and `ensoDestinationEvent` for details) * **`ready_for_manual_execution`** — Funds are recoverable, but the destination action needs manual completion: claim an attested CCTP transfer or retry a stored Stargate payload * **`unknown`** — Status could not be determined ## Identifying the Bridge Protocol <Tabs> <Tab title="Route API"> When using the Route API, the response tells you which bridge was automatically selected: 1. Check the `route` array for the hop where `action === "bridge"` — its `protocol` field contains the bridge protocol 2. The `bridgingEstimates` array provides the protocol name and estimated delivery time ```typescript theme={null} const route = await ensoClient.getRouteData({ fromAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", chainId: 1, destinationChainId: 8453, tokenIn: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], tokenOut: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], amountIn: ["1000000000"], slippage: "300", routingStrategy: "delegate", }); // Extract bridge protocol from the route hops const bridgeHop = route.route.find((hop) => hop.action === "bridge"); const bridgeProtocol = bridgeHop?.protocol; // "stargate" | "ccip" | "relay" | "cctp" // Get estimated delivery time (useful for initial polling delay) const estimatedSeconds = route.bridgingEstimates?.[0]?.estimatedSeconds; ``` </Tab> <Tab title="Bundle API"> When using the Bundle API, you already know the bridge protocol — it's the `protocol` field you specified in your bridge action: ```typescript theme={null} const bundle = await client.getBundleData( { chainId: 1, fromAddress: "0x...", routingStrategy: "router" }, [ { protocol: "stargate", // <-- This is your bridge protocol action: "bridge", args: { primaryAddress: "0x...", destinationChainId: 42161, tokenIn: "0x...", amountIn: "1000000000", receiver: "0x...", }, }, ], ); ``` </Tab> </Tabs> ## Status Check Endpoints <AccordionGroup> <Accordion title="CCIP (Chainlink)"> `GET /api/v1/ccip/bridge/check` — Check Chainlink CCIP bridge transaction status. <CodeGroup> ```typescript TypeScript theme={null} const API_KEY = process.env.ENSO_API_KEY; const chainId = 56; // Source chain (e.g., BNB Chain) const txHash = "0x80f1faf..."; // Source transaction hash const response = await fetch( `https://api.enso.finance/api/v1/ccip/bridge/check?chainId=${chainId}&txHash=${txHash}`, { headers: { Authorization: `Bearer ${API_KEY}` }, } ); const data = await response.json(); console.log(data.status); // "pending" | "inflight" | "delivered" | "failed" | "ready_for_manual_execution" | "unknown" console.log(data.sourceChainEstimatedTimeForFinalitySeconds); // Seconds until finality console.log(data.destinationTxHash); // Destination tx hash when delivered ``` ```bash cURL theme={null} curl "https://api.enso.finance/api/v1/ccip/bridge/check?chainId=56&txHash=0x80f1faf..." \ -H "Authorization: Bearer $ENSO_API_KEY" ``` </CodeGroup> **Response fields:** | Field | Type | Description | | - | - | - | | `status` | `string` | `pending` / `inflight` / `delivered` / `failed` / `unknown` | | `sourceChainId` | `number` | Source chain ID | | `sourceTxHash` | `string` | Source transaction hash | | `sourceChainIdFinality` | `number` | Required finality time in seconds for the source chain | | `sourceChainEstimatedTimeForFinalitySeconds` | `number?` | Estimated seconds remaining until finality | | `destinationChainId` | `number?` | Destination chain ID | | `destinationTxHash` | `string?` | Destination tx hash (when delivered) | | `ccipSendParamsDecoded` | `object?` | Decoded CCIP params: destination chain, token amounts with metadata, fees, gas limit | | `ensoSourceEvent` | `object \| null` | Enso execution event on source chain | | `ensoDestinationEvent` | `object \| null` | Enso callback execution event on destination | | `error` | `string?` | Error message if something went wrong | <Warning> **Finality delay**: CCIP waits for source chain finalization before delivering to the destination. This can range from sub-second (Avalanche) to 15-20 minutes (Ethereum, Optimism). Use `sourceChainEstimatedTimeForFinalitySeconds` to determine your initial polling delay. See [Chainlink's Finality By Blockchain](https://docs.chain.link/ccip/ccip-execution-latency#finality-by-blockchain) for current times per chain. </Warning> </Accordion> <Accordion title="CCTP (Circle)"> `GET /api/v1/cctp/bridge/check` — Check Circle CCTP v2 bridge transaction status. <CodeGroup> ```typescript TypeScript theme={null} const API_KEY = process.env.ENSO_API_KEY; const chainId = 8453; // Source chain (e.g., Base) const txHash = "0x4ac72089..."; // Source transaction hash const response = await fetch( `https://api.enso.finance/api/v1/cctp/bridge/check?chainId=${chainId}&txHash=${txHash}`, { headers: { Authorization: `Bearer ${API_KEY}` }, } ); const data = await response.json(); console.log(data.status); // "pending" | "inflight" | "delivered" | "failed" | "unknown" console.log(data.transferType); // "fast" | "standard" (executed mode) console.log(data.destinationTxHash); // Destination tx hash when delivered console.log(data.forward); // Forwarding Service state for HyperCore deposits ``` ```bash cURL theme={null} curl "https://api.enso.finance/api/v1/cctp/bridge/check?chainId=8453&txHash=0x4ac72089..." \ -H "Authorization: Bearer $ENSO_API_KEY" ``` </CodeGroup> **Response fields:** | Field | Type | Description | | - | - | - | | `status` | `string` | `pending` / `inflight` / `delivered` / `failed` / `ready_for_manual_execution` / `unknown` | | `sourceChainId` | `number` | Source chain ID | | `sourceTxHash` | `string` | Source transaction hash | | `destinationChainId` | `number?` | Destination chain ID (resolved from CCTP domain) | | `destinationTxHash` | `string?` | Destination tx hash (when minted) | | `transferType` | `"fast" \| "standard"?` | Reflects `finalityThresholdExecuted` (may differ from requested type) | | `delayReason` | `string?` | Reason Circle reports for delayed processing, such as `insufficient_fee` | | `forward` | `object?` | Forwarding Service state for transfers using a forwarding hook, including HyperCore deposits | | `forward.state` | `string` | Raw forwarding state, such as `PENDING`, `COMPLETED`, or `FAILED` | | `forward.errorCode` | `string?` | Forwarding failure code, such as `INSUFFICIENT_FEE` | | `forward.errorDetails` | `string?` | Human-readable forwarding failure details | | `forward.txHash` | `string?` | Destination-chain forward transaction hash | | `depositForBurn` | `object?` | Raw `depositForBurn` params — present only when the source call had no hookData | | `depositForBurnDecoded` | `object?` | Decoded `depositForBurn`: token metadata, chain IDs, `maxFee` vs `feeExecuted`, finality info | | `depositForBurnWithHook` | `object?` | Raw `depositForBurnWithHook` params — present only when hookData is non-empty | | `depositForBurnWithHookDecoded` | `object?` | Decoded form including `hookData.forwardingService` (true when bytes match Circle's `cctp-forward` magic) | | `ensoSourceEvent` | `object \| null` | Enso execution event on source chain | | `error` | `string?` | Error message if the check failed | <Note> **Fast vs Standard detection**: After the burn is attested, `transferType` is set from `finalityThresholdExecuted` (≤ 1000 = `fast`, ≥ 2000 = `standard`). This is the **actual** path Circle took — it can differ from your requested `protocolArgs.transferType` if Fast allowance was exhausted or the source chain didn't support Fast. </Note> <Note> **Forwarding Service transfers**: For a CCTP transfer with a forwarding hook, including a HyperCore deposit, `status` is `delivered` only after `forward.state` is complete. A Circle message marked complete can remain `inflight` while forwarding is pending, or return `failed` with the forwarding error details. Enso verifies the destination MessageTransmitter nonce before returning a non-delivered result, so a consumed nonce is reported as `delivered` even if Iris still has a stale forwarding failure state. </Note> <Tip> **Manual claim**: If a transfer gets stuck, call [`GET /api/v1/cctp/bridge/claim`](/pages/use-cases/bridges/cctp-bridge#manual-claim-recovery-flow) to get a ready-to-submit `receiveMessage` transaction for the destination chain. Transfers with a pinned `destinationCaller`, including HyperCore forwarding transfers, return `claimable: false`: only Circle's forwarder can complete them. Both endpoints are rate-limited to 1 request per 10 seconds. </Tip> <Note> **Attested plain transfers**: `ready_for_manual_execution` means Circle has attested a transfer without a forwarding hook, but the destination `receiveMessage` mint has not run yet. Use the claim endpoint above. Enso keeps `delivered` when it cannot read the destination nonce, so temporary RPC failures do not falsely report that action is required. </Note> <Note> **Upstream source**: this endpoint is backed by Circle's Iris [`GET /v2/messages/{sourceDomainId} `](https://developers.circle.com/api-reference/cctp/all/get-messages-v2) — Enso wraps it with on-chain enrichment (token metadata, chain IDs decoded from CCTP domains, executed-fee vs requested-fee). See Circle's [supported blockchains matrix](https://developers.circle.com/cctp/concepts/supported-chains-and-domains#supported-blockchains) for which chains support Fast Transfer. </Note> </Accordion> <Accordion title="Relay"> `GET /api/v1/relay/bridge/check` — Check Relay bridge transaction status. <CodeGroup> ```typescript TypeScript theme={null} const API_KEY = process.env.ENSO_API_KEY; const chainId = 1; // Source chain const txHash = "0x94e5ea9..."; // Source transaction hash const response = await fetch( `https://api.enso.finance/api/v1/relay/bridge/check?chainId=${chainId}&txHash=${txHash}`, { headers: { Authorization: `Bearer ${API_KEY}` }, } ); const data = await response.json(); console.log(data.status); // "pending" | "inflight" | "delivered" | "failed" | "unknown" console.log(data.destinationTxHash); // Destination tx hash when delivered console.log(data.refundTxHash); // Origin-chain refund payout when refunded ``` ```bash cURL theme={null} curl "https://api.enso.finance/api/v1/relay/bridge/check?chainId=1&txHash=0x94e5ea9..." \ -H "Authorization: Bearer $ENSO_API_KEY" ``` </CodeGroup> **Response fields:** | Field | Type | Description | | - | - | - | | `status` | `string` | `pending` / `inflight` / `delivered` / `failed` / `unknown` | | `sourceChainId` | `number` | Source chain ID | | `sourceTxHash` | `string` | Source transaction hash | | `destinationChainId` | `number?` | Destination chain ID | | `destinationTxHash` | `string?` | Destination tx hash (when delivered) | | `refundChainId` | `number?` | Origin chain where Relay paid a refund instead of delivering | | `refundTxHash` | `string?` | Refund payout transaction; no `destinationTxHash` is returned for this case | | `relayRequest` | `object?` | Relay details: raw status, user, recipient, in/out txs, fee breakdown, timestamps | | `ensoSourceEvent` | `object \| null` | Enso execution event on source chain | | `ensoDestinationEvent` | `object \| null` | Enso callback execution event on destination | | `error` | `string?` | Error message if something went wrong | <Tip> **Fee breakdown**: `relayRequest.fees` provides a detailed breakdown in wei (`gas`, `fixed`, `price`), and `relayRequest.feesUsd` gives USD equivalents for each component. </Tip> </Accordion> <Accordion title="Stargate"> `GET /api/v1/stargate/bridge/check` — Check Stargate (LayerZero) bridge transaction status. <CodeGroup> ```typescript TypeScript theme={null} const API_KEY = process.env.ENSO_API_KEY; const chainId = 1; // Source chain const txHash = "0x80f1faf..."; // Source transaction hash const response = await fetch( `https://api.enso.finance/api/v1/stargate/bridge/check?chainId=${chainId}&txHash=${txHash}`, { headers: { Authorization: `Bearer ${API_KEY}` }, } ); const data = await response.json(); console.log(data.status); // "pending" | "inflight" | "delivered" | "failed" | "ready_for_manual_execution" | "unknown" console.log(data.destinationTxHash); // Destination tx hash when delivered ``` ```bash cURL theme={null} curl "https://api.enso.finance/api/v1/stargate/bridge/check?chainId=1&txHash=0x80f1faf..." \ -H "Authorization: Bearer $ENSO_API_KEY" ``` </CodeGroup> **Response fields:** | Field | Type | Description | | - | - | - | | `status` | `string` | `pending` / `inflight` / `delivered` / `failed` / `ready_for_manual_execution` / `unknown` | | `sourceChainId` | `number` | Source chain ID | | `sourceTxHash` | `string` | Source transaction hash | | `destinationChainId` | `number?` | Destination chain ID (when known) | | `destinationTxHash` | `string?` | Destination tx hash (when delivered) | | `isMultiBridge` | `boolean?` | `true` for multi-hop bridge transactions | | `hops` | `array?` | Individual hop details for multi-bridge transactions | | `layerZeroMessage` | `object?` | LayerZero message pathway and timing details | | `ensoSourceEvent` | `object \| null` | Enso execution event on source chain | | `ensoDestinationEvent` | `object \| null` | Enso callback execution event on destination | | `ensoMetadata` | `object?` | Request metadata (tokenIn, tokenOut, amountIn) | | `error` | `string?` | Error message if something went wrong | <Note> **Multi-hop support**: Stargate supports multi-hop transactions (up to 5 sequential bridges). When `isMultiBridge` is `true`, the `hops` array contains per-hop status tracking with individual `sourceChainId`, `destinationChainId`, `status`, and `layerZeroMessage` fields. </Note> <Note> **Stored LayerZero payloads**: `ready_for_manual_execution` means a LayerZero message is blocked or stored and needs a retry or clearance before delivery can continue. It does not mean the funds are lost. </Note> </Accordion> </AccordionGroup> ## Callback Execution Events Stargate, CCIP, and Relay include both `ensoSourceEvent` and `ensoDestinationEvent` in their responses — these track whether Enso's callback logic executed successfully on each chain. CCTP returns only `ensoSourceEvent`. The destination side is Circle `receiveMessage` execution, including HyperCore forwarding when requested, so there is no Enso destination callback event. | Field | Value | Meaning | | - | - | - | | `ensoSourceEvent` | `null` | Source event not yet found | | `ensoSourceEvent.success` | `true` | Source chain execution succeeded | | `ensoSourceEvent.success` | `false` | Source chain execution failed — check `error` field | | `ensoDestinationEvent` | `null` | Destination event not yet found (bridge still in transit) | | `ensoDestinationEvent.success` | `true` | Destination callback executed successfully | | `ensoDestinationEvent.success` | `false` | Destination callback failed — check `error` and `refundDetails` | When a callback fails, `refundDetails` provides information about where funds were sent: ```json theme={null} { "refundDetails": { "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "amount": "1000000000", "recipient": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", "isNative": false } } ``` ## Resources * [Crosschain Routing Guide](/pages/build/get-started/crosschain-routing) — How to build crosschain transactions * [Crosschain Bridges](/pages/use-cases/bridges/index) — Bridge protocol use cases and examples * [Bridge Action Reference](/pages/build/reference/actions#bridge) — Technical details on bridge parameters <div> <p>Updated </p> </div> # Bundle API Source: https://docs.enso.build/pages/build/get-started/bundling-actions Compose ordered public actions into a signer-ready transaction with the Bundle API. The Bundle API builds one transaction from an ordered array of actions selected by your product. Use it for custom sequencing, dynamic outputs, checks, fees, flashloans, or protocol actions that do not fit a single Route API request. <Note> If Enso should choose the entire path into one destination, start with the [Route API](/pages/build/get-started/route). See [Route API vs Bundle API](/pages/build/get-started/overview#route-api-vs-bundle-api) before building a custom sequence. </Note> Actions executed in one same-chain transaction succeed or revert together. Cross-chain delivery is different: the source transaction completes first, then the callback executes on the destination chain. A destination callback failure cannot revert a finalized source-chain bridge. <img /> <img /> ## Before you start 1. [Create and verify an API key](/pages/build/get-started/authentication). 2. Choose a supported chain, protocol, and public action. 3. Use the [Bundle Actions Reference](/pages/build/reference/actions) for action inputs and outputs. 4. Use [supported actions](/api-reference/integration/supported-actions) and the per-protocol action endpoint for current protocol availability. ## Request anatomy ```http theme={null} POST /api/v1/shortcuts/bundle?chainId=1&fromAddress=0x...&routingStrategy=router Authorization: Bearer $ENSO_API_KEY Content-Type: application/json ``` The request body is the action array directly: ```json theme={null} [ { "protocol": "enso", "action": "route", "args": { "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "tokenOut": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", "amountIn": "100000000000", "slippage": "300" } } ] ``` Do not wrap the array in `{ "bundle": [...] }`. Wallet and execution settings belong in query parameters for REST, or in the first argument to `getBundleData` in the SDK. ### Request options | Field | Required | Description | | - | - | - | | `chainId` | Yes | Source-chain ID. | | `fromAddress` | Yes | Wallet that submits the returned transaction. | | `routingStrategy` | No | Execution client strategy. | | `executionMode` | No | Quote execution mode. | | `receiver` | No | Default recipient for final outputs. | | `spender` | No | Account supplying input assets when supported by the selected strategy. | | `refundReceiver` | No | Recipient for dust or applicable bridge refunds. | | `ignoreAggregators` | No | Swap aggregators to exclude globally. | | `skipQuote` | No | Skip quote-dependent output and gas fields. | | `referralCode` | No | Referral code included in the on-chain event. | ## Action structure Every action has three fields: ```typescript theme={null} { protocol: "enso", action: "route", args: { tokenIn: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", tokenOut: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", amountIn: "100000000000", }, } ``` * `protocol` selects the Enso meta-action or protocol integration. * `action` selects a public action supported by that protocol. * `args` contains the action-specific inputs. Protocol action inputs are not universal. Query the current per-protocol action metadata instead of assuming every `deposit`, `redeem`, or `swap` accepts the same fields. ## Amounts and native assets Use decimal strings in the token's smallest base unit. Do not use JavaScript numbers for token amounts. * `"1000000"` is 1 USDC when the token has 6 decimals. * `"1000000000000000000"` is 1 ETH or one 18-decimal token. * Use `0xeeeeeeeeeeeeeeeeeeeeeeeeee
프로젝트로 돌아가기