Skip to content

Commit

Permalink
- Continued work on upgrading the OASIS API NFT API.
Browse files Browse the repository at this point in the history
- Created IMintAndPlaceGeoSpatialNFTRequest, IOASISGeoSpatialNFT, IPlaceGeoSpatialNFTRequest, IPlaceGeoSpatialNFTRequestBase & IMintNFTTransaction interfaces in OASIS.API.Core.

- Updated IOASISNFT interface in OASIS.API.Core by adding ThumbnailUrl, Token, Hash and MetaData properties.

- Updated IOASISNFTProvider interface in OASIS.API.Core by adding MintNFT, MintNFTAsync, LoadNFT, LoadNFTAsync, LoadAllNFTsForAvatar, LoadAllNFTsForAvatarAsync, LoadAllNFTsForMintAddress, LoadAllNFTsForMintAddressAsync, PlaceGeoNFT, PlaceGeoNFTAsync, MintAndPlaceGeoNFT & MintAndPlaceGeoNFTAsync functions.

- Removed Date from IWalletTransaction and WalletTransaction in OASIS.API.Core (this should be set by the relevant managers (NFTManger, WalletManager etc) so the date is always set to Now and so the date cannot be forged then.)

- Added Hash, ThumbnailUrl, Token & MetaData to OASISNFT in OASIS.API.Core.

- Created NFTProviderType enum in OASIS.API.ONode.Core.

- Updated INFTManager interface in OASIS.API.ONode.Core by adding CreateNftTransactionAsync, CreateNftTransaction, MintNftAsync, MintNft, LoadNftAsync, LoadNft, GetNFTProvider, GetNFTProviderTypeFromProviderType & GetProviderTypeFromNFTProviderType functions.

- Created ICreateNftTransactionRequest, IPurchaseOlandRequest & IPurchaseOlandResponse interfaces in OASIS.API.ONode.Core.

- Updated NFTManager in OASIS.API.ONode.Core by adding CreateNftTransactionAsync, CreateNftTransaction, MintNftAsync, MintNft, LoadNftAsync, LoadNft, GetNFTProvider, GetNFTProviderTypeFromProviderType & GetProviderTypeFromNFTProviderType functions.

- Added CreateNftTransactionRequest object to OASIS.API.ONode.Core.

- Removed CargoSaleId property from PurchaseOlandRequest object in OASIS.API.ONode.Core.

- PurchaseOlandResponse object now implements new IPurchaseOlandResponse interface in OASIS.API.ONode.Core.

- Updated NFTController in OASIS.API.ONode.WebAPI by removing all references to the new obsolete NFTService and pointing methods CreateNftTransaction to the new NFTManger in OASIS.API.ONode.Core instead. Also added new MintNFT function.

- Removed the rest of the now retired NFTService in OASIS.API.ONode.WebAPI.
  • Loading branch information
