Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
242 lines (145 sloc) 4.95 KB

near-runtime-ts > "near" > near

Module: near

Index

Classes

Functions


Functions

base58

base58(source: Uint8Array): string

Defined in near.ts:1193

Parameters:

Name Type
source Uint8Array

Returns: string


bytesToString

bytesToString(bytes: Uint8Array): string

Defined in near.ts:1115

Parameters:

Name Type
bytes Uint8Array

Returns: string


hash

hash<T>(data: T): Uint8Array

Defined in near.ts:1143

Hash given data. Returns hash as 32-byte array.

Type parameters:

T

Parameters:

Name Type Description
data T data can be passed as either Uint8Array or anything with .toString (hashed as UTF-8 string).

Returns: Uint8Array


hash32

hash32<T>(data: T): u32

Defined in near.ts:1158

Hash given data. Returns hash as 32-bit integer.

Type parameters:

T

Parameters:

Name Type Description
data T data can be passed as either Uint8Array or anything with .toString (hashed as UTF-8 string).

Returns: u32


log

log(msg: string): void

Defined in near.ts:1184

Parameters:

Name Type
msg string

Returns: void


parseFromBytes

parseFromBytes<T>(bytes: Uint8Array, defaultValue?: T): T

Defined in near.ts:1103

Parses the given bytes array to return a value of the given generic type. Supported types: bool, integer, string and data objects defined in model.ts.

Type parameters:

T

Parameters:

Name Type Default value Description
bytes Uint8Array - Bytes to parse.
Default value defaultValue T null The default value if the bytes are null

Returns: T A parsed value of type T.


parseFromString

parseFromString<T>(s: string, defaultValue?: T): T

Defined in near.ts:1075

Parses the given string to return a value of the given generic type. Supported types: bool, integer, string and data objects defined in model.ts.

Type parameters:

T

Parameters:

Name Type Default value Description
s string - String to parse.
Default value defaultValue T null The default value if the string is null

Returns: T A parsed value of type T.


random32

random32(): u32

Defined in near.ts:1180

Returns random 32-bit integer.

Returns: u32


randomBuffer

randomBuffer(len: u32): Uint8Array

Defined in near.ts:1171

Returns random byte buffer of given length.

Parameters:

Name Type
len u32

Returns: Uint8Array


str

str<T>(value: T): string

Defined in near.ts:1188

Type parameters:

T

Parameters:

Name Type
value T

Returns: string


stringToBytes

stringToBytes(s: string): Uint8Array

Defined in near.ts:1119

Parameters:

Name Type
s string

Returns: Uint8Array


You can’t perform that action at this time.