@rhinestone/sdk 0.2.0 → 0.2.1

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 (63) hide show
  1. package/README.md +4 -16
  2. package/dist/accounts/index.d.ts +24 -0
  3. package/dist/accounts/index.d.ts.map +1 -0
  4. package/dist/accounts/index.js +183 -0
  5. package/dist/accounts/nexus.d.ts +7771 -0
  6. package/dist/accounts/nexus.d.ts.map +1 -0
  7. package/dist/accounts/nexus.js +209 -0
  8. package/dist/accounts/safe.d.ts +13 -0
  9. package/dist/accounts/safe.d.ts.map +1 -0
  10. package/dist/{services/account → accounts}/safe.js +30 -37
  11. package/dist/accounts/utils.d.ts +27 -0
  12. package/dist/accounts/utils.d.ts.map +1 -0
  13. package/dist/accounts/utils.js +155 -0
  14. package/dist/example.js +16 -27
  15. package/dist/{services/transaction.d.ts → execution/index.d.ts} +2 -2
  16. package/dist/execution/index.d.ts.map +1 -0
  17. package/dist/{services/transaction.js → execution/index.js} +12 -13
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/{services/modules.d.ts → modules/index.d.ts} +18 -6
  22. package/dist/modules/index.d.ts.map +1 -0
  23. package/dist/{services/modules.js → modules/index.js} +71 -3
  24. package/dist/orchestrator/client.d.ts.map +1 -0
  25. package/dist/orchestrator/consts.d.ts +2 -0
  26. package/dist/orchestrator/consts.d.ts.map +1 -0
  27. package/dist/orchestrator/consts.js +1 -0
  28. package/dist/orchestrator/error.d.ts.map +1 -0
  29. package/dist/orchestrator/index.d.ts +7 -0
  30. package/dist/orchestrator/index.d.ts.map +1 -0
  31. package/dist/{services/orchestrator → orchestrator}/index.js +2 -2
  32. package/dist/orchestrator/types.d.ts.map +1 -0
  33. package/dist/orchestrator/utils.d.ts.map +1 -0
  34. package/dist/{services/orchestrator → orchestrator}/utils.js +1 -1
  35. package/dist/types.d.ts +7 -5
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +3 -3
  38. package/dist/services/account/index.d.ts +0 -13
  39. package/dist/services/account/index.d.ts.map +0 -1
  40. package/dist/services/account/index.js +0 -54
  41. package/dist/services/account/nexus.d.ts +0 -9
  42. package/dist/services/account/nexus.d.ts.map +0 -1
  43. package/dist/services/account/nexus.js +0 -67
  44. package/dist/services/account/safe.d.ts +0 -9
  45. package/dist/services/account/safe.d.ts.map +0 -1
  46. package/dist/services/modules.d.ts.map +0 -1
  47. package/dist/services/orchestrator/client.d.ts.map +0 -1
  48. package/dist/services/orchestrator/consts.d.ts +0 -6
  49. package/dist/services/orchestrator/consts.d.ts.map +0 -1
  50. package/dist/services/orchestrator/consts.js +0 -4
  51. package/dist/services/orchestrator/error.d.ts.map +0 -1
  52. package/dist/services/orchestrator/index.d.ts +0 -8
  53. package/dist/services/orchestrator/index.d.ts.map +0 -1
  54. package/dist/services/orchestrator/types.d.ts.map +0 -1
  55. package/dist/services/orchestrator/utils.d.ts.map +0 -1
  56. package/dist/services/transaction.d.ts.map +0 -1
  57. /package/dist/{services/orchestrator → orchestrator}/client.d.ts +0 -0
  58. /package/dist/{services/orchestrator → orchestrator}/client.js +0 -0
  59. /package/dist/{services/orchestrator → orchestrator}/error.d.ts +0 -0
  60. /package/dist/{services/orchestrator → orchestrator}/error.js +0 -0
  61. /package/dist/{services/orchestrator → orchestrator}/types.d.ts +0 -0
  62. /package/dist/{services/orchestrator → orchestrator}/types.js +0 -0
  63. /package/dist/{services/orchestrator → orchestrator}/utils.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,GAAG,EAQT,MAAM,MAAM,CAAA;AAQb,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAalD,iBAAe,aAAa,CAAC,MAAM,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAHvn/B;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,209 @@
