Skip to content

Commit

Permalink
add support for skale (#377)
Browse files Browse the repository at this point in the history
Co-authored-by: mouseless <[email protected]>
  • Loading branch information
mouseless0x and mouseless0x authored Dec 12, 2024
1 parent 541a4a6 commit ba16716
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
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"

0 comments on commit ba16716

Please sign in to comment.