using XDCSDKLib;
IXRC20Token XRC20Token = new XRC20Token();
Read methods
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”);
Write Methods
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”);
XRC721 Token Integration
Get XRC721 token-related information from XDCSDKLib DLL by following the steps given below:
Getting Started
Create an instance of the XRC20 token:
Using XDCSDKLib;
IXRC721Token xRC721Token = new XRC721Token();
Read Methods
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”);
Write Methods
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 an XRC account
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”);
How to Publish the XDCSDKWebApi into the server?
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.