neow3j icon indicating copy to clipboard operation
neow3j copied to clipboard

Convert from StackItem to ContractParameter and/or vice-versa

Open gsmachado opened this issue 2 years ago • 3 comments

Summary or problem description

In a given use case (GrantShares) we need to compare StackItems (coming from a smart contract) to ContractParameters. This is a cumbersome thing to accomplish, given the types and incompatibility of objects.

Do you have any solution you want to propose?

Maybe, we could add methods like .toStackItem() or .toContractParameter(). However, we need to better analyze what's the best design.

What part of neow3j does this apply to?

  • SDK

gsmachado avatar May 31 '22 12:05 gsmachado

Instead of implementing mapping methods, i think we should rather have something like contractParam.compareTo(StackItem item). Such a method should do value comparison and provide some flexibility regarding the compared types.

csmuller avatar Jun 03 '22 10:06 csmuller

I will review the current implementation in context of this issue.

csmuller avatar Jun 03 '22 12:06 csmuller

I will review the current implementation in context of this issue.

I will keep this comment for posterity.

gsmachado avatar Feb 08 '24 13:02 gsmachado