|
@@ -1,16 +1,16 @@
|
|
import axios, { AxiosInstance } from 'axios'
|
|
import axios, { AxiosInstance } from 'axios'
|
|
import dotenv from 'dotenv'
|
|
import dotenv from 'dotenv'
|
|
import polly from 'polly-js'
|
|
import polly from 'polly-js'
|
|
-import { solveChallenge, solveChallengeWorkers } from 'shawnlu96-altcha-lib'
|
|
|
|
|
|
+import { solveChallengeWorkers } from 'shawnlu96-altcha-lib'
|
|
import * as os from 'node:os'
|
|
import * as os from 'node:os'
|
|
dotenv.config()
|
|
dotenv.config()
|
|
const cpus = os.cpus()
|
|
const cpus = os.cpus()
|
|
console.log('current cores', cpus.length)
|
|
console.log('current cores', cpus.length)
|
|
-const googlekey = '6LdLhtYpAAAAAOe1xmceNR-i6MTtzq7N6AYztoVI'
|
|
|
|
|
|
+const googlekey = '6Lf-lU0qAAAAAN6q-4UEs3ifAFHAgZXRiL6JD-3T'
|
|
const hCaptchaKey = '04d28d90-d5b9-4a90-94e5-a12c595bd4e2'
|
|
const hCaptchaKey = '04d28d90-d5b9-4a90-94e5-a12c595bd4e2'
|
|
-const captchaApiKey = process.env.CAPTCHA_API_KEY
|
|
|
|
|
|
+const captchaApiKey = '3fa9ccf791a4178915c4e52f7be1cb41'
|
|
|
|
|
|
-export async function getRecaptcha(address: string) {
|
|
|
|
|
|
+export async function getRecaptcha() {
|
|
return await polly()
|
|
return await polly()
|
|
.waitAndRetry(2)
|
|
.waitAndRetry(2)
|
|
.executeForPromise(async () => {
|
|
.executeForPromise(async () => {
|
|
@@ -18,7 +18,7 @@ export async function getRecaptcha(address: string) {
|
|
method: 'userrecaptcha',
|
|
method: 'userrecaptcha',
|
|
key: captchaApiKey,
|
|
key: captchaApiKey,
|
|
googlekey,
|
|
googlekey,
|
|
- pageUrl: `https://faucet.testnet.initia.xyz/?address=${address}`,
|
|
|
|
|
|
+ pageUrl: `https://faucet.testnet.initia.xyz/`,
|
|
json: 1,
|
|
json: 1,
|
|
action: 'verify',
|
|
action: 'verify',
|
|
})
|
|
})
|
|
@@ -30,7 +30,7 @@ export async function getRecaptcha(address: string) {
|
|
`https://2captcha.com/res.php?key=${captchaApiKey}&action=get&id=${request}&json=1`,
|
|
`https://2captcha.com/res.php?key=${captchaApiKey}&action=get&id=${request}&json=1`,
|
|
)
|
|
)
|
|
const token = captchaRes.data.request
|
|
const token = captchaRes.data.request
|
|
- console.log(token)
|
|
|
|
|
|
+ // console.log(token)
|
|
if (token === 'CAPCHA_NOT_READY') throw new Error('CAPCHA_NOT_READY')
|
|
if (token === 'CAPCHA_NOT_READY') throw new Error('CAPCHA_NOT_READY')
|
|
if (!token) throw new Error('no result')
|
|
if (!token) throw new Error('no result')
|
|
return token
|
|
return token
|