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

Use custom JSON marshal instead of object duplication #54

Open
cubismic opened this issue Dec 30, 2019 · 2 comments
Open

Use custom JSON marshal instead of object duplication #54

cubismic opened this issue Dec 30, 2019 · 2 comments

Comments

@cubismic
Copy link
Member

cubismic commented Dec 30, 2019

Currently, some of the Transaction-related objects have two forms, which implement normal type and for marshaling.

type SignedTransactionJSON struct {
BlockNumber int `json:"blockNumber,omitempty"`
BlockHash string `json:"blockHash,omitempty"`
TransactionIndex int `json:"transactionIndex,omitempty"`
Sig string `json:"sig"`
Hash string `json:"hash"`
}

type SignedTransaction struct {
Unsigned TransactionInterface
BlockNumber *int
BlockHash *primitives.H256
TransactionIndex *int
signature []byte
}

This implementation is from codechain-sdk-js.
But since golang can implement custom marshaling function (link1) (link2), I think duplication of the objects is unnecessary.

@cubismic
Copy link
Member Author

This is related to #53

@cubismic
Copy link
Member Author

#63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant