Interface: CairoType
Defined in: src/utils/cairoDataTypes/cairoType.interface.ts:19
What the Cairo data type classes have in common: each one turns itself into the felts a contract call carries.
This is an interface rather than a base class on purpose. TypeScript matches it structurally,
so every class in this directory already satisfies it without declaring anything — a base class
would have had to be added to each of them, and any class that forgot would not have raised :
an instanceof check would simply have answered false and sent the value down the wrong branch.
The composite types are what this exists for : an array, a tuple or a struct holds elements of types it does not know, and only ever needs to ask each of them for its felts.
Example
const elements: CairoType[] = [new CairoUint8(1), new CairoFelt252('Hello')];
const felts = elements.flatMap((element) => element.toApiRequest());
// felts = ["1", "310939249775"]
Methods
toApiRequest()
toApiRequest():
string[]
Defined in: src/utils/cairoDataTypes/cairoType.interface.ts:23
Serialize to the felts a contract call carries, as decimal strings.
Returns
string[]