Skip to content

Commit

Permalink
Fix handling of single params in reads (#24)
Browse files Browse the repository at this point in the history
* Fix handling of single params in reads

* Add changeset and patch
  • Loading branch information
ryangoree authored Feb 13, 2024
1 parent 4ba6440 commit a2edb5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thirty-birds-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@delvtech/evm-client": patch
---

Fix handling of single params
5 changes: 5 additions & 0 deletions packages/evm-client/src/contract/utils/friendlyToArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : {};

Expand Down

0 comments on commit a2edb5a

Please sign in to comment.