Paymaster API
Last updated
Last updated
Paymasters are smart contracts designed to facilitate transaction sponsorship.
They allow third parties to sponsor the gas fees for transactions, enabling users to interact with the blockchain without having to pay for gas themselves.
This can be particularly useful for onboarding new users, running promotional campaigns, or supporting decentralized applications where the end-user experience is improved by abstracting away transaction costs.
To authorize the sponsorship of a given contract address, you need to add it to your sponsored addressesed in the dashboard. From there, we will accept sponsoring transactions targeting this contract.
Have a look at the "Gasless with Paymaster" section of the SDK documentation to see how to integrate it seamlessly.
https://paymaster.cometh.io/CHAIN_ID?apikey=API_KEY
Example for Arbitrum Sepolia : https://paymaster.cometh.io/421614?apikey=API_KEY
Submit a UserOperation to the paymaster. If approved for sponsorship, it returns the paymasterAndData along with updated gas values
Request
{
"jsonrpc": "2.0",
"id": 13,
"method": "pm_sponsorUserOperation",
"params": [
{
"sender": "0x8Fb8E6461F278c1651cb0Be92f27817e7Af128D9",
"nonce": "0x09",
"callData": "0x7bb374280000000000000000000000004fbf9ee4b2af774d4617eab027ac2901a41a7b5f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000406661abd00000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0x0",
"verificationGasLimit": "0x0",
"preVerificationGas": "0x0",
"maxFeePerGas": "0xe4e1c00",
"maxPriorityFeePerGas": "0x7270e00",
"signature": "0xecececececececececececececececececececececececececececececececec"
},
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
]
}
Response
{
"jsonrpc": "2.0",
"id": 13,
"result": {
"paymaster": "0xc49d6e93bB127A2FDf349FAdBD90De6853Bf40ff",
"paymasterData": "0x0000000000000000000000000000000000000000000000000000000067108be20000000000000000000000000000000000000000000000000000000000001234bbdf2f2f5c456f14c1c72a3fb87c73a64dc8157caa5a8243213f4e0beab664335c31160514ee572b2006e78b77dee3749303d737f3ecf58b27cbeddf24120bac1c",
"paymasterPostOpGasLimit": "0x01",
"paymasterVerificationGasLimit": "0x0927c0",
"hash": "0x2a079aad99c4d17456e487153e689bcedbb55707146b597172b05ab6721cf2b5",
"signature": "0xbbdf2f2f5c456f14c1c72a3fb87c73a64dc8157caa5a8243213f4e0beab664335c31160514ee572b2006e78b77dee3749303d737f3ecf58b27cbeddf24120bac1c",
"preVerificationGas": "0x51a257",
"verificationGasLimit": "0x1987c",
"callGasLimit": "0x19afb"
}
}
Returns an array of supported EntryPoint addresses.
Request
{
"method":"pm_supportedEntryPoints",
"id":1,
"params":[],
"jsonrpc":"2.0"
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
]
}
Retrieve Sponsored Addresses
Use the following GET
request to obtain the list of sponsored addresses for a specific chain.
curl --request GET \
--url 'https://paymaster.cometh.io/sponsored-address/CHAIN_ID/?apikey=APIKEY' \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/9.2.0'
Set Sponsored Address
To add a new sponsored address, send a POST
request with the target address and chain ID.
curl --request POST \
--url 'https://paymaster.cometh.io/sponsored-address/?apisecret=API_SECRET' \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/9.2.0' \
--data '{
"targetAddress": "0xE1e5072de1d9B120Cc33C57EbADBCD33DBC6dD62",
"chainId": 100
}'
Retrieve Sponsored Chains
The following GET
request can be used to get information about sponsored chains.
curl --request GET \
--url 'https://paymaster.cometh.io/sponsored-chain/CHAIN_ID/?apikey=APIKEY' \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/9.2.0'
Set Sponsored Chain
This route enables users to sponsor an entire chain, allowing transactions on the chain to benefit from sponsorship.
curl --request POST \
--url 'https://paymaster.cometh.io/sponsored-chain/' \
--header 'Content-Type: application/json' \
--header 'apisecret: API_SECRET' \
--data '{
"chainId": 100
}'