Typescript library for BandChain OBI
npm install @bandprotocol/obi-ts
Typescript Library for encoding and decoding data according to the Oracle Binary Interface (OBI) specification.
``bash`
npm install @bandprotocol/obi-tsor
yarn add @bandprotocol/obi-ts
`javascript
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)
`
OBI supports the following data types:
- string: UTF-8 encoded stringbytes
- : Raw bytesu8
- , u16, u32, u64, u128, u256: Unsigned integersi8
- , i16, i32, i64, i128, i256: Signed integersbool
- : Booleanvector
- : Array of elements of type Tstruct
- : Object with named fields
- Type-safe data encoding/decoding
- Support for complex nested structures
- Compatible with Band Protocol oracle scripts
- Language-agnostic specification
For detailed documentation, please visit:
- Band Chain Documentation
- OBI Specification
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature'
3. Commit your changes ()git push origin feature/amazing-feature`)
4. Push to the branch (
5. Open a Pull Request
This project is licensed under the MIT License
For support and questions, please join our Discord community or open an issue in this repository.