Skip to content

Commit 95e057a

Browse files
committed
chore: update readme and products links
1 parent dfbefde commit 95e057a

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@ import { products, productTypes } from '@nexusmutual/sdk';
1919

2020
Source of truth for the latest mainnet addresses. Feeds into https://api.nexusmutual.io/sdk/.
2121

22-
## Listed products and product types metadata
22+
## Product metadata
2323

24-
The `products` folder contains all protocols listed on Nexus Mutual.
24+
Product and product type metadata is served by the Nexus Mutual API (default base URL `https://api.nexusmutual.io/v2`).
25+
Use the `ProductAPI` class to query products and product types instead of local JSON or logo assets.
26+
For logos, use the URL `https://api.nexusmutual.io/v2/logos/:productId`
2527

26-
If you're a protocol owner and want to update any details (i.e. logo, website, etc), please submit a PR.
27-
Logos should meet the following criteria:
28+
### Example
29+
30+
```typescript
31+
import { ProductAPI } from '@nexusmutual/sdk';
2832

29-
- svg format, with 1:1 ratio
30-
- no fixed width or height
31-
- the image should reach the edge of the viewbox
33+
const productApi = new ProductAPI();
34+
35+
const productTypes = await productApi.getAllProductTypes();
36+
const product = await productApi.getProductById(247);
37+
38+
console.log(productTypes.length, product.name);
39+
```
3240

3341
## Development
3442

@@ -250,7 +258,9 @@ Note: The following product types do not require IPFS content:
250258
- sherlockBugBounty
251259
- immunefiBugBounty
252260

253-
For a complete list of products and product types, see [products.json](https://sdk.nexusmutual.io/data/products.json) and [product-types.json](https://sdk.nexusmutual.io/data/product-types.json).
261+
For a complete list of products and product types, use the API endpoints:
262+
`GET https://api.nexusmutual.io/v2/products` and `GET https://api.nexusmutual.io/v2/product-types`,
263+
or the `ProductAPI.getAllProducts()` and `ProductAPI.getAllProductTypes()` helpers.
254264

255265
### Validation Errors
256266

public/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
</div>
2525
<div class='row'>
2626
<div class='col text-right'>
27-
<a target="_blank" href="/data/product-types.json">Product types 🡭</a><br>
28-
<a target="_blank" href="/data/products.json">Products 🡭</a>
27+
<!-- TODO replace with PROD api url -->
28+
<a target="_blank" href="https://api.staging.nexusmutual.io/v2/product-types">Product types 🡭</a><br>
29+
<a target="_blank" href="https://api.staging.nexusmutual.io/v2/products">Products 🡭</a>
2930
</div>
3031
</div>
3132
</div>

0 commit comments

Comments
 (0)