Links

Get Credit Lines

async getCreditLine()

This function will check if the user already has credit lines. We need this function because if the user wants to create a loan which already belongs to a credit line he has already created, he will not need to create another one.
  • token:string – is the token you will get from the authentication
  • ownerAddress:string - is the address of the user
  • sort:string – can be either “ASC” or “DESC”. ASC is ascending order and DESC is descending order.
  • limit:number – the number of the data you want to get
  • offset:number – the number from where you want to start the data
limit and offset are mostly used for pagination. This means that offset most of the time will equal 0 and limit 100.
const response = await this.newBorrowingService.getCreditLines({
token,
ownerAddress,
sort,
limit,
offset
})
This is an example of the successful response object of this function:
"creditLines": [
{
"contractAddress": "0x3851115bcEf299b3FCC590caeEFB3E8a71e1Df8B"
"createdAt": "2022-03-21T12:34:45.000Z"
"ownerAddress": "0x9694e69C2ADE5779677672B55d762d7d5F37E58b"
"type": "Type C Loan"
"updatedAt": "2022-03-22T12:50:16.000Z"
},
{
"contractAddress": "0xB874BC19C2139810ccbB59e007D6787550cD04Fe"
"createdAt": "2022-03-21T12:33:35.000Z"
"ownerAddress": "0x9694e69C2ADE5779677672B55d762d7d5F37E58b"
"type": "Type A Loan"
"updatedAt": "2022-03-22T14:10:16.000Z"
}
]