IItem
type IItem = {
address: string;
tokenId: string;
itemType: ItemType;
amount: number;
isAutoLiquidated: boolean;
existingPlanId?: number;
privateSaleId?: number;
};
Field | Description |
---|---|
address | The collection address of the item |
tokenId | The token ID of the item |
amount | The number of items (must be 0 if the item is ERC721 or CryptoPunks) |
itemType | 1 -> ERC721 , 2 -> ERC1155 , 3 -> CryptoPunks |
isAutoLiquidated | Indicates if the item will use funds from the auto-liquidation (AL) vault or non-AL vault |
existingPlanId | If the item has an existing loan, this field holds the ID of the loan being refinanced |
privateSaleId | Indicates if the item is listed for private sale (holds the ID of the private listing) |
IItemWithPrice
/**
The `IItemWithPrice` type extends the `IItem` type by including additional field for item price.
*/
type IItemWithPrice = IItem & {
price: {
amount: BigNumber;
currency: string;
};
};
Field | Description |
---|---|
price | The price of the item. The price object includes a BigNumber string assigned to amount and a currency address assigned to currency |
IItemWithSelectedLoanOption
/**
The `IItemWithSelectedLoanOption` type extends the `IItem` type by including additional fields for pricing,
a loan option, and optional fields for existing plan ID and private sale ID.
*/
type IItemWithLoanOption = IItem & {
price: BigNumber;
option: IOption;
existingPlanId?: number;
privateSaleId?: number;
}
Field | Description |
---|---|
price | A BigNumber representing the price or appraisal of the item. |
option | An IOption object representing the loan option associated with the item. |
existingPlanId | An optional number indicating if the item has an existing loan that is being refinanced. |
privateSaleId | An optional number indicating if the item is listed for a private sale. |
ISdkPricerStep1Result
type ISdkPricerStep1Result = {
items: Array<IItem & {
price: BigNumber;
interestRate: number;
options: IOption[]
}>;
}
Field | Description |
---|---|
items | An array of items, where each item includes the base IItem fields along with the following properties: |
- price | A BigNumber representing the price or appraisal of the item. |
-interestRate | A number representing the base interest rate for the item. |
- options | An array of IOption objects, representing various loan plans available for the item. |
IPricedItemWithPlan
/**
The `IPricedItemWithPlan` type extends the `ICreatePlanParams` type by including additional fields
to indicate changes and optional market information.
*/
type IPricedItemWithPlan = Errored<ICreatePlanParams & { isChanged: boolean; marketName?: string }>
Field | Description |
---|---|
isChanged | A boolean indicating if the item has been modified. |
marketName | An optional string representing the name of the market related to the item. |
error | An optional string that provides an error message if any issues occurred while pricing the item |
...ICreatePlanParams | The fields of ICreatePlanParams |
ICreatePlanParams
type ICreatePlanParams = {
item: {
amount: number;
tokenId: string;
contractAddress: string;
cyanVaultAddress: string;
itemType: ItemType;
};
plan: {
amount: BigNumber;
downPaymentPercent: number;
interestRate: number;
serviceFeeRate: number;
term: number;
totalNumberOfPayments: number;
counterPaidPayments: number;
autoRepayStatus: AutoRepayStatus;
};
planId: number;
blockNum: number;
signature: string;
}
IOption
type IOption = {
term: number;
loanRate: number;
totalNumberOfPayments: number;
interestRate: number;
serviceFeeRate: number;
downpaymentRate: number;
counterPaidPayments: number;
downpaymentAmount: BigNumber;
monthlyAmount: BigNumber;
}
Field | Description |
---|---|
term | The loan term in seconds. |
loanRate | The loan rate applied for the loan plan. |
totalNumberOfPayments | The total number of payments required to repay the loan. |
interestRate | The interest rate applied to the loan. |
serviceFeeRate | The rate of the service fee associated with the loan. |
downpaymentRate | The percentage of the total price that must be paid as a downpayment. |
counterPaidPayments | A counter tracking the number of payments already made by the user. |
downpaymentAmount | A BigNumber representing the amount that needs to be paid upfront as a downpayment. |
monthlyAmount | A BigNumber representing the amount to be paid each term during the loan's duration. |
AutoRepayStatus
enum AutoRepayStatus {
Disabled = 0,
FromCyanWallet = 1,
FromMainWallet = 2,
}
Value | Description |
---|---|
Disabled (0) | Automatic repayments are disabled. |
FromCyanWallet (1) | Automatic repayments are made from the Cyan Wallet. |
FromMainWallet (2) | Automatic repayments are made from the Main Wallet. |
IPlanType
const PlanTypes = {
bnpl: 0,
pawn: 1,
} as const;
type IPlanType = typeof PlanTypes[keyof typeof PlanTypes];
Value | Description |
---|---|
0 | Buy Now, Pay Later (BNPL) plan type. |
1 | Pawn plan type. |
IPlan
const statusType = {
Pending: 0,
Funded: 1,
Activated: 2,
};
export interface IPlanStatus = typeof statusType[keyof typeof statusType];
interface IPlan {
planId: number;
owner: string;
totalNumOfPayments: number;
currentNumOfPayments: number;
status: IPlanStatus;
type: 'bnpl' | 'pawn';
paymentPlanContractAddress: string;
collectionAddress: string;
autoRepayStatus: AutoRepayStatus;
tokenId: string;
}
Field | Description |
---|---|
planId | The unique identifier for the plan. |
owner | The address of the owner of the plan. |
totalNumOfPayments | The total number of payments required for the plan. |
currentNumOfPayments | The number of payments that have been made so far. |
status | The current status of the plan (e.g., Pending, Funded, Activated). |
type | The type of the plan (e.g., 'bnpl' for Buy Now, Pay Later or 'pawn' for Pawn). |
collectionAddress | The address of the collection associated with the plan. |
tokenId | The token ID associated with the plan. |
paymentPlanContractAddress | The address of the contract managing the payment plan. |
autoRepayStatus | The status of automatic repayment. |
IOffer
export type IOffer = {
hash: string;
contract: string;
price: {
currency: {
contract: string;
decimals: number;
symbol: string;
name: string;
};
amount: {
raw: string;
decimal: number;
};
netAmount: {
raw: string;
decimal: number;
};
};
validUntil: number;
}
ICollectionsWithMaxLtvs
/** The `ICollectionsWithMaxLtvs` type represents an array of collection objects, each containing
information about the maximum loan-to-value (LTV) ratios for different currencies.
*/
type ICollectionsWithMaxLtvs = {
address: string;
maxLtvs: {
currencyAddress: string;
maxLtv: number;
}[];
}[];
Field | Description |
---|---|
address | The address of the collection. |
maxLtvs | An array of objects, each specifying the maximum loan-to-value (LTV) ratio for a given currency. |
currencyAddress | The address of the currency for which the maximum LTV is specified. |
maxLtv | The maximum loan-to-value ratio for the given currency, expressed as a percentage. |