Using @maroo-chain/contracts in Your Project
Install the @maroo-chain/contracts npm package, import the Solidity precompile interfaces, and consume the pre-generated TypeScript ABIs from ethers or viem.
@maroo-chain/contracts is the canonical npm package shipping the Solidity interface files for Maroo's precompiles (IOkrw, IPcl, IEas, IAgent) and their pre-generated TypeScript ABIs. You install it like any other package; the Solidity sources live under precompiles/... and the typed ABIs live under abi/precompiles/.... You don't need to clone the maroo repo or compile precompile contracts yourself.Install the package
Add the package to your Hardhat or Foundry project. The package name is scoped —
@maroo-chain/contracts. (The earlier unscoped name maroo-contracts is deprecated; do not install it.) Two of the interfaces — IAgent.sol and IPcl.sol — import Solidity types from cosmos-evm-contracts, and the package does not declare it as a dependency. Install it alongside, or those imports fail to resolve. The other four interfaces need nothing extra.# npm
npm install @maroo-chain/contracts
# IAgent.sol and IPcl.sol import Solidity types from cosmos-evm-contracts,
# which @maroo-chain/contracts does NOT declare as a dependency — install it
# yourself or those two imports fail to resolve:
# HHE902 The package "cosmos-evm-contracts" is not installed.
npm install --save-dev cosmos-evm-contracts@^0.0.14 Import a Solidity interface
Solidity files are exposed under the
precompiles/ subpath. Import the precompile interface directly into your contract and instantiate it at the fixed precompile address.// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import "@maroo-chain/contracts/precompiles/pcl/IPcl.sol";
contract PolicyReader {
address constant PCL = 0x1000000000000000000000000000000000000005;
function getGlobalPolicies() external view returns (GlobalPolicyConfig memory) {
return IPcl(PCL).globalPolicies();
}
} Note: If you use Foundry, add
@maroo-chain/contracts/=node_modules/@maroo-chain/contracts/ to remappings.txt so the import path resolves. Use the typed ABI from ethers v6
The package ships per-precompile typed ABIs as named exports under
@maroo-chain/contracts/abi/precompiles/<module>/<Interface>. Import the ABI and pass it to new ethers.Contract(...).import { JsonRpcProvider, Contract } from "ethers";
import { iPclAbi } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";
const PCL = "0x1000000000000000000000000000000000000005";
const provider = new JsonRpcProvider("https://rpc-testnet.maroo.io");
const pcl = new Contract(PCL, iPclAbi, provider);
const admin = await pcl.policyAdmin.staticCall();
console.log("Policy Admin:", admin); Use the typed ABI from viem
The same named ABI export works with viem's
getContract helper. viem infers the function signatures from the typed ABI, so reads and writes are fully typed.import { createPublicClient, http, getContract } from "viem";
import { iPclAbi } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";
const client = createPublicClient({
transport: http("https://rpc-testnet.maroo.io"),
});
const pcl = getContract({
address: "0x1000000000000000000000000000000000000005",
abi: iPclAbi,
client,
});
const admin = await pcl.read.policyAdmin();
console.log("Policy Admin:", admin); Available precompile interfaces
The package currently exports four precompile interfaces. Each has both a Solidity source under
The ABIs are generated with wagmi from the Hardhat-compiled artifacts and ship in both ESM (
precompiles/<module>/I<Name>.sol and a typed ABI under abi/precompiles/<module>/I<Name>:| Interface | Solidity import | ABI import |
|---|---|---|
IOkrw | @maroo-chain/contracts/precompiles/okrw/IOkrw.sol | @maroo-chain/contracts/abi/precompiles/okrw/IOkrw |
IPcl | @maroo-chain/contracts/precompiles/pcl/IPcl.sol | @maroo-chain/contracts/abi/precompiles/pcl/IPcl |
IEas | @maroo-chain/contracts/precompiles/eas/IEas.sol | @maroo-chain/contracts/abi/precompiles/eas/IEas |
IAgent | @maroo-chain/contracts/precompiles/agent/IAgent.sol | @maroo-chain/contracts/abi/precompiles/agent/IAgent |
The ABIs are generated with wagmi from the Hardhat-compiled artifacts and ship in both ESM (
.js) and CommonJS (.cjs) flavors with .d.ts type declarations.// All four typed ABIs in one place
import { iOkrwAbi } from "@maroo-chain/contracts/abi/precompiles/okrw/IOkrw";
import { iPclAbi } from "@maroo-chain/contracts/abi/precompiles/pcl/IPcl";
import { iEasAbi } from "@maroo-chain/contracts/abi/precompiles/eas/IEas";
import { iAgentAbi } from "@maroo-chain/contracts/abi/precompiles/agent/IAgent"; Conclusion
For the precompile addresses to plug into these ABIs, see
deployed-contracts. For the semantics of each precompile, the canonical references are okrw-precompile-overview, pcl-precompile-overview, eas-precompile-overview, and agent-precompile-overview.