@veilnyx-sdk/core
v1.4.4
Published
Veilnyx Core
Readme
@veilnyx-sdk/v1-sdk
SDK for veilnyx v1
Quoting a UserOperation fee
quoteUserOpGasCostWithLatestBaseFee is exported from @veilnyx-sdk/core. It
scales EntryPoint's worst-case prefund to the latest effective gas price,
applies configurable headroom (50% by default), and caps the quote at
maxFeePerGas.
import { quoteUserOpGasCostWithLatestBaseFee } from '@veilnyx-sdk/core';
const userOpFeeQuoteEth = await quoteUserOpGasCostWithLatestBaseFee(
{
maxCost: requiredPrefundEth,
maxFeePerGas: userOp.maxFeePerGas,
maxPriorityFeePerGas: userOp.maxPriorityFeePerGas,
// Optional; defaults to 5,000 basis points (50%).
headroomBps: 5_000,
},
publicClient,
);
const transaction = await core.createTransaction(request, {
revokerId,
paymaster,
viaBundler: true,
userOpFeeQuoteEth,
});The returned value belongs in TransactionOptions.userOpFeeQuoteEth, not
directly in the shielded transaction. Core.createTransaction() converts the
native-token quote into feeAssetId and commits the converted result as the
shielded transaction's feeValue.
