|
@@ -62,6 +62,22 @@ async function startFaucet(concurrency, index) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+function getAndroidModel() {
|
|
|
+ const models = [
|
|
|
+ 'Mi 9',
|
|
|
+ 'LIO-AN00',
|
|
|
+ 'PCRT00',
|
|
|
+ 'V1824A',
|
|
|
+ 'SM-N9760',
|
|
|
+ 'HD1900',
|
|
|
+ 'SKW-A0',
|
|
|
+ 'NX629J',
|
|
|
+ 'M973Q',
|
|
|
+ 'PCLM10',
|
|
|
+ ]
|
|
|
+ return models[Math.floor(Math.random() * models.length)]
|
|
|
+}
|
|
|
+
|
|
|
function formatDateTime(date) {
|
|
|
function pad(number, length) {
|
|
|
return number.toString().padStart(length, '0')
|
|
@@ -92,10 +108,45 @@ function formatDateTime(date) {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+async function getDeviceId(model: string, httpsAgent): Promise<string> {
|
|
|
+ const client = axios.create({
|
|
|
+ httpsAgent: httpsAgent,
|
|
|
+ headers: {
|
|
|
+ 'X-Android-Package': 'xyz.lunchlunch.app',
|
|
|
+ 'x-firebase-client':
|
|
|
+ 'H4sIAAAAAAAAAKtWykhNLCpJSk0sKVayio7VUSpLLSrOzM9TslIyUqoFAFyivEQfAAAA',
|
|
|
+ 'X-Android-Cert': '841CB3E1F4FC6CD420202DD419E02D4EE2E2099B',
|
|
|
+ 'x-goog-api-key': 'AIzaSyA1PYciMbJ03xonKRM3JBr4yTReQ67GeuU',
|
|
|
+ 'User-Agent': `Dalvik/2.1.0 (Linux; U; Android 9; ${model} Build/PQ3B.190801.05281822)`,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ const deviceId = generateRandomString(22)
|
|
|
+ await client.post(
|
|
|
+ 'https://firebaseinstallations.googleapis.com/v1/projects/lunchlunch-fb95e/installations',
|
|
|
+ {
|
|
|
+ fid: deviceId,
|
|
|
+ appId: '1:383319257117:android:1a7c776df5c7048bddd6f4',
|
|
|
+ authVersion: 'FIS_v2',
|
|
|
+ sdkVersion: 'a:18.0.0',
|
|
|
+ },
|
|
|
+ )
|
|
|
+ return deviceId
|
|
|
+}
|
|
|
+
|
|
|
+async function getRawMessage(address: string, message: string, duid: string) {
|
|
|
+ const resp = await axios.post('https://rem.mtdao.io/create', {
|
|
|
+ address,
|
|
|
+ message,
|
|
|
+ duid,
|
|
|
+ })
|
|
|
+ return resp.data
|
|
|
+}
|
|
|
+
|
|
|
async function faucetLunch(concurrency: number = 8) {
|
|
|
const now = new Date()
|
|
|
const accounts = await DBClient.instance.account.findMany({
|
|
|
where: {
|
|
|
+ address: 'init1h0qsw44vys2lavgf0zj0cj32w9vstpns43hf77',
|
|
|
lastRun: {
|
|
|
lt: new Date(now.getTime() - 24 * 60 * 60 * 1000),
|
|
|
},
|
|
@@ -111,7 +162,6 @@ async function faucetLunch(concurrency: number = 8) {
|
|
|
if (!account.gmail) account.gmail = `${generateRandomString(8)}@gmail.com`
|
|
|
if (!account.xrpPrivateKey)
|
|
|
account.xrpPrivateKey = xrpl.Wallet.generate().seed
|
|
|
- if (!account.duid) account.duid = uuidv4().toUpperCase()
|
|
|
|
|
|
const key = new MnemonicKey({ mnemonic: account.mnemonic })
|
|
|
const evmWallet = new ethers.Wallet(key.privateKey.toString('hex'))
|
|
@@ -119,14 +169,21 @@ async function faucetLunch(concurrency: number = 8) {
|
|
|
signedAt: formatDateTime(new Date()),
|
|
|
})
|
|
|
const evmSignedMessage = await evmWallet.signMessage(message)
|
|
|
- const rawMessage = ''
|
|
|
- const deviceModel = 'Mi 9'
|
|
|
+ const deviceModel = getAndroidModel()
|
|
|
+ const proxyAgent = getProxyAgent()
|
|
|
+ if (!account.duid || account.duid.includes('-'))
|
|
|
+ account.duid = await getDeviceId(deviceModel, proxyAgent)
|
|
|
+ const rawMessage = await getRawMessage(
|
|
|
+ evmWallet.address,
|
|
|
+ message,
|
|
|
+ account.duid,
|
|
|
+ )
|
|
|
const deviceOS = 'Android 9'
|
|
|
const client = axios.create({
|
|
|
headers: {
|
|
|
'Lunch-Language': 'EN',
|
|
|
'lunch-fiat-currency': 'USD',
|
|
|
- 'lunch-app-duid': 'ddolHGLkR1efgLFeHNLCNM',
|
|
|
+ 'lunch-app-duid': account.duid,
|
|
|
'lunch-app-version': '0.17.3',
|
|
|
'lun-app-build': 46,
|
|
|
'Lunch-Device-Model': deviceModel,
|
|
@@ -134,7 +191,7 @@ async function faucetLunch(concurrency: number = 8) {
|
|
|
'Lunch-Platform': 'Android',
|
|
|
'user-agent': `lunch/0.17.3(46) (Linux; ${deviceOS}; ${deviceModel} Build/PQ3B.190801.05281822)`,
|
|
|
},
|
|
|
- httpsAgent: getProxyAgent(),
|
|
|
+ httpsAgent: proxyAgent,
|
|
|
})
|
|
|
|
|
|
const resp = await client.post(
|
|
@@ -151,27 +208,30 @@ async function faucetLunch(concurrency: number = 8) {
|
|
|
] = `Bearer ${resp.data.accessToken}`
|
|
|
|
|
|
const xrplWallet = xrpl.Wallet.fromSeed(account.xrpPrivateKey)
|
|
|
+ let needRegister = false
|
|
|
try {
|
|
|
const memberResp = await client.get(
|
|
|
'https://api.lunchlunch.xyz/v1/member',
|
|
|
)
|
|
|
} catch (e) {
|
|
|
-
|
|
|
+ if (e.response.status === 404) {
|
|
|
+ needRegister = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (needRegister) {
|
|
|
+ const register = await client.post(
|
|
|
+ 'https://api.lunchlunch.xyz/v1/member/register',
|
|
|
+ {
|
|
|
+ evmWalletAddress: evmWallet.address,
|
|
|
+ initiaWalletAddress: key.accAddress,
|
|
|
+ isImportedWallet: true,
|
|
|
+ firstInitiaWalletAddress: key.accAddress,
|
|
|
+ email: account.gmail,
|
|
|
+ xrplWalletAddress: xrplWallet.address,
|
|
|
+ },
|
|
|
+ )
|
|
|
+ console.log(`${index}: register done`)
|
|
|
}
|
|
|
-
|
|
|
- const register = await client.post(
|
|
|
- 'https://api.lunchlunch.xyz/v1/member/register',
|
|
|
- {
|
|
|
- evmWalletAddress: evmWallet.address,
|
|
|
- initiaWalletAddress: key.accAddress,
|
|
|
- isImportedWallet: true,
|
|
|
- firstInitiaWalletAddress: key.accAddress,
|
|
|
- email: account.gmail,
|
|
|
- xrplWalletAddress: xrplWallet.address,
|
|
|
- },
|
|
|
- )
|
|
|
- console.log(`${index}: register done`)
|
|
|
-
|
|
|
await client.post(
|
|
|
'https://api.lunchlunch.xyz/v1/dish/submit-action/airdrop',
|
|
|
{
|
|
@@ -207,7 +267,7 @@ async function faucetLunch(concurrency: number = 8) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-await faucetLunch(1)
|
|
|
+await faucetLunch(40)
|
|
|
//
|
|
|
// const phase =
|
|
|
// 'leave bone supply chair brain thunder giant fatigue winter shrimp father stairs'
|