Skip to content

Commit 30ab579

Browse files
committed
- Prepared for the 10/10 STAR ODK v2.2.0 and OASIS v3.3.1 releases.
- 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.
1 parent 44ccfdf commit 30ab579

994 files changed

Lines changed: 385 additions & 161 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NextGenSoftware.OASIS.API.Core/Custom Attributes/CustomOASISProperty.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public CustomOASISProperty()
1111

1212
}
1313

14+
public bool StoreAsJsonString { get; set; }
15+
1416
//private string propertyName;
1517
//public double version;
1618

NextGenSoftware.OASIS.API.Core/Enums/NFTStandardType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public enum NFTStandardType
55
{
66
ERC721,
77
ERC1155,
8-
Both,
9-
Metaplex
8+
Both
9+
//Metaplex
1010
}
1111
}

NextGenSoftware.OASIS.API.Core/Managers/HolonManager/HolonManager-Private-Save.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@ private async Task<OASISResult<IHolon>> SaveHolonForProviderTypeAsync(IHolon hol
289289

290290
if (allChildHolons.Count > 0)
291291
{
292-
OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync<T>((IEnumerable<T>)allChildHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);
292+
List<T> genericHolons = new List<T>();
293+
294+
foreach (IHolon child in allChildHolons)
295+
genericHolons.Add((T)child);
296+
297+
//OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync<T>((IEnumerable<T>)allChildHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);
298+
OASISResult<IEnumerable<T>> saveChildHolonsResult = await SaveHolonsAsync(genericHolons, avatarId, saveChildren, recursive, maxChildDepth, continueOnError, saveChildrenOnProvider, true, providerType);
293299

294300
if (saveChildHolonsResult != null && saveChildHolonsResult.Result != null && !saveChildHolonsResult.IsError)
295301
{

NextGenSoftware.OASIS.API.Core/Managers/HolonManager/HolonManager-Private.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
using NextGenSoftware.OASIS.API.Core.CustomAttrbiutes;
1414
using System.Collections.Immutable;
1515
using System.Drawing;
16+
using System.Reflection.Metadata;
17+
using System.Text.Json;
1618

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

101+
bool storeAsJsonString = false;
102+
99103
// We only want to extract the meta data for sub-classes of Holon that are calling the Generic overloads.
100104
if (holon.GetType() != typeof(Holon) && extractMetaData)
101105
{
102106
PropertyInfo[] props = holon.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
107+
var classAttributes = holon.GetType().GetCustomAttributes();
108+
109+
foreach (CustomOASISProperty attribute in classAttributes)
110+
{
111+
Console.WriteLine($"StoreAsJsonString: {attribute.StoreAsJsonString}");
112+
113+
storeAsJsonString = attribute.StoreAsJsonString;
114+
115+
116+
}
103117

104118
foreach (PropertyInfo propertyInfo in props)
105119
{
106120
foreach (CustomAttributeData data in propertyInfo.CustomAttributes)
107121
{
108122
if (data.AttributeType == (typeof(CustomOASISProperty)))
109123
{
110-
holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon).ToString();
124+
//if (data.NamedArguments)
125+
126+
for (int i = 0; i < data.NamedArguments.Count() ; i++)
127+
{
128+
if (data.NamedArguments[i].MemberName == propertyInfo.Name)
129+
{
130+
if (Convert.ToBoolean(data.NamedArguments[i].TypedValue.Value))
131+
{
132+
133+
}
134+
}
135+
}
136+
137+
//ustomOASISProperty oasisProperty = data as CustomOASISProperty;
138+
139+
//holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon).ToString();
140+
if (storeAsJsonString)
141+
holon.MetaData[propertyInfo.Name] = JsonSerializer.Serialize(propertyInfo.GetValue(holon)) ;
142+
else
143+
holon.MetaData[propertyInfo.Name] = propertyInfo.GetValue(holon);
144+
111145
break;
112146
}
113147
}
@@ -585,8 +619,8 @@ private IHolon MapMetaData<T>(IHolon holon) where T : IHolon
585619
propInfo.SetValue(holon, ColorTranslator.FromHtml(holon.MetaData[key].ToString()));
586620
//propInfo.SetValue(holon, (Color)(holon.MetaData[key]));
587621

588-
else
589-
propInfo.SetValue(holon, holon.MetaData[key]);
622+
//else if (propInfo.Attributes.)
623+
// propInfo.SetValue(holon, holon.MetaData[key]);
590624
}
591625
}
592626
catch (Exception ex)

NextGenSoftware.OASIS.API.ONODE.Core/Holons/OAPP.cs

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using System;
2-
using NextGenSoftware.OASIS.API.Core.Holons;
1+
using NextGenSoftware.OASIS.API.Core.Holons;
32
using NextGenSoftware.OASIS.API.Core.Enums;
43
using NextGenSoftware.OASIS.API.Core.Interfaces.STAR;
54
using NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Holons;
65
using NextGenSoftware.OASIS.API.Core.CustomAttrbiutes;
6+
using NextGenSoftware.OASIS.API.Core.Interfaces;
7+
using Google.Protobuf.WellKnownTypes;
8+
using System.Text.Json;
79

810
namespace NextGenSoftware.OASIS.API.ONode.Core.Holons
911
{
@@ -15,33 +17,60 @@ public OAPP()
1517
this.HolonType = HolonType.OAPP;
1618
}
1719

18-
[CustomOASISProperty]
19-
public OAPPType OAPPType { get; set; }
20+
//[CustomOASISProperty]
21+
//public OAPPType OAPPType { get; set; }
2022

21-
[CustomOASISProperty]
22-
public GenesisType GenesisType { get; set; }
23-
//public ICelestialHolon CelestialHolon { get; set; } //The base CelestialHolon that represents this OAPP (planet, moon, star, solar system, galaxy etc).
23+
//[CustomOASISProperty]
24+
//public GenesisType GenesisType { get; set; }
25+
////public ICelestialHolon CelestialHolon { get; set; } //The base CelestialHolon that represents this OAPP (planet, moon, star, solar system, galaxy etc).
2426

25-
[CustomOASISProperty]
26-
public Guid CelestialBodyId { get; set; }
27+
//[CustomOASISProperty]
28+
//public Guid CelestialBodyId { get; set; }
2729

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

31-
[CustomOASISProperty]
32-
public DateTime PublishedOn { get; set; }
33+
//[CustomOASISProperty]
34+
//public DateTime PublishedOn { get; set; }
3335

34-
[CustomOASISProperty]
35-
public Guid PublishedByAvatarId { get; set; }
36+
//[CustomOASISProperty]
37+
//public Guid PublishedByAvatarId { get; set; }
3638

37-
[CustomOASISProperty]
39+
[CustomOASISProperty()]
40+
public string OAPPDNAJSON { get; set; }
41+
42+
private IOAPPDNA _OAPPDNA;
43+
44+
[CustomOASISProperty(StoreAsJsonString = true)]
45+
public IOAPPDNA OAPPDNA
46+
{
47+
get
48+
{
49+
if (_OAPPDNA == null && MetaData["OAPPDNAJSON"] != null && !string.IsNullOrEmpty(MetaData["OAPPDNAJSON"].ToString()))
50+
_OAPPDNA = JsonSerializer.Deserialize<OAPPDNA>(MetaData["OAPPDNAJSON"].ToString());
51+
52+
return _OAPPDNA;
53+
}
54+
set
55+
{
56+
_OAPPDNA = value;
57+
}
58+
}
59+
60+
//private IOAPPDNA _Name;
61+
62+
//[CustomOASISProperty(StoreAsJsonString = true)]
63+
//public IOAPPDNA OAPPDNA { get; set; }
64+
65+
66+
[CustomOASISProperty()]
3867
public byte[] PublishedOAPP { get; set; }
3968

40-
[CustomOASISProperty]
41-
public string CreatedByAvatarUsername { get; set; }
69+
//[CustomOASISProperty]
70+
//public string CreatedByAvatarUsername { get; set; }
4271

43-
[CustomOASISProperty]
44-
public string PublishedByAvatarUsername { get; set; }
72+
//[CustomOASISProperty]
73+
//public string PublishedByAvatarUsername { get; set; }
4574

4675
//TODO:More to come! ;-)
4776
}

NextGenSoftware.OASIS.API.ONODE.Core/Interfaces/Holons/IOAPP.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public interface IOAPP : IHolon
1616
//string CreatedByAvatarUsername { get; set; }
1717
//string PublishedByAvatarUsername { get; set; }
1818

19-
ICelestialBody CelestialBody { get; set; } //TODO: Dont think we need this?
19+
//ICelestialBody CelestialBody { get; set; } //TODO: Dont think we need this?
20+
string OAPPDNAJSON { get; set; }
2021
IOAPPDNA OAPPDNA { get; set; }
2122
byte[] PublishedOAPP { get; set; }
2223
}

NextGenSoftware.OASIS.API.ONODE.Core/Managers/NFTManager.cs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,14 +1314,33 @@ private OASISResult<INFTTransactionRespone> MintNFTInternal(IMintNFTTransactionR
13141314
return result;
13151315
}
13161316

1317+
//public string CreateERCJson(IMintNFTTransactionRequest request, NFTStandardType NFTStandardType)
1318+
// => NFTStandardType switch
1319+
// {
1320+
// NFTStandardType.ERC721 => CreateERC721Json(request),
1321+
// NFTStandardType.ERC1155 => CreateERC1155Json(request),
1322+
// NFTStandardType.Metaplex => CreateMetaplexJson(request),
1323+
// _ => "",
1324+
// };
1325+
13171326
public string CreateERCJson(IMintNFTTransactionRequest request, NFTStandardType NFTStandardType)
1318-
=> NFTStandardType switch
1327+
{
1328+
if (request.OnChainProvider.Value == ProviderType.SolanaOASIS)
1329+
return CreateMetaplexJson(request);
1330+
else
13191331
{
1320-
NFTStandardType.ERC721 => CreateERC721Json(request),
1321-
NFTStandardType.ERC1155 => CreateERC1155Json(request),
1322-
NFTStandardType.Metaplex => CreateMetaplexJson(request),
1323-
_ => "",
1324-
};
1332+
switch (NFTStandardType)
1333+
{
1334+
case NFTStandardType.ERC721:
1335+
return CreateERC721Json(request);
1336+
1337+
case NFTStandardType.ERC1155:
1338+
return CreateERC721Json(request);
1339+
}
1340+
}
1341+
1342+
return "";
1343+
}
13251344

13261345
private string CreateMetaplexJson(IMintNFTTransactionRequest request)
13271346
{

0 commit comments

Comments
 (0)