@hyperlane-xyz/utils 3.10.1-beta1 → 3.20.0-beta0

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.
Files changed (119) hide show
  1. package/dist/addresses.d.ts +1 -1
  2. package/dist/addresses.d.ts.map +1 -1
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/types.d.ts +3 -1
  8. package/dist/types.d.ts.map +1 -1
  9. package/dist/types.js +0 -1
  10. package/dist/types.js.map +1 -1
  11. package/dist/url.d.ts +2 -0
  12. package/dist/url.d.ts.map +1 -0
  13. package/dist/url.js +10 -0
  14. package/dist/url.js.map +1 -0
  15. package/package.json +2 -2
  16. package/dist/src/addresses.d.ts +0 -42
  17. package/dist/src/addresses.d.ts.map +0 -1
  18. package/dist/src/addresses.js +0 -335
  19. package/dist/src/addresses.js.map +0 -1
  20. package/dist/src/addresses.test.d.ts +0 -2
  21. package/dist/src/addresses.test.d.ts.map +0 -1
  22. package/dist/src/addresses.test.js +0 -46
  23. package/dist/src/addresses.test.js.map +0 -1
  24. package/dist/src/amount.d.ts +0 -45
  25. package/dist/src/amount.d.ts.map +0 -1
  26. package/dist/src/amount.js +0 -126
  27. package/dist/src/amount.js.map +0 -1
  28. package/dist/src/amount.test.d.ts +0 -2
  29. package/dist/src/amount.test.d.ts.map +0 -1
  30. package/dist/src/amount.test.js +0 -48
  31. package/dist/src/amount.test.js.map +0 -1
  32. package/dist/src/arrays.d.ts +0 -8
  33. package/dist/src/arrays.d.ts.map +0 -1
  34. package/dist/src/arrays.js +0 -16
  35. package/dist/src/arrays.js.map +0 -1
  36. package/dist/src/async.d.ts +0 -47
  37. package/dist/src/async.d.ts.map +0 -1
  38. package/dist/src/async.js +0 -101
  39. package/dist/src/async.js.map +0 -1
  40. package/dist/src/base58.d.ts +0 -5
  41. package/dist/src/base58.d.ts.map +0 -1
  42. package/dist/src/base58.js +0 -21
  43. package/dist/src/base58.js.map +0 -1
  44. package/dist/src/base64.d.ts +0 -3
  45. package/dist/src/base64.d.ts.map +0 -1
  46. package/dist/src/base64.js +0 -30
  47. package/dist/src/base64.js.map +0 -1
  48. package/dist/src/big-numbers.d.ts +0 -50
  49. package/dist/src/big-numbers.d.ts.map +0 -1
  50. package/dist/src/big-numbers.js +0 -93
  51. package/dist/src/big-numbers.js.map +0 -1
  52. package/dist/src/big-numbers.test.d.ts +0 -2
  53. package/dist/src/big-numbers.test.d.ts.map +0 -1
  54. package/dist/src/big-numbers.test.js +0 -101
  55. package/dist/src/big-numbers.test.js.map +0 -1
  56. package/dist/src/calldata.d.ts +0 -3
  57. package/dist/src/calldata.d.ts.map +0 -1
  58. package/dist/src/calldata.js +0 -8
  59. package/dist/src/calldata.js.map +0 -1
  60. package/dist/src/checkpoints.d.ts +0 -5
  61. package/dist/src/checkpoints.d.ts.map +0 -1
  62. package/dist/src/checkpoints.js +0 -30
  63. package/dist/src/checkpoints.js.map +0 -1
  64. package/dist/src/domains.d.ts +0 -2
  65. package/dist/src/domains.d.ts.map +0 -1
  66. package/dist/src/domains.js +0 -10
  67. package/dist/src/domains.js.map +0 -1
  68. package/dist/src/env.d.ts +0 -2
  69. package/dist/src/env.d.ts.map +0 -1
  70. package/dist/src/env.js +0 -15
  71. package/dist/src/env.js.map +0 -1
  72. package/dist/src/ids.d.ts +0 -20
  73. package/dist/src/ids.d.ts.map +0 -1
  74. package/dist/src/ids.js +0 -47
  75. package/dist/src/ids.js.map +0 -1
  76. package/dist/src/logging.d.ts +0 -20
  77. package/dist/src/logging.d.ts.map +0 -1
  78. package/dist/src/logging.js +0 -89
  79. package/dist/src/logging.js.map +0 -1
  80. package/dist/src/math.d.ts +0 -5
  81. package/dist/src/math.d.ts.map +0 -1
  82. package/dist/src/math.js +0 -25
  83. package/dist/src/math.js.map +0 -1
  84. package/dist/src/messages.d.ts +0 -21
  85. package/dist/src/messages.d.ts.map +0 -1
  86. package/dist/src/messages.js +0 -58
  87. package/dist/src/messages.js.map +0 -1
  88. package/dist/src/multisig.d.ts +0 -4
  89. package/dist/src/multisig.d.ts.map +0 -1
  90. package/dist/src/multisig.js +0 -61
  91. package/dist/src/multisig.js.map +0 -1
  92. package/dist/src/objects.d.ts +0 -16
  93. package/dist/src/objects.d.ts.map +0 -1
  94. package/dist/src/objects.js +0 -93
  95. package/dist/src/objects.js.map +0 -1
  96. package/dist/src/sets.d.ts +0 -4
  97. package/dist/src/sets.d.ts.map +0 -1
  98. package/dist/src/sets.js +0 -30
  99. package/dist/src/sets.js.map +0 -1
  100. package/dist/src/strings.d.ts +0 -7
  101. package/dist/src/strings.d.ts.map +0 -1
  102. package/dist/src/strings.js +0 -51
  103. package/dist/src/strings.js.map +0 -1
  104. package/dist/src/typeof.d.ts +0 -3
  105. package/dist/src/typeof.d.ts.map +0 -1
  106. package/dist/src/typeof.js +0 -12
  107. package/dist/src/typeof.js.map +0 -1
  108. package/dist/src/types.d.ts +0 -84
  109. package/dist/src/types.d.ts.map +0 -1
  110. package/dist/src/types.js +0 -25
  111. package/dist/src/types.js.map +0 -1
  112. package/dist/src/validation.d.ts +0 -2
  113. package/dist/src/validation.d.ts.map +0 -1
  114. package/dist/src/validation.js +0 -10
  115. package/dist/src/validation.js.map +0 -1
  116. package/dist/src/validator.d.ts +0 -17
  117. package/dist/src/validator.d.ts.map +0 -1
  118. package/dist/src/validator.js +0 -44
  119. package/dist/src/validator.js.map +0 -1
