navio-blsct
Version:
TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.
29 lines (22 loc) • 507 B
text/typescript
import {
getCTxOutAt,
getCTxOutsSize,
} from './blsct'
import { CTxOut } from './ctxOut'
export class CTxOuts {
private obj: any
constructor(obj: any) {
this.obj = obj
}
at = (i: number): CTxOut => {
const size = this.size()
if (i < 0 || i >= size) {
throw new RangeError(`Index ${i} is out of bounds. the size is ${size}`)
}
const obj = getCTxOutAt(this.obj, i)
return new CTxOut(obj)
}
size = (): number => {
return getCTxOutsSize(this.obj)
}
}