import {
getSmartAccountAddress,
sponsorUserOp,
sendUserOp,
waitForReceipt,
} from '@hyperauth/sdk';
// 1. Predict address
const sender = await getSmartAccountAddress({ pubKeyX, pubKeyY });
// 2. Build a minimal UserOp
const userOp: UserOp = {
sender,
nonce: '0x0',
callData: encodedCallData,
callGasLimit: '0x0',
verificationGasLimit: '0x0',
preVerificationGas: '0x0',
maxFeePerGas: '0x0',
maxPriorityFeePerGas: '0x0',
signature: '0x',
};
// 3. Sponsor (fills gas + paymaster fields)
const sponsored = await sponsorUserOp(userOp);
// 4. Sign
const { signature } = await client.signUserOp(sponsored);
// 5. Send
const hash = await sendUserOp({ ...sponsored, signature });
// 6. Confirm
const receipt = await waitForReceipt(hash);
console.log('confirmed:', receipt.success);