@rhinestone/sdk 0.1.0 → 0.2.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.
- package/dist/example.js +40 -24
- package/dist/services/{account.d.ts → account/index.d.ts} +3 -3
- package/dist/services/account/index.d.ts.map +1 -0
- package/dist/services/account/index.js +54 -0
- package/dist/services/account/nexus.d.ts +9 -0
- package/dist/services/account/nexus.d.ts.map +1 -0
- package/dist/services/account/nexus.js +67 -0
- package/dist/services/account/safe.d.ts +9 -0
- package/dist/services/account/safe.d.ts.map +1 -0
- package/dist/services/account/safe.js +107 -0
- package/dist/services/modules.d.ts +2 -4
- package/dist/services/modules.d.ts.map +1 -1
- package/dist/services/modules.js +6 -14
- package/dist/services/orchestrator/utils.d.ts.map +1 -1
- package/dist/services/transaction.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/services/account.d.ts.map +0 -1
- package/dist/services/account.js +0 -127
package/dist/example.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
|
|
3
|
-
// import {
|
|
3
|
+
// import {
|
|
4
|
+
// baseSepolia,
|
|
5
|
+
// arbitrumSepolia,
|
|
6
|
+
// optimismSepolia,
|
|
7
|
+
// arbitrum,
|
|
8
|
+
// base,
|
|
9
|
+
// optimism,
|
|
10
|
+
// } from 'viem/chains'
|
|
4
11
|
// import {
|
|
5
12
|
// Chain,
|
|
6
13
|
// createPublicClient,
|
|
@@ -10,7 +17,6 @@
|
|
|
10
17
|
// Hex,
|
|
11
18
|
// http,
|
|
12
19
|
// parseEther,
|
|
13
|
-
// parseUnits,
|
|
14
20
|
// } from 'viem'
|
|
15
21
|
// import { createRhinestoneAccount } from './index'
|
|
16
22
|
// const fundingPrivateKey = process.env.FUNDING_PRIVATE_KEY
|
|
@@ -21,9 +27,11 @@
|
|
|
21
27
|
// if (!rhinestoneApiKey) {
|
|
22
28
|
// throw new Error('RHINESTONE_API_KEY is not set')
|
|
23
29
|
// }
|
|
30
|
+
// // const sourceChain = base
|
|
31
|
+
// // const targetChain = arbitrum
|
|
24
32
|
// const sourceChain = baseSepolia
|
|
25
33
|
// const targetChain = arbitrumSepolia
|
|
26
|
-
// const usdc = getTokenAddress(sourceChain)
|
|
34
|
+
// // const usdc = getTokenAddress(sourceChain)
|
|
27
35
|
// const usdcTarget = getTokenAddress(targetChain)
|
|
28
36
|
// const usdcAmount = 1n
|
|
29
37
|
// const fundingAccount = privateKeyToAccount(fundingPrivateKey as Hex)
|
|
@@ -42,13 +50,13 @@
|
|
|
42
50
|
// generatePrivateKey(),
|
|
43
51
|
// ])
|
|
44
52
|
// const privateKeyA =
|
|
45
|
-
// '
|
|
53
|
+
// '0x207335e6a3d13577ba379d6427920f031d9a97a125574e1caede8e5d9b6e176a'
|
|
46
54
|
// const accountA = privateKeyToAccount(privateKeyA)
|
|
47
55
|
// const privateKeyB =
|
|
48
|
-
// '
|
|
56
|
+
// '0xc1cff725a1929c69569893737ae925c31cf0976e599515cda458097ad073e267'
|
|
49
57
|
// const accountB = privateKeyToAccount(privateKeyB)
|
|
50
58
|
// const privateKeyC =
|
|
51
|
-
// '
|
|
59
|
+
// '0xcb4c6331c960640e761301d8bcc4a08b77dd5dc825b5fd898568c112a0f808fe'
|
|
52
60
|
// const accountC = privateKeyToAccount(privateKeyC)
|
|
53
61
|
// const rhinestoneAccount = await createRhinestoneAccount({
|
|
54
62
|
// account: {
|
|
@@ -56,7 +64,9 @@
|
|
|
56
64
|
// },
|
|
57
65
|
// owners: {
|
|
58
66
|
// type: 'ecdsa',
|
|
59
|
-
// accounts: [accountA, accountB],
|
|
67
|
+
// accounts: [accountA, accountB, accountC],
|
|
68
|
+
// threshold: 2,
|
|
69
|
+
// // accounts: [accountA],
|
|
60
70
|
// },
|
|
61
71
|
// rhinestoneApiKey,
|
|
62
72
|
// deployerAccount: fundingAccount,
|
|
@@ -74,23 +84,23 @@
|
|
|
74
84
|
// })
|
|
75
85
|
// await publicClient.waitForTransactionReceipt({ hash: txHash })
|
|
76
86
|
// }
|
|
77
|
-
// const usdcBalance = await publicClient.readContract({
|
|
78
|
-
// address: usdc,
|
|
79
|
-
// abi: erc20Abi,
|
|
80
|
-
// functionName: 'balanceOf',
|
|
81
|
-
// args: [address],
|
|
82
|
-
// })
|
|
83
|
-
// if (usdcBalance < usdcAmount) {
|
|
84
|
-
// const txHash2 = await fundingClient.sendTransaction({
|
|
85
|
-
// to: usdc,
|
|
86
|
-
// data: encodeFunctionData({
|
|
87
|
-
// abi: erc20Abi,
|
|
88
|
-
// functionName: 'transfer',
|
|
89
|
-
// args: [address, usdcAmount],
|
|
90
|
-
// }),
|
|
91
|
-
// })
|
|
92
|
-
// await publicClient.waitForTransactionReceipt({ hash: txHash2 })
|
|
93
|
-
// }
|
|
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
|
+
// // }
|
|
94
104
|
// const bundleId = await rhinestoneAccount.sendTransactions({
|
|
95
105
|
// sourceChain,
|
|
96
106
|
// targetChain,
|
|
@@ -123,6 +133,12 @@
|
|
|
123
133
|
// return '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d'
|
|
124
134
|
// case optimismSepolia.id:
|
|
125
135
|
// return '0x5fd84259d66Cd46123540766Be93DFE6D43130D7'
|
|
136
|
+
// case base.id:
|
|
137
|
+
// return '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
|
|
138
|
+
// case arbitrum.id:
|
|
139
|
+
// return '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'
|
|
140
|
+
// case optimism.id:
|
|
141
|
+
// return '0x0b2c639c533813f4aa9d7837caf62653d097ff85'
|
|
126
142
|
// default:
|
|
127
143
|
// throw new Error('Unsupported chain')
|
|
128
144
|
// }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RhinestoneAccountConfig } from '
|
|
1
|
+
import { Account, Chain } from 'viem';
|
|
2
|
+
import { RhinestoneAccountConfig } from '../../types';
|
|
3
3
|
declare function getAddress(config: RhinestoneAccountConfig): Promise<`0x${string}`>;
|
|
4
4
|
declare function isDeployed(chain: Chain, config: RhinestoneAccountConfig): Promise<boolean>;
|
|
5
5
|
declare function deploy(deployer: Account, chain: Chain, config: RhinestoneAccountConfig): Promise<void>;
|
|
@@ -10,4 +10,4 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): Promise<{
|
|
|
10
10
|
hashedInitcode: `0x${string}`;
|
|
11
11
|
}>;
|
|
12
12
|
export { getAddress, isDeployed, getDeployArgs, deploy };
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../services/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAQN,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAKrD,iBAAe,UAAU,CAAC,MAAM,EAAE,uBAAuB,0BAUxD;AAED,iBAAe,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,oBAgBtE;AAED,iBAAe,MAAM,CACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,iBAiBhC;AAED,iBAAe,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;GAS3D;AAED,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createPublicClient, http, createWalletClient, size, keccak256, encodePacked, slice, } from 'viem';
|
|
2
|
+
import { getDeployArgs as getSafeDeployArgs } from './safe';
|
|
3
|
+
import { getDeployArgs as getNexusDeployArgs } from './nexus';
|
|
4
|
+
async function getAddress(config) {
|
|
5
|
+
const { factory, salt, hashedInitcode } = await getDeployArgs(config);
|
|
6
|
+
const hash = keccak256(encodePacked(['bytes1', 'address', 'bytes32', 'bytes'], ['0xff', factory, salt, hashedInitcode]));
|
|
7
|
+
const address = slice(hash, 12, 32);
|
|
8
|
+
return address;
|
|
9
|
+
}
|
|
10
|
+
async function isDeployed(chain, config) {
|
|
11
|
+
const publicClient = createPublicClient({
|
|
12
|
+
chain: chain,
|
|
13
|
+
transport: http(),
|
|
14
|
+
});
|
|
15
|
+
const address = await getAddress(config);
|
|
16
|
+
const code = await publicClient.getCode({
|
|
17
|
+
address,
|
|
18
|
+
});
|
|
19
|
+
if (!code) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (code.startsWith('0xef0100') && code.length === 48) {
|
|
23
|
+
throw new Error('EIP-7702 accounts are not yet supported');
|
|
24
|
+
}
|
|
25
|
+
return size(code) > 0;
|
|
26
|
+
}
|
|
27
|
+
async function deploy(deployer, chain, config) {
|
|
28
|
+
const { factory, factoryData } = await getDeployArgs(config);
|
|
29
|
+
const publicClient = createPublicClient({
|
|
30
|
+
chain: chain,
|
|
31
|
+
transport: http(),
|
|
32
|
+
});
|
|
33
|
+
const client = createWalletClient({
|
|
34
|
+
account: deployer,
|
|
35
|
+
chain: chain,
|
|
36
|
+
transport: http(),
|
|
37
|
+
});
|
|
38
|
+
const tx = await client.sendTransaction({
|
|
39
|
+
to: factory,
|
|
40
|
+
data: factoryData,
|
|
41
|
+
});
|
|
42
|
+
await publicClient.waitForTransactionReceipt({ hash: tx });
|
|
43
|
+
}
|
|
44
|
+
async function getDeployArgs(config) {
|
|
45
|
+
switch (config.account.type) {
|
|
46
|
+
case 'safe': {
|
|
47
|
+
return getSafeDeployArgs(config);
|
|
48
|
+
}
|
|
49
|
+
case 'nexus': {
|
|
50
|
+
return getNexusDeployArgs(config);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export { getAddress, isDeployed, getDeployArgs, deploy };
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}>;
|
|
8
|
+
export { getDeployArgs };
|
|
9
|
+
//# sourceMappingURL=nexus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../services/account/nexus.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAkBrD,iBAAe,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;GAqE3D;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { concat, encodeAbiParameters, encodeFunctionData, keccak256, parseAbi, encodePacked, zeroAddress, } from 'viem';
|
|
2
|
+
import { getValidator, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, RHINESTONE_MODULE_REGISTRY_ADDRESS, } from '../modules';
|
|
3
|
+
import { HOOK_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, TARGET_MODULE_ADDRESS, } from '../orchestrator';
|
|
4
|
+
const NEXUS_FACTORY_ADDRESS = '0x000000c3A93d2c5E02Cb053AC675665b1c4217F9';
|
|
5
|
+
const NEXUS_BOOTSTRAP_ADDRESS = '0x879fa30248eeb693dcCE3eA94a743622170a3658';
|
|
6
|
+
async function getDeployArgs(config) {
|
|
7
|
+
const salt = keccak256('0x');
|
|
8
|
+
const initData = encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [
|
|
9
|
+
NEXUS_BOOTSTRAP_ADDRESS,
|
|
10
|
+
encodeFunctionData({
|
|
11
|
+
abi: parseAbi([
|
|
12
|
+
'struct BootstrapConfig {address module;bytes initData;}',
|
|
13
|
+
'function initNexus(BootstrapConfig[] calldata validators,BootstrapConfig[] calldata executors,BootstrapConfig calldata hook,BootstrapConfig[] calldata fallbacks,address registry,address[] calldata attesters,uint8 threshold) external',
|
|
14
|
+
]),
|
|
15
|
+
functionName: 'initNexus',
|
|
16
|
+
args: [
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
module: getValidator(config).address,
|
|
20
|
+
initData: getValidator(config).initData,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
module: SAME_CHAIN_MODULE_ADDRESS,
|
|
26
|
+
initData: '0x',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
module: TARGET_MODULE_ADDRESS,
|
|
30
|
+
initData: '0x',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
module: HOOK_ADDRESS,
|
|
34
|
+
initData: '0x',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
{
|
|
38
|
+
module: zeroAddress,
|
|
39
|
+
initData: '0x',
|
|
40
|
+
},
|
|
41
|
+
[
|
|
42
|
+
{
|
|
43
|
+
module: TARGET_MODULE_ADDRESS,
|
|
44
|
+
initData: encodePacked(['bytes4', 'bytes1', 'bytes'], ['0x3a5be8cb', '0x00', '0x']),
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
48
|
+
[RHINESTONE_ATTESTER_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS],
|
|
49
|
+
1,
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
52
|
+
]);
|
|
53
|
+
const factoryData = encodeFunctionData({
|
|
54
|
+
abi: parseAbi(['function createAccount(bytes,bytes32)']),
|
|
55
|
+
functionName: 'createAccount',
|
|
56
|
+
args: [initData, salt],
|
|
57
|
+
});
|
|
58
|
+
const actualSalt = keccak256(concat([initData, salt]));
|
|
59
|
+
const hashedInitcode = '0xbf5658acdb0d71e91f2e2ac658b87c63b81f244ccb8c0aef176c5e397e08c2ba';
|
|
60
|
+
return {
|
|
61
|
+
factory: NEXUS_FACTORY_ADDRESS,
|
|
62
|
+
factoryData,
|
|
63
|
+
salt: actualSalt,
|
|
64
|
+
hashedInitcode,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export { getDeployArgs };
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}>;
|
|
8
|
+
export { getDeployArgs };
|
|
9
|
+
//# sourceMappingURL=safe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../services/account/safe.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAmBrD,iBAAe,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;GAyF3D;AAsBD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
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';
|
|
4
|
+
const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
|
|
5
|
+
const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
|
|
6
|
+
const SAFE_SINGLETON_ADDRESS = '0x29fcb43b46531bca003ddc8fcb67ffe91900c762';
|
|
7
|
+
const SAFE_PROXY_FACTORY_ADDRESS = '0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67';
|
|
8
|
+
const NO_SAFE_OWNER_ADDRESS = '0xbabe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e72';
|
|
9
|
+
async function getDeployArgs(config) {
|
|
10
|
+
{
|
|
11
|
+
const owners = getOwners(config);
|
|
12
|
+
const threshold = getThreshold(config);
|
|
13
|
+
const initData = encodeFunctionData({
|
|
14
|
+
abi: parseAbi([
|
|
15
|
+
'function setup(address[] calldata _owners,uint256 _threshold,address to,bytes calldata data,address fallbackHandler,address paymentToken,uint256 payment, address paymentReceiver) external',
|
|
16
|
+
]),
|
|
17
|
+
functionName: 'setup',
|
|
18
|
+
args: [
|
|
19
|
+
owners,
|
|
20
|
+
threshold,
|
|
21
|
+
SAFE_7579_LAUNCHPAD_ADDRESS,
|
|
22
|
+
encodeFunctionData({
|
|
23
|
+
abi: parseAbi([
|
|
24
|
+
'struct ModuleInit {address module;bytes initData;}',
|
|
25
|
+
'function addSafe7579(address safe7579,ModuleInit[] calldata validators,ModuleInit[] calldata executors,ModuleInit[] calldata fallbacks, ModuleInit[] calldata hooks,address[] calldata attesters,uint8 threshold) external',
|
|
26
|
+
]),
|
|
27
|
+
functionName: 'addSafe7579',
|
|
28
|
+
args: [
|
|
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,
|
|
63
|
+
],
|
|
64
|
+
}),
|
|
65
|
+
SAFE_7579_ADAPTER_ADDRESS,
|
|
66
|
+
zeroAddress,
|
|
67
|
+
BigInt(0),
|
|
68
|
+
zeroAddress,
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
const saltNonce = 0n;
|
|
72
|
+
const factoryData = encodeFunctionData({
|
|
73
|
+
abi: parseAbi([
|
|
74
|
+
'function createProxyWithNonce(address singleton,bytes calldata initializer,uint256 saltNonce) external payable returns (address)',
|
|
75
|
+
]),
|
|
76
|
+
functionName: 'createProxyWithNonce',
|
|
77
|
+
args: [SAFE_SINGLETON_ADDRESS, initData, saltNonce],
|
|
78
|
+
});
|
|
79
|
+
const salt = keccak256(encodePacked(['bytes32', 'uint256'], [keccak256(initData), saltNonce]));
|
|
80
|
+
const hashedInitcode = '0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee';
|
|
81
|
+
return {
|
|
82
|
+
factory: SAFE_PROXY_FACTORY_ADDRESS,
|
|
83
|
+
factoryData,
|
|
84
|
+
salt,
|
|
85
|
+
hashedInitcode,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function getOwners(config) {
|
|
90
|
+
const ownerSet = config.owners;
|
|
91
|
+
switch (ownerSet.type) {
|
|
92
|
+
case 'ecdsa':
|
|
93
|
+
return ownerSet.accounts.map((account) => account.address);
|
|
94
|
+
case 'passkey':
|
|
95
|
+
return [NO_SAFE_OWNER_ADDRESS];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function getThreshold(config) {
|
|
99
|
+
const ownerSet = config.owners;
|
|
100
|
+
switch (ownerSet.type) {
|
|
101
|
+
case 'ecdsa':
|
|
102
|
+
return ownerSet.threshold ? BigInt(ownerSet.threshold) : 1n;
|
|
103
|
+
case 'passkey':
|
|
104
|
+
return 1n;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export { getDeployArgs };
|
|
@@ -22,13 +22,11 @@ interface WebauthnSignature {
|
|
|
22
22
|
r: bigint;
|
|
23
23
|
s: bigint;
|
|
24
24
|
}
|
|
25
|
-
declare const SAFE_7579_LAUNCHPAD_ADDRESS: Address;
|
|
26
|
-
declare const SAFE_7579_ADAPTER_ADDRESS: Address;
|
|
27
25
|
declare const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS: Address;
|
|
26
|
+
declare const RHINESTONE_MODULE_REGISTRY_ADDRESS: Address;
|
|
28
27
|
declare const RHINESTONE_ATTESTER_ADDRESS: Address;
|
|
29
|
-
declare function toOwners(config: RhinestoneAccountConfig): `0x${string}`[];
|
|
30
28
|
declare function getValidator(config: RhinestoneAccountConfig): Module;
|
|
31
29
|
export declare function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled, }: WebauthnValidatorSignature): `0x${string}`;
|
|
32
30
|
export declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
33
|
-
export { getValidator,
|
|
31
|
+
export { getValidator, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_MODULE_REGISTRY_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, };
|
|
34
32
|
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../services/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,KAAK,EAEL,GAAG,EAIJ,MAAM,MAAM,CAAA;AAYb,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAA;AAEhE,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,UAAU,CAAA;CACjB;AAcD,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,UAAU,0BAA0B;IAClC,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,EAAE,iBAAiB,GAAG,GAAG,GAAG,UAAU,CAAA;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,UAAU,iBAAiB;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../services/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,KAAK,EAEL,GAAG,EAIJ,MAAM,MAAM,CAAA;AAYb,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAElD,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAA;AAEhE,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,UAAU,CAAA;CACjB;AAcD,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,UAAU,0BAA0B;IAClC,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,EAAE,iBAAiB,GAAG,GAAG,GAAG,UAAU,CAAA;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,UAAU,iBAAiB;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,QAAA,MAAM,kCAAkC,EAAE,OACI,CAAA;AAE9C,QAAA,MAAM,kCAAkC,EAAE,OACI,CAAA;AAC9C,QAAA,MAAM,2BAA2B,EAAE,OACW,CAAA;AAM9C,iBAAS,YAAY,CAAC,MAAM,EAAE,uBAAuB,UAcpD;AAqFD,wBAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EACR,SAAS,EACT,cAAsB,GACvB,EAAE,0BAA0B,iBA6C5B;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAarD;AA0BD,OAAO,EACL,YAAY,EACZ,kCAAkC,EAClC,kCAAkC,EAClC,2BAA2B,GAC5B,CAAA"}
|
package/dist/services/modules.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { bytesToHex, encodeAbiParameters, hexToBytes, keccak256, toHex, } from 'viem';
|
|
2
2
|
import { arbitrum, arbitrumSepolia, base, baseSepolia, optimism, optimismSepolia, polygon, polygonAmoy, } from 'viem/chains';
|
|
3
|
-
const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
|
|
4
|
-
const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
|
|
5
3
|
const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS = '0x6D0515e8E499468DCe9583626f0cA15b887f9d03';
|
|
4
|
+
const RHINESTONE_MODULE_REGISTRY_ADDRESS = '0x000000000069e2a187aeffb852bf3ccdc95151b2';
|
|
6
5
|
const RHINESTONE_ATTESTER_ADDRESS = '0x000000333034E9f539ce08819E12c1b8Cb29084d';
|
|
7
6
|
const OWNABLE_VALIDATOR_ADDRESS = '0x2483DA3A338895199E5e538530213157e931Bf06';
|
|
8
7
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x2f167e55d42584f65e2e30a748f41ee75a311414';
|
|
9
|
-
const NO_SAFE_OWNER_ADDRESS = '0xbabe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e72';
|
|
10
|
-
function toOwners(config) {
|
|
11
|
-
const ownerSet = config.owners;
|
|
12
|
-
switch (ownerSet.type) {
|
|
13
|
-
case 'ecdsa':
|
|
14
|
-
return ownerSet.accounts.map((account) => account.address);
|
|
15
|
-
case 'passkey':
|
|
16
|
-
return [NO_SAFE_OWNER_ADDRESS];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
8
|
function getValidator(config) {
|
|
20
9
|
const ownerSet = config.owners;
|
|
21
10
|
switch (ownerSet.type) {
|
|
@@ -37,7 +26,10 @@ function getOwnableValidator({ threshold, owners, }) {
|
|
|
37
26
|
initData: encodeAbiParameters([
|
|
38
27
|
{ name: 'threshold', type: 'uint256' },
|
|
39
28
|
{ name: 'owners', type: 'address[]' },
|
|
40
|
-
], [
|
|
29
|
+
], [
|
|
30
|
+
BigInt(threshold),
|
|
31
|
+
owners.map((owner) => owner.toLowerCase()).sort(),
|
|
32
|
+
]),
|
|
41
33
|
deInitData: '0x',
|
|
42
34
|
additionalContext: '0x',
|
|
43
35
|
type: 'validator',
|
|
@@ -171,4 +163,4 @@ function parsePublicKey(publicKey) {
|
|
|
171
163
|
y: BigInt(bytesToHex(y)),
|
|
172
164
|
};
|
|
173
165
|
}
|
|
174
|
-
export { getValidator,
|
|
166
|
+
export { getValidator, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_MODULE_REGISTRY_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,GAAG,EAGJ,MAAM,MAAM,CAAA;AAEb,OAAO,EACL,WAAW,EAEX,iBAAiB,EAIlB,MAAM,SAAS,CAAA;AAYhB,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,GAAG,GAAG,CAMtE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAwBjD;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB,CAiCrE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,GAAG,GAAG,WAAW,CAkClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../services/transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../services/transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,YAAY,EAQlB,MAAM,gBAAgB,CAAA;AAOvB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAY,MAAM,UAAU,CAAA;AAEzE,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,mBAiEzB;AAED,iBAAe,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,EAAE,MAAM,yBAa1E;AAmCD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,eAAe,CAAA;CACzB;AAED,KAAK,QAAQ,GAAG,sBAAsB,GAAG,uBAAuB,CAAA;AAChE,UAAU,uBAAuB;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,eAAe,CAAA;CACzB;AAED,KAAK,QAAQ,GAAG,sBAAsB,GAAG,uBAAuB,CAAA;AAChE,UAAU,uBAAuB;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;IACD,MAAM,EAAE,QAAQ,CAAA;IAChB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,SAAS,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,SAAS,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,UAAU,IAAI;IACZ,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,YAAY;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,WAAW;IACnB,WAAW,EAAE,KAAK,CAAA;IAClB,WAAW,EAAE,KAAK,CAAA;IAClB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B;AAED,YAAY,EAAE,uBAAuB,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../services/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAQL,OAAO,EAOR,MAAM,MAAM,CAAA;AAOb,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAelD,iBAAe,UAAU,CAAC,MAAM,EAAE,uBAAuB,0BAUxD;AAED,iBAAe,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,oBAgBtE;AAED,iBAAe,MAAM,CACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,iBAiBhC;AAED,iBAAe,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;GA6F3D;AAED,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/services/account.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { createPublicClient, http, encodeAbiParameters, encodeFunctionData, parseAbi, zeroAddress, createWalletClient, size, keccak256, encodePacked, slice, } from 'viem';
|
|
2
|
-
import { HOOK_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, TARGET_MODULE_ADDRESS, } from './orchestrator';
|
|
3
|
-
import { getValidator, toOwners, SAFE_7579_LAUNCHPAD_ADDRESS, SAFE_7579_ADAPTER_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, } from './modules';
|
|
4
|
-
const SAFE_SINGLETON_ADDRESS = '0x29fcb43b46531bca003ddc8fcb67ffe91900c762';
|
|
5
|
-
const SAFE_PROXY_FACTORY_ADDRESS = '0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67';
|
|
6
|
-
async function getAddress(config) {
|
|
7
|
-
const { factory, salt, hashedInitcode } = await getDeployArgs(config);
|
|
8
|
-
const hash = keccak256(encodePacked(['bytes1', 'address', 'bytes32', 'bytes'], ['0xff', factory, salt, hashedInitcode]));
|
|
9
|
-
const address = slice(hash, 12, 32);
|
|
10
|
-
return address;
|
|
11
|
-
}
|
|
12
|
-
async function isDeployed(chain, config) {
|
|
13
|
-
const publicClient = createPublicClient({
|
|
14
|
-
chain: chain,
|
|
15
|
-
transport: http(),
|
|
16
|
-
});
|
|
17
|
-
const address = await getAddress(config);
|
|
18
|
-
const code = await publicClient.getCode({
|
|
19
|
-
address,
|
|
20
|
-
});
|
|
21
|
-
if (!code) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (code.startsWith('0xef0100') && code.length === 48) {
|
|
25
|
-
throw new Error('EIP-7702 accounts are not yet supported');
|
|
26
|
-
}
|
|
27
|
-
return size(code) > 0;
|
|
28
|
-
}
|
|
29
|
-
async function deploy(deployer, chain, config) {
|
|
30
|
-
const { factory, factoryData } = await getDeployArgs(config);
|
|
31
|
-
const publicClient = createPublicClient({
|
|
32
|
-
chain: chain,
|
|
33
|
-
transport: http(),
|
|
34
|
-
});
|
|
35
|
-
const client = createWalletClient({
|
|
36
|
-
account: deployer,
|
|
37
|
-
chain: chain,
|
|
38
|
-
transport: http(),
|
|
39
|
-
});
|
|
40
|
-
const tx = await client.sendTransaction({
|
|
41
|
-
to: factory,
|
|
42
|
-
data: factoryData,
|
|
43
|
-
});
|
|
44
|
-
await publicClient.waitForTransactionReceipt({ hash: tx });
|
|
45
|
-
}
|
|
46
|
-
async function getDeployArgs(config) {
|
|
47
|
-
switch (config.account.type) {
|
|
48
|
-
case 'safe': {
|
|
49
|
-
const owners = toOwners(config);
|
|
50
|
-
const initializer = encodeFunctionData({
|
|
51
|
-
abi: parseAbi([
|
|
52
|
-
'function setup(address[] calldata _owners,uint256 _threshold,address to,bytes calldata data,address fallbackHandler,address paymentToken,uint256 payment, address paymentReceiver) external',
|
|
53
|
-
]),
|
|
54
|
-
functionName: 'setup',
|
|
55
|
-
args: [
|
|
56
|
-
owners,
|
|
57
|
-
BigInt(1),
|
|
58
|
-
SAFE_7579_LAUNCHPAD_ADDRESS,
|
|
59
|
-
encodeFunctionData({
|
|
60
|
-
abi: parseAbi([
|
|
61
|
-
'struct ModuleInit {address module;bytes initData;}',
|
|
62
|
-
'function addSafe7579(address safe7579,ModuleInit[] calldata validators,ModuleInit[] calldata executors,ModuleInit[] calldata fallbacks, ModuleInit[] calldata hooks,address[] calldata attesters,uint8 threshold) external',
|
|
63
|
-
]),
|
|
64
|
-
functionName: 'addSafe7579',
|
|
65
|
-
args: [
|
|
66
|
-
SAFE_7579_ADAPTER_ADDRESS,
|
|
67
|
-
[
|
|
68
|
-
{
|
|
69
|
-
module: getValidator(config).address,
|
|
70
|
-
initData: getValidator(config).initData,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
{
|
|
75
|
-
module: SAME_CHAIN_MODULE_ADDRESS,
|
|
76
|
-
initData: '0x',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
module: TARGET_MODULE_ADDRESS,
|
|
80
|
-
initData: '0x',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
module: HOOK_ADDRESS,
|
|
84
|
-
initData: '0x',
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
[
|
|
88
|
-
{
|
|
89
|
-
module: TARGET_MODULE_ADDRESS,
|
|
90
|
-
initData: encodeAbiParameters([
|
|
91
|
-
{ name: 'selector', type: 'bytes4' },
|
|
92
|
-
{ name: 'flags', type: 'bytes1' },
|
|
93
|
-
{ name: 'data', type: 'bytes' },
|
|
94
|
-
], ['0x3a5be8cb', '0x00', '0x']),
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
[],
|
|
98
|
-
[RHINESTONE_ATTESTER_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS],
|
|
99
|
-
1,
|
|
100
|
-
],
|
|
101
|
-
}),
|
|
102
|
-
SAFE_7579_ADAPTER_ADDRESS,
|
|
103
|
-
zeroAddress,
|
|
104
|
-
BigInt(0),
|
|
105
|
-
zeroAddress,
|
|
106
|
-
],
|
|
107
|
-
});
|
|
108
|
-
const saltNonce = 0n;
|
|
109
|
-
const factoryData = encodeFunctionData({
|
|
110
|
-
abi: parseAbi([
|
|
111
|
-
'function createProxyWithNonce(address singleton,bytes calldata initializer,uint256 saltNonce) external payable returns (address)',
|
|
112
|
-
]),
|
|
113
|
-
functionName: 'createProxyWithNonce',
|
|
114
|
-
args: [SAFE_SINGLETON_ADDRESS, initializer, saltNonce],
|
|
115
|
-
});
|
|
116
|
-
const salt = keccak256(encodePacked(['bytes32', 'uint256'], [keccak256(initializer), saltNonce]));
|
|
117
|
-
const hashedInitcode = '0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee';
|
|
118
|
-
return {
|
|
119
|
-
factory: SAFE_PROXY_FACTORY_ADDRESS,
|
|
120
|
-
factoryData,
|
|
121
|
-
salt,
|
|
122
|
-
hashedInitcode,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
export { getAddress, isDeployed, getDeployArgs, deploy };
|