GithubHelp home page GithubHelp logo

colored-coins-sdk's People

Contributors

udiwertheimer avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colored-coins-sdk's Issues

Cannot read property 'length' of undefined if amount is not a float.

function bitcoinsToSatoshis (amount) {
var parts = amount.toString().split(".")
var decimal = parts[1]
var missingDigits = 8 - decimal.length
if (missingDigits) {
for (var i = 0; i < missingDigits; i++) {
decimal += '0'
}
}
return parseInt(decimal) + (parseInt(parts[0]) * 100000000)
}

Sent 1 bitcoin and received this error because index at 1 was undefined.

 var decimal = parts[1]

Bug in financeChangeAddress when send asset amount back and forth.

To reproduce the bug:

  • Set financeChangeAddress: cc.hdwallet.getAddress(0, 0)
  • Send asset from and address A to B
  • Send asset back from B to A

After sent back and forth, the output amount (Funding amount in tBTC) will automatically go to address A in testnet even thought we set (financeChangeAddress to cc.hdwallet.getAddress(0, 0))

Note:

  • cc.hdwallet.getAddress(0, 0) is funded
  • Address A and B hold dust amount of tBTC only.

`financeChangeAddress` is ignored when transferring the entire asset amount

Before process send asset between addresses token that hold valid amounts:

send json:

var send = {
                from: [cc.hdwallet.getAddress(0, 0), fromAddress],
                to: transferToAddresse,
                fee: 1000,
                financeChangeAddress: cc.hdwallet.getAddress(0, 0)
            };

###There are something not right here.

- Json Argu properties:

  • cc.hdwallet.getAddress(0, 0) hold some cc amount (1,000,000).
  • fromAddress amount is 100.
  • transferToAddresse is hold 100
  • amount to send is 110, (I am intentionally put it more than the fromAddress hold)

After I did the send asset:

  • cc.hdwallet.getAddress(0, 0) :
{ address: [ ‘moNXJM8PytYgL3AWo7quuebnMbmyRoQKFD’ ],
  utxos:
   [ { index: 2,
       txid: ‘25f3f5a5eb4127e733282b206bcf86d673c82422372708b8c44073dea85507fa’,
       blocktime: 1497589000206,
       blockheight: -1,
       value: 64942400,
       used: false,
       scriptPubKey: [Object],
       assets: [] } ] }

Its assets (cc.hdwallet.getAddress(0, 0)) become empty.

  • fromAddress amount is become 999,990
[
        {
            “assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
            “amount”: 100,
            “issueTxid”: “7fa2c9a6c084b5f1c3b2b95341490b54ea0476f5dc970ceb25a512e8e01ad783”,
            “divisibility”: 2,
            “lockStatus”: false,
            “aggregationPolicy”: “aggregatable”
        }
    ],
    [
        {
            “assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
            “amount”: 999890,
            “issueTxid”: “ef62a80b878c6987ffb1747279b548ca3ffb786ddb620563fc7fc26ed54373c8",
            “divisibility”: 2,
            “lockStatus”: false,
            “aggregationPolicy”: “aggregatable”
        }
    ]
  • transferToAddresse is hold 210 as expected.
[
       {
           “assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
           “amount”: 100,
           “issueTxid”: “8719ea7d187bfb00698087917d5300956094d432c1df981ecdc8eab9feb3f655”,
           “divisibility”: 2,
           “lockStatus”: false,
           “aggregationPolicy”: “aggregatable”
       }
   ],
   [
       {
           “assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
           “amount”: 110,
           “issueTxid”: “ef62a80b878c6987ffb1747279b548ca3ffb786ddb620563fc7fc26ed54373c8",
           “divisibility”: 2,
           “lockStatus”: false,
           “aggregationPolicy”: “aggregatable”
       }
   ]

Note:

from: [cc.hdwallet.getAddress(0, 0), fromAddress] I did use 2 address since the fromAddress did not have enough satoshi tBTC as u can see I set the financeChangeAddress: cc.hdwallet.getAddress(0, 0) to the same tBTC address every time therefore sending asset will spend only the small dust/tx fee.

Every thing work fine if the cc.hdwallet.getAddress(0, 0) hold zero amount in cc and I can use its tBTC value to help finance the tx in cc sdk for another address in cc(addresses with the same assetId).

And it happen the same to the BurnAsset!

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.