@hyperlane-xyz/utils 3.1.0-beta4 → 3.1.2
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/src/amount.d.ts +16 -33
- package/dist/src/amount.d.ts.map +1 -1
- package/dist/src/amount.js +59 -54
- package/dist/src/amount.js.map +1 -1
- package/dist/src/big-numbers.d.ts +8 -31
- package/dist/src/big-numbers.d.ts.map +1 -1
- package/dist/src/big-numbers.js +16 -37
- package/dist/src/big-numbers.js.map +1 -1
- package/dist/src/big-numbers.test.js +29 -89
- package/dist/src/big-numbers.test.js.map +1 -1
- package/dist/src/multisig.d.ts.map +1 -1
- package/dist/src/multisig.js +2 -6
- package/dist/src/multisig.js.map +1 -1
- package/package.json +6 -9
- package/dist/src/amount.test.d.ts +0 -2
- package/dist/src/amount.test.d.ts.map +0 -1
- package/dist/src/amount.test.js +0 -48
- package/dist/src/amount.test.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { addressToByteHexString, addressToBytes, addressToBytes32, addressToBytesCosmos, addressToBytesEvm, addressToBytesSol, bytes32ToAddress, bytesToAddressCosmos, bytesToAddressEvm, bytesToAddressSol, bytesToProtocolAddress, capitalizeAddress, convertToProtocolAddress, ensure0x, eqAddress, eqAddressCosmos, eqAddressEvm, eqAddressSol, getAddressProtocolType, isAddressCosmos, isAddressEvm, isAddressSealevel, isValidAddress, isValidAddressCosmos, isValidAddressEvm, isValidAddressSealevel, isValidTransactionHash, isValidTransactionHashCosmos, isValidTransactionHashEvm, isValidTransactionHashSealevel, isZeroishAddress, normalizeAddress, normalizeAddressCosmos, normalizeAddressEvm, normalizeAddressSealevel, shortenAddress, strip0x, } from './src/addresses';
|
|
2
|
-
export { convertDecimals, eqAmountApproximate, fromWei, fromWeiRounded, toWei, tryParseAmount, } from './src/amount';
|
|
2
|
+
export { convertDecimals, convertDecimalsEthersBigNumber, eqAmountApproximate, fromWei, fromWeiRounded, toWei, tryParseAmount, } from './src/amount';
|
|
3
3
|
export { chunk, exclude } from './src/arrays';
|
|
4
4
|
export { pollAsync, retryAsync, runWithTimeout, sleep, timeout, } from './src/async';
|
|
5
5
|
export { base58ToBuffer, bufferToBase58, hexOrBase58ToHex } from './src/base58';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC9B,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,OAAO,GACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,cAAc,EACd,KAAK,EACL,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,KAAK,EACL,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EA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,EACd,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,4BAA4B,EAC5B,WAAW,EACX,aAAa,EACb,+BAA+B,EAC/B,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC9B,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,OAAO,GACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,mBAAmB,EACnB,OAAO,EACP,cAAc,EACd,KAAK,EACL,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,KAAK,EACL,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAA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AAC;AACpD,OAAO,EACL,OAAO,EACP,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,MAAM,EACN,SAAS,EACT,4BAA4B,EAC5B,WAAW,EACX,aAAa,EACb,+BAA+B,EAC/B,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.BaseValidator = exports.assert = exports.ProtocolType = exports.ProtocolSmallestUnit = exports.MessageStatus = exports.InterchainSecurityModuleType = exports.isNumeric = exports.isNullish = exports.trimToLength = exports.toTitleCase = void 0;
|
|
3
|
+
exports.sleep = exports.runWithTimeout = exports.retryAsync = exports.pollAsync = exports.exclude = exports.chunk = exports.tryParseAmount = exports.toWei = exports.fromWeiRounded = exports.fromWei = exports.eqAmountApproximate = exports.convertDecimalsEthersBigNumber = exports.convertDecimals = exports.strip0x = exports.shortenAddress = exports.normalizeAddressSealevel = exports.normalizeAddressEvm = exports.normalizeAddressCosmos = exports.normalizeAddress = exports.isZeroishAddress = exports.isValidTransactionHashSealevel = exports.isValidTransactionHashEvm = exports.isValidTransactionHashCosmos = exports.isValidTransactionHash = exports.isValidAddressSealevel = exports.isValidAddressEvm = exports.isValidAddressCosmos = exports.isValidAddress = exports.isAddressSealevel = exports.isAddressEvm = exports.isAddressCosmos = exports.getAddressProtocolType = exports.eqAddressSol = exports.eqAddressEvm = exports.eqAddressCosmos = exports.eqAddress = exports.ensure0x = exports.convertToProtocolAddress = exports.capitalizeAddress = exports.bytesToProtocolAddress = exports.bytesToAddressSol = exports.bytesToAddressEvm = exports.bytesToAddressCosmos = exports.bytes32ToAddress = exports.addressToBytesSol = exports.addressToBytesEvm = exports.addressToBytesCosmos = exports.addressToBytes32 = exports.addressToBytes = exports.addressToByteHexString = void 0;
|
|
4
|
+
exports.sanitizeString = exports.errorToString = exports.symmetricDifference = exports.setEquality = exports.difference = exports.promiseObjAll = exports.pick = exports.objMerge = exports.objMapEntries = exports.objMap = exports.objFilter = exports.isObject = exports.invertKeysAndValues = exports.deepEquals = exports.arrayToObject = exports.parseLegacyMultisigIsmMetadata = exports.formatLegacyMultisigIsmMetadata = exports.parseMessage = exports.messageId = exports.formatMessage = exports.sum = exports.stdDev = exports.median = exports.mean = exports.warn = exports.trace = exports.log = exports.error = exports.debug = exports.evmId = exports.canonizeId = exports.safelyAccessEnvVar = exports.domainHash = exports.isS3CheckpointWithId = exports.isS3Checkpoint = exports.isCheckpoint = exports.formatCallData = exports.mulBigAndFixed = exports.isZeroish = exports.isBigNumberish = exports.fixedToBig = exports.bigToFixed = exports.BigNumberMin = exports.BigNumberMax = exports.toBase64 = exports.fromBase64 = exports.hexOrBase58ToHex = exports.bufferToBase58 = exports.base58ToBuffer = exports.timeout = void 0;
|
|
5
|
+
exports.BaseValidator = exports.assert = exports.ProtocolType = exports.ProtocolSmallestUnit = exports.MessageStatus = exports.InterchainSecurityModuleType = exports.isNumeric = exports.isNullish = exports.trimToLength = exports.toTitleCase = exports.streamToString = void 0;
|
|
6
6
|
var addresses_1 = require("./src/addresses");
|
|
7
7
|
Object.defineProperty(exports, "addressToByteHexString", { enumerable: true, get: function () { return addresses_1.addressToByteHexString; } });
|
|
8
8
|
Object.defineProperty(exports, "addressToBytes", { enumerable: true, get: function () { return addresses_1.addressToBytes; } });
|
|
@@ -43,6 +43,7 @@ Object.defineProperty(exports, "shortenAddress", { enumerable: true, get: functi
|
|
|
43
43
|
Object.defineProperty(exports, "strip0x", { enumerable: true, get: function () { return addresses_1.strip0x; } });
|
|
44
44
|
var amount_1 = require("./src/amount");
|
|
45
45
|
Object.defineProperty(exports, "convertDecimals", { enumerable: true, get: function () { return amount_1.convertDecimals; } });
|
|
46
|
+
Object.defineProperty(exports, "convertDecimalsEthersBigNumber", { enumerable: true, get: function () { return amount_1.convertDecimalsEthersBigNumber; } });
|
|
46
47
|
Object.defineProperty(exports, "eqAmountApproximate", { enumerable: true, get: function () { return amount_1.eqAmountApproximate; } });
|
|
47
48
|
Object.defineProperty(exports, "fromWei", { enumerable: true, get: function () { return amount_1.fromWei; } });
|
|
48
49
|
Object.defineProperty(exports, "fromWeiRounded", { enumerable: true, get: function () { return amount_1.fromWeiRounded; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAAA,6CAsCyB;AArCvB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,cAAc,OAAA;AACd,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,8GAAA,iBAAiB,OAAA;AACjB,8GAAA,iBAAiB,OAAA;AACjB,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,8GAAA,iBAAiB,OAAA;AACjB,8GAAA,iBAAiB,OAAA;AACjB,mHAAA,sBAAsB,OAAA;AACtB,8GAAA,iBAAiB,OAAA;AACjB,qHAAA,wBAAwB,OAAA;AACxB,qGAAA,QAAQ,OAAA;AACR,sGAAA,SAAS,OAAA;AACT,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,yGAAA,YAAY,OAAA;AACZ,mHAAA,sBAAsB,OAAA;AACtB,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,8GAAA,iBAAiB,OAAA;AACjB,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AACpB,8GAAA,iBAAiB,OAAA;AACjB,mHAAA,sBAAsB,OAAA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';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
type NumberT = BigNumber.Value;
|
|
4
|
+
export declare function fromWei(value: NumberT | null | undefined, decimals?: number): number;
|
|
5
|
+
export declare function fromWeiRounded(value: NumberT | null | undefined, decimals?: number, roundDownIfSmall?: boolean): string;
|
|
6
|
+
export declare function toWei(value: NumberT | null | undefined, decimals?: number): BigNumber;
|
|
7
|
+
export declare function tryParseAmount(value: NumberT | null | undefined): BigNumber | null;
|
|
8
|
+
export declare function eqAmountApproximate(amountInWei1: BigNumber, amountInWei2: NumberT): boolean;
|
|
2
9
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
|
|
7
|
-
export declare function fromWei(value: BigNumber.Value | null | undefined, decimals?: number): string;
|
|
8
|
-
/**
|
|
9
|
-
* Convert the given Wei value to Ether value,
|
|
10
|
-
* round to set number of decimals with a minimum floor, configured per token
|
|
11
|
-
* @param value The value to convert.
|
|
12
|
-
* @param decimals
|
|
13
|
-
* @returns Converted value in string type.
|
|
14
|
-
*/
|
|
15
|
-
export declare function fromWeiRounded(value: BigNumber.Value | null | undefined, decimals?: number, displayDecimals?: number): string;
|
|
16
|
-
/**
|
|
17
|
-
* Convert the given value to Wei value
|
|
10
|
+
* Converts a value with `fromDecimals` decimals to a value with `toDecimals` decimals.
|
|
11
|
+
* Incurs a loss of precision when `fromDecimals` > `toDecimals`.
|
|
12
|
+
* @param fromDecimals The number of decimals `value` has.
|
|
13
|
+
* @param toDecimals The number of decimals to convert `value` to.
|
|
18
14
|
* @param value The value to convert.
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
export declare function toWei(value: BigNumber.Value | null | undefined, decimals?: number): string;
|
|
22
|
-
/**
|
|
23
|
-
* Try to parse the given value into BigNumber.js BigNumber
|
|
24
|
-
* @param value The value to parse.
|
|
25
|
-
* @returns Parsed value in BigNumber.js BigNumber type.
|
|
26
|
-
*/
|
|
27
|
-
export declare function tryParseAmount(value: BigNumber.Value | null | undefined): BigNumber | null;
|
|
28
|
-
/**
|
|
29
|
-
* Checks if an amount is equal of nearly equal to balance within a small margin of error
|
|
30
|
-
* Necessary because amounts in the UI are often rounded
|
|
31
|
-
* @param amount1 The amount to compare.
|
|
32
|
-
* @param amount2 The amount to compare.
|
|
33
|
-
* @returns true/false.
|
|
15
|
+
* @returns `value` represented with `toDecimals` decimals.
|
|
34
16
|
*/
|
|
35
|
-
export declare function
|
|
17
|
+
export declare function convertDecimals(fromDecimals: number, toDecimals: number, value: NumberT): BigNumber;
|
|
36
18
|
/**
|
|
37
19
|
* Converts a value with `fromDecimals` decimals to a value with `toDecimals` decimals.
|
|
38
20
|
* Incurs a loss of precision when `fromDecimals` > `toDecimals`.
|
|
39
21
|
* @param fromDecimals The number of decimals `value` has.
|
|
40
22
|
* @param toDecimals The number of decimals to convert `value` to.
|
|
41
23
|
* @param value The value to convert.
|
|
42
|
-
* @returns `value` represented with `toDecimals` decimals
|
|
24
|
+
* @returns `value` represented with `toDecimals` decimals.
|
|
43
25
|
*/
|
|
44
|
-
export declare function
|
|
26
|
+
export declare function convertDecimalsEthersBigNumber(fromDecimals: number, toDecimals: number, value: ethers.BigNumber): ethers.BigNumber;
|
|
27
|
+
export {};
|
|
45
28
|
//# sourceMappingURL=amount.d.ts.map
|
package/dist/src/amount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,KAAK,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC;AAE/B,wBAAgB,OAAO,CACrB,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,SAAyB,GAChC,MAAM,CAQR;AAID,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,SAAyB,EACjC,gBAAgB,UAAO,GACtB,MAAM,CAcR;AAED,wBAAgB,KAAK,CACnB,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,SAAyB,GAChC,SAAS,CAkBX;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAChC,SAAS,GAAG,IAAI,CASlB;AAID,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,EACvB,YAAY,EAAE,OAAO,WAKtB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,aAgBf;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,CAAC,SAAS,oBAYxB"}
|
package/dist/src/amount.js
CHANGED
|
@@ -3,78 +3,66 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertDecimals = exports.eqAmountApproximate = exports.tryParseAmount = exports.toWei = exports.fromWeiRounded = exports.fromWei = void 0;
|
|
6
|
+
exports.convertDecimalsEthersBigNumber = exports.convertDecimals = exports.eqAmountApproximate = exports.tryParseAmount = exports.toWei = exports.fromWeiRounded = exports.fromWei = void 0;
|
|
7
7
|
const units_1 = require("@ethersproject/units");
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
10
|
+
const DEFAULT_MIN_ROUNDED_VALUE = 0.00001;
|
|
9
11
|
const DEFAULT_DISPLAY_DECIMALS = 4;
|
|
10
12
|
const DEFAULT_TOKEN_DECIMALS = 18;
|
|
11
|
-
/**
|
|
12
|
-
* Convert the given Wei value to Ether value
|
|
13
|
-
* @param value The value to convert.
|
|
14
|
-
* @returns Converted value in string type.
|
|
15
|
-
*/
|
|
16
13
|
function fromWei(value, decimals = DEFAULT_TOKEN_DECIMALS) {
|
|
17
14
|
if (!value)
|
|
18
|
-
return
|
|
19
|
-
const valueString = value.toString(
|
|
20
|
-
const flooredValue =
|
|
21
|
-
return parseFloat((0, units_1.formatUnits)(flooredValue, decimals))
|
|
15
|
+
return 0;
|
|
16
|
+
const valueString = value.toString().trim();
|
|
17
|
+
const flooredValue = new bignumber_js_1.default(valueString).toFixed(0, bignumber_js_1.default.ROUND_FLOOR);
|
|
18
|
+
return parseFloat((0, units_1.formatUnits)(flooredValue, decimals));
|
|
22
19
|
}
|
|
23
20
|
exports.fromWei = fromWei;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* @param value The value to convert.
|
|
28
|
-
* @param decimals
|
|
29
|
-
* @returns Converted value in string type.
|
|
30
|
-
*/
|
|
31
|
-
function fromWeiRounded(value, decimals = DEFAULT_TOKEN_DECIMALS, displayDecimals) {
|
|
21
|
+
// Similar to fromWei above but rounds to set number of decimals
|
|
22
|
+
// with a minimum floor, configured per token
|
|
23
|
+
function fromWeiRounded(value, decimals = DEFAULT_TOKEN_DECIMALS, roundDownIfSmall = true) {
|
|
32
24
|
if (!value)
|
|
33
25
|
return '0';
|
|
34
|
-
const flooredValue =
|
|
35
|
-
const amount =
|
|
26
|
+
const flooredValue = new bignumber_js_1.default(value).toFixed(0, bignumber_js_1.default.ROUND_FLOOR);
|
|
27
|
+
const amount = new bignumber_js_1.default((0, units_1.formatUnits)(flooredValue, decimals));
|
|
36
28
|
if (amount.isZero())
|
|
37
29
|
return '0';
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
// If amount is less than min value
|
|
31
|
+
if (amount.lt(DEFAULT_MIN_ROUNDED_VALUE)) {
|
|
32
|
+
if (roundDownIfSmall)
|
|
33
|
+
return '0';
|
|
34
|
+
return amount.toString(10);
|
|
35
|
+
}
|
|
36
|
+
const displayDecimals = amount.gte(10000) ? 2 : DEFAULT_DISPLAY_DECIMALS;
|
|
37
|
+
return amount.toFixed(displayDecimals).toString();
|
|
40
38
|
}
|
|
41
39
|
exports.fromWeiRounded = fromWeiRounded;
|
|
42
|
-
/**
|
|
43
|
-
* Convert the given value to Wei value
|
|
44
|
-
* @param value The value to convert.
|
|
45
|
-
* @returns Converted value in string type.
|
|
46
|
-
*/
|
|
47
40
|
function toWei(value, decimals = DEFAULT_TOKEN_DECIMALS) {
|
|
48
41
|
if (!value)
|
|
49
|
-
return
|
|
42
|
+
return new bignumber_js_1.default(0);
|
|
50
43
|
// First convert to a BigNumber, and then call `toString` with the
|
|
51
44
|
// explicit radix 10 such that the result is formatted as a base-10 string
|
|
52
45
|
// and not in scientific notation.
|
|
53
|
-
const valueBN =
|
|
46
|
+
const valueBN = new bignumber_js_1.default(value);
|
|
54
47
|
const valueString = valueBN.toString(10).trim();
|
|
55
48
|
const components = valueString.split('.');
|
|
56
49
|
if (components.length === 1) {
|
|
57
|
-
return (0, units_1.parseUnits)(valueString, decimals).toString();
|
|
50
|
+
return new bignumber_js_1.default((0, units_1.parseUnits)(valueString, decimals).toString());
|
|
58
51
|
}
|
|
59
52
|
else if (components.length === 2) {
|
|
60
53
|
const trimmedFraction = components[1].substring(0, decimals);
|
|
61
|
-
return (0, units_1.parseUnits)(`${components[0]}.${trimmedFraction}`, decimals).toString();
|
|
54
|
+
return new bignumber_js_1.default((0, units_1.parseUnits)(`${components[0]}.${trimmedFraction}`, decimals).toString());
|
|
62
55
|
}
|
|
63
56
|
else {
|
|
64
57
|
throw new Error(`Cannot convert ${valueString} to wei`);
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
exports.toWei = toWei;
|
|
68
|
-
/**
|
|
69
|
-
* Try to parse the given value into BigNumber.js BigNumber
|
|
70
|
-
* @param value The value to parse.
|
|
71
|
-
* @returns Parsed value in BigNumber.js BigNumber type.
|
|
72
|
-
*/
|
|
73
61
|
function tryParseAmount(value) {
|
|
74
62
|
try {
|
|
75
63
|
if (!value)
|
|
76
64
|
return null;
|
|
77
|
-
const parsed =
|
|
65
|
+
const parsed = new bignumber_js_1.default(value);
|
|
78
66
|
if (!parsed || parsed.isNaN() || !parsed.isFinite())
|
|
79
67
|
return null;
|
|
80
68
|
else
|
|
@@ -85,16 +73,12 @@ function tryParseAmount(value) {
|
|
|
85
73
|
}
|
|
86
74
|
}
|
|
87
75
|
exports.tryParseAmount = tryParseAmount;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*/
|
|
95
|
-
function eqAmountApproximate(amount1, amount2, maxDifference) {
|
|
96
|
-
// Is difference btwn amounts less than maxDifference
|
|
97
|
-
return (0, bignumber_js_1.default)(amount1).minus(amount2).abs().lte(maxDifference);
|
|
76
|
+
// Checks if an amount is equal of nearly equal to balance within a small margin of error
|
|
77
|
+
// Necessary because amounts in the UI are often rounded
|
|
78
|
+
function eqAmountApproximate(amountInWei1, amountInWei2) {
|
|
79
|
+
const minValueWei = toWei(DEFAULT_MIN_ROUNDED_VALUE);
|
|
80
|
+
// Is difference btwn amount and balance less than min amount shown for token
|
|
81
|
+
return amountInWei1.minus(amountInWei2).abs().lt(minValueWei);
|
|
98
82
|
}
|
|
99
83
|
exports.eqAmountApproximate = eqAmountApproximate;
|
|
100
84
|
/**
|
|
@@ -103,24 +87,45 @@ exports.eqAmountApproximate = eqAmountApproximate;
|
|
|
103
87
|
* @param fromDecimals The number of decimals `value` has.
|
|
104
88
|
* @param toDecimals The number of decimals to convert `value` to.
|
|
105
89
|
* @param value The value to convert.
|
|
106
|
-
* @returns `value` represented with `toDecimals` decimals
|
|
90
|
+
* @returns `value` represented with `toDecimals` decimals.
|
|
107
91
|
*/
|
|
108
92
|
function convertDecimals(fromDecimals, toDecimals, value) {
|
|
109
|
-
const amount =
|
|
93
|
+
const amount = new bignumber_js_1.default(value);
|
|
110
94
|
if (fromDecimals === toDecimals)
|
|
111
|
-
return amount
|
|
95
|
+
return amount;
|
|
112
96
|
else if (fromDecimals > toDecimals) {
|
|
113
97
|
const difference = fromDecimals - toDecimals;
|
|
114
98
|
return amount
|
|
115
|
-
.div(
|
|
116
|
-
.integerValue(bignumber_js_1.default.ROUND_FLOOR)
|
|
117
|
-
.toString(10);
|
|
99
|
+
.div(new bignumber_js_1.default(10).pow(difference))
|
|
100
|
+
.integerValue(bignumber_js_1.default.ROUND_FLOOR);
|
|
118
101
|
}
|
|
119
102
|
// fromDecimals < toDecimals
|
|
120
103
|
else {
|
|
121
104
|
const difference = toDecimals - fromDecimals;
|
|
122
|
-
return amount.times(
|
|
105
|
+
return amount.times(new bignumber_js_1.default(10).pow(difference));
|
|
123
106
|
}
|
|
124
107
|
}
|
|
125
108
|
exports.convertDecimals = convertDecimals;
|
|
109
|
+
/**
|
|
110
|
+
* Converts a value with `fromDecimals` decimals to a value with `toDecimals` decimals.
|
|
111
|
+
* Incurs a loss of precision when `fromDecimals` > `toDecimals`.
|
|
112
|
+
* @param fromDecimals The number of decimals `value` has.
|
|
113
|
+
* @param toDecimals The number of decimals to convert `value` to.
|
|
114
|
+
* @param value The value to convert.
|
|
115
|
+
* @returns `value` represented with `toDecimals` decimals.
|
|
116
|
+
*/
|
|
117
|
+
function convertDecimalsEthersBigNumber(fromDecimals, toDecimals, value) {
|
|
118
|
+
if (fromDecimals === toDecimals)
|
|
119
|
+
return value;
|
|
120
|
+
else if (fromDecimals > toDecimals) {
|
|
121
|
+
const difference = fromDecimals - toDecimals;
|
|
122
|
+
return value.div(ethers_1.ethers.BigNumber.from('10').pow(difference));
|
|
123
|
+
}
|
|
124
|
+
// fromDecimals < toDecimals
|
|
125
|
+
else {
|
|
126
|
+
const difference = toDecimals - fromDecimals;
|
|
127
|
+
return value.mul(ethers_1.ethers.BigNumber.from('10').pow(difference));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.convertDecimalsEthersBigNumber = convertDecimalsEthersBigNumber;
|
|
126
131
|
//# sourceMappingURL=amount.js.map
|
package/dist/src/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA+D;AAC/D,gEAAqC;
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA+D;AAC/D,gEAAqC;AACrC,mCAAgC;AAEhC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAC1C,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAIlC,SAAgB,OAAO,CACrB,KAAiC,EACjC,QAAQ,GAAG,sBAAsB;IAEjC,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IACrB,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;IAC5C,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,CAAC,OAAO,CACrD,CAAC,EACD,sBAAS,CAAC,WAAW,CACtB,CAAC;IACF,OAAO,UAAU,CAAC,IAAA,mBAAW,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzD,CAAC;AAXD,0BAWC;AAED,gEAAgE;AAChE,6CAA6C;AAC7C,SAAgB,cAAc,CAC5B,KAAiC,EACjC,QAAQ,GAAG,sBAAsB,EACjC,gBAAgB,GAAG,IAAI;IAEvB,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IACvB,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC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AAE;QAClC,MAAM,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;QAC7C,OAAO,MAAM;aACV,GAAG,CAAC,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;aACtC,YAAY,CAAC,sBAAS,CAAC,WAAW,CAAC,CAAC;KACxC;IACD,4BAA4B;SACvB;QACH,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;QAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;KACxD;AACH,CAAC;AAnBD,0CAmBC;AAED;;;;;;;GAOG;AACH,SAAgB,8BAA8B,CAC5C,YAAoB,EACpB,UAAkB,EAClB,KAAuB;IAEvB,IAAI,YAAY,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;SACzC,IAAI,YAAY,GAAG,UAAU,EAAE;QAClC,MAAM,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;QAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,eAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;KAC/D;IACD,4BAA4B;SACvB;QACH,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;QAC7C,OAAO,KAAK,CAAC,GAAG,CAAC,eAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;KAC/D;AACH,CAAC;AAfD,wEAeC"}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import BigNumber from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Check if a value is bigNumberish (e.g. valid numbers, bigNumber).
|
|
5
|
-
* @param value The value to check.
|
|
6
|
-
* @returns true/false.
|
|
7
|
-
*/
|
|
8
|
-
export declare function isBigNumberish(value: BigNumber.Value | undefined | null): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Check if a value (e.g. hex string or number) is zeroish (0, 0x0, 0x00, etc.).
|
|
11
|
-
* @param value The value to check.
|
|
12
|
-
* @returns true/false.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isZeroish(value: BigNumber.Value): boolean;
|
|
1
|
+
import { BigNumber, BigNumberish, FixedNumber } from 'ethers';
|
|
2
|
+
export declare function isBigNumberish(value: any): value is BigNumberish;
|
|
3
|
+
export declare function isZeroish(value: BigNumberish): boolean;
|
|
15
4
|
/**
|
|
16
5
|
* Converts a BigNumber to a FixedNumber of the format fixed128x18.
|
|
17
6
|
* @param big The BigNumber to convert.
|
|
18
7
|
* @returns A FixedNumber representation of a BigNumber.
|
|
19
8
|
*/
|
|
20
|
-
export declare function bigToFixed(big: BigNumber
|
|
9
|
+
export declare function bigToFixed(big: BigNumber): FixedNumber;
|
|
21
10
|
/**
|
|
22
11
|
* Converts a FixedNumber (of any format) to a BigNumber.
|
|
23
12
|
* @param fixed The FixedNumber to convert.
|
|
@@ -30,21 +19,9 @@ export declare function fixedToBig(fixed: FixedNumber, ceil?: boolean): BigNumbe
|
|
|
30
19
|
* @param big The BigNumber to multiply.
|
|
31
20
|
* @param fixed The FixedNumber to multiply.
|
|
32
21
|
* @param ceil If true, the ceiling of the product is used. Otherwise, the floor is used.
|
|
33
|
-
* @returns The BigNumber product
|
|
34
|
-
*/
|
|
35
|
-
export declare function mulBigAndFixed(big: BigNumber.Value, fixed: FixedNumber, ceil?: boolean): string;
|
|
36
|
-
/**
|
|
37
|
-
* Return the smaller in the given two BigNumbers.
|
|
38
|
-
* @param bn1 The BigNumber to compare.
|
|
39
|
-
* @param bn2 The BigNumber to compare.
|
|
40
|
-
* @returns The smaller BigNumber in string type.
|
|
41
|
-
*/
|
|
42
|
-
export declare function BigNumberMin(bn1: BigNumber.Value, bn2: BigNumber.Value): string;
|
|
43
|
-
/**
|
|
44
|
-
* Return the bigger in the given two BigNumbers.
|
|
45
|
-
* @param bn1 The BigNumber to compare.
|
|
46
|
-
* @param bn2 The BigNumber to compare.
|
|
47
|
-
* @returns The bigger BigNumber in string type.
|
|
22
|
+
* @returns The BigNumber product.
|
|
48
23
|
*/
|
|
49
|
-
export declare function
|
|
24
|
+
export declare function mulBigAndFixed(big: BigNumber, fixed: FixedNumber, ceil?: boolean): BigNumber;
|
|
25
|
+
export declare function BigNumberMin(bn1: BigNumber, bn2: BigNumber): BigNumber;
|
|
26
|
+
export declare function BigNumberMax(bn1: BigNumber, bn2: BigNumber): BigNumber;
|
|
50
27
|
//# sourceMappingURL=big-numbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"big-numbers.d.ts","sourceRoot":"","sources":["../../src/big-numbers.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,
|
|
1
|
+
{"version":3,"file":"big-numbers.d.ts","sourceRoot":"","sources":["../../src/big-numbers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAa,MAAM,QAAQ,CAAC;AAIzE,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAOhE;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,WAY5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,GAAG,WAAW,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,UAAQ,GAAG,SAAS,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,WAAW,EAClB,IAAI,UAAQ,GACX,SAAS,CAIX;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,aAE1D;AACD,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,aAE1D"}
|
package/dist/src/big-numbers.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.BigNumberMax = exports.BigNumberMin = exports.mulBigAndFixed = exports.fixedToBig = exports.bigToFixed = exports.isZeroish = exports.isBigNumberish = void 0;
|
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
4
|
const ethers_1 = require("ethers");
|
|
9
|
-
|
|
10
|
-
// when parsing exponential string over e21
|
|
11
|
-
/**
|
|
12
|
-
* Check if a value is bigNumberish (e.g. valid numbers, bigNumber).
|
|
13
|
-
* @param value The value to check.
|
|
14
|
-
* @returns true/false.
|
|
15
|
-
*/
|
|
5
|
+
const typeof_1 = require("./typeof");
|
|
16
6
|
function isBigNumberish(value) {
|
|
17
7
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
if ((0, typeof_1.isNullish)(value))
|
|
9
|
+
return false;
|
|
10
|
+
return ethers_1.BigNumber.from(value)._isBigNumber;
|
|
20
11
|
}
|
|
21
12
|
catch (error) {
|
|
22
13
|
return false;
|
|
23
14
|
}
|
|
24
15
|
}
|
|
25
16
|
exports.isBigNumberish = isBigNumberish;
|
|
26
|
-
|
|
27
|
-
* Check if a value (e.g. hex string or number) is zeroish (0, 0x0, 0x00, etc.).
|
|
28
|
-
* @param value The value to check.
|
|
29
|
-
* @returns true/false.
|
|
30
|
-
*/
|
|
17
|
+
// If a value (e.g. hex string or number) is zeroish (0, 0x0, 0x00, etc.)
|
|
31
18
|
function isZeroish(value) {
|
|
32
19
|
try {
|
|
33
|
-
|
|
20
|
+
if (!value ||
|
|
21
|
+
value === ethers_1.constants.HashZero ||
|
|
22
|
+
value === ethers_1.constants.AddressZero)
|
|
23
|
+
return true;
|
|
24
|
+
return ethers_1.BigNumber.from(value).isZero();
|
|
34
25
|
}
|
|
35
26
|
catch (error) {
|
|
36
27
|
return false;
|
|
@@ -43,7 +34,7 @@ exports.isZeroish = isZeroish;
|
|
|
43
34
|
* @returns A FixedNumber representation of a BigNumber.
|
|
44
35
|
*/
|
|
45
36
|
function bigToFixed(big) {
|
|
46
|
-
return ethers_1.FixedNumber.from(big.toString(
|
|
37
|
+
return ethers_1.FixedNumber.from(big.toString());
|
|
47
38
|
}
|
|
48
39
|
exports.bigToFixed = bigToFixed;
|
|
49
40
|
/**
|
|
@@ -54,7 +45,7 @@ exports.bigToFixed = bigToFixed;
|
|
|
54
45
|
*/
|
|
55
46
|
function fixedToBig(fixed, ceil = false) {
|
|
56
47
|
const fixedAsInteger = ceil ? fixed.ceiling() : fixed.floor();
|
|
57
|
-
return
|
|
48
|
+
return ethers_1.BigNumber.from(fixedAsInteger.toFormat('fixed256x0').toString());
|
|
58
49
|
}
|
|
59
50
|
exports.fixedToBig = fixedToBig;
|
|
60
51
|
/**
|
|
@@ -62,32 +53,20 @@ exports.fixedToBig = fixedToBig;
|
|
|
62
53
|
* @param big The BigNumber to multiply.
|
|
63
54
|
* @param fixed The FixedNumber to multiply.
|
|
64
55
|
* @param ceil If true, the ceiling of the product is used. Otherwise, the floor is used.
|
|
65
|
-
* @returns The BigNumber product
|
|
56
|
+
* @returns The BigNumber product.
|
|
66
57
|
*/
|
|
67
58
|
function mulBigAndFixed(big, fixed, ceil = false) {
|
|
68
59
|
// Converts big to a FixedNumber, multiplies it by fixed, and converts the product back
|
|
69
60
|
// to a BigNumber.
|
|
70
|
-
return fixedToBig(fixed.mulUnsafe(bigToFixed(big)), ceil)
|
|
61
|
+
return fixedToBig(fixed.mulUnsafe(bigToFixed(big)), ceil);
|
|
71
62
|
}
|
|
72
63
|
exports.mulBigAndFixed = mulBigAndFixed;
|
|
73
|
-
/**
|
|
74
|
-
* Return the smaller in the given two BigNumbers.
|
|
75
|
-
* @param bn1 The BigNumber to compare.
|
|
76
|
-
* @param bn2 The BigNumber to compare.
|
|
77
|
-
* @returns The smaller BigNumber in string type.
|
|
78
|
-
*/
|
|
79
64
|
function BigNumberMin(bn1, bn2) {
|
|
80
|
-
return
|
|
65
|
+
return bn1.gte(bn2) ? bn2 : bn1;
|
|
81
66
|
}
|
|
82
67
|
exports.BigNumberMin = BigNumberMin;
|
|
83
|
-
/**
|
|
84
|
-
* Return the bigger in the given two BigNumbers.
|
|
85
|
-
* @param bn1 The BigNumber to compare.
|
|
86
|
-
* @param bn2 The BigNumber to compare.
|
|
87
|
-
* @returns The bigger BigNumber in string type.
|
|
88
|
-
*/
|
|
89
68
|
function BigNumberMax(bn1, bn2) {
|
|
90
|
-
return
|
|
69
|
+
return bn1.lte(bn2) ? bn2 : bn1;
|
|
91
70
|
}
|
|
92
71
|
exports.BigNumberMax = BigNumberMax;
|
|
93
72
|
//# sourceMappingURL=big-numbers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"big-numbers.js","sourceRoot":"","sources":["../../src/big-numbers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"big-numbers.js","sourceRoot":"","sources":["../../src/big-numbers.ts"],"names":[],"mappings":";;;AAAA,mCAAyE;AAEzE,qCAAqC;AAErC,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI;QACF,IAAI,IAAA,kBAAS,EAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACnC,OAAO,kBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC;KAC3C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAPD,wCAOC;AAED,yEAAyE;AACzE,SAAgB,SAAS,CAAC,KAAmB;IAC3C,IAAI;QACF,IACE,CAAC,KAAK;YACN,KAAK,KAAK,kBAAS,CAAC,QAAQ;YAC5B,KAAK,KAAK,kBAAS,CAAC,WAAW;YAE/B,OAAO,IAAI,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41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
7
3
|
const chai_1 = require("chai");
|
|
8
4
|
const ethers_1 = require("ethers");
|
|
9
5
|
const big_numbers_1 = require("./big-numbers");
|
|
10
|
-
describe('
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{ expect: true, context: 'decimal', case: 123.123 },
|
|
17
|
-
{ expect: true, context: 'integer', case: 300000 },
|
|
18
|
-
{ expect: true, context: 'hex 0', case: 0x00 },
|
|
19
|
-
{ expect: true, context: 'hex 0', case: 0x000 },
|
|
20
|
-
{
|
|
21
|
-
expect: true,
|
|
22
|
-
context: 'address 0',
|
|
23
|
-
case: 0x0000000000000000000000000000000000000000,
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
testCases.forEach((tc) => {
|
|
27
|
-
it(`returns ${tc.expect} for ${tc.case}`, () => {
|
|
28
|
-
(0, chai_1.expect)((0, big_numbers_1.isBigNumberish)(tc.case)).to.equal(tc.expect);
|
|
6
|
+
describe('utils', () => {
|
|
7
|
+
describe('bigToFixed', () => {
|
|
8
|
+
it('converts a BigNumber to a FixedNumber', () => {
|
|
9
|
+
const big = ethers_1.BigNumber.from('1234');
|
|
10
|
+
const fixed = (0, big_numbers_1.bigToFixed)(big);
|
|
11
|
+
(0, chai_1.expect)(fixed.toUnsafeFloat()).to.equal(1234);
|
|
29
12
|
});
|
|
30
13
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{ expect: true, context: 'hex 0', case: 0x000 },
|
|
42
|
-
{
|
|
43
|
-
expect: true,
|
|
44
|
-
context: 'address 0',
|
|
45
|
-
case: 0x0000000000000000000000000000000000000000,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
testCases.forEach((tc) => {
|
|
49
|
-
it(`returns ${tc.expect} for ${tc.case}`, () => {
|
|
50
|
-
(0, chai_1.expect)((0, big_numbers_1.isZeroish)(tc.case)).to.equal(tc.expect);
|
|
14
|
+
describe('fixedToBig', () => {
|
|
15
|
+
it('converts a FixedNumber to a floored BigNumber', () => {
|
|
16
|
+
const fixed = ethers_1.FixedNumber.from('12.34');
|
|
17
|
+
const big = (0, big_numbers_1.fixedToBig)(fixed);
|
|
18
|
+
(0, chai_1.expect)(big.toNumber()).to.equal(12);
|
|
19
|
+
});
|
|
20
|
+
it('converts a FixedNumber to a ceilinged BigNumber', () => {
|
|
21
|
+
const fixed = ethers_1.FixedNumber.from('12.34');
|
|
22
|
+
const big = (0, big_numbers_1.fixedToBig)(fixed, true);
|
|
23
|
+
(0, chai_1.expect)(big.toNumber()).to.equal(13);
|
|
51
24
|
});
|
|
52
25
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
it('converts a FixedNumber to a ceilinged BigNumber', () => {
|
|
68
|
-
const fixed = ethers_1.FixedNumber.from('12.34');
|
|
69
|
-
const big = (0, big_numbers_1.fixedToBig)(fixed, true);
|
|
70
|
-
(0, chai_1.expect)(big.toNumber()).to.equal(13);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
describe('mulBigAndFixed', () => {
|
|
74
|
-
it('gets the floored product of a BigNumber and FixedNumber', () => {
|
|
75
|
-
const big = (0, bignumber_js_1.default)('1000');
|
|
76
|
-
const fixed = ethers_1.FixedNumber.from('1.2345');
|
|
77
|
-
const product = (0, big_numbers_1.mulBigAndFixed)(big, fixed);
|
|
78
|
-
(0, chai_1.expect)(product).to.equal((1234).toString());
|
|
79
|
-
});
|
|
80
|
-
it('gets the ceilinged product of a BigNumber and FixedNumber', () => {
|
|
81
|
-
const big = (0, bignumber_js_1.default)('1000');
|
|
82
|
-
const fixed = ethers_1.FixedNumber.from('1.2345');
|
|
83
|
-
const product = (0, big_numbers_1.mulBigAndFixed)(big, fixed, true);
|
|
84
|
-
(0, chai_1.expect)(product).to.equal((1235).toString());
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
describe('BigNumberMin', () => {
|
|
88
|
-
it('gets the min between the two BigNumber', () => {
|
|
89
|
-
const big = (0, bignumber_js_1.default)('1000');
|
|
90
|
-
const bigger = (0, bignumber_js_1.default)('10000');
|
|
91
|
-
(0, chai_1.expect)((0, big_numbers_1.BigNumberMin)(big, bigger)).to.equal(big.toString());
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe('BigNumberMax', () => {
|
|
95
|
-
it('gets the max between the two BigNumber', () => {
|
|
96
|
-
const big = (0, bignumber_js_1.default)('1000');
|
|
97
|
-
const bigger = (0, bignumber_js_1.default)('10000');
|
|
98
|
-
(0, chai_1.expect)((0, big_numbers_1.BigNumberMax)(big, bigger)).to.equal(bigger.toString());
|
|
26
|
+
describe('mulBigAndFixed', () => {
|
|
27
|
+
it('gets the floored product of a BigNumber and FixedNumber', () => {
|
|
28
|
+
const big = ethers_1.BigNumber.from('1000');
|
|
29
|
+
const fixed = ethers_1.FixedNumber.from('1.2345');
|
|
30
|
+
const product = (0, big_numbers_1.mulBigAndFixed)(big, fixed);
|
|
31
|
+
(0, chai_1.expect)(product.toNumber()).to.equal(1234);
|
|
32
|
+
});
|
|
33
|
+
it('gets the ceilinged product of a BigNumber and FixedNumber', () => {
|
|
34
|
+
const big = ethers_1.BigNumber.from('1000');
|
|
35
|
+
const fixed = ethers_1.FixedNumber.from('1.2345');
|
|
36
|
+
const product = (0, big_numbers_1.mulBigAndFixed)(big, fixed, true);
|
|
37
|
+
(0, chai_1.expect)(product.toNumber()).to.equal(1235);
|
|
38
|
+
});
|
|
99
39
|
});
|
|
100
40
|
});
|
|
101
41
|
//# sourceMappingURL=big-numbers.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"big-numbers.test.js","sourceRoot":"","sources":["../../src/big-numbers.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"big-numbers.test.js","sourceRoot":"","sources":["../../src/big-numbers.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,mCAAgD;AAEhD,+CAAuE;AAEvE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,GAAG,GAAG,kBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,MAAM,KAAK,GAAG,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAC;YAE9B,IAAA,aAAM,EAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,KAAK,GAAG,oBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,GAAG,GAAG,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC;YAE9B,IAAA,aAAM,EAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MA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../src/multisig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multisig.d.ts","sourceRoot":"","sources":["../../src/multisig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,8BAA8B,aAC/B,MAAM,KACf,+BA4CF,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAChC,+BAA+B,KACxC,MAqBF,CAAC"}
|
package/dist/src/multisig.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.formatLegacyMultisigIsmMetadata = exports.parseLegacyMultisigIsmMetadata = void 0;
|
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
4
|
const ethers_1 = require("ethers");
|
|
9
5
|
const addresses_1 = require("./addresses");
|
|
10
6
|
const parseLegacyMultisigIsmMetadata = (metadata) => {
|
|
@@ -17,13 +13,13 @@ const parseLegacyMultisigIsmMetadata = (metadata) => {
|
|
|
17
13
|
const SIGNATURE_LENGTH = 65;
|
|
18
14
|
const buf = Buffer.from(ethers_1.utils.arrayify(metadata));
|
|
19
15
|
const checkpointRoot = ethers_1.utils.hexlify(buf.slice(MERKLE_ROOT_OFFSET, MERKLE_INDEX_OFFSET));
|
|
20
|
-
const checkpointIndex =
|
|
16
|
+
const checkpointIndex = ethers_1.BigNumber.from(ethers_1.utils.hexlify(buf.slice(MERKLE_INDEX_OFFSET, ORIGIN_MAILBOX_OFFSET))).toNumber();
|
|
21
17
|
const originMailbox = ethers_1.utils.hexlify(buf.slice(ORIGIN_MAILBOX_OFFSET, MERKLE_PROOF_OFFSET));
|
|
22
18
|
const parseBytesArray = (start, count, size) => {
|
|
23
19
|
return [...Array(count).keys()].map((i) => ethers_1.utils.hexlify(buf.slice(start + size * i, start + size * (i + 1))));
|
|
24
20
|
};
|
|
25
21
|
const proof = parseBytesArray(MERKLE_PROOF_OFFSET, 32, 32);
|
|
26
|
-
const threshold =
|
|
22
|
+
const threshold = ethers_1.BigNumber.from(ethers_1.utils.hexlify(buf.slice(THRESHOLD_OFFSET, SIGNATURES_OFFSET))).toNumber();
|
|
27
23
|
const signatures = parseBytesArray(SIGNATURES_OFFSET, threshold, SIGNATURE_LENGTH);
|
|
28
24
|
const VALIDATORS_OFFSET = SIGNATURES_OFFSET + threshold * SIGNATURE_LENGTH;
|
|
29
25
|
const addressesCount = buf.slice(VALIDATORS_OFFSET).length / 32;
|
package/dist/src/multisig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multisig.js","sourceRoot":"","sources":["../../src/multisig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multisig.js","sourceRoot":"","sources":["../../src/multisig.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE1C,2CAA+C;AAGxC,MAAM,8BAA8B,GAAG,CAC5C,QAAgB,EACiB,EAAE;IACnC,MAAM,kBAAkB,GAAG,CAAC,CAAC;IAC7B,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAC/B,MAAM,qBAAqB,GAAG,EAAE,CAAC;IACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,MAAM,iBAAiB,GAAG,IAAI,CAAC;IAC/B,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAE5B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,cAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,cAAK,CAAC,OAAO,CAClC,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CACnD,CAAC;IACF,MAAM,eAAe,GAAG,kBAA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QACb,KAAK;QACL,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AA9CW,QAAA,8BAA8B,kCA8CzC;AAEK,MAAM,+BAA+B,GAAG,CAC7C,QAAyC,EACjC,EAAE;IACV,OAAO,cAAK,CAAC,YAAY,CACvB;QACE,SAAS;QACT,QAAQ;QACR,SAAS;QACT,aAAa;QACb,OAAO;QACP,OAAO;QACP,WAAW;KACZ,EACD;QACE,QAAQ,CAAC,cAAc;QACvB,QAAQ,CAAC,eAAe;QACxB,IAAA,4BAAgB,EAAC,QAAQ,CAAC,aAAa,CAAC;QACxC,QAAQ,CAAC,KAAK;QACd,QAAQ,CAAC,UAAU,CAAC,MAAM;QAC1B,cAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC;QACpC,QAAQ,CAAC,UAAU;KACpB,CACF,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,+BAA+B,mCAuB1C"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperlane-xyz/utils",
|
|
3
3
|
"description": "General utilities and types for the Hyperlane network",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.2",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@cosmjs/encoding": "^0.31.3",
|
|
7
7
|
"@solana/web3.js": "^1.78.0",
|
|
8
8
|
"bignumber.js": "^9.1.1",
|
|
9
|
-
"ethers": "^5.7.2"
|
|
10
|
-
"mocha": "^10.2.0"
|
|
9
|
+
"ethers": "^5.7.2"
|
|
11
10
|
},
|
|
12
11
|
"devDependencies": {
|
|
13
12
|
"chai": "^4.3.0",
|
|
14
|
-
"prettier": "^2.
|
|
13
|
+
"prettier": "^2.8.8",
|
|
15
14
|
"typescript": "^5.1.6"
|
|
16
15
|
},
|
|
17
16
|
"homepage": "https://www.hyperlane.xyz",
|
|
@@ -28,13 +27,11 @@
|
|
|
28
27
|
"build": "tsc",
|
|
29
28
|
"clean": "rm -rf ./dist",
|
|
30
29
|
"check": "tsc --noEmit",
|
|
31
|
-
"prettier": "prettier --write ./src"
|
|
32
|
-
"test": "mocha --config .mocharc.json './src/**/*.test.ts'"
|
|
30
|
+
"prettier": "prettier --write ./src"
|
|
33
31
|
},
|
|
34
32
|
"sideEffects": false,
|
|
35
33
|
"types": "dist/index.d.ts",
|
|
36
34
|
"files": [
|
|
37
35
|
"/dist"
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"amount.test.d.ts","sourceRoot":"","sources":["../../src/amount.test.ts"],"names":[],"mappings":""}
|
package/dist/src/amount.test.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chai_1 = require("chai");
|
|
4
|
-
const amount_1 = require("./amount");
|
|
5
|
-
describe('fromWei', () => {
|
|
6
|
-
it('parses and converts correctly', () => {
|
|
7
|
-
(0, chai_1.expect)((0, amount_1.fromWei)(1, 0)).to.equal('1');
|
|
8
|
-
(0, chai_1.expect)((0, amount_1.fromWei)('1000000', 6)).to.equal('1');
|
|
9
|
-
(0, chai_1.expect)((0, amount_1.fromWei)('1000000000000000000')).to.equal('1');
|
|
10
|
-
(0, chai_1.expect)((0, amount_1.fromWei)('1000000000000000000.1234')).to.equal('1');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe('fromWeiRounded', () => {
|
|
14
|
-
it('parses and converts correctly', () => {
|
|
15
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)(1, 0)).to.equal('1.0000');
|
|
16
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('1000000', 6)).to.equal('1.0000');
|
|
17
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('1000000000000000000')).to.equal('1.0000');
|
|
18
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('1000000000000000000.1234')).to.equal('1.0000');
|
|
19
|
-
});
|
|
20
|
-
it('rounds correctly', () => {
|
|
21
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)(1234567890, 6, 2)).to.equal('1234.56');
|
|
22
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('1234567890', 6, 4)).to.equal('1234.5678');
|
|
23
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('10000000000000000000')).to.equal('10.0000');
|
|
24
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('10000000000000000000', 18, 0)).to.equal('10');
|
|
25
|
-
});
|
|
26
|
-
it('can drop decimals for large numbers', () => {
|
|
27
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('10001000000000000000000')).to.equal('10001.00');
|
|
28
|
-
(0, chai_1.expect)((0, amount_1.fromWeiRounded)('10001000000000000000', 15, 4)).to.equal('10001.0000');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe('toWei', () => {
|
|
32
|
-
it('parses and converts correctly', () => {
|
|
33
|
-
(0, chai_1.expect)((0, amount_1.toWei)(1, 0)).to.equal('1');
|
|
34
|
-
(0, chai_1.expect)((0, amount_1.toWei)('1', 6)).to.equal('1000000');
|
|
35
|
-
(0, chai_1.expect)((0, amount_1.toWei)('123.456')).to.equal('123456000000000000000');
|
|
36
|
-
(0, chai_1.expect)((0, amount_1.toWei)('1.00000000000000000001')).to.equal('1000000000000000000');
|
|
37
|
-
(0, chai_1.expect)((0, amount_1.toWei)('1.00000000000000000001', 6)).to.equal('1000000');
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe('eqAmountApproximate', () => {
|
|
41
|
-
it('compares correctly', () => {
|
|
42
|
-
(0, chai_1.expect)((0, amount_1.eqAmountApproximate)(1, 1.001, 0.001)).to.be.true;
|
|
43
|
-
(0, chai_1.expect)((0, amount_1.eqAmountApproximate)(9, 9.001, 0.01)).to.be.true;
|
|
44
|
-
(0, chai_1.expect)((0, amount_1.eqAmountApproximate)('9876543210', '9876543210', '1')).to.be.true;
|
|
45
|
-
(0, chai_1.expect)((0, amount_1.eqAmountApproximate)('9876543210', '9876543212', '1')).to.be.false;
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=amount.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"amount.test.js","sourceRoot":"","sources":["../../src/amount.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,qCAA+E;AAE/E,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,IAAA,aAAM,EAAC,IAAA,gBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,IAAA,aAAM,EAAC,IAAA,gBAAO,EAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAA,aAAM,EAAC,IAAA,gBAAO,EAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrD,IAAA,aAAM,EAAC,IAAA,gBAAO,EAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,IAAA,aAAM,EAAC,IAAA,uBAAc,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,IAAA,uBAAc,EAAC,SAAS,EAAE,CAAC,CAAC,CA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