import { createTransfersClient, STELLAR_CCTP, verifyStellarPayment } from "@pesa/sdk";
const quote = await pesa.quote({
route: "stellar-send",
source_chain: "stellar:pubnet",
source_address: stellarAddress,
dest_address: recipient, // what the user typed
amount_in: "50000000", // 5 USDC, 7 decimals
});
const transfer = await pesa.createTransfer(quote.id, crypto.randomUUID());
const action = await pesa.getActions(transfer.id);
if (action?.kind !== "stellar_tx") throw new Error("unexpected action");
const tx = verifyStellarPayment(action.xdr, {
passphrase: STELLAR_CCTP.mainnet.passphrase,
source: stellarAddress,
destination: recipient,
issuer: STELLAR_CCTP.mainnet.usdcIssuer,
amount7: 50_000_000n,
});
const signedXdr = await signWithStellarWallet(tx); // sign the returned Transaction
const done = await pesa.submit(transfer.id, { kind: "stellar_tx", signed_xdr: signedXdr });