1
+ import { encodeAbiParameters, encodeFunctionData, keccak256, parseAbi, zeroAddress, concat, toHex, } from 'viem';
2
+ import { entryPoint07Address, getUserOperationHash, entryPoint07Abi, toSmartAccount, } from 'viem/account-abstraction';
3
+ import { getSetup as getModuleSetup } from '../modules';
4
+ import { encode7579Calls, getAccountNonce } from './utils';
5
+ const NEXUS_IMPLEMENTATION_ADDRESS = '0x000000004f43c49e93c970e84001853a70923b03';
6
+ const NEXUS_FACTORY_ADDRESS = '0x000000001D1D5004a02bAfAb9de2D6CE5b7B13de';
7
+ const NEXUS_BOOTSTRAP_ADDRESS = '0x00000000D3254452a909E4eeD47455Af7E27C289';
8
+ const K1_MEE_VALIDATOR_ADDRESS = '0x00000000d12897ddadc2044614a9677b191a2d95';
9
+ async function getDeployArgs(config) {
10
+ const salt = keccak256('0x');
11
+ const moduleSetup = getModuleSetup(config);
12
+ const initData = encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [
13
+ NEXUS_BOOTSTRAP_ADDRESS,
14
+ encodeFunctionData({
15
+ abi: parseAbi([
16
+ 'struct BootstrapConfig {address module;bytes initData;}',
17
+ 'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
18
+ 'struct RegistryConfig {address registry;address[] attesters;uint8 threshold;}',
19
+ 'function initNexus(BootstrapConfig[] calldata validators,BootstrapConfig[] calldata executors,BootstrapConfig calldata hook,BootstrapConfig[] calldata fallbacks,BootstrapPreValidationHookConfig[] calldata preValidationHooks,RegistryConfig registryConfig) external',
20
+ ]),
21
+ functionName: 'initNexus',
22
+ args: [
23
+ moduleSetup.validators.map((v) => ({
24
+ module: v.address,
25
+ initData: v.initData,
26
+ })),
27
+ moduleSetup.executors.map((e) => ({
28
+ module: e.address,
29
+ initData: e.initData,
30
+ })),
31
+ {
32
+ module: zeroAddress,
33
+ initData: '0x',
34
+ },
35
+ moduleSetup.fallbacks.map((f) => ({
36
+ module: f.address,
37
+ initData: f.initData,
38
+ })),
39
+ [],
40
+ {
41
+ registry: moduleSetup.registry,
42
+ attesters: moduleSetup.attesters,
43
+ threshold: moduleSetup.threshold,
44
+ },
45
+ ],
46
+ }),
47
+ ]);
48
+ const factoryData = encodeFunctionData({
49
+ abi: parseAbi(['function createAccount(bytes,bytes32)']),
50
+ functionName: 'createAccount',
51
+ args: [initData, salt],
52
+ });
53
+ const creationCode = '0x60806040526102aa803803806100148161018c565b92833981016040828203126101885781516001600160a01b03811692909190838303610188576020810151906001600160401b03821161018857019281601f8501121561018857835161006e610069826101c5565b61018c565b9481865260208601936020838301011161018857815f926020809301865e8601015260017f90b772c2cb8a51aa7a8a65fc23543c6d022d5b3f8e2b92eed79fba7eef8293005d823b15610176577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a282511561015e575f8091610146945190845af43d15610156573d91610137610069846101c5565b9283523d5f602085013e6101e0565b505b604051606b908161023f8239f35b6060916101e0565b50505034156101485763b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b5f80fd5b6040519190601f01601f191682016001600160401b038111838210176101b157604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116101b157601f01601f191660200190565b9061020457508051156101f557805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580610235575b610215575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561020d56fe60806040523615605c575f8073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416368280378136915af43d5f803e156058573d5ff35b3d5ffd5b00fea164736f6c634300081b000a';
54
+ const initializationCallData = encodeFunctionData({
55
+ abi: parseAbi(['function initializeAccount(bytes)']),
56
+ functionName: 'initializeAccount',
57
+ args: [initData],
58
+ });
59
+ const accountInitData = encodeAbiParameters([
60
+ {
61
+ name: 'address',
62
+ type: 'address',
63
+ },
64
+ {
65
+ name: 'calldata',
66
+ type: 'bytes',
67
+ },
68
+ ], [NEXUS_IMPLEMENTATION_ADDRESS, initializationCallData]);
69
+ const hashedInitcode = keccak256(concat([creationCode, accountInitData]));
70
+ return {
71
+ factory: NEXUS_FACTORY_ADDRESS,
72
+ factoryData,
73
+ salt,
74
+ hashedInitcode,
75
+ implementation: NEXUS_IMPLEMENTATION_ADDRESS,
76
+ initializationCallData,
77
+ };
78
+ }
79
+ function get7702InitCalls(config) {
80
+ const eoa = config.eoa;
81
+ if (!eoa) {
82
+ throw new Error('EIP-7702 accounts must have an EOA account');
83
+ }
84
+ const moduleSetup = getModuleSetup(config);
85
+ return [
86
+ {
87
+ to: eoa.address,
88
+ data: encodeFunctionData({
89
+ abi: parseAbi([
90
+ 'function setRegistry(address newRegistry, address[] calldata attesters, uint8 threshold)',
91
+ ]),
92
+ functionName: 'setRegistry',
93
+ args: [
94
+ moduleSetup.registry,
95
+ moduleSetup.attesters,
96
+ moduleSetup.threshold,
97
+ ],
98
+ }),
99
+ },
100
+ ...moduleSetup.validators.map((validator) => ({
101
+ to: eoa.address,
102
+ data: encodeFunctionData({
103
+ abi: parseAbi([
104
+ 'function installModule(uint256 moduleTypeId, address module, bytes calldata initData)',
105
+ ]),
106
+ functionName: 'installModule',
107
+ args: [validator.type, validator.address, validator.initData],
108
+ }),
109
+ })),
110
+ ...moduleSetup.executors.map((executor) => ({
111
+ to: eoa.address,
112
+ data: encodeFunctionData({
113
+ abi: parseAbi([
114
+ 'function installModule(uint256 moduleTypeId, address module, bytes calldata initData)',
115
+ ]),
116
+ functionName: 'installModule',
117
+ args: [executor.type, executor.address, executor.initData],
118
+ }),
119
+ })),
120
+ ...moduleSetup.fallbacks.map((fallback) => ({
121
+ to: eoa.address,
122
+ data: encodeFunctionData({
123
+ abi: parseAbi([
124
+ 'function installModule(uint256 moduleTypeId, address module, bytes calldata initData)',
125
+ ]),
126
+ functionName: 'installModule',
127
+ args: [fallback.type, fallback.address, fallback.initData],
128
+ }),
129
+ })),
130
+ ];
131
+ }
132
+ async function get7702SmartAccount(account, client) {
133
+ return await toSmartAccount({
134
+ client,
135
+ entryPoint: {
136
+ abi: entryPoint07Abi,
137
+ address: entryPoint07Address,
138
+ version: '0.7',
139
+ },
140
+ async decodeCalls() {
141
+ throw new Error('Not implemented');
142
+ },
143
+ async encodeCalls(calls) {
144
+ return encode7579Calls({
145
+ mode: {
146
+ type: calls.length > 1 ? 'batchcall' : 'call',
147
+ revertOnError: false,
148
+ selector: '0x',
149
+ context: '0x',
150
+ },
151
+ callData: calls,
152
+ });
153
+ },
154
+ async getAddress() {
155
+ return account.address;
156
+ },
157
+ async getFactoryArgs() {
158
+ return {};
159
+ },
160
+ async getNonce(args) {
161
+ const TIMESTAMP_ADJUSTMENT = 16777215n; // max value for size 3
162
+ const defaultedKey = (args?.key ?? 0n) % TIMESTAMP_ADJUSTMENT;
163
+ const defaultedValidationMode = '0x00';
164
+ const key = concat([
165
+ toHex(defaultedKey, { size: 3 }),
166
+ defaultedValidationMode,
167
+ zeroAddress,
168
+ ]);
169
+ const address = await this.getAddress();
170
+ return getAccountNonce(client, {
171
+ address,
172
+ entryPointAddress: entryPoint07Address,
173
+ key: BigInt(key),
174
+ });
175
+ },
176
+ async getStubSignature() {
177
+ const dynamicPart = K1_MEE_VALIDATOR_ADDRESS.substring(2).padEnd(40, '0');
178
+ return `0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${dynamicPart}000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000`;
179
+ },
180
+ async signMessage() {
181
+ throw new Error('Not implemented');
182
+ },
183
+ async signTypedData() {
184
+ throw new Error('Not implemented');
185
+ },
186
+ async signUserOperation(parameters) {
187
+ const { chainId = client.chain?.id, ...userOperation } = parameters;
188
+ if (!chainId)
189
+ throw new Error('Chain id not found');
190
+ const hash = getUserOperationHash({
191
+ userOperation: {
192
+ ...userOperation,
193
+ sender: userOperation.sender ?? (await this.getAddress()),
194
+ signature: '0x',
195
+ },
196
+ entryPointAddress: entryPoint07Address,
197
+ entryPointVersion: '0.7',
198
+ chainId: chainId,
199
+ });
200
+ if (!account.signMessage) {
201
+ throw new Error('Sign message not supported by account');
202
+ }
203
+ return await account.signMessage({
204
+ message: { raw: hash },
205
+ });
206
+ },
207
+ });
208
+ }
209
+ export { getDeployArgs, get7702InitCalls, get7702SmartAccount };
@@ -0,0 +1,13 @@
1
+ import { RhinestoneAccountConfig } from '../types';
2
+ declare function getDeployArgs(config: RhinestoneAccountConfig): Promise<{
3
+ factory: `0x${string}`;
4
+ factoryData: `0x${string}`;
5
+ salt: `0x${string}`;
6
+ hashedInitcode: `0x${string}`;
7
+ implementation: `0x${string}`;
8
+ initializationCallData: null;
9
+ }>;
10
+ declare function get7702InitCalls(): never;
11
+ declare function get7702SmartAccount(): never;
12
+ export { getDeployArgs, get7702InitCalls, get7702SmartAccount };
13
+ //# sourceMappingURL=safe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../accounts/safe.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAclD,iBAAe,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;;GA0E3D;AAED,iBAAS,gBAAgB,IAAI,KAAK,CAEjC;AAED,iBAAS,mBAAmB,IAAI,KAAK,CAEpC;AAsBD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,6 +1,5 @@
1
- import { encodeFunctionData, encodeAbiParameters, encodePacked, keccak256, parseAbi, zeroAddress, } from 'viem';
2
- import { OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, getValidator, } from '../modules';
3
- import { HOOK_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, TARGET_MODULE_ADDRESS, } from '../orchestrator';
1
+ import { encodeFunctionData, encodePacked, keccak256, parseAbi, zeroAddress, } from 'viem';
2
+ import { getSetup as getModuleSetup } from '../modules';
4
3
  const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
