logo

Did you lose your link? Did something go wrong when creating the link? Don't worry, a sender can always reclaim their link.

If the Peanut Link is lost, the funds are still SAFU. The sender of a Link can always reclaim the funds. In order to reclaim, you will need the chainId and the transaction hash of the deposit (make sure this is the transactionHash of the deposit, not the approval!). Below is a full code example.
Copy
plain text
import peanut, { getDefaultProvider } from '@squirrel-labs/peanut-sdk' import { Wallet } from 'ethersv5' const chainId = '137' // polygon const transactionHash = '0x' const mnemonic = 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol' async function createLinks(): Promise<string> { let wallet = Wallet.fromMnemonic(mnemonic) const provider = await getDefaultProvider(chainId) wallet = wallet.connect(provider) const txReceipt = await peanut.getTxReceiptFromHash(transactionHash, chainId) const latestContractVersion = peanut.getLatestContractVersion({ chainId: chainId, type: 'normal', }) const depositIdx = peanut.getDepositIdxs(txReceipt, chainId, latestContractVersion) const preparedReclaimtx = await peanut.prepareClaimLinkSenderTx({ chainId: chainId, depositIndex: depositIdx[0], contractVersion: latestContractVersion, }) const convertedTx = peanut.peanutToEthersV5Tx(preparedReclaimtx) const signedTx = await wallet.sendTransaction(convertedTx) return signedTx.hash } createLinks().then((hash) => console.log(hash))