Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript Doc #15

Open
technotip opened this issue Oct 3, 2018 · 9 comments
Open

Typescript Doc #15

technotip opened this issue Oct 3, 2018 · 9 comments

Comments

@technotip
Copy link

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

@marpme
Copy link
Member

marpme commented Oct 3, 2018

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
Copy link
Member

marpme commented Oct 3, 2018

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

@technotip
Copy link
Author

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.

@marpme
Copy link
Member

marpme commented Oct 3, 2018

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.

@technotip
Copy link
Author

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
Copy link
Author

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

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

@marpme
Copy link
Member

marpme commented Oct 3, 2018

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)!

@technotip
Copy link
Author

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
Copy link
Author

Still its not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants