From a2edb5a501e8f0c67bcf6f75a32b747796a2b30b Mon Sep 17 00:00:00 2001 From: Ryan Goree <goree.ryan@gmail.com> Date: Tue, 13 Feb 2024 17:33:21 -0600 Subject: [PATCH] Fix handling of single params in reads (#24) * Fix handling of single params in reads * Add changeset and patch --- .changeset/thirty-birds-look.md | 5 +++++ packages/evm-client/src/contract/utils/friendlyToArray.ts | 5 +++++ 2 files changed, 10 insertions(+) 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 0000000..e24136e --- /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 c304db8..efc2db7 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<TAbi, TItemType, TName, TParameterKind>; } + // Single parameters + if (parameters.length === 1) { + return [value] as AbiArrayType<TAbi, TItemType, TName, TParameterKind>; + } + const valueObject: Record<string, unknown> = !!value && typeof value === 'object' ? value : {};