mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Greater convenience for payment transactions
This commit is contained in:
@@ -80,7 +80,8 @@ function Remote(opts, trace) {
|
||||
? true : Boolean(opts.local_signing);
|
||||
this.fee_cushion = (typeof opts.fee_cushion === 'undefined')
|
||||
? 1.5 : Number(opts.fee_cushion);
|
||||
|
||||
this.max_fee = (typeof opts.max_fee === 'undefined')
|
||||
? Infinity: Number(opts.max_fee);
|
||||
this.id = 0;
|
||||
this.trace = opts.trace || trace;
|
||||
this._server_fatal = false; // True, if we know server exited.
|
||||
@@ -1207,9 +1208,17 @@ Remote.prototype.request_connect = function (ip, port, callback) {
|
||||
return request;
|
||||
};
|
||||
|
||||
Remote.prototype.create_transaction =
|
||||
Remote.prototype.transaction = function () {
|
||||
return new Transaction(this);
|
||||
Remote.prototype.transaction = function (source, destination, amount, callback) {
|
||||
var tx = new Transaction(this);
|
||||
|
||||
if (arguments.length >= 3) {
|
||||
tx = tx.payment(source, destination, amount);
|
||||
if (typeof callback === 'function') {
|
||||
tx.submit(callback);
|
||||
}
|
||||
}
|
||||
|
||||
return tx;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user