Generated by DocFX

Class NFTHelpers

Helper static class for the NFT Operations and especially preparation of the NFT data

Inheritance
System.Object
NFTHelpers
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: VEDriversLite.NFT
Assembly: VEDriversLite.dll
Syntax
public static class NFTHelpers

Fields

| Improve this Doc View Source

AllowedTokens

List of the allowed tokens. If you want to use your own tokens you can add them here The hash is the Token hash of the NTP1 token created on the Neblio network

Declaration
public static List<string> AllowedTokens
Field Value
Type Description
System.Collections.Generic.List<System.String>
| Improve this Doc View Source

BDPTokenId

Main default Data storage tokens in VEFramework - BDP

Declaration
public static string BDPTokenId
Field Value
Type Description
System.String
| Improve this Doc View Source

TokenId

Main default tokens in VEFramework - VENFT

Declaration
public static string TokenId
Field Value
Type Description
System.String
| Improve this Doc View Source

WDOGETokenId

WDOGE token

Declaration
public static string WDOGETokenId
Field Value
Type Description
System.String

Methods

| Improve this Doc View Source

CheckIfContainsNFTData(String, GetTransactionInfoResponse)

this function will obtain tx metadata and check if it contains flag NFT true

Declaration
public static async Task<Dictionary<string, string>> CheckIfContainsNFTData(string utxo, GetTransactionInfoResponse info = null)
Parameters
Type Name Description
System.String utxo
GetTransactionInfoResponse info
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.String, System.String>>
| Improve this Doc View Source

CheckIfMintTx(String, GetTransactionInfoResponse)

This function will check if the transaction is mint transaction. it means if the input to this tx was lot of the tokens. This kind of transaction means origin for the NFTs.

Declaration
public static async Task<(bool, string)> CheckIfMintTx(string utxo, GetTransactionInfoResponse info = null)
Parameters
Type Name Description
System.String utxo
GetTransactionInfoResponse info
Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>>
| Improve this Doc View Source

DeInitHandlers()

Deinit handler to receive event info messages from Neblio Transaction Helpers class

Declaration
public static void DeInitHandlers()
| Improve this Doc View Source

FindEventOnTheAddress(String, String, ICollection<Utxos>)

this function will search the utxos, get all nfts utxos (if utxos list is not loaded) and return last profile nft which is founded on the address.

Declaration
public static async Task<INFT> FindEventOnTheAddress(string address, string nftOriginTxId, ICollection<Utxos> utxos = null)
Parameters
Type Name Description
System.String address
System.String nftOriginTxId
System.Collections.Generic.ICollection<Utxos> utxos

leave null if you need to obtain new utxos nft list

Returns
Type Description
System.Threading.Tasks.Task<INFT>
| Improve this Doc View Source

FindProfileNFT(ICollection<INFT>)

This function will return first profile NFT in NFTs list.

Declaration
public static ProfileNFT FindProfileNFT(ICollection<INFT> nfts)
Parameters
Type Name Description
System.Collections.Generic.ICollection<INFT> nfts
Returns
Type Description
ProfileNFT
| Improve this Doc View Source

FindProfileOfAddress(String, ICollection<Utxos>)

this function will search the utxos, get all nfts utxos (if utxos list is not loaded) and return last profile nft which is founded on the address.

Declaration
public static async Task<INFT> FindProfileOfAddress(string address, ICollection<Utxos> utxos = null)
Parameters
Type Name Description
System.String address
System.Collections.Generic.ICollection<Utxos> utxos

leave null if you need to obtain new utxos nft list

Returns
Type Description
System.Threading.Tasks.Task<INFT>
| Improve this Doc View Source

GetChangeNFTTxData(String, INFT)

This function will change NFT data. In NFT image and music it will be not relevant because it will always search for origin data even if you will rewrite it.

Declaration
public static async Task<SendTokenTxData> GetChangeNFTTxData(string address, INFT nft)
Parameters
Type Name Description
System.String address

sender address

INFT nft

Input NFT object with data to save to metadata. Must contain Utxo hash

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>

New Tx Id Hash

| Improve this Doc View Source

GetIoTMessageNFTTransaction(String, String, EncryptionKey, INFT, ICollection<Utxos>, ICollection<Utxos>)

This function will new Post NFT.

Declaration
public static async Task<Transaction> GetIoTMessageNFTTransaction(string address, string receiver, EncryptionKey ekey, INFT NFT, ICollection<Utxos> nutxos, ICollection<Utxos> tutxos)
Parameters
Type Name Description
System.String address

