Skip to content

Commit

Permalink
- Prepared for the 10/10 STAR ODK v2.2.0 and OASIS v3.3.1 releases.
Browse files Browse the repository at this point in the history
- Fixed remaining bugs for OAPP API integration into STAR CLI.

- Can now install as well as publish OAPPs.

- Multiple bug fixes.

- Bumped OASISVersion to v3.3.1 in OASISBootLoader.

- Multiple bug fixes in STAR CLI & STAR.

- Created new OASIS Runtime v3.3.1.

- Created new STAR ODK Runtime v2.2.0.
  • Loading branch information
dellams committed Oct 11, 2024
1 parent 0ef18d4 commit 0bbad71
Show file tree
Hide file tree
Showing 994 changed files with 385 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public CustomOASISProperty()

}

public bool StoreAsJsonString { get; set; }

//private string propertyName;
//public double version;

Expand Down
4 changes: 2 additions & 2 deletions NextGenSoftware.OASIS.API.Core/Enums/NFTStandardType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public enum NFTStandardType
{
ERC721,
ERC1155,
Both,
Metaplex
Both
//Metaplex
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ private async Task<OASISResult<IHolon>> SaveHolonForProviderTypeAsync(IHolon hol

if (allChildHolons.Count > 0)
{
OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync<T>((IEnumerable<T>)allChildHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);
List<T> genericHolons = new List<T>();

foreach (IHolon child in allChildHolons)
genericHolons.Add((T)child);

//OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync<T>((IEnumerable<T>)allChildHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);
OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync(genericHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);

if (saveChildHolonsResult != null && saveChildHolonsResult.Result != null && !saveChildHolonsResult.IsError)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
using NextGenSoftware.OASIS.API.Core.CustomAttrbiutes;
using System.Collections.Immutable;
using System.Drawing;
using System.Reflection.Metadata;
using System.Text.Json;

namespace NextGenSoftware.OASIS.API.Core.Managers
{
Expand Down Expand Up @@ -96,18 +98,50 @@ private IHolon PrepareHolonForSaving(IHolon holon, Guid avatarId, bool extractMe
// TODO: Would ideally like to find a better way to do this so we can avoid reflection if possible because of the potential overhead!
// Need to do some perfomrnace tests with reflection turned on/off (so with this code enabled/disabled) to see what the overhead is exactly...

bool storeAsJsonString = false;

// We only want to extract the meta data for sub-classes of Holon that are calling the Generic overloads.
if (holon.GetType() != typeof(Holon) && extractMetaData)
{
PropertyInfo[] props = holon.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
var classAttributes = holon.GetType().GetCustomAttributes();

foreach (CustomOASISProperty attribute in classAttributes)
{
Console.WriteLine($"StoreAsJsonString: {attribute.StoreAsJsonString}");

storeAsJsonString = attribute.StoreAsJsonString;


}

foreach (PropertyInfo propertyInfo in props)
{
foreach (CustomAttributeData data in propertyInfo.CustomAttributes)
{
if (data.AttributeType == (typeof(CustomOASISProperty)))
{
holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon).ToString();
//if (data.NamedArguments)

for (int i = 0; i < data.NamedArguments.Count() ; i++)
{
if (data.NamedArguments[i].MemberName == propertyInfo.Name)
{
if (Convert.ToBoolean(data.NamedArguments[i].TypedValue.Value))
{

}
}
}

//ustomOASISProperty oasisProperty = data as CustomOASISProperty;

//holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon).ToString();
if (storeAsJsonString)
holon.MetaData[propertyInfo.Name] = JsonSerializer.Serialize(propertyInfo.GetValue(holon)) ;
else
holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon);

break;
}
}
Expand Down Expand Up @@ -585,8 +619,8 @@ private IHolon MapMetaData<T>(IHolon holon) where T : IHolon
propInfo.SetValue(holon, ColorTranslator.FromHtml(holon.MetaData[key].ToString()));
//propInfo.SetValue(holon, (Color)(holon.MetaData[key]));

else
propInfo.SetValue(holon, holon.MetaData[key]);
//else if (propInfo.Attributes.)
// propInfo.SetValue(holon, holon.MetaData[key]);
}
}
catch (Exception ex)
Expand Down
69 changes: 49 additions & 20 deletions NextGenSoftware.OASIS.API.ONODE.Core/Holons/OAPP.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using NextGenSoftware.OASIS.API.Core.Holons;
using NextGenSoftware.OASIS.API.Core.Holons;
using NextGenSoftware.OASIS.API.Core.Enums;
using NextGenSoftware.OASIS.API.Core.Interfaces.STAR;
using NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Holons;
using NextGenSoftware.OASIS.API.Core.CustomAttrbiutes;
using NextGenSoftware.OASIS.API.Core.Interfaces;
using Google.Protobuf.WellKnownTypes;
using System.Text.Json;

namespace NextGenSoftware.OASIS.API.ONode.Core.Holons
{
Expand All @@ -15,33 +17,60 @@ public OAPP()
this.HolonType = HolonType.OAPP;
}

[CustomOASISProperty]
public OAPPType OAPPType { get; set; }
//[CustomOASISProperty]
//public OAPPType OAPPType { get; set; }

[CustomOASISProperty]
public GenesisType GenesisType { get; set; }
//public ICelestialHolon CelestialHolon { get; set; } //The base CelestialHolon that represents this OAPP (planet, moon, star, solar system, galaxy etc).
//[CustomOASISProperty]
//public GenesisType GenesisType { get; set; }
////public ICelestialHolon CelestialHolon { get; set; } //The base CelestialHolon that represents this OAPP (planet, moon, star, solar system, galaxy etc).

[CustomOASISProperty]
public Guid CelestialBodyId { get; set; }
//[CustomOASISProperty]
//public Guid CelestialBodyId { get; set; }

[CustomOASISProperty]
public ICelestialBody CelestialBody { get; set; } //The base CelestialBody that represents this OAPP (planet, moon, star, super star, grand super star, etc).
//[CustomOASISProperty]
//public ICelestialBody CelestialBody { get; set; } //The base CelestialBody that represents this OAPP (planet, moon, star, super star, grand super star, etc).

[CustomOASISProperty]
public DateTime PublishedOn { get; set; }
//[CustomOASISProperty]
//public DateTime PublishedOn { get; set; }

[CustomOASISProperty]
public Guid PublishedByAvatarId { get; set; }
//[CustomOASISProperty]
//public Guid PublishedByAvatarId { get; set; }

[CustomOASISProperty]
[CustomOASISProperty()]
public string OAPPDNAJSON { get; set; }

private IOAPPDNA _OAPPDNA;

[CustomOASISProperty(StoreAsJsonString = true)]
public IOAPPDNA OAPPDNA
{
get
{
if (_OAPPDNA == null && MetaData["OAPPDNAJSON"] != null && !string.IsNullOrEmpty(MetaData["OAPPDNAJSON"].ToString()))
_OAPPDNA = JsonSerializer.Deserialize<OAPPDNA>(MetaData["OAPPDNAJSON"].ToString());

return _OAPPDNA;
}
set
{
_OAPPDNA = value;
}
}

//private IOAPPDNA _Name;

//[CustomOASISProperty(StoreAsJsonString = true)]
//public IOAPPDNA OAPPDNA { get; set; }


[CustomOASISProperty()]
public byte[] PublishedOAPP { get; set; }

[CustomOASISProperty]
public string CreatedByAvatarUsername { get; set; }
//[CustomOASISProperty]
//public string CreatedByAvatarUsername { get; set; }

[CustomOASISProperty]
public string PublishedByAvatarUsername { get; set; }
//[CustomOASISProperty]
//public string PublishedByAvatarUsername { get; set; }

//TODO:More to come! ;-)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public interface IOAPP : IHolon
//string CreatedByAvatarUsername { get; set; }
//string PublishedByAvatarUsername { get; set; }

ICelestialBody CelestialBody { get; set; } //TODO: Dont think we need this?
//ICelestialBody CelestialBody { get; set; } //TODO: Dont think we need this?
string OAPPDNAJSON { get; set; }
IOAPPDNA OAPPDNA { get; set; }
byte[] PublishedOAPP { get; set; }
}
Expand Down
31 changes: 25 additions & 6 deletions NextGenSoftware.OASIS.API.ONODE.Core/Managers/NFTManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,14 +1314,33 @@ private OASISResult<INFTTransactionRespone> MintNFTInternal(IMintNFTTransactionR
return result;
}

//public string CreateERCJson(IMintNFTTransactionRequest request, NFTStandardType NFTStandardType)
// => NFTStandardType switch
// {
// NFTStandardType.ERC721 => CreateERC721Json(request),
// NFTStandardType.ERC1155 => CreateERC1155Json(request),
// NFTStandardType.Metaplex => CreateMetaplexJson(request),
// _ => "",
// };

public string CreateERCJson(IMintNFTTransactionRequest request, NFTStandardType NFTStandardType)
=> NFTStandardType switch
{
if (request.OnChainProvider.Value == ProviderType.SolanaOASIS)
return CreateMetaplexJson(request);
else
{
NFTStandardType.ERC721 => CreateERC721Json(request),
NFTStandardType.ERC1155 => CreateERC1155Json(request),
NFTStandardType.Metaplex => CreateMetaplexJson(request),
_ => "",
};
switch (NFTStandardType)
{
case NFTStandardType.ERC721:
return CreateERC721Json(request);

case NFTStandardType.ERC1155:
return CreateERC721Json(request);
}
}

return "";
}

private string CreateMetaplexJson(IMintNFTTransactionRequest request)
{
Expand Down
Loading

0 comments on commit 0bbad71

Please sign in to comment.