Skip to main content
Version: Next

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:110


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:124


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:132


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:180


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:212


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:223