estimateExternalTransfer
Pre-deposit estimate for a swap-public-style external transfer.
Models the full pipeline: entry bridge (source → shielding chain) → Curvy fee on the shielded amount → exit bridge (shielding chain → destination). Returns the projected delivered amount plus a per-leg fee breakdown. Either leg can be skipped (returns 0) when the corresponding chain/currency matches the shielding side.
Uses the same LiFi bridge allowlist as the backend broadcaster, so the actual route Curvy picks server-side should differ by at most a few bps from this estimate.
Import
import { estimateExternalTransfer } from "@0xcurvy/curvy-sdk/actions";Usage
const estimate = await estimateExternalTransfer({ fromNetwork, fromCurrency, fromAmount, toNetwork, toCurrency });Signature
function estimateExternalTransfer(parameters: EstimateExternalTransferParameters): Promise<EstimateExternalTransferResult>Returns
Promise<EstimateExternalTransferResult>
The action resolves or returns the value shown in the signature.
Parameters
fromNetwork
- Type:
Network - Required: yes
The public network from which funds enter the transfer.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});fromCurrency
- Type:
Currency - Required: yes
The source currency.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});fromAmount
- Type:
bigint - Required: yes
The gross source amount in the source currency's base units.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});toNetwork
- Type:
Network - Required: yes
The public network on which the recipient receives funds.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});toCurrency
- Type:
Currency - Required: yes
The currency the recipient receives.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});shieldingNetworkSlug
- Type:
string - Required: no
Which aggregator network to shield on, by slug. Defaults to the source chain when it has its own aggregator (no entry bridge — mirrors the deposit rule), otherwise the first active aggregator network. Multi-aggregator deployments should pass this (or the planner will, once value-tiered routing lands).
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
shieldingNetworkSlug,
});config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
const result = await estimateExternalTransfer({
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
config,
});Errors
Errors from config resolution and the underlying SDK operation are propagated to the caller.
Related
- Interacting with assets guide
estimateIntent— Select spendable notes and return fees, delivered amount, a sanitized route, and an in-memory handle that can be passed to executeIntent.executeIntent— Execute a handle returned by estimateIntent.getPlanSteps— Return the ordered, sanitized steps an integrator can present to a user.estimateBridge— Quote a bridge/swap before committing — for the swap UI (in-app/public) and send-with-exit-bridge.
Source
packages/@0xcurvy/sdk/src/actions/planner/estimateExternalTransfer.ts