@@ -1,93 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- 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
- const ethers_1 = require("ethers");
9
- // Use toString(10) on bignumber.js to prevent ethers.js bigNumber error
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
- */
16
- function isBigNumberish(value) {
17
- try {
18
- const val = (0, bignumber_js_1.default)(value);
19
- return !val.isNaN() && val.isFinite() && bignumber_js_1.default.isBigNumber(val);
20
- }
21
- catch (error) {
22
- return false;
23
- }
24
- }
25
- 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
- */
31
- function isZeroish(value) {
32
- try {
33
- return (0, bignumber_js_1.default)(value).isZero();
34
- }
35
- catch (error) {
36
- return false;
37
- }
38
- }
39
- exports.isZeroish = isZeroish;
40
- /**
41
- * Converts a BigNumber to a FixedNumber of the format fixed128x18.
42
- * @param big The BigNumber to convert.
43
- * @returns A FixedNumber representation of a BigNumber.
44
- */
45
- function bigToFixed(big) {
46
- return ethers_1.FixedNumber.from(big.toString(10));
47
- }
48
- exports.bigToFixed = bigToFixed;
49
- /**
50
- * Converts a FixedNumber (of any format) to a BigNumber.
51
- * @param fixed The FixedNumber to convert.
52
- * @param ceil If true, the ceiling of fixed is used. Otherwise, the floor is used.
53
- * @returns A BigNumber representation of a FixedNumber.
54
- */
55
- function fixedToBig(fixed, ceil = false) {
56
- const fixedAsInteger = ceil ? fixed.ceiling() : fixed.floor();
57
- return (0, bignumber_js_1.default)(fixedAsInteger.toFormat('fixed256x0').toString());
58
- }
59
- exports.fixedToBig = fixedToBig;
60
- /**
61
- * Multiplies a BigNumber by a FixedNumber, returning the BigNumber product.
62
- * @param big The BigNumber to multiply.
63
- * @param fixed The FixedNumber to multiply.
64
- * @param ceil If true, the ceiling of the product is used. Otherwise, the floor is used.
65
- * @returns The BigNumber product in string type.
66
- */
67
- function mulBigAndFixed(big, fixed, ceil = false) {
68
- // Converts big to a FixedNumber, multiplies it by fixed, and converts the product back
69
- // to a BigNumber.
70
- return fixedToBig(fixed.mulUnsafe(bigToFixed(big)), ceil).toString(10);
71
- }
72
- 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
- function BigNumberMin(bn1, bn2) {
80
- return (0, bignumber_js_1.default)(bn1).gte(bn2) ? bn2.toString(10) : bn1.toString(10);
81
- }
82
- 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
- function BigNumberMax(bn1, bn2) {
90
- return (0, bignumber_js_1.default)(bn1).lte(bn2) ? bn2.toString(10) : bn1.toString(10);
91
- }
92
- exports.BigNumberMax = BigNumberMax;
93
- //# sourceMappingURL=big-numbers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"big-numbers.js","sourceRoot":"","sources":["../../src/big-numbers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,mCAAqC;AAErC,wEAAwE;AACxE,2CAA2C;AAE3C;;;;GAIG;AACH,SAAgB,cAAc,CAC5B,KAAyC;IAEzC,IAAI;QACF,MAAM,GAAG,GAAG,IAAA,sBAAS,EAAC,KAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,sBAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KACrE;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AATD,wCASC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,KAAsB;IAC9C,IAAI;QACF,OAAO,IAAA,sBAAS,EAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAA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AC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC;AALD,oCAKC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=big-numbers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"big-numbers.test.d.ts","sourceRoot":"","sources":["../../src/big-numbers.test.ts"],"names":[],"mappings":""}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
- const chai_1 = require("chai");
8
- const ethers_1 = require("ethers");
9
- const big_numbers_1 = require("./big-numbers");
10
- describe('isBigNumberish', () => {
11
- const testCases = [
12
- { expect: false, context: 'invalid number', case: 'invalidNumber' },
13
- { expect: false, context: 'NaN', case: NaN },
14
- { expect: false, context: 'undefined', case: undefined },
15
- { expect: false, context: 'null', case: null },
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);
29
- });
30
- });
31
- });
32
- describe('isZeroish', () => {
33
- const testCases = [
34
- { expect: false, context: 'invalid number', case: 'invalidNumber' },
35
- { expect: false, context: 'NaN', case: NaN },
36
- { expect: false, context: 'undefined', case: undefined },
37
- { expect: false, context: 'null', case: null },
38
- { expect: false, context: 'non 0 decimal', case: 123.123 },
39
- { expect: false, context: 'non 0 integer', case: 123 },
40
- { expect: true, context: 'hex 0', case: 0x00 },
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);
51
- });
52
- });
53
- });
54
- describe('bigToFixed', () => {
55
- it('converts a BigNumber to a FixedNumber', () => {
56
- const big = (0, bignumber_js_1.default)('7.5e-10');
57
- const fixed = (0, big_numbers_1.bigToFixed)(big);
58
- (0, chai_1.expect)(fixed.toUnsafeFloat()).to.equal(7.5e-10);
59
- });
60
- });
61
- describe('fixedToBig', () => {
62
- it('converts a FixedNumber to a floored BigNumber', () => {
63
- const fixed = ethers_1.FixedNumber.from('12.34');
64
- const big = (0, big_numbers_1.fixedToBig)(fixed);
65
- (0, chai_1.expect)(big.toNumber()).to.equal(12);
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());
99
- });
100
- });
101
- //# sourceMappingURL=big-numbers.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"big-numbers.test.js","sourceRoot":"","sources":["../../src/big-numbers.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAqC;AACrC,+BAA8B;AAC9B,mCAAqC;AAErC,+CAQuB;AAEvB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,SAAS,GAAG;QAChB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE;QACnE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE;QAC5C,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;QACxD,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;QAC9C,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;QACnD,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAO,EAAE;QACnD,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;QAC9C,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AwC,EAAE,GAAG,EAAE;QAChD,MAAM,GAAG,GAAG,IAAA,sBAAS,EAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,CAAC;QAClC,IAAA,aAAM,EAAC,IAAA,0BAAY,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,GAAG,GAAG,IAAA,sBAAS,EAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,CAAC;QAClC,IAAA,aAAM,EAAC,IAAA,0BAAY,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Contract } from 'ethers';
2
- export declare function formatCallData<C extends Contract, I extends Parameters<C['interface']['encodeFunctionData']>>(destinationContract: C, functionName: I[0], functionArgs: I[1]): string;
3
- //# sourceMappingURL=calldata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calldata.d.ts","sourceRoot":"","sources":["../../src/calldata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,cAAc,CAC5B,CAAC,SAAS,QAAQ,EAClB,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC,EAC1D,mBAAmB,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAKxE"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatCallData = void 0;
4
- function formatCallData(destinationContract, functionName, functionArgs) {
5
- return destinationContract.interface.encodeFunctionData(functionName, functionArgs);
6
- }
7
- exports.formatCallData = formatCallData;
8
- //# sourceMappingURL=calldata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calldata.js","sourceRoot":"","sources":["../../src/calldata.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAG5B,mBAAsB,EAAE,YAAkB,EAAE,YAAkB;IAC9D,OAAO,mBAAmB,CAAC,SAAS,CAAC,kBAAkB,CACrD,YAAY,EACZ,YAAY,CACb,CAAC;AACJ,CAAC;AARD,wCAQC"}
@@ -1,5 +0,0 @@
1
- import { Checkpoint, S3Checkpoint, S3CheckpointWithId } from './types';
2
- export declare function isS3Checkpoint(obj: any): obj is S3Checkpoint;
3
- export declare function isS3CheckpointWithId(obj: any): obj is S3CheckpointWithId;
4
- export declare function isCheckpoint(obj: any): obj is Checkpoint;
5
- //# sourceMappingURL=checkpoints.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../../src/checkpoints.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAUjB,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY,CAE5D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,kBAAkB,CAMxE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,UAAU,CAMxD"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCheckpoint = exports.isS3CheckpointWithId = exports.isS3Checkpoint = void 0;
4
- const ethers_1 = require("ethers");
5
- function isValidSignature(signature) {
6
- return typeof signature === 'string'
7
- ? ethers_1.utils.isHexString(signature)
8
- : ethers_1.utils.isHexString(signature.r) &&
9
- ethers_1.utils.isHexString(signature.s) &&
10
- Number.isSafeInteger(signature.v);
11
- }
12
- function isS3Checkpoint(obj) {
13
- return isValidSignature(obj.signature) && isCheckpoint(obj.value);
14
- }
15
- exports.isS3Checkpoint = isS3Checkpoint;
16
- function isS3CheckpointWithId(obj) {
17
- return (isValidSignature(obj.signature) &&
18
- isCheckpoint(obj.value.checkpoint) &&
19
- ethers_1.utils.isHexString(obj.value.message_id));
20
- }
21
- exports.isS3CheckpointWithId = isS3CheckpointWithId;
22
- function isCheckpoint(obj) {
23
- const isValidRoot = ethers_1.utils.isHexString(obj.root);
24
- const isValidIndex = Number.isSafeInteger(obj.index);
25
- const isValidMailbox = ethers_1.utils.isHexString(obj.merkle_tree_hook_address);
26
- const isValidDomain = Number.isSafeInteger(obj.mailbox_domain);
27
- return isValidIndex && isValidRoot && isValidMailbox && isValidDomain;
28
- }
29
- exports.isCheckpoint = isCheckpoint;
30
- //# sourceMappingURL=checkpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../../src/checkpoints.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAS/B,SAAS,gBAAgB,CAAC,SAAc;IACtC,OAAO,OAAO,SAAS,KAAK,QAAQ;QAClC,CAAC,CAAC,cAAK,CAAC,WAAW,CAAC,SAAS,CAAC;QAC9B,CAAC,CAAC,cAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAC5B,cAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9B,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,SAAgB,cAAc,CAAC,GAAQ;IACrC,OAAO,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAFD,wCAEC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC3C,OAAO,CACL,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC;QAC/B,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;QAClC,cAAK,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CACxC,CAAC;AACJ,CAAC;AAND,oDAMC;AAED,SAAgB,YAAY,CAAC,GAAQ;IACnC,MAAM,WAAW,GAAG,cAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,cAAK,CAAC,WAAW,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/D,OAAO,YAAY,IAAI,WAAW,IAAI,cAAc,IAAI,aAAa,CAAC;AACxE,CAAC;AAND,oCAMC"}
@@ -1,2 +0,0 @@
1
- export declare function domainHash(domain: number, merkle_tree_hook: string): string;
2
- //# sourceMappingURL=domains.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../src/domains.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAK3E"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.domainHash = void 0;
4
- const ethers_1 = require("ethers");
5
- const addresses_1 = require("./addresses");
6
- function domainHash(domain, merkle_tree_hook) {
7
- return ethers_1.utils.solidityKeccak256(['uint32', 'bytes32', 'string'], [domain, (0, addresses_1.addressToBytes32)(merkle_tree_hook), 'HYPERLANE']);
8
- }
9
- exports.domainHash = domainHash;
10
- //# sourceMappingURL=domains.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/domains.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAE/B,2CAA+C;AAE/C,SAAgB,UAAU,CAAC,MAAc,EAAE,gBAAwB;IACjE,OAAO,cAAK,CAAC,iBAAiB,CAC5B,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC/B,CAAC,MAAM,EAAE,IAAA,4BAAgB,EAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,CAC1D,CAAC;AACJ,CAAC;AALD,gCAKC"}
package/dist/src/env.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function safelyAccessEnvVar(name: string, toLowerCase?: boolean): string | undefined;
2
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,UAAQ,sBAMnE"}
package/dist/src/env.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safelyAccessEnvVar = void 0;
4
- // Should be used instead of referencing process directly in case we don't
5
- // run in node.js
6
- function safelyAccessEnvVar(name, toLowerCase = false) {
7
- try {
8
- return toLowerCase ? process.env[name]?.toLowerCase() : process.env[name];
9
- }
10
- catch (error) {
11
- return undefined;
12
- }
13
- }
14
- exports.safelyAccessEnvVar = safelyAccessEnvVar;
15
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,iBAAiB;AACjB,SAAgB,kBAAkB,CAAC,IAAY,EAAE,WAAW,GAAG,KAAK;IAClE,IAAI;QACF,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC3E;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAND,gDAMC"}
package/dist/src/ids.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { BytesLike } from 'ethers';
2
- /**
3
- * Converts a 20-byte (or other length) ID to a 32-byte ID.
4
- * Ensures that a bytes-like is 32 long. left-padding with 0s if not.
5
- *
6
- * @param data A string or array of bytes to canonize
7
- * @returns A Uint8Array of length 32
8
- */
9
- export declare function canonizeId(data: BytesLike): Uint8Array;
10
- /**
11
- * Converts an Hyperlane ID of 20 or 32 bytes to the corresponding EVM Address.
12
- *
13
- * For 32-byte IDs this enforces the EVM convention of using the LAST 20 bytes.
14
- *
15
- * @param data The data to truncate
16
- * @returns A 20-byte, 0x-prepended hex string representing the EVM Address
17
- * @throws if the data is not 20 or 32 bytes
18
- */
19
- export declare function evmId(data: BytesLike): string;
20
- //# sourceMappingURL=ids.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,QAAQ,CAAC;AAE1C;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CAUtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAU7C"}
package/dist/src/ids.js DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evmId = exports.canonizeId = void 0;
4
- const ethers_1 = require("ethers");
5
- /**
6
- * Converts a 20-byte (or other length) ID to a 32-byte ID.
7
- * Ensures that a bytes-like is 32 long. left-padding with 0s if not.
8
- *
9
- * @param data A string or array of bytes to canonize
10
- * @returns A Uint8Array of length 32
11
- */
12
- function canonizeId(data) {
13
- if (!data)
14
- throw new Error('Bad input. Undefined');
15
- const buf = ethers_1.utils.arrayify(data);
16
- if (buf.length > 32) {
17
- throw new Error('Too long');
18
- }
19
- if (buf.length !== 20 && buf.length != 32) {
20
- throw new Error('bad input, expect address or bytes32');
21
- }
22
- return ethers_1.utils.zeroPad(buf, 32);
23
- }
24
- exports.canonizeId = canonizeId;
25
- /**
26
- * Converts an Hyperlane ID of 20 or 32 bytes to the corresponding EVM Address.
27
- *
28
- * For 32-byte IDs this enforces the EVM convention of using the LAST 20 bytes.
29
- *
30
- * @param data The data to truncate
31
- * @returns A 20-byte, 0x-prepended hex string representing the EVM Address
32
- * @throws if the data is not 20 or 32 bytes
33
- */
34
- function evmId(data) {
35
- const u8a = ethers_1.utils.arrayify(data);
36
- if (u8a.length === 32) {
37
- return ethers_1.utils.hexlify(u8a.slice(12, 32));
38
- }
39
- else if (u8a.length === 20) {
40
- return ethers_1.utils.hexlify(u8a);
41
- }
42
- else {
43
- throw new Error(`Invalid id length. expected 20 or 32. Got ${u8a.length}`);
44
- }
45
- }
46
- exports.evmId = evmId;
47
- //# sourceMappingURL=ids.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/ids.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE1C;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAe;IACxC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,cAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;KAC7B;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACzD;IACD,OAAO,cAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAVD,gCAUC;AAED;;;;;;;;GAQG;AACH,SAAgB,KAAK,CAAC,IAAe;IACnC,MAAM,GAAG,GAAG,cAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE;QACrB,OAAO,cAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;KACzC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE;QAC5B,OAAO,cAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;KAC3B;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,6CAA6C,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;KAC5E;AACH,CAAC;AAVD,sBAUC"}
@@ -1,20 +0,0 @@
1
- import { LevelWithSilent, Logger, pino } from 'pino';
2
- export declare enum LogLevel {
3
- Debug = "debug",
4
- Info = "info",
5
- Warn = "warn",
6
- Error = "error",
7
- Off = "off"
8
- }
9
- export declare function getLogLevel(): pino.LevelWithSilent;
10
- export declare enum LogFormat {
11
- Pretty = "pretty",
12
- JSON = "json"
13
- }
14
- export declare function getLogFormat(): LogFormat;
15
- export declare let rootLogger: Logger<never>;
16
- export declare function getRootLogger(): Logger<never>;
17
- export declare function configureRootLogger(newLogFormat: LogFormat, newLogLevel: LogLevel): Logger<never>;
18
- export declare function setRootLogger(logger: Logger): Logger<never>;
19
- export declare function createHyperlanePinoLogger(logLevel: LevelWithSilent, logFormat: LogFormat): Logger<never>;
20
- //# sourceMappingURL=logging.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AASrD,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAYD,wBAAgB,WAAW,yBAE1B;AAED,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAQD,wBAAgB,YAAY,cAE3B;AAGD,eAAO,IAAI,UAAU,eAAiD,CAAC;AAEvE,wBAAgB,aAAa,kBAE5B;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,EACvB,WAAW,EAAE,QAAQ,iBAMtB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,iBAG3C;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,SAAS,iBA2BrB"}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createHyperlanePinoLogger = exports.setRootLogger = exports.configureRootLogger = exports.getRootLogger = exports.rootLogger = exports.getLogFormat = exports.LogFormat = exports.getLogLevel = exports.LogLevel = void 0;
4
- const pino_1 = require("pino");
5
- const env_1 = require("./env");
6
- // Level and format here should correspond with the agent options as much as possible
7
- // https://docs.hyperlane.xyz/docs/operate/config-reference#logfmt
8
- // A custom enum definition because pino does not export an enum
9
- // and because we use 'off' instead of 'silent' to match the agent options
10
- var LogLevel;
11
- (function (LogLevel) {
12
- LogLevel["Debug"] = "debug";
13
- LogLevel["Info"] = "info";
14
- LogLevel["Warn"] = "warn";
15
- LogLevel["Error"] = "error";
16
- LogLevel["Off"] = "off";
17
- })(LogLevel || (exports.LogLevel = LogLevel = {}));
18
- let logLevel = toPinoLevel((0, env_1.safelyAccessEnvVar)('LOG_LEVEL', true)) || 'info';
19
- function toPinoLevel(level) {
20
- if (level && pino_1.pino.levels.values[level])
21
- return level;
22
- // For backwards compat and also to match agent level options
23
- else if (level === 'none' || level === 'off')
24
- return 'silent';
25
- else
26
- return undefined;
27
- }
28
- function getLogLevel() {
29
- return logLevel;
30
- }
31
- exports.getLogLevel = getLogLevel;
32
- var LogFormat;
33
- (function (LogFormat) {
34
- LogFormat["Pretty"] = "pretty";
35
- LogFormat["JSON"] = "json";
36
- })(LogFormat || (exports.LogFormat = LogFormat = {}));
37
- let logFormat = LogFormat.JSON;
38
- const envLogFormat = (0, env_1.safelyAccessEnvVar)('LOG_FORMAT', true);
39
- if (envLogFormat && Object.values(LogFormat).includes(envLogFormat))
40
- logFormat = envLogFormat;
41
- function getLogFormat() {
42
- return logFormat;
43
- }
44
- exports.getLogFormat = getLogFormat;
45
- // Note, for brevity and convenience, the rootLogger is exported directly
46
- exports.rootLogger = createHyperlanePinoLogger(logLevel, logFormat);
47
- function getRootLogger() {
48
- return exports.rootLogger;
49
- }
50
- exports.getRootLogger = getRootLogger;
51
- function configureRootLogger(newLogFormat, newLogLevel) {
52
- logFormat = newLogFormat;
53
- logLevel = toPinoLevel(newLogLevel) || logLevel;
54
- exports.rootLogger = createHyperlanePinoLogger(logLevel, logFormat);
55
- return exports.rootLogger;
56
- }
57
- exports.configureRootLogger = configureRootLogger;
58
- function setRootLogger(logger) {
59
- exports.rootLogger = logger;
60
- return exports.rootLogger;
61
- }
62
- exports.setRootLogger = setRootLogger;
63
- function createHyperlanePinoLogger(logLevel, logFormat) {
64
- return (0, pino_1.pino)({
65
- level: logLevel,
66
- name: 'hyperlane',
67
- formatters: {
68
- // Remove pino's default bindings of hostname but keep pid
69
- bindings: (defaultBindings) => ({ pid: defaultBindings.pid }),
70
- },
71
- hooks: {
72
- logMethod(inputArgs, method, level) {
73
- // Pino has no simple way of setting custom log shapes and they
74
- // recommend against using pino-pretty in production so when
75
- // pretty is enabled we circumvent pino and log directly to console
76
- if (logFormat === LogFormat.Pretty &&
77
- level >= pino_1.pino.levels.values[logLevel]) {
78
- // eslint-disable-next-line no-console
79
- console.log(...inputArgs);
80
- // Then return null to prevent pino from logging
81
- return null;
82
- }
83
- return method.apply(this, inputArgs);
84
- },
85
- },
86
- });
87
- }
88
- exports.createHyperlanePinoLogger = createHyperlanePinoLogger;
89
- //# sourceMappingURL=logging.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":";;;AAAA,+BAAqD;AAErD,+BAA2C;AAE3C,qFAAqF;AACrF,kEAAkE;AAElE,gEAAgE;AAChE,0EAA0E;AAC1E,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,uBAAW,CAAA;AACb,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,IAAI,QAAQ,GACV,WAAW,CAAC,IAAA,wBAAkB,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC;AAE/D,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,KAAK,IAAI,WAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,KAAwB,CAAC;IACxE,6DAA6D;SACxD,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,QAAQ,CAAC;;QACzD,OAAO,SAAS,CAAC;AACxB,CAAC;AAED,SAAgB,WAAW;IACzB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,kCAEC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AACD,IAAI,SAAS,GAAc,SAAS,CAAC,IAAI,CAAC;AAC1C,MAAM,YAAY,GAAG,IA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,MAAM,CAAC,QAAQ,CAAC,EACrC;oBACA,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;oBAC1B,gDAAgD;oBAChD,OAAO,IAAI,CAAC;iBACb;gBACD,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACvC,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC;AA7BD,8DA6BC"}
@@ -1,5 +0,0 @@
1
- export declare function median(a: number[]): number;
2
- export declare function sum(a: number[]): number;
3
- export declare function mean(a: number[]): number;
4
- export declare function stdDev(a: number[]): number;
5
- //# sourceMappingURL=math.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAM1C;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAExC;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAI1C"}
package/dist/src/math.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stdDev = exports.mean = exports.sum = exports.median = void 0;
4
- function median(a) {
5
- const sorted = a.slice().sort();
6
- const mid = Math.floor(sorted.length / 2);
7
- const median = sorted.length % 2 == 0 ? (sorted[mid] + sorted[mid + 1]) / 2 : sorted[mid];
8
- return median;
9
- }
10
- exports.median = median;
11
- function sum(a) {
12
- return a.reduce((acc, i) => acc + i);
13
- }
14
- exports.sum = sum;
15
- function mean(a) {
16
- return sum(a) / a.length;
17
- }
18
- exports.mean = mean;
19
- function stdDev(a) {
20
- const xbar = mean(a);
21
- const squaredDifferences = a.map((x) => Math.pow(x - xbar, 2));
22
- return Math.sqrt(mean(squaredDifferences));
23
- }
24
- exports.stdDev = stdDev;
25
- //# sourceMappingURL=math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/math.ts"],"names":[],"mappings":";;;AAAA,SAAgB,MAAM,CAAC,CAAW;IAChC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1C,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wBAMC;AAED,SAAgB,GAAG,CAAC,CAAW;IAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAFD,kBAEC;AAED,SAAgB,IAAI,CAAC,CAAW;IAC9B,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAC3B,CAAC;AAFD,oBAEC;AAED,SAAgB,MAAM,CAAC,CAAW;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,kBAAkB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC7C,CAAC;AAJD,wBAIC"}
@@ -1,21 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { Address, Domain, HexString, ParsedMessage } from './types';
3
- /**
4
- * JS Implementation of solidity/contracts/libs/Message.sol#formatMessage
5
- * @returns Hex string of the packed message
6
- */
7
- export declare const formatMessage: (version: number | BigNumber, nonce: number | BigNumber, originDomain: Domain, senderAddr: Address, destinationDomain: Domain, recipientAddr: Address, body: HexString) => HexString;
8
- /**
9
- * Get ID given message bytes
10
- * @param message Hex string of the packed message (see formatMessage)
11
- * @returns Hex string of message id
12
- */
13
- export declare function messageId(message: HexString): HexString;
14
- /**
15
- * Parse a serialized Hyperlane message from raw bytes.
16
- *
17
- * @param message
18
- * @returns
19
- */
20
- export declare function parseMessage(message: string): ParsedMessage;
21
- //# sourceMappingURL=messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,aAAa,YACf,MAAM,GAAG,SAAS,SACpB,MAAM,GAAG,SAAS,gBACX,MAAM,cACR,OAAO,qBACA,MAAM,iBACV,OAAO,QAChB,SAAS,KACd,SAgBF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAkB3D"}