【发布时间】:2020-05-18 12:30:56
【问题描述】:
我在使用 RippleAPI for Javascript 连接到测试服务器时不断收到以下错误:
[ConnectionError(Error: connect() timed out after 2000 ms. If your internet connection is working, the rippled server may be blocked or inaccessible.)]
但是,如果我尝试从 curl 中获得平衡,它会起作用:
curl 'https://testnet.data.api.ripple.com/v2/accounts/rwAVpkGNU9Shn63EpFq7ju1tr89SsSBwHz/balances?currency=XRP'
下面的代码sn-p:
'use strict';
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233' // Public rippled server
});
api.connect().then(() => {
/* begin custom code ------------------------------------ */
const myAddress = 'rwAVpkGNU9Shn63EpFq7ju1tr89SsSBwHz';
console.log('getting account info for', myAddress);
return api.getAccountInfo(myAddress);
}).then(info => {
console.log(info);
console.log('getAccountInfo done');
/* end custom code -------------------------------------- */
}).then(() => {
return api.disconnect();
}).then(() => {
console.log('done and disconnected.');
}).catch(console.error);
【问题讨论】:
-
您找到解决方案了吗?我也面临同样的问题。
标签: javascript ripple cryptocurrency