@zerodev/sdk
Advanced tools
Comparing version 5.3.8 to 5.3.9
@@ -14,2 +14,3 @@ "use strict"; | ||
const KernelAccountAbi_js_2 = require("./abi/kernel_v_3_0_0/KernelAccountAbi.js"); | ||
const KernelFactoryAbi_js_1 = require("./abi/kernel_v_3_0_0/KernelFactoryAbi.js"); | ||
const KernelFactoryStakerAbi_js_1 = require("./abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js"); | ||
@@ -103,3 +104,3 @@ const KernelAccountAbi_js_3 = require("./abi/kernel_v_3_1/KernelAccountAbi.js"); | ||
}; | ||
const getAccountInitCode = async ({ index, factoryAddress, accountImplementationAddress, metaFactoryAddress, entryPoint: entryPointAddress, kernelPluginManager, initHook, kernelVersion, initConfig }) => { | ||
const getAccountInitCode = async ({ index, factoryAddress, accountImplementationAddress, metaFactoryAddress, entryPoint: entryPointAddress, kernelPluginManager, initHook, kernelVersion, initConfig, useMetaFactory }) => { | ||
const initialisationData = await getKernelInitData({ | ||
@@ -123,2 +124,12 @@ entryPoint: entryPointAddress, | ||
} | ||
if (!useMetaFactory) { | ||
return (0, viem_1.concatHex)([ | ||
factoryAddress, | ||
(0, viem_1.encodeFunctionData)({ | ||
abi: KernelFactoryAbi_js_1.KernelV3FactoryAbi, | ||
functionName: "createAccount", | ||
args: [initialisationData, (0, viem_1.toHex)(index, { size: 32 })] | ||
}) | ||
]); | ||
} | ||
return (0, viem_1.concatHex)([ | ||
@@ -165,3 +176,3 @@ metaFactoryAddress ?? viem_1.zeroAddress, | ||
}; | ||
async function createKernelAccount(client, { plugins, entryPoint: entryPointAddress, index = 0n, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig }) { | ||
async function createKernelAccount(client, { plugins, entryPoint: entryPointAddress, index = 0n, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig, useMetaFactory = true }) { | ||
const entryPointVersion = (0, permissionless_1.getEntryPointVersion)(entryPointAddress); | ||
@@ -201,3 +212,4 @@ const { accountImplementationAddress, factoryAddress, metaFactoryAddress } = getDefaultAddresses(entryPointAddress, kernelVersion, { | ||
kernelVersion, | ||
initConfig | ||
initConfig, | ||
useMetaFactory | ||
}); | ||
@@ -255,5 +267,9 @@ }; | ||
const entryPointVersion = (0, permissionless_1.getEntryPointVersion)(entryPointAddress); | ||
return entryPointVersion === "v0.6" | ||
? factoryAddress | ||
: metaFactoryAddress; | ||
if (entryPointVersion === "v0.6") { | ||
return factoryAddress; | ||
} | ||
if (!useMetaFactory) { | ||
return factoryAddress; | ||
} | ||
return metaFactoryAddress; | ||
}, | ||
@@ -260,0 +276,0 @@ async getFactoryData() { |
@@ -24,3 +24,4 @@ "use strict"; | ||
if (!shouldIncludePimlicoProvider || | ||
(0, utils_js_1.isProviderSet)(_bundlerTransport.value?.url, "ALCHEMY")) | ||
(0, utils_js_1.isProviderSet)(_bundlerTransport.value?.url, "ALCHEMY") || | ||
(0, utils_js_1.isProviderSet)(_bundlerTransport.value?.url, "ZERODEV")) | ||
return _bundlerTransport; | ||
@@ -27,0 +28,0 @@ _bundlerTransport = (0, viem_1.http)((0, utils_js_1.setPimlicoAsProvider)(_bundlerTransport.value?.url))({ ...opts, retryCount: 0 }); |
@@ -20,3 +20,4 @@ "use strict"; | ||
if (!shouldIncludePimlicoProvider || | ||
(0, utils_js_1.isProviderSet)(_transport.value?.url, "ALCHEMY")) | ||
(0, utils_js_1.isProviderSet)(_transport.value?.url, "ALCHEMY") || | ||
(0, utils_js_1.isProviderSet)(_transport.value?.url, "ZERODEV")) | ||
return _transport; | ||
@@ -23,0 +24,0 @@ _transport = (0, viem_1.http)((0, utils_js_1.setPimlicoAsProvider)(_transport.value?.url))({ |
@@ -11,2 +11,3 @@ import { getAccountNonce, getEntryPointVersion, getSenderAddress, isSmartAccountDeployed } from "permissionless"; | ||
import { KernelV3InitAbi } from "./abi/kernel_v_3_0_0/KernelAccountAbi.js"; | ||
import { KernelV3FactoryAbi } from "./abi/kernel_v_3_0_0/KernelFactoryAbi.js"; | ||
import { KernelFactoryStakerAbi } from "./abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js"; | ||
@@ -113,3 +114,3 @@ import { KernelV3_1AccountAbi } from "./abi/kernel_v_3_1/KernelAccountAbi.js"; | ||
*/ | ||
const getAccountInitCode = async ({ index, factoryAddress, accountImplementationAddress, metaFactoryAddress, entryPoint: entryPointAddress, kernelPluginManager, initHook, kernelVersion, initConfig }) => { | ||
const getAccountInitCode = async ({ index, factoryAddress, accountImplementationAddress, metaFactoryAddress, entryPoint: entryPointAddress, kernelPluginManager, initHook, kernelVersion, initConfig, useMetaFactory }) => { | ||
// Build the account initialization data | ||
@@ -135,2 +136,12 @@ const initialisationData = await getKernelInitData({ | ||
} | ||
if (!useMetaFactory) { | ||
return concatHex([ | ||
factoryAddress, | ||
encodeFunctionData({ | ||
abi: KernelV3FactoryAbi, | ||
functionName: "createAccount", | ||
args: [initialisationData, toHex(index, { size: 32 })] | ||
}) | ||
]); | ||
} | ||
return concatHex([ | ||
@@ -196,3 +207,3 @@ metaFactoryAddress ?? zeroAddress, | ||
*/ | ||
export async function createKernelAccount(client, { plugins, entryPoint: entryPointAddress, index = 0n, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig }) { | ||
export async function createKernelAccount(client, { plugins, entryPoint: entryPointAddress, index = 0n, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig, useMetaFactory = true }) { | ||
const entryPointVersion = getEntryPointVersion(entryPointAddress); | ||
@@ -235,3 +246,4 @@ const { accountImplementationAddress, factoryAddress, metaFactoryAddress } = getDefaultAddresses(entryPointAddress, kernelVersion, { | ||
kernelVersion, | ||
initConfig | ||
initConfig, | ||
useMetaFactory | ||
}); | ||
@@ -291,5 +303,9 @@ }; | ||
const entryPointVersion = getEntryPointVersion(entryPointAddress); | ||
return entryPointVersion === "v0.6" | ||
? factoryAddress | ||
: metaFactoryAddress; | ||
if (entryPointVersion === "v0.6") { | ||
return factoryAddress; | ||
} | ||
if (!useMetaFactory) { | ||
return factoryAddress; | ||
} | ||
return metaFactoryAddress; | ||
}, | ||
@@ -296,0 +312,0 @@ async getFactoryData() { |
@@ -21,3 +21,4 @@ import { getEntryPointVersion } from "permissionless"; | ||
if (!shouldIncludePimlicoProvider || | ||
isProviderSet(_bundlerTransport.value?.url, "ALCHEMY")) | ||
isProviderSet(_bundlerTransport.value?.url, "ALCHEMY") || | ||
isProviderSet(_bundlerTransport.value?.url, "ZERODEV")) | ||
return _bundlerTransport; | ||
@@ -24,0 +25,0 @@ _bundlerTransport = http(setPimlicoAsProvider(_bundlerTransport.value?.url))({ ...opts, retryCount: 0 }); |
@@ -34,3 +34,4 @@ import { getEntryPointVersion } from "permissionless"; | ||
if (!shouldIncludePimlicoProvider || | ||
isProviderSet(_transport.value?.url, "ALCHEMY")) | ||
isProviderSet(_transport.value?.url, "ALCHEMY") || | ||
isProviderSet(_transport.value?.url, "ZERODEV")) | ||
return _transport; | ||
@@ -37,0 +38,0 @@ _transport = http(setPimlicoAsProvider(_transport.value?.url))({ |
@@ -23,2 +23,3 @@ import { type SmartAccount } from "permissionless/accounts"; | ||
initConfig?: KernelVerion extends "0.3.1" ? Hex[] : never; | ||
useMetaFactory?: boolean; | ||
}; | ||
@@ -46,3 +47,3 @@ /** | ||
*/ | ||
export declare function createKernelAccount<entryPoint extends EntryPoint, KernelVersion extends GetKernelVersion<entryPoint>, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined>(client: Client<TTransport, TChain, undefined>, { plugins, entryPoint: entryPointAddress, index, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig }: CreateKernelAccountParameters<entryPoint, KernelVersion>): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>>; | ||
export declare function createKernelAccount<entryPoint extends EntryPoint, KernelVersion extends GetKernelVersion<entryPoint>, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined>(client: Client<TTransport, TChain, undefined>, { plugins, entryPoint: entryPointAddress, index, factoryAddress: _factoryAddress, accountImplementationAddress: _accountImplementationAddress, metaFactoryAddress: _metaFactoryAddress, deployedAccountAddress, kernelVersion, initConfig, useMetaFactory }: CreateKernelAccountParameters<entryPoint, KernelVersion>): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>>; | ||
//# sourceMappingURL=createKernelAccount.d.ts.map |
@@ -49,2 +49,3 @@ import { | ||
import { KernelV3InitAbi } from "./abi/kernel_v_3_0_0/KernelAccountAbi.js" | ||
import { KernelV3FactoryAbi } from "./abi/kernel_v_3_0_0/KernelFactoryAbi.js" | ||
import { KernelFactoryStakerAbi } from "./abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js" | ||
@@ -90,2 +91,3 @@ import { KernelV3_1AccountAbi } from "./abi/kernel_v_3_1/KernelAccountAbi.js" | ||
initConfig?: KernelVerion extends "0.3.1" ? Hex[] : never | ||
useMetaFactory?: boolean | ||
} | ||
@@ -219,3 +221,4 @@ | ||
kernelVersion, | ||
initConfig | ||
initConfig, | ||
useMetaFactory | ||
}: { | ||
@@ -231,2 +234,3 @@ index: bigint | ||
initConfig?: GetKernelVersion<entryPoint> extends "0.3.1" ? Hex[] : never | ||
useMetaFactory: boolean | ||
}): Promise<Hex> => { | ||
@@ -255,2 +259,13 @@ // Build the account initialization data | ||
if (!useMetaFactory) { | ||
return concatHex([ | ||
factoryAddress, | ||
encodeFunctionData({ | ||
abi: KernelV3FactoryAbi, | ||
functionName: "createAccount", | ||
args: [initialisationData, toHex(index, { size: 32 })] | ||
}) as Hex | ||
]) | ||
} | ||
return concatHex([ | ||
@@ -367,3 +382,4 @@ metaFactoryAddress ?? zeroAddress, | ||
kernelVersion, | ||
initConfig | ||
initConfig, | ||
useMetaFactory = true | ||
}: CreateKernelAccountParameters<entryPoint, KernelVersion> | ||
@@ -414,3 +430,4 @@ ): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>> { | ||
kernelVersion, | ||
initConfig | ||
initConfig, | ||
useMetaFactory | ||
}) | ||
@@ -487,5 +504,9 @@ } | ||
getEntryPointVersion(entryPointAddress) | ||
return entryPointVersion === "v0.6" | ||
? factoryAddress | ||
: metaFactoryAddress | ||
if (entryPointVersion === "v0.6") { | ||
return factoryAddress | ||
} | ||
if (!useMetaFactory) { | ||
return factoryAddress | ||
} | ||
return metaFactoryAddress | ||
}, | ||
@@ -492,0 +513,0 @@ |
@@ -95,3 +95,4 @@ import { getEntryPointVersion } from "permissionless" | ||
!shouldIncludePimlicoProvider || | ||
isProviderSet(_bundlerTransport.value?.url, "ALCHEMY") | ||
isProviderSet(_bundlerTransport.value?.url, "ALCHEMY") || | ||
isProviderSet(_bundlerTransport.value?.url, "ZERODEV") | ||
) | ||
@@ -98,0 +99,0 @@ return _bundlerTransport |
@@ -70,3 +70,4 @@ import { getEntryPointVersion } from "permissionless" | ||
!shouldIncludePimlicoProvider || | ||
isProviderSet(_transport.value?.url, "ALCHEMY") | ||
isProviderSet(_transport.value?.url, "ALCHEMY") || | ||
isProviderSet(_transport.value?.url, "ZERODEV") | ||
) | ||
@@ -73,0 +74,0 @@ return _transport |
{ | ||
"name": "@zerodev/sdk", | ||
"version": "5.3.8", | ||
"version": "5.3.9", | ||
"author": "ZeroDev", | ||
@@ -5,0 +5,0 @@ "main": "./_cjs/index.js", |
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
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
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
1303460
26213