5
4
  const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
6
5
  const SAFE_SINGLETON_ADDRESS = '0x29fcb43b46531bca003ddc8fcb67ffe91900c762';
@@ -10,6 +9,7 @@ async function getDeployArgs(config) {
10
9
  {
11
10
  const owners = getOwners(config);
12
11
  const threshold = getThreshold(config);
12
+ const moduleSetup = getModuleSetup(config);
13
13
  const initData = encodeFunctionData({
14
14
  abi: parseAbi([
15
15
  'function setup(address[] calldata _owners,uint256 _threshold,address to,bytes calldata data,address fallbackHandler,address paymentToken,uint256 payment, address paymentReceiver) external',
@@ -27,39 +27,24 @@ async function getDeployArgs(config) {
27
27
  functionName: 'addSafe7579',
28
28
  args: [
29
29
  SAFE_7579_ADAPTER_ADDRESS,
30
- [
31
- {
32
- module: getValidator(config).address,
33
- initData: getValidator(config).initData,
34
- },
35
- ],
36
- [
37
- {
38
- module: SAME_CHAIN_MODULE_ADDRESS,
39
- initData: '0x',
40
- },
41
- {
42
- module: TARGET_MODULE_ADDRESS,
43
- initData: '0x',
44
- },
45
- {
46
- module: HOOK_ADDRESS,
47
- initData: '0x',
48
- },
49
- ],
50
- [
51
- {
52
- module: TARGET_MODULE_ADDRESS,
53
- initData: encodeAbiParameters([
54
- { name: 'selector', type: 'bytes4' },
55
- { name: 'flags', type: 'bytes1' },
56
- { name: 'data', type: 'bytes' },
57
- ], ['0x3a5be8cb', '0x00', '0x']),
58
- },
59
- ],
60
- [],
61
- [RHINESTONE_ATTESTER_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS],
62
- 1,
30
+ moduleSetup.validators.map((v) => ({
31
+ module: v.address,
32
+ initData: v.initData,
33
+ })),
34
+ moduleSetup.executors.map((e) => ({
35
+ module: e.address,
36
+ initData: e.initData,
37
+ })),
38
+ moduleSetup.fallbacks.map((f) => ({
39
+ module: f.address,
40
+ initData: f.initData,
41
+ })),
42
+ moduleSetup.hooks.map((h) => ({
43
+ module: h.address,
44
+ initData: h.initData,
45
+ })),
46
+ moduleSetup.attesters,
47
+ moduleSetup.threshold,
63
48
  ],
64
49
  }),
65
50
  SAFE_7579_ADAPTER_ADDRESS,
@@ -83,9 +68,17 @@ async function getDeployArgs(config) {
83
68
  factoryData,
84
69
  salt,
85
70
  hashedInitcode,
71
+ implementation: SAFE_SINGLETON_ADDRESS,
72
+ initializationCallData: null,
86
73
  };
87
74
  }
88
75
  }
76
+ function get7702InitCalls() {
77
+ throw new Error('EIP-7702 is not supported for Safe accounts');
78
+ }
79
+ function get7702SmartAccount() {
80
+ throw new Error('EIP-7702 is not supported for Safe accounts');
81
+ }
89
82
  function getOwners(config) {
90
83
  const ownerSet = config.owners;
91
84
  switch (ownerSet.type) {
@@ -104,4 +97,4 @@ function getThreshold(config) {
104
97
  return 1n;
105
98
  }
106
99
  }
107
- export { getDeployArgs };
100
+ export { getDeployArgs, get7702InitCalls, get7702SmartAccount };
@@ -0,0 +1,27 @@
1
+ import { type Address, type Hex, type Client } from 'viem';
2
+ import { RhinestoneAccountConfig } from '../types';
3
+ type CallType = 'call' | 'delegatecall' | 'batchcall';
4
+ interface ExecutionMode<callType extends CallType> {
5
+ type: callType;
6
+ revertOnError?: boolean;
7
+ selector?: Hex;
8
+ context?: Hex;
9
+ }
10
+ interface EncodeCallDataParams<callType extends CallType> {
11
+ mode: ExecutionMode<callType>;
12
+ callData: readonly {
13
+ to: Address;
14
+ value?: bigint | undefined;
15
+ data?: Hex | undefined;
16
+ }[];
17
+ }
18
+ interface GetAccountNonceParams {
19
+ address: Address;
20
+ entryPointAddress: Address;
21
+ key?: bigint;
22
+ }
23
+ declare function encode7579Calls<callType extends CallType>({ mode, callData, }: EncodeCallDataParams<callType>): Hex;
24
+ declare function getAccountNonce(client: Client, args: GetAccountNonceParams): Promise<bigint>;
25
+ declare function getBundlerClient(config: RhinestoneAccountConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
26
+ export { encode7579Calls, getAccountNonce,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M,6IAuBxE;AAED,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,155 @@
1
+ import { concatHex, encodeAbiParameters, encodeFunctionData, encodePacked, http, toBytes, toHex, } from 'viem';
2
+ import { readContract } from 'viem/actions';
3
+ import { getAction } from 'viem/utils';
4
+ import { createBundlerClient } from 'viem/account-abstraction';
5
+ function parseCallType(callType) {
6
+ switch (callType) {
7
+ case 'call':
8
+ return '0x00';
9
+ case 'batchcall':
10
+ return '0x01';
11
+ case 'delegatecall':
12
+ return '0xff';
13
+ }
14
+ }
15
+ function encodeExecutionMode({ type, revertOnError, selector, context, }) {
16
+ return encodePacked(['bytes1', 'bytes1', 'bytes4', 'bytes4', 'bytes22'], [
17
+ toHex(toBytes(parseCallType(type), { size: 1 })),
18
+ toHex(toBytes(revertOnError ? '0x01' : '0x00', { size: 1 })),
19
+ toHex(toBytes('0x0', { size: 4 })),
20
+ toHex(toBytes(selector ?? '0x', { size: 4 })),
21
+ toHex(toBytes(context ?? '0x', { size: 22 })),
22
+ ]);
23
+ }
24
+ function encode7579Calls({ mode, callData, }) {
25
+ if (callData.length > 1 && mode?.type !== 'batchcall') {
26
+ throw new Error(`mode ${JSON.stringify(mode)} does not supported for batchcall calldata`);
27
+ }
28
+ const executeAbi = [
29
+ {
30
+ type: 'function',
31
+ name: 'execute',
32
+ inputs: [
33
+ {
34
+ name: 'execMode',
35
+ type: 'bytes32',
36
+ internalType: 'ExecMode',
37
+ },
38
+ {
39
+ name: 'executionCalldata',
40
+ type: 'bytes',
41
+ internalType: 'bytes',
42
+ },
43
+ ],
44
+ outputs: [],
45
+ stateMutability: 'payable',
46
+ },
47
+ ];
48
+ if (callData.length > 1) {
49
+ return encodeFunctionData({
50
+ abi: executeAbi,
51
+ functionName: 'execute',
52
+ args: [
53
+ encodeExecutionMode(mode),
54
+ encodeAbiParameters([
55
+ {
56
+ name: 'executionBatch',
57
+ type: 'tuple[]',
58
+ components: [
59
+ {
60
+ name: 'target',
61
+ type: 'address',
62
+ },
63
+ {
64
+ name: 'value',
65
+ type: 'uint256',
66
+ },
67
+ {
68
+ name: 'callData',
69
+ type: 'bytes',
70
+ },
71
+ ],
72
+ },
73
+ ], [
74
+ callData.map((arg) => {
75
+ return {
76
+ target: arg.to,
77
+ value: arg.value ?? 0n,
78
+ callData: arg.data ?? '0x',
79
+ };
80
+ }),
81
+ ]),
82
+ ],
83
+ });
84
+ }
85
+ const call = callData.length === 0 ? undefined : callData[0];
86
+ if (!call) {
87
+ throw new Error('No calls to encode');
88
+ }
89
+ return encodeFunctionData({
90
+ abi: executeAbi,
91
+ functionName: 'execute',
92
+ args: [
93
+ encodeExecutionMode(mode),
94
+ concatHex([
95
+ call.to,
96
+ toHex(call.value ?? 0n, { size: 32 }),
97
+ call.data ?? '0x',
98
+ ]),
99
+ ],
100
+ });
101
+ }
102
+ async function getAccountNonce(client, args) {
103
+ const { address, entryPointAddress, key = 0n } = args;
104
+ return await getAction(client, readContract, 'readContract')({
105
+ address: entryPointAddress,
106
+ abi: [
107
+ {
108
+ inputs: [
109
+ {
110
+ name: 'sender',
111
+ type: 'address',
112
+ },
113
+ {
114
+ name: 'key',
115
+ type: 'uint192',
116
+ },
117
+ ],
118
+ name: 'getNonce',
119
+ outputs: [
120
+ {
121
+ name: 'nonce',
122
+ type: 'uint256',
123
+ },
124
+ ],
125
+ stateMutability: 'view',
126
+ type: 'function',
127
+ },
128
+ ],
129
+ functionName: 'getNonce',
130
+ args: [address, key],
131
+ });
132
+ }
133
+ function getBundlerClient(config, client) {
134
+ function getBundlerEndpoint(config, chainId) {
135
+ switch (config.type) {
136
+ case 'pimlico':
137
+ return `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${config.apiKey}`;
138
+ }
139
+ }
140
+ const { bundler } = config;
141
+ if (!bundler) {
142
+ throw new Error('Bundler is required');
143
+ }
144
+ const chainId = client.chain?.id;
145
+ if (!chainId) {
146
+ throw new Error('Chain id is required');
147
+ }
148
+ const endpoint = getBundlerEndpoint(bundler, chainId);
149
+ return createBundlerClient({
150
+ client,
151
+ transport: http(endpoint),
152
+ paymaster: true,
153
+ });
154
+ }
155
+ export { encode7579Calls, getAccountNonce, getBundlerClient };
package/dist/example.js CHANGED
@@ -7,6 +7,7 @@
7
7
  // arbitrum,
8
8
  // base,
9
9
  // optimism,
10
+ // sepolia,
10
11
  // } from 'viem/chains'
11
12
  // import {
12
13
  // Chain,
@@ -27,22 +28,19 @@
27
28
  // if (!rhinestoneApiKey) {
28
29
  // throw new Error('RHINESTONE_API_KEY is not set')
29
30
  // }
30
- // // const sourceChain = base
31
- // // const targetChain = arbitrum
32
31
  // const sourceChain = baseSepolia
33
32
  // const targetChain = arbitrumSepolia
34
- // // const usdc = getTokenAddress(sourceChain)
35
33
  // const usdcTarget = getTokenAddress(targetChain)
36
34
  // const usdcAmount = 1n
37
35
  // const fundingAccount = privateKeyToAccount(fundingPrivateKey as Hex)
38
36
  // const publicClient = createPublicClient({
39
37
  // chain: sourceChain,
40
- // transport: http(),
38
+ // transport: getTransport(sourceChain),
41
39
  // })
42
40
  // const fundingClient = createWalletClient({
43
41
  // account: fundingAccount,
44
42
  // chain: sourceChain,
45
- // transport: http(),
43
+ // transport: getTransport(sourceChain),
46
44
  // })
47
45
  // console.log('new pks', [
48
46
  // generatePrivateKey(),
@@ -50,24 +48,24 @@
50
48
  // generatePrivateKey(),
51
49
  // ])
52
50
  // const privateKeyA =
53
- // '0x207335e6a3d13577ba379d6427920f031d9a97a125574e1caede8e5d9b6e176a'
51
+ // '0xc1d2bc5a55f47783735daad366cefa85a7fbd2619a2639c1f0bef7aafe6217b0'
54
52
  // const accountA = privateKeyToAccount(privateKeyA)
55
53
  // const privateKeyB =
56
- // '0xc1cff725a1929c69569893737ae925c31cf0976e599515cda458097ad073e267'
54
+ // '0xe076077b3c53583d0eefcad6b30929cc0dfd58e9a2566cf6a059e327ec62fdbe'
57
55
  // const accountB = privateKeyToAccount(privateKeyB)
58
56
  // const privateKeyC =
59
- // '0xcb4c6331c960640e761301d8bcc4a08b77dd5dc825b5fd898568c112a0f808fe'
57
+ // '0x34afca21087883dba533ecf1d9d705dd2ab8a1933e98db704bb7d9ff83edcaa8'
60
58
  // const accountC = privateKeyToAccount(privateKeyC)
61
59
  // const rhinestoneAccount = await createRhinestoneAccount({
62
60
  // account: {
63
- // type: 'safe',
61
+ // type: 'nexus',
64
62
  // },
65
63
  // owners: {
66
64
  // type: 'ecdsa',
67
65
  // accounts: [accountA, accountB, accountC],
68
66
  // threshold: 2,
69
- // // accounts: [accountA],
70
67
  // },
68
+ // sessions: [],
71
69
  // rhinestoneApiKey,
72
70
  // deployerAccount: fundingAccount,
73
71
  // })
@@ -84,23 +82,6 @@
84
82
  // })
85
83
  // await publicClient.waitForTransactionReceipt({ hash: txHash })
86
84
  // }
87
- // // const usdcBalance = await publicClient.readContract({
88
- // // address: usdc,
89
- // // abi: erc20Abi,
90
- // // functionName: 'balanceOf',
91
- // // args: [address],
92
- // // })
93
- // // if (usdcBalance < usdcAmount) {
94
- // // const txHash2 = await fundingClient.sendTransaction({
95
- // // to: usdc,
96
- // // data: encodeFunctionData({
97
- // // abi: erc20Abi,
98
- // // functionName: 'transfer',
99
- // // args: [address, usdcAmount],
100
- // // }),
101
- // // })
102
- // // await publicClient.waitForTransactionReceipt({ hash: txHash2 })
103
- // // }
104
85
  // const bundleId = await rhinestoneAccount.sendTransactions({
105
86
  // sourceChain,
106
87
  // targetChain,
@@ -127,6 +108,8 @@
127
108
  // console.log('status', bundleResult.status)
128
109
  // function getTokenAddress(chain: Chain) {
129
110
  // switch (chain.id) {
111
+ // case sepolia.id:
112
+ // return '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238'
130
113
  // case baseSepolia.id:
131
114
  // return '0x036cbd53842c5426634e7929541ec2318f3dcf7e'
132
115
  // case arbitrumSepolia.id:
@@ -143,3 +126,9 @@
143
126
  // throw new Error('Unsupported chain')
144
127
  // }
145
128
  // }
129
+ // function getTransport(chain: Chain) {
130
+ // if (chain.id === sepolia.id) {
131
+ // return http('https://ethereum-sepolia-rpc.publicnode.com')
132
+ // }
133
+ // return http()
134
+ // }
@@ -1,6 +1,6 @@
1
- import { type BundleResult } from './orchestrator';
1
+ import { type BundleResult } from '../orchestrator';
2
2
  import { RhinestoneAccountConfig, Transaction } from '../types';
3
3
  declare function sendTransactions(config: RhinestoneAccountConfig, transaction: Transaction): Promise<bigint>;
4
4
  declare function waitForExecution(config: RhinestoneAccountConfig, id: bigint): Promise<BundleResult>;
5
5
  export { sendTransactions, waitForExecution };
6
- //# sourceMappingURL=transaction.d.ts.map
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../execution/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,YAAY,EAQlB,MAAM,iBAAiB,CAAA;AAaxB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAY,MAAM,UAAU,CAAA;AAIzE,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,mBA4DzB;AAED,iBAAe,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,EAAE,MAAM,yBAe1E;AAkCD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}