Skip to main content
Version: 11.x

Variable: fastCairoTypeStrategy

const fastCairoTypeStrategy: CairoTypeStrategy

Defined in: src/utils/calldata/parser/cairoTypeStrategy.ts:324

A faster strategy, opt-in through the second argument of new CallData(abi, strategy).

It buys that speed by not going through the class of the declared type for the eight leaves above, which costs one thing the caller should weigh : an out-of-range u8u128, a non-boolean bool or an over-wide EthAddress is serialized rather than refused, and read back rather than refused, since one constructor serves both directions.

Unlike the fastParsingStrategy it replaces, it does not give up reading a signed integer back as a negative number : that is a conversion, not a check, and the shared constructor makes it the same in both strategies.

Example

const felts = fastCairoTypeStrategy.constructors['core::integer::u8'](300, fastCairoTypeStrategy)
.toApiRequest();
// felts = ["300"] which cairoTypeStrategy would refuse