Git Product home page Git Product logo

slpjs's Issues

Is simpleBchSend reliable to be used?

is simpleBchSend function reliable to be used? I noticed it's not documented so wanted to ask if there is a reason?

I guess as far as I could understand it does not filter the utxos and should be supplied with the array item of nonSlpUtxos from getAllSlpBalancesAndUtxos(). Am I correct?

Websockets

I'd like to listen for token transactions using the API at slpdb. Is this the library that would enable that? I cannot find documentation for this

Throwing error while using simpleTokenSend function

I'm using a transaction very similar to the example on the Readme to send a SLP token (or NFT). The same transaction works pretty well on v0.24.0 but it will burn the NFT because there is no support for it in that version. So I upgraded to v.27.11 which by semver versioning shouldn't have any backward incompatibility but same transaction doesn't work anymore and throw this error:

Uncaught (in promise) TypeError: "list" argument must be an Array of Buffers
    concat index.js:399
    pushdata util.js:8
    createOpReturnSend util.js:152
    send tokentype1.js:7
    buildSendOpReturn slptokentype1.js:50
    buildSendOpReturn slp.js:128
    simpleTokenSend transactionhelpers.js:90
    simpleTokenSend bitboxnetwork.js:260
    step bitboxnetwork.js:52
    verb bitboxnetwork.js:33
    __awaiter bitboxnetwork.js:27
    __awaiter bitboxnetwork.js:23
    simpleTokenSend bitboxnetwork.js:255
    _callee2$ transactions.js:101
    Babel 14
    sendSlpTx transactions.js:57

Apparently the problem is with slp_mdm_1.TokenType1.send(tokenIdHex, outputQtyArray); and new slp-mdm library because on versions before addition of this, same tx is working fine. Any ideas?

Question about prospect of this project

Hi @jcramer
I'm planning to create a pull request for this project.
Since this project relies on bitbox.js which is unmaintained/deprecate.
So I was wondering if there a plan to continue to maintain this project going forward?
Thank

test failed

It looks like an error that fails to handle bignumber.js, but I don't know how to deal with it.

I didn't understand the relationship between slpjs and spl-mdm, so I posted it here.


git clone https://github.com/simpleledger/slpjs.git
yarn install
yarn test

that log >>

lib/slptokentype1.ts:36:41 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default'.
Types have separate declarations of a private property '_isBigNumber'.

36 initialQuantity
~~~~~~~~~~~~~~~

lib/slptokentype1.ts:57:41 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default'.

57 initialQuantity
~~~~~~~~~~~~~~~

lib/slptokentype1.ts:72:52 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default[]' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default[]'.
Type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default' is not assignable to type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default'.

72 return TokenType1.send(tokenIdHex, outputQtyArray);
~~~~~~~~~~~~~~

lib/slptokentype1.ts:80:52 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default[]' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default[]'.

80 return NFT1.Child.send(tokenIdHex, outputQtyArray);
~~~~~~~~~~~~~~

lib/slptokentype1.ts:82:52 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default[]' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default[]'.

82 return NFT1.Group.send(tokenIdHex, outputQtyArray);
~~~~~~~~~~~~~~

lib/slptokentype1.ts:91:63 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default'.

91 return TokenType1.mint(tokenIdHex, batonVout, mintQuantity);
~~~~~~~~~~~~

lib/slptokentype1.ts:95:63 - error TS2345: Argument of type 'import("/Users/jasagiri/src/slpjs/node_modules/bignumber.js/bignumber").default' is not assignable to parameter of type 'import("/Users/jasagiri/src/slpjs/node_modules/slp-mdm/node_modules/bignumber.js/bignumber").default'.

95 return NFT1.Group.mint(tokenIdHex, batonVout, mintQuantity);
~~~~~~~~~~~~

Found 7 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Token change issue

