Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for skale #377

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export const compatibilityArgsSchema = z.object({
"op-stack",
"arbitrum",
"hedera",
"mantle"
"mantle",
"skale"
]),
"legacy-transactions": z.boolean(),
"api-version": z
Expand Down
11 changes: 9 additions & 2 deletions src/cli/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,16 @@ export const compatibilityOptions: CliCommandOptions<ICompatibilityArgsInput> =
{
"chain-type": {
description:
"Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain",
"Indicates what type of chain the bundler is running on",
type: "string",
choices: ["default", "op-stack", "arbitrum", "hedera", "mantle"],
choices: [
"default",
"op-stack",
"arbitrum",
"hedera",
"mantle",
"skale"
],
default: "default"
},
"legacy-transactions": {
Expand Down
18 changes: 16 additions & 2 deletions src/cli/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
createPublicClient,
createWalletClient,
formatEther,
fallback
fallback,
CallParameters,
publicActions
} from "viem"
import { UtilityWalletMonitor } from "../executor/utilityWalletMonitor"
import type { IOptionsInput } from "./config"
Expand Down Expand Up @@ -92,7 +94,7 @@ export async function bundlerHandler(args_: IOptionsInput): Promise<void> {
}
}

const publicClient = createPublicClient({
let publicClient = createPublicClient({
transport: customTransport(args.rpcUrl, {
logger: logger.child(
{ module: "public_client" },
Expand All @@ -104,6 +106,18 @@ export async function bundlerHandler(args_: IOptionsInput): Promise<void> {
chain
})

if (args.chainType === "skale") {
// SKALE only allows white listed addresses to deploy contracts.
publicClient = publicClient
.extend((client) => ({
async call(args: CallParameters) {
args.account = "0x4337000c2828F5260d8921fD25829F606b9E8680"
return await client.call(args)
}
}))
.extend(publicActions)
}

const createWalletTransport = (url: string) =>
customTransport(url, {
logger: logger.child(
Expand Down
1 change: 1 addition & 0 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export type ChainType =
| "arbitrum"
| "hedera"
| "mantle"
| "skale"
Loading