@alchemy/aa-alchemy
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -12,2 +12,3 @@ "use strict"; | ||
[chains_1.arbitrumGoerli.id, chains_1.arbitrumGoerli], | ||
[chains_1.arbitrumSepolia.id, chains_1.arbitrumSepolia], | ||
[chains_1.arbitrum.id, chains_1.arbitrum], | ||
@@ -14,0 +15,0 @@ [chains_1.optimism.id, chains_1.optimism], |
@@ -5,2 +5,2 @@ export { withAlchemyGasFeeEstimator } from "./middleware/gas-fees.js"; | ||
export { AlchemyProvider } from "./provider.js"; | ||
export type { AlchemyProviderConfig, ConnectionConfig } from "./provider.js"; | ||
export type { AlchemyProviderConfig } from "./type.js"; |
@@ -1,7 +0,5 @@ | ||
import type { Address } from "viem"; | ||
import type { AlchemyProvider } from "../provider.js"; | ||
export interface AlchemyGasManagerConfig { | ||
policyId: string; | ||
entryPoint: Address; | ||
} | ||
export declare const withAlchemyGasManager: (provider: AlchemyProvider, config: AlchemyGasManagerConfig, estimateGas?: boolean) => AlchemyProvider; |
@@ -43,3 +43,3 @@ "use strict"; | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: (0, aa_core_1.deepHexlify)(await (0, aa_core_1.resolveProperties)(struct)), | ||
@@ -67,3 +67,3 @@ }, | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: userOperation, | ||
@@ -70,0 +70,0 @@ dummySignature: userOperation.signature, |
@@ -1,34 +0,11 @@ | ||
import { SmartAccountProvider, type AccountMiddlewareFn, type SmartAccountProviderConfig } from "@alchemy/aa-core"; | ||
import { SmartAccountProvider, type AccountMiddlewareFn } from "@alchemy/aa-core"; | ||
import { type HttpTransport } from "viem"; | ||
import { type AlchemyGasManagerConfig } from "./middleware/gas-manager.js"; | ||
export type ConnectionConfig = { | ||
rpcUrl?: never; | ||
apiKey: string; | ||
jwt?: never; | ||
} | { | ||
rpcUrl?: never; | ||
apiKey?: never; | ||
jwt: string; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt?: never; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt: string; | ||
}; | ||
export type AlchemyProviderConfig = { | ||
feeOpts?: { | ||
baseFeeBufferPercent?: bigint; | ||
maxPriorityFeeBufferPercent?: bigint; | ||
preVerificationGasBufferPercent?: bigint; | ||
}; | ||
} & Omit<SmartAccountProviderConfig, "rpcProvider"> & ConnectionConfig; | ||
import type { AlchemyProviderConfig } from "./type.js"; | ||
export declare class AlchemyProvider extends SmartAccountProvider<HttpTransport> { | ||
private pvgBuffer; | ||
private feeOptsSet; | ||
constructor({ chain, entryPointAddress, opts, feeOpts, ...connectionConfig }: AlchemyProviderConfig); | ||
constructor(config: AlchemyProviderConfig); | ||
gasEstimator: AccountMiddlewareFn; | ||
withAlchemyGasManager(config: AlchemyGasManagerConfig): AlchemyProvider; | ||
} |
@@ -9,4 +9,7 @@ "use strict"; | ||
const gas_manager_js_1 = require("./middleware/gas-manager.js"); | ||
const schema_js_1 = require("./schema.js"); | ||
class AlchemyProvider extends aa_core_1.SmartAccountProvider { | ||
constructor({ chain, entryPointAddress, opts, feeOpts, ...connectionConfig }) { | ||
constructor(config) { | ||
schema_js_1.AlchemyProviderConfigSchema.parse(config); | ||
const { chain, entryPointAddress, opts, feeOpts, ...connectionConfig } = config; | ||
const _chain = typeof chain === "number" ? chains_js_1.SupportedChains.get(chain) : chain; | ||
@@ -30,3 +33,8 @@ if (!_chain || !_chain.rpcUrls["alchemy"]) { | ||
}); | ||
super({ rpcProvider: client, entryPointAddress, chain: _chain, opts }); | ||
super({ | ||
rpcProvider: client, | ||
entryPointAddress, | ||
chain: _chain, | ||
opts, | ||
}); | ||
Object.defineProperty(this, "pvgBuffer", { | ||
@@ -50,3 +58,3 @@ enumerable: true, | ||
const request = (0, aa_core_1.deepHexlify)(await (0, aa_core_1.resolveProperties)(struct)); | ||
const estimates = await this.rpcClient.estimateUserOperationGas(request, this.entryPointAddress); | ||
const estimates = await this.rpcClient.estimateUserOperationGas(request, this.getEntryPointAddress()); | ||
estimates.preVerificationGas = | ||
@@ -53,0 +61,0 @@ (BigInt(estimates.preVerificationGas) * (100n + this.pvgBuffer)) / 100n; |
@@ -1,2 +0,2 @@ | ||
import { arbitrum, arbitrumGoerli, goerli, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia, base, baseGoerli, } from "viem/chains"; | ||
import { arbitrum, arbitrumGoerli, goerli, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia, base, baseGoerli, arbitrumSepolia, } from "viem/chains"; | ||
export const SupportedChains = new Map([ | ||
@@ -9,2 +9,3 @@ [polygonMumbai.id, polygonMumbai], | ||
[arbitrumGoerli.id, arbitrumGoerli], | ||
[arbitrumSepolia.id, arbitrumSepolia], | ||
[arbitrum.id, arbitrum], | ||
@@ -11,0 +12,0 @@ [optimism.id, optimism], |
@@ -5,2 +5,2 @@ export { withAlchemyGasFeeEstimator } from "./middleware/gas-fees.js"; | ||
export { AlchemyProvider } from "./provider.js"; | ||
export type { AlchemyProviderConfig, ConnectionConfig } from "./provider.js"; | ||
export type { AlchemyProviderConfig } from "./type.js"; |
@@ -1,7 +0,5 @@ | ||
import type { Address } from "viem"; | ||
import type { AlchemyProvider } from "../provider.js"; | ||
export interface AlchemyGasManagerConfig { | ||
policyId: string; | ||
entryPoint: Address; | ||
} | ||
export declare const withAlchemyGasManager: (provider: AlchemyProvider, config: AlchemyGasManagerConfig, estimateGas?: boolean) => AlchemyProvider; |
@@ -39,3 +39,3 @@ import { deepHexlify, resolveProperties, } from "@alchemy/aa-core"; | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: deepHexlify(await resolveProperties(struct)), | ||
@@ -63,3 +63,3 @@ }, | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: userOperation, | ||
@@ -66,0 +66,0 @@ dummySignature: userOperation.signature, |
@@ -1,34 +0,11 @@ | ||
import { SmartAccountProvider, type AccountMiddlewareFn, type SmartAccountProviderConfig } from "@alchemy/aa-core"; | ||
import { SmartAccountProvider, type AccountMiddlewareFn } from "@alchemy/aa-core"; | ||
import { type HttpTransport } from "viem"; | ||
import { type AlchemyGasManagerConfig } from "./middleware/gas-manager.js"; | ||
export type ConnectionConfig = { | ||
rpcUrl?: never; | ||
apiKey: string; | ||
jwt?: never; | ||
} | { | ||
rpcUrl?: never; | ||
apiKey?: never; | ||
jwt: string; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt?: never; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt: string; | ||
}; | ||
export type AlchemyProviderConfig = { | ||
feeOpts?: { | ||
baseFeeBufferPercent?: bigint; | ||
maxPriorityFeeBufferPercent?: bigint; | ||
preVerificationGasBufferPercent?: bigint; | ||
}; | ||
} & Omit<SmartAccountProviderConfig, "rpcProvider"> & ConnectionConfig; | ||
import type { AlchemyProviderConfig } from "./type.js"; | ||
export declare class AlchemyProvider extends SmartAccountProvider<HttpTransport> { | ||
private pvgBuffer; | ||
private feeOptsSet; | ||
constructor({ chain, entryPointAddress, opts, feeOpts, ...connectionConfig }: AlchemyProviderConfig); | ||
constructor(config: AlchemyProviderConfig); | ||
gasEstimator: AccountMiddlewareFn; | ||
withAlchemyGasManager(config: AlchemyGasManagerConfig): AlchemyProvider; | ||
} |
@@ -7,4 +7,7 @@ import { SmartAccountProvider, createPublicErc4337Client, deepHexlify, resolveProperties, } from "@alchemy/aa-core"; | ||
import { withAlchemyGasManager, } from "./middleware/gas-manager.js"; | ||
import { AlchemyProviderConfigSchema } from "./schema.js"; | ||
export class AlchemyProvider extends SmartAccountProvider { | ||
constructor({ chain, entryPointAddress, opts, feeOpts, ...connectionConfig }) { | ||
constructor(config) { | ||
AlchemyProviderConfigSchema.parse(config); | ||
const { chain, entryPointAddress, opts, feeOpts, ...connectionConfig } = config; | ||
const _chain = typeof chain === "number" ? SupportedChains.get(chain) : chain; | ||
@@ -28,3 +31,8 @@ if (!_chain || !_chain.rpcUrls["alchemy"]) { | ||
}); | ||
super({ rpcProvider: client, entryPointAddress, chain: _chain, opts }); | ||
super({ | ||
rpcProvider: client, | ||
entryPointAddress, | ||
chain: _chain, | ||
opts, | ||
}); | ||
Object.defineProperty(this, "pvgBuffer", { | ||
@@ -48,3 +56,3 @@ enumerable: true, | ||
const request = deepHexlify(await resolveProperties(struct)); | ||
const estimates = await this.rpcClient.estimateUserOperationGas(request, this.entryPointAddress); | ||
const estimates = await this.rpcClient.estimateUserOperationGas(request, this.getEntryPointAddress()); | ||
estimates.preVerificationGas = | ||
@@ -51,0 +59,0 @@ (BigInt(estimates.preVerificationGas) * (100n + this.pvgBuffer)) / 100n; |
@@ -5,3 +5,3 @@ export { withAlchemyGasFeeEstimator } from "./middleware/gas-fees.js"; | ||
export { AlchemyProvider } from "./provider.js"; | ||
export type { AlchemyProviderConfig, ConnectionConfig } from "./provider.js"; | ||
export type { AlchemyProviderConfig } from "./type.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,6 +0,4 @@ | ||
import type { Address } from "viem"; | ||
import type { AlchemyProvider } from "../provider.js"; | ||
export interface AlchemyGasManagerConfig { | ||
policyId: string; | ||
entryPoint: Address; | ||
} | ||
@@ -7,0 +5,0 @@ /** |
@@ -1,49 +0,9 @@ | ||
import { SmartAccountProvider, type AccountMiddlewareFn, type SmartAccountProviderConfig } from "@alchemy/aa-core"; | ||
import { SmartAccountProvider, type AccountMiddlewareFn } from "@alchemy/aa-core"; | ||
import { type HttpTransport } from "viem"; | ||
import { type AlchemyGasManagerConfig } from "./middleware/gas-manager.js"; | ||
export type ConnectionConfig = { | ||
rpcUrl?: never; | ||
apiKey: string; | ||
jwt?: never; | ||
} | { | ||
rpcUrl?: never; | ||
apiKey?: never; | ||
jwt: string; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt?: never; | ||
} | { | ||
rpcUrl: string; | ||
apiKey?: never; | ||
jwt: string; | ||
}; | ||
export type AlchemyProviderConfig = { | ||
feeOpts?: { | ||
/** this adds a percent buffer on top of the base fee estimated (default 50%) | ||
* NOTE: this is only applied if the default fee estimator is used. | ||
*/ | ||
baseFeeBufferPercent?: bigint; | ||
/** this adds a percent buffer on top of the priority fee estimated (default 5%)' | ||
* * NOTE: this is only applied if the default fee estimator is used. | ||
*/ | ||
maxPriorityFeeBufferPercent?: bigint; | ||
/** this adds a percent buffer on top of the preVerificationGasEstimated | ||
* | ||
* Defaults 5% on Arbitrum and Optimism, 0% elsewhere | ||
* | ||
* This is only useful on Arbitrum and Optimism, where the preVerificationGas is | ||
* dependent on the gas fee during the time of estimation. To improve chances of | ||
* the UserOperation being mined, users can increase the preVerificationGas by | ||
* a buffer. This buffer will always be charged, regardless of price at time of mine. | ||
* | ||
* NOTE: this is only applied if the defualt gas estimator is used. | ||
*/ | ||
preVerificationGasBufferPercent?: bigint; | ||
}; | ||
} & Omit<SmartAccountProviderConfig, "rpcProvider"> & ConnectionConfig; | ||
import type { AlchemyProviderConfig } from "./type.js"; | ||
export declare class AlchemyProvider extends SmartAccountProvider<HttpTransport> { | ||
private pvgBuffer; | ||
private feeOptsSet; | ||
constructor({ chain, entryPointAddress, opts, feeOpts, ...connectionConfig }: AlchemyProviderConfig); | ||
constructor(config: AlchemyProviderConfig); | ||
gasEstimator: AccountMiddlewareFn; | ||
@@ -50,0 +10,0 @@ /** |
{ | ||
"name": "@alchemy/aa-alchemy", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "adapters for @alchemy/aa-core for interacting with alchemy services", | ||
@@ -42,3 +42,3 @@ "author": "Alchemy", | ||
"devDependencies": { | ||
"@alchemy/aa-core": "^0.1.0", | ||
"@alchemy/aa-core": "^0.1.1", | ||
"typescript": "^5.0.4", | ||
@@ -49,3 +49,3 @@ "typescript-template": "*", | ||
"dependencies": { | ||
"@alchemy/aa-core": "^0.1.1", | ||
"@alchemy/aa-core": "^0.2.0", | ||
"viem": "^1.16.2" | ||
@@ -65,3 +65,3 @@ }, | ||
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme", | ||
"gitHead": "d080df586c7b46c952b4219bf549c1e481bdada6" | ||
"gitHead": "e9de0ca797605b04dc0a5db0764f1efed4a94610" | ||
} |
@@ -14,2 +14,3 @@ import type { Chain } from "viem"; | ||
baseGoerli, | ||
arbitrumSepolia, | ||
} from "viem/chains"; | ||
@@ -24,2 +25,3 @@ | ||
[arbitrumGoerli.id, arbitrumGoerli], | ||
[arbitrumSepolia.id, arbitrumSepolia], | ||
[arbitrum.id, arbitrum], | ||
@@ -26,0 +28,0 @@ [optimism.id, optimism], |
@@ -7,2 +7,2 @@ export { withAlchemyGasFeeEstimator } from "./middleware/gas-fees.js"; | ||
export { AlchemyProvider } from "./provider.js"; | ||
export type { AlchemyProviderConfig, ConnectionConfig } from "./provider.js"; | ||
export type { AlchemyProviderConfig } from "./type.js"; |
@@ -6,3 +6,2 @@ import { | ||
} from "@alchemy/aa-core"; | ||
import type { Address } from "viem"; | ||
import type { AlchemyProvider } from "../provider.js"; | ||
@@ -13,3 +12,2 @@ import type { ClientWithAlchemyMethods } from "./client.js"; | ||
policyId: string; | ||
entryPoint: Address; | ||
} | ||
@@ -94,3 +92,3 @@ | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: deepHexlify(await resolveProperties(struct)), | ||
@@ -135,3 +133,3 @@ }, | ||
policyId: config.policyId, | ||
entryPoint: config.entryPoint, | ||
entryPoint: provider.getEntryPointAddress(), | ||
userOperation: userOperation, | ||
@@ -138,0 +136,0 @@ dummySignature: userOperation.signature, |
@@ -7,3 +7,2 @@ import { | ||
type AccountMiddlewareFn, | ||
type SmartAccountProviderConfig, | ||
} from "@alchemy/aa-core"; | ||
@@ -23,35 +22,5 @@ import { type HttpTransport } from "viem"; | ||
} from "./middleware/gas-manager.js"; | ||
import { AlchemyProviderConfigSchema } from "./schema.js"; | ||
import type { AlchemyProviderConfig } from "./type.js"; | ||
export type ConnectionConfig = | ||
| { rpcUrl?: never; apiKey: string; jwt?: never } | ||
| { rpcUrl?: never; apiKey?: never; jwt: string } | ||
| { rpcUrl: string; apiKey?: never; jwt?: never } | ||
| { rpcUrl: string; apiKey?: never; jwt: string }; | ||
export type AlchemyProviderConfig = { | ||
feeOpts?: { | ||
/** this adds a percent buffer on top of the base fee estimated (default 50%) | ||
* NOTE: this is only applied if the default fee estimator is used. | ||
*/ | ||
baseFeeBufferPercent?: bigint; | ||
/** this adds a percent buffer on top of the priority fee estimated (default 5%)' | ||
* * NOTE: this is only applied if the default fee estimator is used. | ||
*/ | ||
maxPriorityFeeBufferPercent?: bigint; | ||
/** this adds a percent buffer on top of the preVerificationGasEstimated | ||
* | ||
* Defaults 5% on Arbitrum and Optimism, 0% elsewhere | ||
* | ||
* This is only useful on Arbitrum and Optimism, where the preVerificationGas is | ||
* dependent on the gas fee during the time of estimation. To improve chances of | ||
* the UserOperation being mined, users can increase the preVerificationGas by | ||
* a buffer. This buffer will always be charged, regardless of price at time of mine. | ||
* | ||
* NOTE: this is only applied if the defualt gas estimator is used. | ||
*/ | ||
preVerificationGasBufferPercent?: bigint; | ||
}; | ||
} & Omit<SmartAccountProviderConfig, "rpcProvider"> & | ||
ConnectionConfig; | ||
export class AlchemyProvider extends SmartAccountProvider<HttpTransport> { | ||
@@ -61,9 +30,7 @@ private pvgBuffer: bigint; | ||
constructor({ | ||
chain, | ||
entryPointAddress, | ||
opts, | ||
feeOpts, | ||
...connectionConfig | ||
}: AlchemyProviderConfig) { | ||
constructor(config: AlchemyProviderConfig) { | ||
AlchemyProviderConfigSchema.parse(config); | ||
const { chain, entryPointAddress, opts, feeOpts, ...connectionConfig } = | ||
config; | ||
const _chain = | ||
@@ -92,3 +59,8 @@ typeof chain === "number" ? SupportedChains.get(chain) : chain; | ||
super({ rpcProvider: client, entryPointAddress, chain: _chain, opts }); | ||
super({ | ||
rpcProvider: client, | ||
entryPointAddress, | ||
chain: _chain, | ||
opts, | ||
}); | ||
@@ -123,3 +95,3 @@ withAlchemyGasFeeEstimator( | ||
request, | ||
this.entryPointAddress | ||
this.getEntryPointAddress() | ||
); | ||
@@ -126,0 +98,0 @@ estimates.preVerificationGas = |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
121015
77
1719
+ Added@alchemy/aa-core@0.2.0(transitive)
+ Addedzod@3.24.1(transitive)
- Removed@alchemy/aa-core@0.1.1(transitive)
Updated@alchemy/aa-core@^0.2.0