{"id":23300285,"url":"https://github.com/district0x/cljs-0x-connect","last_synced_at":"2025-08-21T09:07:26.892Z","repository":{"id":62433080,"uuid":"124422532","full_name":"district0x/cljs-0x-connect","owner":"district0x","description":"ClojureScript wrapper for 0x Connect library","archived":false,"fork":false,"pushed_at":"2018-03-22T16:00:19.000Z","size":421,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-14T01:18:18.355Z","etag":null,"topics":["wrapper-library"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/district0x.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-08T17:03:02.000Z","updated_at":"2018-04-22T21:24:37.000Z","dependencies_parsed_at":"2022-11-01T21:01:37.595Z","dependency_job_id":null,"html_url":"https://github.com/district0x/cljs-0x-connect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/district0x/cljs-0x-connect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fcljs-0x-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fcljs-0x-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fcljs-0x-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fcljs-0x-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/district0x","download_url":"https://codeload.github.com/district0x/cljs-0x-connect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fcljs-0x-connect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270803450,"owners_count":24648687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wrapper-library"],"created_at":"2024-12-20T09:12:31.248Z","updated_at":"2025-08-21T09:07:26.876Z","avatar_url":"https://github.com/district0x.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cljs-0x-connect\n\n[![Build Status](https://travis-ci.org/district0x/cljs-0x-connect.svg?branch=master)](https://travis-ci.org/district0x/cljs-0x-connect)\n\nClojurescript wrapper for the [0xProject/connect](https://0xproject.com/docs/connect) library, which servers as a gateway to any relayer that conforms to the [standard relayer API v0](https://github.com/0xProject/standard-relayer-api).\n\n\n## Installation\nAdd `[district0x/cljs-0x-connect \"1.0.0\"]` into your project.clj.\u003cbr/\u003e\n\n## Usage\n\n- [cljs-0x-connect.http-client](#http-client)\n  - [create-http-client](#create-http-client)\n  - [get-fees-async](#get-fees-async)\n  - [get-orders-async](#get-orders-async)\n  - [get-order-async](#get-order-async)\n  - [get-orderbook-async](#get-orderbook-async)\n  - [get-token-pairs-async](#get-token-pairs-async)\n  - [submit-order-async](#submit-order-async)\n- [cljs-0x-connect.ws-orderbook](#ws-orderbook)\n  - [create-orderbook-channel](#create-orderbook-channel)\n  - [subscribe](#subscribe)\n  - [close](#close)\n\n## \u003ca name=\"cljs-0x-connect.http-client\"\u003e `cljs-0x-connect.http-client`\n\nThis namespace includes functions for interacting with a set of HTTP endpoints that implement the standard relayer API. \u003cbr\u003e\nAll functions return a JS Promise. Usage example:\n\n```clojure\n(ns my-district\n  (:require [cljs-0x-connect.http-client :as http-client]))\n```\n\n#### \u003ca name=\"create-http-client\"\u003e `create-http-client`\n\nReturns a new HttpClient instance, takes API url string as an argument. \u003cbr\u003e\nExample:\n\n```clojure\n(def client (http-client/create-http-client \"https://api.com/\"))\n```\n\n#### \u003ca name=\"get-fees-async\"\u003e `get-fees-async`\n\nRetrieves fee information from the API, takes a fees request map and an (optional) paging options map (defaults to `{:page 1 :per-page: 100}`) as the arguments. \u003cbr\u003e\n\n[Example](https://github.com/district0x/cljs-0x-connect/blob/connect-with-cljsjs/test/tests/all.cljs#L30).\n\n#### \u003ca name=\"get-orders-async\"\u003e `get-orders-async`\n\nRetrieves orders information from the API, takes an order request map and an (optional) paging options map as the arguments.\u003cbr\u003e\n\n[Example](https://github.com/district0x/cljs-0x-connect/blob/connect-with-cljsjs/test/tests/all.cljs#L55).\n\n#### \u003ca name=\"get-order-async\"\u003e `get-order-async`\n\nRetrieves information about a specific order from the API, takes a hash of the order as an argument.\u003cbr\u003e\n\n[Example](https://github.com/district0x/cljs-0x-connect/blob/connect-with-cljsjs/test/tests/all.cljs#L44).\n\n#### \u003ca name=\"get-orderbook-async\"\u003e `get-orderbook-async`\n\nRetrieves orderbook information from the API, takes an orderbook request map and an (optional) paging options map as the arguments.\u003cbr\u003e\n\n[Example](https://github.com/district0x/cljs-0x-connect/blob/connect-with-cljsjs/test/tests/all.cljs#L37).\n\n#### \u003ca name=\"get-token-pairs-async\"\u003e `get-token-pairs-async`\n\nRetrieves token pair information from the API, takes an token request map and an (optional) paging options map as the arguments.\u003cbr\u003e\n\n[Example](https://github.com/district0x/cljs-0x-connect/blob/connect-with-cljsjs/test/tests/all.cljs#L62).\n\n#### \u003ca name=\"submit-order-async\"\u003e `submit-order-async`\n\nSubmits a signed order to the API, takes a signed order map as an argument\u003cbr\u003e\nExample:\n\n```clojure\n(def signed-order {:ec-signature: {:r \"string\"\n                                   :s \"string,\"\n                                   :v \"number\"}\n                   :exchange-contract-address \"string\"\n                   :expiration-unix-timestamp-sec #object[BigNumber]\n                   :fee-fecipient \"string\"\n                   :maker \"string\"\n                   :maker-fee #object[BigNumber]\n                   :maker-token-address \"string\"\n                   :maker-token-amount #object[BigNumber]\n                   :salt #object[BigNumber]\n                   :taker \"string\"\n                   :takerFee #object[BigNumber]\n                   :taker-token-address \"string\"\n                   :taker-token-amount #object[BigNumber]})\n\n(http-client/submit-order-async chan signed-order)\n```\n\n## \u003ca name=\"cljs-0x-connect.ws-orderbook\"\u003e `cljs-0x-connect.ws-orderbook`\n\nThis namesapce includes functions for interacting with a websocket endpoint that implements the standard relayer API. \u003cbr\u003e\nExample:\n\n```clojure\n(ns my-district\n  (:require [cljs-0x-connect.ws-orderbook :as ws-orderbook]))\n```\n\n#### \u003ca name=\"create-orderbook-channel\"\u003e `create-orderbook-channel`\n\nReturns a new WebSocketOrderbookChannel instance, takes url string as an argument. \u003cbr\u003e\nExample:\n\n```clojure\n(def url \"wss://api.radarrelay.com/0x/v0/ws\")\n\n(def config {:heartbeat-interval-ms 1000})\n\n(def chan (ws-orderbook/create-orderbook-channel url config))\n\n```\n\n#### \u003ca name=\"create-channel-handler\"\u003e `create-channel-handler`\n\nReturns an OrderbookChannelHandler instance that responds to various channel updates, takes a map of four functions as an argument. \u003cbr\u003e\nExample:\n\n```clojure\n(def handler (ws-orderbook/create-channel-handler {:on-snapshot (fn [chan opts resp] (prn \"bids:\" (count (aget resp \"bids\"))\n                                                                                          \"asks:\" (count (aget resp \"asks\"))))\n                                                   :on-update (fn [chan opts order] (prn \"new order:\" order))\n                                                   :on-error (fn [chan opts resp] (prn \"Error:\" resp))\n                                                   :on-close (fn [chan opts] (prn \"closing\"))}))\n```\n\n#### \u003ca name=\"subscribe\"\u003e `subscribe`\n\nSubscribes to orderbook snapshots and updates from the websocket, takes as an argument an OrderbookChannelHandler instance and a map of:\n\n* subscription options map (describing which token pair to subscribe to)\n* an OrderbookChannelHandler instance.\nExample:\n\n```clojure\n(def orderbook-subscription-opts {:base-token-address \"0x2956356cd2a2bf3202f771f50d3d14a367b48070\"\n                                  :quote-token-address \"0xe41d2489571d322189246dafa5ebde1f4699f498\"\n                                  :limit 20\n                                  :snapshot true})\n\n(ws-orderbook/subscribe chan {:opts orderbook-subscription-opts\n                              :handler handler})\n```\n\n#### \u003ca name=\"close\"\u003e `close`\n\nCloses the websocket connection, takes a WebSocketOrderbookChannel instance as an argument. \u003cbr\u003e\nExample:\n\n```clojure\n(ws-orderbook/close chan)\n```\n\n## Development\n\nRun test suite:\n\n```bash\nlein deps\n# To run tests and rerun on changes\nlein doo chrome-headless tests\n```\nInstall into local repo:\n\n```bash\nlein cljsbuild test\nlein install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict0x%2Fcljs-0x-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistrict0x%2Fcljs-0x-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict0x%2Fcljs-0x-connect/lists"}