From 71bccf5440c328ffe59129f759d369ff43284d88 Mon Sep 17 00:00:00 2001 From: Nitin Mittal Date: Thu, 12 Sep 2024 01:59:38 +0900 Subject: [PATCH] fix: aliases --- internal/coder/abi_coder.ts | 18 +++++++++--------- tests/coder/abi_coder.test.ts | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/coder/abi_coder.ts b/internal/coder/abi_coder.ts index 556776b..261cdfa 100644 --- a/internal/coder/abi_coder.ts +++ b/internal/coder/abi_coder.ts @@ -1,8 +1,8 @@ import { - decodeParameter as decodeSingleParam, - decodeParameters as decodeMultipleParams, - decodeLog as decodeSingleLog, - encodeParameters as encodeMultipleParams + decodeParameter, + decodeParameters, + decodeLog, + encodeParameters } from "web3-eth-abi"; /** @@ -16,7 +16,7 @@ export class ABICoder { * @returns {any} - Can return arrays, numbers, objects, etc. depends on the RLP type */ public static decodeParameter(type: any, hex: string): any { - return decodeSingleParam(type, hex); + return decodeParameter(type, hex); } /** @@ -26,7 +26,7 @@ export class ABICoder { * @returns {any} - Can return an object of arrays, numbers, objects, etc. depends on the RLP type */ public static decodeParameters(types: any[], hex: string): { [key: string]: any } { - return decodeMultipleParams(types, hex); + return decodeParameters(types, hex); } /** @@ -36,7 +36,7 @@ export class ABICoder { * @returns {any} - return hex string */ public static encodeParameters(types: any[], values: string[]): string { - return encodeMultipleParams(types, values); + return encodeParameters(types, values); } /** @@ -49,7 +49,7 @@ export class ABICoder { * @returns */ public static decodeLog(inputs: any[], hex: string, topics: string[]): { [key: string]: string } { - return decodeSingleLog(inputs, hex, topics) as unknown as { [key: string]: string }; + return decodeLog(inputs, hex, topics) as unknown as { [key: string]: string }; } /** @@ -61,6 +61,6 @@ export class ABICoder { * @returns {{ [key: string]: any }} */ public static decodeMethod(types: any[], data: string): { [key: string]: any } { - return decodeMultipleParams(types, "0x" + data.slice(10)); + return decodeParameters(types, "0x" + data.slice(10)); } } diff --git a/tests/coder/abi_coder.test.ts b/tests/coder/abi_coder.test.ts index 8670a22..f5deaa5 100644 --- a/tests/coder/abi_coder.test.ts +++ b/tests/coder/abi_coder.test.ts @@ -1,9 +1,9 @@ import { ABICoder } from "../../dist/internal/coder/abi_coder"; import { - decodeParameter as decodeSingleParam, - decodeParameters as decodeMultipleParams, - decodeLog as decodeSingleLog, - encodeParameters as encodeMultipleParams + decodeParameter, + decodeParameters, + decodeLog, + encodeParameters } from "web3-eth-abi"; jest.mock("web3-eth-abi"); @@ -13,7 +13,7 @@ describe("abi_coder", () => { describe("ABICoder", () => { test("decodeParameter", () => { //@ts-ignore - decodeSingleParam.mockReturnValueOnce("mocked_result") + decodeParameter.mockReturnValueOnce("mocked_result") expect( ABICoder.decodeParameter( "mocked_type", @@ -24,7 +24,7 @@ describe("abi_coder", () => { test("decodeParameters", () => { //@ts-ignore - decodeMultipleParams.mockReturnValueOnce(["mocked_result"]) + decodeParameters.mockReturnValueOnce(["mocked_result"]) expect( ABICoder.decodeParameters( ["mocked_type"], @@ -35,7 +35,7 @@ describe("abi_coder", () => { test("encodeParameters", () => { //@ts-ignore - encodeMultipleParams.mockReturnValueOnce("mocked_result") + encodeParameters.mockReturnValueOnce("mocked_result") expect( ABICoder.encodeParameters( ["mocked_type"], @@ -46,7 +46,7 @@ describe("abi_coder", () => { test("decodeLog", () => { //@ts-ignore - decodeSingleLog.mockReturnValueOnce(["mocked_result"]) + decodeLog.mockReturnValueOnce(["mocked_result"]) expect( ABICoder.decodeLog( ["mocked_input"], @@ -58,7 +58,7 @@ describe("abi_coder", () => { test("decodeMethod", () => { //@ts-ignore - decodeMultipleParams.mockReturnValueOnce(["mocked_result"]) + decodeParameters.mockReturnValueOnce(["mocked_result"]) expect( ABICoder.decodeMethod( ['bytes'],