Logo

valence_market

Pipeline Status

valence_market is a plug-in for Valence that lets you set up a web3 marketplace in seconds. Let your users buy and sell assets in a distributed marketplace, where the only fees are the ones you set, and your users are in control of their own trades.

Official documentation ยป

## How to Use `valence_market` provides routes that you can plug in to your base Valence node to turn it into a fully functional marketplace. It is designed to be used as a library and can be imported into your Valence project. .. ### ๐Ÿ”ง Installation If you have `cargo-add` installed, you can simply run the following command: ```sh cargo add valence_market ``` Otherwise, add the following to your `Cargo.toml` file: ```toml [dependencies] valence_market = "0.1.0" ```

(back to top)

.. ### ๐Ÿ”Œ Available Routes #### **GET `/listings`** Retrieve a list of available assets that users can browse and potentially buy .. #### **GET `/listings/:id`** Retrieve a specific listing by its ID .. #### **POST `/listings`** Create a new listing. The structure for the request body will need to follow the `Listing` interface, which looks like: ```json { "_id": "a8f163782fb07c69f511248e", "title": "Asset_test", "description": "This is a test asset listing", "initial_price": 100, "quantity": 10 } ``` .. #### **GET `/orders/:id`** Retrieve a list of orders that have been placed, retrieved by the listing ID .. #### **POST `/orders`** Create a new order. The structure for the request body will need to follow the `Order` interface, which looks like: ```json { "id": "8c6dbdaea24a234fad18eca6", "asset_id": "f837cb510db38d9040889e83", "price": 100, "quantity": 2, "is_bid": false, "created_at": "20 June 2023", "druid": "g092384435098", "desired_asset_id": null } ```

(back to top)

.. ### ๐Ÿšง Further Work - [ ] Paginate orders - [ ] Add cache functionality - [ ] Add cuckoo filter functionality - [x] Separate ID from Listing and Order structs (create MongoDB wrapper struct with ID) - [x] Construct initial order when new listing is created (does this form part of the listing POST call?) - [ ] Add tests - [ ] Add logging - [ ] Refactor and improve error messages for call failures - [ ] Create user functionality - [ ] With user functionality enabled, add user ID to listing and order structs - [ ] With user functionality enabled, add PUT/DELETE calls for listings and orders

(back to top)

..