Skip to main content
POST

Overview

JSON-RPC method paymaster_buildTransaction with the apply_action type. Returns the fee estimate and the fee_action: the pool fee that must be withdrawn (inside the private transaction) to reimburse the paymaster. Use invoke_and_apply_action instead when a signed user call must be wrapped in the same transaction (e.g. an approve for a deposit) — the response then also contains the typed_data to sign. The endpoint is the base URL itself (no path): https://starknet.paymaster.avnu.fi (mainnet) or https://sepolia.paymaster.avnu.fi (testnet).

Headers

x-paymaster-api-key
string
required
Portal API key. Required for the sponsored fee modes (sponsored, sponsored_private)

Body (JSON-RPC 2.0)

method
string
required
paymaster_buildTransaction
params.transaction.type
string
required
apply_action, or invoke_and_apply_action when a signed user call is required
params.transaction.apply_action.pool_address
string
required
The privacy pool address. Must be the pool whitelisted by the paymaster (exported by the SDK as PRIVACY_POOL_ADDRESS / SEPOLIA_PRIVACY_POOL_ADDRESS)
params.transaction.invoke
object
Only for invoke_and_apply_action: { user_address, calls } — the user calls to wrap
params.parameters.version
string
required
0x1
params.parameters.fee_mode
object
required
{ mode: 'sponsored_private', pool_fee_token, tip? }. pool_fee_token is the token the pool fee is paid in; tip is slow | normal | fast (default normal)
params.parameters.time_bounds
object
Optional { execute_after, execute_before } (unix seconds)

Response

type
string
Echoes the transaction type
fee_action
object
required
The pool fee to withdraw inside the private transaction: { type: 'withdraw', recipient, token, amount } (hex amounts)
fee
object
Fee estimate: gas_token_price_in_strk, estimated_fee_in_strk, estimated_fee_in_gas_token, suggested_max_fee_in_strk, suggested_max_fee_in_gas_token (hex)
parameters
object
Echoes the execution parameters
typed_data
object
Only for invoke_and_apply_action: the SNIP-12 typed data the user must sign

Errors