near-safe 0.7.0 → 0.7.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.
    
        package/dist/cjs/lib/safe.d.ts
    CHANGED
    
    | 
         @@ -11,7 +11,7 @@ export declare class SafeContractSuite { 
     | 
|
| 
       11 
11 
     | 
    
         
             
                moduleSetup: Deployment;
         
     | 
| 
       12 
12 
     | 
    
         
             
                entryPoint: Deployment;
         
     | 
| 
       13 
13 
     | 
    
         
             
                constructor();
         
     | 
| 
       14 
     | 
    
         
            -
                addressForSetup(setup: Hex, saltNonce 
     | 
| 
      
 14 
     | 
    
         
            +
                addressForSetup(setup: Hex, saltNonce: string): Promise<Address>;
         
     | 
| 
       15 
15 
     | 
    
         
             
                getSetup(owners: string[]): Hex;
         
     | 
| 
       16 
16 
     | 
    
         
             
                addOwnerData(newOwner: Address): Hex;
         
     | 
| 
       17 
17 
     | 
    
         
             
                getOpHash(chainId: number, unsignedUserOp: UserOperation): Promise<Hash>;
         
     | 
    
        package/dist/cjs/lib/safe.js
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ class SafeContractSuite { 
     | 
|
| 
       21 
21 
     | 
    
         
             
                async addressForSetup(setup, saltNonce) {
         
     | 
| 
       22 
22 
     | 
    
         
             
                    // bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
         
     | 
| 
       23 
23 
     | 
    
         
             
                    // cf: https://github.com/safe-global/safe-smart-account/blob/499b17ad0191b575fcadc5cb5b8e3faeae5391ae/contracts/proxies/SafeProxyFactory.sol#L58
         
     | 
| 
       24 
     | 
    
         
            -
                    const salt = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["bytes32", "uint256"], [(0, viem_1.keccak256)(setup), BigInt(saltNonce 
     | 
| 
      
 24 
     | 
    
         
            +
                    const salt = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["bytes32", "uint256"], [(0, viem_1.keccak256)(setup), BigInt(saltNonce)]));
         
     | 
| 
       25 
25 
     | 
    
         
             
                    // abi.encodePacked(type(SafeProxy).creationCode, uint256(uint160(_singleton)));
         
     | 
| 
       26 
26 
     | 
    
         
             
                    // cf: https://github.com/safe-global/safe-smart-account/blob/499b17ad0191b575fcadc5cb5b8e3faeae5391ae/contracts/proxies/SafeProxyFactory.sol#L29
         
     | 
| 
       27 
27 
     | 
    
         
             
                    const initCode = (0, viem_1.encodePacked)(["bytes", "uint256"], [
         
     | 
| 
         @@ -43,18 +43,18 @@ class SafeContractSuite { 
     | 
|
| 
       43 
43 
     | 
    
         
             
                        abi: this.singleton.abi,
         
     | 
| 
       44 
44 
     | 
    
         
             
                        functionName: "setup",
         
     | 
| 
       45 
45 
     | 
    
         
             
                        args: [
         
     | 
| 
       46 
     | 
    
         
            -
                            owners,
         
     | 
| 
       47 
     | 
    
         
            -
                            1, //  
     | 
| 
       48 
     | 
    
         
            -
                            this.moduleSetup.address,
         
     | 
| 
      
 46 
     | 
    
         
            +
                            owners, // _owners
         
     | 
| 
      
 47 
     | 
    
         
            +
                            1, // _threshold
         
     | 
| 
      
 48 
     | 
    
         
            +
                            this.moduleSetup.address, // to
         
     | 
| 
       49 
49 
     | 
    
         
             
                            (0, viem_1.encodeFunctionData)({
         
     | 
| 
       50 
50 
     | 
    
         
             
                                abi: this.moduleSetup.abi,
         
     | 
| 
       51 
51 
     | 
    
         
             
                                functionName: "enableModules",
         
     | 
| 
       52 
52 
     | 
    
         
             
                                args: [[this.m4337.address]],
         
     | 
| 
       53 
     | 
    
         
            -
                            }),
         
     | 
| 
       54 
     | 
    
         
            -
                            this.m4337.address,
         
     | 
| 
       55 
     | 
    
         
            -
                            viem_1.zeroAddress,
         
     | 
| 
       56 
     | 
    
         
            -
                            0,
         
     | 
| 
       57 
     | 
    
         
            -
                            viem_1.zeroAddress,
         
     | 
| 
      
 53 
     | 
    
         
            +
                            }), // data
         
     | 
| 
      
 54 
     | 
    
         
            +
                            this.m4337.address, // fallbackHandler
         
     | 
| 
      
 55 
     | 
    
         
            +
                            viem_1.zeroAddress, // paymentToken
         
     | 
| 
      
 56 
     | 
    
         
            +
                            0, // payment
         
     | 
| 
      
 57 
     | 
    
         
            +
                            viem_1.zeroAddress, // paymentReceiver
         
     | 
| 
       58 
58 
     | 
    
         
             
                        ],
         
     | 
| 
       59 
59 
     | 
    
         
             
                    });
         
     | 
| 
       60 
60 
     | 
    
         
             
                }
         
     | 
    
        package/dist/cjs/near-safe.js
    CHANGED
    
    | 
         @@ -18,7 +18,8 @@ class NearSafe { 
     | 
|
| 
       18 
18 
     | 
    
         
             
                 * @returns {Promise<NearSafe>} - A promise that resolves to a new `NearSafe` instance.
         
     | 
| 
       19 
19 
     | 
    
         
             
                 */
         
     | 
| 
       20 
20 
     | 
    
         
             
                static async create(config) {
         
     | 
| 
       21 
     | 
    
         
            -
                    const { pimlicoKey 
     | 
| 
      
 21 
     | 
    
         
            +
                    const { pimlicoKey } = config;
         
     | 
| 
      
 22 
     | 
    
         
            +
                    const safeSaltNonce = config.safeSaltNonce || constants_1.DEFAULT_SAFE_SALT_NONCE;
         
     | 
| 
       22 
23 
     | 
    
         
             
                    // const nearAdapter = await mockAdapter();
         
     | 
| 
       23 
24 
     | 
    
         
             
                    const nearAdapter = await (0, near_ca_1.setupAdapter)({ ...config });
         
     | 
| 
       24 
25 
     | 
    
         
             
                    const safePack = new safe_1.SafeContractSuite();
         
     | 
| 
         @@ -30,7 +31,7 @@ class NearSafe { 
     | 
|
| 
       30 
31 
     | 
    
         
             
                    MPC EOA: ${nearAdapter.address}
         
     | 
| 
       31 
32 
     | 
    
         
             
                    Safe: ${safeAddress}
         
     | 
| 
       32 
33 
     | 
    
         
             
                `);
         
     | 
| 
       33 
     | 
    
         
            -
                    return new NearSafe(nearAdapter, safePack, pimlicoKey, setup, safeAddress, safeSaltNonce 
     | 
| 
      
 34 
     | 
    
         
            +
                    return new NearSafe(nearAdapter, safePack, pimlicoKey, setup, safeAddress, safeSaltNonce);
         
     | 
| 
       34 
35 
     | 
    
         
             
                }
         
     | 
| 
       35 
36 
     | 
    
         
             
                /**
         
     | 
| 
       36 
37 
     | 
    
         
             
                 * Constructs a new `NearSafe` object with the provided parameters.
         
     | 
    
        package/dist/esm/lib/safe.d.ts
    CHANGED
    
    | 
         @@ -11,7 +11,7 @@ export declare class SafeContractSuite { 
     | 
|
| 
       11 
11 
     | 
    
         
             
                moduleSetup: Deployment;
         
     | 
| 
       12 
12 
     | 
    
         
             
                entryPoint: Deployment;
         
     | 
| 
       13 
13 
     | 
    
         
             
                constructor();
         
     | 
| 
       14 
     | 
    
         
            -
                addressForSetup(setup: Hex, saltNonce 
     | 
| 
      
 14 
     | 
    
         
            +
                addressForSetup(setup: Hex, saltNonce: string): Promise<Address>;
         
     | 
| 
       15 
15 
     | 
    
         
             
                getSetup(owners: string[]): Hex;
         
     | 
| 
       16 
16 
     | 
    
         
             
                addOwnerData(newOwner: Address): Hex;
         
     | 
| 
       17 
17 
     | 
    
         
             
                getOpHash(chainId: number, unsignedUserOp: UserOperation): Promise<Hash>;
         
     | 
    
        package/dist/esm/lib/safe.js
    CHANGED
    
    | 
         @@ -25,7 +25,7 @@ export class SafeContractSuite { 
     | 
|
| 
       25 
25 
     | 
    
         
             
                async addressForSetup(setup, saltNonce) {
         
     | 
| 
       26 
26 
     | 
    
         
             
                    // bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
         
     | 
| 
       27 
27 
     | 
    
         
             
                    // cf: https://github.com/safe-global/safe-smart-account/blob/499b17ad0191b575fcadc5cb5b8e3faeae5391ae/contracts/proxies/SafeProxyFactory.sol#L58
         
     | 
| 
       28 
     | 
    
         
            -
                    const salt = keccak256(encodePacked(["bytes32", "uint256"], [keccak256(setup), BigInt(saltNonce 
     | 
| 
      
 28 
     | 
    
         
            +
                    const salt = keccak256(encodePacked(["bytes32", "uint256"], [keccak256(setup), BigInt(saltNonce)]));
         
     | 
| 
       29 
29 
     | 
    
         
             
                    // abi.encodePacked(type(SafeProxy).creationCode, uint256(uint160(_singleton)));
         
     | 
| 
       30 
30 
     | 
    
         
             
                    // cf: https://github.com/safe-global/safe-smart-account/blob/499b17ad0191b575fcadc5cb5b8e3faeae5391ae/contracts/proxies/SafeProxyFactory.sol#L29
         
     | 
| 
       31 
31 
     | 
    
         
             
                    const initCode = encodePacked(["bytes", "uint256"], [
         
     | 
| 
         @@ -47,18 +47,18 @@ export class SafeContractSuite { 
     | 
|
| 
       47 
47 
     | 
    
         
             
                        abi: this.singleton.abi,
         
     | 
| 
       48 
48 
     | 
    
         
             
                        functionName: "setup",
         
     | 
| 
       49 
49 
     | 
    
         
             
                        args: [
         
     | 
| 
       50 
     | 
    
         
            -
                            owners,
         
     | 
| 
       51 
     | 
    
         
            -
                            1, //  
     | 
| 
       52 
     | 
    
         
            -
                            this.moduleSetup.address,
         
     | 
| 
      
 50 
     | 
    
         
            +
                            owners, // _owners
         
     | 
| 
      
 51 
     | 
    
         
            +
                            1, // _threshold
         
     | 
| 
      
 52 
     | 
    
         
            +
                            this.moduleSetup.address, // to
         
     | 
| 
       53 
53 
     | 
    
         
             
                            encodeFunctionData({
         
     | 
| 
       54 
54 
     | 
    
         
             
                                abi: this.moduleSetup.abi,
         
     | 
| 
       55 
55 
     | 
    
         
             
                                functionName: "enableModules",
         
     | 
| 
       56 
56 
     | 
    
         
             
                                args: [[this.m4337.address]],
         
     | 
| 
       57 
     | 
    
         
            -
                            }),
         
     | 
| 
       58 
     | 
    
         
            -
                            this.m4337.address,
         
     | 
| 
       59 
     | 
    
         
            -
                            zeroAddress,
         
     | 
| 
       60 
     | 
    
         
            -
                            0,
         
     | 
| 
       61 
     | 
    
         
            -
                            zeroAddress,
         
     | 
| 
      
 57 
     | 
    
         
            +
                            }), // data
         
     | 
| 
      
 58 
     | 
    
         
            +
                            this.m4337.address, // fallbackHandler
         
     | 
| 
      
 59 
     | 
    
         
            +
                            zeroAddress, // paymentToken
         
     | 
| 
      
 60 
     | 
    
         
            +
                            0, // payment
         
     | 
| 
      
 61 
     | 
    
         
            +
                            zeroAddress, // paymentReceiver
         
     | 
| 
       62 
62 
     | 
    
         
             
                        ],
         
     | 
| 
       63 
63 
     | 
    
         
             
                    });
         
     | 
| 
       64 
64 
     | 
    
         
             
                }
         
     | 
    
        package/dist/esm/near-safe.js
    CHANGED
    
    | 
         @@ -21,7 +21,8 @@ export class NearSafe { 
     | 
|
| 
       21 
21 
     | 
    
         
             
                 * @returns {Promise<NearSafe>} - A promise that resolves to a new `NearSafe` instance.
         
     | 
| 
       22 
22 
     | 
    
         
             
                 */
         
     | 
| 
       23 
23 
     | 
    
         
             
                static async create(config) {
         
     | 
| 
       24 
     | 
    
         
            -
                    const { pimlicoKey 
     | 
| 
      
 24 
     | 
    
         
            +
                    const { pimlicoKey } = config;
         
     | 
| 
      
 25 
     | 
    
         
            +
                    const safeSaltNonce = config.safeSaltNonce || DEFAULT_SAFE_SALT_NONCE;
         
     | 
| 
       25 
26 
     | 
    
         
             
                    // const nearAdapter = await mockAdapter();
         
     | 
| 
       26 
27 
     | 
    
         
             
                    const nearAdapter = await setupAdapter({ ...config });
         
     | 
| 
       27 
28 
     | 
    
         
             
                    const safePack = new SafeContractSuite();
         
     | 
| 
         @@ -33,7 +34,7 @@ export class NearSafe { 
     | 
|
| 
       33 
34 
     | 
    
         
             
                    MPC EOA: ${nearAdapter.address}
         
     | 
| 
       34 
35 
     | 
    
         
             
                    Safe: ${safeAddress}
         
     | 
| 
       35 
36 
     | 
    
         
             
                `);
         
     | 
| 
       36 
     | 
    
         
            -
                    return new NearSafe(nearAdapter, safePack, pimlicoKey, setup, safeAddress, safeSaltNonce 
     | 
| 
      
 37 
     | 
    
         
            +
                    return new NearSafe(nearAdapter, safePack, pimlicoKey, setup, safeAddress, safeSaltNonce);
         
     | 
| 
       37 
38 
     | 
    
         
             
                }
         
     | 
| 
       38 
39 
     | 
    
         
             
                /**
         
     | 
| 
       39 
40 
     | 
    
         
             
                 * Constructs a new `NearSafe` object with the provided parameters.
         
     |