Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaplex Core 0.6.1 Integration #54

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Solnet.Metaplex.Examples/Solnet.Metaplex.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Solnet.Metaplex.Examples</RootNamespace>
</PropertyGroup>

Expand Down
39 changes: 22 additions & 17 deletions Solnet.Metaplex.Examples/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"dependencies": {
"net6.0": {
"net8.0": {
"Solnet.Programs": {
"type": "Direct",
"requested": "[6.1.0, )",
Expand Down Expand Up @@ -160,24 +160,31 @@
"resolved": "1.9.0",
"contentHash": "eZZBCABzVOek+id9Xy04HhmgykF0wZg9wpByzrWN7q8qEI0Qen9b7tfd7w8VA3dOeesumMG7C5ZPy0jk7PSRHw=="
},
"Solnet.Extensions": {
"Solana.Programs": {
"type": "Transitive",
"resolved": "6.1.0",
"contentHash": "jTs3CNeA1/FSdDBMDy/MfrTx8Z3pBc9qMRFDC2lgkW8SwHfL9LG0tso/BYsckEKXPpODUxe08xCrCWtLg/Hw1Q==",
"resolved": "8.3.0",
"contentHash": "hIyt1AkPRFLRkDRsYuNS8mwkQSIO6Ji2/mudONLwcQ+ILTqGM4iEMUP6BjzStInyookX10HZX0nKS76mkzhgiw==",
"dependencies": {
"Solnet.Programs": "6.1.0",
"Solnet.Rpc": "6.1.0",
"Solnet.Wallet": "6.1.0"
"Solana.Rpc": "8.3.0"
}
},
"Solnet.KeyStore": {
"Solana.Rpc": {
"type": "Transitive",
"resolved": "6.1.0",
"contentHash": "CkFUXyWLahJh5KeRLNd2BqEFaeosGNhsPmmrZY9yUM92H/4hvNnw84J1RWIbw5nfsczNMp8iYf4l265+sZcKTA==",
"resolved": "8.3.0",
"contentHash": "1GDMxsgHmpW93NyQ9+KzQVuu+UIngEiZhaVDzXPUyD+QRsMC+fNOoxI0K5V1nCcJEv+204V9aUgUhoaB978WIg==",
"dependencies": {
"Microsoft.Extensions.Logging": "6.0.0",
"Microsoft.Extensions.Logging.Console": "6.0.0",
"Solana.Wallet": "8.3.0"
}
},
"Solana.Wallet": {
"type": "Transitive",
"resolved": "8.3.0",
"contentHash": "KWCybD7wcnOM8NIUxnjn/QYY487Fevv2cvJhA27bFWeux0I5ThEbXBXMQuZ5YVc4VKRRpy+ULXfuoL6M83kASg==",
"dependencies": {
"Chaos.NaCl.Standard": "1.0.0",
"Portable.BouncyCastle": "1.9.0",
"Solnet.Wallet": "6.1.0"
"Portable.BouncyCastle": "1.9.0"
}
},
"System.Diagnostics.DiagnosticSource": {
Expand Down Expand Up @@ -217,11 +224,9 @@
"Microsoft.Extensions.Logging.Abstractions": "[6.0.2, )",
"Microsoft.Extensions.Logging.Console": "[6.0.0, )",
"Newtonsoft.Json": "[13.0.1, )",
"Solnet.Extensions": "[6.1.0, )",
"Solnet.Keystore": "[6.1.0, )",
"Solnet.Programs": "[6.1.0, )",
"Solnet.Rpc": "[6.1.0, )",
"Solnet.Wallet": "[6.1.0, )"
"Solana.Programs": "[8.3.0, )",
"Solana.Rpc": "[8.3.0, )",
"Solana.Wallet": "[8.3.0, )"
}
}
}
Expand Down
158 changes: 158 additions & 0 deletions Solnet.Metaplex/Core Program/MplCoreAccounts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using Solnet.Metaplex.Core;
using Solnet.Programs.Utilities;
using Solnet.Wallet;
using Solnet.Metaplex.Core.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Solnet.Metaplex.Core.Accounts
{
public partial class PluginHeaderV1
{
public Key Key { get; set; }

public ulong PluginRegistryOffset { get; set; }

public static PluginHeaderV1 Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
PluginHeaderV1 result = new PluginHeaderV1();
result.Key = (Key)_data.GetU8(offset);
offset += 1;
result.PluginRegistryOffset = _data.GetU64(offset);
offset += 8;
return result;
}
}

public partial class PluginRegistryV1
{
public Key Key { get; set; }

public RegistryRecord[] Registry { get; set; }

public ExternalPluginRecord[] ExternalPlugins { get; set; }

public static PluginRegistryV1 Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
PluginRegistryV1 result = new PluginRegistryV1();
result.Key = (Key)_data.GetU8(offset);
offset += 1;
int resultRegistryLength = (int)_data.GetU32(offset);
offset += 4;
result.Registry = new RegistryRecord[resultRegistryLength];
for (uint resultRegistryIdx = 0; resultRegistryIdx < resultRegistryLength; resultRegistryIdx++)
{
offset += RegistryRecord.Deserialize(_data, offset, out var resultRegistryresultRegistryIdx);
result.Registry[resultRegistryIdx] = resultRegistryresultRegistryIdx;
}

int resultExternalPluginsLength = (int)_data.GetU32(offset);
offset += 4;
result.ExternalPlugins = new ExternalPluginRecord[resultExternalPluginsLength];
for (uint resultExternalPluginsIdx = 0; resultExternalPluginsIdx < resultExternalPluginsLength; resultExternalPluginsIdx++)
{
offset += ExternalPluginRecord.Deserialize(_data, offset, out var resultExternalPluginsresultExternalPluginsIdx);
result.ExternalPlugins[resultExternalPluginsIdx] = resultExternalPluginsresultExternalPluginsIdx;
}

return result;
}
}

public partial class AssetV1
{
public Key Key { get; set; }

public PublicKey Owner { get; set; }

public PublicKey UpdateAuthority { get; set; }

public string Name { get; set; }

public string Uri { get; set; }

public ulong? Seq { get; set; }

public static AssetV1 Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
AssetV1 result = new AssetV1();
result.Key = (Key)_data.GetU8(offset);
offset += 1;
result.Owner = _data.GetPubKey(offset);
offset += 32;
offset += 1;
result.UpdateAuthority = _data.GetPubKey(offset);
offset += 32;
offset += _data.GetBorshString(offset, out var resultName);
result.Name = resultName;
offset += _data.GetBorshString(offset, out var resultUri);
result.Uri = resultUri;
if (_data.GetBool(offset++))
{
result.Seq = _data.GetU64(offset);
offset += 8;
}

return result;
}
}

public partial class CollectionV1
{
public Key Key { get; set; }

public PublicKey UpdateAuthority { get; set; }

public string Name { get; set; }

public string Uri { get; set; }

public uint NumMinted { get; set; }

public uint CurrentSize { get; set; }

public static CollectionV1 Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
CollectionV1 result = new CollectionV1();
result.Key = (Key)_data.GetU8(offset);
offset += 1;
result.UpdateAuthority = _data.GetPubKey(offset);
offset += 32;
offset += _data.GetBorshString(offset, out var resultName);
result.Name = resultName;
offset += _data.GetBorshString(offset, out var resultUri);
result.Uri = resultUri;
result.NumMinted = _data.GetU32(offset);
offset += 4;
result.CurrentSize = _data.GetU32(offset);
offset += 4;
return result;
}
}

public partial class HashedAssetV1
{
public Key Key { get; set; }

public byte[] Hash { get; set; }

public static HashedAssetV1 Deserialize(ReadOnlySpan<byte> _data)
{
int offset = 0;
HashedAssetV1 result = new HashedAssetV1();
result.Key = (Key)_data.GetU8(offset);
offset += 1;
result.Hash = _data.GetBytes(offset, 32);
offset += 32;
return result;
}
}
}
Loading
Loading