You might have noticed that receiver and sender are same here, it's because the transfer will performed from the sender's proxy account in Solana to own account in evm.
Then the vaa can be obtained after this and it must be posted in solana chain.
Now post this signed vaa to wormhole solana core bridge program, parse the payloads from vaa and send the parsed data to solana zebec bridge program.
constpayerAddress=wallet.publicKey.toString();constbridgeAddress=getBridgeAddressForChain(targetChain);constvaaBuf=Buffer.from(vaaBytes);setDefaultWasm("node"); // use bundler for browser// posting vaa in solanaawaitpostVaaSolanaWithRetry( connection,wallet.signTransaction, bridgeAddress, payerAddress, vaaBuf,MAX_VAA_UPLOAD_RETRIES_SOLANA,);const { parse_vaa } =awaitimportCoreWasm();constparsedVaa=parse_vaa(vaaBytes);constparsedPayload=parseZebecPayload(Buffer.from(parsedVaa.payload));constresult=awaitsolanaClient.directTokenTransfer( vaaBytes, <DirectTokenTransferPayload>parsedPayload);
Then the zebec bridge program makes cpi call to token bridge program for asset transfer to evm chain. The asset is automatically redeemed by the token bridge relayer. For manual redeeming, you need to get signed vaa by emitted from token bridge and redeem asset in evm using the payload in that vaa.
if (!result.data) {thrownewError("data is missing in solana client result.");}constexecutionSignature=result.data.signatures[result.data.signatures.length-1];consttransactionResponse=awaitconnection.getTransaction(executionSignature);if (!transactionResponse) {thrownewError("Could not find Transaction");}constanotherSequence=parseSequenceFromLogSolana(transactionResponse);consttokenBridgeEmitterAddress=awaitgetEmitterAddressSolana(SOL_TOKEN_BRIDGE_ADDRESS);const { vaaBytes: tokenBridgeVaa } =awaitgetSignedVAAWithRetry(WORMHOLE_RPC_HOSTS,"solana", tokenBridgeEmitterAddress, anotherSequence,);consttokenBridgeAddress=getTokenBridgeAddressForChain(sourceChain);constbridge=Bridge__factory.connect(tokenBridgeAddress, signer);consttx=awaitbridge.completeTransfer(tokenBridgeVaa);constreceipt=awaittx.wait();console.log("receipt",receipt.transactionHash);