Closed TXien closed 6 years ago
(node:15532) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): NotConnectedError
Use catch
api.preparePayment(address, payment).then(prepared => {
console.info(prepared);
}).catch(err => console.error(err));
const RippleAPI = require('ripple-lib').RippleAPI
//const api = new RippleAPI({server: 'wss://s1.ripple.com:443'});
const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'});
const address = 'rGQM86kJsoFuTzfYPs2PLnami1XD1NEQE6';
const payment = {
"source": {
"address": "rGQM86kJsoFuTzfYPs2PLnami1XD1NEQE6",
"amount": {
"value": "0.01",
"currency": "XRP"
}
},
"destination": {
"address": "rPHtn8eJRXkt3meL1xc4up64SogDeVapxz",
"minAmount": {
"value": "0.01",
"currency": "XRP"
}
}
};
api.preparePayment(address, payment).then(prepared =>
{
console.info(prepared);
}).catch(err => console.log(err));
result is undefined
[NotConnectedError(undefined)]
@TXien Hopefully the above answer resolved your issue. Feel free to let us know if it did not.
thanks, its resolved.
i sign a payment, but the error message show:
following is my code