Skip to content
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

wrapped vm output api response #2287

Merged
merged 2 commits into from
Sep 15, 2020
Merged

Conversation

bogdan-rosianu
Copy link
Contributor

created a wrapped structure which will be returned when calling a vm-values endpoint. Now it will display addresses in bech32 format when needed and added custom json tags (with lowercase)

Testing procedure:

  • run a testnet
  • make a POST request to vm-values/query for example and the output should follow json format and not having unreadable characters

@bogdan-rosianu bogdan-rosianu added the type:feature New feature or request label Sep 14, 2020
@bogdan-rosianu bogdan-rosianu self-assigned this Sep 14, 2020
}

// GetFirstReturnData is a helper function that returns the first ReturnData of VMOutput, interpreted as specified.
func (vmOutput *VMOutputApi) GetFirstReturnData(asType vmcommon.ReturnDataKind) (interface{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added unit tests for all cases (as big int, as big int string, as hex and as string)

func (nf *nodeFacade) convertVmOutputToApiResponse(input *vmcommon.VMOutput) *vm.VMOutputApi {
outputAccounts := make(map[string]*vm.OutputAccountApi)
for key, acc := range input.OutputAccounts {
outPutAddress, err := nf.node.EncodeAddressPubkey(acc.Address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outputAddress*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System tests passed.

@LucianMincu LucianMincu merged commit 9dd5a20 into development Sep 15, 2020
@LucianMincu LucianMincu deleted the wrapped-vm-output-api-response branch September 15, 2020 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants