Get XRC20 token-related information from XDCSDKLib DLL by following the steps given below:
- Install the latest version of Visual Studio with .Net core v3.1 in Windows Operating System.
- Add all the supporting DLL files into the .Net core new project by adding project references.
The DLL files:- Nethereum.Web3.dll
- XDCSDKLib.dll
- BouncyCastle.Crypto.dll
- Common.Logging.Core.dll
- Nethereum.ABI.dll
- Nethereum.Accounts.dll
- Nethereum.BlockchainProcessing.dll
- Nethereum.Contracts.dll
- Nethereum.HdWallet.dll
- Nethereum.Hex.dll
- Nethereum.JsonRpc.Client.dll
- Nethereum.JsonRpc.RpcClient.dll
- Nethereum.KeyStore.dll
- Nethereum.Model.dll
- Nethereum.RLP.dll
- Nethereum.RPC.dll
- Nethereum.Signer.dll
- Nethereum.StandardTokenEIP20.dll
- Nethereum.Util.dll
- Newtonsoft.Json.dll
- ERC721ContractLibrary.dll
- We pushed all the above-listed DLLs into the branch “XDC-SDK-Supported-DLL’’.
Create an instance of the XRC20 token:
using XDCSDKLib;
IXRC20Token XRC20Token = new XRC20Token();
name
var name= await XRC20Token.GetTokenName(“contractAddress”, “BlockchainNetworkUrl”);
symbol
var symbol= await XRC20Token. GetSymbol (“contractAddress”, “BlockchainNetworkUrl”);
decimal
var decimal= await XRC20Token. GetDecimal (“contractAddress”, “BlockchainNetworkUrl”);
TotalSupply
var supply= await XRC20Token. GetTotalSupply (“contractAddress”, “BlockchainNetworkUrl”);
balanceOf
var balanceOf= await XRC20Token. GetBalanceOf (“contractAddress”, “BlockchainNetworkUrl”,”ownerAdddress”);
Allowance
var allowance= await XRC20Token. GetAllowance (“contractAddress”, ”ownerAdddress”,“BlockchainNetworkUrl”,” addressSpender”);
Approve
var approve= await XRC20Token. Approve(“contractAddress”, ” addressSpender”,” allowanceValue”,“BlockchainNetworkUrl”,”OwnerprivateKey”);
TransferFrom
var transferFrom= await XRC20Token. TransferFrom(“contractAddress”, ”OwnerAddress”,”addressTo”,” allowanceValue”,“BlockchainNetworkUrl”,”SpenderPrivateKey”);
Transfer
var transfer= await XRC20Token. Transfer(“contractAddress”,”addressTo”,”tokenValue”,“BlockchainNetworkUrl”,”OwnerprivateKey”);
IncreaseAllowance
var allowance= await XRC20Token. GetIncreasesAllowance (“contractAddress”,”OwnerAddress”,”addressSpender”,”increaseAllowance”,“BlockchainNetworkUrl”,”SpenderPrivateKey”);
DecreaseAllowance
var allowance= await XRC20Token. GetDecreaseAllowance (“contractAddress”,”OwnerAddress”,”addressSpender”,”decreasesAllowance”,“BlockchainNetworkUrl”,”SpenderPrivateKey”);
TransferXdcAmmount
var XdcAmmount= await XRC20Token. TransferXdcAmmount (“toAddress”,”amount”,“BlockchainNetworkUrl”,”ownerPrivateKey”);
Get XRC721 token-related information from XDCSDKLib DLL by following the steps given below:
Create an instance of the XRC20 token:
Using XDCSDKLib;
IXRC721Token xRC721Token = new XRC721Token();
name
var name= await xRC721Token.GetTokenName (“contractAddress”, “BlockchainNetworkUrl”);
symbol
var symbol= await xRC721Token. GetSymbol (“contractAddress”, “BlockchainNetworkUrl”);
decimal
var decimal= await xRC721Token. GetDecimal (“contractAddress”, “BlockchainNetworkUrl”);
TotalSupply
var supply= await xRC721Token. GetTotalSupply (“contractAddress”, “BlockchainNetworkUrl”);
balanceOf
var balanceOf= await xRC721Token. GetBalanceOf (“contractAddress”, “ownerAdddress”, “BlockchainNetworkUrl”);
tokenURI
var tokenURI= await xRC721Token. GetTokenURI (“contractAddress”, ”tokenId”,“BlockchainNetworkUrl”);
ownerOf
var ownerOf= await xRC721Token. GetOwnerOf (“contractAddress”, ”tokenId”,“BlockchainNetworkUrl”);
tokenOwnerbyIndex
var tokenOwnerbyIndex = await xRC721Token. GetTokenOfOwnerByIndex (“contractAddress”, ”ownerAddress”,”Index”,“BlockchainNetworkUrl”);
TokenByIndex
var tokenIndex = await xRC721Token. GetTokenByIndex (“contractAddress”, ” tokenByIndex”,“BlockchainNetworkUrl”);
GetApproved
var getApproved= await xRC721Token. GetApproved (“contractAddress”, ”tokenId”,“BlockchainNetworkUrl”);
supportsInterface
var supportsInterface= await xRC721Token. SupportsInterface (“contractAddress”, byte[] InterfaceId ,“BlockchainNetworkUrl”);
approve
var approve= await xRC721Token. Approve (“contractAddress”, “addresTo”,“tokenId”“BlockchainNetworkUrl”,”ownerPrivateKey”);
SetApprovalforAll
var setApproveAll= await xRC721Token. SetApprovalforAll (“contractAddress”, “addresTo”,approved “BlockchainNetworkUrl”,”ownerPrivateKey”);
IsApprovalforAll
var IsApprovalforAll= await xRC721Token. IsApprovalforAll (“contractAddress”, “OwnerAddress”,“operatorAddress”,“BlockchainNetworkUrl”,”ownerPrivateKey”);
Transferfrom
var tranFrom= await xRC721Token. TransferFrom (“contractAddress”, “addresTo”,“tokenId”“BlockchainNetworkUrl”,”ownerPrivateKey”);
SafeTransferFrom
var SafeTransferFrom = await xRC721Token. SafeTransferFrom (“contractAddress”,” fromAddress”,“addresTo”,“tokenId”“BlockchainNetworkUrl”,”ownerPrivateKey”);
Create the XRC account using the following code:
IAccount account=new Account();
account.CreateAccount(“password”,”workingDirectory”);
var privateKey = account.PrivateKey;
var accountAddress= account.AccountAddress;
Private Key can also be accessed from the working directory that is saved in the system by the following method:
Var privateKey= account.GetPrivateKey(“nameoffile”,”workingdirectory”,”password”);
- Install the SDK .net core 3.1 version on the server and publish the supported DLL files into the virtual directory of the server. We pushed all the supported DLLs for publishing the XDCSDKWebAPI into the branch PublishDllForXDCWebApi.
- As per requirements, change the URL of BlockNetworkChain into the appsettings.json file.
"XDCSDKUrl": {
"Url": "
https://rpc.apothem.network/
"
}
- Operating system: Windows 10 or upper version, windows server latest.
- Memory (RAM): minimum 8 GB
- Processor: Core I3 or above.