mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 12:45:50 +00:00
Add transaction.invoiceID setter
This commit is contained in:
@@ -123,12 +123,12 @@ Transaction.flags = {
|
|||||||
Transaction.formats = require('./binformat').tx;
|
Transaction.formats = require('./binformat').tx;
|
||||||
|
|
||||||
Transaction.prototype.consts = {
|
Transaction.prototype.consts = {
|
||||||
telLOCAL_ERROR : -399,
|
telLOCAL_ERROR: -399,
|
||||||
temMALFORMED : -299,
|
temMALFORMED: -299,
|
||||||
tefFAILURE : -199,
|
tefFAILURE: -199,
|
||||||
terRETRY : -99,
|
terRETRY: -99,
|
||||||
tesSUCCESS : 0,
|
tesSUCCESS: 0,
|
||||||
tecCLAIMED : 100,
|
tecCLAIMED: 100,
|
||||||
};
|
};
|
||||||
|
|
||||||
Transaction.from_json = function(j) {
|
Transaction.from_json = function(j) {
|
||||||
@@ -268,6 +268,14 @@ Transaction.prototype.destinationTag = function(tag) {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Transaction.prototype.invoiceID = function(id) {
|
||||||
|
if (typeof id === 'string') {
|
||||||
|
while (id.length < 64) id += '0';
|
||||||
|
this.tx_json.InvoiceID = id;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
Transaction._pathRewrite = function(path) {
|
Transaction._pathRewrite = function(path) {
|
||||||
return path.map(function(node) {
|
return path.map(function(node) {
|
||||||
var newNode = { };
|
var newNode = { };
|
||||||
@@ -630,20 +638,22 @@ Transaction.prototype.submit = function(callback) {
|
|||||||
|
|
||||||
this.callback = typeof callback === 'function' ? callback : function(){};
|
this.callback = typeof callback === 'function' ? callback : function(){};
|
||||||
|
|
||||||
function submission_error(error, message) {
|
function submissionError(error, message) {
|
||||||
if (!(error instanceof RippleError)) {
|
if (!(error instanceof RippleError)) {
|
||||||
error = new RippleError(error, message);
|
error = new RippleError(error, message);
|
||||||
}
|
}
|
||||||
self.callback(error);
|
self.callback(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
function submission_success(message) {
|
this.once('error', submissionError);
|
||||||
|
|
||||||
|
function submissionSuccess(message) {
|
||||||
self.callback(null, message);
|
self.callback(null, message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.once('success', submissionSuccess);
|
||||||
|
|
||||||
this.on('error', function(){});
|
this.on('error', function(){});
|
||||||
this.once('error', submission_error);
|
|
||||||
this.once('success', submission_success);
|
|
||||||
|
|
||||||
var account = this.tx_json.Account;
|
var account = this.tx_json.Account;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user