@hyperlane-xyz/cli 29.0.0 → 29.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +85 -29
- package/package.json +15 -15
package/bundle/index.js
CHANGED
|
@@ -620629,7 +620629,7 @@ __webpack_async_result__();
|
|
|
620629
620629
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
620630
620630
|
/* harmony export */ x: () => (/* binding */ VERSION)
|
|
620631
620631
|
/* harmony export */ });
|
|
620632
|
-
const VERSION = '29.0.
|
|
620632
|
+
const VERSION = '29.0.1';
|
|
620633
620633
|
//# sourceMappingURL=version.js.map
|
|
620634
620634
|
|
|
620635
620635
|
/***/ }),
|
|
@@ -695064,7 +695064,7 @@ class RebalancerContextFactory {
|
|
|
695064
695064
|
const intentStore = new _tracking_store_index_js__WEBPACK_IMPORTED_MODULE_16__/* .InMemoryStore */ .A();
|
|
695065
695065
|
const actionStore = new _tracking_store_index_js__WEBPACK_IMPORTED_MODULE_16__/* .InMemoryStore */ .A();
|
|
695066
695066
|
const explorerClient = typeof explorerUrlOrClient === 'string'
|
|
695067
|
-
? new _utils_ExplorerClient_js__WEBPACK_IMPORTED_MODULE_17__/* .ExplorerClient */ .x(explorerUrlOrClient)
|
|
695067
|
+
? new _utils_ExplorerClient_js__WEBPACK_IMPORTED_MODULE_17__/* .ExplorerClient */ .x(explorerUrlOrClient, (domain) => this.multiProvider.getProtocol(domain))
|
|
695068
695068
|
: explorerUrlOrClient;
|
|
695069
695069
|
// 3. Get MultiProtocolCore from registry (supports all VM types)
|
|
695070
695070
|
// Only fetch/validate addresses for warp route chains (not all registry chains)
|
|
@@ -697834,12 +697834,30 @@ class InMemoryStore {
|
|
|
697834
697834
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
697835
697835
|
/* harmony export */ x: () => (/* binding */ ExplorerClient)
|
|
697836
697836
|
/* harmony export */ });
|
|
697837
|
+
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(16639);
|
|
697838
|
+
/* harmony import */ var _hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(93142);
|
|
697839
|
+
|
|
697837
697840
|
class ExplorerClient {
|
|
697838
697841
|
baseUrl;
|
|
697839
|
-
|
|
697842
|
+
getProtocol;
|
|
697843
|
+
constructor(baseUrl, getProtocol) {
|
|
697840
697844
|
this.baseUrl = baseUrl;
|
|
697845
|
+
this.getProtocol = getProtocol;
|
|
697841
697846
|
}
|
|
697842
|
-
|
|
697847
|
+
/**
|
|
697848
|
+
* Convert an address to PostgreSQL bytea format (\\x-prefixed hex).
|
|
697849
|
+
* When `domain` is provided, resolves the chain's protocol to encode
|
|
697850
|
+
* non-EVM addresses (e.g. base58 Solana, 32-byte Starknet) correctly
|
|
697851
|
+
* via `addressToByteHexString`. Without `domain`, assumes the address
|
|
697852
|
+
* is already EVM-format hex (used for bridges, txSender, etc. which
|
|
697853
|
+
* are always EVM addresses).
|
|
697854
|
+
*/
|
|
697855
|
+
toBytea(addr, domain) {
|
|
697856
|
+
const protocol = domain !== undefined ? this.getProtocol(domain) : undefined;
|
|
697857
|
+
if (protocol && !(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .isEVMLike */ .Us)(protocol)) {
|
|
697858
|
+
const hex = (0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__/* .addressToByteHexString */ .a2)(addr, protocol);
|
|
697859
|
+
return hex.replace(/^0x/i, '\\x').toLowerCase();
|
|
697860
|
+
}
|
|
697843
697861
|
return addr.replace(/^0x/i, '\\x').toLowerCase();
|
|
697844
697862
|
}
|
|
697845
697863
|
/**
|
|
@@ -697868,14 +697886,17 @@ class ExplorerClient {
|
|
|
697868
697886
|
async hasUndeliveredRebalance(params, logger) {
|
|
697869
697887
|
const { bridges, routersByDomain, txSender, limit = 5 } = params;
|
|
697870
697888
|
// Derive routers and domains from routersByDomain
|
|
697871
|
-
const
|
|
697889
|
+
const routerEntries = Object.entries(routersByDomain);
|
|
697872
697890
|
const domains = Object.keys(routersByDomain).map(Number);
|
|
697873
697891
|
const variables = {
|
|
697892
|
+
// NOTE: bridges are always EVM addresses; pass domain here if non-EVM bridges are added
|
|
697874
697893
|
senders: bridges.map((a) => this.toBytea(a)),
|
|
697894
|
+
// NOTE: bridges are always EVM addresses; pass domain here if non-EVM bridges are added
|
|
697875
697895
|
recipients: bridges.map((a) => this.toBytea(a)),
|
|
697876
|
-
originTxRecipients:
|
|
697896
|
+
originTxRecipients: routerEntries.map(([domain, addr]) => this.toBytea(addr, Number(domain))),
|
|
697877
697897
|
originDomains: domains,
|
|
697878
697898
|
destDomains: domains,
|
|
697899
|
+
// NOTE: txSender is always an EVM address (rebalancer signer)
|
|
697879
697900
|
txSenders: [this.toBytea(txSender)],
|
|
697880
697901
|
limit,
|
|
697881
697902
|
};
|
|
@@ -697948,9 +697969,14 @@ class ExplorerClient {
|
|
|
697948
697969
|
const expectedRouter = routersByDomain[msg.origin_domain_id];
|
|
697949
697970
|
if (!expectedRouter)
|
|
697950
697971
|
return false;
|
|
697972
|
+
const protocol = this.getProtocol(msg.origin_domain_id);
|
|
697951
697973
|
const normalizedMsgRouter = msg.origin_tx_recipient?.startsWith('\\x')
|
|
697952
697974
|
? '0x' + msg.origin_tx_recipient.slice(2)
|
|
697953
697975
|
: msg.origin_tx_recipient;
|
|
697976
|
+
if (protocol && !(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .isEVMLike */ .Us)(protocol)) {
|
|
697977
|
+
const expectedHex = (0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__/* .addressToByteHexString */ .a2)(expectedRouter, protocol).toLowerCase();
|
|
697978
|
+
return normalizedMsgRouter?.toLowerCase() === expectedHex;
|
|
697979
|
+
}
|
|
697954
697980
|
return (normalizedMsgRouter?.toLowerCase() === expectedRouter.toLowerCase());
|
|
697955
697981
|
});
|
|
697956
697982
|
logger.debug({ totalRows: rows.length, validatedRows: validatedRows.length }, 'Post-query validation results');
|
|
@@ -697963,13 +697989,14 @@ class ExplorerClient {
|
|
|
697963
697989
|
async getInflightUserTransfers(params, logger) {
|
|
697964
697990
|
const { routersByDomain, excludeTxSenders, limit = 100 } = params;
|
|
697965
697991
|
// Derive routers and domains from routersByDomain
|
|
697966
|
-
const
|
|
697992
|
+
const routerEntries = Object.entries(routersByDomain);
|
|
697967
697993
|
const domains = Object.keys(routersByDomain).map(Number);
|
|
697968
697994
|
const variables = {
|
|
697969
|
-
senders:
|
|
697970
|
-
recipients:
|
|
697995
|
+
senders: routerEntries.map(([domain, addr]) => this.toBytea(addr, Number(domain))),
|
|
697996
|
+
recipients: routerEntries.map(([domain, addr]) => this.toBytea(addr, Number(domain))),
|
|
697971
697997
|
originDomains: domains,
|
|
697972
697998
|
destDomains: domains,
|
|
697999
|
+
// NOTE: excludeTxSenders are always EVM addresses
|
|
697973
698000
|
excludeTxSenders: excludeTxSenders.map((a) => this.toBytea(a)),
|
|
697974
698001
|
limit,
|
|
697975
698002
|
};
|
|
@@ -698044,19 +698071,23 @@ class ExplorerClient {
|
|
|
698044
698071
|
async getInflightRebalanceActions(params, logger) {
|
|
698045
698072
|
const { bridges, routersByDomain, rebalancerAddress, inventorySignerAddresses, limit = 100, } = params;
|
|
698046
698073
|
// Derive routers and domains from routersByDomain
|
|
698047
|
-
const
|
|
698074
|
+
const routerEntries = Object.entries(routersByDomain);
|
|
698048
698075
|
const domains = Object.keys(routersByDomain).map(Number);
|
|
698049
698076
|
// Build list of tx senders to include (rebalancer + optional inventory signer)
|
|
698077
|
+
// NOTE: rebalancerAddress is always an EVM address (rebalancer signer)
|
|
698050
698078
|
const txSenders = [this.toBytea(rebalancerAddress)];
|
|
698051
698079
|
if (inventorySignerAddresses) {
|
|
698052
698080
|
for (const addr of inventorySignerAddresses) {
|
|
698081
|
+
// NOTE: inventorySignerAddresses are filtered to ProtocolType.Ethereum
|
|
698053
698082
|
txSenders.push(this.toBytea(addr));
|
|
698054
698083
|
}
|
|
698055
698084
|
}
|
|
698056
698085
|
const variables = {
|
|
698086
|
+
// NOTE: bridges are always EVM addresses; pass domain here if non-EVM bridges are added
|
|
698057
698087
|
senders: bridges.map((a) => this.toBytea(a)),
|
|
698088
|
+
// NOTE: bridges are always EVM addresses; pass domain here if non-EVM bridges are added
|
|
698058
698089
|
recipients: bridges.map((a) => this.toBytea(a)),
|
|
698059
|
-
originTxRecipients:
|
|
698090
|
+
originTxRecipients: routerEntries.map(([domain, addr]) => this.toBytea(addr, Number(domain))),
|
|
698060
698091
|
originDomains: domains,
|
|
698061
698092
|
destDomains: domains,
|
|
698062
698093
|
txSenders,
|
|
@@ -767725,8 +767756,8 @@ const TokenMetadataSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* .object */ .Ik({
|
|
|
767725
767756
|
denominator: zod__WEBPACK_IMPORTED_MODULE_3__/* .number */ .ai().int().gt(0),
|
|
767726
767757
|
}),
|
|
767727
767758
|
zod__WEBPACK_IMPORTED_MODULE_3__/* .object */ .Ik({
|
|
767728
|
-
numerator: zod__WEBPACK_IMPORTED_MODULE_3__/* .coerce */ .au.bigint(),
|
|
767729
|
-
denominator: zod__WEBPACK_IMPORTED_MODULE_3__/* .coerce */ .au.bigint(),
|
|
767759
|
+
numerator: zod__WEBPACK_IMPORTED_MODULE_3__/* .coerce */ .au.bigint().positive(),
|
|
767760
|
+
denominator: zod__WEBPACK_IMPORTED_MODULE_3__/* .coerce */ .au.bigint().positive(),
|
|
767730
767761
|
}),
|
|
767731
767762
|
])
|
|
767732
767763
|
.optional(),
|
|
@@ -768807,26 +768838,51 @@ function scalesEqual(a, b) {
|
|
|
768807
768838
|
const nb = normalizeScale(b);
|
|
768808
768839
|
return na.numerator * nb.denominator === nb.numerator * na.denominator;
|
|
768809
768840
|
}
|
|
768841
|
+
/**
|
|
768842
|
+
* Verifies that scale configs across chains are mutually consistent.
|
|
768843
|
+
*
|
|
768844
|
+
* A warp route may use either convention:
|
|
768845
|
+
* - Scale-up: 6-decimal chains carry scale > 1, max-decimal chain carries no scale
|
|
768846
|
+
* - Scale-down: max-decimal chain carries scale < 1 ({num:1, den:N}), others carry no scale
|
|
768847
|
+
*
|
|
768848
|
+
* Both are valid as long as the effective message amount is identical for every chain:
|
|
768849
|
+
* scale_A / scale_B == 10^(dec_B - dec_A) for any pair (A, B)
|
|
768850
|
+
*
|
|
768851
|
+
* Equivalently (avoiding floating point): for a fixed reference chain R,
|
|
768852
|
+
* scale_A.num * 10^dec_A * scale_R.den == scale_R.num * 10^dec_R * scale_A.den
|
|
768853
|
+
*
|
|
768854
|
+
* This accepts precision loss from scale-down (e.g., BSC 18-decimal USDT
|
|
768855
|
+
* scaled to 6-decimal message encoding loses 12 digits of sub-unit precision).
|
|
768856
|
+
*/
|
|
768810
768857
|
function verifyScale(configMap) {
|
|
768811
768858
|
const chainDecimalConfigPairs = configMap instanceof Map
|
|
768812
768859
|
? Object.fromEntries(configMap.entries())
|
|
768813
768860
|
: configMap;
|
|
768814
|
-
const
|
|
768815
|
-
(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .v)(config.decimals, `Decimals must be defined for token config on chain ${chain}`);
|
|
768861
|
+
const entries = Object.entries((0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_0__/* .objMap */ .Yp)(chainDecimalConfigPairs, (chain, config) => {
|
|
768862
|
+
(0,_hyperlane_xyz_utils__WEBPACK_IMPORTED_MODULE_1__/* .assert */ .v)(config.decimals != null, `Decimals must be defined for token config on chain ${chain}`);
|
|
768816
768863
|
return { decimals: config.decimals, scale: config.scale };
|
|
768817
|
-
});
|
|
768818
|
-
if (
|
|
768819
|
-
|
|
768820
|
-
|
|
768821
|
-
|
|
768822
|
-
|
|
768823
|
-
|
|
768824
|
-
|
|
768825
|
-
|
|
768826
|
-
|
|
768827
|
-
|
|
768828
|
-
|
|
768829
|
-
|
|
768864
|
+
}));
|
|
768865
|
+
if (entries.length <= 1)
|
|
768866
|
+
return true;
|
|
768867
|
+
if (areDecimalsUniform(Object.fromEntries(entries))) {
|
|
768868
|
+
const [, refConfig] = entries[0];
|
|
768869
|
+
return entries.every(([, config]) => scalesEqual(refConfig.scale, config.scale));
|
|
768870
|
+
}
|
|
768871
|
+
// Pick the first chain as reference. For every other chain, verify pairwise:
|
|
768872
|
+
// ref.scale.num * 10^ref.dec * chain.scale.den
|
|
768873
|
+
// == chain.scale.num * 10^chain.dec * ref.scale.den
|
|
768874
|
+
const [, refConfig] = entries[0];
|
|
768875
|
+
const refNorm = normalizeScale(refConfig.scale);
|
|
768876
|
+
const refEffective = refNorm.numerator * 10n ** BigInt(refConfig.decimals);
|
|
768877
|
+
for (let i = 1; i < entries.length; i++) {
|
|
768878
|
+
const [, config] = entries[i];
|
|
768879
|
+
const norm = normalizeScale(config.scale);
|
|
768880
|
+
const effective = norm.numerator * 10n ** BigInt(config.decimals);
|
|
768881
|
+
// Cross-multiply to compare ratios without division:
|
|
768882
|
+
// refEffective / refNorm.denominator == effective / norm.denominator
|
|
768883
|
+
// => refEffective * norm.denominator == effective * refNorm.denominator
|
|
768884
|
+
if (refEffective * norm.denominator !== effective * refNorm.denominator) {
|
|
768885
|
+
return false;
|
|
768830
768886
|
}
|
|
768831
768887
|
}
|
|
768832
768888
|
return true;
|
|
@@ -911250,7 +911306,7 @@ module.exports = /*#__PURE__*/JSON.parse('[{"type":"function","name":"proveL2Lea
|
|
|
911250
911306
|
/***/ 99468:
|
|
911251
911307
|
/***/ ((module) => {
|
|
911252
911308
|
|
|
911253
|
-
module.exports = {"rE":"29.0.
|
|
911309
|
+
module.exports = {"rE":"29.0.1"};
|
|
911254
911310
|
|
|
911255
911311
|
/***/ })
|
|
911256
911312
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperlane-xyz/cli",
|
|
3
|
-
"version": "29.0.
|
|
3
|
+
"version": "29.0.1",
|
|
4
4
|
"description": "A command-line utility for common Hyperlane operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -79,21 +79,21 @@
|
|
|
79
79
|
"zod": "^3.21.2",
|
|
80
80
|
"zod-validation-error": "^3.3.0",
|
|
81
81
|
"zx": "^8.1.4",
|
|
82
|
-
"@hyperlane-xyz/aleo-sdk": "29.0.
|
|
82
|
+
"@hyperlane-xyz/aleo-sdk": "29.0.1",
|
|
83
|
+
"@hyperlane-xyz/eslint-config": "29.0.1",
|
|
84
|
+
"@hyperlane-xyz/http-registry-server": "29.0.1",
|
|
85
|
+
"@hyperlane-xyz/deploy-sdk": "4.2.1",
|
|
83
86
|
"@hyperlane-xyz/core": "11.1.0",
|
|
84
|
-
"@hyperlane-xyz/
|
|
85
|
-
"@hyperlane-xyz/
|
|
86
|
-
"@hyperlane-xyz/
|
|
87
|
-
"@hyperlane-xyz/
|
|
88
|
-
"@hyperlane-xyz/
|
|
89
|
-
"@hyperlane-xyz/
|
|
90
|
-
"@hyperlane-xyz/
|
|
91
|
-
"@hyperlane-xyz/
|
|
92
|
-
"@hyperlane-xyz/
|
|
93
|
-
"@hyperlane-xyz/
|
|
94
|
-
"@hyperlane-xyz/tsconfig": "^29.0.0",
|
|
95
|
-
"@hyperlane-xyz/sealevel-sdk": "29.0.0",
|
|
96
|
-
"@hyperlane-xyz/utils": "29.0.0"
|
|
87
|
+
"@hyperlane-xyz/cosmos-sdk": "29.0.1",
|
|
88
|
+
"@hyperlane-xyz/provider-sdk": "4.2.1",
|
|
89
|
+
"@hyperlane-xyz/radix-sdk": "29.0.1",
|
|
90
|
+
"@hyperlane-xyz/rebalancer": "27.2.0",
|
|
91
|
+
"@hyperlane-xyz/relayer": "1.1.13",
|
|
92
|
+
"@hyperlane-xyz/sealevel-sdk": "29.0.1",
|
|
93
|
+
"@hyperlane-xyz/tron-sdk": "22.1.5",
|
|
94
|
+
"@hyperlane-xyz/tsconfig": "^29.0.1",
|
|
95
|
+
"@hyperlane-xyz/utils": "29.0.1",
|
|
96
|
+
"@hyperlane-xyz/sdk": "29.0.1"
|
|
97
97
|
},
|
|
98
98
|
"engines": {
|
|
99
99
|
"node": ">=16"
|