mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 08:35:49 +00:00
run prettier format
This commit is contained in:
@@ -1,53 +1,56 @@
|
||||
import Connection from '../../src/common/connection';
|
||||
import Connection from '../../src/common/connection'
|
||||
|
||||
const request1 = {
|
||||
command: 'server_info'
|
||||
};
|
||||
}
|
||||
|
||||
const request2 = {
|
||||
command: 'account_info',
|
||||
account: 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'
|
||||
};
|
||||
}
|
||||
|
||||
const request3 = {
|
||||
command: 'account_info'
|
||||
};
|
||||
}
|
||||
|
||||
const request4 = {
|
||||
command: 'account_info',
|
||||
account: 'invalid'
|
||||
};
|
||||
}
|
||||
|
||||
function makeRequest(connection, request) {
|
||||
return connection.request(request).then((response) => {
|
||||
console.log(request);
|
||||
console.log(JSON.stringify(response, null, 2));
|
||||
}).catch((error) => {
|
||||
console.log(request);
|
||||
console.log(error);
|
||||
});
|
||||
return connection
|
||||
.request(request)
|
||||
.then(response => {
|
||||
console.log(request)
|
||||
console.log(JSON.stringify(response, null, 2))
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(request)
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
function main() {
|
||||
const connection = new Connection('wss://s1.ripple.com');
|
||||
const connection = new Connection('wss://s1.ripple.com')
|
||||
connection.connect().then(() => {
|
||||
console.log('Connected');
|
||||
console.log('Connected')
|
||||
Promise.all([
|
||||
makeRequest(connection, request1),
|
||||
makeRequest(connection, request2),
|
||||
makeRequest(connection, request3),
|
||||
makeRequest(connection, request4)
|
||||
]).then(() => {
|
||||
console.log('Done');
|
||||
});
|
||||
connection.getLedgerVersion().then(console.log);
|
||||
console.log('Done')
|
||||
})
|
||||
connection.getLedgerVersion().then(console.log)
|
||||
connection.on('ledgerClosed', ledger => {
|
||||
console.log(ledger);
|
||||
connection.getLedgerVersion().then(console.log);
|
||||
});
|
||||
connection.hasLedgerVersions(1, 100).then(console.log);
|
||||
connection.hasLedgerVersions(16631039, 16631040).then(console.log);
|
||||
});
|
||||
console.log(ledger)
|
||||
connection.getLedgerVersion().then(console.log)
|
||||
})
|
||||
connection.hasLedgerVersions(1, 100).then(console.log)
|
||||
connection.hasLedgerVersions(16631039, 16631040).then(console.log)
|
||||
})
|
||||
}
|
||||
|
||||
main();
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user