@@ -3,10 +3,12 @@ import { normalizeString } from '@fuel-ts/utils';
33
44import type { ProgramTypeEnum } from '../types/enums/ProgramTypeEnum' ;
55import type { IConfigurable } from '../types/interfaces/IConfigurable' ;
6+ import type { IErrorCode } from '../types/interfaces/IErrorCode' ;
67import type { IFunction } from '../types/interfaces/IFunction' ;
78import type { IType } from '../types/interfaces/IType' ;
89import type { JsonAbiOld } from '../types/interfaces/JsonAbi' ;
910import type { JsonAbi } from '../types/interfaces/JsonAbiNew' ;
11+ import { parseErrorCodes } from '../utils/parseErrorCodes' ;
1012import { parseFunctions } from '../utils/parseFunctions' ;
1113import { parseTypes } from '../utils/parseTypes' ;
1214import { transpileAbi } from '../utils/transpile-abi' ;
@@ -33,6 +35,7 @@ export class Abi {
3335 public types : IType [ ] ;
3436 public functions : IFunction [ ] ;
3537 public configurables : IConfigurable [ ] ;
38+ public errorCodes ?: IErrorCode [ ] ;
3639
3740 constructor ( params : {
3841 filepath : string ;
@@ -73,11 +76,12 @@ export class Abi {
7376 this . storageSlotsContents = storageSlotsContents ;
7477 this . outputDir = outputDir ;
7578
76- const { types, functions, configurables } = this . parse ( ) ;
79+ const { types, functions, configurables, errorCodes } = this . parse ( ) ;
7780
7881 this . types = types ;
7982 this . functions = functions ;
8083 this . configurables = configurables ;
84+ this . errorCodes = errorCodes ;
8185
8286 this . computeCommonTypesInUse ( ) ;
8387 }
@@ -88,18 +92,21 @@ export class Abi {
8892 types : rawAbiTypes ,
8993 functions : rawAbiFunctions ,
9094 configurables : rawAbiConfigurables ,
95+ errorCodes : rawErrorCodes ,
9196 } = transpiled ;
9297
9398 const types = parseTypes ( { rawAbiTypes } ) ;
9499 const functions = parseFunctions ( { rawAbiFunctions, types } ) ;
95100 const configurables = rawAbiConfigurables . map (
96101 ( rawAbiConfigurable ) => new Configurable ( { types, rawAbiConfigurable } )
97102 ) ;
103+ const errorCodes = parseErrorCodes ( { rawErrorCodes, types } ) ;
98104
99105 return {
100106 types,
101107 functions,
102108 configurables,
109+ errorCodes,
103110 } ;
104111 }
105112
0 commit comments