func (t *TokenAmount) ToRosetta() *types.Amount {
	amount := types.Amount{
		Value: strconv.FormatInt(t.Value, 10),
		Currency: &types.Currency{
			Symbol:   t.TokenId.String(),
			Decimals: int32(t.Decimals),
			Metadata: map[string]interface{}{MetadataKeyType: t.Type},
		},
	}
	if t.Type == domain.TokenTypeNonFungibleUnique {
		metadata := make(map[string]interface{})
		if len(t.SerialNumbers) > 0 {
			serialNumbers := make([]string, 0, len(t.SerialNumbers))
			for _, serialNumber := range t.SerialNumbers {
				serialNumbers = append(serialNumbers, strconv.FormatInt(serialNumber, 10))
			}
			metadata[MetadataKeySerialNumbers] = serialNumbers
		}

		if len(t.Metadatas) > 0 {
			nftMetadatas := make([]string, 0, len(t.Metadatas))
			for _, nftMetadata := range t.Metadatas {
				nftMetadatas = append(nftMetadatas, base64.StdEncoding.EncodeToString(nftMetadata))
			}
			metadata[MetadataKeyMetadatas] = nftMetadatas
		}

		amount.Metadata = metadata
	}

	return &amount
}
// ToRosetta returns Rosetta type Amount with the token's currency
ToRosetta returns Rosetta type Amount with the token's currency
// ToRosetta returns Rosetta type Amount with the token ' s currency
func (t *TokenAmount) ToRosetta() *types.Amount {
	amount := types.Amount{
		Value: strconv.FormatInt(t.Value, 10),
		Currency: &types.Currency{
			Symbol:   t.TokenId.String(),
			Decimals: int32(t.Decimals),
			Metadata: map[string]interface{}{MetadataKeyType: t.Type},
		},
	}
	if t.Type == domain.TokenTypeNonFungibleUnique {
		metadata := make(map[string]interface{})
		if len(t.SerialNumbers) > 0 {
			serialNumbers := make([]string, 0, len(t.SerialNumbers))
			for _, serialNumber := range t.SerialNumbers {
				serialNumbers = append(serialNumbers, strconv.FormatInt(serialNumber, 10))
			}
			metadata[MetadataKeySerialNumbers] = serialNumbers
		}
		if len(t.Metadatas) > 0 {
			nftMetadatas := make([]string, 0, len(t.Metadatas))
			for _, nftMetadata := range t.Metadatas {
				nftMetadatas = append(nftMetadatas, base64.StdEncoding.EncodeToString(nftMetadata))
			}
			metadata[MetadataKeyMetadatas] = nftMetadatas
		}
		amount.Metadata = metadata
	}
	return &amount
}
func ( t * TokenAmount ) ToRosetta ( ) * types . Amount { amount := types . Amount { Value : strconv . FormatInt ( t . Value , 10 ) , Currency : & types . Currency { Symbol : t . TokenId . String ( ) , Decimals : int32 ( t . Decimals ) , Metadata : map [ string ] interface { } { MetadataKeyType : t . Type } , } , } if t . Type == domain . TokenTypeNonFungibleUnique { metadata := make ( map [ string ] interface { } ) if len ( t . SerialNumbers ) > 0 { serialNumbers := make ( [ ] string , 0 , len ( t . SerialNumbers ) ) for _ , serialNumber := range t . SerialNumbers { serialNumbers = append ( serialNumbers , strconv . FormatInt ( serialNumber , 10 ) ) } metadata [ MetadataKeySerialNumbers ] = serialNumbers } if len ( t . Metadatas ) > 0 { nftMetadatas := make ( [ ] string , 0 , len ( t . Metadatas ) ) for _ , nftMetadata := range t . Metadatas { nftMetadatas = append ( nftMetadatas , base64 . StdEncoding . EncodeToString ( nftMetadata ) ) } metadata [ MetadataKeyMetadatas ] = nftMetadatas } amount . Metadata = metadata } return & amount }
ToRosetta returns Rosetta type Amount with the token's currency
ToRosetta returns Rosetta type Amount with the token ' s currency