export interface UserOperationCall { to: string value?: string data?: string nonce?: string } export interface BuildBatchedUserOpRequest { chain: string calls: UserOperationCall[] } export interface BuildBatchedUserOpResponse { data: { userOperation: string userOpHash: string } metadata: { chainId: string /** * Total gas units the built user operation is bounded by, as a decimal * string: the straight sum of its gas-limit fields (`callGasLimit`, * `verificationGasLimit`, `preVerificationGas`, `paymasterVerificationGasLimit`, * `paymasterPostOpGasLimit`) — the ERC-4337 paymaster prefund multiplier is * intentionally NOT applied. Upper-bound at build time, not post-execution * actual. Optional: omitted by backends that predate this field. */ totalGas?: string /** * The price per gas unit (wei) the user operation will pay, as a decimal * string. `'0'` on chains/providers that carry no on-chain fee on the op * (e.g. Ultra Relay bundler-level sponsorship). Optional. */ maxFeePerGas?: string /** * Build-time upper-bound gas cost in wei, as a decimal string * (`totalGas * maxFeePerGas`, computed server-side). This is the authoritative * value to charge against — convert wei → fee token and apply your own buffer. * `'0'` when the op carries no on-chain fee. Optional: omitted by backends * that predate this field. */ estimatedGasCostWei?: string } } export interface BroadcastBatchedUserOpRequest { chain: string userOperation: string signature: string } export interface BroadcastBatchedUserOpResponse { data: { userOpHash: string } metadata: { chainId: string } } export interface SendBatchUserOpTransaction { token: string value: string to: string } export interface SendBatchUserOpRequest { chain: string transactions: SendBatchUserOpTransaction[] signatureApprovalMemo?: string traceId?: string } /** * Gas-reimbursement configuration for `sendBatchedAssets`. * * The end user's transaction is gas-subsidized by Portal's paymaster; this config * appends a final call that transfers `feeToken` from the user's smart account to * `feeRecipient` to reimburse the platform for that subsidized gas. */ export interface GasReimbursement { /** Fee token symbol to charge the end user in (e.g. 'USDC'). */ feeToken: string /** Address that receives the reimbursement (the platform's collection wallet). */ feeRecipient: string /** * Convert the estimated native gas cost (in wei) into a fee-token amount. The * platform owns this FX entirely (rate + margin) — Portal does no conversion. * Return a human-readable decimal string in `feeToken` units (e.g. '0.42' for * 0.42 USDC). May be async. */ convertGasToFeeAmount: (gasCostWei: bigint) => string | Promise /** * Optional safety margin in basis points applied to the gas cost BEFORE * conversion, to absorb gas-price drift between the estimate and the final * build (e.g. 1000 = +10%). Defaults to 0. */ bufferBps?: number /** * Optional non-zero placeholder amount (human-readable, `feeToken` units) used * to build the fee call during the gas-estimation pass so the estimate reflects * the final batch shape. Defaults to '0.01'. Must be ≤ the wallet's balance. The * amount does not affect the gas estimate; it only needs to produce a * representative transfer. */ placeholderAmount?: string } /** * Request for `sendBatchedAssets` — a gas-subsidized batch where the end user * reimburses the platform, in a fee token, for the gas Portal sponsored. See * {@link GasReimbursement}. */ export interface SendBatchedAssetsRequest { chain: string /** The end user's actual transaction(s) to execute in the batch. */ transactions: SendBatchUserOpTransaction[] /** Reimbursement appended as the final call in the batch. */ gasReimbursement: GasReimbursement signatureApprovalMemo?: string traceId?: string }