-
Notifications
You must be signed in to change notification settings - Fork 77
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
cli: implement NEP5-related commands #728
Conversation
Codecov Report
@@ Coverage Diff @@
## master #728 +/- ##
=========================================
- Coverage 66.68% 66.3% -0.38%
=========================================
Files 136 138 +2
Lines 12269 12381 +112
=========================================
+ Hits 8181 8209 +28
- Misses 3692 3775 +83
- Partials 396 397 +1
Continue to review full report at Codecov.
|
pkg/wallet/token.go
Outdated
func (t *Token) MarshalJSON() ([]byte, error) { | ||
m := &tokenAux{ | ||
Name: t.Name, | ||
Hash: t.Hash.Reverse(), // address should be marshaled in LE but here it is marshaled in LE |
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.
What?
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.
tokenAux
will be marshalled with the default JSON marshaler, which uses BE
.
Token address is used as LE everywhere so it is better to store it the same way.
@@ -28,7 +28,7 @@ type Wallet struct { | |||
|
|||
// Extra metadata can be used for storing arbitrary data. | |||
// This field can be empty. | |||
Extra interface{} `json:"extra"` | |||
Extra Extra `json:"extra"` |
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.
I'm not sure about this. It obviously is more effective storing these values, but at the same time it makes us update the wallet for every NEP5 token and may affect interoperability.
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.
It is fully compliant with NEP-6 standard.
It's size is used in NEP5TransferLog so we need to be sure it reflects reality.
When working with NEP5 contracts we frequently need to parse fixed-point decimals with arbitrary precision.
It can be useful to receive all NEP5 token info at once.
To work with NEP5 tokens, one need to save some info e.g. token Name. This way we will not make additional RPC just to get Decimals.
getclaimable RPC expects address as a 1-st argument.
Closes #709 .