Skip to content

Instantly share code, notes, and snippets.

@Jcomper
Created February 23, 2024 09:48
Show Gist options
  • Save Jcomper/d5e4a2b8db74f8299497ec231f403611 to your computer and use it in GitHub Desktop.
Save Jcomper/d5e4a2b8db74f8299497ec231f403611 to your computer and use it in GitHub Desktop.
Fixed script from https://thorlab.io/ for okx-whitelist
(function() {
const wallets = [
"0x88c6C46EBf353A52Bdbab708c23D0c81dAA8134A",
"0x8eaD0E8FEc8319Fd62C8508c71a90296EfD4F042",
];
const names = [
"wallet1",
"wallet2",
];
const walletSelectors = [];
const nameSelectors = [];
for (let i = 3; i <= 98; i += 5) {
walletSelectors.push(
`#scroll-box > div > div > form > div:nth-child(6) > div > div > div > div > div:nth-child(${i}) > div.balance_okui-form-item-control > div > div > div > div > input.balance_okui-input-input`
);
}
for (let i = 5; i <= 100; i += 5) {
nameSelectors.push(
`#scroll-box > div > div > form > div:nth-child(6) > div > div > div > div > div:nth-child(${i}) > div.balance_okui-form-item-control > div > div > div > div > input.balance_okui-input-input`
);
}
const addButtonSelector =
"#scroll-box > div > div > form > div:nth-child(6) > div > div > div > div > div.add-address-form-btn";
function fillInput(input, value) {
input.setAttribute('value', value);
input.dispatchEvent(new Event('input', { bubbles: true }));
}
async function addWallets() {
for (let i = 0; i < wallets.length; i++) {
console.log(`Добавление кошелька ${i + 1} из ${wallets.length}`);
const addressInput = document.querySelector(walletSelectors[i]);
const nameInput = document.querySelector(nameSelectors[i]);
fillInput(addressInput, wallets[i]);
await new Promise((resolve) => setTimeout(resolve, 300));
if (names.length > 0) {
fillInput(nameInput, names[i]);
await new Promise((resolve) => setTimeout(resolve, 400));
}
if (i < wallets.length - 1) {
const button = document.querySelector(addButtonSelector);
button.click();
await new Promise((resolve) => setTimeout(resolve, 1000));
}
}
console.log('Завершено');
}
addWallets();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment