Skip to main content

VarIntReader

scrypt-ts / VarIntReader

Class: VarIntReader

A reader to parse a ByteString buffer

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new VarIntReader(buf)

Parameters

NameType
bufByteString

Defined in

dist/smart-contract/builtins/functions.d.ts:1067

Properties

buf

buf: ByteString

Defined in

dist/smart-contract/builtins/functions.d.ts:1065


pos

pos: bigint

Defined in

dist/smart-contract/builtins/functions.d.ts:1066


StateLen

Static Readonly StateLen: bigint

Defined in

dist/smart-contract/builtins/functions.d.ts:1062


Version

Static Readonly Version: bigint

Defined in

dist/smart-contract/builtins/functions.d.ts:1064


VersionLen

Static Readonly VersionLen: bigint

Defined in

dist/smart-contract/builtins/functions.d.ts:1063

Methods

eof

eof(): boolean

Check if all have been read

Returns

boolean

true if all have been read

Defined in

dist/smart-contract/builtins/functions.d.ts:1072


readBool

readBool(): boolean

read a byte as boolean

Returns

boolean

true if the read byte not equal to '00'

Defined in

dist/smart-contract/builtins/functions.d.ts:1082


readBytes

readBytes(): ByteString

read bytes which encoded with bitcoin [value-pushing words][https://wiki.bitcoinsv.io/index.php/Opcodes_used_in_Bitcoin_Script](https://wiki.bitcoinsv.io/index.php/Opcodes_used_in_Bitcoin_Script)

Returns

ByteString

true if all have been read

Defined in

dist/smart-contract/builtins/functions.d.ts:1077


readInt

readInt(): bigint

read bytes as readBytes and convert it to a number with byteString2Int

Returns

bigint

a number

Defined in

dist/smart-contract/builtins/functions.d.ts:1087