open-index/open-npm huggingface dataset:
npm package: @storknetwork/first-party-stork-evm-sdk
Description: An EVM Solidity SDK for First Party Stork Protocol
Author: Stork Labs
Latest version: 2.0.0

# First Party Stork EVM SDK

This is a Solidity SDK to build EVM contracts that consume First Party Stork data. This package is maintained by [Stork Labs](https://stork.network).

It is available on [npm](https://www.npmjs.com/package/@storknetwork/first-party-stork-evm-sdk).

## Pull Model

The First Party Stork EVM SDK allows users to interact with First Party Stork oracle contracts. These contracts enable individual publishers to directly push their own numeric updates on-chain with optional historical data storage. Any user can consume these updates on a pull basis.

## Details

The First Party Stork EVM SDK provides a set of useful interfaces and structures for building EVM contracts that consume First Party Stork data. Primarily, a consuming contract will be using:

- The `IFirstPartyStork` interface for interacting with the First Party Stork oracle contract
- The `getLatestTemporalNumericValue` function to get the latest value update from a specific publisher
- The `getHistoricalTemporalNumericValue` function to get historical value data by round ID
- The `TemporalNumericValue` struct which represents a value update
- The `PublisherUser` struct which represents publisher configuration

## Example

### Reading Data

The following snippet shows how to read the latest value from a specific publisher on chain.

```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.24 <0.9.0;

import "@storknetwork/first-party-stork-evm-sdk/IFirstPartyStork.sol";
import "@storknetwork/first-party-stork-evm-sdk/FirstPartyStorkStructs.sol";

contract YourContract {
    IFirstPartyStork public firstPartyStork;
    
    constructor(address _firstPartyStork) {
        firstPartyStork = IFirstPartyStork(_firstPartyStork);
    }
    
    // Read the latest value from a specific publisher
    function getPrice(address publisher, string memory assetPairId) 
        public view returns (int192 value, uint64 timestamp) {
        FirstPartyStorkStructs.TemporalNumericValue memory tnv = 
            firstPartyStork.getLatestTemporalNumericValue(publisher, assetPairId);
        return (tnv.quantizedValue, tnv.timestampNs);
    }
    
    // Read historical value data by round ID
    function getHistoricalPrice(address publisher, string memory assetPairId, uint256 roundId)
        public view returns (int192 value, uint64 timestamp) {
        FirstPartyStorkStructs.TemporalNumericValue memory tnv = 
            firstPartyStork.getHistoricalTemporalNumericValue(publisher, assetPairId, roundId);
        return (tnv.quantizedValue, tnv.timestampNs);
    }
}
```
npm package: @storknetwork/stork-evm-sdk
Description: An EVM Solidity SDK for Stork Protocol
Author: Stork Labs
Latest version: 1.0.5

# Stork EVM SDK

This is a Solidity SDK to build EVM contracts that consume Stork price feeds. This package is maintained by [Stork Labs](https://stork.network).

It is available on [npm](https://www.npmjs.com/package/@storknetwork/stork-evm-sdk).

## Pull Model

The Stork EVM SDK allows users to consume Stork price updates on a pull basis. This puts the responsibility of submitting the price updates on-chain to the user whenever they want to interact with an app that consumes Stork price feeds. Stork Labs maintains a [Chain Pusher](https://github.com/stork-oracle/stork-external/tree/main/apps/chain_pusher/README.md) in order to do this.

## Details

The Stork EVM SDK provides a set of useful interfaces and structures for building EVM contracts that consume Stork price feeds. Primarily, a consuming contract will be using:

- The `IStork` interface for interacting with the Stork oracle contract
- The `getTemporalNumericValueV1` function to get the latest price update with staleness check
- The `getTemporalNumericValueUnsafeV1` function to get the latest price update without staleness check
- The `TemporalNumericValue` struct which represents a price update

## Example

The following snippet is an example of how to use this SDK to consume Stork price feeds on chain. A full example is available [here](https://github.com/stork-oracle/stork-external/tree/main/chains/evm/examples/stork).

```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.24 <0.9.0;

import "@stork-network/stork-evm-sdk/IStork.sol";
import "@stork-network/stork-evm-sdk/StorkStructs.sol";

contract YourContract {
    IStork public stork;
    
    constructor(address _stork) {
        stork = IStork(_stork);
    }
    
    // This function reads the latest price from a Stork feed
    function getPrice(bytes32 feedId) public view returns (int192 price, uint64 timestamp) {
        StorkStructs.TemporalNumericValue memory value = stork.getTemporalNumericValueV1(feedId);
        return (value.quantizedValue, value.timestampNs);
    }
}
npm package: @storknetwork/stork-fast-evm-sdk
Description: An EVM Solidity SDK for the Stork Fast Protocol
Author: Stork Labs
Latest version: 1.0.0

# Stork Fast EVM SDK

This is a Solidity SDK for building EVM contracts that consume Stork Fast signed ECDSA update payloads. This package is maintained by [Stork Labs](https://stork.network).

It is available on [npm](https://www.npmjs.com/package/@storknetwork/stork-fast-evm-sdk).

## Verification and Deserialization

The Stork Fast EVM SDK provides a set of useful functions for verifying and deserializing Stork Fast signed ECDSA update payloads. These exist partially as library functions available directly in the `StorkFastDeserialize` library, and partially as contract functions available via the `IStorkFast` interface.

### StorkFastDeserialize Library Functions

The `StorkFastDeserialize` library provides the following functions for deserializing Stork Fast signed ECDSA update payloads:
- `splitSignedECDSAPayload` - Splits a signed ECDSA payload into a signature bytes and a verifiable payload bytes
- `deserializeSignedECDSAPayloadHeader` - Deserializes the header of a signed ECDSA payload
- `deserializeAssetsFromSignedECDSAPayload` - Deserializes the assets from a signed ECDSA payload

### IStorkFast Contract Functions

The `IStorkFast` interface provides a set of useful functions that can be called on an instance of the `StorkFast` contract. These include:
- `verifySignedECDSAPayload` - Verifies a signed ECDSA payload
- `verifyAndDeserializeSignedECDSAPayload` - Verifies and deserializes a signed ECDSA payload

## Example

The following snippet is an example of how to use this SDK to consume Stork Fast signed ECDSA update payloads on-chain. A full example is available [here](https://github.com/stork-oracle/stork-external/tree/main/chains/evm/examples/stork_fast).

```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;

import "@storknetwork/stork-fast-evm-sdk/IStorkFast.sol";
import "@storknetwork/stork-fast-evm-sdk/StorkFastStructs.sol";

contract YourContract {
    IStorkFast public storkFast;

    constructor(address _storkFast) {
        storkFast = IStorkFast(_storkFast);
    }

    function useStorkFast(bytes calldata payload) public payable returns (StorkFastStructs.Asset[] memory assets) {
        StorkFastStructs.Asset[] memory assets = storkFast.verifyAndDeserializeSignedECDSAPayload{value: msg.value}(payload);

        return assets;
    }
}
```
npm package: @storknetwork/stork_chainlink_adapter
Description: EVM Solidity contracts to adapt Stork price feeds to Chainlink's AggregatorV3 Interface
Author: Stork Labs
Latest version: 1.0.6

# Stork Chainlink Adapter

This is the Stork Chainlink Adapter for EVM-compatible chains. This package is maintained by [Stork Labs](https://stork.network).

It is available on [npm](https://www.npmjs.com/package/@storknetwork/stork_chainlink_adapter).

This package can be used as an SDK to build contracts that interact with Stork price feeds using Chainlink's familiar AggregatorV3Interface, or deployed as a standalone contract.

## Chainlink Compatibility

The adapter implements Chainlink's [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-evm/blob/develop/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol), allowing existing Chainlink-integrated applications to seamlessly integrate withStork price feeds with minimal code changes.

**Note: All timestamps are returned in nanoseconds (not seconds) to maintain Stork's high precision.**

## Usage as SDK

Install the package in your Solidity project:

```bash
npm install @storknetwork/stork_chainlink_adapter
```

Import and use in your contract:

```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.24 <0.9.0;

import "@storknetwork/stork_chainlink_adapter/contracts/StorkChainlinkAdapter.sol";

contract YourContract {
    StorkChainlinkAdapter public priceAdapter;
    
    constructor(address storkContract, bytes32 priceId) {
        priceAdapter = new StorkChainlinkAdapter(storkContract, priceId);
    }
    
    function getLatestPrice() external view returns (int256) {
        (, int256 price, , , ) = priceAdapter.latestRoundData();
        return price;
    }
}
```

A complete working example can be found in the [stork-external repository](https://github.com/stork-oracle/stork-external/tree/main/chains/evm/examples/stork_chainlink_adapter).


## Deploying

To deploy the contract, clone down the repo and run the following commands from this contract's directory:

1. `npm install`
2. `npx hardhat compile`
3. Set the `storkContract` and `encodedAssetId` in the `ignition/parameters.json` file. Stork contract addresses and encoded asset ids can be found in the [Stork Documentation](https://docs.stork.network/). 
4. Deploy the contract with `npx hardhat --network <network> ignition deploy ignition/modules/StorkChainlinkAdapter.ts --deployment-id chain-<chainId>-<assetId> --parameters ignition/parameters.json`
npm package: @storknetwork/stork_pyth_adapter
Description: EVM Solidity contracts to adapt Stork price feeds to Pyth's IPyth interface
Author: Stork Labs
Latest version: 1.0.1

# Stork Pyth Adapter

This is the Stork Pyth Adapter for EVM-compatible chains. This package is maintained by [Stork Labs](https://stork.network).

It is available on [npm](https://www.npmjs.com/package/@storknetwork/stork_pyth_adapter).

This package can be used as an SDK to build contracts that interact with Stork price feeds using Pyth's familiar IPyth interface, or deployed as a standalone contract.

## Pyth Compatibility

The adapter implements Pyth's [IPyth interface](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/IPyth.sol), allowing existing Pyth-integrated applications to seamlessly integrate with Stork price feeds with minimal code changes. Price precision (exponent) is dynamically reduced from Stork's int192 values to fit within the less precise int64 used in the IPyth interface.

**Note that all timestamps are returned in seconds (converted from Stork's nanosecond precision) and confidence intervals are not supported in this adapter.**

## Usage as SDK

Install the package in your Solidity project:

```bash
npm install @storknetwork/stork_pyth_adapter
```

Import and use in your contract:

```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.24 <0.9.0;

import "@storknetwork/stork_pyth_adapter/contracts/StorkPythAdapter.sol";

contract YourContract {
    StorkPythAdapter public priceAdapter;
    
    constructor(address storkContract) {
        priceAdapter = new StorkPythAdapter(storkContract);
    }
    
    function getLatestPrice(bytes32 priceId) external view returns (int64) {
        PythStructs.Price memory price = priceAdapter.getPrice(priceId);
        return price.price;
    }
}
```

## Supported Features

This adapter supports the following IPyth interface methods:
- `getValidTimePeriod()` - Returns the validity period for price feeds
- `getPrice(bytes32 id)` - Returns the latest price for a given asset ID
- `getPriceUnsafe(bytes32 id)` - Returns price without validation checks
- `getPriceNoOlderThan(bytes32 id, uint age)` - Returns price with age validation

## Unsupported Features

The following IPyth methods are not supported and will revert:
- EMA price methods (`getEmaPrice`, `getEmaPriceUnsafe`, `getEmaPriceNoOlderThan`)
- Update methods (`updatePriceFeeds`, `updatePriceFeedsIfNecessary`, `parsePriceFeedUpdates`, etc.)
- Fee calculation methods (`getUpdateFee`, `getTwapUpdateFee`)
A complete working example can be found in the [stork-external repository](https://github.com/stork-oracle/stork-external/tree/main/chains/evm/examples/stork_pyth_adapter).

## Deploying

To deploy the contract, clone down the repo and run the following commands from this contract's directory:

1. `npm install`
2. `npx hardhat compile`
3. Set the `storkContract` in the `ignition/parameters.json` file. Stork contract addresses can be found in the [Stork Documentation](https://docs.stork.network/).
4. `npx hardhat ignition deploy ignition/modules/StorkPythAdapter.ts --network <network>`