![]() |
VOOZH | about |
dotnet add package UniqueSDK --version 0.0.3
NuGet\Install-Package UniqueSDK -Version 0.0.3
<PackageReference Include="UniqueSDK" Version="0.0.3" />
<PackageVersion Include="UniqueSDK" Version="0.0.3" />Directory.Packages.props
<PackageReference Include="UniqueSDK" />Project file
paket add UniqueSDK --version 0.0.3
#r "nuget: UniqueSDK, 0.0.3"
#:package UniqueSDK@0.0.3
#addin nuget:?package=UniqueSDK&version=0.0.3Install as a Cake Addin
#tool nuget:?package=UniqueSDK&version=0.0.3Install as a Cake Tool
Simple to use nuget package (standard for C# packages) that abstracts the use of simple NFT operations (minting, transferring, querying..).
The ideal goal of this abstraction is to make it understandable to non-web3 developers.
// Generate new mnemonics
var mnemonics = Mnemonic.GenerateMnemonic(MnemonicSize.Words12);
// Show these mnemonics to the user.
// Careful, mnemonics are private data, which should never be leaked.
Console.WriteLine(mnemonics);
var keyring = new Keyring();
var firstWallet = keyring.AddFromMnemonic(mnemonics, new Meta() { Name = "Test account" }, KeyType.Ed25519);
// Your account that you can use
var account = firstWallet.Account;
// Use existing mnemonics
var mnemonics = "collect salad honey track clerk energy agent empty edit devote mixed injury";
var keyring = new Keyring();
var firstWallet = keyring.AddFromMnemonic(mnemonics, new Meta() { Name = "Test account" }, KeyType.Ed25519);
// Your account that you can use
var account = firstWallet.Account;
// Connect to a Substrate node
var client = new SubstrateClientExt(
new System.Uri(Constants.UNIQUE_NODE_URL),
ChargeTransactionPayment.Default());
await client.ConnectAsync();
Constants.UNIQUE_NODE_URL for any other websocket node URL.AccountInfo accountInfo = await client.GetAccountInfoAsync(account);
Console.WriteLine($"Free balance: {accountInfo.Data.Free.Amount} {accountInfo.Data.Free.Unit}");
string destinationAddress = "5EU6EyEq6RhqYed1gCYyQRVttdy6FC9yAtUUGzPe3gfpFX8y";
AccountInfo accountInfo = await client.GetAccountInfoAsync(destinationAddress);
Console.WriteLine($"Free balance: {accountInfo.Data.Free.Amount} {accountInfo.Data.Free.Unit}");
var nonce = await client.System.AccountNextIndexAsync(account.Value, CancellationToken.None);
Response response = await BalancesModel.TransferRestAsync(
account.Value,
"5EU6EyEq6RhqYed1gCYyQRVttdy6FC9yAtUUGzPe3gfpFX8y",
(decimal)1.5,
nonce,
withFee: true
);
Console.WriteLine($"Fee: {response.Fee.Amount} {response.Fee.Unit}");
var result = await client.SignAndSubmitExtrinsicAsync(await response.SignerPayloadJSON.ToExtrinsicAsync(account));
Assert.That(result == ExtrinsicResult.Success);
Action<string, ExtrinsicStatus> myCallback = (string id, ExtrinsicStatus status) =>
{
if (status.ExtrinsicState == ExtrinsicState.Ready)
{
Console.WriteLine("Ready");
}
else if (status.ExtrinsicState == ExtrinsicState.Dropped)
{
Console.WriteLine("Dropped");
}
else if (status.ExtrinsicState == ExtrinsicState.InBlock)
{
Console.WriteLine("In block");
}
else if (status.ExtrinsicState == ExtrinsicState.Finalized)
{
Console.WriteLine("Finalized");
}
};
Collection collection = new Collection
{
Address = account.Value, // Or any other string SS58 address
CoverImage = new Image
{
Url = "https://ipfs.unique.network/ipfs/QmcAcH4F9HYQtpqKHxBFwGvkfKb8qckXj2YWUrcc8yd24G/image1.png",
},
Name = "Test Collection 5",
PotentialAttributes = new List<PotentialAttribute> {
new PotentialAttribute{
TraitType = "color",
Values = new List<string>
{
"red",
"green",
"blue"
}
}
}
};
uint? collectionId = await CollectionModel.SignAndSubmitCreateCollectionExtrinsicAsync(client, account, collection, myCallback);
Console.WriteLine("Collection id: " + collectionId);
// Use existing mnemonics
var mnemonics = "collect salad honey track clerk energy agent empty edit devote mixed injury";
var keyring = new Keyring();
var firstWallet = keyring.AddFromMnemonic(mnemonics, new Meta() { Name = "Test account" }, KeyType.Ed25519);
// Your account that you can use
var account = firstWallet.Account;
// Connect to a Substrate node
var client = new SubstrateClientExt(
new System.Uri(Constants.UNIQUE_NODE_URL),
ChargeTransactionPayment.Default());
await client.ConnectAsync();
// Nft data
var nft = new Nft
{
CollectionId = 2753,
Owner = account.Value, // Or any other string SS58 address
TokenName = "Unified 2",
ImageSource = "https://bafybeie5r4xjzjn3x6tl7anncjg62yhjzirpzucve4bwpfjhmblzsfpsuy.ipfs.nftstorage.link/",
};
// Custom callback to react on the extrinsic status change
Action<string, ExtrinsicStatus> myCallback = (string id, ExtrinsicStatus status) =>
{
if (status.ExtrinsicState == ExtrinsicState.Ready)
{
Console.WriteLine("Ready");
}
else if (status.ExtrinsicState == ExtrinsicState.Dropped)
{
Console.WriteLine("Dropped");
}
else if (status.ExtrinsicState == ExtrinsicState.InBlock)
{
Console.WriteLine("In block");
}
else if (status.ExtrinsicState == ExtrinsicState.Finalized)
{
Console.WriteLine("Finalized");
}
};
// Sign and Submit the Mint Nft extrinsic
uint? nftId = await client.SignAndSubmitMintNftExtrinsicAsync(account, nft, myCallback);
// Your newly minted Nft id
Console.WriteLine("Nft id: " + nftId);
// Use existing mnemonics
var mnemonics = "collect salad honey track clerk energy agent empty edit devote mixed injury";
var keyring = new Keyring();
var firstWallet = keyring.AddFromMnemonic(mnemonics, new Meta() { Name = "Test account" }, KeyType.Ed25519);
// Your account that you can use
var account = firstWallet.Account;
// Connect to a Substrate node
var client = new SubstrateClientExt(
new System.Uri(Constants.UNIQUE_NODE_URL),
ChargeTransactionPayment.Default());
await client.ConnectAsync();
// Get Account nonce
var nonce = await client.System.AccountNextIndexAsync(account.Value, CancellationToken.None);
// Nft data
var nft = new Nft
{
CollectionId = 2753,
Owner = account.Value, // Or any other string SS58 address
TokenName = "Unified",
ImageSource = "https://bafybeie5r4xjzjn3x6tl7anncjg62yhjzirpzucve4bwpfjhmblzsfpsuy.ipfs.nftstorage.link/",
};
// Get extrinsic details from REST api
var response = await NftModel.MintNftRestAsync(
nft,
nonce,
withFee: true
);
// Show the Fee to the user
Console.WriteLine($"Fee: {response.Fee.Amount} {response.Fee.Unit}");
// Custom callback to react on the extrinsic status change
Action<string, ExtrinsicStatus> myCallback = (string id, ExtrinsicStatus status) =>
{
if (status.ExtrinsicState == ExtrinsicState.Ready)
{
Console.WriteLine("Ready");
}
else if (status.ExtrinsicState == ExtrinsicState.Dropped)
{
Console.WriteLine("Dropped");
}
else if (status.ExtrinsicState == ExtrinsicState.InBlock)
{
Console.WriteLine("In block");
}
else if (status.ExtrinsicState == ExtrinsicState.Finalized)
{
Console.WriteLine("Finalized");
}
};
// Sign and Submit the Mint Nft extrinsic
uint? nftId = await client.SignAndSubmitMintNftExtrinsicAsync(account, response, myCallback);
// Your newly minted Nft id
Console.WriteLine("Nft id: " + nftId);
var collectionId = 2753;
var collection = await CollectionModel.GetCollectionByIdAsync(collectionId);
var collectionName = "C# is BEST";
var collections = await CollectionModel.GetCollectionsByNameAsync(collectionName, limit: 2);
var owner = account.Value;
var collections = await CollectionModel.GetCollectionsByOwnerAsync(owner);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.