mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
28 lines
589 B
TypeScript
28 lines
589 B
TypeScript
import axios, { AxiosResponse } from 'axios'
|
|
import { oceanConfig } from '../../app.config'
|
|
|
|
export interface FaucetResponse {
|
|
success: boolean
|
|
message: string
|
|
trxHash?: string
|
|
}
|
|
|
|
export default async function getFromFaucet(
|
|
account: string
|
|
): Promise<FaucetResponse> {
|
|
try {
|
|
const response: AxiosResponse = await axios({
|
|
method: 'POST',
|
|
url: `${oceanConfig.faucetUri}/faucet`,
|
|
data: {
|
|
address: account,
|
|
agent: 'market'
|
|
}
|
|
})
|
|
|
|
return response.data
|
|
} catch (error) {
|
|
return { success: false, message: error.message }
|
|
}
|
|
}
|