dellams committed Sep 9, 2023
1 parent f9769d9 commit a22e37d
Show file tree
Hide file tree
Showing 24 changed files with 456 additions and 365 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT
{
public interface IMintAndPlaceGeoSpatialNFTRequest : IMintNFTTransaction, IPlaceGeoSpatialNFTRequestBase
{

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT
namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT
{
public interface IOASISGeoSpatialNFT : IOASISNFT
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT
{
public interface IPlaceGeoSpatialNFTRequest : IPlaceGeoSpatialNFTRequestBase
{
public Guid OASISNFTId { get; set; }
public string NFTHash { get; set; }
public string NFTURL { get; set; }
public Guid AvatarId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT
{
public interface IPlaceGeoSpatialNFTRequestBase
{
public long Lat { get; set; }
public long Long { get; set; }
public bool AllowOtherPlayersToAlsoCollect { get; set; }
public bool PermSpawn { get; set; }
public int GlobalSpawnQuantity { get; set; }
public int PlayerSpawnQuantity { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NextGenSoftware.OASIS.API.Core.Enums;
using System;
using System.Collections.Generic;

namespace NextGenSoftware.OASIS.API.Core.Interfaces.NFT
{
public interface IMintNFTTransaction
{
public string MintWalletAddress { get; set; }
public Guid MintedByAvatarId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public byte[] Thumbnail { get; set; }
public string ThumbnailUrl { get; set; }
public decimal Price { get; set; }
public decimal Discount { get; set; }
public string Token { get; set; } //TODO: Should be dervied from the OnChainProvider so may not need this?
public int NumberToMint { get; set; }
public Dictionary<string, object> MetaData { get; set; }
public ProviderType OffChainProvider { get; set; }
public ProviderType OnChainProvider { get; set; }
}
}
5 changes: 4 additions & 1 deletion NextGenSoftware.OASIS.API.Core/Interfaces/NFT/IOASISNFT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ public interface IOASISNFT
Guid Id { get; set; }
Guid MintedByAvatarId { get; set; }
string MintedByAddress { get; set; }
string Hash { get; set; }
decimal Price { get; set; }
decimal Discount { get; set; }
byte[] Thumbnail { get; set; }
Dictionary<string, string> MetaData { get; set; }
string ThumbnailUrl { get; set; }
public string Token { get; set; } //TODO: Should be dervied from the OnChainProvider so may not need this?
Dictionary<string, object> MetaData { get; set; }
ProviderType OffChainProvider { get; set; }
ProviderType OnChainProvider { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

using NextGenSoftware.OASIS.API.Core.Helpers;
using NextGenSoftware.OASIS.API.Core.Interfaces.NFT;
using NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT;
using NextGenSoftware.OASIS.API.Core.Objects.Wallets;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace NextGenSoftware.OASIS.API.Core.Interfaces
Expand All @@ -11,5 +14,24 @@ public interface IOASISNFTProvider : IOASISProvider
//TODO: More to come soon... ;-)
public OASISResult<TransactionRespone> SendNFT(INFTWalletTransaction transation);
public Task<OASISResult<TransactionRespone>> SendNFTAsync(INFTWalletTransaction transation);

public OASISResult<TransactionRespone> MintNFT(IMintNFTTransaction transation);
public Task<OASISResult<TransactionRespone>> MintNFTAsync(IMintNFTTransaction transation);

//These load methods below will apply ONLY to the specefic provider/blockchain that they are implemented on. So will not load for ALL providers across the OASIS, but the versions implemented on NFTManger DOES...
public OASISResult<IOASISNFT> LoadNFT(Guid id);
public Task<OASISResult<IOASISNFT>> LoadNFTAsync(Guid id);

public OASISResult<List<IOASISNFT>> LoadAllNFTsForAvatar(Guid avatarId);
public Task<OASISResult<List<IOASISNFT>>> LoadAllNFTsForAvatarAsync(Guid avatarId);

public OASISResult<List<IOASISNFT>> LoadAllNFTsForMintAddress(string mintWalletAddress);
public Task<OASISResult<List<IOASISNFT>>> LoadAllNFTsForMintAddressAsync(string mintWalletAddress);

public OASISResult<IOASISGeoSpatialNFT> PlaceGeoNFT(IPlaceGeoSpatialNFTRequest request);
public Task<OASISResult<IOASISGeoSpatialNFT>> PlaceGeoNFTAsync(IPlaceGeoSpatialNFTRequest request);

public OASISResult<IOASISGeoSpatialNFT> MintAndPlaceGeoNFT(IMintAndPlaceGeoSpatialNFTRequest request);
public Task<OASISResult<IOASISGeoSpatialNFT>> MintAndPlaceGeoNFTAsync(IMintAndPlaceGeoSpatialNFTRequest request);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using System;
using NextGenSoftware.OASIS.API.Core.Enums;

namespace NextGenSoftware.OASIS.API.Core.Interfaces
Expand All @@ -11,7 +10,6 @@ public interface IWalletTransaction
public string ToWalletAddress { get; set; }
public string Token { get; set; }
public string MemoText { get; set; }
public DateTime Date { get; set; }
public ProviderType ProviderType { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using NextGenSoftware.OASIS.API.Core.Interfaces.NFT;
using NextGenSoftware.OASIS.API.Core.Interfaces.NFT.GeoSpatialNFT;

namespace NextGenSoftware.OASIS.API.Core.Objects
{
Expand Down
7 changes: 4 additions & 3 deletions NextGenSoftware.OASIS.API.Core/Objects/OASISNFT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ public class OASISNFT : IOASISNFT
/// The wallet address
/// </summary>
public string MintedByAddress { get; set; }
public string Hash { get; set; }
public decimal Price { get; set; }
public decimal Discount { get; set; }

public byte[] Thumbnail { get; set; }

public Dictionary<string, string> MetaData { get; set; } = new Dictionary<string, string>();
public string ThumbnailUrl { get; set; }
public string Token { get; set; } //TODO: Should be dervied from the OnChainProvider so may not need this?
public Dictionary<string, object> MetaData { get; set; } = new Dictionary<string, object>();

/// <summary>
/// The Blockchain to store the token on.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ namespace NextGenSoftware.OASIS.API.Core.Objects.Wallets
public class TransactionRespone
{
public string TransactionResult { get; set; }
//public bool IsSuccess { get; set; } //Redundant because will always be wrapped in a OASISResult which contains IsSuccess and IsError etc...
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class WalletTransaction : IWalletTransaction
public string ToWalletAddress { get; set; }
public string Token { get; set; }
public string MemoText { get; set; }
public DateTime Date { get; set; }
public ProviderType ProviderType { get; set; }
}
}
11 changes: 11 additions & 0 deletions NextGenSoftware.OASIS.API.ONODE.Core/Enums/NFTProviderType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

namespace NextGenSoftware.OASIS.API.ONode.Core.Objects
{
public enum NFTProviderType
{
None,
Solana,
Ethereum,
EOS
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
using NextGenSoftware.OASIS.API.Core.Helpers;
using System;
using System.Threading.Tasks;
using NextGenSoftware.OASIS.API.Core.Enums;
using NextGenSoftware.OASIS.API.Core.Helpers;
using NextGenSoftware.OASIS.API.Core.Interfaces;
using NextGenSoftware.OASIS.API.Core.Interfaces.NFT;
using NextGenSoftware.OASIS.API.Core.Objects.Wallets;
using System.Threading.Tasks;
using NextGenSoftware.OASIS.API.ONode.Core.Objects;

namespace NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Managers
{
public interface INFTManager
{
Task<OASISResult<TransactionRespone>> CreateNftTransactionAsync(CreateNftTransactionRequest request);
OASISResult<TransactionRespone> CreateNftTransaction(CreateNftTransactionRequest request);
Task<OASISResult<TransactionRespone>> CreateNftTransactionAsync(INFTWalletTransaction request);
OASISResult<TransactionRespone> CreateNftTransaction(INFTWalletTransaction request);
Task<OASISResult<TransactionRespone>> MintNftAsync(IMintNFTTransaction request);
OASISResult<TransactionRespone> MintNft(IMintNFTTransaction request);
Task<OASISResult<IOASISNFT>> LoadNftAsync(Guid id, NFTProviderType NFTProviderType);
OASISResult<IOASISNFT> LoadNft(Guid id, NFTProviderType NFTProviderType);
IOASISNFTProvider GetNFTProvider<T>(NFTProviderType NFTProviderType, ref OASISResult<T> result, string errorMessage);
IOASISNFTProvider GetNFTProvider<T>(ProviderType providerType, ref OASISResult<T> result, string errorMessage);
NFTProviderType GetNFTProviderTypeFromProviderType(ProviderType providerType);
ProviderType GetProviderTypeFromNFTProviderType(NFTProviderType nftProviderType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using NextGenSoftware.OASIS.API.ONode.Core.Objects;

namespace NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Objects
{
public interface ICreateNftTransactionRequest
{
public NFTProviderType NFTProviderType { get; set; }
public string MintWalletAddress { get; set; }
public string FromWalletAddress { get; set; }
public string ToWalletAddress { get; set; }
public int Amount { get; set; }
public string Token { get; set; }
public string MemoText { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using NextGenSoftware.OASIS.API.Core.Enums;
using System;
using System.Collections.Generic;

namespace NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Objects
{
public interface IPurchaseOlandRequest
{
Guid AvatarId { get; set; }
string AvatarUsername { get; set; }
List<Guid> OlandIds { get; set; }
ProviderType ProviderType { get; set; }
string Tiles { get; set; }
string WalletAddress { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;

namespace NextGenSoftware.OASIS.API.ONode.Core.Interfaces.Objects
{
public interface IPurchaseOlandResponse
{
List<Guid> OlandIds { get; set; }
Guid OLandPurchaseId { get; set; }
string TransactionHash { get; set; }
}
}
Loading

0 comments on commit a22e37d

Please sign in to comment.