Add optional cancel support to offer_create.

This commit is contained in:
Arthur Britto
2013-06-15 22:26:18 -07:00
parent 9dd337a16c
commit be78db1563

View File

@@ -588,8 +588,9 @@ Transaction.prototype.offer_cancel = function (src, sequence) {
// Options:
// .set_flags()
// --> expiration : Date or Number
Transaction.prototype.offer_create = function (src, taker_pays, taker_gets, expiration) {
// --> expiration : if not undefined, Date or Number
// --> cancel_sequence : if not undefined, Sequence
Transaction.prototype.offer_create = function (src, taker_pays, taker_gets, expiration, cancel_sequence) {
this._secret = this._account_secret(src);
this.tx_json.TransactionType = 'OfferCreate';
this.tx_json.Account = UInt160.json_rewrite(src);
@@ -605,6 +606,9 @@ Transaction.prototype.offer_create = function (src, taker_pays, taker_gets, expi
? expiration.getTime()
: Number(expiration);
if (cancel_sequence)
this.tx_json.OfferSequence = Number(cancel_sequence);
return this;
};