@trustwallet/wallet-core 4.2.11 → 4.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/core_proto.d.ts +397 -1
- package/dist/generated/core_proto.js +1265 -132
- package/dist/lib/wallet-core.js +1 -1
- package/dist/lib/wallet-core.wasm +0 -0
- package/dist/src/wallet-core.d.ts +2 -1
- package/package.json +1 -1
@@ -28589,6 +28589,7 @@
|
|
28589
28589
|
* @property {TW.BitcoinV2.Proto.IPsbt|null} [psbt] SigningOutput psbt
|
28590
28590
|
* @property {TW.Utxo.Proto.ITransaction|null} [bitcoin] SigningOutput bitcoin
|
28591
28591
|
* @property {TW.Zcash.Proto.ITransaction|null} [zcash] SigningOutput zcash
|
28592
|
+
* @property {TW.DecredV2.Proto.ITransaction|null} [decred] SigningOutput decred
|
28592
28593
|
*/
|
28593
28594
|
|
28594
28595
|
/**
|
@@ -28686,17 +28687,25 @@
|
|
28686
28687
|
*/
|
28687
28688
|
SigningOutput.prototype.zcash = null;
|
28688
28689
|
|
28690
|
+
/**
|
28691
|
+
* SigningOutput decred.
|
28692
|
+
* @member {TW.DecredV2.Proto.ITransaction|null|undefined} decred
|
28693
|
+
* @memberof TW.BitcoinV2.Proto.SigningOutput
|
28694
|
+
* @instance
|
28695
|
+
*/
|
28696
|
+
SigningOutput.prototype.decred = null;
|
28697
|
+
|
28689
28698
|
// OneOf field names bound to virtual getters and setters
|
28690
28699
|
var $oneOfFields;
|
28691
28700
|
|
28692
28701
|
/**
|
28693
28702
|
* SigningOutput transaction.
|
28694
|
-
* @member {"bitcoin"|"zcash"|undefined} transaction
|
28703
|
+
* @member {"bitcoin"|"zcash"|"decred"|undefined} transaction
|
28695
28704
|
* @memberof TW.BitcoinV2.Proto.SigningOutput
|
28696
28705
|
* @instance
|
28697
28706
|
*/
|
28698
28707
|
Object.defineProperty(SigningOutput.prototype, "transaction", {
|
28699
|
-
get: $util.oneOfGetter($oneOfFields = ["bitcoin", "zcash"]),
|
28708
|
+
get: $util.oneOfGetter($oneOfFields = ["bitcoin", "zcash", "decred"]),
|
28700
28709
|
set: $util.oneOfSetter($oneOfFields)
|
28701
28710
|
});
|
28702
28711
|
|
@@ -28744,6 +28753,8 @@
|
|
28744
28753
|
$root.TW.Utxo.Proto.Transaction.encode(message.bitcoin, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();
|
28745
28754
|
if (message.zcash != null && Object.hasOwnProperty.call(message, "zcash"))
|
28746
28755
|
$root.TW.Zcash.Proto.Transaction.encode(message.zcash, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim();
|
28756
|
+
if (message.decred != null && Object.hasOwnProperty.call(message, "decred"))
|
28757
|
+
$root.TW.DecredV2.Proto.Transaction.encode(message.decred, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim();
|
28747
28758
|
return writer;
|
28748
28759
|
};
|
28749
28760
|
|
@@ -28795,6 +28806,9 @@
|
|
28795
28806
|
case 16:
|
28796
28807
|
message.zcash = $root.TW.Zcash.Proto.Transaction.decode(reader, reader.uint32());
|
28797
28808
|
break;
|
28809
|
+
case 17:
|
28810
|
+
message.decred = $root.TW.DecredV2.Proto.Transaction.decode(reader, reader.uint32());
|
28811
|
+
break;
|
28798
28812
|
default:
|
28799
28813
|
reader.skipType(tag & 7);
|
28800
28814
|
break;
|
@@ -28888,6 +28902,16 @@
|
|
28888
28902
|
return "zcash." + error;
|
28889
28903
|
}
|
28890
28904
|
}
|
28905
|
+
if (message.decred != null && message.hasOwnProperty("decred")) {
|
28906
|
+
if (properties.transaction === 1)
|
28907
|
+
return "transaction: multiple values";
|
28908
|
+
properties.transaction = 1;
|
28909
|
+
{
|
28910
|
+
var error = $root.TW.DecredV2.Proto.Transaction.verify(message.decred);
|
28911
|
+
if (error)
|
28912
|
+
return "decred." + error;
|
28913
|
+
}
|
28914
|
+
}
|
28891
28915
|
return null;
|
28892
28916
|
};
|
28893
28917
|
|
@@ -29009,166 +29033,1248 @@
|
|
29009
29033
|
message.error = 25;
|
29010
29034
|
break;
|
29011
29035
|
}
|
29012
|
-
if (object.errorMessage != null)
|
29013
|
-
message.errorMessage = String(object.errorMessage);
|
29014
|
-
if (object.encoded != null)
|
29015
|
-
if (typeof object.encoded === "string")
|
29016
|
-
$util.base64.decode(object.encoded, message.encoded = $util.newBuffer($util.base64.length(object.encoded)), 0);
|
29017
|
-
else if (object.encoded.length)
|
29018
|
-
message.encoded = object.encoded;
|
29019
|
-
if (object.txid != null)
|
29020
|
-
if (typeof object.txid === "string")
|
29021
|
-
$util.base64.decode(object.txid, message.txid = $util.newBuffer($util.base64.length(object.txid)), 0);
|
29022
|
-
else if (object.txid.length)
|
29023
|
-
message.txid = object.txid;
|
29024
|
-
if (object.vsize != null)
|
29025
|
-
if ($util.Long)
|
29026
|
-
(message.vsize = $util.Long.fromValue(object.vsize)).unsigned = true;
|
29027
|
-
else if (typeof object.vsize === "string")
|
29028
|
-
message.vsize = parseInt(object.vsize, 10);
|
29029
|
-
else if (typeof object.vsize === "number")
|
29030
|
-
message.vsize = object.vsize;
|
29031
|
-
else if (typeof object.vsize === "object")
|
29032
|
-
message.vsize = new $util.LongBits(object.vsize.low >>> 0, object.vsize.high >>> 0).toNumber(true);
|
29033
|
-
if (object.weight != null)
|
29034
|
-
if ($util.Long)
|
29035
|
-
(message.weight = $util.Long.fromValue(object.weight)).unsigned = true;
|
29036
|
-
else if (typeof object.weight === "string")
|
29037
|
-
message.weight = parseInt(object.weight, 10);
|
29038
|
-
else if (typeof object.weight === "number")
|
29039
|
-
message.weight = object.weight;
|
29040
|
-
else if (typeof object.weight === "object")
|
29041
|
-
message.weight = new $util.LongBits(object.weight.low >>> 0, object.weight.high >>> 0).toNumber(true);
|
29042
|
-
if (object.fee != null)
|
29036
|
+
if (object.errorMessage != null)
|
29037
|
+
message.errorMessage = String(object.errorMessage);
|
29038
|
+
if (object.encoded != null)
|
29039
|
+
if (typeof object.encoded === "string")
|
29040
|
+
$util.base64.decode(object.encoded, message.encoded = $util.newBuffer($util.base64.length(object.encoded)), 0);
|
29041
|
+
else if (object.encoded.length)
|
29042
|
+
message.encoded = object.encoded;
|
29043
|
+
if (object.txid != null)
|
29044
|
+
if (typeof object.txid === "string")
|
29045
|
+
$util.base64.decode(object.txid, message.txid = $util.newBuffer($util.base64.length(object.txid)), 0);
|
29046
|
+
else if (object.txid.length)
|
29047
|
+
message.txid = object.txid;
|
29048
|
+
if (object.vsize != null)
|
29049
|
+
if ($util.Long)
|
29050
|
+
(message.vsize = $util.Long.fromValue(object.vsize)).unsigned = true;
|
29051
|
+
else if (typeof object.vsize === "string")
|
29052
|
+
message.vsize = parseInt(object.vsize, 10);
|
29053
|
+
else if (typeof object.vsize === "number")
|
29054
|
+
message.vsize = object.vsize;
|
29055
|
+
else if (typeof object.vsize === "object")
|
29056
|
+
message.vsize = new $util.LongBits(object.vsize.low >>> 0, object.vsize.high >>> 0).toNumber(true);
|
29057
|
+
if (object.weight != null)
|
29058
|
+
if ($util.Long)
|
29059
|
+
(message.weight = $util.Long.fromValue(object.weight)).unsigned = true;
|
29060
|
+
else if (typeof object.weight === "string")
|
29061
|
+
message.weight = parseInt(object.weight, 10);
|
29062
|
+
else if (typeof object.weight === "number")
|
29063
|
+
message.weight = object.weight;
|
29064
|
+
else if (typeof object.weight === "object")
|
29065
|
+
message.weight = new $util.LongBits(object.weight.low >>> 0, object.weight.high >>> 0).toNumber(true);
|
29066
|
+
if (object.fee != null)
|
29067
|
+
if ($util.Long)
|
29068
|
+
(message.fee = $util.Long.fromValue(object.fee)).unsigned = false;
|
29069
|
+
else if (typeof object.fee === "string")
|
29070
|
+
message.fee = parseInt(object.fee, 10);
|
29071
|
+
else if (typeof object.fee === "number")
|
29072
|
+
message.fee = object.fee;
|
29073
|
+
else if (typeof object.fee === "object")
|
29074
|
+
message.fee = new $util.LongBits(object.fee.low >>> 0, object.fee.high >>> 0).toNumber();
|
29075
|
+
if (object.psbt != null) {
|
29076
|
+
if (typeof object.psbt !== "object")
|
29077
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.psbt: object expected");
|
29078
|
+
message.psbt = $root.TW.BitcoinV2.Proto.Psbt.fromObject(object.psbt);
|
29079
|
+
}
|
29080
|
+
if (object.bitcoin != null) {
|
29081
|
+
if (typeof object.bitcoin !== "object")
|
29082
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.bitcoin: object expected");
|
29083
|
+
message.bitcoin = $root.TW.Utxo.Proto.Transaction.fromObject(object.bitcoin);
|
29084
|
+
}
|
29085
|
+
if (object.zcash != null) {
|
29086
|
+
if (typeof object.zcash !== "object")
|
29087
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.zcash: object expected");
|
29088
|
+
message.zcash = $root.TW.Zcash.Proto.Transaction.fromObject(object.zcash);
|
29089
|
+
}
|
29090
|
+
if (object.decred != null) {
|
29091
|
+
if (typeof object.decred !== "object")
|
29092
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.decred: object expected");
|
29093
|
+
message.decred = $root.TW.DecredV2.Proto.Transaction.fromObject(object.decred);
|
29094
|
+
}
|
29095
|
+
return message;
|
29096
|
+
};
|
29097
|
+
|
29098
|
+
/**
|
29099
|
+
* Creates a plain object from a SigningOutput message. Also converts values to other types if specified.
|
29100
|
+
* @function toObject
|
29101
|
+
* @memberof TW.BitcoinV2.Proto.SigningOutput
|
29102
|
+
* @static
|
29103
|
+
* @param {TW.BitcoinV2.Proto.SigningOutput} message SigningOutput
|
29104
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
29105
|
+
* @returns {Object.<string,*>} Plain object
|
29106
|
+
*/
|
29107
|
+
SigningOutput.toObject = function toObject(message, options) {
|
29108
|
+
if (!options)
|
29109
|
+
options = {};
|
29110
|
+
var object = {};
|
29111
|
+
if (options.defaults) {
|
29112
|
+
object.error = options.enums === String ? "OK" : 0;
|
29113
|
+
object.errorMessage = "";
|
29114
|
+
if (options.bytes === String)
|
29115
|
+
object.encoded = "";
|
29116
|
+
else {
|
29117
|
+
object.encoded = [];
|
29118
|
+
if (options.bytes !== Array)
|
29119
|
+
object.encoded = $util.newBuffer(object.encoded);
|
29120
|
+
}
|
29121
|
+
if (options.bytes === String)
|
29122
|
+
object.txid = "";
|
29123
|
+
else {
|
29124
|
+
object.txid = [];
|
29125
|
+
if (options.bytes !== Array)
|
29126
|
+
object.txid = $util.newBuffer(object.txid);
|
29127
|
+
}
|
29128
|
+
if ($util.Long) {
|
29129
|
+
var long = new $util.Long(0, 0, true);
|
29130
|
+
object.vsize = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29131
|
+
} else
|
29132
|
+
object.vsize = options.longs === String ? "0" : 0;
|
29133
|
+
if ($util.Long) {
|
29134
|
+
var long = new $util.Long(0, 0, true);
|
29135
|
+
object.weight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29136
|
+
} else
|
29137
|
+
object.weight = options.longs === String ? "0" : 0;
|
29138
|
+
if ($util.Long) {
|
29139
|
+
var long = new $util.Long(0, 0, false);
|
29140
|
+
object.fee = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29141
|
+
} else
|
29142
|
+
object.fee = options.longs === String ? "0" : 0;
|
29143
|
+
object.psbt = null;
|
29144
|
+
}
|
29145
|
+
if (message.error != null && message.hasOwnProperty("error"))
|
29146
|
+
object.error = options.enums === String ? $root.TW.Common.Proto.SigningError[message.error] : message.error;
|
29147
|
+
if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
|
29148
|
+
object.errorMessage = message.errorMessage;
|
29149
|
+
if (message.encoded != null && message.hasOwnProperty("encoded"))
|
29150
|
+
object.encoded = options.bytes === String ? $util.base64.encode(message.encoded, 0, message.encoded.length) : options.bytes === Array ? Array.prototype.slice.call(message.encoded) : message.encoded;
|
29151
|
+
if (message.txid != null && message.hasOwnProperty("txid"))
|
29152
|
+
object.txid = options.bytes === String ? $util.base64.encode(message.txid, 0, message.txid.length) : options.bytes === Array ? Array.prototype.slice.call(message.txid) : message.txid;
|
29153
|
+
if (message.vsize != null && message.hasOwnProperty("vsize"))
|
29154
|
+
if (typeof message.vsize === "number")
|
29155
|
+
object.vsize = options.longs === String ? String(message.vsize) : message.vsize;
|
29156
|
+
else
|
29157
|
+
object.vsize = options.longs === String ? $util.Long.prototype.toString.call(message.vsize) : options.longs === Number ? new $util.LongBits(message.vsize.low >>> 0, message.vsize.high >>> 0).toNumber(true) : message.vsize;
|
29158
|
+
if (message.weight != null && message.hasOwnProperty("weight"))
|
29159
|
+
if (typeof message.weight === "number")
|
29160
|
+
object.weight = options.longs === String ? String(message.weight) : message.weight;
|
29161
|
+
else
|
29162
|
+
object.weight = options.longs === String ? $util.Long.prototype.toString.call(message.weight) : options.longs === Number ? new $util.LongBits(message.weight.low >>> 0, message.weight.high >>> 0).toNumber(true) : message.weight;
|
29163
|
+
if (message.fee != null && message.hasOwnProperty("fee"))
|
29164
|
+
if (typeof message.fee === "number")
|
29165
|
+
object.fee = options.longs === String ? String(message.fee) : message.fee;
|
29166
|
+
else
|
29167
|
+
object.fee = options.longs === String ? $util.Long.prototype.toString.call(message.fee) : options.longs === Number ? new $util.LongBits(message.fee.low >>> 0, message.fee.high >>> 0).toNumber() : message.fee;
|
29168
|
+
if (message.psbt != null && message.hasOwnProperty("psbt"))
|
29169
|
+
object.psbt = $root.TW.BitcoinV2.Proto.Psbt.toObject(message.psbt, options);
|
29170
|
+
if (message.bitcoin != null && message.hasOwnProperty("bitcoin")) {
|
29171
|
+
object.bitcoin = $root.TW.Utxo.Proto.Transaction.toObject(message.bitcoin, options);
|
29172
|
+
if (options.oneofs)
|
29173
|
+
object.transaction = "bitcoin";
|
29174
|
+
}
|
29175
|
+
if (message.zcash != null && message.hasOwnProperty("zcash")) {
|
29176
|
+
object.zcash = $root.TW.Zcash.Proto.Transaction.toObject(message.zcash, options);
|
29177
|
+
if (options.oneofs)
|
29178
|
+
object.transaction = "zcash";
|
29179
|
+
}
|
29180
|
+
if (message.decred != null && message.hasOwnProperty("decred")) {
|
29181
|
+
object.decred = $root.TW.DecredV2.Proto.Transaction.toObject(message.decred, options);
|
29182
|
+
if (options.oneofs)
|
29183
|
+
object.transaction = "decred";
|
29184
|
+
}
|
29185
|
+
return object;
|
29186
|
+
};
|
29187
|
+
|
29188
|
+
/**
|
29189
|
+
* Converts this SigningOutput to JSON.
|
29190
|
+
* @function toJSON
|
29191
|
+
* @memberof TW.BitcoinV2.Proto.SigningOutput
|
29192
|
+
* @instance
|
29193
|
+
* @returns {Object.<string,*>} JSON object
|
29194
|
+
*/
|
29195
|
+
SigningOutput.prototype.toJSON = function toJSON() {
|
29196
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
29197
|
+
};
|
29198
|
+
|
29199
|
+
return SigningOutput;
|
29200
|
+
})();
|
29201
|
+
|
29202
|
+
return Proto;
|
29203
|
+
})();
|
29204
|
+
|
29205
|
+
return BitcoinV2;
|
29206
|
+
})();
|
29207
|
+
|
29208
|
+
TW.DecredV2 = (function() {
|
29209
|
+
|
29210
|
+
/**
|
29211
|
+
* Namespace DecredV2.
|
29212
|
+
* @memberof TW
|
29213
|
+
* @namespace
|
29214
|
+
*/
|
29215
|
+
var DecredV2 = {};
|
29216
|
+
|
29217
|
+
DecredV2.Proto = (function() {
|
29218
|
+
|
29219
|
+
/**
|
29220
|
+
* Namespace Proto.
|
29221
|
+
* @memberof TW.DecredV2
|
29222
|
+
* @namespace
|
29223
|
+
*/
|
29224
|
+
var Proto = {};
|
29225
|
+
|
29226
|
+
Proto.OutPoint = (function() {
|
29227
|
+
|
29228
|
+
/**
|
29229
|
+
* Properties of an OutPoint.
|
29230
|
+
* @memberof TW.DecredV2.Proto
|
29231
|
+
* @interface IOutPoint
|
29232
|
+
* @property {Uint8Array|null} [hash] OutPoint hash
|
29233
|
+
* @property {number|null} [vout] OutPoint vout
|
29234
|
+
* @property {number|null} [tree] OutPoint tree
|
29235
|
+
*/
|
29236
|
+
|
29237
|
+
/**
|
29238
|
+
* Constructs a new OutPoint.
|
29239
|
+
* @memberof TW.DecredV2.Proto
|
29240
|
+
* @classdesc Represents an OutPoint.
|
29241
|
+
* @implements IOutPoint
|
29242
|
+
* @constructor
|
29243
|
+
* @param {TW.DecredV2.Proto.IOutPoint=} [properties] Properties to set
|
29244
|
+
*/
|
29245
|
+
function OutPoint(properties) {
|
29246
|
+
if (properties)
|
29247
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
29248
|
+
if (properties[keys[i]] != null)
|
29249
|
+
this[keys[i]] = properties[keys[i]];
|
29250
|
+
}
|
29251
|
+
|
29252
|
+
/**
|
29253
|
+
* OutPoint hash.
|
29254
|
+
* @member {Uint8Array} hash
|
29255
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29256
|
+
* @instance
|
29257
|
+
*/
|
29258
|
+
OutPoint.prototype.hash = $util.newBuffer([]);
|
29259
|
+
|
29260
|
+
/**
|
29261
|
+
* OutPoint vout.
|
29262
|
+
* @member {number} vout
|
29263
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29264
|
+
* @instance
|
29265
|
+
*/
|
29266
|
+
OutPoint.prototype.vout = 0;
|
29267
|
+
|
29268
|
+
/**
|
29269
|
+
* OutPoint tree.
|
29270
|
+
* @member {number} tree
|
29271
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29272
|
+
* @instance
|
29273
|
+
*/
|
29274
|
+
OutPoint.prototype.tree = 0;
|
29275
|
+
|
29276
|
+
/**
|
29277
|
+
* Creates a new OutPoint instance using the specified properties.
|
29278
|
+
* @function create
|
29279
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29280
|
+
* @static
|
29281
|
+
* @param {TW.DecredV2.Proto.IOutPoint=} [properties] Properties to set
|
29282
|
+
* @returns {TW.DecredV2.Proto.OutPoint} OutPoint instance
|
29283
|
+
*/
|
29284
|
+
OutPoint.create = function create(properties) {
|
29285
|
+
return new OutPoint(properties);
|
29286
|
+
};
|
29287
|
+
|
29288
|
+
/**
|
29289
|
+
* Encodes the specified OutPoint message. Does not implicitly {@link TW.DecredV2.Proto.OutPoint.verify|verify} messages.
|
29290
|
+
* @function encode
|
29291
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29292
|
+
* @static
|
29293
|
+
* @param {TW.DecredV2.Proto.IOutPoint} message OutPoint message or plain object to encode
|
29294
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
29295
|
+
* @returns {$protobuf.Writer} Writer
|
29296
|
+
*/
|
29297
|
+
OutPoint.encode = function encode(message, writer) {
|
29298
|
+
if (!writer)
|
29299
|
+
writer = $Writer.create();
|
29300
|
+
if (message.hash != null && Object.hasOwnProperty.call(message, "hash"))
|
29301
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash);
|
29302
|
+
if (message.vout != null && Object.hasOwnProperty.call(message, "vout"))
|
29303
|
+
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.vout);
|
29304
|
+
if (message.tree != null && Object.hasOwnProperty.call(message, "tree"))
|
29305
|
+
writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.tree);
|
29306
|
+
return writer;
|
29307
|
+
};
|
29308
|
+
|
29309
|
+
/**
|
29310
|
+
* Decodes an OutPoint message from the specified reader or buffer.
|
29311
|
+
* @function decode
|
29312
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29313
|
+
* @static
|
29314
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
29315
|
+
* @param {number} [length] Message length if known beforehand
|
29316
|
+
* @returns {TW.DecredV2.Proto.OutPoint} OutPoint
|
29317
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
29318
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
29319
|
+
*/
|
29320
|
+
OutPoint.decode = function decode(reader, length) {
|
29321
|
+
if (!(reader instanceof $Reader))
|
29322
|
+
reader = $Reader.create(reader);
|
29323
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.DecredV2.Proto.OutPoint();
|
29324
|
+
while (reader.pos < end) {
|
29325
|
+
var tag = reader.uint32();
|
29326
|
+
switch (tag >>> 3) {
|
29327
|
+
case 1:
|
29328
|
+
message.hash = reader.bytes();
|
29329
|
+
break;
|
29330
|
+
case 2:
|
29331
|
+
message.vout = reader.uint32();
|
29332
|
+
break;
|
29333
|
+
case 3:
|
29334
|
+
message.tree = reader.uint32();
|
29335
|
+
break;
|
29336
|
+
default:
|
29337
|
+
reader.skipType(tag & 7);
|
29338
|
+
break;
|
29339
|
+
}
|
29340
|
+
}
|
29341
|
+
return message;
|
29342
|
+
};
|
29343
|
+
|
29344
|
+
/**
|
29345
|
+
* Verifies an OutPoint message.
|
29346
|
+
* @function verify
|
29347
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29348
|
+
* @static
|
29349
|
+
* @param {Object.<string,*>} message Plain object to verify
|
29350
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
29351
|
+
*/
|
29352
|
+
OutPoint.verify = function verify(message) {
|
29353
|
+
if (typeof message !== "object" || message === null)
|
29354
|
+
return "object expected";
|
29355
|
+
if (message.hash != null && message.hasOwnProperty("hash"))
|
29356
|
+
if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash)))
|
29357
|
+
return "hash: buffer expected";
|
29358
|
+
if (message.vout != null && message.hasOwnProperty("vout"))
|
29359
|
+
if (!$util.isInteger(message.vout))
|
29360
|
+
return "vout: integer expected";
|
29361
|
+
if (message.tree != null && message.hasOwnProperty("tree"))
|
29362
|
+
if (!$util.isInteger(message.tree))
|
29363
|
+
return "tree: integer expected";
|
29364
|
+
return null;
|
29365
|
+
};
|
29366
|
+
|
29367
|
+
/**
|
29368
|
+
* Creates an OutPoint message from a plain object. Also converts values to their respective internal types.
|
29369
|
+
* @function fromObject
|
29370
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29371
|
+
* @static
|
29372
|
+
* @param {Object.<string,*>} object Plain object
|
29373
|
+
* @returns {TW.DecredV2.Proto.OutPoint} OutPoint
|
29374
|
+
*/
|
29375
|
+
OutPoint.fromObject = function fromObject(object) {
|
29376
|
+
if (object instanceof $root.TW.DecredV2.Proto.OutPoint)
|
29377
|
+
return object;
|
29378
|
+
var message = new $root.TW.DecredV2.Proto.OutPoint();
|
29379
|
+
if (object.hash != null)
|
29380
|
+
if (typeof object.hash === "string")
|
29381
|
+
$util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0);
|
29382
|
+
else if (object.hash.length)
|
29383
|
+
message.hash = object.hash;
|
29384
|
+
if (object.vout != null)
|
29385
|
+
message.vout = object.vout >>> 0;
|
29386
|
+
if (object.tree != null)
|
29387
|
+
message.tree = object.tree >>> 0;
|
29388
|
+
return message;
|
29389
|
+
};
|
29390
|
+
|
29391
|
+
/**
|
29392
|
+
* Creates a plain object from an OutPoint message. Also converts values to other types if specified.
|
29393
|
+
* @function toObject
|
29394
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29395
|
+
* @static
|
29396
|
+
* @param {TW.DecredV2.Proto.OutPoint} message OutPoint
|
29397
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
29398
|
+
* @returns {Object.<string,*>} Plain object
|
29399
|
+
*/
|
29400
|
+
OutPoint.toObject = function toObject(message, options) {
|
29401
|
+
if (!options)
|
29402
|
+
options = {};
|
29403
|
+
var object = {};
|
29404
|
+
if (options.defaults) {
|
29405
|
+
if (options.bytes === String)
|
29406
|
+
object.hash = "";
|
29407
|
+
else {
|
29408
|
+
object.hash = [];
|
29409
|
+
if (options.bytes !== Array)
|
29410
|
+
object.hash = $util.newBuffer(object.hash);
|
29411
|
+
}
|
29412
|
+
object.vout = 0;
|
29413
|
+
object.tree = 0;
|
29414
|
+
}
|
29415
|
+
if (message.hash != null && message.hasOwnProperty("hash"))
|
29416
|
+
object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash;
|
29417
|
+
if (message.vout != null && message.hasOwnProperty("vout"))
|
29418
|
+
object.vout = message.vout;
|
29419
|
+
if (message.tree != null && message.hasOwnProperty("tree"))
|
29420
|
+
object.tree = message.tree;
|
29421
|
+
return object;
|
29422
|
+
};
|
29423
|
+
|
29424
|
+
/**
|
29425
|
+
* Converts this OutPoint to JSON.
|
29426
|
+
* @function toJSON
|
29427
|
+
* @memberof TW.DecredV2.Proto.OutPoint
|
29428
|
+
* @instance
|
29429
|
+
* @returns {Object.<string,*>} JSON object
|
29430
|
+
*/
|
29431
|
+
OutPoint.prototype.toJSON = function toJSON() {
|
29432
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
29433
|
+
};
|
29434
|
+
|
29435
|
+
return OutPoint;
|
29436
|
+
})();
|
29437
|
+
|
29438
|
+
Proto.Transaction = (function() {
|
29439
|
+
|
29440
|
+
/**
|
29441
|
+
* Properties of a Transaction.
|
29442
|
+
* @memberof TW.DecredV2.Proto
|
29443
|
+
* @interface ITransaction
|
29444
|
+
* @property {number|null} [serializeType] Transaction serializeType
|
29445
|
+
* @property {number|null} [version] Transaction version
|
29446
|
+
* @property {Array.<TW.DecredV2.Proto.ITransactionInput>|null} [inputs] Transaction inputs
|
29447
|
+
* @property {Array.<TW.DecredV2.Proto.ITransactionOutput>|null} [outputs] Transaction outputs
|
29448
|
+
* @property {number|null} [lockTime] Transaction lockTime
|
29449
|
+
* @property {number|null} [expiry] Transaction expiry
|
29450
|
+
*/
|
29451
|
+
|
29452
|
+
/**
|
29453
|
+
* Constructs a new Transaction.
|
29454
|
+
* @memberof TW.DecredV2.Proto
|
29455
|
+
* @classdesc Represents a Transaction.
|
29456
|
+
* @implements ITransaction
|
29457
|
+
* @constructor
|
29458
|
+
* @param {TW.DecredV2.Proto.ITransaction=} [properties] Properties to set
|
29459
|
+
*/
|
29460
|
+
function Transaction(properties) {
|
29461
|
+
this.inputs = [];
|
29462
|
+
this.outputs = [];
|
29463
|
+
if (properties)
|
29464
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
29465
|
+
if (properties[keys[i]] != null)
|
29466
|
+
this[keys[i]] = properties[keys[i]];
|
29467
|
+
}
|
29468
|
+
|
29469
|
+
/**
|
29470
|
+
* Transaction serializeType.
|
29471
|
+
* @member {number} serializeType
|
29472
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29473
|
+
* @instance
|
29474
|
+
*/
|
29475
|
+
Transaction.prototype.serializeType = 0;
|
29476
|
+
|
29477
|
+
/**
|
29478
|
+
* Transaction version.
|
29479
|
+
* @member {number} version
|
29480
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29481
|
+
* @instance
|
29482
|
+
*/
|
29483
|
+
Transaction.prototype.version = 0;
|
29484
|
+
|
29485
|
+
/**
|
29486
|
+
* Transaction inputs.
|
29487
|
+
* @member {Array.<TW.DecredV2.Proto.ITransactionInput>} inputs
|
29488
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29489
|
+
* @instance
|
29490
|
+
*/
|
29491
|
+
Transaction.prototype.inputs = $util.emptyArray;
|
29492
|
+
|
29493
|
+
/**
|
29494
|
+
* Transaction outputs.
|
29495
|
+
* @member {Array.<TW.DecredV2.Proto.ITransactionOutput>} outputs
|
29496
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29497
|
+
* @instance
|
29498
|
+
*/
|
29499
|
+
Transaction.prototype.outputs = $util.emptyArray;
|
29500
|
+
|
29501
|
+
/**
|
29502
|
+
* Transaction lockTime.
|
29503
|
+
* @member {number} lockTime
|
29504
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29505
|
+
* @instance
|
29506
|
+
*/
|
29507
|
+
Transaction.prototype.lockTime = 0;
|
29508
|
+
|
29509
|
+
/**
|
29510
|
+
* Transaction expiry.
|
29511
|
+
* @member {number} expiry
|
29512
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29513
|
+
* @instance
|
29514
|
+
*/
|
29515
|
+
Transaction.prototype.expiry = 0;
|
29516
|
+
|
29517
|
+
/**
|
29518
|
+
* Creates a new Transaction instance using the specified properties.
|
29519
|
+
* @function create
|
29520
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29521
|
+
* @static
|
29522
|
+
* @param {TW.DecredV2.Proto.ITransaction=} [properties] Properties to set
|
29523
|
+
* @returns {TW.DecredV2.Proto.Transaction} Transaction instance
|
29524
|
+
*/
|
29525
|
+
Transaction.create = function create(properties) {
|
29526
|
+
return new Transaction(properties);
|
29527
|
+
};
|
29528
|
+
|
29529
|
+
/**
|
29530
|
+
* Encodes the specified Transaction message. Does not implicitly {@link TW.DecredV2.Proto.Transaction.verify|verify} messages.
|
29531
|
+
* @function encode
|
29532
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29533
|
+
* @static
|
29534
|
+
* @param {TW.DecredV2.Proto.ITransaction} message Transaction message or plain object to encode
|
29535
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
29536
|
+
* @returns {$protobuf.Writer} Writer
|
29537
|
+
*/
|
29538
|
+
Transaction.encode = function encode(message, writer) {
|
29539
|
+
if (!writer)
|
29540
|
+
writer = $Writer.create();
|
29541
|
+
if (message.serializeType != null && Object.hasOwnProperty.call(message, "serializeType"))
|
29542
|
+
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.serializeType);
|
29543
|
+
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
29544
|
+
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version);
|
29545
|
+
if (message.inputs != null && message.inputs.length)
|
29546
|
+
for (var i = 0; i < message.inputs.length; ++i)
|
29547
|
+
$root.TW.DecredV2.Proto.TransactionInput.encode(message.inputs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
29548
|
+
if (message.outputs != null && message.outputs.length)
|
29549
|
+
for (var i = 0; i < message.outputs.length; ++i)
|
29550
|
+
$root.TW.DecredV2.Proto.TransactionOutput.encode(message.outputs[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
29551
|
+
if (message.lockTime != null && Object.hasOwnProperty.call(message, "lockTime"))
|
29552
|
+
writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.lockTime);
|
29553
|
+
if (message.expiry != null && Object.hasOwnProperty.call(message, "expiry"))
|
29554
|
+
writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.expiry);
|
29555
|
+
return writer;
|
29556
|
+
};
|
29557
|
+
|
29558
|
+
/**
|
29559
|
+
* Decodes a Transaction message from the specified reader or buffer.
|
29560
|
+
* @function decode
|
29561
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29562
|
+
* @static
|
29563
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
29564
|
+
* @param {number} [length] Message length if known beforehand
|
29565
|
+
* @returns {TW.DecredV2.Proto.Transaction} Transaction
|
29566
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
29567
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
29568
|
+
*/
|
29569
|
+
Transaction.decode = function decode(reader, length) {
|
29570
|
+
if (!(reader instanceof $Reader))
|
29571
|
+
reader = $Reader.create(reader);
|
29572
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.DecredV2.Proto.Transaction();
|
29573
|
+
while (reader.pos < end) {
|
29574
|
+
var tag = reader.uint32();
|
29575
|
+
switch (tag >>> 3) {
|
29576
|
+
case 1:
|
29577
|
+
message.serializeType = reader.uint32();
|
29578
|
+
break;
|
29579
|
+
case 2:
|
29580
|
+
message.version = reader.uint32();
|
29581
|
+
break;
|
29582
|
+
case 3:
|
29583
|
+
if (!(message.inputs && message.inputs.length))
|
29584
|
+
message.inputs = [];
|
29585
|
+
message.inputs.push($root.TW.DecredV2.Proto.TransactionInput.decode(reader, reader.uint32()));
|
29586
|
+
break;
|
29587
|
+
case 4:
|
29588
|
+
if (!(message.outputs && message.outputs.length))
|
29589
|
+
message.outputs = [];
|
29590
|
+
message.outputs.push($root.TW.DecredV2.Proto.TransactionOutput.decode(reader, reader.uint32()));
|
29591
|
+
break;
|
29592
|
+
case 5:
|
29593
|
+
message.lockTime = reader.uint32();
|
29594
|
+
break;
|
29595
|
+
case 6:
|
29596
|
+
message.expiry = reader.uint32();
|
29597
|
+
break;
|
29598
|
+
default:
|
29599
|
+
reader.skipType(tag & 7);
|
29600
|
+
break;
|
29601
|
+
}
|
29602
|
+
}
|
29603
|
+
return message;
|
29604
|
+
};
|
29605
|
+
|
29606
|
+
/**
|
29607
|
+
* Verifies a Transaction message.
|
29608
|
+
* @function verify
|
29609
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29610
|
+
* @static
|
29611
|
+
* @param {Object.<string,*>} message Plain object to verify
|
29612
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
29613
|
+
*/
|
29614
|
+
Transaction.verify = function verify(message) {
|
29615
|
+
if (typeof message !== "object" || message === null)
|
29616
|
+
return "object expected";
|
29617
|
+
if (message.serializeType != null && message.hasOwnProperty("serializeType"))
|
29618
|
+
if (!$util.isInteger(message.serializeType))
|
29619
|
+
return "serializeType: integer expected";
|
29620
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
29621
|
+
if (!$util.isInteger(message.version))
|
29622
|
+
return "version: integer expected";
|
29623
|
+
if (message.inputs != null && message.hasOwnProperty("inputs")) {
|
29624
|
+
if (!Array.isArray(message.inputs))
|
29625
|
+
return "inputs: array expected";
|
29626
|
+
for (var i = 0; i < message.inputs.length; ++i) {
|
29627
|
+
var error = $root.TW.DecredV2.Proto.TransactionInput.verify(message.inputs[i]);
|
29628
|
+
if (error)
|
29629
|
+
return "inputs." + error;
|
29630
|
+
}
|
29631
|
+
}
|
29632
|
+
if (message.outputs != null && message.hasOwnProperty("outputs")) {
|
29633
|
+
if (!Array.isArray(message.outputs))
|
29634
|
+
return "outputs: array expected";
|
29635
|
+
for (var i = 0; i < message.outputs.length; ++i) {
|
29636
|
+
var error = $root.TW.DecredV2.Proto.TransactionOutput.verify(message.outputs[i]);
|
29637
|
+
if (error)
|
29638
|
+
return "outputs." + error;
|
29639
|
+
}
|
29640
|
+
}
|
29641
|
+
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
29642
|
+
if (!$util.isInteger(message.lockTime))
|
29643
|
+
return "lockTime: integer expected";
|
29644
|
+
if (message.expiry != null && message.hasOwnProperty("expiry"))
|
29645
|
+
if (!$util.isInteger(message.expiry))
|
29646
|
+
return "expiry: integer expected";
|
29647
|
+
return null;
|
29648
|
+
};
|
29649
|
+
|
29650
|
+
/**
|
29651
|
+
* Creates a Transaction message from a plain object. Also converts values to their respective internal types.
|
29652
|
+
* @function fromObject
|
29653
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29654
|
+
* @static
|
29655
|
+
* @param {Object.<string,*>} object Plain object
|
29656
|
+
* @returns {TW.DecredV2.Proto.Transaction} Transaction
|
29657
|
+
*/
|
29658
|
+
Transaction.fromObject = function fromObject(object) {
|
29659
|
+
if (object instanceof $root.TW.DecredV2.Proto.Transaction)
|
29660
|
+
return object;
|
29661
|
+
var message = new $root.TW.DecredV2.Proto.Transaction();
|
29662
|
+
if (object.serializeType != null)
|
29663
|
+
message.serializeType = object.serializeType >>> 0;
|
29664
|
+
if (object.version != null)
|
29665
|
+
message.version = object.version >>> 0;
|
29666
|
+
if (object.inputs) {
|
29667
|
+
if (!Array.isArray(object.inputs))
|
29668
|
+
throw TypeError(".TW.DecredV2.Proto.Transaction.inputs: array expected");
|
29669
|
+
message.inputs = [];
|
29670
|
+
for (var i = 0; i < object.inputs.length; ++i) {
|
29671
|
+
if (typeof object.inputs[i] !== "object")
|
29672
|
+
throw TypeError(".TW.DecredV2.Proto.Transaction.inputs: object expected");
|
29673
|
+
message.inputs[i] = $root.TW.DecredV2.Proto.TransactionInput.fromObject(object.inputs[i]);
|
29674
|
+
}
|
29675
|
+
}
|
29676
|
+
if (object.outputs) {
|
29677
|
+
if (!Array.isArray(object.outputs))
|
29678
|
+
throw TypeError(".TW.DecredV2.Proto.Transaction.outputs: array expected");
|
29679
|
+
message.outputs = [];
|
29680
|
+
for (var i = 0; i < object.outputs.length; ++i) {
|
29681
|
+
if (typeof object.outputs[i] !== "object")
|
29682
|
+
throw TypeError(".TW.DecredV2.Proto.Transaction.outputs: object expected");
|
29683
|
+
message.outputs[i] = $root.TW.DecredV2.Proto.TransactionOutput.fromObject(object.outputs[i]);
|
29684
|
+
}
|
29685
|
+
}
|
29686
|
+
if (object.lockTime != null)
|
29687
|
+
message.lockTime = object.lockTime >>> 0;
|
29688
|
+
if (object.expiry != null)
|
29689
|
+
message.expiry = object.expiry >>> 0;
|
29690
|
+
return message;
|
29691
|
+
};
|
29692
|
+
|
29693
|
+
/**
|
29694
|
+
* Creates a plain object from a Transaction message. Also converts values to other types if specified.
|
29695
|
+
* @function toObject
|
29696
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29697
|
+
* @static
|
29698
|
+
* @param {TW.DecredV2.Proto.Transaction} message Transaction
|
29699
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
29700
|
+
* @returns {Object.<string,*>} Plain object
|
29701
|
+
*/
|
29702
|
+
Transaction.toObject = function toObject(message, options) {
|
29703
|
+
if (!options)
|
29704
|
+
options = {};
|
29705
|
+
var object = {};
|
29706
|
+
if (options.arrays || options.defaults) {
|
29707
|
+
object.inputs = [];
|
29708
|
+
object.outputs = [];
|
29709
|
+
}
|
29710
|
+
if (options.defaults) {
|
29711
|
+
object.serializeType = 0;
|
29712
|
+
object.version = 0;
|
29713
|
+
object.lockTime = 0;
|
29714
|
+
object.expiry = 0;
|
29715
|
+
}
|
29716
|
+
if (message.serializeType != null && message.hasOwnProperty("serializeType"))
|
29717
|
+
object.serializeType = message.serializeType;
|
29718
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
29719
|
+
object.version = message.version;
|
29720
|
+
if (message.inputs && message.inputs.length) {
|
29721
|
+
object.inputs = [];
|
29722
|
+
for (var j = 0; j < message.inputs.length; ++j)
|
29723
|
+
object.inputs[j] = $root.TW.DecredV2.Proto.TransactionInput.toObject(message.inputs[j], options);
|
29724
|
+
}
|
29725
|
+
if (message.outputs && message.outputs.length) {
|
29726
|
+
object.outputs = [];
|
29727
|
+
for (var j = 0; j < message.outputs.length; ++j)
|
29728
|
+
object.outputs[j] = $root.TW.DecredV2.Proto.TransactionOutput.toObject(message.outputs[j], options);
|
29729
|
+
}
|
29730
|
+
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
29731
|
+
object.lockTime = message.lockTime;
|
29732
|
+
if (message.expiry != null && message.hasOwnProperty("expiry"))
|
29733
|
+
object.expiry = message.expiry;
|
29734
|
+
return object;
|
29735
|
+
};
|
29736
|
+
|
29737
|
+
/**
|
29738
|
+
* Converts this Transaction to JSON.
|
29739
|
+
* @function toJSON
|
29740
|
+
* @memberof TW.DecredV2.Proto.Transaction
|
29741
|
+
* @instance
|
29742
|
+
* @returns {Object.<string,*>} JSON object
|
29743
|
+
*/
|
29744
|
+
Transaction.prototype.toJSON = function toJSON() {
|
29745
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
29746
|
+
};
|
29747
|
+
|
29748
|
+
return Transaction;
|
29749
|
+
})();
|
29750
|
+
|
29751
|
+
Proto.TransactionInput = (function() {
|
29752
|
+
|
29753
|
+
/**
|
29754
|
+
* Properties of a TransactionInput.
|
29755
|
+
* @memberof TW.DecredV2.Proto
|
29756
|
+
* @interface ITransactionInput
|
29757
|
+
* @property {TW.DecredV2.Proto.IOutPoint|null} [outPoint] TransactionInput outPoint
|
29758
|
+
* @property {number|null} [sequence] TransactionInput sequence
|
29759
|
+
* @property {Long|null} [value] TransactionInput value
|
29760
|
+
* @property {number|null} [blockHeight] TransactionInput blockHeight
|
29761
|
+
* @property {number|null} [blockIndex] TransactionInput blockIndex
|
29762
|
+
* @property {Uint8Array|null} [scriptSig] TransactionInput scriptSig
|
29763
|
+
*/
|
29764
|
+
|
29765
|
+
/**
|
29766
|
+
* Constructs a new TransactionInput.
|
29767
|
+
* @memberof TW.DecredV2.Proto
|
29768
|
+
* @classdesc Represents a TransactionInput.
|
29769
|
+
* @implements ITransactionInput
|
29770
|
+
* @constructor
|
29771
|
+
* @param {TW.DecredV2.Proto.ITransactionInput=} [properties] Properties to set
|
29772
|
+
*/
|
29773
|
+
function TransactionInput(properties) {
|
29774
|
+
if (properties)
|
29775
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
29776
|
+
if (properties[keys[i]] != null)
|
29777
|
+
this[keys[i]] = properties[keys[i]];
|
29778
|
+
}
|
29779
|
+
|
29780
|
+
/**
|
29781
|
+
* TransactionInput outPoint.
|
29782
|
+
* @member {TW.DecredV2.Proto.IOutPoint|null|undefined} outPoint
|
29783
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29784
|
+
* @instance
|
29785
|
+
*/
|
29786
|
+
TransactionInput.prototype.outPoint = null;
|
29787
|
+
|
29788
|
+
/**
|
29789
|
+
* TransactionInput sequence.
|
29790
|
+
* @member {number} sequence
|
29791
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29792
|
+
* @instance
|
29793
|
+
*/
|
29794
|
+
TransactionInput.prototype.sequence = 0;
|
29795
|
+
|
29796
|
+
/**
|
29797
|
+
* TransactionInput value.
|
29798
|
+
* @member {Long} value
|
29799
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29800
|
+
* @instance
|
29801
|
+
*/
|
29802
|
+
TransactionInput.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
|
29803
|
+
|
29804
|
+
/**
|
29805
|
+
* TransactionInput blockHeight.
|
29806
|
+
* @member {number} blockHeight
|
29807
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29808
|
+
* @instance
|
29809
|
+
*/
|
29810
|
+
TransactionInput.prototype.blockHeight = 0;
|
29811
|
+
|
29812
|
+
/**
|
29813
|
+
* TransactionInput blockIndex.
|
29814
|
+
* @member {number} blockIndex
|
29815
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29816
|
+
* @instance
|
29817
|
+
*/
|
29818
|
+
TransactionInput.prototype.blockIndex = 0;
|
29819
|
+
|
29820
|
+
/**
|
29821
|
+
* TransactionInput scriptSig.
|
29822
|
+
* @member {Uint8Array} scriptSig
|
29823
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29824
|
+
* @instance
|
29825
|
+
*/
|
29826
|
+
TransactionInput.prototype.scriptSig = $util.newBuffer([]);
|
29827
|
+
|
29828
|
+
/**
|
29829
|
+
* Creates a new TransactionInput instance using the specified properties.
|
29830
|
+
* @function create
|
29831
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29832
|
+
* @static
|
29833
|
+
* @param {TW.DecredV2.Proto.ITransactionInput=} [properties] Properties to set
|
29834
|
+
* @returns {TW.DecredV2.Proto.TransactionInput} TransactionInput instance
|
29835
|
+
*/
|
29836
|
+
TransactionInput.create = function create(properties) {
|
29837
|
+
return new TransactionInput(properties);
|
29838
|
+
};
|
29839
|
+
|
29840
|
+
/**
|
29841
|
+
* Encodes the specified TransactionInput message. Does not implicitly {@link TW.DecredV2.Proto.TransactionInput.verify|verify} messages.
|
29842
|
+
* @function encode
|
29843
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29844
|
+
* @static
|
29845
|
+
* @param {TW.DecredV2.Proto.ITransactionInput} message TransactionInput message or plain object to encode
|
29846
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
29847
|
+
* @returns {$protobuf.Writer} Writer
|
29848
|
+
*/
|
29849
|
+
TransactionInput.encode = function encode(message, writer) {
|
29850
|
+
if (!writer)
|
29851
|
+
writer = $Writer.create();
|
29852
|
+
if (message.outPoint != null && Object.hasOwnProperty.call(message, "outPoint"))
|
29853
|
+
$root.TW.DecredV2.Proto.OutPoint.encode(message.outPoint, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
29854
|
+
if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence"))
|
29855
|
+
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.sequence);
|
29856
|
+
if (message.value != null && Object.hasOwnProperty.call(message, "value"))
|
29857
|
+
writer.uint32(/* id 3, wireType 0 =*/24).int64(message.value);
|
29858
|
+
if (message.blockHeight != null && Object.hasOwnProperty.call(message, "blockHeight"))
|
29859
|
+
writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.blockHeight);
|
29860
|
+
if (message.blockIndex != null && Object.hasOwnProperty.call(message, "blockIndex"))
|
29861
|
+
writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.blockIndex);
|
29862
|
+
if (message.scriptSig != null && Object.hasOwnProperty.call(message, "scriptSig"))
|
29863
|
+
writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.scriptSig);
|
29864
|
+
return writer;
|
29865
|
+
};
|
29866
|
+
|
29867
|
+
/**
|
29868
|
+
* Decodes a TransactionInput message from the specified reader or buffer.
|
29869
|
+
* @function decode
|
29870
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29871
|
+
* @static
|
29872
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
29873
|
+
* @param {number} [length] Message length if known beforehand
|
29874
|
+
* @returns {TW.DecredV2.Proto.TransactionInput} TransactionInput
|
29875
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
29876
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
29877
|
+
*/
|
29878
|
+
TransactionInput.decode = function decode(reader, length) {
|
29879
|
+
if (!(reader instanceof $Reader))
|
29880
|
+
reader = $Reader.create(reader);
|
29881
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.DecredV2.Proto.TransactionInput();
|
29882
|
+
while (reader.pos < end) {
|
29883
|
+
var tag = reader.uint32();
|
29884
|
+
switch (tag >>> 3) {
|
29885
|
+
case 1:
|
29886
|
+
message.outPoint = $root.TW.DecredV2.Proto.OutPoint.decode(reader, reader.uint32());
|
29887
|
+
break;
|
29888
|
+
case 2:
|
29889
|
+
message.sequence = reader.uint32();
|
29890
|
+
break;
|
29891
|
+
case 3:
|
29892
|
+
message.value = reader.int64();
|
29893
|
+
break;
|
29894
|
+
case 4:
|
29895
|
+
message.blockHeight = reader.uint32();
|
29896
|
+
break;
|
29897
|
+
case 5:
|
29898
|
+
message.blockIndex = reader.uint32();
|
29899
|
+
break;
|
29900
|
+
case 6:
|
29901
|
+
message.scriptSig = reader.bytes();
|
29902
|
+
break;
|
29903
|
+
default:
|
29904
|
+
reader.skipType(tag & 7);
|
29905
|
+
break;
|
29906
|
+
}
|
29907
|
+
}
|
29908
|
+
return message;
|
29909
|
+
};
|
29910
|
+
|
29911
|
+
/**
|
29912
|
+
* Verifies a TransactionInput message.
|
29913
|
+
* @function verify
|
29914
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29915
|
+
* @static
|
29916
|
+
* @param {Object.<string,*>} message Plain object to verify
|
29917
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
29918
|
+
*/
|
29919
|
+
TransactionInput.verify = function verify(message) {
|
29920
|
+
if (typeof message !== "object" || message === null)
|
29921
|
+
return "object expected";
|
29922
|
+
if (message.outPoint != null && message.hasOwnProperty("outPoint")) {
|
29923
|
+
var error = $root.TW.DecredV2.Proto.OutPoint.verify(message.outPoint);
|
29924
|
+
if (error)
|
29925
|
+
return "outPoint." + error;
|
29926
|
+
}
|
29927
|
+
if (message.sequence != null && message.hasOwnProperty("sequence"))
|
29928
|
+
if (!$util.isInteger(message.sequence))
|
29929
|
+
return "sequence: integer expected";
|
29930
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
29931
|
+
if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high)))
|
29932
|
+
return "value: integer|Long expected";
|
29933
|
+
if (message.blockHeight != null && message.hasOwnProperty("blockHeight"))
|
29934
|
+
if (!$util.isInteger(message.blockHeight))
|
29935
|
+
return "blockHeight: integer expected";
|
29936
|
+
if (message.blockIndex != null && message.hasOwnProperty("blockIndex"))
|
29937
|
+
if (!$util.isInteger(message.blockIndex))
|
29938
|
+
return "blockIndex: integer expected";
|
29939
|
+
if (message.scriptSig != null && message.hasOwnProperty("scriptSig"))
|
29940
|
+
if (!(message.scriptSig && typeof message.scriptSig.length === "number" || $util.isString(message.scriptSig)))
|
29941
|
+
return "scriptSig: buffer expected";
|
29942
|
+
return null;
|
29943
|
+
};
|
29944
|
+
|
29945
|
+
/**
|
29946
|
+
* Creates a TransactionInput message from a plain object. Also converts values to their respective internal types.
|
29947
|
+
* @function fromObject
|
29948
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29949
|
+
* @static
|
29950
|
+
* @param {Object.<string,*>} object Plain object
|
29951
|
+
* @returns {TW.DecredV2.Proto.TransactionInput} TransactionInput
|
29952
|
+
*/
|
29953
|
+
TransactionInput.fromObject = function fromObject(object) {
|
29954
|
+
if (object instanceof $root.TW.DecredV2.Proto.TransactionInput)
|
29955
|
+
return object;
|
29956
|
+
var message = new $root.TW.DecredV2.Proto.TransactionInput();
|
29957
|
+
if (object.outPoint != null) {
|
29958
|
+
if (typeof object.outPoint !== "object")
|
29959
|
+
throw TypeError(".TW.DecredV2.Proto.TransactionInput.outPoint: object expected");
|
29960
|
+
message.outPoint = $root.TW.DecredV2.Proto.OutPoint.fromObject(object.outPoint);
|
29961
|
+
}
|
29962
|
+
if (object.sequence != null)
|
29963
|
+
message.sequence = object.sequence >>> 0;
|
29964
|
+
if (object.value != null)
|
29965
|
+
if ($util.Long)
|
29966
|
+
(message.value = $util.Long.fromValue(object.value)).unsigned = false;
|
29967
|
+
else if (typeof object.value === "string")
|
29968
|
+
message.value = parseInt(object.value, 10);
|
29969
|
+
else if (typeof object.value === "number")
|
29970
|
+
message.value = object.value;
|
29971
|
+
else if (typeof object.value === "object")
|
29972
|
+
message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber();
|
29973
|
+
if (object.blockHeight != null)
|
29974
|
+
message.blockHeight = object.blockHeight >>> 0;
|
29975
|
+
if (object.blockIndex != null)
|
29976
|
+
message.blockIndex = object.blockIndex >>> 0;
|
29977
|
+
if (object.scriptSig != null)
|
29978
|
+
if (typeof object.scriptSig === "string")
|
29979
|
+
$util.base64.decode(object.scriptSig, message.scriptSig = $util.newBuffer($util.base64.length(object.scriptSig)), 0);
|
29980
|
+
else if (object.scriptSig.length)
|
29981
|
+
message.scriptSig = object.scriptSig;
|
29982
|
+
return message;
|
29983
|
+
};
|
29984
|
+
|
29985
|
+
/**
|
29986
|
+
* Creates a plain object from a TransactionInput message. Also converts values to other types if specified.
|
29987
|
+
* @function toObject
|
29988
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
29989
|
+
* @static
|
29990
|
+
* @param {TW.DecredV2.Proto.TransactionInput} message TransactionInput
|
29991
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
29992
|
+
* @returns {Object.<string,*>} Plain object
|
29993
|
+
*/
|
29994
|
+
TransactionInput.toObject = function toObject(message, options) {
|
29995
|
+
if (!options)
|
29996
|
+
options = {};
|
29997
|
+
var object = {};
|
29998
|
+
if (options.defaults) {
|
29999
|
+
object.outPoint = null;
|
30000
|
+
object.sequence = 0;
|
30001
|
+
if ($util.Long) {
|
30002
|
+
var long = new $util.Long(0, 0, false);
|
30003
|
+
object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
30004
|
+
} else
|
30005
|
+
object.value = options.longs === String ? "0" : 0;
|
30006
|
+
object.blockHeight = 0;
|
30007
|
+
object.blockIndex = 0;
|
30008
|
+
if (options.bytes === String)
|
30009
|
+
object.scriptSig = "";
|
30010
|
+
else {
|
30011
|
+
object.scriptSig = [];
|
30012
|
+
if (options.bytes !== Array)
|
30013
|
+
object.scriptSig = $util.newBuffer(object.scriptSig);
|
30014
|
+
}
|
30015
|
+
}
|
30016
|
+
if (message.outPoint != null && message.hasOwnProperty("outPoint"))
|
30017
|
+
object.outPoint = $root.TW.DecredV2.Proto.OutPoint.toObject(message.outPoint, options);
|
30018
|
+
if (message.sequence != null && message.hasOwnProperty("sequence"))
|
30019
|
+
object.sequence = message.sequence;
|
30020
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
30021
|
+
if (typeof message.value === "number")
|
30022
|
+
object.value = options.longs === String ? String(message.value) : message.value;
|
30023
|
+
else
|
30024
|
+
object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value;
|
30025
|
+
if (message.blockHeight != null && message.hasOwnProperty("blockHeight"))
|
30026
|
+
object.blockHeight = message.blockHeight;
|
30027
|
+
if (message.blockIndex != null && message.hasOwnProperty("blockIndex"))
|
30028
|
+
object.blockIndex = message.blockIndex;
|
30029
|
+
if (message.scriptSig != null && message.hasOwnProperty("scriptSig"))
|
30030
|
+
object.scriptSig = options.bytes === String ? $util.base64.encode(message.scriptSig, 0, message.scriptSig.length) : options.bytes === Array ? Array.prototype.slice.call(message.scriptSig) : message.scriptSig;
|
30031
|
+
return object;
|
30032
|
+
};
|
30033
|
+
|
30034
|
+
/**
|
30035
|
+
* Converts this TransactionInput to JSON.
|
30036
|
+
* @function toJSON
|
30037
|
+
* @memberof TW.DecredV2.Proto.TransactionInput
|
30038
|
+
* @instance
|
30039
|
+
* @returns {Object.<string,*>} JSON object
|
30040
|
+
*/
|
30041
|
+
TransactionInput.prototype.toJSON = function toJSON() {
|
30042
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
30043
|
+
};
|
30044
|
+
|
30045
|
+
return TransactionInput;
|
30046
|
+
})();
|
30047
|
+
|
30048
|
+
Proto.TransactionOutput = (function() {
|
30049
|
+
|
30050
|
+
/**
|
30051
|
+
* Properties of a TransactionOutput.
|
30052
|
+
* @memberof TW.DecredV2.Proto
|
30053
|
+
* @interface ITransactionOutput
|
30054
|
+
* @property {Long|null} [value] TransactionOutput value
|
30055
|
+
* @property {number|null} [version] TransactionOutput version
|
30056
|
+
* @property {Uint8Array|null} [script] TransactionOutput script
|
30057
|
+
*/
|
30058
|
+
|
30059
|
+
/**
|
30060
|
+
* Constructs a new TransactionOutput.
|
30061
|
+
* @memberof TW.DecredV2.Proto
|
30062
|
+
* @classdesc Represents a TransactionOutput.
|
30063
|
+
* @implements ITransactionOutput
|
30064
|
+
* @constructor
|
30065
|
+
* @param {TW.DecredV2.Proto.ITransactionOutput=} [properties] Properties to set
|
30066
|
+
*/
|
30067
|
+
function TransactionOutput(properties) {
|
30068
|
+
if (properties)
|
30069
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
30070
|
+
if (properties[keys[i]] != null)
|
30071
|
+
this[keys[i]] = properties[keys[i]];
|
30072
|
+
}
|
30073
|
+
|
30074
|
+
/**
|
30075
|
+
* TransactionOutput value.
|
30076
|
+
* @member {Long} value
|
30077
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30078
|
+
* @instance
|
30079
|
+
*/
|
30080
|
+
TransactionOutput.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
|
30081
|
+
|
30082
|
+
/**
|
30083
|
+
* TransactionOutput version.
|
30084
|
+
* @member {number} version
|
30085
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30086
|
+
* @instance
|
30087
|
+
*/
|
30088
|
+
TransactionOutput.prototype.version = 0;
|
30089
|
+
|
30090
|
+
/**
|
30091
|
+
* TransactionOutput script.
|
30092
|
+
* @member {Uint8Array} script
|
30093
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30094
|
+
* @instance
|
30095
|
+
*/
|
30096
|
+
TransactionOutput.prototype.script = $util.newBuffer([]);
|
30097
|
+
|
30098
|
+
/**
|
30099
|
+
* Creates a new TransactionOutput instance using the specified properties.
|
30100
|
+
* @function create
|
30101
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30102
|
+
* @static
|
30103
|
+
* @param {TW.DecredV2.Proto.ITransactionOutput=} [properties] Properties to set
|
30104
|
+
* @returns {TW.DecredV2.Proto.TransactionOutput} TransactionOutput instance
|
30105
|
+
*/
|
30106
|
+
TransactionOutput.create = function create(properties) {
|
30107
|
+
return new TransactionOutput(properties);
|
30108
|
+
};
|
30109
|
+
|
30110
|
+
/**
|
30111
|
+
* Encodes the specified TransactionOutput message. Does not implicitly {@link TW.DecredV2.Proto.TransactionOutput.verify|verify} messages.
|
30112
|
+
* @function encode
|
30113
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30114
|
+
* @static
|
30115
|
+
* @param {TW.DecredV2.Proto.ITransactionOutput} message TransactionOutput message or plain object to encode
|
30116
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
30117
|
+
* @returns {$protobuf.Writer} Writer
|
30118
|
+
*/
|
30119
|
+
TransactionOutput.encode = function encode(message, writer) {
|
30120
|
+
if (!writer)
|
30121
|
+
writer = $Writer.create();
|
30122
|
+
if (message.value != null && Object.hasOwnProperty.call(message, "value"))
|
30123
|
+
writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value);
|
30124
|
+
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
30125
|
+
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.version);
|
30126
|
+
if (message.script != null && Object.hasOwnProperty.call(message, "script"))
|
30127
|
+
writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.script);
|
30128
|
+
return writer;
|
30129
|
+
};
|
30130
|
+
|
30131
|
+
/**
|
30132
|
+
* Decodes a TransactionOutput message from the specified reader or buffer.
|
30133
|
+
* @function decode
|
30134
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30135
|
+
* @static
|
30136
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
30137
|
+
* @param {number} [length] Message length if known beforehand
|
30138
|
+
* @returns {TW.DecredV2.Proto.TransactionOutput} TransactionOutput
|
30139
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
30140
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
30141
|
+
*/
|
30142
|
+
TransactionOutput.decode = function decode(reader, length) {
|
30143
|
+
if (!(reader instanceof $Reader))
|
30144
|
+
reader = $Reader.create(reader);
|
30145
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.DecredV2.Proto.TransactionOutput();
|
30146
|
+
while (reader.pos < end) {
|
30147
|
+
var tag = reader.uint32();
|
30148
|
+
switch (tag >>> 3) {
|
30149
|
+
case 1:
|
30150
|
+
message.value = reader.int64();
|
30151
|
+
break;
|
30152
|
+
case 2:
|
30153
|
+
message.version = reader.uint32();
|
30154
|
+
break;
|
30155
|
+
case 3:
|
30156
|
+
message.script = reader.bytes();
|
30157
|
+
break;
|
30158
|
+
default:
|
30159
|
+
reader.skipType(tag & 7);
|
30160
|
+
break;
|
30161
|
+
}
|
30162
|
+
}
|
30163
|
+
return message;
|
30164
|
+
};
|
30165
|
+
|
30166
|
+
/**
|
30167
|
+
* Verifies a TransactionOutput message.
|
30168
|
+
* @function verify
|
30169
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30170
|
+
* @static
|
30171
|
+
* @param {Object.<string,*>} message Plain object to verify
|
30172
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
30173
|
+
*/
|
30174
|
+
TransactionOutput.verify = function verify(message) {
|
30175
|
+
if (typeof message !== "object" || message === null)
|
30176
|
+
return "object expected";
|
30177
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
30178
|
+
if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high)))
|
30179
|
+
return "value: integer|Long expected";
|
30180
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
30181
|
+
if (!$util.isInteger(message.version))
|
30182
|
+
return "version: integer expected";
|
30183
|
+
if (message.script != null && message.hasOwnProperty("script"))
|
30184
|
+
if (!(message.script && typeof message.script.length === "number" || $util.isString(message.script)))
|
30185
|
+
return "script: buffer expected";
|
30186
|
+
return null;
|
30187
|
+
};
|
30188
|
+
|
30189
|
+
/**
|
30190
|
+
* Creates a TransactionOutput message from a plain object. Also converts values to their respective internal types.
|
30191
|
+
* @function fromObject
|
30192
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
30193
|
+
* @static
|
30194
|
+
* @param {Object.<string,*>} object Plain object
|
30195
|
+
* @returns {TW.DecredV2.Proto.TransactionOutput} TransactionOutput
|
30196
|
+
*/
|
30197
|
+
TransactionOutput.fromObject = function fromObject(object) {
|
30198
|
+
if (object instanceof $root.TW.DecredV2.Proto.TransactionOutput)
|
30199
|
+
return object;
|
30200
|
+
var message = new $root.TW.DecredV2.Proto.TransactionOutput();
|
30201
|
+
if (object.value != null)
|
29043
30202
|
if ($util.Long)
|
29044
|
-
(message.
|
29045
|
-
else if (typeof object.
|
29046
|
-
message.
|
29047
|
-
else if (typeof object.
|
29048
|
-
message.
|
29049
|
-
else if (typeof object.
|
29050
|
-
message.
|
29051
|
-
if (object.
|
29052
|
-
|
29053
|
-
|
29054
|
-
|
29055
|
-
|
29056
|
-
|
29057
|
-
|
29058
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.bitcoin: object expected");
|
29059
|
-
message.bitcoin = $root.TW.Utxo.Proto.Transaction.fromObject(object.bitcoin);
|
29060
|
-
}
|
29061
|
-
if (object.zcash != null) {
|
29062
|
-
if (typeof object.zcash !== "object")
|
29063
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.zcash: object expected");
|
29064
|
-
message.zcash = $root.TW.Zcash.Proto.Transaction.fromObject(object.zcash);
|
29065
|
-
}
|
30203
|
+
(message.value = $util.Long.fromValue(object.value)).unsigned = false;
|
30204
|
+
else if (typeof object.value === "string")
|
30205
|
+
message.value = parseInt(object.value, 10);
|
30206
|
+
else if (typeof object.value === "number")
|
30207
|
+
message.value = object.value;
|
30208
|
+
else if (typeof object.value === "object")
|
30209
|
+
message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber();
|
30210
|
+
if (object.version != null)
|
30211
|
+
message.version = object.version >>> 0;
|
30212
|
+
if (object.script != null)
|
30213
|
+
if (typeof object.script === "string")
|
30214
|
+
$util.base64.decode(object.script, message.script = $util.newBuffer($util.base64.length(object.script)), 0);
|
30215
|
+
else if (object.script.length)
|
30216
|
+
message.script = object.script;
|
29066
30217
|
return message;
|
29067
30218
|
};
|
29068
30219
|
|
29069
30220
|
/**
|
29070
|
-
* Creates a plain object from a
|
30221
|
+
* Creates a plain object from a TransactionOutput message. Also converts values to other types if specified.
|
29071
30222
|
* @function toObject
|
29072
|
-
* @memberof TW.
|
30223
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
29073
30224
|
* @static
|
29074
|
-
* @param {TW.
|
30225
|
+
* @param {TW.DecredV2.Proto.TransactionOutput} message TransactionOutput
|
29075
30226
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
29076
30227
|
* @returns {Object.<string,*>} Plain object
|
29077
30228
|
*/
|
29078
|
-
|
30229
|
+
TransactionOutput.toObject = function toObject(message, options) {
|
29079
30230
|
if (!options)
|
29080
30231
|
options = {};
|
29081
30232
|
var object = {};
|
29082
30233
|
if (options.defaults) {
|
29083
|
-
|
29084
|
-
|
29085
|
-
|
29086
|
-
|
29087
|
-
|
29088
|
-
|
29089
|
-
if (options.bytes !== Array)
|
29090
|
-
object.encoded = $util.newBuffer(object.encoded);
|
29091
|
-
}
|
30234
|
+
if ($util.Long) {
|
30235
|
+
var long = new $util.Long(0, 0, false);
|
30236
|
+
object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
30237
|
+
} else
|
30238
|
+
object.value = options.longs === String ? "0" : 0;
|
30239
|
+
object.version = 0;
|
29092
30240
|
if (options.bytes === String)
|
29093
|
-
object.
|
30241
|
+
object.script = "";
|
29094
30242
|
else {
|
29095
|
-
object.
|
30243
|
+
object.script = [];
|
29096
30244
|
if (options.bytes !== Array)
|
29097
|
-
object.
|
30245
|
+
object.script = $util.newBuffer(object.script);
|
29098
30246
|
}
|
29099
|
-
if ($util.Long) {
|
29100
|
-
var long = new $util.Long(0, 0, true);
|
29101
|
-
object.vsize = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29102
|
-
} else
|
29103
|
-
object.vsize = options.longs === String ? "0" : 0;
|
29104
|
-
if ($util.Long) {
|
29105
|
-
var long = new $util.Long(0, 0, true);
|
29106
|
-
object.weight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29107
|
-
} else
|
29108
|
-
object.weight = options.longs === String ? "0" : 0;
|
29109
|
-
if ($util.Long) {
|
29110
|
-
var long = new $util.Long(0, 0, false);
|
29111
|
-
object.fee = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
29112
|
-
} else
|
29113
|
-
object.fee = options.longs === String ? "0" : 0;
|
29114
|
-
object.psbt = null;
|
29115
30247
|
}
|
29116
|
-
if (message.
|
29117
|
-
|
29118
|
-
|
29119
|
-
object.errorMessage = message.errorMessage;
|
29120
|
-
if (message.encoded != null && message.hasOwnProperty("encoded"))
|
29121
|
-
object.encoded = options.bytes === String ? $util.base64.encode(message.encoded, 0, message.encoded.length) : options.bytes === Array ? Array.prototype.slice.call(message.encoded) : message.encoded;
|
29122
|
-
if (message.txid != null && message.hasOwnProperty("txid"))
|
29123
|
-
object.txid = options.bytes === String ? $util.base64.encode(message.txid, 0, message.txid.length) : options.bytes === Array ? Array.prototype.slice.call(message.txid) : message.txid;
|
29124
|
-
if (message.vsize != null && message.hasOwnProperty("vsize"))
|
29125
|
-
if (typeof message.vsize === "number")
|
29126
|
-
object.vsize = options.longs === String ? String(message.vsize) : message.vsize;
|
29127
|
-
else
|
29128
|
-
object.vsize = options.longs === String ? $util.Long.prototype.toString.call(message.vsize) : options.longs === Number ? new $util.LongBits(message.vsize.low >>> 0, message.vsize.high >>> 0).toNumber(true) : message.vsize;
|
29129
|
-
if (message.weight != null && message.hasOwnProperty("weight"))
|
29130
|
-
if (typeof message.weight === "number")
|
29131
|
-
object.weight = options.longs === String ? String(message.weight) : message.weight;
|
29132
|
-
else
|
29133
|
-
object.weight = options.longs === String ? $util.Long.prototype.toString.call(message.weight) : options.longs === Number ? new $util.LongBits(message.weight.low >>> 0, message.weight.high >>> 0).toNumber(true) : message.weight;
|
29134
|
-
if (message.fee != null && message.hasOwnProperty("fee"))
|
29135
|
-
if (typeof message.fee === "number")
|
29136
|
-
object.fee = options.longs === String ? String(message.fee) : message.fee;
|
30248
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
30249
|
+
if (typeof message.value === "number")
|
30250
|
+
object.value = options.longs === String ? String(message.value) : message.value;
|
29137
30251
|
else
|
29138
|
-
object.
|
29139
|
-
if (message.
|
29140
|
-
object.
|
29141
|
-
if (message.
|
29142
|
-
object.
|
29143
|
-
if (options.oneofs)
|
29144
|
-
object.transaction = "bitcoin";
|
29145
|
-
}
|
29146
|
-
if (message.zcash != null && message.hasOwnProperty("zcash")) {
|
29147
|
-
object.zcash = $root.TW.Zcash.Proto.Transaction.toObject(message.zcash, options);
|
29148
|
-
if (options.oneofs)
|
29149
|
-
object.transaction = "zcash";
|
29150
|
-
}
|
30252
|
+
object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value;
|
30253
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
30254
|
+
object.version = message.version;
|
30255
|
+
if (message.script != null && message.hasOwnProperty("script"))
|
30256
|
+
object.script = options.bytes === String ? $util.base64.encode(message.script, 0, message.script.length) : options.bytes === Array ? Array.prototype.slice.call(message.script) : message.script;
|
29151
30257
|
return object;
|
29152
30258
|
};
|
29153
30259
|
|
29154
30260
|
/**
|
29155
|
-
* Converts this
|
30261
|
+
* Converts this TransactionOutput to JSON.
|
29156
30262
|
* @function toJSON
|
29157
|
-
* @memberof TW.
|
30263
|
+
* @memberof TW.DecredV2.Proto.TransactionOutput
|
29158
30264
|
* @instance
|
29159
30265
|
* @returns {Object.<string,*>} JSON object
|
29160
30266
|
*/
|
29161
|
-
|
30267
|
+
TransactionOutput.prototype.toJSON = function toJSON() {
|
29162
30268
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
29163
30269
|
};
|
29164
30270
|
|
29165
|
-
return
|
30271
|
+
return TransactionOutput;
|
29166
30272
|
})();
|
29167
30273
|
|
29168
30274
|
return Proto;
|
29169
30275
|
})();
|
29170
30276
|
|
29171
|
-
return
|
30277
|
+
return DecredV2;
|
29172
30278
|
})();
|
29173
30279
|
|
29174
30280
|
TW.Utxo = (function() {
|
@@ -29928,7 +31034,7 @@
|
|
29928
31034
|
if (!writer)
|
29929
31035
|
writer = $Writer.create();
|
29930
31036
|
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
29931
|
-
writer.uint32(/* id 1, wireType 0 =*/8).
|
31037
|
+
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.version);
|
29932
31038
|
if (message.lockTime != null && Object.hasOwnProperty.call(message, "lockTime"))
|
29933
31039
|
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.lockTime);
|
29934
31040
|
if (message.inputs != null && message.inputs.length)
|
@@ -29959,7 +31065,7 @@
|
|
29959
31065
|
var tag = reader.uint32();
|
29960
31066
|
switch (tag >>> 3) {
|
29961
31067
|
case 1:
|
29962
|
-
message.version = reader.
|
31068
|
+
message.version = reader.uint32();
|
29963
31069
|
break;
|
29964
31070
|
case 2:
|
29965
31071
|
message.lockTime = reader.uint32();
|
@@ -30033,7 +31139,7 @@
|
|
30033
31139
|
return object;
|
30034
31140
|
var message = new $root.TW.Utxo.Proto.Transaction();
|
30035
31141
|
if (object.version != null)
|
30036
|
-
message.version = object.version
|
31142
|
+
message.version = object.version >>> 0;
|
30037
31143
|
if (object.lockTime != null)
|
30038
31144
|
message.lockTime = object.lockTime >>> 0;
|
30039
31145
|
if (object.inputs) {
|
@@ -30469,7 +31575,7 @@
|
|
30469
31575
|
if (!writer)
|
30470
31576
|
writer = $Writer.create();
|
30471
31577
|
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
30472
|
-
writer.uint32(/* id 1, wireType 0 =*/8).
|
31578
|
+
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.version);
|
30473
31579
|
if (message.versionGroupId != null && Object.hasOwnProperty.call(message, "versionGroupId"))
|
30474
31580
|
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.versionGroupId);
|
30475
31581
|
if (message.inputs != null && message.inputs.length)
|
@@ -30508,7 +31614,7 @@
|
|
30508
31614
|
var tag = reader.uint32();
|
30509
31615
|
switch (tag >>> 3) {
|
30510
31616
|
case 1:
|
30511
|
-
message.version = reader.
|
31617
|
+
message.version = reader.uint32();
|
30512
31618
|
break;
|
30513
31619
|
case 2:
|
30514
31620
|
message.versionGroupId = reader.uint32();
|
@@ -30606,7 +31712,7 @@
|
|
30606
31712
|
return object;
|
30607
31713
|
var message = new $root.TW.Zcash.Proto.Transaction();
|
30608
31714
|
if (object.version != null)
|
30609
|
-
message.version = object.version
|
31715
|
+
message.version = object.version >>> 0;
|
30610
31716
|
if (object.versionGroupId != null)
|
30611
31717
|
message.versionGroupId = object.versionGroupId >>> 0;
|
30612
31718
|
if (object.inputs) {
|
@@ -44641,6 +45747,7 @@
|
|
44641
45747
|
* @property {string|null} [transactionId] SigningOutput transactionId
|
44642
45748
|
* @property {TW.Common.Proto.SigningError|null} [error] SigningOutput error
|
44643
45749
|
* @property {string|null} [errorMessage] SigningOutput errorMessage
|
45750
|
+
* @property {TW.BitcoinV2.Proto.ISigningOutput|null} [signingResultV2] SigningOutput signingResultV2
|
44644
45751
|
*/
|
44645
45752
|
|
44646
45753
|
/**
|
@@ -44698,6 +45805,14 @@
|
|
44698
45805
|
*/
|
44699
45806
|
SigningOutput.prototype.errorMessage = "";
|
44700
45807
|
|
45808
|
+
/**
|
45809
|
+
* SigningOutput signingResultV2.
|
45810
|
+
* @member {TW.BitcoinV2.Proto.ISigningOutput|null|undefined} signingResultV2
|
45811
|
+
* @memberof TW.Decred.Proto.SigningOutput
|
45812
|
+
* @instance
|
45813
|
+
*/
|
45814
|
+
SigningOutput.prototype.signingResultV2 = null;
|
45815
|
+
|
44701
45816
|
/**
|
44702
45817
|
* Creates a new SigningOutput instance using the specified properties.
|
44703
45818
|
* @function create
|
@@ -44732,6 +45847,8 @@
|
|
44732
45847
|
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.error);
|
44733
45848
|
if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage"))
|
44734
45849
|
writer.uint32(/* id 5, wireType 2 =*/42).string(message.errorMessage);
|
45850
|
+
if (message.signingResultV2 != null && Object.hasOwnProperty.call(message, "signingResultV2"))
|
45851
|
+
$root.TW.BitcoinV2.Proto.SigningOutput.encode(message.signingResultV2, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
|
44735
45852
|
return writer;
|
44736
45853
|
};
|
44737
45854
|
|
@@ -44768,6 +45885,9 @@
|
|
44768
45885
|
case 5:
|
44769
45886
|
message.errorMessage = reader.string();
|
44770
45887
|
break;
|
45888
|
+
case 6:
|
45889
|
+
message.signingResultV2 = $root.TW.BitcoinV2.Proto.SigningOutput.decode(reader, reader.uint32());
|
45890
|
+
break;
|
44771
45891
|
default:
|
44772
45892
|
reader.skipType(tag & 7);
|
44773
45893
|
break;
|
@@ -44833,6 +45953,11 @@
|
|
44833
45953
|
if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
|
44834
45954
|
if (!$util.isString(message.errorMessage))
|
44835
45955
|
return "errorMessage: string expected";
|
45956
|
+
if (message.signingResultV2 != null && message.hasOwnProperty("signingResultV2")) {
|
45957
|
+
var error = $root.TW.BitcoinV2.Proto.SigningOutput.verify(message.signingResultV2);
|
45958
|
+
if (error)
|
45959
|
+
return "signingResultV2." + error;
|
45960
|
+
}
|
44836
45961
|
return null;
|
44837
45962
|
};
|
44838
45963
|
|
@@ -44968,6 +46093,11 @@
|
|
44968
46093
|
}
|
44969
46094
|
if (object.errorMessage != null)
|
44970
46095
|
message.errorMessage = String(object.errorMessage);
|
46096
|
+
if (object.signingResultV2 != null) {
|
46097
|
+
if (typeof object.signingResultV2 !== "object")
|
46098
|
+
throw TypeError(".TW.Decred.Proto.SigningOutput.signingResultV2: object expected");
|
46099
|
+
message.signingResultV2 = $root.TW.BitcoinV2.Proto.SigningOutput.fromObject(object.signingResultV2);
|
46100
|
+
}
|
44971
46101
|
return message;
|
44972
46102
|
};
|
44973
46103
|
|
@@ -44996,6 +46126,7 @@
|
|
44996
46126
|
object.transactionId = "";
|
44997
46127
|
object.error = options.enums === String ? "OK" : 0;
|
44998
46128
|
object.errorMessage = "";
|
46129
|
+
object.signingResultV2 = null;
|
44999
46130
|
}
|
45000
46131
|
if (message.transaction != null && message.hasOwnProperty("transaction"))
|
45001
46132
|
object.transaction = $root.TW.Decred.Proto.Transaction.toObject(message.transaction, options);
|
@@ -45007,6 +46138,8 @@
|
|
45007
46138
|
object.error = options.enums === String ? $root.TW.Common.Proto.SigningError[message.error] : message.error;
|
45008
46139
|
if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
|
45009
46140
|
object.errorMessage = message.errorMessage;
|
46141
|
+
if (message.signingResultV2 != null && message.hasOwnProperty("signingResultV2"))
|
46142
|
+
object.signingResultV2 = $root.TW.BitcoinV2.Proto.SigningOutput.toObject(message.signingResultV2, options);
|
45010
46143
|
return object;
|
45011
46144
|
};
|
45012
46145
|
|