sender address

System.String receiver

Receiver of the NFT

EncryptionKey ekey

Encryption Key object of the address

INFT NFT

Input NFT object with data to save to metadata

System.Collections.Generic.ICollection<Utxos> nutxos

List of spendable neblio utxos if you have it loaded.

System.Collections.Generic.ICollection<Utxos> tutxos

List of spendable token utxos if you have it loaded.

Returns
Type Description
System.Threading.Tasks.Task<NBitcoin.Transaction>

New Tx Id Hash

| Improve this Doc View Source

GetMessageNFTTransaction(String, String, EncryptionKey, INFT, ICollection<Utxos>, ICollection<Utxos>, BitcoinSecret, String)

This function will new Post NFT.

Declaration
public static async Task<Transaction> GetMessageNFTTransaction(string address, string receiver, EncryptionKey ekey, INFT NFT, ICollection<Utxos> nutxos, ICollection<Utxos> tutxos, BitcoinSecret secret, string rewriteAuthor = "")
Parameters
Type Name Description
System.String address

sender address

System.String receiver

Receiver of the NFT

EncryptionKey ekey

Encryption Key object of the address

INFT NFT

Input NFT object with data to save to metadata

System.Collections.Generic.ICollection<Utxos> nutxos

List of spendable neblio utxos if you have it loaded.

System.Collections.Generic.ICollection<Utxos> tutxos

List of spendable token utxos if you have it loaded.

NBitcoin.BitcoinSecret secret
System.String rewriteAuthor

You can rewrite author and use the Profile NFT hash,etc.

Returns
Type Description
System.Threading.Tasks.Task<NBitcoin.Transaction>

New Tx Id Hash

| Improve this Doc View Source

GetMintMultiNFTData(String, INFT, String, List<String>)

This function will new Post NFTs as multimint. It means in one transaction it will create multiple 1 tokens outputs which are NFTs with same origin metadata.

Declaration
public static async Task<MintNFTData> GetMintMultiNFTData(string address, INFT NFT, string receiver = "", List<string> multipleReceivers = null)
Parameters
Type Name Description
System.String address

sender address

INFT NFT

Input NFT object with data to save to metadata

System.String receiver

Receiver of the NFT

System.Collections.Generic.List<System.String> multipleReceivers
Returns
Type Description
System.Threading.Tasks.Task<MintNFTData>

New Tx Id Hash

| Improve this Doc View Source

GetMintNFTData(String, EncryptionKey, INFT, String)

This function will new NFTs.

Declaration
public static async Task<MintNFTData> GetMintNFTData(string address, EncryptionKey ekey, INFT NFT, string receiver = "")
Parameters
Type Name Description
System.String address

sender address

EncryptionKey ekey

Encryption Key object of the address

INFT NFT

Input NFT object with data to save to metadata

System.String receiver

Receiver of the NFT

Returns
Type Description
System.Threading.Tasks.Task<MintNFTData>

New Tx Id Hash

| Improve this Doc View Source

GetNFTPaymentData(String, String, INFT, ICollection<Utxos>)

This function will send payment for some NFT.

Declaration
public static async Task<SendTokenTxData> GetNFTPaymentData(string address, string receiver, INFT nft, ICollection<Utxos> nutxos)
Parameters
Type Name Description
System.String address

sender address

System.String receiver

Receiver of the NFT

INFT nft

Input NFT object with data to save to metadata. It is NFT what you are buying.

System.Collections.Generic.ICollection<Utxos> nutxos

List of spendable neblio utxos if you have it loaded.

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>

New Tx Id Hash

| Improve this Doc View Source

GetNFTTxData(String, String, INFT, Boolean, Double, Boolean, Double)

This function will send NFT. It can be also used for write the price of the NFT.

Declaration
public static async Task<SendTokenTxData> GetNFTTxData(string address, string receiver, INFT NFT, bool priceWrite, double price = 0.0002, bool withDogePrice = false, double dogeprice = 1)
Parameters
Type Name Description
System.String address

adress of sender

System.String receiver

address of receiver

INFT NFT

Input NFT object with data to save to metadata. It is NFT what you are sending.

System.Boolean priceWrite

Set this if you just want to set price of the NFT. means resend to yourself

System.Double price

Price must be higher than 0.0002 Neblio

System.Boolean withDogePrice

Set if Doge Price should be written

System.Double dogeprice

Set doge price, min 0.1

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>

New Tx Id hash

| Improve this Doc View Source

GetNFTWithOwner(String)

