@zerodev/sdk 5.4.37 → 5.4.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/_cjs/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.js +826 -0
  2. package/_cjs/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.js.map +1 -0
  3. package/_cjs/accounts/kernel/createKernelAccount.js +56 -18
  4. package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
  5. package/_cjs/accounts/utils/signerTo7702Validator.js +1 -1
  6. package/_cjs/accounts/utils/signerTo7702Validator.js.map +1 -1
  7. package/_cjs/actions/account-client/changeSudoValidator.js +5 -1
  8. package/_cjs/actions/account-client/changeSudoValidator.js.map +1 -1
  9. package/_cjs/actions/account-client/uninstallPlugin.js +5 -1
  10. package/_cjs/actions/account-client/uninstallPlugin.js.map +1 -1
  11. package/_cjs/constants.js +2 -1
  12. package/_cjs/constants.js.map +1 -1
  13. package/_cjs/index.js +3 -1
  14. package/_cjs/index.js.map +1 -1
  15. package/_esm/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.js +823 -0
  16. package/_esm/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.js.map +1 -0
  17. package/_esm/accounts/kernel/createKernelAccount.js +56 -18
  18. package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
  19. package/_esm/accounts/utils/signerTo7702Validator.js +1 -1
  20. package/_esm/accounts/utils/signerTo7702Validator.js.map +1 -1
  21. package/_esm/actions/account-client/changeSudoValidator.js +5 -1
  22. package/_esm/actions/account-client/changeSudoValidator.js.map +1 -1
  23. package/_esm/actions/account-client/uninstallPlugin.js +5 -1
  24. package/_esm/actions/account-client/uninstallPlugin.js.map +1 -1
  25. package/_esm/constants.js +2 -1
  26. package/_esm/constants.js.map +1 -1
  27. package/_esm/index.js +1 -0
  28. package/_esm/index.js.map +1 -1
  29. package/_types/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.d.ts +1027 -0
  30. package/_types/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.d.ts.map +1 -0
  31. package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
  32. package/_types/actions/account-client/changeSudoValidator.d.ts.map +1 -1
  33. package/_types/actions/account-client/uninstallPlugin.d.ts.map +1 -1
  34. package/_types/constants.d.ts +1 -0
  35. package/_types/constants.d.ts.map +1 -1
  36. package/_types/index.d.ts +1 -0
  37. package/_types/index.d.ts.map +1 -1
  38. package/_types/types/kernel.d.ts +1 -1
  39. package/_types/types/kernel.d.ts.map +1 -1
  40. package/accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.ts +822 -0
  41. package/accounts/kernel/createKernelAccount.ts +60 -22
  42. package/accounts/utils/signerTo7702Validator.ts +1 -1
  43. package/actions/account-client/changeSudoValidator.ts +5 -3
  44. package/actions/account-client/uninstallPlugin.ts +5 -3
  45. package/constants.ts +2 -1
  46. package/index.ts +1 -0
  47. package/package.json +1 -1
  48. package/types/kernel.ts +1 -1
@@ -731,19 +731,39 @@ export async function createKernelAccount<
731
731
  chainId: metadataChainId,
732
732
  version
733
733
  } = await getMemoizedAccountMetadata()
734
- const wrappedMessageHash = await eip712WrapHash(
735
- messageHash,
736
- {
737
- name,
738
- chainId: Number(metadataChainId),
739
- version,
740
- verifyingContract: accountAddress
741
- },
742
- useReplayableSignature
743
- )
744
- let signature = await kernelPluginManager.signMessage({
745
- message: { raw: wrappedMessageHash }
746
- })
734
+
735
+ let signature: Hex
736
+ if (isEip7702) {
737
+ signature = await kernelPluginManager.signTypedData({
738
+ message: { hash: messageHash },
739
+ primaryType: "Kernel",
740
+ types: {
741
+ Kernel: [{ name: "hash", type: "bytes32" }]
742
+ },
743
+ domain: {
744
+ name,
745
+ version,
746
+ chainId: useReplayableSignature
747
+ ? 0
748
+ : Number(metadataChainId),
749
+ verifyingContract: accountAddress
750
+ }
751
+ })
752
+ } else {
753
+ const wrappedMessageHash = await eip712WrapHash(
754
+ messageHash,
755
+ {
756
+ name,
757
+ chainId: Number(metadataChainId),
758
+ version,
759
+ verifyingContract: accountAddress
760
+ },
761
+ useReplayableSignature
762
+ )
763
+ signature = await kernelPluginManager.signMessage({
764
+ message: { raw: wrappedMessageHash }
765
+ })
766
+ }
747
767
 
