-
Notifications
You must be signed in to change notification settings - Fork 198
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
added new api to get all issued esdts #2951
Conversation
node/node.go
Outdated
// GetAllIssuedESDTs returns all the issued esdt tokens, works if not is on metachain | ||
func (n *Node) GetAllIssuedESDTs() ([]string, error) { | ||
if n.shardCoordinator.SelfId() != core.MetachainShardId { | ||
return nil, ErrAccountNotFound |
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 you return another error because is not so intuitive for the user if gets this error.
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.
deleted as not used
node/node.go
Outdated
@@ -444,6 +445,48 @@ func (n *Node) GetUsername(address string) (string, error) { | |||
return string(username), nil | |||
} | |||
|
|||
// GetAllIssuedESDTs returns all the issued esdt tokens, works if not is on metachain |
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.
works only on the metachain node ?
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.
done
return nil, ErrAccountNotFound | ||
} | ||
|
||
account, err := n.accounts.GetExistingAccount(vm.ESDTSCAddress) |
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.
please add a todo here to modify this implementation with the modifications from this branch 'fix-network-economics'
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.
yes. will do.
cmd/node/config/api.toml
Outdated
{ Name = "/config", Open = true }, | ||
|
||
# /network/esdts will return all the issued esdts on the protocol | ||
{ Name = "/esdts", Open = true }, |
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.
remove trailing ,
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.
done
facade/nodeFacade.go
Outdated
@@ -287,6 +287,11 @@ func (nf *nodeFacade) GetAllESDTTokens(address string) (map[string]*esdt.ESDigit | |||
return nf.node.GetAllESDTTokens(address) | |||
} | |||
|
|||
// GetAllIssuedESDTs returns all the issued esdts for a given address |
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.
// GetAllIssuedESDTs returns all the issued esdts from the esdt system smart contract
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.
done
|
||
for leaf := range chLeaves { | ||
key := string(leaf.Key()) | ||
if strings.Contains(key, "-") { |
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.
is this enough? we have to make sure no other key would contain -
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.
this is enough
facade/nodeFacade.go
Outdated
@@ -287,6 +287,11 @@ func (nf *nodeFacade) GetAllESDTTokens(address string) (map[string]*esdt.ESDigit | |||
return nf.node.GetAllESDTTokens(address) | |||
} | |||
|
|||
// GetAllIssuedESDTs returns all the issued esdts for a given address |
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 not for a given address, refactor the comment
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.
done
|
||
for leaf := range chLeaves { | ||
key := string(leaf.Key()) | ||
if strings.Contains(key, "-") { |
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.
So "-" should be reserved only for esdt as a symbol used in the key
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.
this is ok.
added new api to get all issued esdts