2022-01-11 20:05:07 +01:00
|
|
|
import { Purgatory } from '@oceanprotocol/lib'
|
2021-10-13 18:48:59 +02:00
|
|
|
import { fetchData } from './fetch'
|
2021-03-17 11:44:26 +01:00
|
|
|
|
2020-11-20 14:31:28 +01:00
|
|
|
const purgatoryUrl = 'https://market-purgatory.oceanprotocol.com/api/'
|
|
|
|
|
2021-03-17 11:44:26 +01:00
|
|
|
export interface PurgatoryDataAccount {
|
|
|
|
address: string
|
|
|
|
reason: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getAccountPurgatoryData(
|
|
|
|
address: string
|
|
|
|
): Promise<PurgatoryDataAccount> {
|
2021-10-18 20:44:33 +02:00
|
|
|
const data = (await fetchData(
|
|
|
|
`${purgatoryUrl}account?address=${address}`
|
|
|
|
)) as PurgatoryDataAccount[]
|
2021-03-17 11:44:26 +01:00
|
|
|
return { address: data[0]?.address, reason: data[0]?.reason }
|
2020-11-20 14:31:28 +01:00
|
|
|
}
|