2 releases
0.1.1 | Nov 24, 2023 |
---|---|
0.1.0 | Oct 25, 2023 |
#6 in #l2
49KB
733 lines
valence_market
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:
cargo add valence_market
Otherwise, add the following to your Cargo.toml
file:
[dependencies]
valence_market = "0.1.0"
..
🔌 Available Routes
/listings
Retrieve a list of available assets that users can browse and potentially buy
..
/listings/:id
Retrieve a specific listing by its ID
..
/listings
Create a new listing. The structure for the request body will need to follow the Listing
interface, which looks like:
{
"_id": "a8f163782fb07c69f511248e",
"title": "Asset_test",
"description": "This is a test asset listing",
"initial_price": 100,
"quantity": 10
}
..
/orders/:id
Retrieve a list of orders that have been placed, retrieved by the listing ID
..
/orders
Create a new order. The structure for the request body will need to follow the Order
interface, which looks like:
{
"id": "8c6dbdaea24a234fad18eca6",
"asset_id": "f837cb510db38d9040889e83",
"price": 100,
"quantity": 2,
"is_bid": false,
"created_at": "20 June 2023",
"druid": "g092384435098",
"desired_asset_id": null
}
..
🚧 Further Work
- Paginate orders
- Add cache functionality
- Add cuckoo filter functionality
- Separate ID from Listing and Order structs (create MongoDB wrapper struct with ID)
- 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
..
Dependencies
~36–51MB
~1M SLoC