Skip to content

Commit

Permalink
Merge pull request #1979 from Web3Auth/feat/aa-update-transport-param
Browse files Browse the repository at this point in the history
account abstraction - make only url or transport required
  • Loading branch information
chaitanyapotti authored Oct 10, 2024
2 parents bae12fd + ed7e781 commit ba25fd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ export class AccountAbstractionProvider extends BaseProvider<AccountAbstractionP
// setup bundler and paymaster
if (this.config.paymasterConfig) {
this._paymasterClient = createPaymasterClient({
transport: http(this.config.paymasterConfig.url),
...this.config.paymasterConfig,
transport: this.config.paymasterConfig.transport ?? http(this.config.paymasterConfig.url),
});
}
this._bundlerClient = createBundlerClient({
...this.config.bundlerConfig,
account: this.smartAccount,
client: this._publicClient,
transport: http(this.config.bundlerConfig.url),
transport: this.config.bundlerConfig.transport ?? http(this.config.bundlerConfig.url),
paymaster: this._paymasterClient,
...this.config.bundlerConfig,
});

const providerHandlers = getProviderHandlers({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { createBundlerClient, createPaymasterClient } from "viem/account-abstraction";

export type BundlerConfig = {
url: string;
} & Omit<Parameters<typeof createBundlerClient>[0], "account" | "client" | "transport" | "paymaster"> &
Partial<Pick<Parameters<typeof createBundlerClient>[0], "transport">>;
type Transport = Parameters<typeof createBundlerClient>[0]["transport"];

export type PaymasterConfig = {
url: string;
} & Omit<Parameters<typeof createPaymasterClient>[0], "transport"> &
Partial<Pick<Parameters<typeof createPaymasterClient>[0], "transport">>;
export type BundlerConfig = Omit<Parameters<typeof createBundlerClient>[0], "account" | "client" | "transport" | "paymaster"> &
({ url: string; transport?: Transport } | { url?: string; transport: Transport });

export type PaymasterConfig = Omit<Parameters<typeof createPaymasterClient>[0], "transport"> &
({ url: string; transport?: Transport } | { url?: string; transport: Transport });

0 comments on commit ba25fd4

Please sign in to comment.