Skip to content

Commit

Permalink
feat: pass parameter correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Apr 23, 2024
1 parent 00df45e commit 8effd6d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nevermined-io/sdk",
"version": "3.0.0-rc14",
"version": "3.0.0-rc15",
"description": "Javascript SDK for connecting with Nevermined Data Platform ",
"main": "./dist/node/sdk.js",
"typings": "./dist/node/sdk.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/keeper/contracts/ContractBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ export abstract class ContractBase extends Instantiable {
account: from,
...(txparams.value && { value: txparams.value }),
})
const kernelClient = await getKernelClient(from, this.config.chainId!, ENTRYPOINT_ADDRESS_V07)
const kernelClient = await getKernelClient(
from,
this.config.chainId!,
ENTRYPOINT_ADDRESS_V07,
this.config.zeroDevProjectId!,
)
// @ts-ignore
const txHash = await kernelClient.writeContract(request)
if (progress) {
Expand Down
1 change: 1 addition & 0 deletions src/nevermined/NvmApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export class NvmApp {
smartAccountSigner,
config.chainId!,
ENTRYPOINT_ADDRESS_V07,
config.zeroDevProjectId,
)

// const kernelClient = await createEcdsaKernelAccountClient({
Expand Down
13 changes: 9 additions & 4 deletions src/nevermined/utils/BlockchainViemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,14 @@ export const formatEther = (value: bigint): string => {

/////// ZERO DEV

export async function getKernelClient(signer: any, chainId: number, entryPointAddress: EntryPoint) {
export async function getKernelClient(
signer: any,
chainId: number,
entryPointAddress: EntryPoint,
zeroDevProjectId: string,
) {
const publicClient = createPublicClient({
transport: http(`https://rpc.zerodev.app/api/v2/bundler/${process.env.PROJECT_ID}`),
transport: http(`https://rpc.zerodev.app/api/v2/bundler/${zeroDevProjectId}`),
})

const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
Expand All @@ -391,12 +396,12 @@ export async function getKernelClient(signer: any, chainId: number, entryPointAd
account,
entryPoint: entryPointAddress,
chain: getChain(chainId),
bundlerTransport: http(`https://rpc.zerodev.app/api/v2/bundler/${process.env.PROJECT_ID}`),
bundlerTransport: http(`https://rpc.zerodev.app/api/v2/bundler/${zeroDevProjectId}`),
middleware: {
sponsorUserOperation: async ({ userOperation }) => {
const paymasterClient = createZeroDevPaymasterClient({
chain: getChain(chainId),
transport: http(`https://rpc.zerodev.app/api/v2/paymaster/${process.env.PROJECT_ID}`),
transport: http(`https://rpc.zerodev.app/api/v2/paymaster/${zeroDevProjectId}`),
entryPoint: entryPointAddress,
})
const _userOperation =
Expand Down

0 comments on commit 8effd6d

Please sign in to comment.