This function will load the NFT based by Tx Id hash and find the owner of the NFT

Declaration
public static async Task<(bool, GetNFTOwnerDto)> GetNFTWithOwner(string txid)
Parameters
Type Name Description
System.String txid
Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, GetNFTOwnerDto>>
| Improve this Doc View Source

GetPubKeyFromLastFoundTx(String)

This function will find last send transaction by some address and parse public key (NBitcoin class) from it. Usefull for encryption.

Declaration
public static async Task<(bool, PubKey)> GetPubKeyFromLastFoundTx(string address)
Parameters
Type Name Description
System.String address
Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, NBitcoin.PubKey>>
| Improve this Doc View Source

GetPubKeyFromProfileNFTTx(String)

This function will find profile on address if exists and parse address public key (NBitcoin class) from it. Usefull for encryption

Declaration
public static async Task<(bool, PubKey)> GetPubKeyFromProfileNFTTx(string address)
Parameters
Type Name Description
System.String address
Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, NBitcoin.PubKey>>
| Improve this Doc View Source

GetTokenIssueTxData(String, String, UInt64, String, String, String, String, String, String, IDictionary<String, String>)

This function will create Dto for issue Token tx transaction

Declaration
public static async Task<IssueTokenTxData> GetTokenIssueTxData(string issuingAddress, string receiver, ulong amount, string tokenSymbol, string issuerNick, string description, string imageLink, string imageFileName, string imageType, IDictionary<string, string> metadata = null)
Parameters
Type Name Description
System.String issuingAddress
System.String receiver
System.UInt64 amount
System.String tokenSymbol
System.String issuerNick
System.String description
System.String imageLink
System.String imageFileName
System.String imageType
System.Collections.Generic.IDictionary<System.String, System.String> metadata
Returns
Type Description
System.Threading.Tasks.Task<IssueTokenTxData>
| Improve this Doc View Source

GetTokenTxDataCopy(String, PaymentNFT, INFT)

This function will take some NFT which was matched with some payment as copy, coppy data and create complete payment, which will send NFT to new owner. During this the payment NFT token is send back to project address

Declaration
public static async Task<SendTokenTxData> GetTokenTxDataCopy(string address, PaymentNFT payment, INFT NFT)
Parameters
Type Name Description
System.String address

sender address

PaymentNFT payment

Payment NFT of received payment

INFT NFT

NFT for sale

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>
| Improve this Doc View Source

GetTxDataForDestroyNFTs(String, ICollection<INFT>, String)

This function will destroy selected NFTs

Declaration
public static async Task<SendTokenTxData> GetTxDataForDestroyNFTs(string address, ICollection<INFT> nfts, string receiver = "")
Parameters
Type Name Description
System.String address

sender address

System.Collections.Generic.ICollection<INFT> nfts

Input NFTs to destroy

System.String receiver

Receiver of the NFT

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>
| Improve this Doc View Source

GetTxDataForNFTTicket(String, INFT)

This function will write Used flag to the NFT Ticket

Declaration
public static async Task<SendTokenTxData> GetTxDataForNFTTicket(string address, INFT NFT)
Parameters
Type Name Description
System.String address

adress of sender

INFT NFT

Input NFT object with data to save to metadata. It is NFT what you are sending.

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>

New Tx Id hash

| Improve this Doc View Source

GetTxDataForOrderedNFT(String, PaymentNFT, INFT)

This function will take some NFT which was matched with some payment, coppy data and create complete payment, which will send NFT to new owner. During this the payment NFT token is send back to project address

Declaration
public static async Task<SendTokenTxData> GetTxDataForOrderedNFT(string address, PaymentNFT payment, INFT NFT)
Parameters
Type Name Description
System.String address

sender address

PaymentNFT payment

Payment NFT of received payment

INFT NFT

NFT for sale

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>
| Improve this Doc View Source

GetTxDataForReturnNFTPayment(String, PaymentNFT)

This function will return payment to the original sender.

Declaration
public static async Task<SendTokenTxData> GetTxDataForReturnNFTPayment(string address, PaymentNFT nft)
Parameters
Type Name Description
System.String address

sender address

PaymentNFT nft

Input PaymentNFT.

Returns
Type Description
System.Threading.Tasks.Task<SendTokenTxData>

New Tx Id Hash

| Improve this Doc View Source

InitHandlers()

Init handler to receive event info messages from Neblio Transaction Helpers class

Declaration
public static void InitHandlers()
| Improve this Doc View Source

InitNFTHelpers()

Add allowed tokens during the initialization

