near-safe 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/lib/safe.d.ts +1 -1
- package/dist/cjs/lib/safe.js +3 -2
- package/dist/cjs/near-safe.d.ts +1 -1
- package/dist/cjs/near-safe.js +4 -4
- package/dist/esm/lib/safe.d.ts +1 -1
- package/dist/esm/lib/safe.js +3 -2
- package/dist/esm/near-safe.d.ts +1 -1
- package/dist/esm/near-safe.js +4 -4
- package/package.json +1 -1
package/dist/cjs/lib/safe.d.ts
CHANGED
@@ -14,7 +14,7 @@ export declare class SafeContractSuite {
|
|
14
14
|
addressForSetup(setup: Hex, saltNonce?: string): Promise<Address>;
|
15
15
|
getSetup(owners: string[]): Hex;
|
16
16
|
addOwnerData(newOwner: Address): Hex;
|
17
|
-
getOpHash(unsignedUserOp: UserOperation): Promise<Hash>;
|
17
|
+
getOpHash(chainId: number, unsignedUserOp: UserOperation): Promise<Hash>;
|
18
18
|
private factoryDataForSetup;
|
19
19
|
buildUserOp(nonce: bigint, txData: MetaTransaction, safeAddress: Address, feeData: GasPrice, setup: string, safeNotDeployed: boolean, safeSaltNonce: string): Promise<UnsignedUserOperation>;
|
20
20
|
getNonce(address: Address, chainId: number): Promise<bigint>;
|
package/dist/cjs/lib/safe.js
CHANGED
@@ -64,9 +64,10 @@ class SafeContractSuite {
|
|
64
64
|
args: [newOwner, 1],
|
65
65
|
});
|
66
66
|
}
|
67
|
-
async getOpHash(unsignedUserOp) {
|
67
|
+
async getOpHash(chainId, unsignedUserOp) {
|
68
68
|
const { factory, factoryData, verificationGasLimit, callGasLimit, maxPriorityFeePerGas, maxFeePerGas, } = unsignedUserOp;
|
69
|
-
const
|
69
|
+
const client = await (0, util_1.getClient)(chainId);
|
70
|
+
const opHash = await client.readContract({
|
70
71
|
address: this.m4337.address,
|
71
72
|
abi: this.m4337.abi,
|
72
73
|
functionName: "getOperationHash",
|
package/dist/cjs/near-safe.d.ts
CHANGED
@@ -85,7 +85,7 @@ export declare class NearSafe {
|
|
85
85
|
* @param {UserOperation} userOp - The user operation for which the hash needs to be computed.
|
86
86
|
* @returns {Promise<Hash>} - A promise that resolves to the hash of the provided user operation.
|
87
87
|
*/
|
88
|
-
opHash(userOp: UserOperation): Promise<Hash>;
|
88
|
+
opHash(chainId: number, userOp: UserOperation): Promise<Hash>;
|
89
89
|
/**
|
90
90
|
* Encodes a request to sign a transaction using either a paymaster or the user's own funds.
|
91
91
|
*
|
package/dist/cjs/near-safe.js
CHANGED
@@ -118,8 +118,8 @@ class NearSafe {
|
|
118
118
|
* @param {UserOperation} userOp - The user operation for which the hash needs to be computed.
|
119
119
|
* @returns {Promise<Hash>} - A promise that resolves to the hash of the provided user operation.
|
120
120
|
*/
|
121
|
-
async opHash(userOp) {
|
122
|
-
return this.safePack.getOpHash(userOp);
|
121
|
+
async opHash(chainId, userOp) {
|
122
|
+
return this.safePack.getOpHash(chainId, userOp);
|
123
123
|
}
|
124
124
|
/**
|
125
125
|
* Encodes a request to sign a transaction using either a paymaster or the user's own funds.
|
@@ -317,11 +317,11 @@ class NearSafe {
|
|
317
317
|
transactions,
|
318
318
|
usePaymaster,
|
319
319
|
});
|
320
|
-
const opHash = await this.opHash(userOp);
|
320
|
+
const opHash = await this.opHash(chainId, userOp);
|
321
321
|
return {
|
322
322
|
payload: (0, near_ca_1.toPayload)(opHash),
|
323
323
|
evmMessage: JSON.stringify(userOp),
|
324
|
-
hash: await this.opHash(userOp),
|
324
|
+
hash: await this.opHash(chainId, userOp),
|
325
325
|
};
|
326
326
|
}
|
327
327
|
}
|
package/dist/esm/lib/safe.d.ts
CHANGED
@@ -14,7 +14,7 @@ export declare class SafeContractSuite {
|
|
14
14
|
addressForSetup(setup: Hex, saltNonce?: string): Promise<Address>;
|
15
15
|
getSetup(owners: string[]): Hex;
|
16
16
|
addOwnerData(newOwner: Address): Hex;
|
17
|
-
getOpHash(unsignedUserOp: UserOperation): Promise<Hash>;
|
17
|
+
getOpHash(chainId: number, unsignedUserOp: UserOperation): Promise<Hash>;
|
18
18
|
private factoryDataForSetup;
|
19
19
|
buildUserOp(nonce: bigint, txData: MetaTransaction, safeAddress: Address, feeData: GasPrice, setup: string, safeNotDeployed: boolean, safeSaltNonce: string): Promise<UnsignedUserOperation>;
|
20
20
|
getNonce(address: Address, chainId: number): Promise<bigint>;
|
package/dist/esm/lib/safe.js
CHANGED
@@ -68,9 +68,10 @@ export class SafeContractSuite {
|
|
68
68
|
args: [newOwner, 1],
|
69
69
|
});
|
70
70
|
}
|
71
|
-
async getOpHash(unsignedUserOp) {
|
71
|
+
async getOpHash(chainId, unsignedUserOp) {
|
72
72
|
const { factory, factoryData, verificationGasLimit, callGasLimit, maxPriorityFeePerGas, maxFeePerGas, } = unsignedUserOp;
|
73
|
-
const
|
73
|
+
const client = await getClient(chainId);
|
74
|
+
const opHash = await client.readContract({
|
74
75
|
address: this.m4337.address,
|
75
76
|
abi: this.m4337.abi,
|
76
77
|
functionName: "getOperationHash",
|
package/dist/esm/near-safe.d.ts
CHANGED
@@ -85,7 +85,7 @@ export declare class NearSafe {
|
|
85
85
|
* @param {UserOperation} userOp - The user operation for which the hash needs to be computed.
|
86
86
|
* @returns {Promise<Hash>} - A promise that resolves to the hash of the provided user operation.
|
87
87
|
*/
|
88
|
-
opHash(userOp: UserOperation): Promise<Hash>;
|
88
|
+
opHash(chainId: number, userOp: UserOperation): Promise<Hash>;
|
89
89
|
/**
|
90
90
|
* Encodes a request to sign a transaction using either a paymaster or the user's own funds.
|
91
91
|
*
|
package/dist/esm/near-safe.js
CHANGED
@@ -121,8 +121,8 @@ export class NearSafe {
|
|
121
121
|
* @param {UserOperation} userOp - The user operation for which the hash needs to be computed.
|
122
122
|
* @returns {Promise<Hash>} - A promise that resolves to the hash of the provided user operation.
|
123
123
|
*/
|
124
|
-
async opHash(userOp) {
|
125
|
-
return this.safePack.getOpHash(userOp);
|
124
|
+
async opHash(chainId, userOp) {
|
125
|
+
return this.safePack.getOpHash(chainId, userOp);
|
126
126
|
}
|
127
127
|
/**
|
128
128
|
* Encodes a request to sign a transaction using either a paymaster or the user's own funds.
|
@@ -320,11 +320,11 @@ export class NearSafe {
|
|
320
320
|
transactions,
|
321
321
|
usePaymaster,
|
322
322
|
});
|
323
|
-
const opHash = await this.opHash(userOp);
|
323
|
+
const opHash = await this.opHash(chainId, userOp);
|
324
324
|
return {
|
325
325
|
payload: toPayload(opHash),
|
326
326
|
evmMessage: JSON.stringify(userOp),
|
327
|
-
hash: await this.opHash(userOp),
|
327
|
+
hash: await this.opHash(chainId, userOp),
|
328
328
|
};
|
329
329
|
}
|
330
330
|
}
|