Documentation Index
Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
Use this file to discover all available pages before exploring further.
Paymaster SDK
ERC-4337 gas sponsorship — sponsor transactions, estimate fees, check rates
Operations
| Method | Description |
|---|
lucidSponsorUserOp | Sponsor a UserOp with $LUCID |
lucidGetPaymasterRate | Get LUCID/ETH exchange rate |
lucidEstimateGasLucid | Estimate gas cost in $LUCID |
Generated Reference
Overview
ERC-4337 gas sponsorship — sponsor transactions, estimate fees, check rates
Available Operations
Sponsor an ERC-4337 UserOperation by paying the gas cost in LUCID tokens. The paymaster signs the UserOp and deducts LUCID from the sender’s balance at the current exchange rate.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.paymaster.lucidSponsorUserOp({
chainId: "<id>",
userOp: {},
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { paymasterLucidSponsorUserOp } from "raijin-labs-lucid-ai/funcs/paymasterLucidSponsorUserOp.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await paymasterLucidSponsorUserOp(raijinLabsLucidAi, {
chainId: "<id>",
userOp: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("paymasterLucidSponsorUserOp failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | models.SponsorUserOpRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.SuccessResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 400 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
lucidGetPaymasterRate
Retrieve the current LUCID-per-ETH exchange rate used for gas sponsoring on a specific EVM chain. The rate determines how much LUCID is charged per gas unit.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.paymaster.lucidGetPaymasterRate({
chainId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { paymasterLucidGetPaymasterRate } from "raijin-labs-lucid-ai/funcs/paymasterLucidGetPaymasterRate.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await paymasterLucidGetPaymasterRate(raijinLabsLucidAi, {
chainId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("paymasterLucidGetPaymasterRate failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | operations.LucidGetPaymasterRateRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.PaymasterRateResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
lucidEstimateGasLucid
Estimate the LUCID token cost for a UserOperation before submitting it. Returns the estimated gas in ETH and the equivalent LUCID amount at the current exchange rate.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.paymaster.lucidEstimateGasLucid({
chainId: "<id>",
userOp: {},
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { paymasterLucidEstimateGasLucid } from "raijin-labs-lucid-ai/funcs/paymasterLucidEstimateGasLucid.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await paymasterLucidEstimateGasLucid(raijinLabsLucidAi, {
chainId: "<id>",
userOp: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("paymasterLucidEstimateGasLucid failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | models.EstimateGasRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.SuccessResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 400 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |