scientistnik / btsdex

Package for work with BitShares DEX
MIT License
21 stars 27 forks source link

memoDecode #8

Closed technologiespro closed 6 years ago

technologiespro commented 6 years ago

Added memoDecode method from history tx.

Test code:

const BitShares =  require("./index.js");
BitShares.init("wss://bitshares.openledger.info/ws");
BitShares.subscribe('connected', start);

KEY = '5K...PrivateKey';
SENDER = 'sender_name';

async function start() {

    let bot = new BitShares(SENDER, KEY);
    bot.setMemoKey(KEY);
    let memo_text = await bot.memoDecode({
        "from": "BTS5...sender_address",
        "nonce": 192135435365768,
        "message": "b897254f..."
    });

    console.log(memo_text);

}
technologiespro commented 6 years ago

you are right, it is better to return the text and remove the superfluous condition