Giter Site home page Giter Site logo

scanwatch's People

Contributors

etwnn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

scanwatch's Issues

discussion tab + feature

Hi. Repository discussion tab seems missing you can add it in settings.

Feature request:
Get address current erc20/erc721 (bep20/bep721) holdings.

My idea of implementation:

  1. get inputs and outputs separately
  2. compare them
  3. remove spent transactions
  4. result - all unspent inputs

My implementation of bep721 holdings:

from ScanWatch import ScanManager
from ScanWatch.utils.enums import NETWORK, TRANSACTION

api_token = ""
address = "0x8477f08df0d70f3b19e6241dcb1757363741ed7e"

manager = ScanManager(address, NETWORK.BSC, api_token, "test")

# manager.get_transactions(TRANSACTION.NORMAL)  # normal transactions

manager.update_all_transactions()

result = manager.get_transactions(TRANSACTION.ERC721)

trans_in = []
trans_out = []

print('Transactions: ')
for res in result:
    if res['from'] == address:
        trans_out.append(res)
        side = 'out'
    else:
        trans_in.append(res)
        side = 'in'

    print(f"from: {res['from']} / {side} / to: {res['to']} / contract: {res['contractAddress']} / token: {res['tokenID']} - {res['tokenName']} - {res['tokenSymbol']}")

final = trans_in

for x in trans_in:
    for out in trans_out:
        if (out['contractAddress'] == x['contractAddress'] and
                out['tokenID'] == x['tokenID'] and
                out['tokenName'] == x['tokenName'] and
                out['tokenSymbol'] == x['tokenSymbol']):
            final.remove(x)

print('Holdings: ')
for res in final:
    print(f"from: {res['from']} / to: {res['to']} / contract: {res['contractAddress']} / token: {res['tokenID']} - {res['tokenName']} - {res['tokenSymbol']}")

I'm not clearly sure if this is the right way of implementation (don't know how this will work if transactions failed etc.)

If you can natively implement this functional into library that's would be nice. Maybe you can do this with better/safer/optimized way

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.