New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@decentralchain/oracle-data

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@decentralchain/oracle-data

Official TypeScript SDK for parsing, encoding, validating, and diffing oracle data on the DecentralChain blockchain — provider identity, asset verification, and data transaction field utilities

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
3
Created
Source

DecentralChain

@decentralchain/oracle-data

Oracle data parsing and encoding utilities for the DecentralChain blockchain.

npm license bundle size node

Overview

Provides structured access to on-chain oracle data entries — defining how oracle key-value data is encoded, decoded, and validated. Parse data transaction fields into typed provider and asset objects, convert them back to fields, and compute diffs between data states.

Part of the DecentralChain SDK.

Installation

npm install @decentralchain/oracle-data

Requires Node.js >= 24 and an ESM environment ("type": "module").

Quick Start

import {
  getProviderData,
  getProviderAssets,
  getFieldsFromData,
  getFieldsFromAsset,
  getDifferenceByData,
  getDifferenceByFields,
  getFields,
} from '@decentralchain/oracle-data';

// Parse oracle provider data from on-chain data transaction fields
const providerResult = getProviderData(dataTxFields);
if (providerResult.status === 'ok') {
  console.log(providerResult.content.name);
}

// Parse oracle asset data
const assets = getProviderAssets(dataTxFields);

// Convert provider data back to data transaction fields
const fields = getFieldsFromData(providerResult.content);

// Convert asset data back to fields
const assetFields = getFieldsFromAsset(asset);

// Get the diff between two provider data objects
const diff = getDifferenceByData(oldProvider, newProvider);

// Get the diff between two sets of raw fields
const fieldDiff = getDifferenceByFields(oldFields, newFields);

// Auto-detect provider vs asset and convert to fields
const autoFields = getFields(dataOrAsset);

API Reference

Parsing

  • getProviderData(dataTxFields) — Parse oracle provider data from an array of data transaction fields. Returns TResponse<IProviderData>.
  • getProviderAssets(dataTxFields) — Parse oracle asset data from an array of data transaction fields. Returns TResponse<TProviderAsset>[].

Serialization

  • getFieldsFromData(data) — Convert provider data back to data transaction fields.
  • getFieldsFromAsset(data) — Convert asset data back to data transaction fields.
  • getFields(data) — Auto-detect type and convert to data transaction fields.

Diffing

  • getDifferenceByData(previous, next) — Compute diff between two data objects of the same type.
  • getDifferenceByFields(previous, next) — Compute diff between two arrays of data transaction fields.

Types

  • IProviderData — Oracle provider metadata (name, link, email, version, description).
  • IProviderAsset / TProviderAsset — Oracle asset data (id, status, ticker, logo, etc.).
  • TDataTxField — A single data transaction field (string, integer, boolean, or binary).
  • TResponse<T> — Success or error response wrapper.
  • STATUS_LIST — Asset verification status enum.
  • DATA_ENTRY_TYPES — Data entry type identifiers.

Development

Prerequisites

  • Node.js >= 24 (see .node-version)
  • npm >= 11 (latest stable recommended)

Setup

git clone https://github.com/Decentral-America/oracle-data.git
cd oracle-data
npm install

Scripts

CommandDescription
npm run buildBuild distribution files (ESM + CJS)
npm testRun tests with Vitest
npm run test:watchTests in watch mode
npm run test:coverageTests with V8 coverage
npm run typecheckTypeScript type checking
npm run lintESLint
npm run lint:fixESLint with auto-fix
npm run formatFormat with Prettier
npm run format:checkCheck formatting
npm run check:publintValidate package structure
npm run check:exportsValidate type exports
npm run check:sizeCheck bundle size budget
npm run validateFull CI validation pipeline
npm run bulletproofFormat + lint fix + typecheck + test
npm run bulletproof:checkCI-safe: check format + lint + tc + test

Quality Gates

All PRs must pass:

  • Zero lint errors (npm run lint)
  • Zero type errors (npm run typecheck)
  • All tests passing with 90%+ coverage
  • Bundle size within budget (npm run check:size)
  • Valid package exports (npm run check:publint && npm run check:exports)
PackageDescription
@decentralchain/ts-typesCore TypeScript type definitions
@decentralchain/data-entitiesAsset, Money, and OrderPrice models
@decentralchain/node-api-jsNode REST API client
@decentralchain/transactionsTransaction builders and signers

Contributing

See CONTRIBUTING.md.

Security

To report a vulnerability, see SECURITY.md.

License

MIT — Copyright (c) DecentralChain

Keywords

decentralchain

FAQs

Package last updated on 05 Mar 2026

Did you know?

Socket

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