Declaration
public static async Task InitNFTHelpers()
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

IsBuyableNFT(NFTTypes)

Return true if the type is allowed to buy and sell Actually are supported Image, Music, Post, Ticket NFTs.

Declaration
public static bool IsBuyableNFT(NFTTypes nftType)
Parameters
Type Name Description
NFTTypes nftType
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LoadAddressNFTMessages(String, String, ICollection<INFT>)

Load just the Messages on the address - between the addresses

Declaration
public static async Task<List<INFT>> LoadAddressNFTMessages(string aliceAddress, string bobAddress, ICollection<INFT> innfts = null)
Parameters
Type Name Description
System.String aliceAddress
System.String bobAddress
System.Collections.Generic.ICollection<INFT> innfts
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.List<INFT>>
Exceptions
Type Condition
System.Exception
| Improve this Doc View Source

LoadAddressNFTs(String, ICollection<Utxos>, ICollection<INFT>, Boolean, Int32, Boolean, Boolean, Boolean)

This function will find all NFTs and load them to the carriers. If you already have list of utxos and NFTs you can provide it and it will load just the changes.

Declaration
public static async Task<List<INFT>> LoadAddressNFTs(string address, ICollection<Utxos> inutxos = null, ICollection<INFT> innfts = null, bool fireProfileEvent = false, int maxLoadedItems = 0, bool withoutMessages = false, bool justMessages = false, bool justPayments = false)
Parameters
Type Name Description
System.String address

Address with this NFTs

System.Collections.Generic.ICollection<Utxos> inutxos

Input Utxos collection

System.Collections.Generic.ICollection<INFT> innfts

Input NFTs collection

System.Boolean fireProfileEvent

If you find profile, fire the event

System.Int32 maxLoadedItems

Limit number of loaded items

System.Boolean withoutMessages

Do not load messages

System.Boolean justMessages

Load just messages

System.Boolean justPayments

Load just Payments

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.List<INFT>>
| Improve this Doc View Source

LoadAddressNFTsWithProfile(String)

This function will load NFTs and during it find the profile NFT

Declaration
public static async Task<(INFT, List<INFT>)> LoadAddressNFTsWithProfile(string address)
Parameters
Type Name Description
System.String address
Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<INFT, System.Collections.Generic.List<INFT>>>

profile NFT and list of all NFTs

| Improve this Doc View Source

LoadLastData(String)

This will load just last transaction metadata if it is NFT metadata. This function will not iterate to start/origin. It is used for example in Post

Declaration
public static async Task<LoadNFTOriginDataDto> LoadLastData(string utxo)
Parameters
Type Name Description
System.String utxo
Returns
Type Description
System.Threading.Tasks.Task<LoadNFTOriginDataDto>
| Improve this Doc View Source

LoadNFTOriginData(String, Boolean, GetTransactionInfoResponse)

This function will iterate through inputs of tx from the point of the utxo to find tx where this 1 token was splited from some lot. Metadata from this founded tx is returned for load to NFT carrier. This method is now used for "original" NFTs. It is for example Image and Music.

Declaration
public static async Task<LoadNFTOriginDataDto> LoadNFTOriginData(string utxo, bool checkIfUsed = false, GetTransactionInfoResponse txinfo = null)
Parameters
Type Name Description
System.String utxo
System.Boolean checkIfUsed

if you are checking the NFT ticket you should set this flag

GetTransactionInfoResponse txinfo
Returns
Type Description
System.Threading.Tasks.Task<LoadNFTOriginDataDto>
| Improve this Doc View Source

LoadNFTsHistory(String)

Returns list of NFTs with the data of the point of this history of some NFT.

Declaration
public static async Task<List<INFT>> LoadNFTsHistory(string utxo)
Parameters
Type Name Description
System.String utxo
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.List<INFT>>

Events

| Improve this Doc View Source

NewEventInfo

New event happened - IEventInfo type of the message

Declaration
public static event EventHandler<IEventInfo> NewEventInfo
Event Type
Type Description
System.EventHandler<IEventInfo>
| Improve this Doc View Source

NFTLoadingStateChanged

This event is called profile nft is found in the list of nfts

Declaration
public static event EventHandler<string> NFTLoadingStateChanged
Event Type
Type Description
System.EventHandler<System.String>
| Improve this Doc View Source

ProfileNFTFound

This event is called profile nft is found in the list of nfts

Declaration
public static event EventHandler<INFT> ProfileNFTFound
Event Type
Type Description
System.EventHandler<INFT>