Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

@fuel-ts/utils v0.94.9Docs


Icon Link@fuel-ts/utils

Icon LinkVariables

Icon LinkdefaultConsensusKey

Icon InfoCircle

const defaultConsensusKey: "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298" = '0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298'

Icon LinkDefined in

packages/utils/src/utils/defaultSnapshotConfigs.ts:12 Icon Link


Icon LinkdefaultSnapshotConfigs

Icon InfoCircle

const defaultSnapshotConfigs: SnapshotConfigs

Icon LinkDefined in

packages/utils/src/utils/defaultSnapshotConfigs.ts:6 Icon Link

Icon LinkFunctions

Icon Linkarrayify()

Icon InfoCircle

arrayify(value, name?, copy?): Uint8Array

Get a typed Uint8Array from a BytesLike object.

Icon LinkParameters

value: BytesLike

the BytesLike data.

name?: string

a display name for the error result.

copy?: boolean = true

create a copy of the original data (if applicable).

Icon LinkReturns

Uint8Array

  • a typed Uint8Array.

Icon LinkDefined in

packages/utils/src/utils/arrayify.ts:12 Icon Link


Icon LinkassertUnreachable()

Icon InfoCircle

assertUnreachable(_x): never

Used to verify that a switch statement exhausts all variants.

Icon LinkParameters

_x: never

Icon LinkReturns

never

Icon LinkDefined in

packages/utils/src/index.ts:21 Icon Link


Icon LinkcapitalizeString()

Icon InfoCircle

capitalizeString(str): string

Icon LinkParameters

str: string

Icon LinkReturns

string

Icon LinkDefined in

packages/utils/src/utils/capitalizeString.ts:1 Icon Link


Icon LinkchunkAndPadBytes()

Icon InfoCircle

chunkAndPadBytes(bytes, chunkSize): Uint8Array[]

Function to take a byte array and split into chunks of a given size

Icon LinkParameters

bytes: Uint8Array

The byte array to chunk

chunkSize: number

The size of each chunk

Icon LinkReturns

Uint8Array[]

An array of byte arrays of a specified size

Icon LinkDefined in

packages/utils/src/utils/chunkAndPadBytes.ts:8 Icon Link


Icon LinkcompressBytecode()

Icon InfoCircle

compressBytecode(bytecodeAsBinary?): string

Icon LinkParameters

bytecodeAsBinary?: BytesLike

Icon LinkReturns

string

Icon LinkDefined in

packages/utils/src/utils/bytecode.ts:6 Icon Link


Icon Linkconcat()

Icon InfoCircle

concat(arrays): Uint8Array

Concatenates multiple BytesLike into a single Uint8Array.

Icon LinkParameters

arrays: readonly BytesLike []

The arrays to concatenate.

Icon LinkReturns

Uint8Array

  • The concatenated array.

Icon LinkDefined in

packages/utils/src/utils/concat.ts:38 Icon Link


Icon LinkconcatBytes()

Icon InfoCircle

concatBytes(arrays): Uint8Array

Concatenates multiple Uint8Arrays into a single Uint8Array.

Icon LinkParameters

arrays: readonly Uint8Array[] | readonly number[][]

The arrays to concatenate.

Icon LinkReturns

Uint8Array

  • The concatenated array.

Icon LinkDefined in

packages/utils/src/utils/concat.ts:11 Icon Link


Icon LinkdataSlice()

Icon InfoCircle

dataSlice(data, start?, end?): string

Returns a hex string by slicing data from the start offset to the end offset.

Icon LinkParameters

data: BytesLike

the data to be sliced.

start?: number

the start offset (default: 0).

end?: number

the end offset (default: length of data).

Icon LinkReturns

string

  • a sliced hex string from start to end.

Icon LinkDefined in

packages/utils/src/utils/dataSlice.ts:15 Icon Link


Icon LinkdecodeBase58()

Icon InfoCircle

decodeBase58(value): BN

Icon LinkParameters

value: string

Icon LinkReturns

BN

Icon LinkDefined in

packages/utils/src/utils/base58.ts:51 Icon Link


Icon LinkdecompressBytecode()

Icon InfoCircle

decompressBytecode(bytecodeAsBase64): Uint8Array

Icon LinkParameters

bytecodeAsBase64: string

Icon LinkReturns

Uint8Array

Icon LinkDefined in

packages/utils/src/utils/bytecode.ts:22 Icon Link


Icon LinkencodeBase58()

Icon InfoCircle

encodeBase58(_value): string

Encode value as a Base58-encoded string.

Icon LinkParameters

_value: BytesLike

Icon LinkReturns

string

Icon LinkDefined in

packages/utils/src/utils/base58.ts:30 Icon Link


Icon Linkhexlify()

Icon InfoCircle

hexlify(data): string

Returns a hex representation of the inputted bytes.

Icon LinkParameters

data: BytesLike

Icon LinkReturns

string

Icon LinkDefined in

packages/utils/src/utils/hexlify.ts:10 Icon Link


Icon LinkisDefined()

Icon InfoCircle

isDefined<T>(value): value is T

Icon LinkType Parameters

T

Icon LinkParameters

value: undefined | T

Icon LinkReturns

value is T

Icon LinkDefined in

packages/utils/src/utils/isDefined.ts:1 Icon Link


Icon LinknormalizeString()

Icon InfoCircle

normalizeString(str): string

Converts some.string-value into SomeStringValue.

Examples: my-simple.test —— MySimpleTest myFile.ts —— MyFileTs my-abi.json —— MyAbiJson

Icon LinkParameters

str: string

Icon LinkReturns

string

Icon LinkDefined in

packages/utils/src/utils/normalizeString.ts:11 Icon Link


Icon Linksleep()

Icon InfoCircle

sleep(time): Promise<unknown>

Icon LinkParameters

time: number

Icon LinkReturns

Promise<unknown>

Icon LinkDefined in

packages/utils/src/utils/sleep.ts:1 Icon Link


Icon LinktoUtf8Bytes()

Icon InfoCircle

toUtf8Bytes(stri, form): Uint8Array

Returns the UTF-8 byte representation of str.

If form is disabled, the string is not normalized.

Icon LinkParameters

stri: string

the string to convert to UTF-8 bytes.

form: boolean = true

whether to normalize the string.

Icon LinkReturns

Uint8Array

  • the UTF-8 byte representation of str.

Icon LinkDefined in

packages/utils/src/utils/toUtf8Bytes.ts:11 Icon Link


Icon LinktoUtf8String()

Icon InfoCircle

toUtf8String(bytes): string

Returns the string represented by the UTF-8 data bytes.

Icon LinkParameters

bytes: BytesLike

the UTF-8 data bytes

Icon LinkReturns

string

the string represented by the UTF-8 data bytes

Icon LinkDefined in

packages/utils/src/utils/toUtf8String.ts:178 Icon Link

Icon LinkClasses

Icon LinkInterfaces