UNPKG

@unruggable/gateways

Version:

Trustless Ethereum Multichain CCIP-Read Gateway

33 lines (32 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ROLLUP_ABI = exports.ROOT_CHAIN_ABI = void 0; exports.isContract = isContract; exports.encodeProof = encodeProof; const abi_1 = require("ethers/abi"); const utils_js_1 = require("../utils.cjs"); exports.ROOT_CHAIN_ABI = new abi_1.Interface([ // `event NewHeaderBlock( // address indexed proposer, // uint256 indexed blockId, // uint256 indexed reward, // uint256 start, // uint256 end, // bytes32 root // )`, `function currentHeaderBlock() view returns (uint256)`, `function getLastChildBlock() view returns (uint256)`, `function headerBlocks(uint256) view returns (bytes32 rootHash, uint256 l2BlockNumberStart, uint256 l2BlockNumberEnd, uint256 createdAt, address proposer)`, ]); // https://github.com/0xPolygonHermez/zkevm-contracts/blob/main/contracts/v2/PolygonRollupManager.sol exports.ROLLUP_ABI = new abi_1.Interface([ `function chainIDToRollupID(uint64 chainID) view returns (uint32)`, `function getRollupBatchNumToStateRoot(uint32 rollupID, uint64 batchNum) view returns (bytes32)`, `function getLastVerifiedBatch(uint32 rollupID) view returns (uint64)`, ]); function isContract(proof) { return parseInt(proof.codeLength) > 0; } function encodeProof(proof) { return utils_js_1.ABI_CODER.encode(['bytes[]'], [proof]); }