Skip to main content
Version: 5.19.5

Namespace: typedData

References​

StarkNetMerkleType​

Re-exports StarkNetMerkleType


StarkNetType​

Re-exports StarkNetType


StarkNetDomain​

Re-exports StarkNetDomain


TypedData​

Re-exports TypedData

Functions​

prepareSelector​

â–¸ prepareSelector(selector): string

Parameters​

NameType
selectorstring

Returns​

string

Defined in​

src/utils/typedData.ts:36


isMerkleTreeType​

â–¸ isMerkleTreeType(type): type is StarkNetMerkleType

Parameters​

NameType
typeStarkNetType

Returns​

type is StarkNetMerkleType

Defined in​

src/utils/typedData.ts:40


getDependencies​

â–¸ getDependencies(types, type, dependencies?): string[]

Get the dependencies of a struct type. If a struct has the same dependency multiple times, it's only included once in the resulting array.

Parameters​

NameTypeDefault value
typesRecord<string, StarkNetType[]>undefined
typestringundefined
dependencies?string[][]

Returns​

string[]

Defined in​

src/utils/typedData.ts:58


encodeType​

â–¸ encodeType(types, type): string

Encode a type to a string. All dependent types are alphabetically sorted.

Parameters​

NameType
typesRecord<string, StarkNetType[]>
typestring

Returns​

string

Defined in​

src/utils/typedData.ts:114


getTypeHash​

â–¸ getTypeHash(types, type): string

Get a type string as hash.

Parameters​

NameType
typesRecord<string, StarkNetType[]>
typestring

Returns​

string

Defined in​

src/utils/typedData.ts:132


encodeValue​

â–¸ encodeValue(types, type, data, ctx?): [string, string]

Encodes a single value to an ABI serialisable string, number or Buffer. Returns the data as tuple, which consists of an array of ABI compatible types, and an array of corresponding values.

Parameters​

NameType
typesRecord<string, StarkNetType[]>
typestring
dataunknown
ctxContext

Returns​

[string, string]

Defined in​

src/utils/typedData.ts:145


encodeData​

â–¸ encodeData<T>(types, type, data): string[][]

Encode the data to an ABI encoded Buffer. The data should be a key -> value object with all the required values. All dependent types are automatically encoded.

Type parameters​

NameType
Textends TypedData

Parameters​

NameType
typesT["types"]
typestring
dataT["message"]

Returns​

string[][]

Defined in​

src/utils/typedData.ts:197


getStructHash​

â–¸ getStructHash<T>(types, type, data): string

Get encoded data as a hash. The data should be a key -> value object with all the required values. All dependent types are automatically encoded.

Type parameters​

NameType
Textends TypedData

Parameters​

NameType
typesT["types"]
typestring
dataT["message"]

Returns​

string

Defined in​

src/utils/typedData.ts:234


getMessageHash​

â–¸ getMessageHash(typedData, account): string

Get the EIP-191 encoded message to sign, from the typedData object.

Parameters​

NameType
typedDataTypedData
accountBigNumberish

Returns​

string

Defined in​

src/utils/typedData.ts:249