Skip to content

Commit

Permalink
fix: aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
nitinmittal23 committed Sep 11, 2024
1 parent fc59a65 commit 71bccf5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions internal/coder/abi_coder.ts
Original file line number Diff line number Diff line change
@@ -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";

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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 };
}

/**
Expand All @@ -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));
}
}
18 changes: 9 additions & 9 deletions tests/coder/abi_coder.test.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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",
Expand All @@ -24,7 +24,7 @@ describe("abi_coder", () => {

test("decodeParameters", () => {
//@ts-ignore
decodeMultipleParams.mockReturnValueOnce(["mocked_result"])
decodeParameters.mockReturnValueOnce(["mocked_result"])
expect(
ABICoder.decodeParameters(
["mocked_type"],
Expand All @@ -35,7 +35,7 @@ describe("abi_coder", () => {

test("encodeParameters", () => {
//@ts-ignore
encodeMultipleParams.mockReturnValueOnce("mocked_result")
encodeParameters.mockReturnValueOnce("mocked_result")
expect(
ABICoder.encodeParameters(
["mocked_type"],
Expand All @@ -46,7 +46,7 @@ describe("abi_coder", () => {

test("decodeLog", () => {
//@ts-ignore
decodeSingleLog.mockReturnValueOnce(["mocked_result"])
decodeLog.mockReturnValueOnce(["mocked_result"])
expect(
ABICoder.decodeLog(
["mocked_input"],
Expand All @@ -58,7 +58,7 @@ describe("abi_coder", () => {

test("decodeMethod", () => {
//@ts-ignore
decodeMultipleParams.mockReturnValueOnce(["mocked_result"])
decodeParameters.mockReturnValueOnce(["mocked_result"])
expect(
ABICoder.decodeMethod(
['bytes'],
Expand Down

0 comments on commit 71bccf5

Please sign in to comment.