Loan

API Integration for Loan Application with StreamNFT

1. Create a Bid Pool

This operation creates a bid pool for a specific collection.

StartCoroutine(SendRequest("http://api.streamnft.tech/initPool", "POST", new
{
  interestrate = "1",
  graceperiod = "10",
  collection = "1YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  loanduration = "10",
  secret = "4uzLYRhX2dnsgUZVNNY82TNFCZbDFt5D9KLJuTFM8X2mc83ACEybEAi8aurEEZJTkSBwp8xg65KKP2ot1cj5Cz56", //Optional (providing secret send on-chain transaction)
  raw = false //Optional (return raw transaction)
}));

2. Get Bid Pool

This operation retrieves the bid pool.

StartCoroutine(SendRequest("http://api.streamnft.tech/getBidPool", "GET", null));// Some code

3. Add Liquidity

This operation adds liquidity to a created Bid Pool.

StartCoroutine(SendRequest("http://api.streamnft.tech/initManager", "POST", new
{
  biddingool = "1YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  bidamount = "100", // amount in lamports,
  totalbids = "10", // total bids
  secret = "4uzLYRhX2dnsgUZVNNY82TNFCZbDFt5D9KLJuTFM8X2mc83ACEybEAi8aurEEZJTkSBwp8xg65KKP2ot1cj5Cz56", //Optional (providing secret send on-chain transaction)
  raw = false //Optional (return raw transaction)
}));

4. Get Bid Manager

This operation retrieves the bid manager.

StartCoroutine(SendRequest("http://api.streamnft.tech/getBidManager", "GET", null));// Some code

5. Get User Assets

This operation retrieves the assets of a specific user.

string userAddress = "userAddressHere"; // Replace with the actual user address
StartCoroutine(SendRequest($"http://api.streamnft.tech/getUserAssets/{userAddress}", "GET", null));

6. Get Asset Manager

This operation retrieves the asset manager.


string mint = "NFTmint"; // Replace with the NFT mint
StartCoroutine(SendRequest($"http://api.streamnft.tech/getAssetInfo/{mint}", "GET", null));

7. Take Loan

Collection holders can claim loan on their NFTs.

StartCoroutine(SendRequest("http://api.streamnft.tech/processLoan", "POST", new
{
  biddingpool = "1YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  biddingmanager = "2YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  secret = "4uzLYRhX2dnsgUZVNNY82TNFCZbDFt5D9KLJuTFM8X2mc83ACEybEAi8aurEEZJTkSBwp8xg65KKP2ot1cj5Cz56",
  raw = false 
}));

8. Repay Loan

Repay loan already taken by the user.

StartCoroutine(SendRequest("http://api.streamnft.tech/repayLoan", "POST", new
{
  biddingpoolaccount = "1YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  biddingmanager = "2YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  nftmint = "3YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa33",
  secret = "4uzLYRhX2dnsgUZVNNY82TNFCZbDFt5D9KLJuTFM8X2mc83ACEybEAi8aurEEZJTkSBwp8xg65KKP2ot1cj5Cz56", //Optional (providing secret send on-chain transaction)
  raw = false //Optional (return raw transaction)
}));

9. Remove Liquidity

Liquidity providers can remove provided liquidity.

StartCoroutine(SendRequest("http://api.streamnft.tech/cancelmanager", "POST", new
{
  biddingpool = "1YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
  biddingmanager = "2YeSmq9njjsyr4AYb1LDzdooUaVJThXdgH34Z6Gpaa3h",
    secret = "4uzLYRhX2dnsgUZVNNY82TNFCZbDFt5D9KLJuTFM8X2mc83ACEybEAi8aurEEZJTkSBwp8xg65KKP2ot1cj5Cz56", //Optional (providing secret send on-chain transaction)
  raw = false //Optional (return raw transaction)
}));

Last updated