You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transfer fails, funds are locked and can be restored with the restore flow though.
Have no idea why is it happening, I've been able to do a few successful transfers with the same code.
I'm using a bit modified code from the docs & examples:
async function tokenTransfer<N extends Network>(
wh: Wormhole<N>,
route: {
token: TokenId;
amount: bigint;
source: SignerStuff<N, Chain>;
destination: SignerStuff<N, Chain>;
delivery?: {
automatic: boolean;
nativeGas?: bigint;
};
payload?: Uint8Array;
},
roundTrip?: boolean,
): Promise<TokenTransfer<N>> {
// Create a TokenTransfer object to track the state of the transfer over time
const xfer = await wh.tokenTransfer(
route.token,
route.amount,
route.source.address,
route.destination.address,
route.delivery?.automatic ?? false,
route.payload,
route.delivery?.nativeGas,
);
logger.info("transfer:", xfer.transfer);
logger.info("route", route);
const quote = await TokenTransfer.quoteTransfer(
wh,
route.source.chain,
route.destination.chain,
xfer.transfer,
);
logger.info("quote:", quote);
if (xfer.transfer.automatic && quote.destinationToken.amount < 0)
throw "The amount requested is too low to cover the fee and any native gas requested.";
// 1) Submit the transactions to the source chain, passing a signer to sign any txns
logger.info("Starting transfer");
try {
const srcTxids = await xfer.initiateTransfer(route.source.signer);
logger.info(`Started transfer: `, srcTxids);
} catch (e) {
if (e instanceof SendTransactionError) {
logger.error(await e.getLogs(connection));
} else {
logger.error(e);
}
throw new Error("Transfer failed");
}
// If automatic, we're done
if (route.delivery?.automatic) return xfer;
// 2) Wait for the VAA to be signed and ready (not required for auto transfer)
logger.info("Getting Attestation");
const attestIds = await xfer.fetchAttestation(120000);
logger.info(`Got Attestation: `, attestIds);
Transfer fails, funds are locked and can be restored with the restore flow though.
Have no idea why is it happening, I've been able to do a few successful transfers with the same code.
Logs:
I'm using a bit modified code from the docs & examples:
Wormholescan example:
https://wormholescan.io/#/tx/5UgiE2AXbFbzNsQUJ6f5Adn1eEWxavBR4Jec2ZH4UL5mUzA6NApujwzo3kkXCCmtw5K1SZZbNYpGP7E7YRYhxWTR
Sometimes I get another error (funds are still transferred & can be claimed):
Wormholescan example (I've recovered this one):
https://wormholescan.io/#/tx/41xdAqrqBYLKGJghFooM7Mx2GeT8SLrnaT4vGnzERqM4ypQy5hjSHbQ39omSaK4UppG2NVNN8by27cDhfVXvGstD
The text was updated successfully, but these errors were encountered: