scoin / multichain-node

A simple wrapper for Multichain's JSON RPC api that parses your input.
MIT License
73 stars 54 forks source link

SendFrom / sendAssetFrom - from Native currency #36

Closed inzider closed 4 years ago

inzider commented 4 years ago

Hi,

For native currency transfer :

1 - using sendFrom return { code: -1, message: 'value is type null, expected real' } or 2- using sendAssetFrom wih asset:"", return { code: -8, message: 'Invalid asset reference' }

Since native currency don't have a name only a chain name, code wont run a command that process in CLI / terminal. Seems referencing as " " wont do.

Cli command : sendfrom 14gRJk8Sis7oByZ6m72JZErXRBfoWXEfGnoNdU
1KyzhGzMHSSZoLRNW4GxQp3Kf6KswrgCY8kxxD 1

Return success with txid: {"method":"sendfrom","params":
["14gRJk8Sis7oByZ6m72JZErXRBfoWXEfGnoNdE", "1KyzhGzMHSSZoLRNW4GxQp3Kf6KswrgCY
8kxxD",1],"id":"28780236-1588651856","chain_name":"INX"}

0af1c7e402edba21f3ed7d170b1d4a19a23fc6e679f7e32e497faf2e0ba4ae12 

Yet this wont :

multichain.sendFrom({ // sendAssetFrom
    from: '14gRJk8Sis7oByZ6m72JZErXRBfoWXEfGnoNdE',
    to: '1HtdSAEeJvkUJ6ueqkk6dMkCvxcnLPsWrTomt6',
    // asset: '',
    qty: 1
        });

Please help, thx! ; )

inzider commented 4 years ago

Solved. I should read docs / commands.js better. It need to be amount, no qty, for native curreny using sendFrom.

Yet, the test.js don't include this method.

        const tx = await multichain.sendFrom({
            from: addr1,
            to: addr2,
            amount: 1
        });