Using Unity LDK

Initialise

  1. 1.
    Download the LibrtyDevKit.dll from our Librty-Unity and add the file as a new script asset to your unity game.
  2. 2.
    Get the api key by signing up at librty.xyz and use it to initialize LibrtyDevKit:
    LibrtyDevKit LDK = new LibrtyDevKit("<apiKey>");

Network Types

Use the following enum values as network parameter in apis calls:
Name
Value
Polygon Mainnet
LDKNetworkType.polygon
Ethereum Mainnet ( coming Soon )
LDKNetworkType.ethereum
Simulation ( Simulate response )
LDKNetworkType.simulation

Indexer APIs

Use following token related apis from our Indexer solution for following scenarios:
// get balance for a token in a wallet on a particular network
LDK.getTokenBalance("0xc2132d05d31c914a87c6611c10748aeb04b58e8f", "0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c", LDKNetworkType.polygon);
// get all transactions for a token for a wallet
LDK.getTokenTransaction("0xc2132d05d31c914a87c6611c10748aeb04b58e8f", "0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c", LDKNetworkType.polygon);
// get token price
LDK.getTokenPrice("0xc2132d05d31c914a87c6611c10748aeb04b58e8f", LDKNetworkType.polygon);
// get token info
LDK.getTokenInfo("0xc2132d05d31c914a87c6611c10748aeb04b58e8f", LDKNetworkType.polygon);
// get the balance of the native token for a network
LDK.getNativeTokenBalance("0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c", LDKNetworkType.polygon);
// get token allowance for any wallet (called spenderWallet here) for a token
LDK.getTokenAllowance("0xc2132d05d31c914a87c6611c10748aeb04b58e8f", "0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c","0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c", LDKNetworkType.polygon);
// get list of all tokens in a wallet
LDK.getTokensInWallet("0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c", LDKNetworkType.polygon);

NFT APIs

You can find NFT info as follows:
// get NFT Metada
LDK.getNFTInfo("0xa3aee8bce55beea1951ef834b99f3ac60d1abeeb", LDKNetworkType.polygon);
// get NFT Collection Information
LDK.getCollectionInfo("0xa3aee8bce55beea1951ef834b99f3ac60d1abeeb", LDKNetworkType.polygon);

Account APIs

You can get account and gas fee related info as follows:
// get transaction status and other details for a given transaction hash
LDK.getTransactionDetails("0x9a7d74bf44d927668c937e330273859b3cd080445d7124a030c78a46dc731bfc", LDKNetworkType.polygon);
// get the gas fee for a particular network
LDK.getGasFee("0x6fe489d80a48caf7472cd45f4258b9ffb5208e3c",LDKNetworkType.polygon);