virtualeconomy / js-v-sdk

[DEPRECATED and please use https://github.com/virtualeconomy/js-vsys instead] Java Script library for V Systems
https://www.npmjs.com/package/@virtualeconomy/js-v-sdk
MIT License
10 stars 5 forks source link

Callback not supported #40

Closed vipertechofficial closed 3 years ago

vipertechofficial commented 3 years ago

How can I use the API trough callbacks ? image

In the image I wanted to perform a test to show account balance on login in the console, but it don't work.

image

Here I got a promise.

image

Here I got nothing.

COULD SOMEONE EXPLAIN ME HOW TO be able to work with the API just like pouchDB ? https://pouchdb.com/api.html

The following code shows nothing in the console.

chain.getBalanceDetail(new_account.address).then(response => {

        console.log(response);
    }, respError =>{

        console.log(respError);
    });
vipertechofficial commented 3 years ago

Does the API works from localhost?

0x100cc commented 3 years ago
const chain = new Blockchain(NODE_IP, NETWORK_BYTE)

Here, testnet node IP http://test.v.systems:9922 is not working for now. I suggest using http://marble.vos.systems:9924

I hope my advice can help you.

SheldonYS commented 3 years ago

Currently, we are moving nodes. marble.vos.systems could be shutdown recently. Please use the following nodes instead

http://vaivora.vos.systems:9924
http://gabija.vos.systems:9924
http://test-node.v.systems:9924

You can create chain class like this:

const vsys = require("@virtualeconomy/js-v-sdk");
const constants = vsys.constants;
const node_address = "http://vaivora.vos.systems:9924"; // change to your node address
const network_byte = constants.TESTNET_BYTE;
var chain = new vsys.Blockchain(node_address, network_byte);

chain.getBalanceDetail('AUAX5tBz94KmpRdZuaX3FGXBMCQUxgb1hj5').then(response => {
        console.log(response);
    }, respError =>{
        console.log(respError);
    });
vipertechofficial commented 3 years ago

Ok thanks both @SheldonYS @Haynar216 , I used const node_address = "http://test.v.systems:9922"; I'll close it later, I am currently developing something, I'll check it out in a few hours.

EDIT: It works, thanks. I'll list node addresses in my application.