-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move structs from "valuesMulti" and "valuesSingle". Merge input & output #13
Conversation
if i != len(outputValues)-1 { | ||
return errors.New("variadic values must be last among output values") | ||
} | ||
|
||
err = s.deserializeVariadicValues(partsHolder, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was dropped by mistake within this series of PRs.
https://github.com/multiversx/mx-sdk-abi-go/blob/main/abi/serializer.go#L147
package abi | ||
|
||
// Field is a field in a struct, enum etc. | ||
type Field struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was moved from valuesSingle
to its own file.
Most other structs from valuesSingle
were moved to their own files (addressValue
, boolValue
etc.) in previous PRs. Small integers follow in the next PR.
abi/serializer.go
Outdated
if value.Value == nil { | ||
return nil | ||
} | ||
|
||
return s.doSerialize(partsHolder, []any{value.Value}) | ||
} | ||
|
||
func (s *serializer) serializeInputMultiValue(partsHolder *partsHolder, value InputMultiValue) error { | ||
func (s *serializer) serializeMultiValue(partsHolder *partsHolder, value *MultiValue) error { | ||
for _, item := range value.Items { | ||
err := s.doSerialize(partsHolder, []any{item}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you do return s.doSerialize(partsHolder, value.Items)
maybe? Same comment for the other funcs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point! Refactored.
Tests are passing in the "staging" branch: #8.
This is a PR from a series of many.
No logic change, only refactoring.
See: #5.