| 11 | }; |
| 12 | |
| 13 | function buildSchemaHeader(types: ParameterType[]): string { |
| 14 | const allShortTypes = Object.keys(PARAMETER_SHORT_TYPES); |
| 15 | |
| 16 | // Shorten all selected types with the corresponding "short" type |
| 17 | // i.e. 'address' types get set as simply 'a' and 'bytes32' becomes |
| 18 | // simply 'b' etc |
| 19 | const selectedShortTypes = types.reduce((acc: string[], type) => { |
| 20 | const shortType = allShortTypes.find((st) => PARAMETER_SHORT_TYPES[st as ParameterTypeShort] === type); |
| 21 | return [...acc, shortType!]; |
| 22 | }, []); |
| 23 | |
| 24 | return `${VERSION}${selectedShortTypes.join('')}`; |
| 25 | } |
| 26 | |
| 27 | function buildNameValuePairs(parameters: InputParameter[]): unknown[] { |
| 28 | return flatMap(parameters, (parameter) => { |