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

added new api to get all issued esdts #2951

Merged
merged 4 commits into from
Apr 1, 2021

Conversation

sasurobert
Copy link
Contributor

added new api to get all issued esdts

@miiu96 miiu96 self-requested a review March 31, 2021 17:49
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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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 ?

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

return nil, ErrAccountNotFound
}

account, err := n.accounts.GetExistingAccount(vm.ESDTSCAddress)
Copy link
Contributor

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'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. will do.

@SebastianMarian SebastianMarian self-requested a review March 31, 2021 21:57
{ Name = "/config", Open = true },

# /network/esdts will return all the issued esdts on the protocol
{ Name = "/esdts", Open = true },
Copy link
Contributor

Choose a reason for hiding this comment

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

remove trailing ,

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

@@ -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
Copy link
Contributor

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

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


for leaf := range chLeaves {
key := string(leaf.Key())
if strings.Contains(key, "-") {
Copy link
Contributor

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 -

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is enough

@@ -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
Copy link
Contributor

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

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


for leaf := range chLeaves {
key := string(leaf.Key())
if strings.Contains(key, "-") {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is ok.

@bogdan-rosianu bogdan-rosianu merged commit acf26ca into feat/eip-esdt-local-mint Apr 1, 2021
@bogdan-rosianu bogdan-rosianu deleted the get-all-issued-esdts branch April 1, 2021 08:59
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

Successfully merging this pull request may close these issues.

None yet

4 participants