@hyperlane-xyz/cli 31.1.0 → 31.2.0
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/bundle/index.js +76 -27
- package/package.json +15 -15
package/bundle/index.js
CHANGED
|
@@ -694435,7 +694435,7 @@ __webpack_async_result__();
|
|
|
694435
694435
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
694436
694436
|
/* harmony export */ x: () => (/* binding */ VERSION)
|
|
694437
694437
|
/* harmony export */ });
|
|
694438
|
-
const VERSION = '31.
|
|
694438
|
+
const VERSION = '31.2.0';
|
|
694439
694439
|
//# sourceMappingURL=version.js.map
|
|
694440
694440
|
|
|
694441
694441
|
/***/ }),
|
|
@@ -815780,12 +815780,13 @@ async function contractHasString(provider, address, searchFor) {
|
|
|
815780
815780
|
|
|
815781
815781
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
815782
815782
|
/* harmony export */ EM: () => (/* binding */ normalizeScale),
|
|
815783
|
+
/* harmony export */ TI: () => (/* binding */ messageAmountFromLocal),
|
|
815783
815784
|
/* harmony export */ gm: () => (/* binding */ scalesEqual),
|
|
815784
815785
|
/* harmony export */ k: () => (/* binding */ verifyScale)
|
|
815785
815786
|
/* harmony export */ });
|
|
815786
|
-
/* unused harmony
|
|
815787
|
-
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(
|
|
815788
|
-
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(
|
|
815787
|
+
/* unused harmony exports DEFAULT_SCALE, localAmountFromMessage, minLocalAmountForMessage, alignLocalAmountToMessage */
|
|
815788
|
+
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(21387);
|
|
815789
|
+
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(73938);
|
|
815789
815790
|
|
|
815790
815791
|
const DEFAULT_SCALE = {
|
|
815791
815792
|
numerator: 1n,
|
|
@@ -815805,6 +815806,48 @@ function normalizeScale(scale) {
|
|
|
815805
815806
|
denominator: BigInt(scale.denominator),
|
|
815806
815807
|
};
|
|
815807
815808
|
}
|
|
815809
|
+
function assertValidScale(scale) {
|
|
815810
|
+
(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .v)(scale.numerator > 0n && scale.denominator > 0n, `Scale must be positive, got ${scale.numerator}/${scale.denominator}`);
|
|
815811
|
+
}
|
|
815812
|
+
function ceilDiv(numerator, denominator) {
|
|
815813
|
+
assert(denominator > 0n, 'Denominator must be positive');
|
|
815814
|
+
assert(numerator >= 0n, 'Numerator must be non-negative');
|
|
815815
|
+
if (numerator === 0n)
|
|
815816
|
+
return 0n;
|
|
815817
|
+
return (numerator + denominator - 1n) / denominator;
|
|
815818
|
+
}
|
|
815819
|
+
function messageAmountFromLocal(localAmount, scale) {
|
|
815820
|
+
(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .v)(localAmount >= 0n, 'Local amount must be non-negative');
|
|
815821
|
+
const normalized = normalizeScale(scale);
|
|
815822
|
+
assertValidScale(normalized);
|
|
815823
|
+
return (localAmount * normalized.numerator) / normalized.denominator;
|
|
815824
|
+
}
|
|
815825
|
+
function localAmountFromMessage(messageAmount, scale) {
|
|
815826
|
+
assert(messageAmount >= 0n, 'Message amount must be non-negative');
|
|
815827
|
+
const normalized = normalizeScale(scale);
|
|
815828
|
+
assertValidScale(normalized);
|
|
815829
|
+
return (messageAmount * normalized.denominator) / normalized.numerator;
|
|
815830
|
+
}
|
|
815831
|
+
function minLocalAmountForMessage(messageAmount, scale) {
|
|
815832
|
+
assert(messageAmount >= 0n, 'Message amount must be non-negative');
|
|
815833
|
+
const normalized = normalizeScale(scale);
|
|
815834
|
+
assertValidScale(normalized);
|
|
815835
|
+
return ceilDiv(messageAmount * normalized.denominator, normalized.numerator);
|
|
815836
|
+
}
|
|
815837
|
+
function alignLocalAmountToMessage(localAmount, scale) {
|
|
815838
|
+
assert(localAmount >= 0n, 'Local amount must be non-negative');
|
|
815839
|
+
const messageAmount = messageAmountFromLocal(localAmount, scale);
|
|
815840
|
+
if (messageAmount === 0n) {
|
|
815841
|
+
return {
|
|
815842
|
+
localAmount: 0n,
|
|
815843
|
+
messageAmount: 0n,
|
|
815844
|
+
};
|
|
815845
|
+
}
|
|
815846
|
+
return {
|
|
815847
|
+
localAmount: minLocalAmountForMessage(messageAmount, scale),
|
|
815848
|
+
messageAmount,
|
|
815849
|
+
};
|
|
815850
|
+
}
|
|
815808
815851
|
/**
|
|
815809
815852
|
* Compares two scale values for equality without precision loss.
|
|
815810
815853
|
* Accepts any scale variant (number, {number,number}, {bigint,bigint}, undefined).
|
|
@@ -815835,8 +815878,8 @@ function verifyScale(configMap) {
|
|
|
815835
815878
|
const chainDecimalConfigPairs = configMap instanceof Map
|
|
815836
815879
|
? Object.fromEntries(configMap.entries())
|
|
815837
815880
|
: configMap;
|
|
815838
|
-
const entries = Object.entries((0,
|
|
815839
|
-
(0,
|
|
815881
|
+
const entries = Object.entries((0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__/* .objMap */ .Yp)(chainDecimalConfigPairs, (chain, config) => {
|
|
815882
|
+
(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .assert */ .v)(config.decimals != null, `Decimals must be defined for token config on chain ${chain}`);
|
|
815840
815883
|
return { decimals: config.decimals, scale: config.scale };
|
|
815841
815884
|
}));
|
|
815842
815885
|
if (entries.length <= 1)
|
|
@@ -816575,6 +816618,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
816575
816618
|
/* harmony import */ var _quoted_calls_builder_js__WEBPACK_IMPORTED_MODULE_15__ = __nccwpck_require__(33257);
|
|
816576
816619
|
/* harmony import */ var _quoted_calls_codec_js__WEBPACK_IMPORTED_MODULE_16__ = __nccwpck_require__(14372);
|
|
816577
816620
|
/* harmony import */ var _quoted_calls_types_js__WEBPACK_IMPORTED_MODULE_17__ = __nccwpck_require__(35835);
|
|
816621
|
+
/* harmony import */ var _utils_decimals_js__WEBPACK_IMPORTED_MODULE_19__ = __nccwpck_require__(27043);
|
|
816578
816622
|
/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(95778);
|
|
816579
816623
|
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_token_Token_js__WEBPACK_IMPORTED_MODULE_3__]);
|
|
816580
816624
|
_token_Token_js__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
@@ -816593,6 +816637,7 @@ _token_Token_js__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.t
|
|
|
816593
816637
|
|
|
816594
816638
|
|
|
816595
816639
|
|
|
816640
|
+
|
|
816596
816641
|
class WarpCore {
|
|
816597
816642
|
multiProvider;
|
|
816598
816643
|
tokens;
|
|
@@ -817366,22 +817411,24 @@ class WarpCore {
|
|
|
817366
817411
|
return true;
|
|
817367
817412
|
}
|
|
817368
817413
|
const destinationBalance = await this.getTokenCollateral(resolvedDestinationToken);
|
|
817369
|
-
|
|
817370
|
-
//
|
|
817371
|
-
|
|
817372
|
-
|
|
817373
|
-
|
|
817374
|
-
|
|
817375
|
-
|
|
817376
|
-
|
|
817377
|
-
|
|
817378
|
-
|
|
817379
|
-
|
|
817380
|
-
|
|
817381
|
-
|
|
817382
|
-
|
|
817383
|
-
}
|
|
817384
|
-
const
|
|
817414
|
+
// Legacy fallback: when both scales are undefined but decimals differ,
|
|
817415
|
+
// we can't use message-space comparison because messageAmountFromLocal
|
|
817416
|
+
// with identity scale would compare raw local units across different
|
|
817417
|
+
// decimal spaces. Fall back to decimal conversion instead.
|
|
817418
|
+
// Well-configured routes should have scale set — verifyScale() catches
|
|
817419
|
+
// this at deploy time. Misconfigured routes that reach the message-space
|
|
817420
|
+
// path below may produce incorrect results.
|
|
817421
|
+
if (originToken.decimals !== resolvedDestinationToken.decimals &&
|
|
817422
|
+
originToken.scale === undefined &&
|
|
817423
|
+
resolvedDestinationToken.scale === undefined) {
|
|
817424
|
+
const destinationBalanceInOriginDecimals = BigInt((0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_18__/* .convertDecimalsToIntegerString */ .In)(resolvedDestinationToken.decimals, originToken.decimals, destinationBalance.toString()));
|
|
817425
|
+
const isSufficient = destinationBalanceInOriginDecimals >= amount;
|
|
817426
|
+
this.logger.debug(`${originTokenAmount.token.symbol} to ${destination} has ${isSufficient ? 'sufficient' : 'INSUFFICIENT'} collateral`);
|
|
817427
|
+
return isSufficient;
|
|
817428
|
+
}
|
|
817429
|
+
const requiredMessageAmount = (0,_utils_decimals_js__WEBPACK_IMPORTED_MODULE_19__/* .messageAmountFromLocal */ .TI)(amount, originToken.scale);
|
|
817430
|
+
const availableMessageAmount = (0,_utils_decimals_js__WEBPACK_IMPORTED_MODULE_19__/* .messageAmountFromLocal */ .TI)(destinationBalance, resolvedDestinationToken.scale);
|
|
817431
|
+
const isSufficient = availableMessageAmount >= requiredMessageAmount;
|
|
817385
817432
|
this.logger.debug(`${originTokenAmount.token.symbol} to ${destination} has ${isSufficient ? 'sufficient' : 'INSUFFICIENT'} collateral`);
|
|
817386
817433
|
return isSufficient;
|
|
817387
817434
|
}
|
|
@@ -817721,11 +817768,14 @@ var customZodTypes = __nccwpck_require__(47690);
|
|
|
817721
817768
|
var TokenConnection = __nccwpck_require__(29842);
|
|
817722
817769
|
// EXTERNAL MODULE: ../sdk/dist/token/TokenStandard.js
|
|
817723
817770
|
var TokenStandard = __nccwpck_require__(4879);
|
|
817771
|
+
// EXTERNAL MODULE: ../sdk/dist/token/types.js
|
|
817772
|
+
var token_types = __nccwpck_require__(38466);
|
|
817724
817773
|
;// CONCATENATED MODULE: ../sdk/dist/token/ITokenMetadata.js
|
|
817725
817774
|
|
|
817726
817775
|
|
|
817727
817776
|
|
|
817728
817777
|
|
|
817778
|
+
|
|
817729
817779
|
const TokenConfigSchema = types/* object */.Ik({
|
|
817730
817780
|
chainName: customZodTypes/* ZChainName */.Vm.describe('The name of the chain, must correspond to a chain in the multiProvider chainMetadata'),
|
|
817731
817781
|
standard: types/* nativeEnum */.fc(TokenStandard/* TokenStandard */.ph)
|
|
@@ -817753,7 +817803,7 @@ const TokenConfigSchema = types/* object */.Ik({
|
|
|
817753
817803
|
coinGeckoId: types/* string */.Yj()
|
|
817754
817804
|
.optional()
|
|
817755
817805
|
.describe('The CoinGecko id of the token, used for price lookups'),
|
|
817756
|
-
scale:
|
|
817806
|
+
scale: token_types/* TokenMetadataSchema */.ox.shape.scale.describe('The scaling factor of the token'),
|
|
817757
817807
|
warpRouteId: types/* string */.Yj()
|
|
817758
817808
|
.min(1)
|
|
817759
817809
|
.optional()
|
|
@@ -903348,10 +903398,9 @@ function hexToRadixCustomPrefix(hex, module, prefix, length = 32) {
|
|
|
903348
903398
|
/* harmony export */ Zp: () => (/* binding */ addBufferToGasLimit),
|
|
903349
903399
|
/* harmony export */ fq: () => (/* binding */ toWei),
|
|
903350
903400
|
/* harmony export */ kX: () => (/* binding */ fromWei),
|
|
903351
|
-
/* harmony export */ kl: () => (/* binding */ convertDecimals)
|
|
903352
|
-
/* harmony export */ lx: () => (/* binding */ convertToScaledAmount)
|
|
903401
|
+
/* harmony export */ kl: () => (/* binding */ convertDecimals)
|
|
903353
903402
|
/* harmony export */ });
|
|
903354
|
-
/* unused harmony exports fromWeiRounded, tryParseAmount, eqAmountApproximate */
|
|
903403
|
+
/* unused harmony exports fromWeiRounded, tryParseAmount, eqAmountApproximate, convertToScaledAmount */
|
|
903355
903404
|
/* harmony import */ var _ethersproject_units__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(48312);
|
|
903356
903405
|
/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(62033);
|
|
903357
903406
|
|
|
@@ -907154,7 +907203,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"_format":"hh-sol-artifact-1","contra
|
|
|
907154
907203
|
/***/ 99468:
|
|
907155
907204
|
/***/ ((module) => {
|
|
907156
907205
|
|
|
907157
|
-
module.exports = {"rE":"31.
|
|
907206
|
+
module.exports = {"rE":"31.2.0"};
|
|
907158
907207
|
|
|
907159
907208
|
/***/ })
|
|
907160
907209
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperlane-xyz/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.2.0",
|
|
4
4
|
"description": "A command-line utility for common Hyperlane operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -72,21 +72,21 @@
|
|
|
72
72
|
"zod": "^3.21.2",
|
|
73
73
|
"zod-validation-error": "^3.3.0",
|
|
74
74
|
"zx": "^8.1.4",
|
|
75
|
+
"@hyperlane-xyz/aleo-sdk": "31.2.0",
|
|
76
|
+
"@hyperlane-xyz/cosmos-sdk": "31.2.0",
|
|
77
|
+
"@hyperlane-xyz/deploy-sdk": "4.3.3",
|
|
78
|
+
"@hyperlane-xyz/http-registry-server": "31.2.0",
|
|
75
79
|
"@hyperlane-xyz/core": "11.3.1",
|
|
76
|
-
"@hyperlane-xyz/
|
|
77
|
-
"@hyperlane-xyz/
|
|
78
|
-
"@hyperlane-xyz/
|
|
79
|
-
"@hyperlane-xyz/
|
|
80
|
-
"@hyperlane-xyz/
|
|
81
|
-
"@hyperlane-xyz/
|
|
82
|
-
"@hyperlane-xyz/sdk": "
|
|
83
|
-
"@hyperlane-xyz/
|
|
84
|
-
"@hyperlane-xyz/
|
|
85
|
-
"@hyperlane-xyz/
|
|
86
|
-
"@hyperlane-xyz/utils": "31.1.0",
|
|
87
|
-
"@hyperlane-xyz/tsconfig": "^31.1.0",
|
|
88
|
-
"@hyperlane-xyz/relayer": "1.1.20",
|
|
89
|
-
"@hyperlane-xyz/starknet-sdk": "27.2.8"
|
|
80
|
+
"@hyperlane-xyz/provider-sdk": "4.3.3",
|
|
81
|
+
"@hyperlane-xyz/radix-sdk": "31.2.0",
|
|
82
|
+
"@hyperlane-xyz/rebalancer": "27.2.8",
|
|
83
|
+
"@hyperlane-xyz/sdk": "31.2.0",
|
|
84
|
+
"@hyperlane-xyz/relayer": "1.1.21",
|
|
85
|
+
"@hyperlane-xyz/sealevel-sdk": "31.2.0",
|
|
86
|
+
"@hyperlane-xyz/starknet-sdk": "27.2.9",
|
|
87
|
+
"@hyperlane-xyz/tron-sdk": "22.1.13",
|
|
88
|
+
"@hyperlane-xyz/utils": "31.2.0",
|
|
89
|
+
"@hyperlane-xyz/tsconfig": "^31.2.0"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
92
|
"node": ">=16"
|