@kadena/hardhat-chainweb
Version:
Hardhat plugin for Kadena's Chainweb network
22 lines • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNetworkStem = void 0;
exports.computeOriginHash = computeOriginHash;
const ethers_1 = require("ethers");
const getNetworkStem = (chainwebName) => `chainweb_${chainwebName}`;
exports.getNetworkStem = getNetworkStem;
function computeOriginHash(origin) {
// Create a proper ABI encoding matching Solidity struct layout
const abiEncoded = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['tuple(uint32,address,uint64,uint64,uint64)'], [
[
origin.chain, // uint32 originChainId
origin.originContractAddress, // address originContractAddress
origin.height, // uint64 originBlockHeight
origin.txIdx, // uint64 originTransactionIndex
origin.eventIdx, // uint64 originEventIndex
],
]);
// Hash it using keccak256
return ethers_1.ethers.keccak256(abiEncoded);
}
//# sourceMappingURL=pure-utils.js.map