diff --git a/bun.lockb b/bun.lockb index d75dae49..263900fa 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/core/index.ts b/packages/core/index.ts index 31603729..da768124 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -20,7 +20,7 @@ export { type SponsorUserOperationParameters, type SponsorUserOperationReturnType } from "./actions/paymaster/sponsorUserOperation.js" -export { type SmartAccountClientConfig } from "./clients/kernelAccountClient.js" +export type { SmartAccountClientConfig } from "./clients/kernelAccountClient.js" export { zerodevPaymasterActions, type ZeroDevPaymasterClientActions, @@ -40,12 +40,12 @@ export { type CreateKernelMigrationAccountParameters } from "./accounts/kernel/createKernelMigrationAccount.js" export { createFallbackKernelAccountClient } from "./clients/fallbackKernelAccountClient.js" -export { - type KernelValidator, - type KernelValidatorHook, - type ZeroDevPaymasterRpcSchema, - type KernelPluginManager, - type Action +export type { + KernelValidator, + KernelValidatorHook, + ZeroDevPaymasterRpcSchema, + KernelPluginManager, + Action } from "./types/kernel.js" export { KernelAccountAbi } from "./accounts/kernel/abi/KernelAccountAbi.js" export { KernelFactoryAbi } from "./accounts/kernel/abi/KernelFactoryAbi.js" diff --git a/packages/test/v0.7/multiTenantSessionAccount.test.ts b/packages/test/v0.7/multiTenantSessionAccount.test.ts index 62167c3a..488aecd7 100644 --- a/packages/test/v0.7/multiTenantSessionAccount.test.ts +++ b/packages/test/v0.7/multiTenantSessionAccount.test.ts @@ -1,6 +1,5 @@ // @ts-expect-error import { beforeAll, describe, test } from "bun:test" -import { CAB_V0_2_1, createKernelCABClient } from "@zerodev/cab" import { type KernelAccountClient, type KernelSmartAccountImplementation, diff --git a/plugins/multi-tenant-session-account/actions/encodeCallDataWithCAB.ts b/plugins/multi-tenant-session-account/actions/encodeCallDataWithCAB.ts index 22e1859d..3bc79ece 100644 --- a/plugins/multi-tenant-session-account/actions/encodeCallDataWithCAB.ts +++ b/plugins/multi-tenant-session-account/actions/encodeCallDataWithCAB.ts @@ -1,380 +1,380 @@ -import { - type RepayTokenInfo, - type RepayTokens, - createInvoiceCall, - withdrawCall -} from "@zerodev/cab" -import { AccountNotFoundError, KernelV3ExecuteAbi } from "@zerodev/sdk" -import { - http, - type Address, - type Chain, - type Client, - type Hash, - type Hex, - type Transport, - concatHex, - createPublicClient, - decodeAbiParameters, - encodeAbiParameters, - encodeFunctionData, - isAddressEqual, - pad, - toHex -} from "viem" -import type { - GetSmartAccountParameter, - SmartAccount -} from "viem/account-abstraction" -import { parseAccount } from "viem/accounts" -import { getChainId } from "viem/actions" -import type { SessionAccountImplementation } from "../account/createSessionAccount.js" -import { - CAB_PAYMASTER_SERVER_URL, - DMVersionToAddressMap -} from "../constants.js" -import { - type SponsorTokenInfo, - cabAllowancesAbiType, - encodeCABEnforcerArgs, - encodePaymasterTokens -} from "../enforcers/cab-paymaster/index.js" -import { - type ENFORCER_VERSION, - getEnforcerAddress -} from "../enforcers/cab-paymaster/toCABPaymasterEnforcer.js" -import { toDelegationHash } from "../utils/index.js" +// import { +// type RepayTokenInfo, +// type RepayTokens, +// createInvoiceCall, +// withdrawCall +// } from "@zerodev/cab" +// import { AccountNotFoundError, KernelV3ExecuteAbi } from "@zerodev/sdk" +// import { +// http, +// type Address, +// type Chain, +// type Client, +// type Hash, +// type Hex, +// type Transport, +// concatHex, +// createPublicClient, +// decodeAbiParameters, +// encodeAbiParameters, +// encodeFunctionData, +// isAddressEqual, +// pad, +// toHex +// } from "viem" +// import type { +// GetSmartAccountParameter, +// SmartAccount +// } from "viem/account-abstraction" +// import { parseAccount } from "viem/accounts" +// import { getChainId } from "viem/actions" +// import type { SessionAccountImplementation } from "../account/createSessionAccount.js" +// import { +// CAB_PAYMASTER_SERVER_URL, +// DMVersionToAddressMap +// } from "../constants.js" +// import { +// type SponsorTokenInfo, +// cabAllowancesAbiType, +// encodeCABEnforcerArgs, +// encodePaymasterTokens +// } from "../enforcers/cab-paymaster/index.js" +// import { +// type ENFORCER_VERSION, +// getEnforcerAddress +// } from "../enforcers/cab-paymaster/toCABPaymasterEnforcer.js" +// import { toDelegationHash } from "../utils/index.js" -export type EncodeCallDataWithCABParameters< - account extends SmartAccount | undefined = SmartAccount | undefined, - accountOverride extends SmartAccount | undefined = SmartAccount | undefined -> = GetSmartAccountParameter & { - calls: { to: Address; value: bigint; data: Hex }[] - repayTokens: RepayTokens - enforcerVersion?: ENFORCER_VERSION -} +// export type EncodeCallDataWithCABParameters< +// account extends SmartAccount | undefined = SmartAccount | undefined, +// accountOverride extends SmartAccount | undefined = SmartAccount | undefined +// > = GetSmartAccountParameter & { +// calls: { to: Address; value: bigint; data: Hex }[] +// repayTokens: RepayTokens +// enforcerVersion?: ENFORCER_VERSION +// } -export async function encodeCallDataWithCAB< - account extends SmartAccount | undefined, - chain extends Chain | undefined, - accountOverride extends SmartAccount | undefined = undefined ->( - client: Client, - args: EncodeCallDataWithCABParameters -): Promise { - const cabEnforcerAddress = getEnforcerAddress( - args.enforcerVersion ?? "v0_2" - ) - const { account: account_ = client.account, calls, repayTokens } = args +// export async function encodeCallDataWithCAB< +// account extends SmartAccount | undefined, +// chain extends Chain | undefined, +// accountOverride extends SmartAccount | undefined = undefined +// >( +// client: Client, +// args: EncodeCallDataWithCABParameters +// ): Promise { +// const cabEnforcerAddress = getEnforcerAddress( +// args.enforcerVersion ?? "v0_2" +// ) +// const { account: account_ = client.account, calls, repayTokens } = args - if (!account_) { - throw new AccountNotFoundError() - } +// if (!account_) { +// throw new AccountNotFoundError() +// } - const account = parseAccount( - account_ - ) as SmartAccount - const chainId = client.chain ? client.chain.id : await getChainId(client) +// const account = parseAccount( +// account_ +// ) as SmartAccount +// const chainId = client.chain ? client.chain.id : await getChainId(client) - const cabClient = createPublicClient({ - transport: http(CAB_PAYMASTER_SERVER_URL) - }) +// const cabClient = createPublicClient({ +// transport: http(CAB_PAYMASTER_SERVER_URL) +// }) - let callData = encodeFunctionData({ - abi: KernelV3ExecuteAbi, - functionName: "execute", - args: [ - concatHex([ - "0x01", // 1 byte - "0x00", // 1 byte - "0x00000000", // 4 bytes - "0x00000000", // 4 bytes - pad("0x00000000", { size: 22 }) - ]), - encodeAbiParameters( - [ - { - name: "executionBatch", - type: "tuple[]", - components: [ - { - name: "target", - type: "address" - }, - { - name: "value", - type: "uint256" - }, - { - name: "callData", - type: "bytes" - } - ] - } - ], - [ - calls.map((arg) => { - return { - target: arg.to, - value: arg.value, - callData: arg.data - } - }) - ] - ) - ] - }) +// let callData = encodeFunctionData({ +// abi: KernelV3ExecuteAbi, +// functionName: "execute", +// args: [ +// concatHex([ +// "0x01", // 1 byte +// "0x00", // 1 byte +// "0x00000000", // 4 bytes +// "0x00000000", // 4 bytes +// pad("0x00000000", { size: 22 }) +// ]), +// encodeAbiParameters( +// [ +// { +// name: "executionBatch", +// type: "tuple[]", +// components: [ +// { +// name: "target", +// type: "address" +// }, +// { +// name: "value", +// type: "uint256" +// }, +// { +// name: "callData", +// type: "bytes" +// } +// ] +// } +// ], +// [ +// calls.map((arg) => { +// return { +// target: arg.to, +// value: arg.value, +// callData: arg.data +// } +// }) +// ] +// ) +// ] +// }) - const delegatorAccountAddress = - account.delegations[account.delegations.length - 1].delegator - const accountNonce = await account.getNonce() +// const delegatorAccountAddress = +// account.delegations[account.delegations.length - 1].delegator +// const accountNonce = await account.getNonce() - const cabPaymasterTokensResponse: { - paymaster: Address - sponsorTokensInfo: SponsorTokenInfo[] - repayTokensInfo: RepayTokenInfo[] - } = await cabClient.request({ - // @ts-expect-error - method: "pm_getCabPaymasterTokens", - params: [ - // @ts-expect-error - deepHexlify({ - sender: delegatorAccountAddress, - callData, - nonce: accountNonce, - maxFeePerGas: 0n, - callGasLimit: 0n, - verificationGasLimit: 0n, - preVerificationGas: 0n, - paymasterPostOpGasLimit: 0n, - paymasterVerificationGasLimit: 0n - }), - account.entryPoint.address, - // @ts-expect-error - chainId, - // @ts-expect-error - repayTokens, - // @ts-expect-error - cabEnforcerAddress - ] - }) - const cabEnforcerIndex = account.delegations[ - account.delegations.length - 1 - ].caveats.findIndex( - (c) => c.enforcer.toLowerCase() === cabEnforcerAddress.toLowerCase() - ) - const cabEnforcer = - account.delegations[account.delegations.length - 1].caveats[ - cabEnforcerIndex - ] +// const cabPaymasterTokensResponse: { +// paymaster: Address +// sponsorTokensInfo: SponsorTokenInfo[] +// repayTokensInfo: RepayTokenInfo[] +// } = await cabClient.request({ +// // @ts-expect-error +// method: "pm_getCabPaymasterTokens", +// params: [ +// // @ts-expect-error +// deepHexlify({ +// sender: delegatorAccountAddress, +// callData, +// nonce: accountNonce, +// maxFeePerGas: 0n, +// callGasLimit: 0n, +// verificationGasLimit: 0n, +// preVerificationGas: 0n, +// paymasterPostOpGasLimit: 0n, +// paymasterVerificationGasLimit: 0n +// }), +// account.entryPoint.address, +// // @ts-expect-error +// chainId, +// // @ts-expect-error +// repayTokens, +// // @ts-expect-error +// cabEnforcerAddress +// ] +// }) +// const cabEnforcerIndex = account.delegations[ +// account.delegations.length - 1 +// ].caveats.findIndex( +// (c) => c.enforcer.toLowerCase() === cabEnforcerAddress.toLowerCase() +// ) +// const cabEnforcer = +// account.delegations[account.delegations.length - 1].caveats[ +// cabEnforcerIndex +// ] - const calls_ = [ - ...withdrawCall({ - accountAddress: delegatorAccountAddress, - paymaster: cabPaymasterTokensResponse.paymaster, - sponsorTokensInfo: cabPaymasterTokensResponse.sponsorTokensInfo - }), - ...calls, - createInvoiceCall({ - chainId, - account: delegatorAccountAddress, - nonce: accountNonce, - paymaster: cabPaymasterTokensResponse.paymaster, - repayTokensInfo: cabPaymasterTokensResponse.repayTokensInfo - }) - ] - callData = encodeFunctionData({ - abi: KernelV3ExecuteAbi, - functionName: "execute", - args: [ - concatHex([ - "0x01", // 1 byte - "0x00", // 1 byte - "0x00000000", // 4 bytes - "0x00000000", // 4 bytes - pad("0x00000000", { size: 22 }) - ]), - encodeAbiParameters( - [ - { - name: "executionBatch", - type: "tuple[]", - components: [ - { - name: "target", - type: "address" - }, - { - name: "value", - type: "uint256" - }, - { - name: "callData", - type: "bytes" - } - ] - } - ], - [ - calls_.map((arg) => { - return { - target: arg.to, - value: arg.value, - callData: arg.data - } - }) - ] - ) - ] - }) +// const calls_ = [ +// ...withdrawCall({ +// accountAddress: delegatorAccountAddress, +// paymaster: cabPaymasterTokensResponse.paymaster, +// sponsorTokensInfo: cabPaymasterTokensResponse.sponsorTokensInfo +// }), +// ...calls, +// createInvoiceCall({ +// chainId, +// account: delegatorAccountAddress, +// nonce: accountNonce, +// paymaster: cabPaymasterTokensResponse.paymaster, +// repayTokensInfo: cabPaymasterTokensResponse.repayTokensInfo +// }) +// ] +// callData = encodeFunctionData({ +// abi: KernelV3ExecuteAbi, +// functionName: "execute", +// args: [ +// concatHex([ +// "0x01", // 1 byte +// "0x00", // 1 byte +// "0x00000000", // 4 bytes +// "0x00000000", // 4 bytes +// pad("0x00000000", { size: 22 }) +// ]), +// encodeAbiParameters( +// [ +// { +// name: "executionBatch", +// type: "tuple[]", +// components: [ +// { +// name: "target", +// type: "address" +// }, +// { +// name: "value", +// type: "uint256" +// }, +// { +// name: "callData", +// type: "bytes" +// } +// ] +// } +// ], +// [ +// calls_.map((arg) => { +// return { +// target: arg.to, +// value: arg.value, +// callData: arg.data +// } +// }) +// ] +// ) +// ] +// }) - const { repayTokenDataEncoded, sponsorTokenDataEncoded } = - encodePaymasterTokens( - cabPaymasterTokensResponse.sponsorTokensInfo, - cabPaymasterTokensResponse.repayTokensInfo - ) - const { paymasterSignature }: { paymasterSignature: Hex } = - await cabClient.request({ - // @ts-expect-error - method: "pm_getCabEnforcerPaymasterData", - params: [ - // @ts-expect-error - deepHexlify({ - sender: delegatorAccountAddress, - callData, - nonce: accountNonce, - maxFeePerGas: 0n, - callGasLimit: 0n, - verificationGasLimit: 0n, - preVerificationGas: 0n, - paymasterPostOpGasLimit: 0n, - paymasterVerificationGasLimit: 0n - }), - account.entryPoint.address, - // @ts-expect-error - chainId, - // @ts-expect-error - DMVersionToAddressMap["1.0.0"].delegationManagerAddress, - // @ts-expect-error - toDelegationHash( - account.delegations[account.delegations.length - 1] - ), - // @ts-expect-error - concatHex([ - "0x01", // 1 byte - "0x00", // 1 byte - "0x00000000", // 4 bytes - "0x00000000", // 4 bytes - pad("0x00000000", { size: 22 }) - ]), - // @ts-expect-error - encodeAbiParameters( - [ - { - name: "executionBatch", - type: "tuple[]", - components: [ - { - name: "target", - type: "address" - }, - { - name: "value", - type: "uint256" - }, - { - name: "callData", - type: "bytes" - } - ] - } - ], - [ - calls_.map((arg) => { - return { - target: arg.to, - value: arg.value, - callData: arg.data - } - }) - ] - ), - // @ts-expect-error - sponsorTokenDataEncoded, - // @ts-expect-error - repayTokenDataEncoded, - // @ts-expect-error - cabEnforcerAddress - ] - }) - if (cabEnforcer) { - const [allowances] = decodeAbiParameters( - [cabAllowancesAbiType], - cabEnforcer.terms - ) - const indexes = cabPaymasterTokensResponse.repayTokensInfo.map( - (rpyTkn, rpyIdx) => { - let sponsorIndex = 0 - let repayIndex = 0 - for (const [allowanceIdx, allowance] of allowances.entries()) { - repayIndex = allowance.vaults.findIndex( - (vault) => - vault.chainId === BigInt(rpyTkn.chainId) && - isAddressEqual(vault.vault, rpyTkn.vault) - ) - if ( - repayIndex !== -1 && - isAddressEqual( - cabPaymasterTokensResponse.sponsorTokensInfo[rpyIdx] - .address, - allowance.token - ) - ) { - sponsorIndex = allowanceIdx - break - } - } - if (repayIndex === -1) { - throw new Error("Repay token not found in allowances") - } - return BigInt( - concatHex([ - toHex(sponsorIndex, { size: 16 }), - toHex(repayIndex, { size: 16 }) - ]) - ) - } - ) - const cabEnforcerArgs = encodeCABEnforcerArgs({ - indexes, - nonce: accountNonce, - spender: delegatorAccountAddress, - paymasterSignature, - repayTokenData: cabPaymasterTokensResponse.repayTokensInfo, - sponsorTokenData: cabPaymasterTokensResponse.sponsorTokensInfo - }) - account.delegations[account.delegations.length - 1].caveats[ - cabEnforcerIndex - ] = { - ...account.delegations[account.delegations.length - 1].caveats[ - cabEnforcerIndex - ], - args: cabEnforcerArgs - } - } - return await account.encodeCalls([ - ...withdrawCall({ - accountAddress: delegatorAccountAddress, - paymaster: cabPaymasterTokensResponse.paymaster, - sponsorTokensInfo: cabPaymasterTokensResponse.sponsorTokensInfo - }), - ...calls, - createInvoiceCall({ - chainId, - account: delegatorAccountAddress, - nonce: accountNonce, - paymaster: cabPaymasterTokensResponse.paymaster, - repayTokensInfo: cabPaymasterTokensResponse.repayTokensInfo - }) - ]) -} +// const { repayTokenDataEncoded, sponsorTokenDataEncoded } = +// encodePaymasterTokens( +// cabPaymasterTokensResponse.sponsorTokensInfo, +// cabPaymasterTokensResponse.repayTokensInfo +// ) +// const { paymasterSignature }: { paymasterSignature: Hex } = +// await cabClient.request({ +// // @ts-expect-error +// method: "pm_getCabEnforcerPaymasterData", +// params: [ +// // @ts-expect-error +// deepHexlify({ +// sender: delegatorAccountAddress, +// callData, +// nonce: accountNonce, +// maxFeePerGas: 0n, +// callGasLimit: 0n, +// verificationGasLimit: 0n, +// preVerificationGas: 0n, +// paymasterPostOpGasLimit: 0n, +// paymasterVerificationGasLimit: 0n +// }), +// account.entryPoint.address, +// // @ts-expect-error +// chainId, +// // @ts-expect-error +// DMVersionToAddressMap["1.0.0"].delegationManagerAddress, +// // @ts-expect-error +// toDelegationHash( +// account.delegations[account.delegations.length - 1] +// ), +// // @ts-expect-error +// concatHex([ +// "0x01", // 1 byte +// "0x00", // 1 byte +// "0x00000000", // 4 bytes +// "0x00000000", // 4 bytes +// pad("0x00000000", { size: 22 }) +// ]), +// // @ts-expect-error +// encodeAbiParameters( +// [ +// { +// name: "executionBatch", +// type: "tuple[]", +// components: [ +// { +// name: "target", +// type: "address" +// }, +// { +// name: "value", +// type: "uint256" +// }, +// { +// name: "callData", +// type: "bytes" +// } +// ] +// } +// ], +// [ +// calls_.map((arg) => { +// return { +// target: arg.to, +// value: arg.value, +// callData: arg.data +// } +// }) +// ] +// ), +// // @ts-expect-error +// sponsorTokenDataEncoded, +// // @ts-expect-error +// repayTokenDataEncoded, +// // @ts-expect-error +// cabEnforcerAddress +// ] +// }) +// if (cabEnforcer) { +// const [allowances] = decodeAbiParameters( +// [cabAllowancesAbiType], +// cabEnforcer.terms +// ) +// const indexes = cabPaymasterTokensResponse.repayTokensInfo.map( +// (rpyTkn, rpyIdx) => { +// let sponsorIndex = 0 +// let repayIndex = 0 +// for (const [allowanceIdx, allowance] of allowances.entries()) { +// repayIndex = allowance.vaults.findIndex( +// (vault) => +// vault.chainId === BigInt(rpyTkn.chainId) && +// isAddressEqual(vault.vault, rpyTkn.vault) +// ) +// if ( +// repayIndex !== -1 && +// isAddressEqual( +// cabPaymasterTokensResponse.sponsorTokensInfo[rpyIdx] +// .address, +// allowance.token +// ) +// ) { +// sponsorIndex = allowanceIdx +// break +// } +// } +// if (repayIndex === -1) { +// throw new Error("Repay token not found in allowances") +// } +// return BigInt( +// concatHex([ +// toHex(sponsorIndex, { size: 16 }), +// toHex(repayIndex, { size: 16 }) +// ]) +// ) +// } +// ) +// const cabEnforcerArgs = encodeCABEnforcerArgs({ +// indexes, +// nonce: accountNonce, +// spender: delegatorAccountAddress, +// paymasterSignature, +// repayTokenData: cabPaymasterTokensResponse.repayTokensInfo, +// sponsorTokenData: cabPaymasterTokensResponse.sponsorTokensInfo +// }) +// account.delegations[account.delegations.length - 1].caveats[ +// cabEnforcerIndex +// ] = { +// ...account.delegations[account.delegations.length - 1].caveats[ +// cabEnforcerIndex +// ], +// args: cabEnforcerArgs +// } +// } +// return await account.encodeCalls([ +// ...withdrawCall({ +// accountAddress: delegatorAccountAddress, +// paymaster: cabPaymasterTokensResponse.paymaster, +// sponsorTokensInfo: cabPaymasterTokensResponse.sponsorTokensInfo +// }), +// ...calls, +// createInvoiceCall({ +// chainId, +// account: delegatorAccountAddress, +// nonce: accountNonce, +// paymaster: cabPaymasterTokensResponse.paymaster, +// repayTokensInfo: cabPaymasterTokensResponse.repayTokensInfo +// }) +// ]) +// } diff --git a/plugins/multi-tenant-session-account/actions/index.ts b/plugins/multi-tenant-session-account/actions/index.ts index 787bc020..939ab0a1 100644 --- a/plugins/multi-tenant-session-account/actions/index.ts +++ b/plugins/multi-tenant-session-account/actions/index.ts @@ -2,10 +2,10 @@ export { type SignDelegationParameters, signDelegation } from "./signDelegation.js" -export { - type EncodeCallDataWithCABParameters, - encodeCallDataWithCAB -} from "./encodeCallDataWithCAB.js" +// export { +// type EncodeCallDataWithCABParameters, +// encodeCallDataWithCAB +// } from "./encodeCallDataWithCAB.js" export { type SendDelegateUserOperationParameters, delegate diff --git a/plugins/multi-tenant-session-account/clients/decorators/dmActionsEip7710.ts b/plugins/multi-tenant-session-account/clients/decorators/dmActionsEip7710.ts index d8df75df..339dfc8a 100644 --- a/plugins/multi-tenant-session-account/clients/decorators/dmActionsEip7710.ts +++ b/plugins/multi-tenant-session-account/clients/decorators/dmActionsEip7710.ts @@ -1,13 +1,13 @@ import type { Chain, Client, Hash, Transport } from "viem" import type { SmartAccount } from "viem/account-abstraction" import { - type EncodeCallDataWithCABParameters, + // type EncodeCallDataWithCABParameters, type SendDelegateUserOperationParameters, type SendInstallDMAndDelegateUserOperationParameters, type SendInstallDMAsExecutorUserOperationParameters, type SignDelegationParameters, delegate, - encodeCallDataWithCAB, + // encodeCallDataWithCAB, installDMAndDelegate, installDMAsExecutor, signDelegation @@ -27,9 +27,9 @@ export type DMActionsEip7710< typeof signDelegation >[1] ) => Promise - encodeCallDataWithCAB: ( - args: Parameters>[1] - ) => Promise + // encodeCallDataWithCAB: ( + // args: Parameters>[1] + // ) => Promise installDMAndDelegate: ( args: SendInstallDMAndDelegateUserOperationParameters ) => Promise @@ -40,7 +40,7 @@ export type DMActionsEip7710< } function dmActionsEip7710({ - enforcerVersion + enforcerVersion: _enforcerVersion }: { enforcerVersion: ENFORCER_VERSION }) { @@ -62,14 +62,14 @@ function dmActionsEip7710({ ...args } as SignDelegationParameters ), - encodeCallDataWithCAB: (args) => - encodeCallDataWithCAB(client, { - ...args, - enforcerVersion: enforcerVersion - } as EncodeCallDataWithCABParameters< - TSmartAccount, - accountOverride - >), + // encodeCallDataWithCAB: (args) => + // encodeCallDataWithCAB(client, { + // ...args, + // enforcerVersion: enforcerVersion + // } as EncodeCallDataWithCABParameters< + // TSmartAccount, + // accountOverride + // >), installDMAndDelegate: (args) => installDMAndDelegate(client, args), installDMAsExecutor: (args) => installDMAsExecutor(client, args), delegate: (args) => delegate(client, args) diff --git a/plugins/multi-tenant-session-account/enforcers/cab-paymaster/toCABPaymasterEnforcer.ts b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/toCABPaymasterEnforcer.ts index 44ed0f92..9e287d05 100644 --- a/plugins/multi-tenant-session-account/enforcers/cab-paymaster/toCABPaymasterEnforcer.ts +++ b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/toCABPaymasterEnforcer.ts @@ -1,4 +1,3 @@ -import type { RepayTokenInfo } from "@zerodev/cab" import { http, type Address, @@ -8,6 +7,7 @@ import { } from "viem" import { CAB_PAYMASTER_SERVER_URL } from "../../constants.js" import type { Caveat } from "../../types.js" +import type { RepayTokenInfo } from "./type.js" import { type SponsorTokenInfo, cabAllowancesAbiType } from "./utils.js" export type CABPaymasterEnforcerArgs = { diff --git a/plugins/multi-tenant-session-account/enforcers/cab-paymaster/type.ts b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/type.ts new file mode 100644 index 00000000..b535cc00 --- /dev/null +++ b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/type.ts @@ -0,0 +1,7 @@ +import type { Address } from "viem" + +export type RepayTokenInfo = { + amount: bigint + vault: Address + chainId: bigint +} diff --git a/plugins/multi-tenant-session-account/enforcers/cab-paymaster/utils.ts b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/utils.ts index 046b6abe..2e9f7abe 100644 --- a/plugins/multi-tenant-session-account/enforcers/cab-paymaster/utils.ts +++ b/plugins/multi-tenant-session-account/enforcers/cab-paymaster/utils.ts @@ -1,4 +1,3 @@ -import type { RepayTokenInfo } from "@zerodev/cab" import { type Address, type Hex, @@ -11,6 +10,7 @@ import { toHex } from "viem" import type { CABPaymasterEnforcerArgs } from "./toCABPaymasterEnforcer.js" +import type { RepayTokenInfo } from "./type.js" export type SponsorTokenInfo = { amount: bigint diff --git a/plugins/multi-tenant-session-account/package.json b/plugins/multi-tenant-session-account/package.json index e9b01d55..5d3f5446 100644 --- a/plugins/multi-tenant-session-account/package.json +++ b/plugins/multi-tenant-session-account/package.json @@ -63,9 +63,8 @@ "lint:fix": "bun run lint --apply" }, "peerDependencies": { - "viem": "^2.28.0", "@zerodev/sdk": "^5.4.0", - "@zerodev/cab": "^0.0.25" + "viem": "^2.28.0" }, "dependencies": { "semver": "^7.6.0" diff --git a/plugins/social/toSocialValidatorPlugin.ts b/plugins/social/toSocialValidatorPlugin.ts index 9a769a67..0ca094c0 100644 --- a/plugins/social/toSocialValidatorPlugin.ts +++ b/plugins/social/toSocialValidatorPlugin.ts @@ -64,7 +64,7 @@ export async function getSocialValidator< throw new Error("initiateLogin() must be called first.") } - const magicProvider = await magic.wallet.getProvider() + const magicProvider = magic.rpcProvider const ecdsaValidator = await signerToEcdsaValidator(client, { signer: magicProvider,