From b26f0f522b2b704ec2888098ea1a9f53da3cf200 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Thu, 22 Jun 2023 19:28:12 +0100 Subject: [PATCH] missed a couple return types --- .../src/codegen/render-solidity/renderEnums.ts | 2 +- .../src/codegen/render-solidity/renderTypeHelpers.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/common/src/codegen/render-solidity/renderEnums.ts b/packages/common/src/codegen/render-solidity/renderEnums.ts index a666ce6586..acf62e15b8 100644 --- a/packages/common/src/codegen/render-solidity/renderEnums.ts +++ b/packages/common/src/codegen/render-solidity/renderEnums.ts @@ -1,7 +1,7 @@ import { renderArguments, renderList, renderedSolidityHeader } from "./common"; import { RenderEnum } from "./types"; -export function renderEnums(enums: RenderEnum[]) { +export function renderEnums(enums: RenderEnum[]): string { let result = renderedSolidityHeader; result += renderList( diff --git a/packages/common/src/codegen/render-solidity/renderTypeHelpers.ts b/packages/common/src/codegen/render-solidity/renderTypeHelpers.ts index 125bf81bc0..c44d246ea8 100644 --- a/packages/common/src/codegen/render-solidity/renderTypeHelpers.ts +++ b/packages/common/src/codegen/render-solidity/renderTypeHelpers.ts @@ -1,6 +1,6 @@ import { RenderField, RenderKeyTuple, RenderType } from "./types"; -export function renderTypeHelpers(options: { fields: RenderField[]; keyTuple: RenderKeyTuple[] }) { +export function renderTypeHelpers(options: { fields: RenderField[]; keyTuple: RenderKeyTuple[] }): string { const { fields, keyTuple } = options; let result = ""; @@ -32,9 +32,9 @@ export function renderTypeHelpers(options: { fields: RenderField[]; keyTuple: Re return result; } -function getWrappingHelpers(array: RenderType[]) { - const wrappers = new Map(); - const unwrappers = new Map(); +function getWrappingHelpers(array: RenderType[]): string[] { + const wrappers = new Map(); + const unwrappers = new Map(); for (const { typeWrappingData, typeWrap, typeUnwrap, internalTypeId } of array) { if (!typeWrappingData) continue; const { kind } = typeWrappingData; @@ -54,7 +54,7 @@ function renderWrapperStaticArray( elementType: string, staticLength: number, internalTypeId: string -) { +): string { // WARNING: ensure this still works if changing major solidity versions! // (the memory layout for static arrays may change) return ` @@ -76,7 +76,7 @@ function renderUnwrapperStaticArray( elementType: string, staticLength: number, internalTypeId: string -) { +): string { // byte length for memory copying (more efficient than a loop) const byteLength = staticLength * 32; // TODO to optimize memory usage consider generalizing TightEncoder to a render-time utility