npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sei-native-oracle-adapter

v1.0.0

Published

Sei native oracle adapter library.

Readme

Sei Native Oracle Adapter Library

A library that enables an out-of-the-box utilization of the Sei Native Oracle though the Solidity smart-contracts. The Sei Native Oracle returns 18 decimal fixed point numbers in a string format (which is usually not directly usable), and this library helps you easily retrieve exchange rates in uint256 format with a manageable amount decimals.

Functionalities

getExchangeRates()

  • Function that provides the ability to retrieve all available exchange rates converted to uint256 and with maximum precision to the contracts which utilize the adapter.
  • Returns: rates[] and denoms[] (denoms is needed in order to map rates to tokens, which enables contextual usage of the retrieved data)

getExchangeRate(string memory denom)

  • Function that provides the ability to retrieve an exchange rate converted to uint256 and with maximum precision.
  • Denom is computed by appending lowercase character 'u' to the lowercase token symbol (ex. 'usei', 'ueth', 'ubtc').
  • In case of an unsupported denom, returned exchange rate will be zero.
  • Returns: rate

getOracleTwaps(uint64 lookbackSeconds)

  • Function that provides all available time weighed average prices of tokens converted to uint256 and with maximum precision for a chosen timespan.
  • Timespan is a time range between block.timestamp and block.timestamp - lookbackSeconds.
  • Returns: twaps[] + denoms[] (denoms array helps adapter/oracle consumers use data in context)

getOracleTwap(uint64 lookbackSeconds, string memory denom)

  • Function that provides a time weighed average price of a chosen token/denom in a timespan determined by lookbackSeconds.
  • Returns: twap

convertBytesNumberToUint256(bytes memory bytesNumber)

  • Function that converts a number from fixed point bytes representation (which was previously casted from string representation) to uint256.
  • Returns: uint256Number -> converted number

changeDecimals(uint256 number, uint256 fromDecimals, uint256 toDecimals)

  • Function that changes decimals on a provided number by either appending zeroes to it or trimming it for a specified number of decimals.
  • This function is not directly used in any of the existing flows, but it is made to let consumers manually adapt decimals on need.
  • Can utilize the informative ORACLE_PRECISION constant.
  • Returns: number -> number with modified decimals

*Rates/Prices are represented in USD value

Usage

Build

$ forge build

Test

$ forge test

License

MIT