Skip to main content
Version: 11.x

Function: createAbiParser()

createAbiParser(abi, parsingStrategy?): AbiParserInterface

Defined in: src/utils/calldata/parser/index.ts:51

Create the parser of an abi. It is chosen from the format of the abi (getAbiVersion), not from the version of Cairo.

A Cairo 0 abi gets its own parser, kept apart from the Cairo 1 ones so that those can move to the Cairo type classes without dragging along types — felt, felt* — that no class registers.

Parameters​

abi​

Abi

parsingStrategy?​

CairoTypeStrategy | ParsingStrategy

Returns​

AbiParserInterface

abi parser interface

Example​

const abiParser2 = createAbiParser([getInterfaceAbi('struct')]);
// abiParser2 instanceof AbiParser2 === true

const abiParser1 = createAbiParser([getFunctionAbi('struct')]);
// abiParser1 instanceof AbiParser1 === true

const abiParser0 = createAbiParser([getFunctionAbi('felt')]);
// abiParser0 instanceof AbiParser0 === true