near-safe 0.8.1 → 0.8.3
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/decode.js +1 -1
 - package/dist/cjs/index.d.ts +2 -1
 - package/dist/cjs/index.js +1 -0
 - package/dist/cjs/near-safe.js +7 -5
 - package/dist/esm/decode.js +1 -1
 - package/dist/esm/index.d.ts +2 -1
 - package/dist/esm/index.js +1 -0
 - package/dist/esm/near-safe.js +8 -6
 - package/package.json +1 -1
 
    
        package/dist/cjs/decode.js
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ const safe_message_1 = require("./lib/safe-message"); 
     | 
|
| 
       19 
19 
     | 
    
         
             
            function decodeTxData({ evmMessage, chainId, }) {
         
     | 
| 
       20 
20 
     | 
    
         
             
                const data = evmMessage;
         
     | 
| 
       21 
21 
     | 
    
         
             
                if ((0, safe_message_1.isRlpHex)(evmMessage)) {
         
     | 
| 
       22 
     | 
    
         
            -
                    decodeRlpHex(chainId, evmMessage);
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return decodeRlpHex(chainId, evmMessage);
         
     | 
| 
       23 
23 
     | 
    
         
             
                }
         
     | 
| 
       24 
24 
     | 
    
         
             
                if ((0, safe_message_1.isTransactionSerializable)(data)) {
         
     | 
| 
       25 
25 
     | 
    
         
             
                    return decodeTransactionSerializable(chainId, data);
         
     | 
    
        package/dist/cjs/index.d.ts
    CHANGED
    
    | 
         @@ -3,4 +3,5 @@ export * from "./types"; 
     | 
|
| 
       3 
3 
     | 
    
         
             
            export * from "./util";
         
     | 
| 
       4 
4 
     | 
    
         
             
            export * from "./constants";
         
     | 
| 
       5 
5 
     | 
    
         
             
            export * from "./decode";
         
     | 
| 
       6 
     | 
    
         
            -
            export  
     | 
| 
      
 6 
     | 
    
         
            +
            export * from "./lib/safe-message";
         
     | 
| 
      
 7 
     | 
    
         
            +
            export { Network, BaseTx, SignRequestData, populateTx, NetworkFields, signatureFromOutcome, signatureFromTxHash, requestRouter as mpcRequestRouter, EthTransactionParams, } from "near-ca";
         
     | 
    
        package/dist/cjs/index.js
    CHANGED
    
    | 
         @@ -20,6 +20,7 @@ __exportStar(require("./types"), exports); 
     | 
|
| 
       20 
20 
     | 
    
         
             
            __exportStar(require("./util"), exports);
         
     | 
| 
       21 
21 
     | 
    
         
             
            __exportStar(require("./constants"), exports);
         
     | 
| 
       22 
22 
     | 
    
         
             
            __exportStar(require("./decode"), exports);
         
     | 
| 
      
 23 
     | 
    
         
            +
            __exportStar(require("./lib/safe-message"), exports);
         
     | 
| 
       23 
24 
     | 
    
         
             
            var near_ca_1 = require("near-ca");
         
     | 
| 
       24 
25 
     | 
    
         
             
            Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return near_ca_1.Network; } });
         
     | 
| 
       25 
26 
     | 
    
         
             
            Object.defineProperty(exports, "populateTx", { enumerable: true, get: function () { return near_ca_1.populateTx; } });
         
     | 
    
        package/dist/cjs/near-safe.js
    CHANGED
    
    | 
         @@ -337,13 +337,15 @@ class NearSafe { 
     | 
|
| 
       337 
337 
     | 
    
         
             
                    }
         
     | 
| 
       338 
338 
     | 
    
         
             
                }
         
     | 
| 
       339 
339 
     | 
    
         
             
                encodeForSafe(from) {
         
     | 
| 
       340 
     | 
    
         
            -
                    const  
     | 
| 
       341 
     | 
    
         
            -
                     
     | 
| 
       342 
     | 
    
         
            -
             
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
      
 340 
     | 
    
         
            +
                    const lowerFrom = from.toLowerCase();
         
     | 
| 
      
 341 
     | 
    
         
            +
                    const lowerZero = viem_1.zeroAddress.toLowerCase();
         
     | 
| 
      
 342 
     | 
    
         
            +
                    const lowerSafe = this.address.toLowerCase();
         
     | 
| 
      
 343 
     | 
    
         
            +
                    const lowerMpc = this.mpcAddress.toLowerCase();
         
     | 
| 
      
 344 
     | 
    
         
            +
                    // We allow zeroAddress (and and treat is as from = safe)
         
     | 
| 
      
 345 
     | 
    
         
            +
                    if (![lowerSafe, lowerMpc, lowerZero].includes(lowerFrom)) {
         
     | 
| 
       344 
346 
     | 
    
         
             
                        throw new Error(`Unexpected from address ${from}`);
         
     | 
| 
       345 
347 
     | 
    
         
             
                    }
         
     | 
| 
       346 
     | 
    
         
            -
                    return this.address.toLowerCase()  
     | 
| 
      
 348 
     | 
    
         
            +
                    return [this.address.toLowerCase(), lowerZero].includes(lowerFrom);
         
     | 
| 
       347 
349 
     | 
    
         
             
                }
         
     | 
| 
       348 
