# polycode-chainlink-feeds

> Polycode SDK to access Chainlink features easily in-browser

Latest version **1.0.9** (published 2023-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install polycode-chainlink-feeds
pnpm add polycode-chainlink-feeds
yarn add polycode-chainlink-feeds
bun add polycode-chainlink-feeds
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2023-11-08 |
| First published | 2023-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 976.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AnonS |
| Maintainers | polycodesh |
| Keywords | sdk |

## Links

- npm: https://www.npmjs.com/package/polycode-chainlink-feeds
- npm.io page: https://npm.io/package/polycode-chainlink-feeds

## Dependencies (3)

- [web3](https://npm.io/package/web3.md) ^1.9.0
- [ethers](https://npm.io/package/ethers.md) ^6.7.1
- [mustache](https://npm.io/package/mustache.md) ^4.2.0

## Recent versions

- 1.0.9 (latest) — 2023-11-08
- 1.0.8 — 2023-11-06

## README

# Polycode Chainlink SDK

Polycode Chainlink SDK is a fully open source Typescript SDK which enables any frontend developer to fetch the prices of various assets through Chainlink DataFeeds.
Users can fetch price pairs, NFT floor price information & more...

## Getting started

Install the SDK by typing in your npm project (Angular, React, vanilla npm, ...)

```sh
npm install polycode-chainlink-feeds
```

In your JavaScript or TypeScript file import the SDK with:

```ts
import { PolycodeChainlinkSDK } from 'polycode-chainlink-feeds'
```

Then import all the Price Feeds you want:

```ts
import { PriceFeedsETH } from 'polycode-chainlink-feeds'
import { PriceFeedsAVAX } from 'polycode-chainlink-feeds'
import { PriceFeedsBSC } from 'polycode-chainlink-feeds'
```

Initialize the SDK by calling:

```ts
const ethSDK = new PolycodeChainlinkSDK('https://rpc-node-url.xx', new PriceFeedsETH())
const avaxSDK = new PolycodeChainlinkSDK('https://avax-rpc-url.xx', new PriceFeedsAVAX())
```

And simply fetch a price pair by calling the price feeds functionality on the SDK:

```ts
ethSDK.getFromOracle(ethSDK.feeds.AAVE_ETH).then(res => { console.log(res) })
```

## Modern development

Polycode Chainlink SDK extracts all the pair contracts addresses for all networks that are compatible into code generated classes, so all 
modern editors will support full code autocomplete.

![Screenshot 2023-03-31 at 17 48 26](https://user-images.githubusercontent.com/42938691/229169473-409e6fec-d183-416c-b0b3-db12f34fcf3c.png)

## Reading data

The data is returned in the form of an RoundDataModel object:

```ts
export interface RoundDataModel {
    roundID: BigNumber;
    answer: BigNumber;
    formattedAnswer?: string;
    startedAt: BigNumber;
    updatedAt: BigNumber;
    answeredInRound: BigNumber;
    assetName?: string;
    dataFeedName?: string;
}
```

## Example app

Take a look at [Example React App](https://github.com/0xpolycode/chainlink-sdk-example-react-app) too see how to use Polycode Chainlink SDK inside your project!

## License

Polycode Chainlink SDK is fully open source, clonable & re-usable. Polycode retains no rights to the code or implementations.

---
_Source: https://npm.io/package/polycode-chainlink-feeds · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
