Code Monkey home page Code Monkey logo

opensea-sales-twitter-bot's Issues

Last sale (in seconds since Unix epoch): undefined

hi griffin,

first off, thanks for setting this up. i have one question about increasing the interval.

2021-09-02T06:37:33.825569+00:00 app[worker.1]: Last sale (in seconds since Unix epoch): undefined

I changed the interval from 60000 to 120000 at line 81 in app.js. is that how this should be done?

Why is X_API_KEY now mandatory

Hey, love the bot - has been running really well.

Recently stopped working and I noticed the code changes that now require an OS API key?

I have fetched the new updates and applied for an API key, however, the doco says that the key is not mandatory?

Not sure if the OpenSea doco has not been updated or if it’s just the way the bot uses the API?

Infinite loop on events due to inacurracy between seconds and miliseconds ?

My bot has been stuck reposting the same event over and over.
From my investigation, I'm surprised the problem didn't seem to emerge earlier and I don't totally get it.

curl 'https://api.opensea.io/api/v1/events?collection_slug=cryptocubes&occurred_after=1645787316' -H 'Accept: application/json' -H "X-API-KEY: $API_KEY" | jq '.asset_events[-1]'

Result

{
  "approved_account": null,
  "asset": {
    "id": 17168260,
    "num_sales": 3,
    "background_color": null,
    "image_url": "https://lh3.googleusercontent.com/1juN1Mbi52rVbspQtDG9-Ichs8_WdCH2L6gwx3yFlpv-PKfETMZ8haemFX8veXul31wwLb_ScwxIN0RkDUPF8gMmKQ",
    "image_preview_url": "https://lh3.googleusercontent.com/1juN1Mbi52rVbspQtDG9-Ichs8_WdCH2L6gwx3yFlpv-PKfETMZ8haemFX8veXul31wwLb_ScwxIN0RkDUPF8gMmKQ=s250",
    "image_thumbnail_url": "https://lh3.googleusercontent.com/1juN1Mbi52rVbspQtDG9-Ichs8_WdCH2L6gwx3yFlpv-PKfETMZ8haemFX8veXul31wwLb_ScwxIN0RkDUPF8gMmKQ=s128",
    "image_original_url": "https://ipfs.io/ipfs/QmQQPBFQ221xKcMo31k4pKbEwQwHAZugV2qHjWhdGZ47c8/image.gif",
    "animation_url": null,
    "animation_original_url": null,
    "name": "CryptoCube#136",
    "description": "Join the punk movement.  \n\nExhibit your CryptoCube in 3d platforms.",
    "external_link": "https://app.rarible.com/token/0xdbb163b22e839a26d2a5011841cb4430019020f9:152",
    "asset_contract": {
      "address": "0xdbb163b22e839a26d2a5011841cb4430019020f9",
      "asset_contract_type": "non-fungible",
      "created_date": "2020-10-04T16:51:37.658205",
      "name": "CryptoCubes",
      "nft_version": "3.0",
      "opensea_version": null,
      "owner": 12077606,
      "schema_name": "ERC721",
      "symbol": "CC",
      "total_supply": "0",
      "description": "CryptoCubes are algorithmically generated metaverse-native 3d NFT collectibles.\r\n\r\nLimited to 256\r\n\r\nCreated by Han.",
      "external_link": "https://app.rarible.com/collection/0xdbb163b22e839a26d2a5011841cb4430019020f9",
      "image_url": "https://lh3.googleusercontent.com/X_V_EbYK5XpjO_j1AETDTUkolFCx-HJzcpM5TtMbI3bVN1ny4wVvXcX_BYzcAkzbTHjtW0mgGNmqOSRiejhr3tPt=s120",
      "default_to_fiat": false,
      "dev_buyer_fee_basis_points": 0,
      "dev_seller_fee_basis_points": 1000,
      "only_proxied_transfers": false,
      "opensea_buyer_fee_basis_points": 0,
      "opensea_seller_fee_basis_points": 250,
      "buyer_fee_basis_points": 0,
      "seller_fee_basis_points": 1250,
      "payout_address": "0xbf28421a82186bf50f496ab937c3368b55adbf19"
    },
    "permalink": "https://opensea.io/assets/0xdbb163b22e839a26d2a5011841cb4430019020f9/152",
    "collection": {
      "banner_image_url": "https://lh3.googleusercontent.com/eMwxxLlB7W8Psnr61OLliEFQlA8Bt5Y4tz1KXiEZaDD83t4IxIJcQMIZfm9ClVr5ATBOZxSLKcuGhtV_kdl4dVcs=s2500",
      "chat_url": null,
      "created_date": "2020-10-20T19:31:14.007197",
      "default_to_fiat": false,
      "description": "CryptoCubes are algorithmically generated metaverse-native 3d NFT collectibles.\r\n\r\nLimited to 256\r\n\r\nCreated by Han.",
      "dev_buyer_fee_basis_points": "0",
      "dev_seller_fee_basis_points": "1000",
      "discord_url": "https://discord.gg/cryptocubes",
      "display_data": {
        "card_display_style": "contain"
      },
      "external_url": "https://app.rarible.com/collection/0xdbb163b22e839a26d2a5011841cb4430019020f9",
      "featured": false,
      "featured_image_url": null,
      "hidden": false,
      "safelist_request_status": "verified",
      "image_url": "https://lh3.googleusercontent.com/X_V_EbYK5XpjO_j1AETDTUkolFCx-HJzcpM5TtMbI3bVN1ny4wVvXcX_BYzcAkzbTHjtW0mgGNmqOSRiejhr3tPt=s120",
      "is_subject_to_whitelist": false,
      "large_image_url": "https://lh3.googleusercontent.com/X_V_EbYK5XpjO_j1AETDTUkolFCx-HJzcpM5TtMbI3bVN1ny4wVvXcX_BYzcAkzbTHjtW0mgGNmqOSRiejhr3tPt",
      "medium_username": null,
      "name": "CryptoCubes",
      "only_proxied_transfers": false,
      "opensea_buyer_fee_basis_points": "0",
      "opensea_seller_fee_basis_points": "250",
      "payout_address": "0xbf28421a82186bf50f496ab937c3368b55adbf19",
      "require_email": false,
      "short_description": null,
      "slug": "cryptocubes",
      "telegram_url": null,
      "twitter_username": "CubesCrypto",
      "instagram_username": null,
      "wiki_url": null
    },
    "decimals": 0,
    "token_metadata": "https://ipfs.io/ipfs/QmaMDuYvnNU9HcLKXm419Lu3KafRPt56kccj7xmtHJiRtU",
    "owner": {
      "user": {
        "username": "Futureis"
      },
      "profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/23.png",
      "address": "0x1fdc7ec0a099dadf4643faea7cd0fcee23075932",
      "config": ""
    },
    "token_id": "152"
  },
  "asset_bundle": null,
  "auction_type": null,
  "bid_amount": "10000000000000000000",
  "collection_slug": "cryptocubes",
  "contract_address": "0x7f268357a8c2552623316e2562d90e642bb538e5",
  "created_date": "2022-02-25T11:08:36.706701",
  "custom_event_name": null,
  "dev_fee_payment_event": null,
  "dev_seller_fee_basis_points": 1000,
  "duration": null,
  "ending_price": null,
  "event_type": "offer_entered",
  "from_account": {
    "user": {
      "username": "M4T"
    },
    "profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/15.png",
    "address": "0x6bf97f2534be2242ddb3a29bfb24d498212dcded",
    "config": ""
  },
  "id": 3676682692,
  "is_private": null,
  "owner_account": null,
  "payment_token": {
    "id": 2,
    "symbol": "WETH",
    "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "image_url": "https://storage.opensea.io/files/accae6b6fb3888cbff27a013729c22dc.svg",
    "name": "Wrapped Ether",
    "decimals": 18,
    "eth_price": "1.000000000000000",
    "usd_price": "2630.679999999999836000"
  },
  "quantity": "1",
  "seller": null,
  "starting_price": null,
  "to_account": null,
  "total_price": null,
  "transaction": null,
  "winner_account": null,
  "listing_time": null
}

