0.3.3 • Published 10 months ago
@chronicleprotocol/pull-oracle v0.3.3
Documentation
Check the documentation for more details.
Getting Started
Install the SDK
npm install --save @chronicleprotocol/pull-oracle
Usage
Generating authentication tokens on the server:
import { signAuthToken } from "@chronicleprotocol/pull-oracle";
const { token, message } = signAuthToken({
// private key is 0x prefixed 32 byte hex string
privateKey: "0xabc...",
});
Your public signing address must be allow-listed on our servers before your tokens will be valid.
Authenticating a user session on the client and fetching prices:
import { authenticate, getPrices } from "@chronicleprotocol/pull-oracle";
// token is received from the server
// `authenticate` caches the token in memory so it only needs to be called once per session
authenticate(token);
const prices = await getPrices([{ wat: "MKR/USD" }, { wat: "ETH/USD" }]);