Socket
Book a DemoInstallSign in
Socket

@bandprotocol/obi-ts

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bandprotocol/obi-ts

Typescript library for BandChain OBI

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

Band Chain Oracle Binary Interface (OBI)


Typescript Library for encoding and decoding data according to the Oracle Binary Interface (OBI) specification.

Installation

npm install @bandprotocol/obi-ts
# or
yarn add @bandprotocol/obi-ts

Usage

Basic Example

import { Obi } from '@bandprotocol/obi-ts'

// Create OBI object
const obi = new Obi(
  `{symbols:[string],minimum_source_count:u8}/{responses:[{symbol:string,response_code:u8,rate:u64}]}`
)

// Encode input
const input = { symbol: 'BTC', minimum_source_count: 10 }
const encodedInput = obi.encodeInput(input)

// Decode output
const output = obi.decodeOutput(encodedBytes)
console.log(output)

Data Types

OBI supports the following data types:

  • string: UTF-8 encoded string
  • bytes: Raw bytes
  • u8, u16, u32, u64, u128, u256: Unsigned integers
  • i8, i16, i32, i64, i128, i256: Signed integers
  • bool: Boolean
  • vector<T>: Array of elements of type T
  • struct: Object with named fields

Features

  • Type-safe data encoding/decoding
  • Support for complex nested structures
  • Compatible with Band Protocol oracle scripts
  • Language-agnostic specification

Documentation

For detailed documentation, please visit:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License

Support

For support and questions, please join our Discord community or open an issue in this repository.

Keywords

bandprotocol

FAQs

Package last updated on 21 Jan 2025

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