estimateExternalTransfer
Pre-deposit estimate for a swap-public-style external transfer.
Models the full pipeline with every fee it charges: the entry bridge (when the deposit is not shielded in place), shielding into the private balance, the withdrawal's protocol and network fees, and the exit bridge (when the destination differs from the shielding side). Both bridges and the shielding destination come from the portal broadcaster's own routing, so the estimate prices the route it runs.
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
signal
- Type:
AbortSignal - Required: no
Aborts the estimate; an aborted estimate is never published.
const result = await estimateExternalTransfer({
signal,
fromNetwork,
fromCurrency,
fromAmount,
toNetwork,
toCurrency,
});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
The aggregator network the caller expects the deposit to shield on, by slug. The portal broadcaster decides (in place when the source accepts portal shields, otherwise by the deposit's value), so a different network fails the estimate instead of pricing a route that will not run.
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