The returned event created_date is 2022-02-25T11:08:36.706701
Now if we make a moment out of it, we get

> const moment = require('moment');
> moment("2022-02-25T11:08:36.706701").unix()
1645787316

The resulting request will be https://api.opensea.io/api/v1/events?collection_slug=cryptocubes&occurred_after=1645787316 again, and that will fetch and post the same event again. Just incrementing the timestamp by 1 will prevent the problem to happen (but we might miss some events !)

Am I the only one experiencing the problem ? Was occured_after exclusive of timestamp and became inclusive ?

Why I am getting this error

2021-11-24T10:24:07.827195+00:00 app[worker.1]: [Symbol(kCapture)]: false,
2021-11-24T10:24:07.827195+00:00 app[worker.1]: [Symbol(kNeedDrain)]: false,
2021-11-24T10:24:07.827195+00:00 app[worker.1]: [Symbol(corked)]: 0,
2021-11-24T10:24:07.827196+00:00 app[worker.1]: [Symbol(kOutHeaders)]: [Object: null prototype]
2021-11-24T10:24:07.827196+00:00 app[worker.1]: },
2021-11-24T10:24:07.827196+00:00 app[worker.1]: data: 'error code: 1020'
2021-11-24T10:24:07.827196+00:00 app[worker.1]: },
2021-11-24T10:24:07.827196+00:00 app[worker.1]: isAxiosError: true,
2021-11-24T10:24:07.827197+00:00 app[worker.1]: toJSON: [Function: toJSON]
2021-11-24T10:24:07.827197+00:00 app[worker.1]: }

lastSaleTime: undefined

re: https://github.com/KadeStroude/immutable-x-marketplace-sales-twitter-bot (a fork of your code!)

Hi @dsgriffin, or anyone else - would you mind please assisting me with this?

I am not super familiar with some of the libraries you have used, however made a few changes to the section of 'app.js' where you pull data from OpenSea every 60 seconds:

  • Changed the moment(). units to 'toISOOString().' (from 'unix().' - as that is incompatible with the Immutable X API)
  • Changed the API url to Immutable X's API (from OpenSea)
  • Changed the params such that they were relevant to the new API

I then tried to make some ammendments to the events / response section and the outcome has been my lastSaleTime variable is consistently 'undefined'. Do you know where I am going wrong please?

https://docs.x.immutable.com/reference/get_v1-applications-1

Last sale (in seconds since Unix epoch): undefined

Anyone else have the issue of the bot suddenly stop posting tweet of sales only message seen in logs every 1-2 mins
Last sale (in seconds since Unix epoch): undefined

update: twitter seems to suspend accounts thinking its spam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.