Skip to main content

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

MethodDescription
lucidSponsorUserOpSponsor a UserOp with $LUCID
lucidGetPaymasterRateGet LUCID/ETH exchange rate
lucidEstimateGasLucidEstimate gas cost in $LUCID

Generated Reference

Overview

ERC-4337 gas sponsorship — sponsor transactions, estimate fees, check rates

Available Operations

lucidSponsorUserOp

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

ParameterTypeRequiredDescription
requestmodels.SponsorUserOpRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit: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.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.SuccessResponse>

Errors

Error TypeStatus CodeContent Type
errors.ErrorResponse400application/json
errors.ErrorResponse500application/json
errors.RaijinLabsLucidAiDefaultError4XX, 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

ParameterTypeRequiredDescription
requestoperations.LucidGetPaymasterRateRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit: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.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.PaymasterRateResponse>

Errors

Error TypeStatus CodeContent Type
errors.ErrorResponse500application/json
errors.RaijinLabsLucidAiDefaultError4XX, 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

ParameterTypeRequiredDescription
requestmodels.EstimateGasRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit: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.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.SuccessResponse>

Errors

Error TypeStatus CodeContent Type
errors.ErrorResponse400application/json
errors.ErrorResponse500application/json
errors.RaijinLabsLucidAiDefaultError4XX, 5XX*/*