Jump to content
McKay Development

kast0l

Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by kast0l

  1. The trade is successfully sent and confirmed, but then problems arise and I don’t understand why, if the cookies are set correctly

    async function SteamTrade(client, account, cookies) {
        const community = new SteamCommunity();
        community.setCookies(cookies);
        const manager = new TradeOfferManager({
            steam: client,
            community: community,
            language: 'en',
        });
     
    await confirmTradeOffer(status, community, account.identity_secret);
                    manager.getOffer(offer.id, (err, offerDetails) => {
                        if (err) {
                            console.error(`${offer.id}: ${err}`);
                            reject(err);
                        } else {
                            console.log(`${offer.id} `);
                            const itemsToGive = offerDetails.itemsToGive;
                            console.log( itemsToGive);
                            resolve({offerDetails, itemsToGive});
                        }
                    });
    the error occurs after this block of code
  2. @NickersI figured out what the problem was, I needed to look at the library more carefully, for your case I tested this code and everything was successfully confirmed for me 

    async function confirmTradeOffers(community, identitySecret) {
        const time = SteamTotp.time();
        const confKey = SteamTotp.getConfirmationKey(identitySecret, time, 'conf');
        const allowKey = SteamTotp.getConfirmationKey(identitySecret, time, 'allow');
     
        return new Promise((resolve, reject) => {
            community.acceptAllConfirmations(time, confKey, allowKey, (err, confs) => {
                if (err) {
                    console.error(`Ошибка при подтверждении всех трейдов: ${err}`);
                    reject(`Ошибка подтверждения: ${err}`);
                } else {
                    console.log(`Все трейды успешно подтверждены. Подтверждено трейдов: ${confs.length}`);
                    resolve(`Трейды подтверждены успешно. Подтверждено трейдов: ${confs.length}`);
                }
            });
        });
    }
     
    await confirmTradeOffers(community, account.identity_secret);
  3. identitySecret in this format JGhCjFThpoOCuCH4...=,time in this format is 1708401621,data about identitySecret is taken from maFille and they are correct, I checked, since trades are successfully confirmed through SDA,confKey in this format DAgRR7dVxGjC9axkJaf3M...=,offerid also match, but I don't understand why this error occurs Error: Invalid authenticator

    here is part of the code that confirms trades and calls this function

    async function confirmTradeOffer(community, offer, identitySecret) {
        const time = SteamTotp.time();
        const confKey = SteamTotp.getConfirmationKey(identitySecret, time, 'allow');
     
        console.log(`Подтверждение трейда с следующими данными:`);
        console.log(`- ID трейда: ${offer.id}`);
        console.log(`- Время (Unix Timestamp): ${time}`);
        console.log(`- Ключ подтверждения: ${confKey}`);
        console.log(`- IdentitySecret: ${identitySecret}`);
     
        return new Promise((resolve, reject) => {
            community.acceptConfirmationForObject(offer.id, confKey, (err) => {
                if (err) {
                    console.error(`Ошибка подтверждения трейда ID ${offer.id}: ${err}`);
                    reject(`Ошибка подтверждения трейда: ${err}`);
                } else {
                    console.log(`Трейд ID ${offer.id} успешно подтвержден.`);
                    resolve('Трейд подтвержден успешно.');
                }
            });
        });
    }
     
    const confirmResult = await confirmTradeOffer(community, offer, account.identitySecret);
    console.log(confirmResult);
    break;
  4. console output:
    Login: starlivovsky5 completed successfully

    Total accounts connected: 1 from 1
    All accounts are successfully connected.
    Process Node.js ended with code 0
    Function execution time: 10.006s
    PS C:\Users\Kast0l\Desktop\tetst script>

    Please help me solve this problem or at least understand what it is

    const SteamUser = require("steam-user");
    const SteamTotp = require("steam-totp");
    const accounts = require("./accounts.js");
     
    let totalConnectedAccounts = 0;
     
    const logInAccounts = async () => {
        for (let account of accounts) {
            const client = new SteamUser
     
            const logInOptions = {
                accountName: account.accountName,
                password: account.password,
                twoFactorCode: SteamTotp.generateAuthCode(account.sharedSecret)
            };
     
            try {
                await new Promise((resolve, reject) => {
                    client.logOn(logInOptions);
     
                    client.once("loggedOn", () => {
                        totalConnectedAccounts++;
                        console.log(`Login: ${account.accountName} completed successfully`);
                        resolve();
                    });
     
                    client.once("error", (err) => {
                        console.log(`Ошибка при входе для аккаунта ${account.accountName}: ${err}`);
                        reject(err);
                    });
                });
            } finally {
                await client.logOff();
            }
        }
     
        console.log(`\nTotal accounts connected: ${totalConnectedAccounts} from ${accounts.length}`);
        console.log("All accounts are successfully connected.");
     
        console.time("Function execution time");
        process.on('exit', (code) => {
            console.log(`Process Node.js ended with code ${code}`);
            console.timeEnd("Function execution time");
        });
    };
     
    logInAccounts()
×
×
  • Create New...