Skip to content

Commit

Permalink
fix: nit updates for correct variable name for with alchemy gas manag…
Browse files Browse the repository at this point in the history
…er function
  • Loading branch information
denniswon committed Nov 29, 2023
1 parent 9388508 commit f15e335
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/alchemy/src/middleware/gas-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export interface AlchemyGasEstimationOptions {
/**
* This middleware wraps the Alchemy Gas Manager APIs to provide more flexible UserOperation gas sponsorship.
*
* If `delegateGasEstimation` is true, it will use `alchemy_requestGasAndPaymasterAndData` to get all of the gas estimates + paymaster data
* in one RPC call.
* If `estimateGas` field of `gasEstimationOptions` is true, it will use `alchemy_requestGasAndPaymasterAndData` to get all of
* the gas estimates + paymaster data in one RPC call.
*
* Otherwise, it will use `alchemy_requestPaymasterAndData` to get only paymaster data, allowing you
* to customize the gas and fee estimation middleware.
*
* @param provider - the smart account provider to override to use the alchemy gas manager
* @param config - the alchemy gas manager configuration
* @param delegateGasEstimation - if true, this will use `alchemy_requestGasAndPaymasterAndData` else will use `alchemy_requestPaymasterAndData`
* @param gasEstimationOptions - if `estimateGas` field is true, will use `alchemy_requestGasAndPaymasterAndData` else will use `alchemy_requestPaymasterAndData`
* @returns the provider augmented to use the alchemy gas manager
*/
export const withAlchemyGasManager = <P extends AlchemyProvider>(
Expand Down
8 changes: 4 additions & 4 deletions packages/alchemy/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ export class AlchemyProvider extends SmartAccountProvider<HttpTransport> {
* This methods adds the Alchemy Gas Manager middleware to the provider.
*
* @param config - the Alchemy Gas Manager configuration
* @param delegateGasEstimation - whether to delegate the gas estimation entirely to bundler
* @param estimateGas - whether to delegate the gas estimation entirely to bundler
*
* Note that with delegateGasEstimation set to true, the gas estimation middleware will be no-op'd
* Note that with estimateGas set to true, the gas estimation middleware will be no-op'd
* and fee options set upon provider init will be ignored.
*
* @returns {AlchemyProvider} - a new AlchemyProvider with the Gas Manager middleware
*/
withAlchemyGasManager(
config: AlchemyGasManagerConfig,
delegateGasEstimation: boolean = true
estimateGas: boolean = true
): AlchemyProvider {
if (!this.isConnected()) {
throw new Error(
Expand All @@ -104,7 +104,7 @@ export class AlchemyProvider extends SmartAccountProvider<HttpTransport> {
}

return withAlchemyGasManager(this, config, {
estimateGas: delegateGasEstimation,
estimateGas,
});
}

Expand Down
6 changes: 5 additions & 1 deletion site/packages/aa-alchemy/middleware/withAlchemyGasManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ A new instance of an `AlchemyProvider` with the same attributes as the input, no

- `policyId: string` -- the Alchemy Gas Manager policy ID

### `delegateGasEstimation: boolean` -- a flag to additionally estimate gas as part of requesting paymaster and data
### `gasEstimationOptions: AlchemyGasEstimationOptions`

- `estimateGas: boolean` -- a flag to additionally estimate gas as part of requesting paymaster and data
- `fallbackGasEstimator?: AccountMiddlewareFn` -- an optional fallback gas estimator middleware to be used in case of `paymasterAndData` override case when sending a user operation to bypass paymaster middleware. If not provided, defaults to the default gas estimator middleware set on the provider.
- `fallbackFeeDataGetter?: fallbackFeeDataGetter` -- an optional fallback fee data getter middleware to be used in case of `paymasterAndData` override case when sending a user operation to bypass paymaster middleware. If not provided, defaults to the default fee data getter middleware set on the provider.

0 comments on commit f15e335

Please sign in to comment.