Function: encodeType()
encodeType(
types,type,revision?):string
Defined in: src/utils/typedData.ts:245
Encode a type to a string. All dependent types are alphabetically sorted.
Parameters
types
Record<string, StarknetType[]>
The types object containing all defined types.
type
string
The name of the type to encode.
revision?
TypedDataRevision = Revision.LEGACY
The revision of the TypedData.
Returns
string
The encoded string.
Example
import typedDataExample from '../../__mocks__/typedData/baseExample.json';
const result = encodeType(typedDataExample.types, 'Mail');
// result = "Mail(from:Person,to:Person,contents:felt)Person(name:felt,wallet:felt)";