@1inch/solidity-utils 2.2.7 → 2.2.8
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/src/asserts.d.ts +1 -3
- package/dist/src/asserts.js +14 -21
- package/dist/src/asserts.js.map +1 -1
- package/dist/src/permit.d.ts +9 -23
- package/dist/src/permit.js +48 -26
- package/dist/src/permit.js.map +1 -1
- package/dist/src/prelude.d.ts +8 -14
- package/dist/src/prelude.js +10 -23
- package/dist/src/prelude.js.map +1 -1
- package/dist/src/profileEVM.d.ts +4 -2
- package/dist/src/profileEVM.js +31 -40
- package/dist/src/profileEVM.js.map +1 -1
- package/dist/src/utils.d.ts +6 -9
- package/dist/src/utils.js +22 -26
- package/dist/src/utils.js.map +1 -1
- package/package.json +2 -2
package/dist/src/asserts.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function toBNExtended(value: string | number | BN): BN;
|
|
3
|
-
export declare function assertRoughlyEqualValues(expected: string | number | BN, actual: string | number | BN, relativeDiff: number): void;
|
|
1
|
+
export declare function assertRoughlyEqualValues(expected: string | number | bigint, actual: string | number | bigint, relativeDiff: number): void;
|
package/dist/src/asserts.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertRoughlyEqualValues =
|
|
3
|
+
exports.assertRoughlyEqualValues = void 0;
|
|
4
4
|
const prelude_1 = require("./prelude");
|
|
5
|
-
function toBNExtended(value) {
|
|
6
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
7
|
-
return (0, prelude_1.toBN)(value);
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
exports.toBNExtended = toBNExtended;
|
|
12
5
|
function assertRoughlyEqualValues(expected, actual, relativeDiff) {
|
|
13
|
-
let expectedBN =
|
|
14
|
-
let actualBN =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
let expectedBN = BigInt(expected);
|
|
7
|
+
let actualBN = BigInt(actual);
|
|
8
|
+
(0, prelude_1.expect)(expectedBN * actualBN).to.be.gte(0, 'Values are of different sign');
|
|
9
|
+
if (expectedBN < 0)
|
|
10
|
+
expectedBN = -expectedBN;
|
|
11
|
+
if (actualBN < 0)
|
|
12
|
+
actualBN = -actualBN;
|
|
20
13
|
let multiplerNumerator = relativeDiff;
|
|
21
|
-
let multiplerDenominator =
|
|
14
|
+
let multiplerDenominator = 1n;
|
|
22
15
|
while (!Number.isInteger(multiplerNumerator)) {
|
|
23
|
-
multiplerDenominator = multiplerDenominator
|
|
16
|
+
multiplerDenominator = multiplerDenominator * 10n;
|
|
24
17
|
multiplerNumerator *= 10;
|
|
25
18
|
}
|
|
26
|
-
const diff = expectedBN
|
|
27
|
-
const treshold = expectedBN
|
|
28
|
-
if (
|
|
29
|
-
(0, prelude_1.expect)(actualBN).to.be.
|
|
19
|
+
const diff = expectedBN > actualBN ? expectedBN - actualBN : actualBN - expectedBN;
|
|
20
|
+
const treshold = (expectedBN * BigInt(multiplerNumerator)) / multiplerDenominator;
|
|
21
|
+
if (diff > treshold) {
|
|
22
|
+
(0, prelude_1.expect)(actualBN).to.be.equal(expectedBN, `${actual} != ${expected} with ${relativeDiff} precision`);
|
|
30
23
|
}
|
|
31
24
|
}
|
|
32
25
|
exports.assertRoughlyEqualValues = assertRoughlyEqualValues;
|
package/dist/src/asserts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asserts.js","sourceRoot":"","sources":["../../src/asserts.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"asserts.js","sourceRoot":"","sources":["../../src/asserts.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAEnC,SAAgB,wBAAwB,CACpC,QAAkC,EAClC,MAAgC,EAChC,YAAoB;IAEpB,IA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ethers';
|
|
4
|
+
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
|
|
4
5
|
export declare const TypedDataVersion = SignTypedDataVersion.V4;
|
|
5
|
-
export declare const defaultDeadline:
|
|
6
|
+
export declare const defaultDeadline: bigint;
|
|
6
7
|
export declare const EIP712Domain: {
|
|
7
8
|
name: string;
|
|
8
9
|
type: string;
|
|
@@ -15,16 +16,11 @@ export declare const DaiLikePermit: {
|
|
|
15
16
|
name: string;
|
|
16
17
|
type: string;
|
|
17
18
|
}[];
|
|
18
|
-
export declare function trim0x(bigNumber:
|
|
19
|
+
export declare function trim0x(bigNumber: bigint | string): string;
|
|
19
20
|
export declare function cutSelector(data: string): string;
|
|
20
21
|
export declare function domainSeparator(name: string, version: string, chainId: string, verifyingContract: string): string;
|
|
21
22
|
export declare function buildData(name: string, version: string, chainId: number, verifyingContract: string, owner: string, spender: string, value: string, nonce: string, deadline?: string): {
|
|
22
|
-
readonly primaryType: "Permit";
|
|
23
23
|
readonly types: {
|
|
24
|
-
readonly EIP712Domain: {
|
|
25
|
-
name: string;
|
|
26
|
-
type: string;
|
|
27
|
-
}[];
|
|
28
24
|
readonly Permit: {
|
|
29
25
|
name: string;
|
|
30
26
|
type: string;
|
|
@@ -45,12 +41,7 @@ export declare function buildData(name: string, version: string, chainId: number
|
|
|
45
41
|
};
|
|
46
42
|
};
|
|
47
43
|
export declare function buildDataLikeDai(name: string, version: string, chainId: number, verifyingContract: string, holder: string, spender: string, nonce: string, allowed: boolean, expiry?: string): {
|
|
48
|
-
readonly primaryType: "Permit";
|
|
49
44
|
readonly types: {
|
|
50
|
-
readonly EIP712Domain: {
|
|
51
|
-
name: string;
|
|
52
|
-
type: string;
|
|
53
|
-
}[];
|
|
54
45
|
readonly Permit: {
|
|
55
46
|
name: string;
|
|
56
47
|
type: string;
|
|
@@ -70,11 +61,6 @@ export declare function buildDataLikeDai(name: string, version: string, chainId:
|
|
|
70
61
|
readonly allowed: boolean;
|
|
71
62
|
};
|
|
72
63
|
};
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
export declare function signWithPk<T extends MessageTypes>(privateKey: Buffer | string, data: TypedMessage<T>): string;
|
|
78
|
-
export declare function getPermit(owner: string, ownerPrivateKey: string, permitContract: PermittableToken, tokenVersion: string, chainId: number, spender: string, value: string, deadline?: string): Promise<string>;
|
|
79
|
-
export declare function getPermitLikeDai(holder: string, holderPrivateKey: string, permitContract: PermittableToken, tokenVersion: string, chainId: number, spender: string, allowed: boolean, expiry?: string): Promise<string>;
|
|
80
|
-
export declare function withTarget(target: BN | string, data: BN | string): string;
|
|
64
|
+
export declare function getPermit(owner: Wallet | SignerWithAddress, permitContract: Contract, tokenVersion: string, chainId: number, spender: string, value: string, deadline?: string, compact?: boolean): Promise<string>;
|
|
65
|
+
export declare function getPermitLikeDai(holder: Wallet | SignerWithAddress, permitContract: Contract, tokenVersion: string, chainId: number, spender: string, allowed: boolean, expiry?: string, compact?: boolean): Promise<string>;
|
|
66
|
+
export declare function withTarget(target: bigint | string, data: bigint | string): string;
|
package/dist/src/permit.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withTarget = exports.getPermitLikeDai = exports.getPermit = exports.
|
|
3
|
+
exports.withTarget = exports.getPermitLikeDai = exports.getPermit = exports.buildDataLikeDai = exports.buildData = exports.domainSeparator = exports.cutSelector = exports.trim0x = exports.DaiLikePermit = exports.Permit = exports.EIP712Domain = exports.defaultDeadline = exports.TypedDataVersion = void 0;
|
|
4
4
|
const eth_sig_util_1 = require("@metamask/eth-sig-util");
|
|
5
|
-
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
6
5
|
const prelude_1 = require("./prelude");
|
|
6
|
+
const utils_1 = require("ethers/lib/utils");
|
|
7
7
|
exports.TypedDataVersion = eth_sig_util_1.SignTypedDataVersion.V4;
|
|
8
8
|
exports.defaultDeadline = prelude_1.constants.MAX_UINT256;
|
|
9
9
|
exports.EIP712Domain = [
|
|
@@ -40,55 +40,77 @@ function cutSelector(data) {
|
|
|
40
40
|
}
|
|
41
41
|
exports.cutSelector = cutSelector;
|
|
42
42
|
function domainSeparator(name, version, chainId, verifyingContract) {
|
|
43
|
-
return '0x' +
|
|
43
|
+
return ('0x' +
|
|
44
|
+
eth_sig_util_1.TypedDataUtils.hashStruct('EIP712Domain', { name, version, chainId, verifyingContract }, { EIP712Domain: exports.EIP712Domain }, exports.TypedDataVersion).toString('hex'));
|
|
44
45
|
}
|
|
45
46
|
exports.domainSeparator = domainSeparator;
|
|
46
|
-
function buildData(name, version, chainId, verifyingContract, owner, spender, value, nonce, deadline = exports.defaultDeadline) {
|
|
47
|
+
function buildData(name, version, chainId, verifyingContract, owner, spender, value, nonce, deadline = exports.defaultDeadline.toString()) {
|
|
47
48
|
return {
|
|
48
|
-
|
|
49
|
-
types: { EIP712Domain: exports.EIP712Domain, Permit: exports.Permit },
|
|
49
|
+
types: { Permit: exports.Permit },
|
|
50
50
|
domain: { name, version, chainId, verifyingContract },
|
|
51
51
|
message: { owner, spender, value, nonce, deadline },
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
exports.buildData = buildData;
|
|
55
|
-
function buildDataLikeDai(name, version, chainId, verifyingContract, holder, spender, nonce, allowed, expiry = exports.defaultDeadline) {
|
|
55
|
+
function buildDataLikeDai(name, version, chainId, verifyingContract, holder, spender, nonce, allowed, expiry = exports.defaultDeadline.toString()) {
|
|
56
56
|
return {
|
|
57
|
-
|
|
58
|
-
types: { EIP712Domain: exports.EIP712Domain, Permit: exports.DaiLikePermit },
|
|
57
|
+
types: { Permit: exports.DaiLikePermit },
|
|
59
58
|
domain: { name, version, chainId, verifyingContract },
|
|
60
59
|
message: { holder, spender, nonce, expiry, allowed },
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
exports.buildDataLikeDai = buildDataLikeDai;
|
|
64
|
-
function signWithPk(privateKey, data) {
|
|
65
|
-
const buffer = Buffer.isBuffer(privateKey) ? privateKey : Buffer.from(trim0x(privateKey), 'hex');
|
|
66
|
-
return (0, eth_sig_util_1.signTypedData)({ privateKey: buffer, data, version: exports.TypedDataVersion });
|
|
67
|
-
}
|
|
68
|
-
exports.signWithPk = signWithPk;
|
|
69
63
|
/*
|
|
70
64
|
* @param permitContract The contract object with ERC20Permit type and token address for which the permit creating.
|
|
71
65
|
*/
|
|
72
|
-
async function getPermit(owner,
|
|
73
|
-
const nonce = await permitContract.nonces(owner);
|
|
66
|
+
async function getPermit(owner, permitContract, tokenVersion, chainId, spender, value, deadline = exports.defaultDeadline.toString(), compact = false) {
|
|
67
|
+
const nonce = await permitContract.nonces(owner.address);
|
|
74
68
|
const name = await permitContract.name();
|
|
75
|
-
const data = buildData(name, tokenVersion, chainId, permitContract.address, owner, spender, value, nonce.toString(), deadline);
|
|
76
|
-
const signature =
|
|
77
|
-
const { v, r, s } = (0,
|
|
78
|
-
|
|
69
|
+
const data = buildData(name, tokenVersion, chainId, permitContract.address, owner.address, spender, value, nonce.toString(), deadline);
|
|
70
|
+
const signature = await owner._signTypedData(data.domain, data.types, data.message);
|
|
71
|
+
const { v, r, s } = (0, utils_1.splitSignature)(signature);
|
|
72
|
+
if (compact) {
|
|
73
|
+
if (BigInt(deadline) !== prelude_1.constants.MAX_UINT256 && BigInt(deadline) >= (1n << 32n)) {
|
|
74
|
+
throw new Error('Deadline is too big for the compact mode');
|
|
75
|
+
}
|
|
76
|
+
return '0x' +
|
|
77
|
+
BigInt(value).toString(16).padStart(64, '0') +
|
|
78
|
+
(deadline === prelude_1.constants.MAX_UINT256.toString() ? '00000000' : (BigInt(deadline) + 1n).toString(16).padStart(8, '0')) +
|
|
79
|
+
BigInt(r).toString(16).padStart(64, '0') +
|
|
80
|
+
(BigInt(s) | (BigInt(v - 27) << 255n)).toString(16).padStart(64, '0');
|
|
81
|
+
}
|
|
82
|
+
const permitCall = permitContract.interface.encodeFunctionData('permit', [
|
|
83
|
+
owner.address,
|
|
84
|
+
spender,
|
|
85
|
+
value,
|
|
86
|
+
deadline,
|
|
87
|
+
v,
|
|
88
|
+
r,
|
|
89
|
+
s,
|
|
90
|
+
]);
|
|
79
91
|
return cutSelector(permitCall);
|
|
80
92
|
}
|
|
81
93
|
exports.getPermit = getPermit;
|
|
82
94
|
/*
|
|
83
95
|
* @param permitContract The contract object with ERC20PermitLikeDai type and token address for which the permit creating.
|
|
84
96
|
*/
|
|
85
|
-
async function getPermitLikeDai(holder,
|
|
86
|
-
const nonce = await permitContract.nonces(holder);
|
|
97
|
+
async function getPermitLikeDai(holder, permitContract, tokenVersion, chainId, spender, allowed, expiry = exports.defaultDeadline.toString(), compact = false) {
|
|
98
|
+
const nonce = await permitContract.nonces(holder.address);
|
|
87
99
|
const name = await permitContract.name();
|
|
88
|
-
const data = buildDataLikeDai(name, tokenVersion, chainId, permitContract.address, holder, spender, nonce.toString(), allowed, expiry);
|
|
89
|
-
const signature =
|
|
90
|
-
const { v, r, s } = (0,
|
|
91
|
-
|
|
100
|
+
const data = buildDataLikeDai(name, tokenVersion, chainId, permitContract.address, holder.address, spender, nonce.toString(), allowed, expiry);
|
|
101
|
+
const signature = await holder._signTypedData(data.domain, data.types, data.message);
|
|
102
|
+
const { v, r, s } = (0, utils_1.splitSignature)(signature);
|
|
103
|
+
if (compact) {
|
|
104
|
+
if (BigInt(expiry) !== prelude_1.constants.MAX_UINT256 && BigInt(expiry) >= (1n << 32n)) {
|
|
105
|
+
throw new Error('Expiry is too big for the compact mode');
|
|
106
|
+
}
|
|
107
|
+
return '0x' +
|
|
108
|
+
BigInt(nonce).toString(16).padStart(8, '0') +
|
|
109
|
+
(expiry === prelude_1.constants.MAX_UINT256.toString() ? '00000000' : (BigInt(expiry) + 1n).toString(16).padStart(8, '0')) +
|
|
110
|
+
BigInt(r).toString(16).padStart(64, '0') +
|
|
111
|
+
(BigInt(s) | (BigInt(v - 27) << 255n)).toString(16).padStart(64, '0');
|
|
112
|
+
}
|
|
113
|
+
const permitCall = permitContract.interface.encodeFunctionData('permit(address,address,uint256,uint256,bool,uint8,bytes32,bytes32)', [holder.address, spender, nonce, expiry, allowed, v, r, s]);
|
|
92
114
|
return cutSelector(permitCall);
|
|
93
115
|
}
|
|
94
116
|
exports.getPermitLikeDai = getPermitLikeDai;
|
package/dist/src/permit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permit.js","sourceRoot":"","sources":["../../src/permit.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"permit.js","sourceRoot":"","sources":["../../src/permit.ts"],"names":[],"mappings":";;;AAAA,yDAA8E;AAC9E,uCAAsC;AAGtC,4CAAkD;AAGrC,QAAA,gBAAgB,GAAG,mCAAoB,CAAC,EAAE,CAAC;AAC3C,QAAA,eAAe,GAAG,mBAAS,CAAC,WAAW,CAAC;AAExC,QAAA,YAAY,GAAG;IACxB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;CACjD,CAAC;AAEW,QAAA,MAAM,GAAG;IAClB,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;CACxC,CAAC;AAEW,QAAA,aAAa,GAAG;IACzB,EAAE,IAAI,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AAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAChH,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;YACxC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;KAC7E;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAC1D,oEAAoE,EACpE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAC7D,CAAC;IACF,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC;AA1CD,4CA0CC;AAED,SAAgB,UAAU,CAAC,MAAuB,EAAE,IAAqB;IACrE,OAAO,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAFD,gCAEC"}
|
package/dist/src/prelude.d.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { Assertion, AssertionError, assert, expect, config, should } from 'chai';
|
|
2
|
-
import '
|
|
3
|
-
import BN from 'bn.js';
|
|
4
|
-
export declare function toBN(num: string | number, base?: number | 'hex'): BN;
|
|
2
|
+
import { time } from '@nomicfoundation/hardhat-network-helpers';
|
|
5
3
|
export declare const constants: {
|
|
6
4
|
readonly ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
7
5
|
readonly EEE_ADDRESS: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
8
6
|
readonly ZERO_BYTES32: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
9
|
-
readonly MAX_UINT256:
|
|
10
|
-
readonly MAX_INT256:
|
|
11
|
-
readonly MIN_INT256:
|
|
7
|
+
readonly MAX_UINT256: bigint;
|
|
8
|
+
readonly MAX_INT256: bigint;
|
|
9
|
+
readonly MIN_INT256: bigint;
|
|
10
|
+
readonly MAX_UINT128: bigint;
|
|
12
11
|
};
|
|
13
|
-
export {
|
|
14
|
-
export declare
|
|
15
|
-
|
|
16
|
-
latest: () => Promise<BN>;
|
|
17
|
-
};
|
|
18
|
-
export declare const time: Time;
|
|
19
|
-
export declare function ether(n: string): BN;
|
|
20
|
-
export { Assertion, AssertionError, assert, expect, config, should, };
|
|
12
|
+
export { time };
|
|
13
|
+
export declare function ether(n: string): bigint;
|
|
14
|
+
export { Assertion, AssertionError, assert, expect, config, should };
|
package/dist/src/prelude.js
CHANGED
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.should = exports.config = exports.expect = exports.assert = exports.AssertionError = exports.Assertion = exports.ether = exports.time = exports.
|
|
4
|
-
const
|
|
5
|
-
const chai_1 = tslib_1.__importStar(require("chai"));
|
|
3
|
+
exports.should = exports.config = exports.expect = exports.assert = exports.AssertionError = exports.Assertion = exports.ether = exports.time = exports.constants = void 0;
|
|
4
|
+
const chai_1 = require("chai");
|
|
6
5
|
Object.defineProperty(exports, "Assertion", { enumerable: true, get: function () { return chai_1.Assertion; } });
|
|
7
6
|
Object.defineProperty(exports, "AssertionError", { enumerable: true, get: function () { return chai_1.AssertionError; } });
|
|
8
7
|
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return chai_1.assert; } });
|
|
9
8
|
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return chai_1.expect; } });
|
|
10
9
|
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return chai_1.config; } });
|
|
11
10
|
Object.defineProperty(exports, "should", { enumerable: true, get: function () { return chai_1.should; } });
|
|
12
|
-
require("
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
|
|
16
|
-
exports.BN = bn_js_1.default;
|
|
17
|
-
chai_1.default.use(chai_as_promised_1.default);
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
19
|
-
const { time: timeImpl } = require('@openzeppelin/test-helpers');
|
|
20
|
-
function toBN(num, base) {
|
|
21
|
-
if (typeof (num) === 'string' && num.startsWith('0x')) {
|
|
22
|
-
return new bn_js_1.default(num.substring(2), 16);
|
|
23
|
-
}
|
|
24
|
-
return new bn_js_1.default(num, base);
|
|
25
|
-
}
|
|
26
|
-
exports.toBN = toBN;
|
|
11
|
+
const utils_1 = require("ethers/lib/utils");
|
|
12
|
+
const hardhat_network_helpers_1 = require("@nomicfoundation/hardhat-network-helpers");
|
|
13
|
+
Object.defineProperty(exports, "time", { enumerable: true, get: function () { return hardhat_network_helpers_1.time; } });
|
|
27
14
|
exports.constants = {
|
|
28
15
|
ZERO_ADDRESS: '0x0000000000000000000000000000000000000000',
|
|
29
16
|
EEE_ADDRESS: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
30
17
|
ZERO_BYTES32: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
31
|
-
MAX_UINT256:
|
|
32
|
-
MAX_INT256:
|
|
33
|
-
MIN_INT256:
|
|
18
|
+
MAX_UINT256: 2n ** 256n - 1n,
|
|
19
|
+
MAX_INT256: 2n ** 255n - 1n,
|
|
20
|
+
MIN_INT256: -(2n ** 255n),
|
|
21
|
+
MAX_UINT128: 2n ** 128n - 1n,
|
|
34
22
|
};
|
|
35
|
-
exports.time = timeImpl;
|
|
36
23
|
function ether(n) {
|
|
37
|
-
return
|
|
24
|
+
return (0, utils_1.parseUnits)(n).toBigInt();
|
|
38
25
|
}
|
|
39
26
|
exports.ether = ether;
|
|
40
27
|
//# sourceMappingURL=prelude.js.map
|
package/dist/src/prelude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/prelude.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/prelude.ts"],"names":[],"mappings":";;;AAAA,+BAAiF;AAsBxE,0FAtBA,gBAAS,OAsBA;AAAE,+FAtBA,qBAAc,OAsBA;AAAE,uFAtBA,aAAM,OAsBA;AAAE,uFAtBA,aAAM,OAsBA;AAAE,uFAtBA,aAAM,OAsBA;AAAE,uFAtBA,aAAM,OAsBA;AArBlE,4CAA8C;AAC9C,sFAAgE;AAavD,qFAbA,8BAAI,OAaA;AAXA,QAAA,SAAS,GAAG;IACrB,YAAY,EAAE,4CAA4C;IAC1D,WAAW,EAAE,4CAA4C;IACzD,YAAY,EAAE,oEAAoE;IAClF,WAAW,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;IAC3B,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC;IACzB,WAAW,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;CACtB,CAAC;AAKX,SAAgB,KAAK,CAAC,CAAS;IAC3B,OAAO,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACpC,CAAC;AAFD,sBAEC"}
|
package/dist/src/profileEVM.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { PathLike, promises as fs } from 'fs';
|
|
4
|
+
import { providers } from 'ethers';
|
|
3
5
|
export declare const gasspectOptionsDefault: {
|
|
4
6
|
minOpGasCost: number;
|
|
5
7
|
args: boolean;
|
|
6
8
|
res: boolean;
|
|
7
9
|
};
|
|
8
|
-
export declare function profileEVM(txHash: string, instruction: string[], optionalTraceFile?: PathLike | fs.FileHandle): Promise<number[]>;
|
|
9
|
-
export declare function gasspectEVM(txHash: string, gasspectOptions?: Record<string, unknown>, optionalTraceFile?: PathLike | fs.FileHandle): Promise<string[]>;
|
|
10
|
+
export declare function profileEVM(provider: providers.JsonRpcProvider, txHash: string, instruction: string[], optionalTraceFile?: PathLike | fs.FileHandle): Promise<number[]>;
|
|
11
|
+
export declare function gasspectEVM(provider: providers.JsonRpcProvider, txHash: string, gasspectOptions?: Record<string, unknown>, optionalTraceFile?: PathLike | fs.FileHandle): Promise<string[]>;
|
package/dist/src/profileEVM.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gasspectEVM = exports.profileEVM = exports.gasspectOptionsDefault = void 0;
|
|
4
|
-
const util_1 = require("util");
|
|
5
4
|
const fs_1 = require("fs");
|
|
6
|
-
const prelude_1 = require("./prelude");
|
|
7
5
|
exports.gasspectOptionsDefault = {
|
|
8
6
|
minOpGasCost: 300,
|
|
9
7
|
args: false,
|
|
@@ -12,16 +10,21 @@ exports.gasspectOptionsDefault = {
|
|
|
12
10
|
function _normalizeOp(ops, i) {
|
|
13
11
|
if (ops[i].op === 'STATICCALL') {
|
|
14
12
|
ops[i].gasCost = ops[i].gasCost - ops[i + 1].gas;
|
|
15
|
-
if (ops[i].stack.length > 8 &&
|
|
13
|
+
if (ops[i].stack.length > 8 &&
|
|
14
|
+
ops[i].stack[ops[i].stack.length - 8] === '0000000000000000000000000000000000000000000000000000000000000001') {
|
|
16
15
|
ops[i].op = 'STATICCALL-ECRECOVER';
|
|
17
16
|
}
|
|
18
|
-
else if (ops[i].stack.length > 8 &&
|
|
17
|
+
else if (ops[i].stack.length > 8 &&
|
|
18
|
+
ops[i].stack[ops[i].stack.length - 8] <= '00000000000000000000000000000000000000000000000000000000000000FF') {
|
|
19
19
|
ops[i].op = 'STATICCALL-' + ops[i].stack[ops[i].stack.length - 8].substr(62, 2);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
ops[i].args = [
|
|
23
|
-
'0x' + ops[i].stack[ops[i].stack.length - 2].
|
|
24
|
-
'0x' +
|
|
23
|
+
'0x' + ops[i].stack[ops[i].stack.length - 2].substring(24),
|
|
24
|
+
'0x' +
|
|
25
|
+
(ops[i].memory || [])
|
|
26
|
+
.join('')
|
|
27
|
+
.substr(2 * Number(ops[i].stack[ops[i].stack.length - 3]), 2 * Number(ops[i].stack[ops[i].stack.length - 4])),
|
|
25
28
|
];
|
|
26
29
|
if (ops[i].gasCost === 100) {
|
|
27
30
|
ops[i].op += '_R';
|
|
@@ -30,8 +33,11 @@ function _normalizeOp(ops, i) {
|
|
|
30
33
|
}
|
|
31
34
|
if (['CALL', 'DELEGATECALL', 'CALLCODE'].indexOf(ops[i].op) !== -1) {
|
|
32
35
|
ops[i].args = [
|
|
33
|
-
'0x' + ops[i].stack[ops[i].stack.length - 2].
|
|
34
|
-
'0x' +
|
|
36
|
+
'0x' + ops[i].stack[ops[i].stack.length - 2].substring(24),
|
|
37
|
+
'0x' +
|
|
38
|
+
(ops[i].memory || [])
|
|
39
|
+
.join('')
|
|
40
|
+
.substr(2 * Number(ops[i].stack[ops[i].stack.length - 4]), 2 * Number(ops[i].stack[ops[i].stack.length - 5])),
|
|
35
41
|
];
|
|
36
42
|
ops[i].gasCost = ops[i].gasCost - ops[i + 1].gas;
|
|
37
43
|
ops[i].res = ops[i + 1].stack[ops[i + 1].stack.length - 1];
|
|
@@ -43,16 +49,14 @@ function _normalizeOp(ops, i) {
|
|
|
43
49
|
ops[i].gasCost = 3;
|
|
44
50
|
}
|
|
45
51
|
if (['SSTORE', 'SLOAD'].indexOf(ops[i].op) !== -1) {
|
|
46
|
-
ops[i].args = [
|
|
47
|
-
'0x' + ops[i].stack[ops[i].stack.length - 1],
|
|
48
|
-
];
|
|
52
|
+
ops[i].args = ['0x' + ops[i].stack[ops[i].stack.length - 1]];
|
|
49
53
|
if (ops[i].op === 'SSTORE') {
|
|
50
54
|
ops[i].args.push('0x' + ops[i].stack[ops[i].stack.length - 2]);
|
|
51
55
|
}
|
|
52
56
|
if (ops[i].gasCost === 100) {
|
|
53
57
|
ops[i].op += '_R';
|
|
54
58
|
}
|
|
55
|
-
if (ops[i].gasCost
|
|
59
|
+
if (ops[i].gasCost >= 20000) {
|
|
56
60
|
ops[i].op += '_I';
|
|
57
61
|
}
|
|
58
62
|
if (ops[i].op.startsWith('SLOAD')) {
|
|
@@ -60,43 +64,25 @@ function _normalizeOp(ops, i) {
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
if (ops[i].op === 'EXTCODESIZE') {
|
|
63
|
-
ops[i].args = [
|
|
64
|
-
'0x' + ops[i].stack[ops[i].stack.length - 1].substr(24),
|
|
65
|
-
];
|
|
67
|
+
ops[i].args = ['0x' + ops[i].stack[ops[i].stack.length - 1].substring(24)];
|
|
66
68
|
ops[i].res = ops[i + 1].stack[ops[i + 1].stack.length - 1];
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
async function profileEVM(txHash, instruction, optionalTraceFile) {
|
|
70
|
-
|
|
71
|
-
throw new Error('Unsupported provider');
|
|
72
|
-
}
|
|
73
|
-
const trace = await (0, util_1.promisify)(web3.currentProvider.send.bind(web3.currentProvider))({
|
|
74
|
-
jsonrpc: '2.0',
|
|
75
|
-
method: 'debug_traceTransaction',
|
|
76
|
-
params: [txHash, {}],
|
|
77
|
-
id: new Date().getTime(),
|
|
78
|
-
});
|
|
71
|
+
async function profileEVM(provider, txHash, instruction, optionalTraceFile) {
|
|
72
|
+
const trace = await provider.send('debug_traceTransaction', [txHash]);
|
|
79
73
|
const str = JSON.stringify(trace);
|
|
80
74
|
if (optionalTraceFile) {
|
|
81
75
|
await fs_1.promises.writeFile(optionalTraceFile, str);
|
|
82
76
|
}
|
|
83
|
-
return instruction.map(instr => {
|
|
77
|
+
return instruction.map((instr) => {
|
|
84
78
|
return str.split('"' + instr.toUpperCase() + '"').length - 1;
|
|
85
79
|
});
|
|
86
80
|
}
|
|
87
81
|
exports.profileEVM = profileEVM;
|
|
88
|
-
async function gasspectEVM(txHash, gasspectOptions = {}, optionalTraceFile) {
|
|
82
|
+
async function gasspectEVM(provider, txHash, gasspectOptions = {}, optionalTraceFile) {
|
|
89
83
|
const options = { ...exports.gasspectOptionsDefault, ...gasspectOptions };
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
const trace = await (0, util_1.promisify)(web3.currentProvider.send.bind(web3.currentProvider))({
|
|
94
|
-
jsonrpc: '2.0',
|
|
95
|
-
method: 'debug_traceTransaction',
|
|
96
|
-
params: [txHash, {}],
|
|
97
|
-
id: new Date().getTime(),
|
|
98
|
-
});
|
|
99
|
-
const ops = trace === null || trace === void 0 ? void 0 : trace.result.structLogs;
|
|
84
|
+
const trace = await provider.send('debug_traceTransaction', [txHash]);
|
|
85
|
+
const ops = trace.structLogs;
|
|
100
86
|
const traceAddress = [0, -1];
|
|
101
87
|
for (const [i, op] of ops.entries()) {
|
|
102
88
|
op.traceAddress = traceAddress.slice(0, traceAddress.length - 1);
|
|
@@ -109,12 +95,17 @@ async function gasspectEVM(txHash, gasspectOptions = {}, optionalTraceFile) {
|
|
|
109
95
|
traceAddress.pop();
|
|
110
96
|
}
|
|
111
97
|
}
|
|
112
|
-
const result = ops
|
|
98
|
+
const result = ops
|
|
99
|
+
.filter((op) => op.gasCost > options.minOpGasCost)
|
|
100
|
+
.map((op) => op.traceAddress.join('-') +
|
|
101
|
+
'-' +
|
|
102
|
+
op.op +
|
|
113
103
|
(options.args ? '(' + (op.args || []).join(',') + ')' : '') +
|
|
114
104
|
(options.res ? (op.res ? ':0x' + op.res : '') : '') +
|
|
115
|
-
' = ' +
|
|
105
|
+
' = ' +
|
|
106
|
+
op.gasCost);
|
|
116
107
|
if (optionalTraceFile) {
|
|
117
|
-
await fs_1.promises.writeFile(optionalTraceFile, JSON.stringify(
|
|
108
|
+
await fs_1.promises.writeFile(optionalTraceFile, JSON.stringify(trace));
|
|
118
109
|
}
|
|
119
110
|
return result;
|
|
120
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileEVM.js","sourceRoot":"","sources":["../../src/profileEVM.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"profileEVM.js","sourceRoot":"","sources":["../../src/profileEVM.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAGjC,QAAA,sBAAsB,GAAG;IAClC,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK,EAAE,4BAA4B;CAC3C,CAAC;AAcF,SAAS,YAAY,CAAC,GAAS,EAAE,CAAS;IACtC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,YAAY,EAAE;QAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAEjD,IACI,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YACvB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,kEAAkE,EAC9G;YACE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,sBAAsB,CAAC;SACtC;aAAM,IACH,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YACvB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,kEAAkE,EAC7G;YACE,GAAG,CAAC,CA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C,EAAE,CAAC;QACnD,KAAK;QACL,EAAE,CAAC,OAAO,CACjB,CAAC;IAEN,IAAI,iBAAiB,EAAE;QACnB,MAAM,aAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;KAChE;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA9CD,kCA8CC"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { constants } from './prelude';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare function trackReceivedTokenAndTx<T extends unknown[], U extends Truffle.AnyEvent>(token: Token | {
|
|
2
|
+
import { providers, Wallet, Contract, Bytes, ContractTransaction } from 'ethers';
|
|
3
|
+
export declare function timeIncreaseTo(seconds: number | string): Promise<void>;
|
|
4
|
+
export declare function trackReceivedTokenAndTx<T extends unknown[]>(provider: providers.JsonRpcProvider, token: Contract | {
|
|
8
5
|
address: typeof constants.ZERO_ADDRESS;
|
|
9
6
|
} | {
|
|
10
7
|
address: typeof constants.EEE_ADDRESS;
|
|
11
|
-
}, wallet: string, txPromise: (...args: T) => Promise<
|
|
8
|
+
}, wallet: string, txPromise: (...args: T) => Promise<ContractTransaction>, ...args: T): Promise<any[]>;
|
|
12
9
|
export declare function fixSignature(signature: string): string;
|
|
13
|
-
export declare function signMessage(signer:
|
|
14
|
-
export declare function countInstructions(txHash: string, instructions: string[]): Promise<number[]>;
|
|
10
|
+
export declare function signMessage(signer: Wallet, messageHex?: string | Bytes): Promise<string>;
|
|
11
|
+
export declare function countInstructions(provider: providers.JsonRpcProvider, txHash: string, instructions: string[]): Promise<number[]>;
|
package/dist/src/utils.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.countInstructions = exports.signMessage = exports.fixSignature = exports.trackReceivedTokenAndTx = exports.timeIncreaseTo = void 0;
|
|
4
|
-
const util_1 = require("util");
|
|
5
4
|
const prelude_1 = require("./prelude");
|
|
5
|
+
const hardhat_network_helpers_1 = require("@nomicfoundation/hardhat-network-helpers");
|
|
6
6
|
async function timeIncreaseTo(seconds) {
|
|
7
7
|
const delay = 1000 - new Date().getMilliseconds();
|
|
8
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
9
|
-
await
|
|
8
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
9
|
+
await hardhat_network_helpers_1.time.increaseTo(seconds);
|
|
10
10
|
}
|
|
11
11
|
exports.timeIncreaseTo = timeIncreaseTo;
|
|
12
|
-
async function trackReceivedTokenAndTx(token, wallet, txPromise, ...args) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const preBalance = await balanceFunc();
|
|
12
|
+
async function trackReceivedTokenAndTx(provider, token, wallet, txPromise, ...args) {
|
|
13
|
+
const isETH = token.address === prelude_1.constants.ZERO_ADDRESS || token.address === prelude_1.constants.EEE_ADDRESS;
|
|
14
|
+
const getBalance = 'balanceOf' in token ? token.balanceOf : provider.getBalance;
|
|
15
|
+
const preBalance = await getBalance(wallet);
|
|
17
16
|
const txResult = await txPromise(...args);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const postBalance = await getBalance(wallet);
|
|
18
|
+
if ('wait' in txResult) {
|
|
19
|
+
const txReceipt = await txResult.wait();
|
|
20
|
+
const txFees = wallet.toLowerCase() === txResult.from.toLowerCase() && isETH
|
|
21
|
+
? txReceipt.gasUsed.toBigInt() * txReceipt.effectiveGasPrice.toBigInt()
|
|
22
|
+
: 0n;
|
|
23
|
+
return [postBalance.sub(preBalance).add(txFees), txResult];
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return [postBalance.sub(preBalance), txResult];
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
exports.trackReceivedTokenAndTx = trackReceivedTokenAndTx;
|
|
25
30
|
function fixSignature(signature) {
|
|
@@ -34,23 +39,14 @@ function fixSignature(signature) {
|
|
|
34
39
|
return signature.slice(0, 130) + vHex;
|
|
35
40
|
}
|
|
36
41
|
exports.fixSignature = fixSignature;
|
|
37
|
-
// signs message in node (ganache auto-applies "Ethereum Signed Message" prefix)
|
|
38
42
|
async function signMessage(signer, messageHex = '0x') {
|
|
39
|
-
return fixSignature(await
|
|
43
|
+
return fixSignature(await signer.signMessage(messageHex));
|
|
40
44
|
}
|
|
41
45
|
exports.signMessage = signMessage;
|
|
42
|
-
async function countInstructions(txHash, instructions) {
|
|
43
|
-
|
|
44
|
-
throw new Error('Unsupported provider');
|
|
45
|
-
}
|
|
46
|
-
const trace = await (0, util_1.promisify)(web3.currentProvider.send.bind(web3.currentProvider))({
|
|
47
|
-
jsonrpc: '2.0',
|
|
48
|
-
method: 'debug_traceTransaction',
|
|
49
|
-
params: [txHash, {}],
|
|
50
|
-
id: new Date().getTime(),
|
|
51
|
-
});
|
|
46
|
+
async function countInstructions(provider, txHash, instructions) {
|
|
47
|
+
const trace = await provider.send('debug_traceTransaction', [txHash]);
|
|
52
48
|
const str = JSON.stringify(trace);
|
|
53
|
-
return instructions.map(instr => {
|
|
49
|
+
return instructions.map((instr) => {
|
|
54
50
|
return str.split('"' + instr.toUpperCase() + '"').length - 1;
|
|
55
51
|
});
|
|
56
52
|
}
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AACtC,sFAAgE;AAGzD,KAAK,UAAU,cAAc,CAAC,OAAwB;IACzD,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,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
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"prebuild": "rimraf ./dist && cti src -b",
|
|
13
13
|
"build": "tsc -p tsconfig.publish.json",
|
|
14
14
|
"postbuild": "echo done",
|
|
15
|
-
"
|
|
15
|
+
"prepublish": "yarn build",
|
|
16
16
|
"coverage": "hardhat coverage",
|
|
17
17
|
"format": "yarn format-ts && yarn format-sol",
|
|
18
18
|
"format-ts": "prettier '**/*.ts' --write",
|