@rhinestone/sdk 1.4.2 → 2.0.0-beta.0

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 (202) hide show
  1. package/README.md +89 -1
  2. package/dist/src/accounts/error.d.ts +1 -1
  3. package/dist/src/accounts/error.js +1 -19
  4. package/dist/src/accounts/index.d.ts +5 -5
  5. package/dist/src/accounts/index.js +121 -157
  6. package/dist/src/accounts/json-rpc/index.d.ts +1 -1
  7. package/dist/src/accounts/json-rpc/index.js +8 -10
  8. package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
  9. package/dist/src/accounts/json-rpc/providers.js +4 -7
  10. package/dist/src/accounts/kernel.d.ts +3 -3
  11. package/dist/src/accounts/kernel.js +66 -75
  12. package/dist/src/accounts/nexus.d.ts +3 -3
  13. package/dist/src/accounts/nexus.js +62 -73
  14. package/dist/src/accounts/passport.d.ts +3 -3
  15. package/dist/src/accounts/passport.js +9 -13
  16. package/dist/src/accounts/safe.d.ts +3 -3
  17. package/dist/src/accounts/safe.js +54 -63
  18. package/dist/src/accounts/signing/common.d.ts +10 -4
  19. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  20. package/dist/src/accounts/signing/common.js +30 -36
  21. package/dist/src/accounts/signing/message.d.ts +2 -2
  22. package/dist/src/accounts/signing/message.js +10 -12
  23. package/dist/src/accounts/signing/passkeys.js +11 -17
  24. package/dist/src/accounts/signing/typedData.d.ts +1 -1
  25. package/dist/src/accounts/signing/typedData.js +6 -8
  26. package/dist/src/accounts/startale.d.ts +3 -3
  27. package/dist/src/accounts/startale.js +37 -47
  28. package/dist/src/accounts/utils.d.ts +2 -2
  29. package/dist/src/accounts/utils.js +22 -28
  30. package/dist/src/accounts/walletClient.js +4 -8
  31. package/dist/src/actions/compact.d.ts +1 -1
  32. package/dist/src/actions/compact.js +22 -35
  33. package/dist/src/actions/deployment.d.ts +1 -1
  34. package/dist/src/actions/deployment.js +11 -13
  35. package/dist/src/actions/ecdsa.d.ts +1 -1
  36. package/dist/src/actions/ecdsa.js +14 -20
  37. package/dist/src/actions/index.d.ts +2 -2
  38. package/dist/src/actions/index.js +6 -10
  39. package/dist/src/actions/mfa.d.ts +1 -1
  40. package/dist/src/actions/mfa.js +18 -24
  41. package/dist/src/actions/passkeys.d.ts +2 -2
  42. package/dist/src/actions/passkeys.js +14 -20
  43. package/dist/src/actions/recovery.d.ts +1 -1
  44. package/dist/src/actions/recovery.js +25 -29
  45. package/dist/src/actions/smart-sessions.d.ts +1 -1
  46. package/dist/src/actions/smart-sessions.js +8 -12
  47. package/dist/src/auth/provider.d.ts +7 -0
  48. package/dist/src/auth/provider.d.ts.map +1 -0
  49. package/dist/src/auth/provider.js +38 -0
  50. package/dist/src/errors/index.d.ts +3 -3
  51. package/dist/src/errors/index.js +10 -54
  52. package/dist/src/execution/compact.d.ts +3 -3
  53. package/dist/src/execution/compact.js +10 -18
  54. package/dist/src/execution/error.js +1 -11
  55. package/dist/src/execution/index.d.ts +9 -8
  56. package/dist/src/execution/index.d.ts.map +1 -1
  57. package/dist/src/execution/index.js +54 -67
  58. package/dist/src/execution/permit2.d.ts +5 -5
  59. package/dist/src/execution/permit2.js +8 -13
  60. package/dist/src/execution/singleChainOps.d.ts +2 -2
  61. package/dist/src/execution/singleChainOps.js +1 -3
  62. package/dist/src/execution/types.d.ts +1 -1
  63. package/dist/src/execution/types.js +1 -2
  64. package/dist/src/execution/utils.d.ts +10 -6
  65. package/dist/src/execution/utils.d.ts.map +1 -1
  66. package/dist/src/execution/utils.js +159 -162
  67. package/dist/src/index.d.ts +10 -10
  68. package/dist/src/index.d.ts.map +1 -1
  69. package/dist/src/index.js +57 -67
  70. package/dist/src/jwt-server/digest.d.ts +11 -0
  71. package/dist/src/jwt-server/digest.d.ts.map +1 -0
  72. package/dist/src/jwt-server/digest.js +19 -0
  73. package/dist/src/jwt-server/express.d.ts +16 -0
  74. package/dist/src/jwt-server/express.d.ts.map +1 -0
  75. package/dist/src/jwt-server/express.js +23 -0
  76. package/dist/src/jwt-server/handlers.d.ts +10 -0
  77. package/dist/src/jwt-server/handlers.d.ts.map +1 -0
  78. package/dist/src/jwt-server/handlers.js +37 -0
  79. package/dist/src/jwt-server/index.d.ts +8 -0
  80. package/dist/src/jwt-server/index.d.ts.map +1 -0
  81. package/dist/src/jwt-server/index.js +7 -0
  82. package/dist/src/jwt-server/jcs.d.ts +12 -0
  83. package/dist/src/jwt-server/jcs.d.ts.map +1 -0
  84. package/dist/src/jwt-server/jcs.js +57 -0
  85. package/dist/src/jwt-server/signer.d.ts +18 -0
  86. package/dist/src/jwt-server/signer.d.ts.map +1 -0
  87. package/dist/src/jwt-server/signer.js +68 -0
  88. package/dist/src/jwt-server/sponsorship.d.ts +19 -0
  89. package/dist/src/jwt-server/sponsorship.d.ts.map +1 -0
  90. package/dist/src/jwt-server/sponsorship.js +51 -0
  91. package/dist/src/jwt-server/web.d.ts +4 -0
  92. package/dist/src/jwt-server/web.d.ts.map +1 -0
  93. package/dist/src/jwt-server/web.js +23 -0
  94. package/dist/src/modules/abi/smart-session-emissary.js +1 -3
  95. package/dist/src/modules/abi/smart-sessions.js +1 -4
  96. package/dist/src/modules/chain-abstraction.js +1 -5
  97. package/dist/src/modules/common.d.ts +1 -1
  98. package/dist/src/modules/common.js +1 -13
  99. package/dist/src/modules/index.d.ts +5 -5
  100. package/dist/src/modules/index.js +35 -50
  101. package/dist/src/modules/legacy.d.ts +2 -2
  102. package/dist/src/modules/legacy.js +11 -14
  103. package/dist/src/modules/read.d.ts +1 -1
  104. package/dist/src/modules/read.js +11 -15
  105. package/dist/src/modules/validators/core.d.ts +2 -2
  106. package/dist/src/modules/validators/core.js +26 -44
  107. package/dist/src/modules/validators/index.d.ts +2 -2
  108. package/dist/src/modules/validators/index.js +3 -19
  109. package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
  110. package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
  111. package/dist/src/modules/validators/policies/claim/types.js +11 -14
  112. package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
  113. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  114. package/dist/src/modules/validators/smart-sessions.js +77 -97
  115. package/dist/src/orchestrator/client.d.ts +10 -5
  116. package/dist/src/orchestrator/client.d.ts.map +1 -1
  117. package/dist/src/orchestrator/client.js +73 -66
  118. package/dist/src/orchestrator/consts.d.ts +1 -1
  119. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  120. package/dist/src/orchestrator/consts.js +2 -8
  121. package/dist/src/orchestrator/error.js +1 -33
  122. package/dist/src/orchestrator/index.d.ts +8 -7
  123. package/dist/src/orchestrator/index.d.ts.map +1 -1
  124. package/dist/src/orchestrator/index.js +8 -57
  125. package/dist/src/orchestrator/registry.d.ts +2 -2
  126. package/dist/src/orchestrator/registry.js +19 -33
  127. package/dist/src/orchestrator/types.d.ts +5 -1
  128. package/dist/src/orchestrator/types.d.ts.map +1 -1
  129. package/dist/src/orchestrator/types.js +1 -17
  130. package/dist/src/orchestrator/utils.js +1 -3
  131. package/dist/src/types.d.ts +29 -5
  132. package/dist/src/types.d.ts.map +1 -1
  133. package/dist/src/types.js +1 -2
  134. package/dist/src/utils/index.d.ts +2 -2
  135. package/dist/src/utils/index.js +9 -15
  136. package/package.json +29 -98
  137. package/dist/src/accounts/index.test.d.ts +0 -2
  138. package/dist/src/accounts/index.test.d.ts.map +0 -1
  139. package/dist/src/accounts/index.test.js +0 -33
  140. package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
  141. package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
  142. package/dist/src/accounts/json-rpc/index.test.js +0 -35
  143. package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
  144. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
  145. package/dist/src/accounts/json-rpc/providers.test.js +0 -43
  146. package/dist/src/accounts/kernel.test.d.ts +0 -2
  147. package/dist/src/accounts/kernel.test.d.ts.map +0 -1
  148. package/dist/src/accounts/kernel.test.js +0 -132
  149. package/dist/src/accounts/nexus.test.d.ts +0 -2
  150. package/dist/src/accounts/nexus.test.d.ts.map +0 -1
  151. package/dist/src/accounts/nexus.test.js +0 -118
  152. package/dist/src/accounts/safe.test.d.ts +0 -2
  153. package/dist/src/accounts/safe.test.d.ts.map +0 -1
  154. package/dist/src/accounts/safe.test.js +0 -168
  155. package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
  156. package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
  157. package/dist/src/accounts/signing/passkeys.test.js +0 -88
  158. package/dist/src/accounts/startale.test.d.ts +0 -2
  159. package/dist/src/accounts/startale.test.d.ts.map +0 -1
  160. package/dist/src/accounts/startale.test.js +0 -189
  161. package/dist/src/accounts/utils.test.d.ts +0 -2
  162. package/dist/src/accounts/utils.test.d.ts.map +0 -1
  163. package/dist/src/accounts/utils.test.js +0 -49
  164. package/dist/src/actions/ecdsa.test.d.ts +0 -2
  165. package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
  166. package/dist/src/actions/ecdsa.test.js +0 -99
  167. package/dist/src/actions/passkeys.test.d.ts +0 -2
  168. package/dist/src/actions/passkeys.test.d.ts.map +0 -1
  169. package/dist/src/actions/passkeys.test.js +0 -54
  170. package/dist/src/actions/recovery.test.d.ts +0 -2
  171. package/dist/src/actions/recovery.test.d.ts.map +0 -1
  172. package/dist/src/actions/recovery.test.js +0 -168
  173. package/dist/src/execution/signing.test.d.ts +0 -2
  174. package/dist/src/execution/signing.test.d.ts.map +0 -1
  175. package/dist/src/execution/signing.test.js +0 -465
  176. package/dist/src/execution/utils.test.d.ts +0 -2
  177. package/dist/src/execution/utils.test.d.ts.map +0 -1
  178. package/dist/src/execution/utils.test.js +0 -388
  179. package/dist/src/modules/index.test.d.ts +0 -2
  180. package/dist/src/modules/index.test.d.ts.map +0 -1
  181. package/dist/src/modules/index.test.js +0 -81
  182. package/dist/src/modules/validators/core.test.d.ts +0 -2
  183. package/dist/src/modules/validators/core.test.d.ts.map +0 -1
  184. package/dist/src/modules/validators/core.test.js +0 -101
  185. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts +0 -2
  186. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts.map +0 -1
  187. package/dist/src/modules/validators/policies/claim/permit2.test.js +0 -519
  188. package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
  189. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
  190. package/dist/src/modules/validators/smart-sessions.test.js +0 -311
  191. package/dist/src/orchestrator/registry.test.d.ts +0 -2
  192. package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
  193. package/dist/src/orchestrator/registry.test.js +0 -154
  194. package/dist/src/utils/index.test.d.ts +0 -2
  195. package/dist/src/utils/index.test.d.ts.map +0 -1
  196. package/dist/src/utils/index.test.js +0 -42
  197. package/dist/test/consts.d.ts +0 -10
  198. package/dist/test/consts.d.ts.map +0 -1
  199. package/dist/test/consts.js +0 -22
  200. package/dist/test/utils/utils.d.ts +0 -5
  201. package/dist/test/utils/utils.d.ts.map +0 -1
  202. package/dist/test/utils/utils.js +0 -20
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAlchemyUrl = getAlchemyUrl;
4
- exports.getCustomUrl = getCustomUrl;
5
- const shared_configs_1 = require("@rhinestone/shared-configs");
1
+ import { providerRegistry as providers } from '@rhinestone/shared-configs';
6
2
  function getAlchemyUrl(chainId, apiKey) {
7
- const urlTemplate = shared_configs_1.providerRegistry.Alchemy.url_template;
8
- const chainParam = shared_configs_1.providerRegistry.Alchemy.chain_mapping[chainId];
3
+ const urlTemplate = providers.Alchemy.url_template;
4
+ const chainParam = providers.Alchemy.chain_mapping[chainId];
9
5
  if (!chainParam) {
10
6
  throw new Error(`Unsupported chain: ${chainId}`);
11
7
  }
@@ -16,3 +12,4 @@ function getAlchemyUrl(chainId, apiKey) {
16
12
  function getCustomUrl(chainId, urls) {
17
13
  return urls[chainId];
18
14
  }
15
+ export { getAlchemyUrl, getCustomUrl };
@@ -1,8 +1,8 @@
1
1
  import { type Abi, type Address, type Chain, type Hex, type PublicClient } from 'viem';
2
2
  import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
3
- import { type Module } from '../modules/common';
4
- import type { OwnerSet, RhinestoneAccountConfig } from '../types';
5
- import { type ValidatorConfig } from './utils';
3
+ import { type Module } from '../modules/common.js';
4
+ import type { OwnerSet, RhinestoneAccountConfig } from '../types.js';
5
+ import { type ValidatorConfig } from './utils.js';
6
6
  declare function getDeployArgs(config: RhinestoneAccountConfig): {
7
7
  factory: `0x${string}`;
8
8
  factoryData: `0x${string}`;
@@ -1,20 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEip712Domain = getEip712Domain;
4
- exports.getInstallData = getInstallData;
5
- exports.getAddress = getAddress;
6
- exports.getDeployArgs = getDeployArgs;
7
- exports.getSmartAccount = getSmartAccount;
8
- exports.getGuardianSmartAccount = getGuardianSmartAccount;
9
- exports.packSignature = packSignature;
10
- exports.wrapMessageHash = wrapMessageHash;
11
- const viem_1 = require("viem");
12
- const account_abstraction_1 = require("viem/account-abstraction");
13
- const modules_1 = require("../modules");
14
- const common_1 = require("../modules/common");
15
- const validators_1 = require("../modules/validators");
16
- const error_1 = require("./error");
17
- const utils_1 = require("./utils");
1
+ import { concat, concatHex, decodeAbiParameters, decodeFunctionData, domainSeparator, encodeAbiParameters, encodeFunctionData, getContractAddress, keccak256, parseAbi, stringToHex, toHex, zeroAddress, zeroHash, } from 'viem';
2
+ import { entryPoint07Abi, entryPoint07Address, getUserOperationHash, toSmartAccount, } from 'viem/account-abstraction';
3
+ import { getSetup as getModuleSetup } from '../modules/index.js';
4
+ import { MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_ID_VALIDATOR, } from '../modules/common.js';
5
+ import { getMockSignature } from '../modules/validators/index.js';
6
+ import { AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, } from './error.js';
7
+ import { encode7579Calls, getAccountNonce } from './utils.js';
18
8
  const KERNEL_META_FACTORY_ADDRESS = '0xd703aae79538628d27099b8c4f621be4ccd142d5';
19
9
  const KERNEL_IMPLEMENTATION_ADDRESS = '0xd6cedde84be40893d153be9d467cd6ad37875b28';
20
10
  const KERNEL_FACTORY_ADDRESS = '0x2577507b78c2008ff367261cb6285d44ba5ef2e9';
@@ -25,23 +15,23 @@ function getDeployArgs(config) {
25
15
  if (!('factory' in config.initData)) {
26
16
  return null;
27
17
  }
28
- const factoryData = (0, viem_1.decodeFunctionData)({
29
- abi: (0, viem_1.parseAbi)([
18
+ const factoryData = decodeFunctionData({
19
+ abi: parseAbi([
30
20
  'function deployWithFactory(address factory,bytes createData,bytes32 salt)',
31
21
  ]),
32
22
  data: config.initData.factoryData,
33
23
  });
34
24
  if (factoryData.functionName !== 'deployWithFactory') {
35
- throw new error_1.AccountConfigurationNotSupportedError('Invalid factory data', 'kernel');
25
+ throw new AccountConfigurationNotSupportedError('Invalid factory data', 'kernel');
36
26
  }
37
27
  const factory = factoryData.args[0];
38
28
  const createData = factoryData.args[1];
39
29
  const salt = factoryData.args[2];
40
30
  const implementation = factory.toLowerCase() === KERNEL_FACTORY_ADDRESS
41
31
  ? KERNEL_IMPLEMENTATION_ADDRESS
42
- : viem_1.zeroAddress;
43
- if (implementation === viem_1.zeroAddress) {
44
- throw new error_1.AccountConfigurationNotSupportedError('Unsupported Kernel implementation', 'kernel');
32
+ : zeroAddress;
33
+ if (implementation === zeroAddress) {
34
+ throw new AccountConfigurationNotSupportedError('Unsupported Kernel implementation', 'kernel');
45
35
  }
46
36
  return {
47
37
  factory: config.initData.factory,
@@ -52,10 +42,10 @@ function getDeployArgs(config) {
52
42
  };
53
43
  }
54
44
  const account = config.account;
55
- const salt = account?.salt ?? viem_1.zeroHash;
56
- const moduleSetup = (0, modules_1.getSetup)(config);
57
- const rootValidator = (0, viem_1.concat)(['0x01', moduleSetup.validators[0].address]);
58
- const hook = viem_1.zeroAddress;
45
+ const salt = account?.salt ?? zeroHash;
46
+ const moduleSetup = getModuleSetup(config);
47
+ const rootValidator = concat(['0x01', moduleSetup.validators[0].address]);
48
+ const hook = zeroAddress;
59
49
  const validatorData = moduleSetup.validators[0].initData;
60
50
  const hookData = '0x';
61
51
  // Install modules via init config
@@ -73,13 +63,13 @@ function getDeployArgs(config) {
73
63
  for (const module of moduleSetup.hooks) {
74
64
  initConfig.push(...getInstallData(module));
75
65
  }
76
- const initializationCallData = (0, viem_1.encodeFunctionData)({
77
- abi: (0, viem_1.parseAbi)(['function initialize(bytes21,address,bytes,bytes,bytes[])']),
66
+ const initializationCallData = encodeFunctionData({
67
+ abi: parseAbi(['function initialize(bytes21,address,bytes,bytes,bytes[])']),
78
68
  functionName: 'initialize',
79
69
  args: [rootValidator, hook, validatorData, hookData, initConfig],
80
70
  });
81
- const factoryData = (0, viem_1.encodeFunctionData)({
82
- abi: (0, viem_1.parseAbi)(['function deployWithFactory(address,bytes,bytes32)']),
71
+ const factoryData = encodeFunctionData({
72
+ abi: parseAbi(['function deployWithFactory(address,bytes,bytes32)']),
83
73
  functionName: 'deployWithFactory',
84
74
  args: [KERNEL_FACTORY_ADDRESS, initializationCallData, salt],
85
75
  });
@@ -97,8 +87,8 @@ function getAddress(config) {
97
87
  throw new Error('Cannot derive address: deploy args not available');
98
88
  }
99
89
  const { salt, initializationCallData } = deployArgs;
100
- const actualSalt = (0, viem_1.keccak256)((0, viem_1.concat)([initializationCallData, salt]));
101
- return (0, viem_1.getContractAddress)({
90
+ const actualSalt = keccak256(concat([initializationCallData, salt]));
91
+ return getContractAddress({
102
92
  from: KERNEL_FACTORY_ADDRESS,
103
93
  opcode: 'CREATE2',
104
94
  bytecode: KERNEL_BYTECODE,
@@ -107,67 +97,67 @@ function getAddress(config) {
107
97
  }
108
98
  function getEip712Domain(config, chain) {
109
99
  if (config.initData) {
110
- throw new error_1.Eip712DomainNotAvailableError('Existing Kernel accounts are not yet supported');
100
+ throw new Eip712DomainNotAvailableError('Existing Kernel accounts are not yet supported');
111
101
  }
112
102
  return {
113
103
  name: 'Kernel',
114
104
  version: KERNEL_VERSION,
115
105
  chainId: chain.id,
116
106
  verifyingContract: getAddress(config),
117
- salt: viem_1.zeroHash,
107
+ salt: zeroHash,
118
108
  };
119
109
  }
120
110
  function getInstallData(module) {
121
111
  const HOOK_INSTALLED_ADDRESS = '0x0000000000000000000000000000000000000001';
122
112
  switch (module.type) {
123
- case common_1.MODULE_TYPE_ID_VALIDATOR: {
124
- const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x', '0x']);
125
- const initData = (0, viem_1.concat)([HOOK_INSTALLED_ADDRESS, data]);
126
- const validatorId = (0, viem_1.concat)(['0x01', module.address]);
113
+ case MODULE_TYPE_ID_VALIDATOR: {
114
+ const data = encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x', '0x']);
115
+ const initData = concat([HOOK_INSTALLED_ADDRESS, data]);
116
+ const validatorId = concat(['0x01', module.address]);
127
117
  return [
128
- (0, viem_1.encodeFunctionData)({
129
- abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
118
+ encodeFunctionData({
119
+ abi: parseAbi(['function installModule(uint256,address,bytes)']),
130
120
  functionName: 'installModule',
131
121
  args: [module.type, module.address, initData],
132
122
  }),
133
- (0, viem_1.encodeFunctionData)({
134
- abi: (0, viem_1.parseAbi)(['function grantAccess(bytes21,bytes4,bool)']),
123
+ encodeFunctionData({
124
+ abi: parseAbi(['function grantAccess(bytes21,bytes4,bool)']),
135
125
  functionName: 'grantAccess',
136
126
  args: [validatorId, '0xe9ae5c53', true],
137
127
  }),
138
128
  ];
139
129
  }
140
- case common_1.MODULE_TYPE_ID_EXECUTOR: {
141
- const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x']);
142
- const initData = (0, viem_1.concat)([viem_1.zeroAddress, data]);
130
+ case MODULE_TYPE_ID_EXECUTOR: {
131
+ const data = encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x']);
132
+ const initData = concat([zeroAddress, data]);
143
133
  return [
144
- (0, viem_1.encodeFunctionData)({
145
- abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
134
+ encodeFunctionData({
135
+ abi: parseAbi(['function installModule(uint256,address,bytes)']),
146
136
  functionName: 'installModule',
147
137
  args: [module.type, module.address, initData],
148
138
  }),
149
139
  ];
150
140
  }
151
- case common_1.MODULE_TYPE_ID_FALLBACK: {
152
- const [selector, flags, selectorData] = (0, viem_1.decodeAbiParameters)([
141
+ case MODULE_TYPE_ID_FALLBACK: {
142
+ const [selector, flags, selectorData] = decodeAbiParameters([
153
143
  { name: 'selector', type: 'bytes4' },
154
144
  { name: 'flags', type: 'bytes1' },
155
145
  { name: 'data', type: 'bytes' },
156
146
  ], module.initData);
157
- const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }], [(0, viem_1.concat)([flags, selectorData]), '0x']);
158
- const initData = (0, viem_1.concat)([selector, HOOK_INSTALLED_ADDRESS, data]);
147
+ const data = encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [concat([flags, selectorData]), '0x']);
148
+ const initData = concat([selector, HOOK_INSTALLED_ADDRESS, data]);
159
149
  return [
160
- (0, viem_1.encodeFunctionData)({
161
- abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
150
+ encodeFunctionData({
151
+ abi: parseAbi(['function installModule(uint256,address,bytes)']),
162
152
  functionName: 'installModule',
163
153
  args: [module.type, module.address, initData],
164
154
  }),
165
155
  ];
166
156
  }
167
- case common_1.MODULE_TYPE_ID_HOOK: {
157
+ case MODULE_TYPE_ID_HOOK: {
168
158
  return [
169
- (0, viem_1.encodeFunctionData)({
170
- abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
159
+ encodeFunctionData({
160
+ abi: parseAbi(['function installModule(uint256,address,bytes)']),
171
161
  functionName: 'installModule',
172
162
  args: [module.type, module.address, module.initData],
173
163
  }),
@@ -176,9 +166,9 @@ function getInstallData(module) {
176
166
  }
177
167
  }
178
168
  async function packSignature(signature, validator, transformSignature = (signature) => signature) {
179
- const vId = validator.isRoot ? '0x00' : (0, viem_1.concat)(['0x01', validator.address]);
180
- const magicValueSigReplayable = (0, viem_1.keccak256)((0, viem_1.toHex)('kernel.replayable.signature'));
181
- const packedSig = (0, viem_1.concat)([
169
+ const vId = validator.isRoot ? '0x00' : concat(['0x01', validator.address]);
170
+ const magicValueSigReplayable = keccak256(toHex('kernel.replayable.signature'));
171
+ const packedSig = concat([
182
172
  vId,
183
173
  magicValueSigReplayable,
184
174
  transformSignature(signature),
@@ -186,7 +176,7 @@ async function packSignature(signature, validator, transformSignature = (signatu
186
176
  return packedSig;
187
177
  }
188
178
  function wrapMessageHash(messageHash, accountAddress) {
189
- const _domainSeparator = (0, viem_1.domainSeparator)({
179
+ const _domainSeparator = domainSeparator({
190
180
  domain: {
191
181
  name: 'Kernel',
192
182
  version: KERNEL_VERSION,
@@ -194,36 +184,36 @@ function wrapMessageHash(messageHash, accountAddress) {
194
184
  verifyingContract: accountAddress,
195
185
  },
196
186
  });
197
- const kernelTypeHash = (0, viem_1.keccak256)((0, viem_1.stringToHex)('Kernel(bytes32 hash)'));
198
- const wrappedMessageHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: 'bytes32' }, { type: 'bytes32' }], [kernelTypeHash, messageHash]));
199
- const digest = (0, viem_1.keccak256)((0, viem_1.concatHex)(['0x1901', _domainSeparator, wrappedMessageHash]));
187
+ const kernelTypeHash = keccak256(stringToHex('Kernel(bytes32 hash)'));
188
+ const wrappedMessageHash = keccak256(encodeAbiParameters([{ type: 'bytes32' }, { type: 'bytes32' }], [kernelTypeHash, messageHash]));
189
+ const digest = keccak256(concatHex(['0x1901', _domainSeparator, wrappedMessageHash]));
200
190
  return digest;
201
191
  }
202
192
  async function getSmartAccount(client, address, owners, validatorAddress, sign) {
203
193
  return getBaseSmartAccount(address, client, validatorAddress, 'root', async () => {
204
- return (0, validators_1.getMockSignature)(owners);
194
+ return getMockSignature(owners);
205
195
  }, sign);
206
196
  }
207
197
  async function getGuardianSmartAccount(client, address, guardians, validatorAddress, sign) {
208
198
  return await getBaseSmartAccount(address, client, validatorAddress, 'validator', async () => {
209
- return (0, validators_1.getMockSignature)(guardians);
199
+ return getMockSignature(guardians);
210
200
  }, async (hash) => {
211
201
  return await sign(hash);
212
202
  });
213
203
  }
214
204
  async function getBaseSmartAccount(address, client, validatorAddress, validatorType, getStubSignature, signUserOperation) {
215
- return await (0, account_abstraction_1.toSmartAccount)({
205
+ return await toSmartAccount({
216
206
  client,
217
207
  entryPoint: {
218
- abi: account_abstraction_1.entryPoint07Abi,
219
- address: account_abstraction_1.entryPoint07Address,
208
+ abi: entryPoint07Abi,
209
+ address: entryPoint07Address,
220
210
  version: '0.7',
221
211
  },
222
212
  async decodeCalls() {
223
213
  throw new Error('Not implemented');
224
214
  },
225
215
  async encodeCalls(calls) {
226
- return (0, utils_1.encode7579Calls)({
216
+ return encode7579Calls({
227
217
  mode: {
228
218
  type: calls.length > 1 ? 'batchcall' : 'call',
229
219
  revertOnError: false,
@@ -245,10 +235,10 @@ async function getBaseSmartAccount(address, client, validatorAddress, validatorT
245
235
  const type = validatorType === 'root' ? '0x00' : '0x01';
246
236
  const identifier = validatorAddress;
247
237
  const nonceKey = '0x0000';
248
- const key = (0, viem_1.concat)([mode, type, identifier, nonceKey]);
249
- return (0, utils_1.getAccountNonce)(client, {
238
+ const key = concat([mode, type, identifier, nonceKey]);
239
+ return getAccountNonce(client, {
250
240
  address,
251
- entryPointAddress: account_abstraction_1.entryPoint07Address,
241
+ entryPointAddress: entryPoint07Address,
252
242
  key: BigInt(key),
253
243
  });
254
244
  },
@@ -265,13 +255,13 @@ async function getBaseSmartAccount(address, client, validatorAddress, validatorT
265
255
  const { chainId = client.chain?.id, ...userOperation } = parameters;
266
256
  if (!chainId)
267
257
  throw new Error('Chain id not found');
268
- const hash = (0, account_abstraction_1.getUserOperationHash)({
258
+ const hash = getUserOperationHash({
269
259
  userOperation: {
270
260
  ...userOperation,
271
261
  sender: userOperation.sender ?? (await this.getAddress()),
272
262
  signature: '0x',
273
263
  },
274
- entryPointAddress: account_abstraction_1.entryPoint07Address,
264
+ entryPointAddress: entryPoint07Address,
275
265
  entryPointVersion: '0.7',
276
266
  chainId: chainId,
277
267
  });
@@ -279,3 +269,4 @@ async function getBaseSmartAccount(address, client, validatorAddress, validatorT
279
269
  },
280
270
  });
281
271
  }
272
+ export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
@@ -1,8 +1,8 @@
1
1
  import type { Abi, Account, Address, Chain, Hex, PublicClient } from 'viem';
2
2
  import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
3
- import type { Module } from '../modules/common';
4
- import type { OwnerSet, RhinestoneAccountConfig } from '../types';
5
- import { type ValidatorConfig } from './utils';
3
+ import type { Module } from '../modules/common.js';
4
+ import type { OwnerSet, RhinestoneAccountConfig } from '../types.js';
5
+ import { type ValidatorConfig } from './utils.js';
6
6
  declare function getDeployArgs(config: RhinestoneAccountConfig): {
7
7
  salt: `0x${string}`;
8
8
  factory: `0x${string}`;