defmodule Polymarket.MixProject do use Mix.Project @version "0.2.0" @source_url "https://github.com/mdon/polymarket_sdk" def project do [ app: :polymarket_sdk, version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), description: description(), package: package(), docs: docs(), name: "Polymarket", source_url: @source_url ] end def application do [ extra_applications: [:logger] ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp description do "Higher-level Elixir SDK for Polymarket: Gamma market discovery, Data API, " <> "CTF/pUSD helpers, and convenience facades. Depends on polymarket_clob for the " <> "low-level CLOB surface." end defp package do # Files included in the published Hex tarball. # # `test/fixtures/` and the calldata-fixture regeneration script under # `scripts/` are included so consumers can verify the on-chain # ABI/calldata oracle and reproduce it without cloning the GitHub # repo. This matches the convention `polymarket_clob` already uses # for its parity fixtures. # # `scripts/node_modules/` is intentionally NOT included — it is a # local install of ethers.js used only by the regeneration script, # gitignored, and ~23MB. Listing the specific scripts files instead # of the directory keeps it out. # # `AGENTS.md`, `PACKAGE_PLAN.md`, and `SDK_SURFACE_PLAN.md` are # intentionally excluded: internal AI/dev-process planning notes # that are not authoritative for users of the library. [ licenses: ["MIT"], files: ~w( lib scripts/generate_calldata_fixtures.mjs scripts/generate_tx_fixtures.mjs scripts/package.json scripts/package-lock.json test/fixtures .formatter.exs mix.exs README.md LICENSE CHANGELOG.md ), links: %{ "GitHub" => @source_url, "Polymarket Docs" => "https://docs.polymarket.com" } ] end defp docs do [ main: "Polymarket", source_ref: "v#{@version}", source_url: @source_url, extras: [ "README.md", "CHANGELOG.md" ] ] end defp deps do # Phase 5 scaffold: the SDK depends on polymarket_clob for low-level CLOB # auth, signing, orders, and market reads. Higher-level Polymarket APIs # (Gamma, Data, CTF, pUSD, RTDS) live in this package. # # The path-based dep is the workspace-local form; set HEX_BUILD=1 # to switch it to the Hex requirement for `mix hex.build` / # `mix hex.publish` (publish polymarket_clob first). # # `:req` is reintroduced in Phase 6 because `Polymarket.Gamma` issues # first-party HTTPS calls against `gamma-api.polymarket.com`. `:plug` # comes back as a test-only dep so `Req.Test.json/2` and # `Plug.Conn.send_resp/3` remain available in the test suite. # # `:websockex` is reintroduced in Phase 10 because `Polymarket.RTDS` # `use WebSockex` for the real-time trade feed. # # `:jason` is reintroduced in Phase 10 because `Polymarket.RTDS` # directly encodes subscription messages and decodes incoming frames. # Other modules continue to rely on Req's built-in JSON decode step # (Jason reaches them transitively). # `:ex_keccak` is reintroduced in Phase 11a because `Polymarket.ABI` # computes function selectors as the first 4 bytes of # `keccak256("functionName(types)")`. The polymarket_clob package # already depends on it, but per the package-direct-dep convention # (Phase 4.5 / 6.1 / 10), modules under `lib/polymarket/` that # reference a third-party module by name declare the dep directly. [ workspace_dep(:polymarket_clob, "~> 0.2"), {:req, "~> 0.5"}, {:websockex, "~> 0.4"}, {:jason, "~> 1.4"}, {:ex_keccak, "~> 0.7"}, # `:ex_secp256k1` is reintroduced in Phase 11b because # `Polymarket.Tx.sign/2` calls `ExSecp256k1.sign_compact/2` for # legacy EIP-155 transaction signatures. {:ex_secp256k1, "~> 0.7"}, {:plug, "~> 1.18", only: :test}, {:ex_doc, "~> 0.34", only: :dev, runtime: false} ] end # Workspace packages are path deps day-to-day; HEX_BUILD=1 switches # them to Hex requirements so `mix hex.build`/`mix hex.publish` # produce a valid package (Hex forbids path dependencies). defp workspace_dep(name, requirement) do if System.get_env("HEX_BUILD") do {name, requirement} else {name, requirement, path: "../#{name}"} end end end