recoverPortal
Recover (sweep) the funds held in a portal to destinationAddress.
Re-derives the recovery private key from the announcement via core.scan, then dispatches to the EVM or Solana recovery flow based on the matched portal's flavour.
Import
import { recoverPortal } from "@0xcurvy/curvy-sdk/actions";Usage
await recoverPortal({ networkId, tokenAddress, portalRecord, destinationAddress });Signature
function recoverPortal(parameters: RecoverPortalParameters): Promise<string>Returns
Promise<string>
The action resolves or returns the value shown in the signature.
Parameters
networkId
- Type:
number - Required: yes
The Curvy network identifier on which the portal holds funds.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
});tokenAddress
- Type:
HexString | (string & {}) - Required: yes
The EVM token contract or Solana mint held by the portal.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
});portalRecord
- Type:
MatchedPortalRecord - Required: yes
The matched portal record containing the recovery announcement.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
});destinationAddress
- Type:
HexString | (string & {}) - Required: yes
The public address that should receive the recovered funds.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
});solanaSigner
- Type:
SolanaSigner - Required: no
The connected signer required to submit a Solana recovery transaction.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
solanaSigner,
});onSubmitted
- Type:
(transactionHash: string) => void - Required: no
Reports the public transaction reference before waiting for confirmation.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
onSubmitted,
});onSubmitting
- Type:
() => void - Required: no
Called immediately before the network submission attempt, after local preparation/signing.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
onSubmitting,
});portalFactoryContractAddress
- Type:
HexString - Required: no
Override the EVM factory used for recovery, e.g. a retired factory after an upgrade.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
portalFactoryContractAddress,
});config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
const result = await recoverPortal({
networkId,
tokenAddress,
portalRecord,
destinationAddress,
config,
});Errors
- when the active account has no private keys, no matching recovery key is found, the network id is unknown, or a Solana recovery is requested without a signer.
Related
- Portals and recovery guide
findOwnedPortals— Enumerate every portal owned by the active account's keys on the given network.findPortal— Find the portal owned by the active account at a specific on-chain address.