748
768
  if (
749
769
  !hasKernelFeature(
@@ -793,15 +813,33 @@ export async function createKernelAccount<
793
813
  chainId: metadataChainId,
794
814
  version
795
815
  } = await getMemoizedAccountMetadata()
796
- const wrappedMessageHash = await eip712WrapHash(typedHash, {
797
- name,
798
- chainId: Number(metadataChainId),
799
- version,
800
- verifyingContract: accountAddress
801
- })
802
- const signature = await kernelPluginManager.signMessage({
803
- message: { raw: wrappedMessageHash }
804
- })
816
+
817
+ let signature: Hex
818
+ if (isEip7702) {
819
+ signature = await kernelPluginManager.signTypedData({
820
+ message: { hash: typedHash },
821
+ primaryType: "Kernel",
822
+ types: {
823
+ Kernel: [{ name: "hash", type: "bytes32" }]
824
+ },
825
+ domain: {
826
+ name,
827
+ version,
828
+ chainId: Number(metadataChainId),
829
+ verifyingContract: accountAddress
830
+ }
831
+ })
832
+ } else {
833
+ const wrappedMessageHash = await eip712WrapHash(typedHash, {
834
+ name,
835
+ chainId: Number(metadataChainId),
836
+ version,
837
+ verifyingContract: accountAddress
838
+ })
839
+ signature = await kernelPluginManager.signMessage({
840
+ message: { raw: wrappedMessageHash }
841
+ })
842
+ }
805
843
  if (
806
844
  !hasKernelFeature(
807
845
  KERNEL_FEATURES.ERC1271_WITH_VALIDATOR,
@@ -58,7 +58,7 @@ export async function signerTo7702Validator<
58
58
  return {
59
59
  ...account,
60
60
  supportedKernelVersions: kernelVersion,
61
- validatorType: "SECONDARY",
61
+ validatorType: "EIP7702",
62
62
  address: viemSigner.address,
63
63
  source: "EIP7702Validator",
64
64
  getIdentifier() {
@@ -69,9 +69,11 @@ export async function changeSudoValidator<
69
69
 
70
70
  let rootValidatorId: Hex
71
71
  if (
72
- [VALIDATOR_TYPE.PERMISSION, VALIDATOR_TYPE.SECONDARY].includes(
73
- VALIDATOR_TYPE[sudoValidator.validatorType]
74
- )
72
+ [
73
+ VALIDATOR_TYPE.PERMISSION,
74
+ VALIDATOR_TYPE.SECONDARY,
75
+ VALIDATOR_TYPE.EIP7702
76
+ ].includes(VALIDATOR_TYPE[sudoValidator.validatorType])
75
77
  ) {
76
78
  rootValidatorId = concatHex([
77
79
  VALIDATOR_TYPE[sudoValidator.validatorType],
@@ -52,9 +52,11 @@ export async function uninstallPlugin<
52
52
 
53
53
  let validatorId: Hex
54
54
  if (
55
- [VALIDATOR_TYPE.PERMISSION, VALIDATOR_TYPE.SECONDARY].includes(
56
- VALIDATOR_TYPE[plugin.validatorType]
57
- )
55
+ [
56
+ VALIDATOR_TYPE.PERMISSION,
57
+ VALIDATOR_TYPE.SECONDARY,
58
+ VALIDATOR_TYPE.EIP7702
59
+ ].includes(VALIDATOR_TYPE[plugin.validatorType])
58
60
  ) {
59
61
  validatorId = concatHex([
60
62
  VALIDATOR_TYPE[plugin.validatorType],
package/constants.ts CHANGED
@@ -115,7 +115,8 @@ export const KERNEL_NAME = "Kernel"
115
115
  export const VALIDATOR_TYPE = {
116
116
  SUDO: "0x00",
117
117
  SECONDARY: "0x01",
118
- PERMISSION: "0x02"
118
+ PERMISSION: "0x02",
119
+ EIP7702: "0x00"
119
120
  } as const
120
121
  export enum VALIDATOR_MODE {
121
122
  DEFAULT = "0x00",
package/index.ts CHANGED
@@ -51,6 +51,7 @@ export {
51
51
  KernelV3InitAbi
52
52
  } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js"
53
53
  export { KernelV3_1AccountAbi } from "./accounts/kernel/abi/kernel_v_3_1/KernelAccountAbi.js"
54
+ export { KernelV3_3AccountAbi } from "./accounts/kernel/abi/kernel_v_3_3/KernelAccountAbi.js"
54
55
  export { KernelV3FactoryAbi } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js"
55
56
  export { KernelFactoryStakerAbi } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js"
56
57
  export { TokenActionsAbi } from "./accounts/kernel/abi/TokenActionsAbi.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodev/sdk",
3
- "version": "5.4.37",
3
+ "version": "5.4.39",
4
4
  "author": "ZeroDev",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
package/types/kernel.ts CHANGED
@@ -116,7 +116,7 @@ export type ZeroDevAccountClientRpcSchema = [
116
116
 
117
117
  export type ValidatorType = Extract<
118
118
  keyof typeof VALIDATOR_TYPE,
119
- "PERMISSION" | "SECONDARY"
119
+ "PERMISSION" | "SECONDARY" | "EIP7702"
120
120
  >
121
121
 
122
122
  export type KernelValidator<Name extends string = string> =