mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Rename RippleAPI client to Client (#1520)
* rename RippleAPI -> XrplClient * more renames * move API stuff to client folder * rename all api -> client * fix tests * make tests run * fix integ tests * fix urls * fix merge issues * XrplClient -> Client * fix merge issues * rename xrpl-client npm symlink to xrpl-local
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
const masterAccount = 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh';
|
||||
const masterSecret = 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb';
|
||||
|
||||
function ledgerAccept(api) {
|
||||
function ledgerAccept(client) {
|
||||
const request = {command: 'ledger_accept'};
|
||||
return api.connection.request(request);
|
||||
return client.connection.request(request);
|
||||
}
|
||||
|
||||
function pay(api, from, to, amount, secret, currency = 'XRP', counterparty) {
|
||||
function pay(client, from, to, amount, secret, currency = 'XRP', counterparty) {
|
||||
const paymentSpecification = {
|
||||
source: {
|
||||
address: from,
|
||||
@@ -32,19 +32,19 @@ function pay(api, from, to, amount, secret, currency = 'XRP', counterparty) {
|
||||
}
|
||||
|
||||
let id = null;
|
||||
return api.preparePayment(from, paymentSpecification, {})
|
||||
.then(data => api.sign(data.txJSON, secret))
|
||||
return client.preparePayment(from, paymentSpecification, {})
|
||||
.then(data => client.sign(data.txJSON, secret))
|
||||
.then(signed => {
|
||||
id = signed.id;
|
||||
return api.submit(signed.signedTransaction);
|
||||
return client.submit(signed.signedTransaction);
|
||||
})
|
||||
.then(() => ledgerAccept(api))
|
||||
.then(() => ledgerAccept(client))
|
||||
.then(() => id);
|
||||
}
|
||||
|
||||
|
||||
function payTo(api, to, amount = '4003218', currency = 'XRP', counterparty) {
|
||||
return pay(api, masterAccount, to, amount, masterSecret, currency,
|
||||
function payTo(client, to, amount = '4003218', currency = 'XRP', counterparty) {
|
||||
return pay(client, masterAccount, to, amount, masterSecret, currency,
|
||||
counterparty);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user