@1inch/solidity-utils 6.1.0 → 6.2.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/hardhat-setup/networks.d.ts +7 -7
- package/dist/hardhat-setup/networks.js +9 -6
- package/dist/hardhat-setup/networks.js.map +1 -1
- package/dist/src/bySig.d.ts +5 -4
- package/dist/src/bySig.js +5 -4
- package/dist/src/bySig.js.map +1 -1
- package/dist/src/expect.d.ts +4 -3
- package/dist/src/expect.js +4 -3
- package/dist/src/expect.js.map +1 -1
- package/dist/src/permit.d.ts +13 -13
- package/dist/src/permit.js +13 -13
- package/dist/src/prelude.d.ts +1 -1
- package/dist/src/prelude.js +1 -1
- package/dist/src/profileEVM.d.ts +3 -3
- package/dist/src/profileEVM.js +3 -3
- package/dist/src/utils.d.ts +17 -18
- package/dist/src/utils.js +11 -11
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChainConfig } from '@nomicfoundation/hardhat-verify/src/types';
|
|
2
|
-
import { Network, NetworksUserConfig } from 'hardhat/types';
|
|
2
|
+
import { HardhatNetworkAccountsUserConfig, Network, NetworksUserConfig } from 'hardhat/types';
|
|
3
3
|
/**
|
|
4
4
|
* @category Hardhat-Setup
|
|
5
|
-
*
|
|
5
|
+
* Configuration type for managing Etherscan integration in Hardhat setups.
|
|
6
6
|
* @param apiKey Dictionary of API keys for accessing Etherscan, indexed by network name.
|
|
7
7
|
* @param customChains Array of custom blockchain network configurations.
|
|
8
8
|
*/
|
|
@@ -14,13 +14,13 @@ export type Etherscan = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* @category Hardhat-Setup
|
|
17
|
-
*
|
|
17
|
+
* A helper method to get the network name from the command line arguments.
|
|
18
18
|
* @returns The network name.
|
|
19
19
|
*/
|
|
20
20
|
export declare function getNetwork(): string;
|
|
21
21
|
/**
|
|
22
22
|
* @category Hardhat-Setup
|
|
23
|
-
*
|
|
23
|
+
* A helper method to parse RPC configuration strings. Checks that the string is in the expected format.
|
|
24
24
|
* @param envRpc The RPC configuration string to parse.
|
|
25
25
|
* @returns An object containing the RPC URL and optional auth key HTTP header.
|
|
26
26
|
*/
|
|
@@ -30,20 +30,20 @@ export declare function parseRpcEnv(envRpc: string): {
|
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* @category Hardhat-Setup
|
|
33
|
-
*
|
|
33
|
+
* A helper method to reset the Hardhat network to the local network or to a fork.
|
|
34
34
|
* @param network The Hardhat network object.
|
|
35
35
|
* @param networkName The name of the network to reset to.
|
|
36
36
|
*/
|
|
37
37
|
export declare function resetHardhatNetworkFork(network: Network, networkName: string): Promise<void>;
|
|
38
38
|
/**
|
|
39
39
|
* @category Hardhat-Setup
|
|
40
|
-
*
|
|
40
|
+
* The Network class is a helper class to register networks and Etherscan API keys.
|
|
41
41
|
* See the [README](https://github.com/1inch/solidity-utils/tree/master/hardhat-setup/README.md) for usage.
|
|
42
42
|
*/
|
|
43
43
|
export declare class Networks {
|
|
44
44
|
networks: NetworksUserConfig;
|
|
45
45
|
etherscan: Etherscan;
|
|
46
|
-
constructor(useHardhat?: boolean, forkingNetworkName?: string, saveHardhatDeployments?: boolean);
|
|
46
|
+
constructor(useHardhat?: boolean, forkingNetworkName?: string, saveHardhatDeployments?: boolean, forkingAccounts?: HardhatNetworkAccountsUserConfig);
|
|
47
47
|
register(name: string, chainId: number, rpc?: string, privateKey?: string, etherscanNetworkName?: string, etherscanKey?: string, hardfork?: string): void;
|
|
48
48
|
registerCustom(name: string, chainId: number, url?: string, privateKey?: string, etherscanKey?: string, apiURL?: string, browserURL?: string, hardfork?: string): void;
|
|
49
49
|
registerZksync(name: string, chainId: number, rpc?: string, ethNetwork?: string, privateKey?: string, verifyURL?: string, hardfork?: string): void;
|
|
@@ -8,7 +8,7 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
|
|
9
9
|
/**
|
|
10
10
|
* @category Hardhat-Setup
|
|
11
|
-
*
|
|
11
|
+
* A helper method to get the network name from the command line arguments.
|
|
12
12
|
* @returns The network name.
|
|
13
13
|
*/
|
|
14
14
|
function getNetwork() {
|
|
@@ -17,7 +17,7 @@ function getNetwork() {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @category Hardhat-Setup
|
|
20
|
-
*
|
|
20
|
+
* A helper method to parse RPC configuration strings. Checks that the string is in the expected format.
|
|
21
21
|
* @param envRpc The RPC configuration string to parse.
|
|
22
22
|
* @returns An object containing the RPC URL and optional auth key HTTP header.
|
|
23
23
|
*/
|
|
@@ -30,7 +30,7 @@ function parseRpcEnv(envRpc) {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @category Hardhat-Setup
|
|
33
|
-
*
|
|
33
|
+
* A helper method to reset the Hardhat network to the local network or to a fork.
|
|
34
34
|
* @param network The Hardhat network object.
|
|
35
35
|
* @param networkName The name of the network to reset to.
|
|
36
36
|
*/
|
|
@@ -56,11 +56,11 @@ async function resetHardhatNetworkFork(network, networkName) {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* @category Hardhat-Setup
|
|
59
|
-
*
|
|
59
|
+
* The Network class is a helper class to register networks and Etherscan API keys.
|
|
60
60
|
* See the [README](https://github.com/1inch/solidity-utils/tree/master/hardhat-setup/README.md) for usage.
|
|
61
61
|
*/
|
|
62
62
|
class Networks {
|
|
63
|
-
constructor(useHardhat = true, forkingNetworkName, saveHardhatDeployments = false) {
|
|
63
|
+
constructor(useHardhat = true, forkingNetworkName, saveHardhatDeployments = false, forkingAccounts) {
|
|
64
64
|
this.networks = {};
|
|
65
65
|
this.etherscan = { apiKey: {}, customChains: [] };
|
|
66
66
|
dotenv_1.default.config();
|
|
@@ -71,6 +71,9 @@ class Networks {
|
|
|
71
71
|
// @ts-ignore
|
|
72
72
|
saveDeployments: saveHardhatDeployments,
|
|
73
73
|
};
|
|
74
|
+
if (forkingAccounts) {
|
|
75
|
+
this.networks.hardhat.accounts = forkingAccounts;
|
|
76
|
+
}
|
|
74
77
|
}
|
|
75
78
|
if (forkingNetworkName) {
|
|
76
79
|
const { url, authKeyHttpHeader } = parseRpcEnv(process.env[`${forkingNetworkName.toUpperCase()}_RPC_URL`] || '');
|
|
@@ -136,7 +139,7 @@ class Networks {
|
|
|
136
139
|
this.register('aurora', 1313161554, process.env.AURORA_RPC_URL, process.env.AURORA_PRIVATE_KEY || privateKey, 'aurora', process.env.AURORA_ETHERSCAN_KEY);
|
|
137
140
|
this.register('base', 8453, process.env.BASE_RPC_URL, process.env.BASE_PRIVATE_KEY || privateKey, 'base', process.env.BASE_ETHERSCAN_KEY);
|
|
138
141
|
this.registerCustom('klaytn', 8217, process.env.KLAYTN_RPC_URL, process.env.KLAYTN_PRIVATE_KEY || privateKey, process.env.KLAYTN_ETHERSCAN_KEY, 'https://scope.klaytn.com/', 'https://scope.klaytn.com/'); // eslint-disable-line max-len
|
|
139
|
-
this.registerCustom('
|
|
142
|
+
this.registerCustom('linea', 59144, process.env.LINEA_RPC_URL, process.env.LINEA_PRIVATE_KEY || privateKey, process.env.LINEA_ETHERSCAN_KEY, 'https://api.lineascan.build/api', 'https://lineascan.build/', 'london'); // eslint-disable-line max-len
|
|
140
143
|
this.registerZksync('zksync', 324, process.env.ZKSYNC_RPC_URL, 'mainnet', process.env.ZKSYNC_PRIVATE_KEY || privateKey, process.env.ZKSYNC_VERIFY_URL);
|
|
141
144
|
// For 'zksyncFork' network you should use zksync fork node: https://github.com/matter-labs/era-test-node
|
|
142
145
|
this.registerZksync('zksyncFork', 260, process.env.ZKSYNC_FORK_RPC_URL, 'mainnet', process.env.ZKSYNC_FORK_PRIVATE_KEY || privateKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../hardhat-setup/networks.ts"],"names":[],"mappings":";;;AAoBA,gCAGC;AAQD,kCAMC;AAQD,0DAkBC;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AC,mBAAmB,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,QAAQ,CAAC,CAAC,CAAC,8BAA8B;QACrP,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACvJ,yGAAyG;QACzG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,UAAU,CAAC,CAAC;QACtI,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,CAAC,CAAC;QAC9J,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QAC1K,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;IAClE,CAAC;CACJ;AA7FD,4BA6FC"}
|
package/dist/src/bySig.d.ts
CHANGED
|
@@ -11,10 +11,11 @@ export declare enum NonceType {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Builds traits for {bySig} contract by combining params.
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* @param params An object containing the following properties:
|
|
15
|
+
* - `nonceType` The type of nonce to use. Default is `NonceType.Account`.
|
|
16
|
+
* - `deadline` The deadline for the message. Default is `0`.
|
|
17
|
+
* - `relayer` The relayer address. Default is the zero address.
|
|
18
|
+
* - `nonce` The nonce. Default is `0`.
|
|
18
19
|
* @returns A bigint representing the combined traits.
|
|
19
20
|
* @throws Error if provided with invalid parameters.
|
|
20
21
|
*/
|
package/dist/src/bySig.js
CHANGED
|
@@ -18,10 +18,11 @@ var NonceType;
|
|
|
18
18
|
})(NonceType || (exports.NonceType = NonceType = {}));
|
|
19
19
|
/**
|
|
20
20
|
* Builds traits for {bySig} contract by combining params.
|
|
21
|
-
* @param
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* @param params An object containing the following properties:
|
|
22
|
+
* - `nonceType` The type of nonce to use. Default is `NonceType.Account`.
|
|
23
|
+
* - `deadline` The deadline for the message. Default is `0`.
|
|
24
|
+
* - `relayer` The relayer address. Default is the zero address.
|
|
25
|
+
* - `nonce` The nonce. Default is `0`.
|
|
25
26
|
* @returns A bigint representing the combined traits.
|
|
26
27
|
* @throws Error if provided with invalid parameters.
|
|
27
28
|
*/
|
package/dist/src/bySig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bySig.js","sourceRoot":"","sources":["../../src/bySig.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bySig.js","sourceRoot":"","sources":["../../src/bySig.ts"],"names":[],"mappings":";;;AAyBA,4CAuBC;AAgBD,8BASC;AAYD,wCAaC;AAlGD,qCAAiC;AACjC,uCAAsC;AAItC;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACjB,+CAAO,CAAA;IACP,iDAAQ,CAAA;IACR,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAED;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,EAC7B,SAAS,GAAG,SAAS,CAAC,OAAO,EAC7B,QA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,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,cAAc,CAC1B,IAAY,EACZ,OAAe,EACf,OAAwB,EACxB,iBAAyB,EACzB,MAAkC,EAClC,UAA4B;IAE5B,OAAO,MAAM,CAAC,aAAa,CACvB,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAC7C,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,EACtF,UAAU,CACb,CAAC;AACN,CAAC"}
|
package/dist/src/expect.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Assertion, assert, expect, config, should } from 'chai';
|
|
2
2
|
/**
|
|
3
3
|
* @category expect
|
|
4
|
-
*
|
|
4
|
+
* Asserts that two values are roughly equal within a specified relative difference.
|
|
5
5
|
* This function is useful for cases where precision issues might cause direct comparisons to fail.
|
|
6
|
+
* @remarks
|
|
7
|
+
* This function will revert with a message if the values are of different signs
|
|
8
|
+
* or if the actual value deviates from the expected by more than the specified relative difference.
|
|
6
9
|
* @param expected The expected value as a string, number, or bigint.
|
|
7
10
|
* @param actual The actual value obtained, to compare against the expected value.
|
|
8
11
|
* @param relativeDiff The maximum allowed relative difference between the expected and actual values.
|
|
9
12
|
* The relative difference is calculated as the absolute difference divided by the expected value,
|
|
10
13
|
* ensuring that the actual value is within this relative difference from the expected value.
|
|
11
|
-
* @notice This function will revert with a message if the values are of different signs
|
|
12
|
-
* or if the actual value deviates from the expected by more than the specified relative difference.
|
|
13
14
|
*/
|
|
14
15
|
export declare function assertRoughlyEqualValues(expected: string | number | bigint, actual: string | number | bigint, relativeDiff: number): void;
|
|
15
16
|
export { Assertion, assert, expect, config, should };
|
package/dist/src/expect.js
CHANGED
|
@@ -10,15 +10,16 @@ Object.defineProperty(exports, "config", { enumerable: true, get: function () {
|
|
|
10
10
|
Object.defineProperty(exports, "should", { enumerable: true, get: function () { return chai_1.should; } });
|
|
11
11
|
/**
|
|
12
12
|
* @category expect
|
|
13
|
-
*
|
|
13
|
+
* Asserts that two values are roughly equal within a specified relative difference.
|
|
14
14
|
* This function is useful for cases where precision issues might cause direct comparisons to fail.
|
|
15
|
+
* @remarks
|
|
16
|
+
* This function will revert with a message if the values are of different signs
|
|
17
|
+
* or if the actual value deviates from the expected by more than the specified relative difference.
|
|
15
18
|
* @param expected The expected value as a string, number, or bigint.
|
|
16
19
|
* @param actual The actual value obtained, to compare against the expected value.
|
|
17
20
|
* @param relativeDiff The maximum allowed relative difference between the expected and actual values.
|
|
18
21
|
* The relative difference is calculated as the absolute difference divided by the expected value,
|
|
19
22
|
* ensuring that the actual value is within this relative difference from the expected value.
|
|
20
|
-
* @notice This function will revert with a message if the values are of different signs
|
|
21
|
-
* or if the actual value deviates from the expected by more than the specified relative difference.
|
|
22
23
|
*/
|
|
23
24
|
function assertRoughlyEqualValues(expected, actual, relativeDiff) {
|
|
24
25
|
let expectedBN = BigInt(expected);
|
package/dist/src/expect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/expect.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/expect.ts"],"names":[],"mappings":";;;AAeA,4DAuBC;AAtCD,+BAAiE;AAyCxD,0FAzCA,gBAAS,OAyCA;AAAE,uFAzCA,aAAM,OAyCA;AAAE,uFAzCA,aAAM,OAyCA;AAAE,uFAzCA,aAAM,OAyCA;AAAE,uFAzCA,aAAM,OAyCA;AAvClD;;;;;;;;;;;;GAYG;AACH,SAAgB,wBAAwB,CACpC,QAAkC,EAClC,MAAgC,EAChC,YAAoB;IAEpB,IAAI,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,aAAM,EAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC;IAE3E,IAAI,UAAU,GAAG,CAAC;QAAE,UAAU,GAAG,CAAC,UAAU,CAAC;IAC7C,IAAI,QAAQ,GAAG,CAAC;QAAE,QAAQ,GAAG,CAAC,QAAQ,CAAC;IAEvC,IAAI,kBAAkB,GAAG,YAAY,CAAC;IACtC,IAAI,oBAAoB,GAAG,EAAE,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC3C,oBAAoB,GAAG,oBAAoB,GAAG,GAAG,CAAC;QAClD,kBAAkB,IAAI,EAAE,CAAC;IAC7B,CAAC;IACD,MAAM,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC;IACnF,MAAM,QAAQ,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC,GAAG,oBAAoB,CAAC;IAClF,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;QAClB,IAAA,aAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,MAAM,OAAO,QAAQ,SAAS,YAAY,YAAY,CAAC,CAAC;IACxG,CAAC;AACL,CAAC"}
|
package/dist/src/permit.d.ts
CHANGED
|
@@ -20,21 +20,21 @@ export declare const DaiLikePermit: {
|
|
|
20
20
|
}[];
|
|
21
21
|
/**
|
|
22
22
|
* @category permit
|
|
23
|
-
*
|
|
23
|
+
* Removes the '0x' prefix from a string. If no '0x' prefix is found, returns the original string.
|
|
24
24
|
* @param bigNumber The number (as a bigint or string) from which to remove the '0x' prefix.
|
|
25
25
|
* @return The string without the '0x' prefix.
|
|
26
26
|
*/
|
|
27
27
|
export declare function trim0x(bigNumber: bigint | string): string;
|
|
28
28
|
/**
|
|
29
29
|
* @category permit
|
|
30
|
-
*
|
|
30
|
+
* Trims the method selector from transaction data, removing the first 8 characters (4 bytes of hexable string) after '0x' prefix.
|
|
31
31
|
* @param data The transaction data string from which to trim the selector.
|
|
32
32
|
* @return The trimmed selector string.
|
|
33
33
|
*/
|
|
34
34
|
export declare function cutSelector(data: string): string;
|
|
35
35
|
/**
|
|
36
36
|
* @category permit
|
|
37
|
-
*
|
|
37
|
+
* Generates a domain separator for EIP-712 structured data using the provided parameters.
|
|
38
38
|
* @param name The user readable name of EIP-712 domain.
|
|
39
39
|
* @param version The version of the EIP-712 domain.
|
|
40
40
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -44,7 +44,7 @@ export declare function cutSelector(data: string): string;
|
|
|
44
44
|
export declare function domainSeparator(name: string, version: string, chainId: string, verifyingContract: string): string;
|
|
45
45
|
/**
|
|
46
46
|
* @category permit
|
|
47
|
-
*
|
|
47
|
+
* Constructs structured data for EIP-2612 permit function, including types, domain, and message with details about the permit.
|
|
48
48
|
* @param name The user readable name of signing EIP-712 domain
|
|
49
49
|
* @param version The version of the signing EIP-712 domain.
|
|
50
50
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -78,7 +78,7 @@ export declare function buildData(name: string, version: string, chainId: number
|
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
80
|
* @category permit
|
|
81
|
-
*
|
|
81
|
+
* Prepares structured data similar to the Dai permit function, including types, domain, and message with permit details.
|
|
82
82
|
* @param name The user readable name of signing EIP-712 domain
|
|
83
83
|
* @param version The version of the signing EIP-712 domain.
|
|
84
84
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -113,13 +113,13 @@ export declare function buildDataLikeDai(name: string, version: string, chainId:
|
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
115
|
* @category permit
|
|
116
|
-
*
|
|
116
|
+
* Ensures contract code is set for a given address and returns a contract instance.
|
|
117
117
|
* @return The contract instance of IPermit2.
|
|
118
118
|
*/
|
|
119
119
|
export declare function permit2Contract(): Promise<import("ethers").Contract>;
|
|
120
120
|
/**
|
|
121
121
|
* @category permit
|
|
122
|
-
*
|
|
122
|
+
* Generates a permit signature for ERC20 tokens with EIP-2612 standard.
|
|
123
123
|
* @param owner The wallet or signer issuing the permit.
|
|
124
124
|
* @param permitContract The contract object with ERC20Permit type and token address for which the permit creating.
|
|
125
125
|
* @param tokenVersion The version of the token's EIP-712 domain.
|
|
@@ -133,7 +133,7 @@ export declare function permit2Contract(): Promise<import("ethers").Contract>;
|
|
|
133
133
|
export declare function getPermit(owner: Wallet | SignerWithAddress, permitContract: ERC20Permit, tokenVersion: string, chainId: number, spender: string, value: string, deadline?: string, compact?: boolean): Promise<string>;
|
|
134
134
|
/**
|
|
135
135
|
* @category permit
|
|
136
|
-
*
|
|
136
|
+
* Creates a permit for spending tokens on Permit2 standard contracts.
|
|
137
137
|
* @param owner The wallet or signer issuing the permit.
|
|
138
138
|
* @param token The address of the token for which the permit is creates.
|
|
139
139
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -147,7 +147,7 @@ export declare function getPermit(owner: Wallet | SignerWithAddress, permitContr
|
|
|
147
147
|
export declare function getPermit2(owner: Wallet | SignerWithAddress, token: string, chainId: number, spender: string, amount: bigint, compact?: boolean, expiration?: bigint, sigDeadline?: bigint): Promise<string>;
|
|
148
148
|
/**
|
|
149
149
|
* @category permit
|
|
150
|
-
*
|
|
150
|
+
* Generates a Dai-like permit signature for tokens.
|
|
151
151
|
* @param holder The wallet or signer issuing the permit.
|
|
152
152
|
* @param permitContract The contract object with ERC20PermitLikeDai type and token address for which the permit creating.
|
|
153
153
|
* @param tokenVersion The version of the token's EIP-712 domain.
|
|
@@ -161,7 +161,7 @@ export declare function getPermit2(owner: Wallet | SignerWithAddress, token: str
|
|
|
161
161
|
export declare function getPermitLikeDai(holder: Wallet | SignerWithAddress, permitContract: DaiLikePermitMock, tokenVersion: string, chainId: number, spender: string, allowed: boolean, expiry?: string, compact?: boolean): Promise<string>;
|
|
162
162
|
/**
|
|
163
163
|
* @category permit
|
|
164
|
-
*
|
|
164
|
+
* Generates a ERC-7597 permit signature for tokens.
|
|
165
165
|
* @param owner Contract with isValidSignature function.
|
|
166
166
|
* @param signer The wallet or signer issuing the permit.
|
|
167
167
|
* @param permitContract The contract object with ERC7597Permit type and token address for which the permit creating.
|
|
@@ -175,7 +175,7 @@ export declare function getPermitLikeDai(holder: Wallet | SignerWithAddress, per
|
|
|
175
175
|
export declare function getPermitLikeUSDC(owner: string, signer: Wallet | SignerWithAddress, permitContract: USDCLikePermitMock, tokenVersion: string, chainId: number, spender: string, value: string, deadline?: string): Promise<string>;
|
|
176
176
|
/**
|
|
177
177
|
* @category permit
|
|
178
|
-
*
|
|
178
|
+
* Concatenates a target address with data, trimming the '0x' prefix from the data.
|
|
179
179
|
* @param target The target address or value to prepend.
|
|
180
180
|
* @param data The data string to be concatenated after trimming.
|
|
181
181
|
* @return A concatenated string of target and data.
|
|
@@ -183,7 +183,7 @@ export declare function getPermitLikeUSDC(owner: string, signer: Wallet | Signer
|
|
|
183
183
|
export declare function withTarget(target: bigint | string, data: bigint | string): string;
|
|
184
184
|
/**
|
|
185
185
|
* @category permit
|
|
186
|
-
*
|
|
186
|
+
* Compresses a permit function call to a shorter format based on its type.
|
|
187
187
|
* Type | EIP-2612 | DAI | Permit2
|
|
188
188
|
* Uncompressed | 224 | 256 | 352
|
|
189
189
|
* Compressed | 100 | 72 | 96
|
|
@@ -193,7 +193,7 @@ export declare function withTarget(target: bigint | string, data: bigint | strin
|
|
|
193
193
|
export declare function compressPermit(permit: string): string;
|
|
194
194
|
/**
|
|
195
195
|
* @category permit
|
|
196
|
-
*
|
|
196
|
+
* Decompresses a compressed permit function call back to its original full format.
|
|
197
197
|
* @param permit The compressed permit function call string.
|
|
198
198
|
* @param token The token address involved in the permit (for Permit2 type).
|
|
199
199
|
* @param owner The owner address involved in the permit.
|
package/dist/src/permit.js
CHANGED
|
@@ -46,7 +46,7 @@ exports.DaiLikePermit = [
|
|
|
46
46
|
];
|
|
47
47
|
/**
|
|
48
48
|
* @category permit
|
|
49
|
-
*
|
|
49
|
+
* Removes the '0x' prefix from a string. If no '0x' prefix is found, returns the original string.
|
|
50
50
|
* @param bigNumber The number (as a bigint or string) from which to remove the '0x' prefix.
|
|
51
51
|
* @return The string without the '0x' prefix.
|
|
52
52
|
*/
|
|
@@ -59,7 +59,7 @@ function trim0x(bigNumber) {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* @category permit
|
|
62
|
-
*
|
|
62
|
+
* Trims the method selector from transaction data, removing the first 8 characters (4 bytes of hexable string) after '0x' prefix.
|
|
63
63
|
* @param data The transaction data string from which to trim the selector.
|
|
64
64
|
* @return The trimmed selector string.
|
|
65
65
|
*/
|
|
@@ -69,7 +69,7 @@ function cutSelector(data) {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* @category permit
|
|
72
|
-
*
|
|
72
|
+
* Generates a domain separator for EIP-712 structured data using the provided parameters.
|
|
73
73
|
* @param name The user readable name of EIP-712 domain.
|
|
74
74
|
* @param version The version of the EIP-712 domain.
|
|
75
75
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -82,7 +82,7 @@ function domainSeparator(name, version, chainId, verifyingContract) {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* @category permit
|
|
85
|
-
*
|
|
85
|
+
* Constructs structured data for EIP-2612 permit function, including types, domain, and message with details about the permit.
|
|
86
86
|
* @param name The user readable name of signing EIP-712 domain
|
|
87
87
|
* @param version The version of the signing EIP-712 domain.
|
|
88
88
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -102,7 +102,7 @@ function buildData(name, version, chainId, verifyingContract, owner, spender, va
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* @category permit
|
|
105
|
-
*
|
|
105
|
+
* Prepares structured data similar to the Dai permit function, including types, domain, and message with permit details.
|
|
106
106
|
* @param name The user readable name of signing EIP-712 domain
|
|
107
107
|
* @param version The version of the signing EIP-712 domain.
|
|
108
108
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -123,7 +123,7 @@ function buildDataLikeDai(name, version, chainId, verifyingContract, holder, spe
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* @category permit
|
|
126
|
-
*
|
|
126
|
+
* Ensures contract code is set for a given address and returns a contract instance.
|
|
127
127
|
* @return The contract instance of IPermit2.
|
|
128
128
|
*/
|
|
129
129
|
async function permit2Contract() {
|
|
@@ -134,7 +134,7 @@ async function permit2Contract() {
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* @category permit
|
|
137
|
-
*
|
|
137
|
+
* Generates a permit signature for ERC20 tokens with EIP-2612 standard.
|
|
138
138
|
* @param owner The wallet or signer issuing the permit.
|
|
139
139
|
* @param permitContract The contract object with ERC20Permit type and token address for which the permit creating.
|
|
140
140
|
* @param tokenVersion The version of the token's EIP-712 domain.
|
|
@@ -156,7 +156,7 @@ async function getPermit(owner, permitContract, tokenVersion, chainId, spender,
|
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* @category permit
|
|
159
|
-
*
|
|
159
|
+
* Creates a permit for spending tokens on Permit2 standard contracts.
|
|
160
160
|
* @param owner The wallet or signer issuing the permit.
|
|
161
161
|
* @param token The address of the token for which the permit is creates.
|
|
162
162
|
* @param chainId The unique identifier for the blockchain network.
|
|
@@ -188,7 +188,7 @@ async function getPermit2(owner, token, chainId, spender, amount, compact = fals
|
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* @category permit
|
|
191
|
-
*
|
|
191
|
+
* Generates a Dai-like permit signature for tokens.
|
|
192
192
|
* @param holder The wallet or signer issuing the permit.
|
|
193
193
|
* @param permitContract The contract object with ERC20PermitLikeDai type and token address for which the permit creating.
|
|
194
194
|
* @param tokenVersion The version of the token's EIP-712 domain.
|
|
@@ -210,7 +210,7 @@ async function getPermitLikeDai(holder, permitContract, tokenVersion, chainId, s
|
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
212
|
* @category permit
|
|
213
|
-
*
|
|
213
|
+
* Generates a ERC-7597 permit signature for tokens.
|
|
214
214
|
* @param owner Contract with isValidSignature function.
|
|
215
215
|
* @param signer The wallet or signer issuing the permit.
|
|
216
216
|
* @param permitContract The contract object with ERC7597Permit type and token address for which the permit creating.
|
|
@@ -232,7 +232,7 @@ async function getPermitLikeUSDC(owner, signer, permitContract, tokenVersion, ch
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* @category permit
|
|
235
|
-
*
|
|
235
|
+
* Concatenates a target address with data, trimming the '0x' prefix from the data.
|
|
236
236
|
* @param target The target address or value to prepend.
|
|
237
237
|
* @param data The data string to be concatenated after trimming.
|
|
238
238
|
* @return A concatenated string of target and data.
|
|
@@ -242,7 +242,7 @@ function withTarget(target, data) {
|
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* @category permit
|
|
245
|
-
*
|
|
245
|
+
* Compresses a permit function call to a shorter format based on its type.
|
|
246
246
|
* Type | EIP-2612 | DAI | Permit2
|
|
247
247
|
* Uncompressed | 224 | 256 | 352
|
|
248
248
|
* Compressed | 100 | 72 | 96
|
|
@@ -290,7 +290,7 @@ function compressPermit(permit) {
|
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* @category permit
|
|
293
|
-
*
|
|
293
|
+
* Decompresses a compressed permit function call back to its original full format.
|
|
294
294
|
* @param permit The compressed permit function call string.
|
|
295
295
|
* @param token The token address involved in the permit (for Permit2 type).
|
|
296
296
|
* @param owner The owner address involved in the permit.
|
package/dist/src/prelude.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const constants: {
|
|
|
14
14
|
export { time };
|
|
15
15
|
/**
|
|
16
16
|
* @category prelude
|
|
17
|
-
*
|
|
17
|
+
* Converts an Ether amount represented as a string into its Wei equivalent as a bigint.
|
|
18
18
|
* @param n The amount of Ether to convert, specified as a string.
|
|
19
19
|
* @return The equivalent amount in Wei as a bigint.
|
|
20
20
|
*/
|
package/dist/src/prelude.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.constants = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* @category prelude
|
|
22
|
-
*
|
|
22
|
+
* Converts an Ether amount represented as a string into its Wei equivalent as a bigint.
|
|
23
23
|
* @param n The amount of Ether to convert, specified as a string.
|
|
24
24
|
* @return The equivalent amount in Wei as a bigint.
|
|
25
25
|
*/
|
package/dist/src/profileEVM.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PathLike, promises as fs } from 'fs';
|
|
|
2
2
|
import { JsonRpcProvider } from 'ethers';
|
|
3
3
|
/**
|
|
4
4
|
* @category profileEVM
|
|
5
|
-
*
|
|
5
|
+
* Default configuration options for the `gasspectEVM` function to analyze gas usage in EVM transactions.
|
|
6
6
|
* @property minOpGasCost The minimal gas cost of operations to be returned in the analysis. Defaults to 300, filtering out less costly operations for clarity.
|
|
7
7
|
* @property args Boolean indicating whether to return the arguments of each operation in the analysis. Defaults to `false`, omitting arguments for simplicity.
|
|
8
8
|
* @property res Boolean indicating whether to return the results of each operation in the analysis. Defaults to `false`, omitting results to focus on gas usage.
|
|
@@ -14,7 +14,7 @@ export declare const gasspectOptionsDefault: {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* @category profileEVM
|
|
17
|
-
*
|
|
17
|
+
* Profiles EVM execution by counting occurrences of specified instructions in a transaction's execution trace.
|
|
18
18
|
* @param provider An Ethereum provider capable of sending custom RPC requests.
|
|
19
19
|
* @param txHash The hash of the transaction to profile.
|
|
20
20
|
* @param instruction An array of EVM instructions (opcodes) to count within the transaction's execution trace.
|
|
@@ -26,7 +26,7 @@ export declare function profileEVM(provider: JsonRpcProvider | {
|
|
|
26
26
|
}, txHash: string, instruction: string[], optionalTraceFile?: PathLike | fs.FileHandle): Promise<number[]>;
|
|
27
27
|
/**
|
|
28
28
|
* @category profileEVM
|
|
29
|
-
*
|
|
29
|
+
* Performs gas analysis on EVM transactions, highlighting operations that exceed a specified gas cost.
|
|
30
30
|
* Analyzes gas usage by operations within a transaction, applying filters and formatting based on options.
|
|
31
31
|
* @param provider The Ethereum JSON RPC provider or any custom provider with a `send` method.
|
|
32
32
|
* @param txHash Transaction hash to analyze.
|
package/dist/src/profileEVM.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.gasspectEVM = gasspectEVM;
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
/**
|
|
8
8
|
* @category profileEVM
|
|
9
|
-
*
|
|
9
|
+
* Default configuration options for the `gasspectEVM` function to analyze gas usage in EVM transactions.
|
|
10
10
|
* @property minOpGasCost The minimal gas cost of operations to be returned in the analysis. Defaults to 300, filtering out less costly operations for clarity.
|
|
11
11
|
* @property args Boolean indicating whether to return the arguments of each operation in the analysis. Defaults to `false`, omitting arguments for simplicity.
|
|
12
12
|
* @property res Boolean indicating whether to return the results of each operation in the analysis. Defaults to `false`, omitting results to focus on gas usage.
|
|
@@ -80,7 +80,7 @@ function _normalizeOp(ops, i) {
|
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* @category profileEVM
|
|
83
|
-
*
|
|
83
|
+
* Profiles EVM execution by counting occurrences of specified instructions in a transaction's execution trace.
|
|
84
84
|
* @param provider An Ethereum provider capable of sending custom RPC requests.
|
|
85
85
|
* @param txHash The hash of the transaction to profile.
|
|
86
86
|
* @param instruction An array of EVM instructions (opcodes) to count within the transaction's execution trace.
|
|
@@ -101,7 +101,7 @@ provider, txHash, instruction, optionalTraceFile) {
|
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* @category profileEVM
|
|
104
|
-
*
|
|
104
|
+
* Performs gas analysis on EVM transactions, highlighting operations that exceed a specified gas cost.
|
|
105
105
|
* Analyzes gas usage by operations within a transaction, applying filters and formatting based on options.
|
|
106
106
|
* @param provider The Ethereum JSON RPC provider or any custom provider with a `send` method.
|
|
107
107
|
* @param txHash Transaction hash to analyze.
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { constants } from './prelude';
|
|
|
6
6
|
import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider';
|
|
7
7
|
/**
|
|
8
8
|
* @category utils
|
|
9
|
-
*
|
|
9
|
+
* Options for deployment methods.
|
|
10
10
|
* @param contractName Name of the contract to deploy.
|
|
11
11
|
* @param constructorArgs Arguments for the contract's constructor.
|
|
12
12
|
* @param deployments Deployment facilitator object from Hardhat.
|
|
@@ -36,19 +36,19 @@ export interface DeployContractOptions {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* @category utils
|
|
39
|
-
*
|
|
39
|
+
* Options for deployment methods with create3. This is an extension of DeployContractOptions without `deployer` and `skipIfAlreadyDeployed`.
|
|
40
40
|
* @param txSigner Signer object to sign the deployment transaction.
|
|
41
41
|
* @param create3Deployer Address of the create3 deployer contract, which related to `contracts/interfaces/ICreate3Deployer.sol`.
|
|
42
42
|
* @param salt Salt value for create3 deployment.
|
|
43
43
|
*/
|
|
44
|
-
interface DeployContractOptionsWithCreate3 extends Omit<DeployContractOptions, 'deployer'> {
|
|
44
|
+
export interface DeployContractOptionsWithCreate3 extends Omit<DeployContractOptions, 'deployer'> {
|
|
45
45
|
txSigner?: Wallet | SignerWithAddress;
|
|
46
46
|
create3Deployer: string;
|
|
47
47
|
salt: string;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* @category utils
|
|
51
|
-
*
|
|
51
|
+
* Deploys a contract with optional Etherscan verification.
|
|
52
52
|
* @param options Deployment options. Default values:
|
|
53
53
|
* - constructorArgs: []
|
|
54
54
|
* - deploymentName: contractName
|
|
@@ -61,7 +61,7 @@ interface DeployContractOptionsWithCreate3 extends Omit<DeployContractOptions, '
|
|
|
61
61
|
export declare function deployAndGetContract(options: DeployContractOptions): Promise<Contract>;
|
|
62
62
|
/**
|
|
63
63
|
* @category utils
|
|
64
|
-
*
|
|
64
|
+
* Deploys a contract using create3 and saves the deployment information.
|
|
65
65
|
* @param options Deployment options. Default values:
|
|
66
66
|
* - constructorArgs: []
|
|
67
67
|
* - txSigner: first signer in the environment
|
|
@@ -74,7 +74,7 @@ export declare function deployAndGetContract(options: DeployContractOptions): Pr
|
|
|
74
74
|
export declare function deployAndGetContractWithCreate3(options: DeployContractOptionsWithCreate3): Promise<Contract>;
|
|
75
75
|
/**
|
|
76
76
|
* @category utils
|
|
77
|
-
*
|
|
77
|
+
* Saves the deployment information using the deploy transaction hash.
|
|
78
78
|
* @param provider JSON RPC provider or Hardhat Ethers Provider.
|
|
79
79
|
* @param deployments Deployment facilitator object from Hardhat.
|
|
80
80
|
* @param contractName Name of the contract to deploy.
|
|
@@ -90,13 +90,13 @@ export declare function saveContractWithCreate3Deployment(provider: JsonRpcProvi
|
|
|
90
90
|
salt: string, create3Deployer: string, deployTxHash: string, skipVerify?: boolean): Promise<Contract>;
|
|
91
91
|
/**
|
|
92
92
|
* @category utils
|
|
93
|
-
*
|
|
93
|
+
* Advances the blockchain time to a specific timestamp for testing purposes.
|
|
94
94
|
* @param seconds Target time in seconds or string format to increase to.
|
|
95
95
|
*/
|
|
96
96
|
export declare function timeIncreaseTo(seconds: number | string): Promise<void>;
|
|
97
97
|
/**
|
|
98
98
|
* @category utils
|
|
99
|
-
*
|
|
99
|
+
* Deploys a contract given a name and optional constructor parameters.
|
|
100
100
|
* @param name The contract name.
|
|
101
101
|
* @param parameters Constructor parameters for the contract.
|
|
102
102
|
* @returns The deployed contract instance.
|
|
@@ -104,7 +104,7 @@ export declare function timeIncreaseTo(seconds: number | string): Promise<void>;
|
|
|
104
104
|
export declare function deployContract(name: string, parameters?: Array<BigNumberish>): Promise<BaseContract>;
|
|
105
105
|
/**
|
|
106
106
|
* @category utils
|
|
107
|
-
*
|
|
107
|
+
* Deploys a contract from bytecode, useful for testing and deployment of minimal proxies.
|
|
108
108
|
* @param abi Contract ABI.
|
|
109
109
|
* @param bytecode Contract bytecode.
|
|
110
110
|
* @param parameters Constructor parameters.
|
|
@@ -125,16 +125,16 @@ export type Token = {
|
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
127
|
* @category utils
|
|
128
|
-
*
|
|
128
|
+
* Represents a tuple containing a token quantity and either a transaction receipt or a recursive instance of the same tuple type.
|
|
129
129
|
* This type is used in `trackReceivedTokenAndTx` method to track token transfers and their transaction receipts in a nested structure,
|
|
130
130
|
* allowing for handling of complex scenarios like chained or batched transactions and tracking several tokens.
|
|
131
|
-
* - result[0]
|
|
132
|
-
* - result[1]
|
|
131
|
+
* - `result[0]`: The amount of the token received.
|
|
132
|
+
* - `result[1]`: The transaction receipt or another nested token tracking result.
|
|
133
133
|
*/
|
|
134
134
|
export type TrackReceivedTokenAndTxResult = [bigint, ContractTransactionReceipt | TrackReceivedTokenAndTxResult];
|
|
135
135
|
/**
|
|
136
136
|
* @category utils
|
|
137
|
-
*
|
|
137
|
+
* Tracks token balance changes and transaction receipts for specified wallet addresses during test scenarios.
|
|
138
138
|
* It could be used recursively for multiple tokens via specific `txPromise` function.
|
|
139
139
|
* @param provider JSON RPC provider or custom provider object.
|
|
140
140
|
* @param token Token contract instance or ETH address constants.
|
|
@@ -152,14 +152,14 @@ export declare function trackReceivedTokenAndTx<T extends unknown[]>(provider: J
|
|
|
152
152
|
}, wallet: string, txPromise: (...args: T) => Promise<ContractTransactionResponse | TrackReceivedTokenAndTxResult>, ...args: T): Promise<TrackReceivedTokenAndTxResult>;
|
|
153
153
|
/**
|
|
154
154
|
* @category utils
|
|
155
|
-
*
|
|
155
|
+
* Corrects the ECDSA signature 'v' value according to Ethereum's standard.
|
|
156
156
|
* @param signature The original signature string.
|
|
157
157
|
* @returns The corrected signature string.
|
|
158
158
|
*/
|
|
159
159
|
export declare function fixSignature(signature: string): string;
|
|
160
160
|
/**
|
|
161
161
|
* @category utils
|
|
162
|
-
*
|
|
162
|
+
* Signs a message with a given signer and fixes the signature format.
|
|
163
163
|
* @param signer Signer object or wallet instance.
|
|
164
164
|
* @param messageHex The message to sign, in hex format.
|
|
165
165
|
* @returns The signed message string.
|
|
@@ -169,7 +169,7 @@ export declare function signMessage(signer: Wallet | {
|
|
|
169
169
|
}, messageHex?: string | Uint8Array): Promise<string>;
|
|
170
170
|
/**
|
|
171
171
|
* @category utils
|
|
172
|
-
*
|
|
172
|
+
* Counts the occurrences of specified EVM instructions in a transaction's execution trace.
|
|
173
173
|
* @param provider JSON RPC provider or custom provider object.
|
|
174
174
|
* @param txHash Transaction hash to analyze.
|
|
175
175
|
* @param instructions Array of EVM instructions (opcodes) to count.
|
|
@@ -180,7 +180,7 @@ export declare function countInstructions(provider: JsonRpcProvider | {
|
|
|
180
180
|
}, txHash: string, instructions: string[]): Promise<number[]>;
|
|
181
181
|
/**
|
|
182
182
|
* @category utils
|
|
183
|
-
*
|
|
183
|
+
* Retrieves the current USD price of ETH or another specified native token.
|
|
184
184
|
* This helper function is designed for use in test environments to maintain stability against market fluctuations.
|
|
185
185
|
* It fetches the current price of ETH (or a specified native token for side chains) in USD from the Coinbase API to
|
|
186
186
|
* ensure that tests remain stable and unaffected by significant market price fluctuations when token price is
|
|
@@ -189,4 +189,3 @@ export declare function countInstructions(provider: JsonRpcProvider | {
|
|
|
189
189
|
* @return The price of the specified native token in USD, scaled by 1e18 to preserve precision.
|
|
190
190
|
*/
|
|
191
191
|
export declare function getEthPrice(nativeTokenSymbol?: string): Promise<bigint>;
|
|
192
|
-
export {};
|
package/dist/src/utils.js
CHANGED
|
@@ -19,7 +19,7 @@ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
|
19
19
|
const prelude_1 = require("./prelude");
|
|
20
20
|
/**
|
|
21
21
|
* @category utils
|
|
22
|
-
*
|
|
22
|
+
* Deploys a contract with optional Etherscan verification.
|
|
23
23
|
* @param options Deployment options. Default values:
|
|
24
24
|
* - constructorArgs: []
|
|
25
25
|
* - deploymentName: contractName
|
|
@@ -65,7 +65,7 @@ async function deployAndGetContract(options) {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* @category utils
|
|
68
|
-
*
|
|
68
|
+
* Deploys a contract using create3 and saves the deployment information.
|
|
69
69
|
* @param options Deployment options. Default values:
|
|
70
70
|
* - constructorArgs: []
|
|
71
71
|
* - txSigner: first signer in the environment
|
|
@@ -95,7 +95,7 @@ async function deployAndGetContractWithCreate3(options) {
|
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* @category utils
|
|
98
|
-
*
|
|
98
|
+
* Saves the deployment information using the deploy transaction hash.
|
|
99
99
|
* @param provider JSON RPC provider or Hardhat Ethers Provider.
|
|
100
100
|
* @param deployments Deployment facilitator object from Hardhat.
|
|
101
101
|
* @param contractName Name of the contract to deploy.
|
|
@@ -142,7 +142,7 @@ salt, create3Deployer, deployTxHash, skipVerify = false) {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* @category utils
|
|
145
|
-
*
|
|
145
|
+
* Advances the blockchain time to a specific timestamp for testing purposes.
|
|
146
146
|
* @param seconds Target time in seconds or string format to increase to.
|
|
147
147
|
*/
|
|
148
148
|
async function timeIncreaseTo(seconds) {
|
|
@@ -152,7 +152,7 @@ async function timeIncreaseTo(seconds) {
|
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* @category utils
|
|
155
|
-
*
|
|
155
|
+
* Deploys a contract given a name and optional constructor parameters.
|
|
156
156
|
* @param name The contract name.
|
|
157
157
|
* @param parameters Constructor parameters for the contract.
|
|
158
158
|
* @returns The deployed contract instance.
|
|
@@ -165,7 +165,7 @@ async function deployContract(name, parameters = []) {
|
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* @category utils
|
|
168
|
-
*
|
|
168
|
+
* Deploys a contract from bytecode, useful for testing and deployment of minimal proxies.
|
|
169
169
|
* @param abi Contract ABI.
|
|
170
170
|
* @param bytecode Contract bytecode.
|
|
171
171
|
* @param parameters Constructor parameters.
|
|
@@ -181,7 +181,7 @@ async function deployContractFromBytecode(abi, bytecode, parameters = [], signer
|
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* @category utils
|
|
184
|
-
*
|
|
184
|
+
* Tracks token balance changes and transaction receipts for specified wallet addresses during test scenarios.
|
|
185
185
|
* It could be used recursively for multiple tokens via specific `txPromise` function.
|
|
186
186
|
* @param provider JSON RPC provider or custom provider object.
|
|
187
187
|
* @param token Token contract instance or ETH address constants.
|
|
@@ -205,7 +205,7 @@ async function trackReceivedTokenAndTx(provider, token, wallet, txPromise, ...ar
|
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* @category utils
|
|
208
|
-
*
|
|
208
|
+
* Corrects the ECDSA signature 'v' value according to Ethereum's standard.
|
|
209
209
|
* @param signature The original signature string.
|
|
210
210
|
* @returns The corrected signature string.
|
|
211
211
|
*/
|
|
@@ -222,7 +222,7 @@ function fixSignature(signature) {
|
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
224
224
|
* @category utils
|
|
225
|
-
*
|
|
225
|
+
* Signs a message with a given signer and fixes the signature format.
|
|
226
226
|
* @param signer Signer object or wallet instance.
|
|
227
227
|
* @param messageHex The message to sign, in hex format.
|
|
228
228
|
* @returns The signed message string.
|
|
@@ -232,7 +232,7 @@ async function signMessage(signer, messageHex = '0x') {
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* @category utils
|
|
235
|
-
*
|
|
235
|
+
* Counts the occurrences of specified EVM instructions in a transaction's execution trace.
|
|
236
236
|
* @param provider JSON RPC provider or custom provider object.
|
|
237
237
|
* @param txHash Transaction hash to analyze.
|
|
238
238
|
* @param instructions Array of EVM instructions (opcodes) to count.
|
|
@@ -249,7 +249,7 @@ provider, txHash, instructions) {
|
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* @category utils
|
|
252
|
-
*
|
|
252
|
+
* Retrieves the current USD price of ETH or another specified native token.
|
|
253
253
|
* This helper function is designed for use in test environments to maintain stability against market fluctuations.
|
|
254
254
|
* It fetches the current price of ETH (or a specified native token for side chains) in USD from the Coinbase API to
|
|
255
255
|
* ensure that tests remain stable and unaffected by significant market price fluctuations when token price is
|