Skip to content

Commit

Permalink
Docs day polishing (#44)
Browse files Browse the repository at this point in the history
* revised structure of API

* revised custom Marketplace structure

* updated nav
  • Loading branch information
JamesLawton authored Apr 11, 2024
1 parent 0ce6fe0 commit eb73c2a
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 152 deletions.
9 changes: 0 additions & 9 deletions docs/pages/api/embedded-wallet.mdx

This file was deleted.

9 changes: 9 additions & 0 deletions docs/pages/api/marketplace/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Marketplace API

:::note
[Marketplace API documentation and testing](https://0xsequence.redoc.ly/tag/marketplace)
:::

The Sequence Marketplace API service offers a simple and fast way to interact with sequence marketplace protocols. The API is designed to be easy to use and to have all the features you need to build a fully functional marketplace.

#TODO add example from solutions
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,7 @@ import { Callout } from "vocs/components";

## GetTopOrders

Query the protocol for the top order based on various filters.

Fetch the top orders from the protocol, optionally excluding those created by a specific user.

- Request: POST /rpc/Marketplace/GetTopOrders
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract
- `collectionAddress` (string) -- the address of the NFT collection
- `currencyAddresses` (string[]) -- an array of currency contract addresses
- `tokenIDs` (string[]) -- an array of token IDs to filter the orders by
- `isListing` (bool) -- whether to fetch listing orders (true) or offer orders (false)
- `priceSort` (SortOrder) -- the direction to sort the orders by price as an enum of `"DESC"` or `"ASC"`
- `excludeUser?` (string) -- the address of a user whose orders to exclude
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]
With the use of the `GetTopOrders` api developers can build bots to retrieve best orders to execute on, or, just simple notifiers to track the best orders to take action.

:::code-group

Expand All @@ -57,8 +23,8 @@ curl --request POST \
```

```ts twoslash [js]
// Works in both a Webapp (browser) or Node.js:
import fetch from "cross-fetch";
// Works in both a Webapp (browser) or Node.js by importing cross-fetch:
// import fetch from "cross-fetch";

(async () => {
const res = await fetch(
Expand All @@ -81,12 +47,44 @@ import fetch from "cross-fetch";
console.log("res", await res.json());
})();
```

```shell twoslash [other]
Please contact our team for assistance with integrations to another target.
```
:::

### Example implementation
### Schema

Query the protocol for the top order based on various filters.

Fetch the top orders from the protocol, optionally excluding those created by a specific user.

- Request: POST /rpc/Marketplace/GetTopOrders
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract
- `collectionAddress` (string) -- the address of the NFT collection
- `currencyAddresses` (string[]) -- an array of currency contract addresses
- `tokenIDs` (string[]) -- an array of token IDs to filter the orders by
- `isListing` (bool) -- whether to fetch listing orders (true) or offer orders (false)
- `priceSort` (SortOrder) -- the direction to sort the orders by price as an enum of `"DESC"` or `"ASC"`
- `excludeUser?` (string) -- the address of a user whose orders to exclude
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]


With the use of the `GetTopOrders` api developers can build bots to retrieve best orders to execute on, or, just simple notifiers to track the best orders to take action.
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,14 @@ import { Callout } from "vocs/components";

## GetOrderbookOrders

Query the protocol for orders based on various filters.
With the use of the `GetOrderbookOrders` api developers can build custom marketplaces around the api, as an example, one can implement a frontend to fulfill certain orders (not just the best price) for a collectible

_Sequence Orderbook `GetOrderbookOrders` Method:_
![GetOrderbookOrders](/img/marketplace/custom-marketplace-listings.png)

- Request: POST /rpc/Marketplace/GetOrderbookOrders
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract
- `collectionAddress` (string) -- the address of the NFT collection
- `currencyAddresses` (string[]) -- an array of currency contract addresses
- `filters` (OrderbookOrderFilter) -- filters to apply to the query
- `tokenIds` (string[]) -- the token ids of the assets you're looking at
- `isListing?` (bool) -- `true` if it is an order, `false` if it's an offer
- `userAddress?` (string) -- the address of the user
- `orderStatuses` (OrderStatus[]) (optional) -- filter orders by their statuses as `OPEN`, `CLOSED`, `CANCELLED` strings
- `metadataFilter` (Filter) (optional) -- filter orders by metadata
- `text?` (string) -- text to search
- `properties?` (PropertyFilter[]) --
- `name` (string) -- name of the property, eg: hero
- `type`: (PropertyType) -- type of the values of the property as an enum from: `"INT"`,`"STRING"`,`"ARRAY"`, or `"GENERIC"`
- `min?`: (int64) -- used if type is int, gives range of values for filtering
- `max?`: (int64) -- used if type is int, gives range of values for filtering
- `values?`: []any -- if string then array of values, eg: ["Ada", "Ari", "Axel", "Banjo" ...]
- `beforeExpiryTimestamp` (int64) -- filter orders expiring before the given timestamp
- `page?` -- page object to sort by
- `sort` (Sort[]) -- with an object of keys `"column"` and `"order"` with example `"createdAt"` and `"ASC"`, respectively
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]

**Example: `GetOrderbookOrders` of token ids from a collection address on Polygon**
### Example

`GetOrderbookOrders` of token ids from a collection address on Sepolia:

<Callout type="info">
Note: If using the metadata.properties key to filter, the use of `min` and
Expand Down Expand Up @@ -129,14 +88,54 @@ import fetch from "cross-fetch";
console.log("res", await res.json());
})();
```

```shell twoslash [other]
Please contact our team for assistance with integrations to another target.
```
:::

### Example implementation
### Schema

With the use of the `GetOrderbookOrders` api developers can build custom marketplaces around the api, as an example, one can implement a frontend to fulfill certain orders (not just the best price) for a collectible
Query the protocol for orders based on various filters.

![GetOrderbookOrders](/img/marketplace/custom-marketplace-listings.png)
_Sequence Orderbook `GetOrderbookOrders` Method:_

- Request: POST /rpc/Marketplace/GetOrderbookOrders
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract
- `collectionAddress` (string) -- the address of the NFT collection
- `currencyAddresses` (string[]) -- an array of currency contract addresses
- `filters` (OrderbookOrderFilter) -- filters to apply to the query
- `tokenIds` (string[]) -- the token ids of the assets you're looking at
- `isListing?` (bool) -- `true` if it is an order, `false` if it's an offer
- `userAddress?` (string) -- the address of the user
- `orderStatuses` (OrderStatus[]) (optional) -- filter orders by their statuses as `OPEN`, `CLOSED`, `CANCELLED` strings
- `metadataFilter` (Filter) (optional) -- filter orders by metadata
- `text?` (string) -- text to search
- `properties?` (PropertyFilter[]) --
- `name` (string) -- name of the property, eg: hero
- `type`: (PropertyType) -- type of the values of the property as an enum from: `"INT"`,`"STRING"`,`"ARRAY"`, or `"GENERIC"`
- `min?`: (int64) -- used if type is int, gives range of values for filtering
- `max?`: (int64) -- used if type is int, gives range of values for filtering
- `values?`: []any -- if string then array of values, eg: ["Ada", "Ari", "Axel", "Banjo" ...]
- `beforeExpiryTimestamp` (int64) -- filter orders expiring before the given timestamp
- `page?` -- page object to sort by
- `sort` (Sort[]) -- with an object of keys `"column"` and `"order"` with example `"createdAt"` and `"ASC"`, respectively
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
## GetUserActivities

Retrieve activity data for a specific user, including orders and trades.
Enables you to retrieve activity data for a specific user, including orders and trades. With the use of the `GetUserActivities` api developers can build custom and personalized social or tracking experiences to follow certain users in various interfaces.

- Request: POST /api/Marketplace/GetUserActivities
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract.
- `collectionAddress` (string) -- the address of the NFT collection.
- `currencyAddresses` (string[]) -- an array of currency contract addresses.
- `userAddress` (string) -- the address of the user whose activities are being queried.
- `tokenIDs` (string[]) -- an array of token IDs to filter the activities by.
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]
![GetUserActivities](/img/marketplace/activities.png)

**Example: `GetUserActivities` for a user with specific token IDs**
### Example
`GetUserActivities` for a user with specific token IDs:


:::code-group

```shell twoslash [curl] filename="curl"
curl -X POST -H "Content-Type: application/json" https://dev-marketplace-api.sequence.app/arbitrum-sepolia/rpc/Marketplace/GetUserActivities -d '{
"orderbookContractAddress": "0xB537a160472183f2150d42EB1c3DD6684A55f74c",
Expand Down Expand Up @@ -75,14 +47,37 @@ import fetch from "cross-fetch";

console.log("res", await res.json());
})();
```
```
:::

```shell twoslash [other]
Please contact our team for assistance with integrations to another target.
```
### Schema

### Example implementation

With the use of the `GetUserActivities` api developers can build custom and personalized social or tracking experiences to follow certain users in various interfaces.

![GetUserActivities](/img/marketplace/activities.png)
- Request: POST /api/Marketplace/GetUserActivities
- Content-Type: application/json
- Body (in JSON):
- `orderbookContractAddress` (string) -- the address of the protocol contract.
- `collectionAddress` (string) -- the address of the NFT collection.
- `currencyAddresses` (string[]) -- an array of currency contract addresses.
- `userAddress` (string) -- the address of the user whose activities are being queried.
- `tokenIDs` (string[]) -- an array of token IDs to filter the activities by.
- Response (in JSON):
- `page`
- `page` (i32) -- number of the page
- `pageSize` (i32) -- number of orders on the page
- `more` (bool) -- if there are more orders
- `orders` (OrderbookOrder[])
[
- `orderId` (string) -- order id
- `tokenContract` (string) -- the collection contract
- `tokenId` (string) -- the tokenId of the collection in the order
- `isListing` (bool) -- is true if it's a listing for sale, or false if it's an offer
- `quantity` (string) -- the number of tokens the order is for
- `quantityRemaining` (string) -- the number of tokens after the order
- `currencyAddress` (string) -- the currency the token is trading in
- `pricePerToken` (string) -- the price per token
- `expiry` (string) -- the expiry of when the order is no longer valid
- `orderStatus` (OrderStatus) -- the status of the order as an enum fom `"OPEN"`, `"CLOSED"`, `"CANCELLED"`
- `createdBy` (string) -- the address the order was created by
- `createdAt` (uint64) -- the time the order was created
- `orderbookContractAddress` (string) -- the orderbook contract address
]
20 changes: 14 additions & 6 deletions nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const topNav = [
{ text: 'Relayer API', link: '/api/relayer/overview' },
{ text: 'Indexer API', link: '/api/indexer/overview' },
{ text: 'Metadata API', link: '/api/metadata/overview' },
{ text: 'Marketplace API', link: '/api/marketplace' },
{ text: 'Marketplace API', link: '/api/marketplace/overview' },
{ text: 'Node Gateway', link: '/api/node-gateway' },
]
},
Expand Down Expand Up @@ -119,7 +119,7 @@ export const sidebar = {
{text: 'Get Top Orders', link: '/solutions/marketplaces/orderbook/examples/03-get-top-orders'},
{text: 'Get Orderbook', link: '/solutions/marketplaces/orderbook/examples/04-get-orderbook'},
{text: 'Get User Activities', link: '/solutions/marketplaces/orderbook/examples/05-get-user-activities'},
{text: 'Orderbook Transactions', link: '/solutions/marketplaces/orderbook/examples/06-orderbook-transactions'},
{text: 'Creating Market Transactions', link: '/solutions/marketplaces/orderbook/examples/06-orderbook-transactions'},
]
}
]
Expand Down Expand Up @@ -408,10 +408,14 @@ export const sidebar = {
text: 'Marketplace',
collapsed: true,
items: [
{ text: 'Overview', link: '/api/marketplace' },
{ text: 'Schema', link: '/api/marketplace/schema' },
{ text: 'Marketplace API', link: '/api/marketplace/api' },
{ text: 'Overview', link: '/api/marketplace/overview' },
// { text: 'Schema', link: '/api/marketplace/schema' },
// { text: 'Marketplace API', link: '/api/marketplace/api' },
{text: 'Examples', collapsed: true, items: [
{text: 'Get Top Orders', link: '/solutions/marketplaces/orderbook/examples/03-get-top-orders'},
{text: 'Get Orderbook', link: '/solutions/marketplaces/orderbook/examples/04-get-orderbook'},
{text: 'Get User Activities', link: '/solutions/marketplaces/orderbook/examples/05-get-user-activities'},
{text: 'Creating Market Transactions', link: '/solutions/marketplaces/orderbook/examples/06-orderbook-transactions'},
]
}
]
Expand All @@ -435,6 +439,10 @@ export const sidebar = {
{ text: 'We\'re hiring!', link: 'https://horizon.io/careers' },
{ text: 'Contact Us', link: 'https://support.sequence.xyz' },
]
}
},





} as Sidebar

0 comments on commit eb73c2a

Please sign in to comment.