nodejs-verge icon indicating copy to clipboard operation
nodejs-verge copied to clipboard

Typescript Doc

Open technotip opened this issue 5 years ago • 9 comments

I've installed verge-node

npm install verge-node-typescript;

I've imported it in my node project

var verge = require(verge-node-typescript);

When I try to execute the code in the document, I start getting error message that its not a function.

And it doesn't throw any error or result.

Kindly write document for using it.

Thank you ..

technotip avatar Oct 03 '18 09:10 technotip

It requires a complete node to be run. Without a verge node, you won't be able to request anything.

How to init it: https://github.com/vergecurrency/vWallet/blob/develop/src/stores/VergeClient.ts#L38-L41

How to (for example) get transaction lists: https://github.com/vergecurrency/vWallet/blob/develop/src/stores/TransactionStore.ts#L191-L198

Supported Methods: (it's WIP) https://github.com/marpme/verge-node-typescript/blob/master/src/API.ts

marpme avatar Oct 03 '18 10:10 marpme

To your other question about to send XVG to multiple addresses: It's not yet supported.

marpme avatar Oct 03 '18 10:10 marpme

It requires a complete node to be run. Without a verge node, you won't be able to request anything.

How to init it: https://github.com/vergecurrency/vWallet/blob/develop/src/stores/VergeClient.ts#L38-L41

How to (for example) get transaction lists: https://github.com/vergecurrency/vWallet/blob/develop/src/stores/TransactionStore.ts#L191-L198

Supported Methods: (it's WIP) https://github.com/marpme/verge-node-typescript/blob/master/src/API.ts

I've a full node running on my system. It's 100% synced too. I've added verge.config file in %appdata% folder. I have entered proper user and pass values in my node application. Still am not able to fetch the data.

technotip avatar Oct 03 '18 10:10 technotip

Then it should work if you have done everything correctly, which it sounds. Show me the config & the code for the connection otherwise, I can't help you right now.

marpme avatar Oct 03 '18 11:10 marpme

verge.conf (I've created it in VERGE folder in %appdata%. Its not a .txt file. I've checked it properly)

rpcuser=vergerpcusername
rpcpassword=55CpSuCNvDcYsdQU9w526mkQqJAimSQwCSJL6dPT8wQX
rpcport=20102
port=21102
daemon=1
algo=groestl

In node cli npm install verge-node-typescript;

Inside node's app.js file

var verge = require('verge-node-typescript');
verge.auth('vergerpcusername','55CpSuCNvDcYsdQU9w526mkQqJAimSQwCSJL6dPT8wQX');

When I execute this, it throws error that .auth isn't a function.

technotip avatar Oct 03 '18 12:10 technotip

If I do this var verge = require('node-verge')()

It starts throwing error. 'node-verge' module not found.

technotip avatar Oct 03 '18 12:10 technotip

This:

var verge = require('verge-node-typescript');
verge.auth('vergerpcusername','55CpSuCNvDcYsdQU9w526mkQqJAimSQwCSJL6dPT8wQX');

Should be this:

const { Client } = require('verge-node-typescript');
client = new Client({
    user: vergerpcusername,
    pass: '55CpSuCNvDcYsdQU9w526mkQqJAimSQwCSJL6dPT8wQX',
})

And please make sure your verge node is running on the same system (meaning localhost)!

marpme avatar Oct 03 '18 13:10 marpme

I'm using above code and trying to call getInfo method.

  client.getInfo()
  .then( (info) => {
    console.log(info)
    console.log('Fetched new transactions')
  })
  .catch((err) => {
    console.log('Failed fetching new transactions '+err);
  });

It's giving me following error: Failed fetching new transactions Error: connect ECONNREFUSED 127.0.0.1:20102

Yes, my Verge wallet is synced fully and is on same machine where am running my node application.

technotip avatar Oct 03 '18 14:10 technotip

Still its not working.

technotip avatar Oct 10 '18 13:10 technotip