You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
now the dynamic array's encoding logic is to encode every item, then concat the hex string follow the length encoded hex.:
publicfunc abiEncodeDynamic()->String?{// get valuesletvalues=self.compactMap{ value ->String?inreturn value.abiEncode(dynamic: true)}// number of elements in the array, padded leftletlength=String(values.count, radix:16).paddingLeft(toLength:64, withPad:"0")// values, joined with no separatorreturn length + values.joined()}
now the dynamic array's encoding logic is to encode every item, then concat the hex string follow the length encoded hex.:
but follw the document: https://docs.soliditylang.org/en/v0.8.13/abi-spec.html#formal-specification-of-the-encoding
it seems that the dynamic array's encoded data should have extra bytes between length hex and item's hex, to represent the dynamic item's data location.
for example:
I want to encode a dynamic array of 4 datas:
the testData now is this:
it seems should add the extra bytes like this:
I was trying to send a eth_call with dynamic array's encoded data but got error. after add the extra bytes. the call is success.
is there any wrong usage of me or any missunderstanding?
The text was updated successfully, but these errors were encountered: