Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'length') #6

Open
asdasdasdasdasdasdasdad opened this issue Jan 10, 2022 · 2 comments

Comments

@asdasdasdasdasdasdasdad

Hi. I need to trigger the bot for NEW sales.
I modified code:

const runSalesBot = async () => {
    console.log("starting sales bot...");
    const mostRecentSignature = await solanaConnection.getSignaturesForAddress(projectPubKey, { limit: 1 });
    const options = { until: mostRecentSignature[0].signature }

    let signatures;
    let lastKnownSignature;
    //const options = {};
    while (true) {
        try {
            const signatures = await solanaConnection.getSignaturesForAddress(projectPubKey, options);
            if (!signatures.length) {
                console.log("polling...")
                await timer(pollingInterval);
                continue;
            }
        } catch (err) {
            console.log("error fetching signatures: ", err);
            continue;
        }

Output:

starting sales bot...
polling...
polling...
polling...
polling...
polling...
polling...
polling...
polling...
polling...
polling...
polling...
/home/opc/nft-sales-bot/sales_bot.js:46
        for (let i = signatures.length - 1; i >= 0; i--) {
                                ^

TypeError: Cannot read properties of undefined (reading 'length')
    at runSalesBot (/home/opc/nft-sales-bot/sales_bot.js:46:33)

What i need to do? Thanks in advance

@Brandon1419
Copy link

Same issue

@AndreaZero
Copy link

same.. any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants