Socket
Socket
Sign inDemoInstall

redstone-api-extended

Package Overview
Dependencies
10
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redstone-api-extended

Extended javascript library for fetching data from Redstone ecosystem


Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Redstone API (extended)

License Github activity Discord NPM

Twitter

This is an extended version of redstone-api. It adds the oracle module, allowing to fetch data packages from decentralized cache layer (including redstone-cache-layer nodes and streamr network) and use it in Blockchain Smart Contracts with tools like redstone-evm-connector.

📦 Installation

Using npm

npm install redstone-api-extended

Using yarn

yarn add redstone-api-extended

🤖 Usage

Importing

// Using Node.js `require()`
const redstone = require('redstone-api-extended');

// Using ES6 imports
import redstone from 'redstone-api-extended';

Get data packages with default sources configuration

// Get package for all symbols
const dataPackage = await redstone.oracle.getFromDataFeed("redstone-avalanche-prod");

// Get package for one symbol
const dataPackage = await redstone.oracle.getFromDataFeed("redstone-avalanche-prod", "ETH");
Available data feed ids
  • redstone
  • redstone-stocks
  • redstone-rapid
  • redstone-avalanche
  • redstone-avalanche-prod

Get default data sources configuration for data feed

const dataPackage = redstone.oracle.getDefaultDataSourcesConfig("redstone-stocks");

Get data packages with custom sources configuration

// Get with custom data sources config
const dataPackage = await redstone.oracle.get({
  "sources": [
    {
      "type": "streamr",
      "streamrEndpointPrefix": "0x981bdA8276ae93F567922497153de7A5683708d3/redstone-oracle",
      "disabledForSinglePrices": false,
      "evmSignerAddress": "0x981bdA8276ae93F567922497153de7A5683708d3"
    },
    {
      "type": "cache-layer",
      "url": "https://api.redstone.finance",
      "providerId": "TEHhCDWy-vGmPSZsYJyM0aP_MM4xESgyIZdf5mVODzg",
      "evmSignerAddress": "0x981bdA8276ae93F567922497153de7A5683708d3"
    },
    {
      "type": "cache-layer",
      "url": "https://api.redstone.finance",
      "providerId": "ll8DlO4xMwHK7gIMsbnOnN7Jg8Sl674Ls4G0aBfHCyk",
      "evmSignerAddress": "0x3BEFDd935b50F172e696A5187DBaCfEf0D208e48"
    },
    {
      "type": "cache-layer",
      "url": "https://vwx3eni8c7.eu-west-1.awsapprunner.com",
      "providerId": "TEHhCDWy-vGmPSZsYJyM0aP_MM4xESgyIZdf5mVODzg",
      "evmSignerAddress": "0x981bdA8276ae93F567922497153de7A5683708d3"
    }
  ],
  "valueSelectionAlgorithm": "first-valid",
  "timeoutMilliseconds": 10000,
  "maxTimestampDiffMilliseconds": 150000,
  "preVerifySignatureOffchain": true
});

Get the latest data package

💬 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

📜 License

This software is licensed under the MIT © Redstone

Keywords

FAQs

Last updated on 20 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc