From 1ce3087140d9f8c7256d08a0113fc7fea8726d63 Mon Sep 17 00:00:00 2001 From: Ryan Goree Date: Tue, 13 Feb 2024 17:30:20 -0600 Subject: [PATCH 1/2] Fix handling of single params in reads --- packages/evm-client/src/contract/utils/friendlyToArray.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/evm-client/src/contract/utils/friendlyToArray.ts b/packages/evm-client/src/contract/utils/friendlyToArray.ts index c304db8a..cf916e23 100644 --- a/packages/evm-client/src/contract/utils/friendlyToArray.ts +++ b/packages/evm-client/src/contract/utils/friendlyToArray.ts @@ -81,6 +81,11 @@ export function friendlyToArray< return [] as AbiArrayType; } + // Single parameters + if (parameters.length) { + return [value] as AbiArrayType; + } + const valueObject: Record = !!value && typeof value === 'object' ? value : {}; From 15cdac4d056223d6588295959723c55570591184 Mon Sep 17 00:00:00 2001 From: Ryan Goree Date: Tue, 13 Feb 2024 17:32:30 -0600 Subject: [PATCH 2/2] Add changeset and patch --- .changeset/thirty-birds-look.md | 5 +++++ packages/evm-client/src/contract/utils/friendlyToArray.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/thirty-birds-look.md diff --git a/.changeset/thirty-birds-look.md b/.changeset/thirty-birds-look.md new file mode 100644 index 00000000..e24136ee --- /dev/null +++ b/.changeset/thirty-birds-look.md @@ -0,0 +1,5 @@ +--- +"@delvtech/evm-client": patch +--- + +Fix handling of single params diff --git a/packages/evm-client/src/contract/utils/friendlyToArray.ts b/packages/evm-client/src/contract/utils/friendlyToArray.ts index cf916e23..efc2db71 100644 --- a/packages/evm-client/src/contract/utils/friendlyToArray.ts +++ b/packages/evm-client/src/contract/utils/friendlyToArray.ts @@ -82,7 +82,7 @@ export function friendlyToArray< } // Single parameters - if (parameters.length) { + if (parameters.length === 1) { return [value] as AbiArrayType; }