alchemyGasAndPaymasterAndDataMiddleware
Defined in: account-kit/infra/dist/types/middleware/gasManager.d.ts:71
Paymaster middleware factory that uses Alchemy’s Gas Manager for sponsoring
transactions. Uses Alchemy’s custom alchemy_requestGasAndPaymasterAndData
method instead of conforming to the standard ERC-7677 interface. Note that
if you use createAlchemySmartAccountClient
, this middleware is already
used by default and you do not need to manually include it.
Example
import {
const sepolia: Chainsepolia,
function alchemy(config: AlchemyTransportConfig): AlchemyTransportCreates an Alchemy transport with the specified configuration options. When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt. If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.
alchemy,
function alchemyGasAndPaymasterAndDataMiddleware(params: AlchemyGasAndPaymasterAndDataMiddlewareParams): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData">Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions. Uses Alchemy's custom alchemy_requestGasAndPaymasterAndData
method instead of conforming to the standard ERC-7677 interface. Note that if you use createAlchemySmartAccountClient
, this middleware is already used by default and you do not need to manually include it.
alchemyGasAndPaymasterAndDataMiddleware,
} from "@account-kit/infra";
import { function createSmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>): SmartAccountClient<TTransport, TChain, TAccount>createSmartAccountClient } from "@aa-sdk/core";
const const client: {
[x: string]: unknown;
account: SmartContractAccount | undefined;
batch?: {
multicall?: boolean | Prettify<MulticallBatchOptions> | undefined;
} | undefined;
... 83 more ...;
extend: <const client extends {
...;
} & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>;
}client = createSmartAccountClient<AlchemyTransport, Chain, SmartContractAccount | undefined, UserOperationContext>(config: {
type?: string | undefined | undefined;
... 15 more ...;
signUserOperation?: ClientMiddlewareFn<...> | undefined;
}): {
...;
}createSmartAccountClient({
transport: AlchemyTransportThe RPC transport
transport: function alchemy(config: AlchemyTransportConfig): AlchemyTransportCreates an Alchemy transport with the specified configuration options. When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt. If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.
alchemy({ apiKey: stringapiKey: "your-api-key" }),
chain?: Chain | undefinedChain for the client.
chain: const sepolia: Chainsepolia,
...function alchemyGasAndPaymasterAndDataMiddleware(params: AlchemyGasAndPaymasterAndDataMiddlewareParams): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData">Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions. Uses Alchemy's custom alchemy_requestGasAndPaymasterAndData
method instead of conforming to the standard ERC-7677 interface. Note that if you use createAlchemySmartAccountClient
, this middleware is already used by default and you do not need to manually include it.
alchemyGasAndPaymasterAndDataMiddleware({
AlchemyGasAndPaymasterAndDataMiddlewareParams.policyId: string | string[]policyId: "policyId",
AlchemyGasAndPaymasterAndDataMiddlewareParams.transport: AlchemyTransporttransport: function alchemy(config: AlchemyTransportConfig): AlchemyTransportCreates an Alchemy transport with the specified configuration options. When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt. If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.
alchemy({ apiKey: stringapiKey: "your-api-key" }),
}),
});
Parameters
Returns
Pick
<ClientMiddlewareConfig
,
| "dummyPaymasterAndData"
| "feeEstimator"
| "gasEstimator"
| "paymasterAndData"
>
partial client middleware configuration containing dummyPaymasterAndData
, feeEstimator
, gasEstimator
, and paymasterAndData