Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kerneljs/presets

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kerneljs/presets - npm Package Compare versions

Comparing version 0.0.1-alpha.3 to 0.0.1-alpha.4

22

_cjs/zerodev/index.js

@@ -22,3 +22,3 @@ "use strict";

};
async function createEcdsaKernelAccountClient({ chain, projectId, signer, provider, index, usePaymaster = true, }) {
async function createEcdsaKernelAccountClient({ chain, projectId, signer, provider, index, usePaymaster = true }) {
const publicClient = (0, viem_1.createPublicClient)({

@@ -38,11 +38,13 @@ transport: (0, viem_1.http)(getZeroDevBundlerRPC(projectId, provider))

transport: (0, viem_1.http)(getZeroDevBundlerRPC(projectId, provider)),
sponsorUserOperation: usePaymaster ? (async ({ userOperation }) => {
const kernelPaymaster = (0, core_1.createKernelPaymasterClient)({
chain: chain,
transport: (0, viem_1.http)(getZeroDevPaymasterRPC(projectId, provider))
});
return kernelPaymaster.sponsorUserOperation({
userOperation
});
}) : undefined
sponsorUserOperation: usePaymaster
? async ({ userOperation }) => {
const kernelPaymaster = (0, core_1.createKernelPaymasterClient)({
chain: chain,
transport: (0, viem_1.http)(getZeroDevPaymasterRPC(projectId, provider))
});
return kernelPaymaster.sponsorUserOperation({
userOperation
});
}
: undefined
});

@@ -49,0 +51,0 @@ return kernelClient;

@@ -19,3 +19,3 @@ import { createKernelAccount, createKernelPaymasterClient } from "@kerneljs/core";

};
export async function createEcdsaKernelAccountClient({ chain, projectId, signer, provider, index, usePaymaster = true, }) {
export async function createEcdsaKernelAccountClient({ chain, projectId, signer, provider, index, usePaymaster = true }) {
const publicClient = createPublicClient({

@@ -35,11 +35,13 @@ transport: http(getZeroDevBundlerRPC(projectId, provider))

transport: http(getZeroDevBundlerRPC(projectId, provider)),
sponsorUserOperation: usePaymaster ? (async ({ userOperation }) => {
const kernelPaymaster = createKernelPaymasterClient({
chain: chain,
transport: http(getZeroDevPaymasterRPC(projectId, provider))
});
return kernelPaymaster.sponsorUserOperation({
userOperation
});
}) : undefined
sponsorUserOperation: usePaymaster
? async ({ userOperation }) => {
const kernelPaymaster = createKernelPaymasterClient({
chain: chain,
transport: http(getZeroDevPaymasterRPC(projectId, provider))
});
return kernelPaymaster.sponsorUserOperation({
userOperation
});
}
: undefined
});

@@ -46,0 +48,0 @@ return kernelClient;

@@ -6,3 +6,3 @@ import type { KernelSmartAccount } from "@kerneljs/core";

export type Provider = "STACKUP" | "PIMLICO" | "ALCHEMY" | "GELATO";
export declare function createEcdsaKernelAccountClient<TChain extends Chain | undefined = Chain | undefined, TSource extends string = "custom", TAddress extends Address = Address>({ chain, projectId, signer, provider, index, usePaymaster, }: {
export declare function createEcdsaKernelAccountClient<TChain extends Chain | undefined = Chain | undefined, TSource extends string = "custom", TAddress extends Address = Address>({ chain, projectId, signer, provider, index, usePaymaster }: {
chain: TChain;

@@ -9,0 +9,0 @@ projectId: string;

{
"name": "@kerneljs/presets",
"version": "0.0.1-alpha.3",
"version": "0.0.1-alpha.4",
"author": "ZeroDev",

@@ -13,2 +13,14 @@ "main": "./_cjs/index.js",

},
"exports": {
".": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
},
"./zerodev": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
}
},
"license": "MIT",

@@ -42,7 +54,7 @@ "files": [

"typescript": "^5.0.0",
"@kerneljs/core": "^0.0.1-alpha.5",
"@kerneljs/ecdsa-validator": "^0.0.1-alpha.11",
"@kerneljs/core": "^0.0.1-alpha.6",
"@kerneljs/ecdsa-validator": "^0.0.1-alpha.12",
"permissionless": "^0.0.20",
"viem": "^1.21.3"
"viem": "^1.21.4"
}
}
import type { KernelSmartAccount } from "@kerneljs/core"
import {
createKernelAccount,
createKernelPaymasterClient
createKernelAccount,
createKernelPaymasterClient
} from "@kerneljs/core"

@@ -16,83 +16,85 @@ import { signerToEcdsaValidator } from "@kerneljs/ecdsa-validator"

const getZeroDevBundlerRPC = (
projectId: string,
provider?: Provider
projectId: string,
provider?: Provider
): string => {
let rpc = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`
if (provider) {
rpc += `?bundlerProvider=${provider}`
}
return rpc
let rpc = `https://rpc.zerodev.app/api/v2/bundler/${projectId}`
if (provider) {
rpc += `?bundlerProvider=${provider}`
}
return rpc
}
const getZeroDevPaymasterRPC = (
projectId: string,
provider?: Provider
projectId: string,
provider?: Provider
): string => {
let rpc = `https://rpc.zerodev.app/api/v2/paymaster/${projectId}`
if (provider) {
rpc += `?paymasterProvider=${provider}`
}
return rpc
let rpc = `https://rpc.zerodev.app/api/v2/paymaster/${projectId}`
if (provider) {
rpc += `?paymasterProvider=${provider}`
}
return rpc
}
export async function createEcdsaKernelAccountClient<
TChain extends Chain | undefined = Chain | undefined,
TSource extends string = "custom",
TAddress extends Address = Address
TChain extends Chain | undefined = Chain | undefined,
TSource extends string = "custom",
TAddress extends Address = Address
>({
chain,
projectId,
signer,
provider,
index,
usePaymaster = true,
chain,
projectId,
signer,
provider,
index,
usePaymaster = true
}: {
chain: TChain
projectId: string
signer: SmartAccountSigner<TSource, TAddress>
provider?: Provider
index?: bigint
usePaymaster?: boolean
chain: TChain
projectId: string
signer: SmartAccountSigner<TSource, TAddress>
provider?: Provider
index?: bigint
usePaymaster?: boolean
}): Promise<
SmartAccountClient<
HttpTransport,
TChain,
KernelSmartAccount<HttpTransport, TChain>
>
SmartAccountClient<
HttpTransport,
TChain,
KernelSmartAccount<HttpTransport, TChain>
>
> {
const publicClient = createPublicClient({
transport: http(getZeroDevBundlerRPC(projectId, provider))
})
const publicClient = createPublicClient({
transport: http(getZeroDevBundlerRPC(projectId, provider))
})
const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
signer
})
const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
signer
})
const account = await createKernelAccount(publicClient, {
plugin: ecdsaValidator,
index
})
const account = await createKernelAccount(publicClient, {
plugin: ecdsaValidator,
index
})
const kernelClient = createSmartAccountClient({
account,
chain,
transport: http(getZeroDevBundlerRPC(projectId, provider)),
sponsorUserOperation: usePaymaster ? (async ({
userOperation
}): Promise<UserOperation> => {
const kernelPaymaster = createKernelPaymasterClient({
chain: chain,
transport: http(getZeroDevPaymasterRPC(projectId, provider))
})
return kernelPaymaster.sponsorUserOperation({
userOperation
})
}) : undefined
})
const kernelClient = createSmartAccountClient({
account,
chain,
transport: http(getZeroDevBundlerRPC(projectId, provider)),
sponsorUserOperation: usePaymaster
? async ({ userOperation }): Promise<UserOperation> => {
const kernelPaymaster = createKernelPaymasterClient({
chain: chain,
transport: http(
getZeroDevPaymasterRPC(projectId, provider)
)
})
return kernelPaymaster.sponsorUserOperation({
userOperation
})
}
: undefined
})
return kernelClient as SmartAccountClient<
HttpTransport,
TChain,
KernelSmartAccount<HttpTransport, TChain>
>
return kernelClient as SmartAccountClient<
HttpTransport,
TChain,
KernelSmartAccount<HttpTransport, TChain>
>
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc