generate_orbit_config
Create configuration code for Orbit chain deployments, including chain setup, AnyTrust DAC configuration, and custom gas token settings using the Arbitrum Orbit SDK.
Instructions
Generate configuration code for Orbit chain deployment. Supports chain config, AnyTrust DAC setup, and custom gas token configuration using @arbitrum/orbit-sdk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the configuration needed | |
| chain_id | No | Chain ID for the new Orbit chain | |
| owner | No | Initial chain owner address (0x...) | |
| is_anytrust | No | Whether this is an AnyTrust chain (vs Rollup) | |
| native_token | No | Custom gas token address (ERC20) | |
| parent_chain | No | Parent chain for the Orbit chain | arbitrum-sepolia |
Implementation Reference
- The `execute` method in `GenerateOrbitConfigTool` handles the logic for generating Orbit chain configurations by selecting templates and replacing placeholders with provided parameters.
def execute(self, **kwargs) -> dict[str, Any]: """Generate Orbit chain configuration code.""" prompt = kwargs.get("prompt", "") chain_id = kwargs.get("chain_id", 412346) owner = kwargs.get("owner", "0x0000000000000000000000000000000000000000") is_anytrust = kwargs.get("is_anytrust", False) native_token = kwargs.get("native_token") parent_chain = kwargs.get("parent_chain", "arbitrum-sepolia") if not prompt: return {"error": "prompt is required"} # Select template based on prompt keywords lower_prompt = prompt.lower() if native_token or "gas token" in lower_prompt or "native token" in lower_prompt: template = get_orbit_template("custom_gas_token") elif is_anytrust or "anytrust" in lower_prompt or "dac" in lower_prompt: template = get_orbit_template("anytrust_config") else: template = get_orbit_template("chain_config") if not template: template = get_orbit_template("chain_config") # Get parent chain info parent_rpc = PARENT_CHAIN_RPCS.get(parent_chain, PARENT_CHAIN_RPCS["arbitrum-sepolia"]) parent_chain_id = self._get_parent_chain_id(parent_chain) parent_chain_name = parent_chain.replace("-", " ").title() # Substitute parameters code = template.code code = code.replace("{chain_id}", str(chain_id)) code = code.replace("{owner}", owner) code = code.replace("{is_anytrust}", "true" if is_anytrust else "false") code = code.replace("{parent_chain_id}", str(parent_chain_id)) code = code.replace("{parent_chain_name}", parent_chain_name) code = code.replace("{parent_chain_rpc}", parent_rpc) if native_token: code = code.replace("{native_token}", native_token) code = code.replace( "{validators_array}", "[account.address] as `0x${string}`[]", ) code = code.replace( "{batch_posters_array}", "[account.address] as `0x${string}`[]", ) # Build files dict files = {} if template.template_type == "config" and template.name == "Orbit Chain Config": files["scripts/prepare-chain-config.ts"] = code elif "anytrust" in template.name.lower(): files["scripts/configure-anytrust.ts"] = code elif "gas token" in template.name.lower(): files["scripts/deploy-custom-gas-token.ts"] = code else: files["scripts/configure.ts"] = code # Add .env.example files[".env.example"] = self._generate_env_example(parent_rpc, chain_id) result = { "template_used": template.name, "template_type": template.template_type, "files": files, "dependencies": ORBIT_DEPENDENCIES, "parent_chain": { "name": parent_chain, "chain_id": parent_chain_id, "rpc": parent_rpc, }, "chain_config": { "chain_id": chain_id, "owner": owner, "is_anytrust": is_anytrust, "native_token": native_token, }, "setup_instructions": [ "1. Install dependencies: npm install", "2. Copy .env.example to .env and fill in your private key", f"3. Run the script: npx tsx {list(files.keys())[0]}", ], "disclaimer": TEMPLATE_DISCLAIMER, } return result - The `input_schema` defines the required and optional parameters for the `generate_orbit_config` tool.
input_schema = { "type": "object", "properties": { "prompt": { "type": "string", "description": "Description of the configuration needed", }, "chain_id": { "type": "integer", "description": "Chain ID for the new Orbit chain", "default": 412346, }, "owner": { "type": "string", "description": "Initial chain owner address (0x...)", }, "is_anytrust": { "type": "boolean", "description": "Whether this is an AnyTrust chain (vs Rollup)", "default": False, }, "native_token": { "type": "string", "description": "Custom gas token address (ERC20) for custom gas token chains", }, "parent_chain": { "type": "string", "enum": [ "arbitrum-one", "arbitrum-sepolia", "ethereum-mainnet", "ethereum-sepolia", ], "description": "Parent chain for the Orbit chain", "default": "arbitrum-sepolia", }, }, "required": ["prompt"], }