static async sendToken(tokenId, sendAmount, fundingAddress, fundingWif, tokenReceiverAddress, bchChangeReceiverAddress){

There are two issues with the bitboxnetwork.sendToken() method.

  1. When token change is 0 there is a dust output still created to receive 0 tokens.
  2. Address for receiving the token change should be the same as the bchChangeAddress parameter
  3. Rename the bchChangeAddress parameter so that it is clear that both token change and bch change are going back to this address.

Also, if this isn't provided where does the change go? The funding address?

SLPJS fails to get token UTXOs

I'm still investigating this issue. This GitHub Issue will be used to track the data as I uncover the root-cause. I've followed the trail to slpjs and suspect the issue I'm seeing is caused by the switch to SLPDB v1.

Overview

The slp-sdk e2e test recently started failing, with the error Could not find any SLP token UTXOs. The error is originating from this line in the slp-sdk send() method of the TokenType1.ts library.

That bitboxNetwork.getTokenInformation(tokenId) call is returning a query from SLPDB with the slpTokenUtxos property as an empty object for an address that does have a token UTXO. This is ultimately what is causing the error.

I'm not familiar with the slpjs code base. It appears to be calling Bitcore? Then makes a query SLPDB. I can't seem to follow the code at this point.

I suspect that the root cause of this issue is one of two possible sources:

  • Changes we've recently made to rest.bitcoin.com to switch the SLP endpoints to use SLPDB v1.
  • Changes in SLPDB v1 that no longer support whatever query is being made.

I've updated slp-sdk to use the latest version slpjs (v0.24.3) with no change.

Unit Tests call Network

One of the things I'm a stickler on is that unit tests not make network calls. The primary differences between unit and integration tests, is that unit tests do not call external services. External services need to be mocked for unit tests, and live for integration tests.

If unit tests make external calls, then any CI system relying on unit tests will fail when those services fail, and then bad things happen. The reliability of the CI system is thrown into question and the ability to push a fix fails if the CI can't pass tests and validate the PR.

I ran all tests on slpjs and they passed. But then I turned off my wifi and ran the tests again. The following tests failed:

165 passing (113ms)
  12 failing

  1) BitdbNetwork
       getTokenInformation()
         returns token information for a given valid tokenId:
     Error: getaddrinfo ENOTFOUND bitdb.bch.sx bitdb.bch.sx:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  2) BitdbNetwork
       getTokenInformation()
         throws when tokeId is not found:

      AssertionError [ERR_ASSERTION]: 'getaddrinfo ENOTFOUND bitdb.bch.sx bitdb.bch.sx:443' == 'Token not found'
      + expected - actual

      -getaddrinfo ENOTFOUND bitdb.bch.sx bitdb.bch.sx:443
      +Token not found
      
      at Context.it (test/bitdbnetwork.js:36:24)
      at process._tickCallback (internal/process/next_tick.js:68:7)

  3) JsonRpcProxyValidator
       mainnet isValidSlpTxid()
         returns true for a valid SEND token transaction:
     Error: getaddrinfo ENOTFOUND validate.simpleledger.info validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  4) JsonRpcProxyValidator
       mainnet isValidSlpTxid()
         returns false for an unknown txid:
     Error: getaddrinfo ENOTFOUND validate.simpleledger.info validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  5) JsonRpcProxyValidator
       mainnet isValidSlpTxid()
         returns true for MINT transaction:
     Error: getaddrinfo ENOTFOUND validate.simpleledger.info validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  6) JsonRpcProxyValidator
       mainnet validateSlpTransactions()
         works for valid SEND token transactions:
     Error: getaddrinfo ENOTFOUND validate.simpleledger.info validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  7) JsonRpcProxyValidator
       mainnet validateSlpTransactions()
         works for invalid SEND token transactions:
     Error: getaddrinfo ENOTFOUND validate.simpleledger.info validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  8) JsonRpcProxyValidator
       testnet isValidSlpTxid()
         returns true for a valid SEND token transaction:
     Error: getaddrinfo ENOTFOUND testnet-validate.simpleledger.info testnet-validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  9) JsonRpcProxyValidator
       testnet isValidSlpTxid()
         returns false for an unknown txid:
     Error: getaddrinfo ENOTFOUND testnet-validate.simpleledger.info testnet-validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  10) JsonRpcProxyValidator
       testnet isValidSlpTxid()
         returns true for MINT transaction:
     Error: getaddrinfo ENOTFOUND testnet-validate.simpleledger.info testnet-validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  11) JsonRpcProxyValidator
       testnet validateSlpTransactions()
         works for valid SEND token transactions:
     Error: getaddrinfo ENOTFOUND testnet-validate.simpleledger.info testnet-validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)

  12) JsonRpcProxyValidator
       testnet validateSlpTransactions()
         works for invalid SEND token transactions:
     Error: getaddrinfo ENOTFOUND testnet-validate.simpleledger.info testnet-validate.simpleledger.info:443
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)



npm ERR! Test failed.  See above for more details.

Post Office-like state

Is it possible to get a transaction into a state similar to what Vin Armani proposes with a Post Office, i.e. to get inputs and outputs of SLP signed, then serialize the transaction to hex and unserialize it server-side, add BCH inputs to pay for the fee.

I looked at buildRawSendTx, it's nearly possible to build a tx with signed SLP inputs/outputs only, as I see it, but it seems that it'll throw Error("Transaction input BCH amount is too low. Add more BCH inputs to fund this transaction.");, but even if that's avoidable by creating a copy of buildRawSendTx - let's say I serialize the TX to hex, is there a way to unserialize it from hex back to TransactionBuilder at the server-side (let's assume node.js + slp) to add the BCH inputs?

Also are there plans to support Post Offices officially in slpjs?

Any guidance would be greatly appreciated! Thank you!

Can I decouple this from bitbox network?

Is it possible to use the util functions in this library to judge the UTXOs that I receive from other nodes? For example from BCHD or insomnia which gives you indexed UTXOs.

npm install slpjs facing errors

I have node version running 12.8.2
During installation of slpjs and all other related packages facing the following error

image

Help required..

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.