350 
     | 
    
         
             
                async policyForChainId(chainId) {
         
     | 
| 
       349 
351 
     | 
    
         
             
                    const bundler = this.bundlerForChainId(chainId);
         
     | 
    
        package/dist/esm/decode.js
    CHANGED
    
    | 
         @@ -12,7 +12,7 @@ import { isRlpHex, isTransactionSerializable } from "./lib/safe-message"; 
     | 
|
| 
       12 
12 
     | 
    
         
             
            export function decodeTxData({ evmMessage, chainId, }) {
         
     | 
| 
       13 
13 
     | 
    
         
             
                const data = evmMessage;
         
     | 
| 
       14 
14 
     | 
    
         
             
                if (isRlpHex(evmMessage)) {
         
     | 
| 
       15 
     | 
    
         
            -
                    decodeRlpHex(chainId, evmMessage);
         
     | 
| 
      
 15 
     | 
    
         
            +
                    return decodeRlpHex(chainId, evmMessage);
         
     | 
| 
       16 
16 
     | 
    
         
             
                }
         
     | 
| 
       17 
17 
     | 
    
         
             
                if (isTransactionSerializable(data)) {
         
     | 
| 
       18 
18 
     | 
    
         
             
                    return decodeTransactionSerializable(chainId, data);
         
     | 
    
        package/dist/esm/index.d.ts
    CHANGED
    
    | 
         @@ -3,4 +3,5 @@ export * from "./types"; 
     | 
|
| 
       3 
3 
     | 
    
         
             
            export * from "./util";
         
     | 
| 
       4 
4 
     | 
    
         
             
            export * from "./constants";
         
     | 
| 
       5 
5 
     | 
    
         
             
            export * from "./decode";
         
     | 
| 
       6 
     | 
    
         
            -
            export  
     | 
| 
      
 6 
     | 
    
         
            +
            export * from "./lib/safe-message";
         
     | 
| 
      
 7 
     | 
    
         
            +
            export { Network, BaseTx, SignRequestData, populateTx, NetworkFields, signatureFromOutcome, signatureFromTxHash, requestRouter as mpcRequestRouter, EthTransactionParams, } from "near-ca";
         
     | 
    
        package/dist/esm/index.js
    CHANGED
    
    | 
         @@ -3,4 +3,5 @@ export * from "./types"; 
     | 
|
| 
       3 
3 
     | 
    
         
             
            export * from "./util";
         
     | 
| 
       4 
4 
     | 
    
         
             
            export * from "./constants";
         
     | 
| 
       5 
5 
     | 
    
         
             
            export * from "./decode";
         
     | 
| 
      
 6 
     | 
    
         
            +
            export * from "./lib/safe-message";
         
     | 
| 
       6 
7 
     | 
    
         
             
            export { Network, populateTx, signatureFromOutcome, signatureFromTxHash, requestRouter as mpcRequestRouter, } from "near-ca";
         
     | 
    
        package/dist/esm/near-safe.js
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { setupAdapter, signatureFromOutcome, toPayload, requestRouter as mpcRequestRouter, } from "near-ca";
         
     | 
| 
       2 
     | 
    
         
            -
            import { serializeSignature } from "viem";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { serializeSignature, zeroAddress } from "viem";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { DEFAULT_SAFE_SALT_NONCE } from "./constants";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { Erc4337Bundler } from "./lib/bundler";
         
     | 
| 
       5 
5 
     | 
    
         
             
            import { encodeMulti } from "./lib/multisend";
         
     | 
| 
         @@ -340,13 +340,15 @@ export class NearSafe { 
     | 
|
| 
       340 
340 
     | 
    
         
             
                    }
         
     | 
| 
       341 
341 
     | 
    
         
             
                }
         
     | 
| 
       342 
342 
     | 
    
         
             
                encodeForSafe(from) {
         
     | 
| 
       343 
     | 
    
         
            -
                    const  
     | 
| 
       344 
     | 
    
         
            -
                     
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
             
     | 
| 
      
 343 
     | 
    
         
            +
                    const lowerFrom = from.toLowerCase();
         
     | 
| 
      
 344 
     | 
    
         
            +
                    const lowerZero = zeroAddress.toLowerCase();
         
     | 
| 
      
 345 
     | 
    
         
            +
                    const lowerSafe = this.address.toLowerCase();
         
     | 
| 
      
 346 
     | 
    
         
            +
                    const lowerMpc = this.mpcAddress.toLowerCase();
         
     | 
| 
      
 347 
     | 
    
         
            +
                    // We allow zeroAddress (and and treat is as from = safe)
         
     | 
| 
      
 348 
     | 
    
         
            +
                    if (![lowerSafe, lowerMpc, lowerZero].includes(lowerFrom)) {
         
     | 
| 
       347 
349 
     | 
    
         
             
                        throw new Error(`Unexpected from address ${from}`);
         
     | 
| 
       348 
350 
     | 
    
         
             
                    }
         
     | 
| 
       349 
     | 
    
         
            -
                    return this.address.toLowerCase()  
     | 
| 
      
 351 
     | 
    
         
            +
                    return [this.address.toLowerCase(), lowerZero].includes(lowerFrom);
         
     | 
| 
       350 
352 
     | 
    
         
             
                }
         
     | 
| 
       351 
353 
     | 
    
         
             
                async policyForChainId(chainId) {
         
     | 
| 
       352 
354 
     | 
    
         
             
                    const bundler = this.bundlerForChainId(chainId);
         
     |