near-safe 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/near-safe.js +1 -1
- package/dist/cjs/util.d.ts +1 -1
- package/dist/cjs/util.js +4 -7
- package/dist/esm/near-safe.js +1 -1
- package/dist/esm/util.d.ts +1 -1
- package/dist/esm/util.js +5 -8
- package/package.json +2 -2
package/dist/cjs/near-safe.js
CHANGED
@@ -342,7 +342,7 @@ class NearSafe {
|
|
342
342
|
const lowerMpc = this.mpcAddress.toLowerCase();
|
343
343
|
// We allow zeroAddress (and and treat is as from = safe)
|
344
344
|
if (![lowerSafe, lowerMpc, lowerZero].includes(lowerFrom)) {
|
345
|
-
throw new Error(`Unexpected from address ${from}`);
|
345
|
+
throw new Error(`Unexpected from address ${from} - expected {}`);
|
346
346
|
}
|
347
347
|
return [this.address.toLowerCase(), lowerZero].includes(lowerFrom);
|
348
348
|
}
|
package/dist/cjs/util.d.ts
CHANGED
@@ -8,7 +8,7 @@ export declare function packSignature(signature: `0x${string}`, validFrom?: numb
|
|
8
8
|
export declare function packPaymasterData(data: PaymasterData): Hex;
|
9
9
|
export declare function containsValue(transactions: MetaTransaction[]): boolean;
|
10
10
|
export declare function isContract(address: Address, chainId: number): Promise<boolean>;
|
11
|
-
export declare function getClient(chainId: number): PublicClient;
|
11
|
+
export declare function getClient(chainId: number, rpcUrl?: string): PublicClient;
|
12
12
|
export declare function metaTransactionsFromRequest(params: SessionRequestParams): MetaTransaction[];
|
13
13
|
export declare function saltNonceFromMessage(input: string): string;
|
14
14
|
/**
|
package/dist/cjs/util.js
CHANGED
@@ -14,7 +14,6 @@ exports.assertUnique = assertUnique;
|
|
14
14
|
exports.userOpTransactionCost = userOpTransactionCost;
|
15
15
|
const near_ca_1 = require("near-ca");
|
16
16
|
const viem_1 = require("viem");
|
17
|
-
const constants_1 = require("./constants");
|
18
17
|
exports.PLACEHOLDER_SIG = (0, viem_1.encodePacked)(["uint48", "uint48"], [0, 0]);
|
19
18
|
const packGas = (hi, lo) => (0, viem_1.encodePacked)(["uint128", "uint128"], [BigInt(hi), BigInt(lo)]);
|
20
19
|
exports.packGas = packGas;
|
@@ -37,12 +36,10 @@ function containsValue(transactions) {
|
|
37
36
|
async function isContract(address, chainId) {
|
38
37
|
return (await getClient(chainId).getCode({ address })) !== undefined;
|
39
38
|
}
|
40
|
-
function getClient(chainId) {
|
41
|
-
//
|
42
|
-
|
43
|
-
|
44
|
-
}
|
45
|
-
return near_ca_1.Network.fromChainId(chainId).client;
|
39
|
+
function getClient(chainId, rpcUrl) {
|
40
|
+
// Caution: rpcUrl might not be aligned with chainId!
|
41
|
+
const options = rpcUrl ? { rpcUrl } : {};
|
42
|
+
return near_ca_1.Network.fromChainId(chainId, options).client;
|
46
43
|
}
|
47
44
|
function metaTransactionsFromRequest(params) {
|
48
45
|
let transactions;
|
package/dist/esm/near-safe.js
CHANGED
@@ -345,7 +345,7 @@ export class NearSafe {
|
|
345
345
|
const lowerMpc = this.mpcAddress.toLowerCase();
|
346
346
|
// We allow zeroAddress (and and treat is as from = safe)
|
347
347
|
if (![lowerSafe, lowerMpc, lowerZero].includes(lowerFrom)) {
|
348
|
-
throw new Error(`Unexpected from address ${from}`);
|
348
|
+
throw new Error(`Unexpected from address ${from} - expected {}`);
|
349
349
|
}
|
350
350
|
return [this.address.toLowerCase(), lowerZero].includes(lowerFrom);
|
351
351
|
}
|
package/dist/esm/util.d.ts
CHANGED
@@ -8,7 +8,7 @@ export declare function packSignature(signature: `0x${string}`, validFrom?: numb
|
|
8
8
|
export declare function packPaymasterData(data: PaymasterData): Hex;
|
9
9
|
export declare function containsValue(transactions: MetaTransaction[]): boolean;
|
10
10
|
export declare function isContract(address: Address, chainId: number): Promise<boolean>;
|
11
|
-
export declare function getClient(chainId: number): PublicClient;
|
11
|
+
export declare function getClient(chainId: number, rpcUrl?: string): PublicClient;
|
12
12
|
export declare function metaTransactionsFromRequest(params: SessionRequestParams): MetaTransaction[];
|
13
13
|
export declare function saltNonceFromMessage(input: string): string;
|
14
14
|
/**
|
package/dist/esm/util.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { getNetworkId, Network, signatureFromTxHash as sigFromHash, } from "near-ca";
|
2
|
-
import { concatHex, encodePacked, toHex, isHex, parseTransaction, zeroAddress, toBytes, keccak256, serializeSignature,
|
3
|
-
import { DEFAULT_SETUP_RPC } from "./constants";
|
2
|
+
import { concatHex, encodePacked, toHex, isHex, parseTransaction, zeroAddress, toBytes, keccak256, serializeSignature, } from "viem";
|
4
3
|
export const PLACEHOLDER_SIG = encodePacked(["uint48", "uint48"], [0, 0]);
|
5
4
|
export const packGas = (hi, lo) => encodePacked(["uint128", "uint128"], [BigInt(hi), BigInt(lo)]);
|
6
5
|
export function packSignature(signature, validFrom = 0, validTo = 0) {
|
@@ -22,12 +21,10 @@ export function containsValue(transactions) {
|
|
22
21
|
export async function isContract(address, chainId) {
|
23
22
|
return (await getClient(chainId).getCode({ address })) !== undefined;
|
24
23
|
}
|
25
|
-
export function getClient(chainId) {
|
26
|
-
//
|
27
|
-
|
28
|
-
|
29
|
-
}
|
30
|
-
return Network.fromChainId(chainId).client;
|
24
|
+
export function getClient(chainId, rpcUrl) {
|
25
|
+
// Caution: rpcUrl might not be aligned with chainId!
|
26
|
+
const options = rpcUrl ? { rpcUrl } : {};
|
27
|
+
return Network.fromChainId(chainId, options).client;
|
31
28
|
}
|
32
29
|
export function metaTransactionsFromRequest(params) {
|
33
30
|
let transactions;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "near-safe",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.7",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "An SDK for controlling Ethereum Smart Accounts via ERC4337 from a Near Account.",
|
6
6
|
"author": "bh2smith",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"dependencies": {
|
44
44
|
"@safe-global/safe-gateway-typescript-sdk": "^3.22.6",
|
45
45
|
"near-api-js": "^5.0.1",
|
46
|
-
"near-ca": "^0.8.
|
46
|
+
"near-ca": "^0.8.2",
|
47
47
|
"semver": "^7.6.3",
|
48
48
|
"viem": "^2.22.8"
|
49
49
|
},
|