Coder Social home page Coder Social logo

nodejs interface about xpub-scan HOT 10 CLOSED

ledgerhq avatar ledgerhq commented on September 15, 2024 4
nodejs interface

from xpub-scan.

Comments (10)

meriadec avatar meriadec commented on September 15, 2024 2

I would say the current codebase should be refactored to make this smooth. Today you could probably hack thing around like

const { init } = require("@ledgerhq/xpub-scan/lib/helpers");
const checkBalance = require("@ledgerhq/xpub-scan/lib/actions/checkBalance");

async function main() {
  const xpub =
    "tpubDCR8dij5wujL48XPKtQATpKUEQkJL2VkuKrtypXXba7hWSjW8uziMYVud6HHT99egY4BG1WUJ3z8hcDvdwrWGvTuk8AfbqF6euw1F2gRvUj";

  const silent = false;
  const quiet = false;
  const currency = "BTC";
  const testnet = undefined;
  const derivationMode = undefined;

  init(xpub, silent, quiet, currency, testnet, derivationMode);

  const res = await checkBalance.run(xpub);

  console.log(res);
}

main()

from xpub-scan.

glethuillier avatar glethuillier commented on September 15, 2024 1

@sambP Yes, this function returns all addresses with at least one operation. Therefore, you will have all past movements. Xpub Scan systematically retrieves all active addresses, that is addresses that had been used and addresses that are currently being used.

from xpub-scan.

pavlogs avatar pavlogs commented on September 15, 2024

I would vote to have this feature as well

from xpub-scan.

glethuillier avatar glethuillier commented on September 15, 2024

This is a great idea. It will require some refactoring. We will definitely take a look at this, @sambP.

from xpub-scan.

sambP avatar sambP commented on September 15, 2024

Thanks @meriadec, works so far. The only problem is, that I have to scan multiple pubs in parallel, it would be nice to get an instance of init() somehow.

Sounds great, @glethuillier. I know everyone hates time estimates, but would it be possible to give me one? :) We need this feature for our product and I have to decide if I just wait or try to build a solution for myself.

from xpub-scan.

sambP avatar sambP commented on September 15, 2024

I checked the code, running checkBalance in parellel with different xpubs seems to work fine, as long as they can share the global configuration. We use only btc xpubs, so no problems for us and no time estimates anymore needed :)

Looking forward for an official solution.

from xpub-scan.

sambP avatar sambP commented on September 15, 2024

@meriadec sorry but one question a little bit offtopic, do I get with the checkBalance.run function also addresses which are currently empty but hold assets in the past? I would need them to find all movements.

from xpub-scan.

meriadec avatar meriadec commented on September 15, 2024

I think @glethuillier should be able to answer as he's the author of the lib, I would rather not saying sh*t 😄

To answer your previous questions about how the code will evolve in the future, I don't think we can give you satisfying answers for now. This tool has been initially built for internal QA purposes first, although we already considered splitting in into more manageable & documented pieces (e.g: balance module, comparison module..) but it will probably take time.

But feedbacks always appreciated :)

from xpub-scan.

glethuillier avatar glethuillier commented on September 15, 2024

A PR dedicated to this topic from @pglushchenko-ledger has just been merged: #75

from xpub-scan.

glethuillier avatar glethuillier commented on September 15, 2024

Here is the documentation associated with this feature.

This issue can be closed.

from xpub-scan.

Related Issues (20)

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.