Bitcoin-com / slp-sdk

Simple Ledger Protocol SDK powered by BITBOX
https://developer.bitcoin.com/slp
MIT License
20 stars 32 forks source link

Cannot read property 'concat' of undefined on sending #62

Open blockparty-sh opened 5 years ago

blockparty-sh commented 5 years ago

I am reposting this error from here: https://github.com/Bitcoin-com/badger/issues/197

Just in case someone is looking here for same problem. I am pretty sure I have gotten this bug in slp-sdk as well, possibly due to some network issue (rest being down/responding incorrectly perhaps?).

kirkins commented 4 years ago

Hello I'm having the same issue. I believe the same code is being used successfully elsewhere so I'm wondering why it fails in my case.

Input config below with funding wif switched out:

sendConfig:  { fundingAddress: 'simpleledger:qqaza4qqgnazt7zxexta6zv2gvcyp64kqgdaf0v6vq',
  fundingWif: 'cUCSrdhu7mCzx4sWqL6irqzprkofxPmLHYgkSnG2WaWVqJDXtWRS',
  tokenReceiverAddress: 'simpleledger:qr5jrq0ulfjdu0wk725v02fnfrrts6yrlyzfspntcv',
  bchChangeReceiverAddress: 'bitcoincash:qqaza4qqgnazt7zxexta6zv2gvcyp64kqgpxz5e6j7',
  tokenId:
   '54be8c9eac597633e2fa579565a8b5a5e9a361f82c3cc87a7e5f669c3c4f33ac',
  amount: 100 }

Are one of my values incorrect or wrong format here?

kirkins commented 4 years ago

The specific part of the library that causes an error in my case is in lib/TokenType1.js lines 146-147.

inputUtxos = balances_1.slpTokenUtxos[tokenId];
inputUtxos = inputUtxos.concat(balances_1.nonSlpUtxos);

The balances_1.slpTokenUtxos here is an empty object.

kirkins commented 4 years ago

Figured it out in my situation, I was using the wrong address and the one being used actually had no slp tokens.