Skip to content

Commit

Permalink
add NonFungibleESDTv2 to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
BeniaminDrasovean committed Nov 1, 2023
1 parent e7c4fba commit 1133dc5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ const (
Fungible ESDTType = iota
// NonFungible defines the token type for ESDT non fungible tokens
NonFungible
// NonFungibleV2 defines the token type for ESDT non fungible tokens
NonFungibleV2
// Meta defines the token type for ESDT meta tokens
Meta
)

// FungibleESDT defines the string for the token type of fungible ESDT
Expand All @@ -175,6 +179,12 @@ const FungibleESDT = "FungibleESDT"
// NonFungibleESDT defines the string for the token type of non fungible ESDT
const NonFungibleESDT = "NonFungibleESDT"

// NonFungibleESDTv2 defines the string for the token type of non fungible ESDT
const NonFungibleESDTv2 = "NonFungibleESDTv2"

// MetaESDT defines the string for the token type of meta ESDT
const MetaESDT = "MetaESDT"

// SemiFungibleESDT defines the string for the token type of semi fungible ESDT
const SemiFungibleESDT = "SemiFungibleESDT"

Expand Down
16 changes: 16 additions & 0 deletions core/converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,19 @@ func ConvertToEvenHexBigInt(value *big.Int) string {

return str
}

// ConvertESDTTypeToUint32 converts the esdt type to uint32
func ConvertESDTTypeToUint32(esdtType string) (uint32, error) {
switch esdtType {
case FungibleESDT:
return uint32(Fungible), nil
case NonFungibleESDT:
return uint32(NonFungible), nil
case NonFungibleESDTv2:
return uint32(NonFungibleV2), nil
case MetaESDT:
return uint32(Meta), nil
default:
return math.MaxUint32, fmt.Errorf("invalid esdt type: %s", esdtType)
}
}

0 comments on commit 1133dc5

Please sign in to comment.