Skip to main content

decode

@opcat-labs/scrypt-ts-opcat v1.0.4


@opcat-labs/scrypt-ts-opcat / scriptNumber / decode

Function: decode()

decode(buffer, maxLength?, minimal?): number

Defined in: packages/scrypt-ts-opcat/src/utils/script_number.ts:13

Decodes a script number from a buffer.

Parameters​

buffer​

Uint8Array

The buffer containing the script number.

maxLength?​

number

The maximum length of the script number. Defaults to 4.

minimal?​

boolean

Whether the script number should be minimal. Defaults to true.

Returns​

number

The decoded script number.

Throws​

If the script number overflows the maximum length.

Throws​

If the script number is not minimally encoded when minimal is true.