The pricer accepts a currency address and an array of NFT items as input, and returns possible loan options.
Pricing Step 1: Retrieve loan options for items
priceBnplsStep1
is an asynchronous method that performs the first step in pricing Buy Now, Pay Later (BNPL) or Pawn loans for a set of items. It retrieves pricing options for each item based on the provided currency and the current chain associated with the items.
Parameters
currencyAddress
(string
): The address of the currency to be financed for the loan.items
(Array of <IItem
|IItemWithPrice
>): An array of items to be priced. Each item can either be a basic item (IItem
) or an item with a pre-determined price (IItemWithPrice
).
Returns
- Promise<
ISdkPricerStep1Result
>: A promise that resolves to an object containing the array of items with generated loan options.
Example Usage
const currencyAddress = '0x123...'; // Replace with actual currency address
const items = [
{ address: '0xabc...', tokenId: '1', itemType: ItemType.ERC721, amount: 1, isAutoLiquidated: false },
{ address: '0xdef...', tokenId: '2', itemType: ItemType.ERC721, amount: 1, isAutoLiquidated: false, price: { amount: BigNumber.from(1000), currency: '0x123...' } }
];
// call pricer step 1 based on plan type
// BNPL - sdk.priceBnplsStep1()
// Pawn - sdk.pricePawnsStep1()
const pricedItems = await sdk.priceBnplsStep1(currencyAddress, items);
console.log(pricedItems);
Call pricer step 1 based on plan type
- For BNPL: Use
sdk.priceBnplsStep1()
- For Pawn: Use
sdk.pricePawnsStep1()
Notes
- This method is part of the pricing flow for creating loans. It interacts with an external API to get pricing information and applies specific loan options for each item.
- Ensure the provided
currencyAddress
is valid and supported by the chain the items are on. - The
items
array can include both items that need to be appraised (Pawn) and items that already have a price (BNPL), allowing for flexibility in the pricing process.