@trustwallet/wallet-core 4.1.8-rc2 → 4.1.9
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 +217 -50
- package/dist/generated/core_proto.js +770 -334
- package/dist/lib/wallet-core.js +1 -1
- package/dist/lib/wallet-core.wasm +0 -0
- package/package.json +1 -1
@@ -23100,6 +23100,7 @@
|
|
23100
23100
|
* @interface IChainInfo
|
23101
23101
|
* @property {number|null} [p2pkhPrefix] ChainInfo p2pkhPrefix
|
23102
23102
|
* @property {number|null} [p2shPrefix] ChainInfo p2shPrefix
|
23103
|
+
* @property {string|null} [hrp] ChainInfo hrp
|
23103
23104
|
*/
|
23104
23105
|
|
23105
23106
|
/**
|
@@ -23133,6 +23134,14 @@
|
|
23133
23134
|
*/
|
23134
23135
|
ChainInfo.prototype.p2shPrefix = 0;
|
23135
23136
|
|
23137
|
+
/**
|
23138
|
+
* ChainInfo hrp.
|
23139
|
+
* @member {string} hrp
|
23140
|
+
* @memberof TW.BitcoinV2.Proto.ChainInfo
|
23141
|
+
* @instance
|
23142
|
+
*/
|
23143
|
+
ChainInfo.prototype.hrp = "";
|
23144
|
+
|
23136
23145
|
/**
|
23137
23146
|
* Creates a new ChainInfo instance using the specified properties.
|
23138
23147
|
* @function create
|
@@ -23161,6 +23170,8 @@
|
|
23161
23170
|
writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.p2pkhPrefix);
|
23162
23171
|
if (message.p2shPrefix != null && Object.hasOwnProperty.call(message, "p2shPrefix"))
|
23163
23172
|
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.p2shPrefix);
|
23173
|
+
if (message.hrp != null && Object.hasOwnProperty.call(message, "hrp"))
|
23174
|
+
writer.uint32(/* id 3, wireType 2 =*/26).string(message.hrp);
|
23164
23175
|
return writer;
|
23165
23176
|
};
|
23166
23177
|
|
@@ -23188,6 +23199,9 @@
|
|
23188
23199
|
case 2:
|
23189
23200
|
message.p2shPrefix = reader.uint32();
|
23190
23201
|
break;
|
23202
|
+
case 3:
|
23203
|
+
message.hrp = reader.string();
|
23204
|
+
break;
|
23191
23205
|
default:
|
23192
23206
|
reader.skipType(tag & 7);
|
23193
23207
|
break;
|
@@ -23213,6 +23227,9 @@
|
|
23213
23227
|
if (message.p2shPrefix != null && message.hasOwnProperty("p2shPrefix"))
|
23214
23228
|
if (!$util.isInteger(message.p2shPrefix))
|
23215
23229
|
return "p2shPrefix: integer expected";
|
23230
|
+
if (message.hrp != null && message.hasOwnProperty("hrp"))
|
23231
|
+
if (!$util.isString(message.hrp))
|
23232
|
+
return "hrp: string expected";
|
23216
23233
|
return null;
|
23217
23234
|
};
|
23218
23235
|
|
@@ -23232,6 +23249,8 @@
|
|
23232
23249
|
message.p2pkhPrefix = object.p2pkhPrefix >>> 0;
|
23233
23250
|
if (object.p2shPrefix != null)
|
23234
23251
|
message.p2shPrefix = object.p2shPrefix >>> 0;
|
23252
|
+
if (object.hrp != null)
|
23253
|
+
message.hrp = String(object.hrp);
|
23235
23254
|
return message;
|
23236
23255
|
};
|
23237
23256
|
|
@@ -23251,11 +23270,14 @@
|
|
23251
23270
|
if (options.defaults) {
|
23252
23271
|
object.p2pkhPrefix = 0;
|
23253
23272
|
object.p2shPrefix = 0;
|
23273
|
+
object.hrp = "";
|
23254
23274
|
}
|
23255
23275
|
if (message.p2pkhPrefix != null && message.hasOwnProperty("p2pkhPrefix"))
|
23256
23276
|
object.p2pkhPrefix = message.p2pkhPrefix;
|
23257
23277
|
if (message.p2shPrefix != null && message.hasOwnProperty("p2shPrefix"))
|
23258
23278
|
object.p2shPrefix = message.p2shPrefix;
|
23279
|
+
if (message.hrp != null && message.hasOwnProperty("hrp"))
|
23280
|
+
object.hrp = message.hrp;
|
23259
23281
|
return object;
|
23260
23282
|
};
|
23261
23283
|
|
@@ -23289,38 +23311,32 @@
|
|
23289
23311
|
return values;
|
23290
23312
|
})();
|
23291
23313
|
|
23292
|
-
Proto.
|
23314
|
+
Proto.TransactionBuilder = (function() {
|
23293
23315
|
|
23294
23316
|
/**
|
23295
|
-
* Properties of a
|
23317
|
+
* Properties of a TransactionBuilder.
|
23296
23318
|
* @memberof TW.BitcoinV2.Proto
|
23297
|
-
* @interface
|
23298
|
-
* @property {TW.BitcoinV2.Proto.TransactionVersion|null} [version]
|
23299
|
-
* @property {
|
23300
|
-
* @property {Array.<
|
23301
|
-
* @property {
|
23302
|
-
* @property {
|
23303
|
-
* @property {
|
23304
|
-
* @property {TW.BitcoinV2.Proto.
|
23305
|
-
* @property {
|
23306
|
-
* @property {
|
23307
|
-
* @property {TW.BitcoinV2.Proto.IOutput|null} [maxAmountOutput] SigningInput maxAmountOutput
|
23308
|
-
* @property {TW.BitcoinV2.Proto.IChainInfo|null} [chainInfo] SigningInput chainInfo
|
23309
|
-
* @property {Long|null} [fixedDustThreshold] SigningInput fixedDustThreshold
|
23310
|
-
* @property {boolean|null} [dangerousUseFixedSchnorrRng] SigningInput dangerousUseFixedSchnorrRng
|
23319
|
+
* @interface ITransactionBuilder
|
23320
|
+
* @property {TW.BitcoinV2.Proto.TransactionVersion|null} [version] TransactionBuilder version
|
23321
|
+
* @property {number|null} [lockTime] TransactionBuilder lockTime
|
23322
|
+
* @property {Array.<TW.BitcoinV2.Proto.IInput>|null} [inputs] TransactionBuilder inputs
|
23323
|
+
* @property {Array.<TW.BitcoinV2.Proto.IOutput>|null} [outputs] TransactionBuilder outputs
|
23324
|
+
* @property {TW.BitcoinV2.Proto.InputSelector|null} [inputSelector] TransactionBuilder inputSelector
|
23325
|
+
* @property {Long|null} [feePerVb] TransactionBuilder feePerVb
|
23326
|
+
* @property {TW.BitcoinV2.Proto.IOutput|null} [changeOutput] TransactionBuilder changeOutput
|
23327
|
+
* @property {TW.BitcoinV2.Proto.IOutput|null} [maxAmountOutput] TransactionBuilder maxAmountOutput
|
23328
|
+
* @property {Long|null} [fixedDustThreshold] TransactionBuilder fixedDustThreshold
|
23311
23329
|
*/
|
23312
23330
|
|
23313
23331
|
/**
|
23314
|
-
* Constructs a new
|
23332
|
+
* Constructs a new TransactionBuilder.
|
23315
23333
|
* @memberof TW.BitcoinV2.Proto
|
23316
|
-
* @classdesc Represents a
|
23317
|
-
* @implements
|
23334
|
+
* @classdesc Represents a TransactionBuilder.
|
23335
|
+
* @implements ITransactionBuilder
|
23318
23336
|
* @constructor
|
23319
|
-
* @param {TW.BitcoinV2.Proto.
|
23337
|
+
* @param {TW.BitcoinV2.Proto.ITransactionBuilder=} [properties] Properties to set
|
23320
23338
|
*/
|
23321
|
-
function
|
23322
|
-
this.privateKeys = [];
|
23323
|
-
this.publicKeys = [];
|
23339
|
+
function TransactionBuilder(properties) {
|
23324
23340
|
this.inputs = [];
|
23325
23341
|
this.outputs = [];
|
23326
23342
|
if (properties)
|
@@ -23330,177 +23346,742 @@
|
|
23330
23346
|
}
|
23331
23347
|
|
23332
23348
|
/**
|
23333
|
-
*
|
23349
|
+
* TransactionBuilder version.
|
23334
23350
|
* @member {TW.BitcoinV2.Proto.TransactionVersion} version
|
23335
|
-
* @memberof TW.BitcoinV2.Proto.
|
23336
|
-
* @instance
|
23337
|
-
*/
|
23338
|
-
SigningInput.prototype.version = 0;
|
23339
|
-
|
23340
|
-
/**
|
23341
|
-
* SigningInput privateKeys.
|
23342
|
-
* @member {Array.<Uint8Array>} privateKeys
|
23343
|
-
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23344
|
-
* @instance
|
23345
|
-
*/
|
23346
|
-
SigningInput.prototype.privateKeys = $util.emptyArray;
|
23347
|
-
|
23348
|
-
/**
|
23349
|
-
* SigningInput publicKeys.
|
23350
|
-
* @member {Array.<Uint8Array>} publicKeys
|
23351
|
-
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23351
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23352
23352
|
* @instance
|
23353
23353
|
*/
|
23354
|
-
|
23354
|
+
TransactionBuilder.prototype.version = 0;
|
23355
23355
|
|
23356
23356
|
/**
|
23357
|
-
*
|
23357
|
+
* TransactionBuilder lockTime.
|
23358
23358
|
* @member {number} lockTime
|
23359
|
-
* @memberof TW.BitcoinV2.Proto.
|
23359
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23360
23360
|
* @instance
|
23361
23361
|
*/
|
23362
|
-
|
23362
|
+
TransactionBuilder.prototype.lockTime = 0;
|
23363
23363
|
|
23364
23364
|
/**
|
23365
|
-
*
|
23365
|
+
* TransactionBuilder inputs.
|
23366
23366
|
* @member {Array.<TW.BitcoinV2.Proto.IInput>} inputs
|
23367
|
-
* @memberof TW.BitcoinV2.Proto.
|
23367
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23368
23368
|
* @instance
|
23369
23369
|
*/
|
23370
|
-
|
23370
|
+
TransactionBuilder.prototype.inputs = $util.emptyArray;
|
23371
23371
|
|
23372
23372
|
/**
|
23373
|
-
*
|
23373
|
+
* TransactionBuilder outputs.
|
23374
23374
|
* @member {Array.<TW.BitcoinV2.Proto.IOutput>} outputs
|
23375
|
-
* @memberof TW.BitcoinV2.Proto.
|
23375
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23376
23376
|
* @instance
|
23377
23377
|
*/
|
23378
|
-
|
23378
|
+
TransactionBuilder.prototype.outputs = $util.emptyArray;
|
23379
23379
|
|
23380
23380
|
/**
|
23381
|
-
*
|
23381
|
+
* TransactionBuilder inputSelector.
|
23382
23382
|
* @member {TW.BitcoinV2.Proto.InputSelector} inputSelector
|
23383
|
-
* @memberof TW.BitcoinV2.Proto.
|
23383
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23384
23384
|
* @instance
|
23385
23385
|
*/
|
23386
|
-
|
23386
|
+
TransactionBuilder.prototype.inputSelector = 0;
|
23387
23387
|
|
23388
23388
|
/**
|
23389
|
-
*
|
23389
|
+
* TransactionBuilder feePerVb.
|
23390
23390
|
* @member {Long} feePerVb
|
23391
|
-
* @memberof TW.BitcoinV2.Proto.
|
23391
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23392
23392
|
* @instance
|
23393
23393
|
*/
|
23394
|
-
|
23394
|
+
TransactionBuilder.prototype.feePerVb = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
|
23395
23395
|
|
23396
23396
|
/**
|
23397
|
-
*
|
23397
|
+
* TransactionBuilder changeOutput.
|
23398
23398
|
* @member {TW.BitcoinV2.Proto.IOutput|null|undefined} changeOutput
|
23399
|
-
* @memberof TW.BitcoinV2.Proto.
|
23399
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23400
23400
|
* @instance
|
23401
23401
|
*/
|
23402
|
-
|
23402
|
+
TransactionBuilder.prototype.changeOutput = null;
|
23403
23403
|
|
23404
23404
|
/**
|
23405
|
-
*
|
23405
|
+
* TransactionBuilder maxAmountOutput.
|
23406
23406
|
* @member {TW.BitcoinV2.Proto.IOutput|null|undefined} maxAmountOutput
|
23407
|
-
* @memberof TW.BitcoinV2.Proto.
|
23408
|
-
* @instance
|
23409
|
-
*/
|
23410
|
-
SigningInput.prototype.maxAmountOutput = null;
|
23411
|
-
|
23412
|
-
/**
|
23413
|
-
* SigningInput chainInfo.
|
23414
|
-
* @member {TW.BitcoinV2.Proto.IChainInfo|null|undefined} chainInfo
|
23415
|
-
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23407
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23416
23408
|
* @instance
|
23417
23409
|
*/
|
23418
|
-
|
23410
|
+
TransactionBuilder.prototype.maxAmountOutput = null;
|
23419
23411
|
|
23420
23412
|
/**
|
23421
|
-
*
|
23413
|
+
* TransactionBuilder fixedDustThreshold.
|
23422
23414
|
* @member {Long|null|undefined} fixedDustThreshold
|
23423
|
-
* @memberof TW.BitcoinV2.Proto.
|
23424
|
-
* @instance
|
23425
|
-
*/
|
23426
|
-
SigningInput.prototype.fixedDustThreshold = null;
|
23427
|
-
|
23428
|
-
/**
|
23429
|
-
* SigningInput dangerousUseFixedSchnorrRng.
|
23430
|
-
* @member {boolean} dangerousUseFixedSchnorrRng
|
23431
|
-
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23415
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23432
23416
|
* @instance
|
23433
23417
|
*/
|
23434
|
-
|
23418
|
+
TransactionBuilder.prototype.fixedDustThreshold = null;
|
23435
23419
|
|
23436
23420
|
// OneOf field names bound to virtual getters and setters
|
23437
23421
|
var $oneOfFields;
|
23438
23422
|
|
23439
23423
|
/**
|
23440
|
-
*
|
23424
|
+
* TransactionBuilder dustPolicy.
|
23441
23425
|
* @member {"fixedDustThreshold"|undefined} dustPolicy
|
23442
|
-
* @memberof TW.BitcoinV2.Proto.
|
23426
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23443
23427
|
* @instance
|
23444
23428
|
*/
|
23445
|
-
Object.defineProperty(
|
23429
|
+
Object.defineProperty(TransactionBuilder.prototype, "dustPolicy", {
|
23446
23430
|
get: $util.oneOfGetter($oneOfFields = ["fixedDustThreshold"]),
|
23447
23431
|
set: $util.oneOfSetter($oneOfFields)
|
23448
23432
|
});
|
23449
23433
|
|
23450
23434
|
/**
|
23451
|
-
* Creates a new
|
23435
|
+
* Creates a new TransactionBuilder instance using the specified properties.
|
23452
23436
|
* @function create
|
23453
|
-
* @memberof TW.BitcoinV2.Proto.
|
23437
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23454
23438
|
* @static
|
23455
|
-
* @param {TW.BitcoinV2.Proto.
|
23456
|
-
* @returns {TW.BitcoinV2.Proto.
|
23439
|
+
* @param {TW.BitcoinV2.Proto.ITransactionBuilder=} [properties] Properties to set
|
23440
|
+
* @returns {TW.BitcoinV2.Proto.TransactionBuilder} TransactionBuilder instance
|
23457
23441
|
*/
|
23458
|
-
|
23459
|
-
return new
|
23442
|
+
TransactionBuilder.create = function create(properties) {
|
23443
|
+
return new TransactionBuilder(properties);
|
23460
23444
|
};
|
23461
23445
|
|
23462
23446
|
/**
|
23463
|
-
* Encodes the specified
|
23447
|
+
* Encodes the specified TransactionBuilder message. Does not implicitly {@link TW.BitcoinV2.Proto.TransactionBuilder.verify|verify} messages.
|
23464
23448
|
* @function encode
|
23465
|
-
* @memberof TW.BitcoinV2.Proto.
|
23449
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23466
23450
|
* @static
|
23467
|
-
* @param {TW.BitcoinV2.Proto.
|
23451
|
+
* @param {TW.BitcoinV2.Proto.ITransactionBuilder} message TransactionBuilder message or plain object to encode
|
23468
23452
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
23469
23453
|
* @returns {$protobuf.Writer} Writer
|
23470
23454
|
*/
|
23471
|
-
|
23455
|
+
TransactionBuilder.encode = function encode(message, writer) {
|
23472
23456
|
if (!writer)
|
23473
23457
|
writer = $Writer.create();
|
23474
23458
|
if (message.version != null && Object.hasOwnProperty.call(message, "version"))
|
23475
23459
|
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version);
|
23476
|
-
if (message.privateKeys != null && message.privateKeys.length)
|
23477
|
-
for (var i = 0; i < message.privateKeys.length; ++i)
|
23478
|
-
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.privateKeys[i]);
|
23479
|
-
if (message.publicKeys != null && message.publicKeys.length)
|
23480
|
-
for (var i = 0; i < message.publicKeys.length; ++i)
|
23481
|
-
writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.publicKeys[i]);
|
23482
23460
|
if (message.lockTime != null && Object.hasOwnProperty.call(message, "lockTime"))
|
23483
|
-
writer.uint32(/* id
|
23461
|
+
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.lockTime);
|
23484
23462
|
if (message.inputs != null && message.inputs.length)
|
23485
23463
|
for (var i = 0; i < message.inputs.length; ++i)
|
23486
|
-
$root.TW.BitcoinV2.Proto.Input.encode(message.inputs[i], writer.uint32(/* id
|
23464
|
+
$root.TW.BitcoinV2.Proto.Input.encode(message.inputs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
23487
23465
|
if (message.outputs != null && message.outputs.length)
|
23488
23466
|
for (var i = 0; i < message.outputs.length; ++i)
|
23489
|
-
$root.TW.BitcoinV2.Proto.Output.encode(message.outputs[i], writer.uint32(/* id
|
23467
|
+
$root.TW.BitcoinV2.Proto.Output.encode(message.outputs[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
23490
23468
|
if (message.inputSelector != null && Object.hasOwnProperty.call(message, "inputSelector"))
|
23491
|
-
writer.uint32(/* id
|
23469
|
+
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.inputSelector);
|
23492
23470
|
if (message.feePerVb != null && Object.hasOwnProperty.call(message, "feePerVb"))
|
23493
|
-
writer.uint32(/* id
|
23471
|
+
writer.uint32(/* id 6, wireType 0 =*/48).int64(message.feePerVb);
|
23494
23472
|
if (message.changeOutput != null && Object.hasOwnProperty.call(message, "changeOutput"))
|
23495
|
-
$root.TW.BitcoinV2.Proto.Output.encode(message.changeOutput, writer.uint32(/* id
|
23473
|
+
$root.TW.BitcoinV2.Proto.Output.encode(message.changeOutput, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
|
23496
23474
|
if (message.maxAmountOutput != null && Object.hasOwnProperty.call(message, "maxAmountOutput"))
|
23497
|
-
$root.TW.BitcoinV2.Proto.Output.encode(message.maxAmountOutput, writer.uint32(/* id
|
23475
|
+
$root.TW.BitcoinV2.Proto.Output.encode(message.maxAmountOutput, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
|
23476
|
+
if (message.fixedDustThreshold != null && Object.hasOwnProperty.call(message, "fixedDustThreshold"))
|
23477
|
+
writer.uint32(/* id 14, wireType 0 =*/112).int64(message.fixedDustThreshold);
|
23478
|
+
return writer;
|
23479
|
+
};
|
23480
|
+
|
23481
|
+
/**
|
23482
|
+
* Decodes a TransactionBuilder message from the specified reader or buffer.
|
23483
|
+
* @function decode
|
23484
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23485
|
+
* @static
|
23486
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
23487
|
+
* @param {number} [length] Message length if known beforehand
|
23488
|
+
* @returns {TW.BitcoinV2.Proto.TransactionBuilder} TransactionBuilder
|
23489
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
23490
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
23491
|
+
*/
|
23492
|
+
TransactionBuilder.decode = function decode(reader, length) {
|
23493
|
+
if (!(reader instanceof $Reader))
|
23494
|
+
reader = $Reader.create(reader);
|
23495
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.BitcoinV2.Proto.TransactionBuilder();
|
23496
|
+
while (reader.pos < end) {
|
23497
|
+
var tag = reader.uint32();
|
23498
|
+
switch (tag >>> 3) {
|
23499
|
+
case 1:
|
23500
|
+
message.version = reader.int32();
|
23501
|
+
break;
|
23502
|
+
case 2:
|
23503
|
+
message.lockTime = reader.uint32();
|
23504
|
+
break;
|
23505
|
+
case 3:
|
23506
|
+
if (!(message.inputs && message.inputs.length))
|
23507
|
+
message.inputs = [];
|
23508
|
+
message.inputs.push($root.TW.BitcoinV2.Proto.Input.decode(reader, reader.uint32()));
|
23509
|
+
break;
|
23510
|
+
case 4:
|
23511
|
+
if (!(message.outputs && message.outputs.length))
|
23512
|
+
message.outputs = [];
|
23513
|
+
message.outputs.push($root.TW.BitcoinV2.Proto.Output.decode(reader, reader.uint32()));
|
23514
|
+
break;
|
23515
|
+
case 5:
|
23516
|
+
message.inputSelector = reader.int32();
|
23517
|
+
break;
|
23518
|
+
case 6:
|
23519
|
+
message.feePerVb = reader.int64();
|
23520
|
+
break;
|
23521
|
+
case 7:
|
23522
|
+
message.changeOutput = $root.TW.BitcoinV2.Proto.Output.decode(reader, reader.uint32());
|
23523
|
+
break;
|
23524
|
+
case 8:
|
23525
|
+
message.maxAmountOutput = $root.TW.BitcoinV2.Proto.Output.decode(reader, reader.uint32());
|
23526
|
+
break;
|
23527
|
+
case 14:
|
23528
|
+
message.fixedDustThreshold = reader.int64();
|
23529
|
+
break;
|
23530
|
+
default:
|
23531
|
+
reader.skipType(tag & 7);
|
23532
|
+
break;
|
23533
|
+
}
|
23534
|
+
}
|
23535
|
+
return message;
|
23536
|
+
};
|
23537
|
+
|
23538
|
+
/**
|
23539
|
+
* Verifies a TransactionBuilder message.
|
23540
|
+
* @function verify
|
23541
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23542
|
+
* @static
|
23543
|
+
* @param {Object.<string,*>} message Plain object to verify
|
23544
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
23545
|
+
*/
|
23546
|
+
TransactionBuilder.verify = function verify(message) {
|
23547
|
+
if (typeof message !== "object" || message === null)
|
23548
|
+
return "object expected";
|
23549
|
+
var properties = {};
|
23550
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
23551
|
+
switch (message.version) {
|
23552
|
+
default:
|
23553
|
+
return "version: enum value expected";
|
23554
|
+
case 0:
|
23555
|
+
case 1:
|
23556
|
+
case 2:
|
23557
|
+
break;
|
23558
|
+
}
|
23559
|
+
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
23560
|
+
if (!$util.isInteger(message.lockTime))
|
23561
|
+
return "lockTime: integer expected";
|
23562
|
+
if (message.inputs != null && message.hasOwnProperty("inputs")) {
|
23563
|
+
if (!Array.isArray(message.inputs))
|
23564
|
+
return "inputs: array expected";
|
23565
|
+
for (var i = 0; i < message.inputs.length; ++i) {
|
23566
|
+
var error = $root.TW.BitcoinV2.Proto.Input.verify(message.inputs[i]);
|
23567
|
+
if (error)
|
23568
|
+
return "inputs." + error;
|
23569
|
+
}
|
23570
|
+
}
|
23571
|
+
if (message.outputs != null && message.hasOwnProperty("outputs")) {
|
23572
|
+
if (!Array.isArray(message.outputs))
|
23573
|
+
return "outputs: array expected";
|
23574
|
+
for (var i = 0; i < message.outputs.length; ++i) {
|
23575
|
+
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.outputs[i]);
|
23576
|
+
if (error)
|
23577
|
+
return "outputs." + error;
|
23578
|
+
}
|
23579
|
+
}
|
23580
|
+
if (message.inputSelector != null && message.hasOwnProperty("inputSelector"))
|
23581
|
+
switch (message.inputSelector) {
|
23582
|
+
default:
|
23583
|
+
return "inputSelector: enum value expected";
|
23584
|
+
case 0:
|
23585
|
+
case 1:
|
23586
|
+
case 2:
|
23587
|
+
case 10:
|
23588
|
+
break;
|
23589
|
+
}
|
23590
|
+
if (message.feePerVb != null && message.hasOwnProperty("feePerVb"))
|
23591
|
+
if (!$util.isInteger(message.feePerVb) && !(message.feePerVb && $util.isInteger(message.feePerVb.low) && $util.isInteger(message.feePerVb.high)))
|
23592
|
+
return "feePerVb: integer|Long expected";
|
23593
|
+
if (message.changeOutput != null && message.hasOwnProperty("changeOutput")) {
|
23594
|
+
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.changeOutput);
|
23595
|
+
if (error)
|
23596
|
+
return "changeOutput." + error;
|
23597
|
+
}
|
23598
|
+
if (message.maxAmountOutput != null && message.hasOwnProperty("maxAmountOutput")) {
|
23599
|
+
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.maxAmountOutput);
|
23600
|
+
if (error)
|
23601
|
+
return "maxAmountOutput." + error;
|
23602
|
+
}
|
23603
|
+
if (message.fixedDustThreshold != null && message.hasOwnProperty("fixedDustThreshold")) {
|
23604
|
+
properties.dustPolicy = 1;
|
23605
|
+
if (!$util.isInteger(message.fixedDustThreshold) && !(message.fixedDustThreshold && $util.isInteger(message.fixedDustThreshold.low) && $util.isInteger(message.fixedDustThreshold.high)))
|
23606
|
+
return "fixedDustThreshold: integer|Long expected";
|
23607
|
+
}
|
23608
|
+
return null;
|
23609
|
+
};
|
23610
|
+
|
23611
|
+
/**
|
23612
|
+
* Creates a TransactionBuilder message from a plain object. Also converts values to their respective internal types.
|
23613
|
+
* @function fromObject
|
23614
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23615
|
+
* @static
|
23616
|
+
* @param {Object.<string,*>} object Plain object
|
23617
|
+
* @returns {TW.BitcoinV2.Proto.TransactionBuilder} TransactionBuilder
|
23618
|
+
*/
|
23619
|
+
TransactionBuilder.fromObject = function fromObject(object) {
|
23620
|
+
if (object instanceof $root.TW.BitcoinV2.Proto.TransactionBuilder)
|
23621
|
+
return object;
|
23622
|
+
var message = new $root.TW.BitcoinV2.Proto.TransactionBuilder();
|
23623
|
+
switch (object.version) {
|
23624
|
+
case "UseDefault":
|
23625
|
+
case 0:
|
23626
|
+
message.version = 0;
|
23627
|
+
break;
|
23628
|
+
case "V1":
|
23629
|
+
case 1:
|
23630
|
+
message.version = 1;
|
23631
|
+
break;
|
23632
|
+
case "V2":
|
23633
|
+
case 2:
|
23634
|
+
message.version = 2;
|
23635
|
+
break;
|
23636
|
+
}
|
23637
|
+
if (object.lockTime != null)
|
23638
|
+
message.lockTime = object.lockTime >>> 0;
|
23639
|
+
if (object.inputs) {
|
23640
|
+
if (!Array.isArray(object.inputs))
|
23641
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.inputs: array expected");
|
23642
|
+
message.inputs = [];
|
23643
|
+
for (var i = 0; i < object.inputs.length; ++i) {
|
23644
|
+
if (typeof object.inputs[i] !== "object")
|
23645
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.inputs: object expected");
|
23646
|
+
message.inputs[i] = $root.TW.BitcoinV2.Proto.Input.fromObject(object.inputs[i]);
|
23647
|
+
}
|
23648
|
+
}
|
23649
|
+
if (object.outputs) {
|
23650
|
+
if (!Array.isArray(object.outputs))
|
23651
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.outputs: array expected");
|
23652
|
+
message.outputs = [];
|
23653
|
+
for (var i = 0; i < object.outputs.length; ++i) {
|
23654
|
+
if (typeof object.outputs[i] !== "object")
|
23655
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.outputs: object expected");
|
23656
|
+
message.outputs[i] = $root.TW.BitcoinV2.Proto.Output.fromObject(object.outputs[i]);
|
23657
|
+
}
|
23658
|
+
}
|
23659
|
+
switch (object.inputSelector) {
|
23660
|
+
case "SelectAscending":
|
23661
|
+
case 0:
|
23662
|
+
message.inputSelector = 0;
|
23663
|
+
break;
|
23664
|
+
case "SelectInOrder":
|
23665
|
+
case 1:
|
23666
|
+
message.inputSelector = 1;
|
23667
|
+
break;
|
23668
|
+
case "SelectDescending":
|
23669
|
+
case 2:
|
23670
|
+
message.inputSelector = 2;
|
23671
|
+
break;
|
23672
|
+
case "UseAll":
|
23673
|
+
case 10:
|
23674
|
+
message.inputSelector = 10;
|
23675
|
+
break;
|
23676
|
+
}
|
23677
|
+
if (object.feePerVb != null)
|
23678
|
+
if ($util.Long)
|
23679
|
+
(message.feePerVb = $util.Long.fromValue(object.feePerVb)).unsigned = false;
|
23680
|
+
else if (typeof object.feePerVb === "string")
|
23681
|
+
message.feePerVb = parseInt(object.feePerVb, 10);
|
23682
|
+
else if (typeof object.feePerVb === "number")
|
23683
|
+
message.feePerVb = object.feePerVb;
|
23684
|
+
else if (typeof object.feePerVb === "object")
|
23685
|
+
message.feePerVb = new $util.LongBits(object.feePerVb.low >>> 0, object.feePerVb.high >>> 0).toNumber();
|
23686
|
+
if (object.changeOutput != null) {
|
23687
|
+
if (typeof object.changeOutput !== "object")
|
23688
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.changeOutput: object expected");
|
23689
|
+
message.changeOutput = $root.TW.BitcoinV2.Proto.Output.fromObject(object.changeOutput);
|
23690
|
+
}
|
23691
|
+
if (object.maxAmountOutput != null) {
|
23692
|
+
if (typeof object.maxAmountOutput !== "object")
|
23693
|
+
throw TypeError(".TW.BitcoinV2.Proto.TransactionBuilder.maxAmountOutput: object expected");
|
23694
|
+
message.maxAmountOutput = $root.TW.BitcoinV2.Proto.Output.fromObject(object.maxAmountOutput);
|
23695
|
+
}
|
23696
|
+
if (object.fixedDustThreshold != null)
|
23697
|
+
if ($util.Long)
|
23698
|
+
(message.fixedDustThreshold = $util.Long.fromValue(object.fixedDustThreshold)).unsigned = false;
|
23699
|
+
else if (typeof object.fixedDustThreshold === "string")
|
23700
|
+
message.fixedDustThreshold = parseInt(object.fixedDustThreshold, 10);
|
23701
|
+
else if (typeof object.fixedDustThreshold === "number")
|
23702
|
+
message.fixedDustThreshold = object.fixedDustThreshold;
|
23703
|
+
else if (typeof object.fixedDustThreshold === "object")
|
23704
|
+
message.fixedDustThreshold = new $util.LongBits(object.fixedDustThreshold.low >>> 0, object.fixedDustThreshold.high >>> 0).toNumber();
|
23705
|
+
return message;
|
23706
|
+
};
|
23707
|
+
|
23708
|
+
/**
|
23709
|
+
* Creates a plain object from a TransactionBuilder message. Also converts values to other types if specified.
|
23710
|
+
* @function toObject
|
23711
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23712
|
+
* @static
|
23713
|
+
* @param {TW.BitcoinV2.Proto.TransactionBuilder} message TransactionBuilder
|
23714
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
23715
|
+
* @returns {Object.<string,*>} Plain object
|
23716
|
+
*/
|
23717
|
+
TransactionBuilder.toObject = function toObject(message, options) {
|
23718
|
+
if (!options)
|
23719
|
+
options = {};
|
23720
|
+
var object = {};
|
23721
|
+
if (options.arrays || options.defaults) {
|
23722
|
+
object.inputs = [];
|
23723
|
+
object.outputs = [];
|
23724
|
+
}
|
23725
|
+
if (options.defaults) {
|
23726
|
+
object.version = options.enums === String ? "UseDefault" : 0;
|
23727
|
+
object.lockTime = 0;
|
23728
|
+
object.inputSelector = options.enums === String ? "SelectAscending" : 0;
|
23729
|
+
if ($util.Long) {
|
23730
|
+
var long = new $util.Long(0, 0, false);
|
23731
|
+
object.feePerVb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
23732
|
+
} else
|
23733
|
+
object.feePerVb = options.longs === String ? "0" : 0;
|
23734
|
+
object.changeOutput = null;
|
23735
|
+
object.maxAmountOutput = null;
|
23736
|
+
}
|
23737
|
+
if (message.version != null && message.hasOwnProperty("version"))
|
23738
|
+
object.version = options.enums === String ? $root.TW.BitcoinV2.Proto.TransactionVersion[message.version] : message.version;
|
23739
|
+
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
23740
|
+
object.lockTime = message.lockTime;
|
23741
|
+
if (message.inputs && message.inputs.length) {
|
23742
|
+
object.inputs = [];
|
23743
|
+
for (var j = 0; j < message.inputs.length; ++j)
|
23744
|
+
object.inputs[j] = $root.TW.BitcoinV2.Proto.Input.toObject(message.inputs[j], options);
|
23745
|
+
}
|
23746
|
+
if (message.outputs && message.outputs.length) {
|
23747
|
+
object.outputs = [];
|
23748
|
+
for (var j = 0; j < message.outputs.length; ++j)
|
23749
|
+
object.outputs[j] = $root.TW.BitcoinV2.Proto.Output.toObject(message.outputs[j], options);
|
23750
|
+
}
|
23751
|
+
if (message.inputSelector != null && message.hasOwnProperty("inputSelector"))
|
23752
|
+
object.inputSelector = options.enums === String ? $root.TW.BitcoinV2.Proto.InputSelector[message.inputSelector] : message.inputSelector;
|
23753
|
+
if (message.feePerVb != null && message.hasOwnProperty("feePerVb"))
|
23754
|
+
if (typeof message.feePerVb === "number")
|
23755
|
+
object.feePerVb = options.longs === String ? String(message.feePerVb) : message.feePerVb;
|
23756
|
+
else
|
23757
|
+
object.feePerVb = options.longs === String ? $util.Long.prototype.toString.call(message.feePerVb) : options.longs === Number ? new $util.LongBits(message.feePerVb.low >>> 0, message.feePerVb.high >>> 0).toNumber() : message.feePerVb;
|
23758
|
+
if (message.changeOutput != null && message.hasOwnProperty("changeOutput"))
|
23759
|
+
object.changeOutput = $root.TW.BitcoinV2.Proto.Output.toObject(message.changeOutput, options);
|
23760
|
+
if (message.maxAmountOutput != null && message.hasOwnProperty("maxAmountOutput"))
|
23761
|
+
object.maxAmountOutput = $root.TW.BitcoinV2.Proto.Output.toObject(message.maxAmountOutput, options);
|
23762
|
+
if (message.fixedDustThreshold != null && message.hasOwnProperty("fixedDustThreshold")) {
|
23763
|
+
if (typeof message.fixedDustThreshold === "number")
|
23764
|
+
object.fixedDustThreshold = options.longs === String ? String(message.fixedDustThreshold) : message.fixedDustThreshold;
|
23765
|
+
else
|
23766
|
+
object.fixedDustThreshold = options.longs === String ? $util.Long.prototype.toString.call(message.fixedDustThreshold) : options.longs === Number ? new $util.LongBits(message.fixedDustThreshold.low >>> 0, message.fixedDustThreshold.high >>> 0).toNumber() : message.fixedDustThreshold;
|
23767
|
+
if (options.oneofs)
|
23768
|
+
object.dustPolicy = "fixedDustThreshold";
|
23769
|
+
}
|
23770
|
+
return object;
|
23771
|
+
};
|
23772
|
+
|
23773
|
+
/**
|
23774
|
+
* Converts this TransactionBuilder to JSON.
|
23775
|
+
* @function toJSON
|
23776
|
+
* @memberof TW.BitcoinV2.Proto.TransactionBuilder
|
23777
|
+
* @instance
|
23778
|
+
* @returns {Object.<string,*>} JSON object
|
23779
|
+
*/
|
23780
|
+
TransactionBuilder.prototype.toJSON = function toJSON() {
|
23781
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
23782
|
+
};
|
23783
|
+
|
23784
|
+
return TransactionBuilder;
|
23785
|
+
})();
|
23786
|
+
|
23787
|
+
Proto.Psbt = (function() {
|
23788
|
+
|
23789
|
+
/**
|
23790
|
+
* Properties of a Psbt.
|
23791
|
+
* @memberof TW.BitcoinV2.Proto
|
23792
|
+
* @interface IPsbt
|
23793
|
+
* @property {Uint8Array|null} [psbt] Psbt psbt
|
23794
|
+
*/
|
23795
|
+
|
23796
|
+
/**
|
23797
|
+
* Constructs a new Psbt.
|
23798
|
+
* @memberof TW.BitcoinV2.Proto
|
23799
|
+
* @classdesc Represents a Psbt.
|
23800
|
+
* @implements IPsbt
|
23801
|
+
* @constructor
|
23802
|
+
* @param {TW.BitcoinV2.Proto.IPsbt=} [properties] Properties to set
|
23803
|
+
*/
|
23804
|
+
function Psbt(properties) {
|
23805
|
+
if (properties)
|
23806
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
23807
|
+
if (properties[keys[i]] != null)
|
23808
|
+
this[keys[i]] = properties[keys[i]];
|
23809
|
+
}
|
23810
|
+
|
23811
|
+
/**
|
23812
|
+
* Psbt psbt.
|
23813
|
+
* @member {Uint8Array} psbt
|
23814
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23815
|
+
* @instance
|
23816
|
+
*/
|
23817
|
+
Psbt.prototype.psbt = $util.newBuffer([]);
|
23818
|
+
|
23819
|
+
/**
|
23820
|
+
* Creates a new Psbt instance using the specified properties.
|
23821
|
+
* @function create
|
23822
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23823
|
+
* @static
|
23824
|
+
* @param {TW.BitcoinV2.Proto.IPsbt=} [properties] Properties to set
|
23825
|
+
* @returns {TW.BitcoinV2.Proto.Psbt} Psbt instance
|
23826
|
+
*/
|
23827
|
+
Psbt.create = function create(properties) {
|
23828
|
+
return new Psbt(properties);
|
23829
|
+
};
|
23830
|
+
|
23831
|
+
/**
|
23832
|
+
* Encodes the specified Psbt message. Does not implicitly {@link TW.BitcoinV2.Proto.Psbt.verify|verify} messages.
|
23833
|
+
* @function encode
|
23834
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23835
|
+
* @static
|
23836
|
+
* @param {TW.BitcoinV2.Proto.IPsbt} message Psbt message or plain object to encode
|
23837
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
23838
|
+
* @returns {$protobuf.Writer} Writer
|
23839
|
+
*/
|
23840
|
+
Psbt.encode = function encode(message, writer) {
|
23841
|
+
if (!writer)
|
23842
|
+
writer = $Writer.create();
|
23843
|
+
if (message.psbt != null && Object.hasOwnProperty.call(message, "psbt"))
|
23844
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.psbt);
|
23845
|
+
return writer;
|
23846
|
+
};
|
23847
|
+
|
23848
|
+
/**
|
23849
|
+
* Decodes a Psbt message from the specified reader or buffer.
|
23850
|
+
* @function decode
|
23851
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23852
|
+
* @static
|
23853
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
23854
|
+
* @param {number} [length] Message length if known beforehand
|
23855
|
+
* @returns {TW.BitcoinV2.Proto.Psbt} Psbt
|
23856
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
23857
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
23858
|
+
*/
|
23859
|
+
Psbt.decode = function decode(reader, length) {
|
23860
|
+
if (!(reader instanceof $Reader))
|
23861
|
+
reader = $Reader.create(reader);
|
23862
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.BitcoinV2.Proto.Psbt();
|
23863
|
+
while (reader.pos < end) {
|
23864
|
+
var tag = reader.uint32();
|
23865
|
+
switch (tag >>> 3) {
|
23866
|
+
case 1:
|
23867
|
+
message.psbt = reader.bytes();
|
23868
|
+
break;
|
23869
|
+
default:
|
23870
|
+
reader.skipType(tag & 7);
|
23871
|
+
break;
|
23872
|
+
}
|
23873
|
+
}
|
23874
|
+
return message;
|
23875
|
+
};
|
23876
|
+
|
23877
|
+
/**
|
23878
|
+
* Verifies a Psbt message.
|
23879
|
+
* @function verify
|
23880
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23881
|
+
* @static
|
23882
|
+
* @param {Object.<string,*>} message Plain object to verify
|
23883
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
23884
|
+
*/
|
23885
|
+
Psbt.verify = function verify(message) {
|
23886
|
+
if (typeof message !== "object" || message === null)
|
23887
|
+
return "object expected";
|
23888
|
+
if (message.psbt != null && message.hasOwnProperty("psbt"))
|
23889
|
+
if (!(message.psbt && typeof message.psbt.length === "number" || $util.isString(message.psbt)))
|
23890
|
+
return "psbt: buffer expected";
|
23891
|
+
return null;
|
23892
|
+
};
|
23893
|
+
|
23894
|
+
/**
|
23895
|
+
* Creates a Psbt message from a plain object. Also converts values to their respective internal types.
|
23896
|
+
* @function fromObject
|
23897
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23898
|
+
* @static
|
23899
|
+
* @param {Object.<string,*>} object Plain object
|
23900
|
+
* @returns {TW.BitcoinV2.Proto.Psbt} Psbt
|
23901
|
+
*/
|
23902
|
+
Psbt.fromObject = function fromObject(object) {
|
23903
|
+
if (object instanceof $root.TW.BitcoinV2.Proto.Psbt)
|
23904
|
+
return object;
|
23905
|
+
var message = new $root.TW.BitcoinV2.Proto.Psbt();
|
23906
|
+
if (object.psbt != null)
|
23907
|
+
if (typeof object.psbt === "string")
|
23908
|
+
$util.base64.decode(object.psbt, message.psbt = $util.newBuffer($util.base64.length(object.psbt)), 0);
|
23909
|
+
else if (object.psbt.length)
|
23910
|
+
message.psbt = object.psbt;
|
23911
|
+
return message;
|
23912
|
+
};
|
23913
|
+
|
23914
|
+
/**
|
23915
|
+
* Creates a plain object from a Psbt message. Also converts values to other types if specified.
|
23916
|
+
* @function toObject
|
23917
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23918
|
+
* @static
|
23919
|
+
* @param {TW.BitcoinV2.Proto.Psbt} message Psbt
|
23920
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
23921
|
+
* @returns {Object.<string,*>} Plain object
|
23922
|
+
*/
|
23923
|
+
Psbt.toObject = function toObject(message, options) {
|
23924
|
+
if (!options)
|
23925
|
+
options = {};
|
23926
|
+
var object = {};
|
23927
|
+
if (options.defaults)
|
23928
|
+
if (options.bytes === String)
|
23929
|
+
object.psbt = "";
|
23930
|
+
else {
|
23931
|
+
object.psbt = [];
|
23932
|
+
if (options.bytes !== Array)
|
23933
|
+
object.psbt = $util.newBuffer(object.psbt);
|
23934
|
+
}
|
23935
|
+
if (message.psbt != null && message.hasOwnProperty("psbt"))
|
23936
|
+
object.psbt = options.bytes === String ? $util.base64.encode(message.psbt, 0, message.psbt.length) : options.bytes === Array ? Array.prototype.slice.call(message.psbt) : message.psbt;
|
23937
|
+
return object;
|
23938
|
+
};
|
23939
|
+
|
23940
|
+
/**
|
23941
|
+
* Converts this Psbt to JSON.
|
23942
|
+
* @function toJSON
|
23943
|
+
* @memberof TW.BitcoinV2.Proto.Psbt
|
23944
|
+
* @instance
|
23945
|
+
* @returns {Object.<string,*>} JSON object
|
23946
|
+
*/
|
23947
|
+
Psbt.prototype.toJSON = function toJSON() {
|
23948
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
23949
|
+
};
|
23950
|
+
|
23951
|
+
return Psbt;
|
23952
|
+
})();
|
23953
|
+
|
23954
|
+
Proto.SigningInput = (function() {
|
23955
|
+
|
23956
|
+
/**
|
23957
|
+
* Properties of a SigningInput.
|
23958
|
+
* @memberof TW.BitcoinV2.Proto
|
23959
|
+
* @interface ISigningInput
|
23960
|
+
* @property {Array.<Uint8Array>|null} [privateKeys] SigningInput privateKeys
|
23961
|
+
* @property {Array.<Uint8Array>|null} [publicKeys] SigningInput publicKeys
|
23962
|
+
* @property {TW.BitcoinV2.Proto.IChainInfo|null} [chainInfo] SigningInput chainInfo
|
23963
|
+
* @property {boolean|null} [dangerousUseFixedSchnorrRng] SigningInput dangerousUseFixedSchnorrRng
|
23964
|
+
* @property {TW.BitcoinV2.Proto.ITransactionBuilder|null} [builder] SigningInput builder
|
23965
|
+
* @property {TW.BitcoinV2.Proto.IPsbt|null} [psbt] SigningInput psbt
|
23966
|
+
*/
|
23967
|
+
|
23968
|
+
/**
|
23969
|
+
* Constructs a new SigningInput.
|
23970
|
+
* @memberof TW.BitcoinV2.Proto
|
23971
|
+
* @classdesc Represents a SigningInput.
|
23972
|
+
* @implements ISigningInput
|
23973
|
+
* @constructor
|
23974
|
+
* @param {TW.BitcoinV2.Proto.ISigningInput=} [properties] Properties to set
|
23975
|
+
*/
|
23976
|
+
function SigningInput(properties) {
|
23977
|
+
this.privateKeys = [];
|
23978
|
+
this.publicKeys = [];
|
23979
|
+
if (properties)
|
23980
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
23981
|
+
if (properties[keys[i]] != null)
|
23982
|
+
this[keys[i]] = properties[keys[i]];
|
23983
|
+
}
|
23984
|
+
|
23985
|
+
/**
|
23986
|
+
* SigningInput privateKeys.
|
23987
|
+
* @member {Array.<Uint8Array>} privateKeys
|
23988
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23989
|
+
* @instance
|
23990
|
+
*/
|
23991
|
+
SigningInput.prototype.privateKeys = $util.emptyArray;
|
23992
|
+
|
23993
|
+
/**
|
23994
|
+
* SigningInput publicKeys.
|
23995
|
+
* @member {Array.<Uint8Array>} publicKeys
|
23996
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
23997
|
+
* @instance
|
23998
|
+
*/
|
23999
|
+
SigningInput.prototype.publicKeys = $util.emptyArray;
|
24000
|
+
|
24001
|
+
/**
|
24002
|
+
* SigningInput chainInfo.
|
24003
|
+
* @member {TW.BitcoinV2.Proto.IChainInfo|null|undefined} chainInfo
|
24004
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24005
|
+
* @instance
|
24006
|
+
*/
|
24007
|
+
SigningInput.prototype.chainInfo = null;
|
24008
|
+
|
24009
|
+
/**
|
24010
|
+
* SigningInput dangerousUseFixedSchnorrRng.
|
24011
|
+
* @member {boolean} dangerousUseFixedSchnorrRng
|
24012
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24013
|
+
* @instance
|
24014
|
+
*/
|
24015
|
+
SigningInput.prototype.dangerousUseFixedSchnorrRng = false;
|
24016
|
+
|
24017
|
+
/**
|
24018
|
+
* SigningInput builder.
|
24019
|
+
* @member {TW.BitcoinV2.Proto.ITransactionBuilder|null|undefined} builder
|
24020
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24021
|
+
* @instance
|
24022
|
+
*/
|
24023
|
+
SigningInput.prototype.builder = null;
|
24024
|
+
|
24025
|
+
/**
|
24026
|
+
* SigningInput psbt.
|
24027
|
+
* @member {TW.BitcoinV2.Proto.IPsbt|null|undefined} psbt
|
24028
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24029
|
+
* @instance
|
24030
|
+
*/
|
24031
|
+
SigningInput.prototype.psbt = null;
|
24032
|
+
|
24033
|
+
// OneOf field names bound to virtual getters and setters
|
24034
|
+
var $oneOfFields;
|
24035
|
+
|
24036
|
+
/**
|
24037
|
+
* SigningInput transaction.
|
24038
|
+
* @member {"builder"|"psbt"|undefined} transaction
|
24039
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24040
|
+
* @instance
|
24041
|
+
*/
|
24042
|
+
Object.defineProperty(SigningInput.prototype, "transaction", {
|
24043
|
+
get: $util.oneOfGetter($oneOfFields = ["builder", "psbt"]),
|
24044
|
+
set: $util.oneOfSetter($oneOfFields)
|
24045
|
+
});
|
24046
|
+
|
24047
|
+
/**
|
24048
|
+
* Creates a new SigningInput instance using the specified properties.
|
24049
|
+
* @function create
|
24050
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24051
|
+
* @static
|
24052
|
+
* @param {TW.BitcoinV2.Proto.ISigningInput=} [properties] Properties to set
|
24053
|
+
* @returns {TW.BitcoinV2.Proto.SigningInput} SigningInput instance
|
24054
|
+
*/
|
24055
|
+
SigningInput.create = function create(properties) {
|
24056
|
+
return new SigningInput(properties);
|
24057
|
+
};
|
24058
|
+
|
24059
|
+
/**
|
24060
|
+
* Encodes the specified SigningInput message. Does not implicitly {@link TW.BitcoinV2.Proto.SigningInput.verify|verify} messages.
|
24061
|
+
* @function encode
|
24062
|
+
* @memberof TW.BitcoinV2.Proto.SigningInput
|
24063
|
+
* @static
|
24064
|
+
* @param {TW.BitcoinV2.Proto.ISigningInput} message SigningInput message or plain object to encode
|
24065
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
24066
|
+
* @returns {$protobuf.Writer} Writer
|
24067
|
+
*/
|
24068
|
+
SigningInput.encode = function encode(message, writer) {
|
24069
|
+
if (!writer)
|
24070
|
+
writer = $Writer.create();
|
24071
|
+
if (message.privateKeys != null && message.privateKeys.length)
|
24072
|
+
for (var i = 0; i < message.privateKeys.length; ++i)
|
24073
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.privateKeys[i]);
|
24074
|
+
if (message.publicKeys != null && message.publicKeys.length)
|
24075
|
+
for (var i = 0; i < message.publicKeys.length; ++i)
|
24076
|
+
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.publicKeys[i]);
|
23498
24077
|
if (message.chainInfo != null && Object.hasOwnProperty.call(message, "chainInfo"))
|
23499
|
-
$root.TW.BitcoinV2.Proto.ChainInfo.encode(message.chainInfo, writer.uint32(/* id
|
23500
|
-
if (message.fixedDustThreshold != null && Object.hasOwnProperty.call(message, "fixedDustThreshold"))
|
23501
|
-
writer.uint32(/* id 14, wireType 0 =*/112).int64(message.fixedDustThreshold);
|
24078
|
+
$root.TW.BitcoinV2.Proto.ChainInfo.encode(message.chainInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
23502
24079
|
if (message.dangerousUseFixedSchnorrRng != null && Object.hasOwnProperty.call(message, "dangerousUseFixedSchnorrRng"))
|
23503
|
-
writer.uint32(/* id
|
24080
|
+
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.dangerousUseFixedSchnorrRng);
|
24081
|
+
if (message.builder != null && Object.hasOwnProperty.call(message, "builder"))
|
24082
|
+
$root.TW.BitcoinV2.Proto.TransactionBuilder.encode(message.builder, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
|
24083
|
+
if (message.psbt != null && Object.hasOwnProperty.call(message, "psbt"))
|
24084
|
+
$root.TW.BitcoinV2.Proto.Psbt.encode(message.psbt, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
|
23504
24085
|
return writer;
|
23505
24086
|
};
|
23506
24087
|
|
@@ -23523,51 +24104,26 @@
|
|
23523
24104
|
var tag = reader.uint32();
|
23524
24105
|
switch (tag >>> 3) {
|
23525
24106
|
case 1:
|
23526
|
-
message.version = reader.int32();
|
23527
|
-
break;
|
23528
|
-
case 2:
|
23529
24107
|
if (!(message.privateKeys && message.privateKeys.length))
|
23530
24108
|
message.privateKeys = [];
|
23531
24109
|
message.privateKeys.push(reader.bytes());
|
23532
24110
|
break;
|
23533
|
-
case
|
24111
|
+
case 2:
|
23534
24112
|
if (!(message.publicKeys && message.publicKeys.length))
|
23535
24113
|
message.publicKeys = [];
|
23536
24114
|
message.publicKeys.push(reader.bytes());
|
23537
24115
|
break;
|
23538
|
-
case
|
23539
|
-
message.
|
23540
|
-
break;
|
23541
|
-
case 5:
|
23542
|
-
if (!(message.inputs && message.inputs.length))
|
23543
|
-
message.inputs = [];
|
23544
|
-
message.inputs.push($root.TW.BitcoinV2.Proto.Input.decode(reader, reader.uint32()));
|
23545
|
-
break;
|
23546
|
-
case 6:
|
23547
|
-
if (!(message.outputs && message.outputs.length))
|
23548
|
-
message.outputs = [];
|
23549
|
-
message.outputs.push($root.TW.BitcoinV2.Proto.Output.decode(reader, reader.uint32()));
|
23550
|
-
break;
|
23551
|
-
case 7:
|
23552
|
-
message.inputSelector = reader.int32();
|
23553
|
-
break;
|
23554
|
-
case 8:
|
23555
|
-
message.feePerVb = reader.int64();
|
24116
|
+
case 3:
|
24117
|
+
message.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.decode(reader, reader.uint32());
|
23556
24118
|
break;
|
23557
|
-
case
|
23558
|
-
message.
|
24119
|
+
case 4:
|
24120
|
+
message.dangerousUseFixedSchnorrRng = reader.bool();
|
23559
24121
|
break;
|
23560
24122
|
case 10:
|
23561
|
-
message.
|
23562
|
-
break;
|
23563
|
-
case 13:
|
23564
|
-
message.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.decode(reader, reader.uint32());
|
23565
|
-
break;
|
23566
|
-
case 14:
|
23567
|
-
message.fixedDustThreshold = reader.int64();
|
24123
|
+
message.builder = $root.TW.BitcoinV2.Proto.TransactionBuilder.decode(reader, reader.uint32());
|
23568
24124
|
break;
|
23569
|
-
case
|
23570
|
-
message.
|
24125
|
+
case 11:
|
24126
|
+
message.psbt = $root.TW.BitcoinV2.Proto.Psbt.decode(reader, reader.uint32());
|
23571
24127
|
break;
|
23572
24128
|
default:
|
23573
24129
|
reader.skipType(tag & 7);
|
@@ -23589,15 +24145,6 @@
|
|
23589
24145
|
if (typeof message !== "object" || message === null)
|
23590
24146
|
return "object expected";
|
23591
24147
|
var properties = {};
|
23592
|
-
if (message.version != null && message.hasOwnProperty("version"))
|
23593
|
-
switch (message.version) {
|
23594
|
-
default:
|
23595
|
-
return "version: enum value expected";
|
23596
|
-
case 0:
|
23597
|
-
case 1:
|
23598
|
-
case 2:
|
23599
|
-
break;
|
23600
|
-
}
|
23601
24148
|
if (message.privateKeys != null && message.hasOwnProperty("privateKeys")) {
|
23602
24149
|
if (!Array.isArray(message.privateKeys))
|
23603
24150
|
return "privateKeys: array expected";
|
@@ -23612,63 +24159,32 @@
|
|
23612
24159
|
if (!(message.publicKeys[i] && typeof message.publicKeys[i].length === "number" || $util.isString(message.publicKeys[i])))
|
23613
24160
|
return "publicKeys: buffer[] expected";
|
23614
24161
|
}
|
23615
|
-
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
23616
|
-
if (!$util.isInteger(message.lockTime))
|
23617
|
-
return "lockTime: integer expected";
|
23618
|
-
if (message.inputs != null && message.hasOwnProperty("inputs")) {
|
23619
|
-
if (!Array.isArray(message.inputs))
|
23620
|
-
return "inputs: array expected";
|
23621
|
-
for (var i = 0; i < message.inputs.length; ++i) {
|
23622
|
-
var error = $root.TW.BitcoinV2.Proto.Input.verify(message.inputs[i]);
|
23623
|
-
if (error)
|
23624
|
-
return "inputs." + error;
|
23625
|
-
}
|
23626
|
-
}
|
23627
|
-
if (message.outputs != null && message.hasOwnProperty("outputs")) {
|
23628
|
-
if (!Array.isArray(message.outputs))
|
23629
|
-
return "outputs: array expected";
|
23630
|
-
for (var i = 0; i < message.outputs.length; ++i) {
|
23631
|
-
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.outputs[i]);
|
23632
|
-
if (error)
|
23633
|
-
return "outputs." + error;
|
23634
|
-
}
|
23635
|
-
}
|
23636
|
-
if (message.inputSelector != null && message.hasOwnProperty("inputSelector"))
|
23637
|
-
switch (message.inputSelector) {
|
23638
|
-
default:
|
23639
|
-
return "inputSelector: enum value expected";
|
23640
|
-
case 0:
|
23641
|
-
case 1:
|
23642
|
-
case 2:
|
23643
|
-
case 10:
|
23644
|
-
break;
|
23645
|
-
}
|
23646
|
-
if (message.feePerVb != null && message.hasOwnProperty("feePerVb"))
|
23647
|
-
if (!$util.isInteger(message.feePerVb) && !(message.feePerVb && $util.isInteger(message.feePerVb.low) && $util.isInteger(message.feePerVb.high)))
|
23648
|
-
return "feePerVb: integer|Long expected";
|
23649
|
-
if (message.changeOutput != null && message.hasOwnProperty("changeOutput")) {
|
23650
|
-
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.changeOutput);
|
23651
|
-
if (error)
|
23652
|
-
return "changeOutput." + error;
|
23653
|
-
}
|
23654
|
-
if (message.maxAmountOutput != null && message.hasOwnProperty("maxAmountOutput")) {
|
23655
|
-
var error = $root.TW.BitcoinV2.Proto.Output.verify(message.maxAmountOutput);
|
23656
|
-
if (error)
|
23657
|
-
return "maxAmountOutput." + error;
|
23658
|
-
}
|
23659
24162
|
if (message.chainInfo != null && message.hasOwnProperty("chainInfo")) {
|
23660
24163
|
var error = $root.TW.BitcoinV2.Proto.ChainInfo.verify(message.chainInfo);
|
23661
24164
|
if (error)
|
23662
24165
|
return "chainInfo." + error;
|
23663
24166
|
}
|
23664
|
-
if (message.fixedDustThreshold != null && message.hasOwnProperty("fixedDustThreshold")) {
|
23665
|
-
properties.dustPolicy = 1;
|
23666
|
-
if (!$util.isInteger(message.fixedDustThreshold) && !(message.fixedDustThreshold && $util.isInteger(message.fixedDustThreshold.low) && $util.isInteger(message.fixedDustThreshold.high)))
|
23667
|
-
return "fixedDustThreshold: integer|Long expected";
|
23668
|
-
}
|
23669
24167
|
if (message.dangerousUseFixedSchnorrRng != null && message.hasOwnProperty("dangerousUseFixedSchnorrRng"))
|
23670
24168
|
if (typeof message.dangerousUseFixedSchnorrRng !== "boolean")
|
23671
24169
|
return "dangerousUseFixedSchnorrRng: boolean expected";
|
24170
|
+
if (message.builder != null && message.hasOwnProperty("builder")) {
|
24171
|
+
properties.transaction = 1;
|
24172
|
+
{
|
24173
|
+
var error = $root.TW.BitcoinV2.Proto.TransactionBuilder.verify(message.builder);
|
24174
|
+
if (error)
|
24175
|
+
return "builder." + error;
|
24176
|
+
}
|
24177
|
+
}
|
24178
|
+
if (message.psbt != null && message.hasOwnProperty("psbt")) {
|
24179
|
+
if (properties.transaction === 1)
|
24180
|
+
return "transaction: multiple values";
|
24181
|
+
properties.transaction = 1;
|
24182
|
+
{
|
24183
|
+
var error = $root.TW.BitcoinV2.Proto.Psbt.verify(message.psbt);
|
24184
|
+
if (error)
|
24185
|
+
return "psbt." + error;
|
24186
|
+
}
|
24187
|
+
}
|
23672
24188
|
return null;
|
23673
24189
|
};
|
23674
24190
|
|
@@ -23684,20 +24200,6 @@
|
|
23684
24200
|
if (object instanceof $root.TW.BitcoinV2.Proto.SigningInput)
|
23685
24201
|
return object;
|
23686
24202
|
var message = new $root.TW.BitcoinV2.Proto.SigningInput();
|
23687
|
-
switch (object.version) {
|
23688
|
-
case "UseDefault":
|
23689
|
-
case 0:
|
23690
|
-
message.version = 0;
|
23691
|
-
break;
|
23692
|
-
case "V1":
|
23693
|
-
case 1:
|
23694
|
-
message.version = 1;
|
23695
|
-
break;
|
23696
|
-
case "V2":
|
23697
|
-
case 2:
|
23698
|
-
message.version = 2;
|
23699
|
-
break;
|
23700
|
-
}
|
23701
24203
|
if (object.privateKeys) {
|
23702
24204
|
if (!Array.isArray(object.privateKeys))
|
23703
24205
|
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.privateKeys: array expected");
|
@@ -23718,81 +24220,23 @@
|
|
23718
24220
|
else if (object.publicKeys[i].length)
|
23719
24221
|
message.publicKeys[i] = object.publicKeys[i];
|
23720
24222
|
}
|
23721
|
-
if (object.lockTime != null)
|
23722
|
-
message.lockTime = object.lockTime >>> 0;
|
23723
|
-
if (object.inputs) {
|
23724
|
-
if (!Array.isArray(object.inputs))
|
23725
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.inputs: array expected");
|
23726
|
-
message.inputs = [];
|
23727
|
-
for (var i = 0; i < object.inputs.length; ++i) {
|
23728
|
-
if (typeof object.inputs[i] !== "object")
|
23729
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.inputs: object expected");
|
23730
|
-
message.inputs[i] = $root.TW.BitcoinV2.Proto.Input.fromObject(object.inputs[i]);
|
23731
|
-
}
|
23732
|
-
}
|
23733
|
-
if (object.outputs) {
|
23734
|
-
if (!Array.isArray(object.outputs))
|
23735
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.outputs: array expected");
|
23736
|
-
message.outputs = [];
|
23737
|
-
for (var i = 0; i < object.outputs.length; ++i) {
|
23738
|
-
if (typeof object.outputs[i] !== "object")
|
23739
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.outputs: object expected");
|
23740
|
-
message.outputs[i] = $root.TW.BitcoinV2.Proto.Output.fromObject(object.outputs[i]);
|
23741
|
-
}
|
23742
|
-
}
|
23743
|
-
switch (object.inputSelector) {
|
23744
|
-
case "SelectAscending":
|
23745
|
-
case 0:
|
23746
|
-
message.inputSelector = 0;
|
23747
|
-
break;
|
23748
|
-
case "SelectInOrder":
|
23749
|
-
case 1:
|
23750
|
-
message.inputSelector = 1;
|
23751
|
-
break;
|
23752
|
-
case "SelectDescending":
|
23753
|
-
case 2:
|
23754
|
-
message.inputSelector = 2;
|
23755
|
-
break;
|
23756
|
-
case "UseAll":
|
23757
|
-
case 10:
|
23758
|
-
message.inputSelector = 10;
|
23759
|
-
break;
|
23760
|
-
}
|
23761
|
-
if (object.feePerVb != null)
|
23762
|
-
if ($util.Long)
|
23763
|
-
(message.feePerVb = $util.Long.fromValue(object.feePerVb)).unsigned = false;
|
23764
|
-
else if (typeof object.feePerVb === "string")
|
23765
|
-
message.feePerVb = parseInt(object.feePerVb, 10);
|
23766
|
-
else if (typeof object.feePerVb === "number")
|
23767
|
-
message.feePerVb = object.feePerVb;
|
23768
|
-
else if (typeof object.feePerVb === "object")
|
23769
|
-
message.feePerVb = new $util.LongBits(object.feePerVb.low >>> 0, object.feePerVb.high >>> 0).toNumber();
|
23770
|
-
if (object.changeOutput != null) {
|
23771
|
-
if (typeof object.changeOutput !== "object")
|
23772
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.changeOutput: object expected");
|
23773
|
-
message.changeOutput = $root.TW.BitcoinV2.Proto.Output.fromObject(object.changeOutput);
|
23774
|
-
}
|
23775
|
-
if (object.maxAmountOutput != null) {
|
23776
|
-
if (typeof object.maxAmountOutput !== "object")
|
23777
|
-
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.maxAmountOutput: object expected");
|
23778
|
-
message.maxAmountOutput = $root.TW.BitcoinV2.Proto.Output.fromObject(object.maxAmountOutput);
|
23779
|
-
}
|
23780
24223
|
if (object.chainInfo != null) {
|
23781
24224
|
if (typeof object.chainInfo !== "object")
|
23782
24225
|
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.chainInfo: object expected");
|
23783
24226
|
message.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.fromObject(object.chainInfo);
|
23784
24227
|
}
|
23785
|
-
if (object.fixedDustThreshold != null)
|
23786
|
-
if ($util.Long)
|
23787
|
-
(message.fixedDustThreshold = $util.Long.fromValue(object.fixedDustThreshold)).unsigned = false;
|
23788
|
-
else if (typeof object.fixedDustThreshold === "string")
|
23789
|
-
message.fixedDustThreshold = parseInt(object.fixedDustThreshold, 10);
|
23790
|
-
else if (typeof object.fixedDustThreshold === "number")
|
23791
|
-
message.fixedDustThreshold = object.fixedDustThreshold;
|
23792
|
-
else if (typeof object.fixedDustThreshold === "object")
|
23793
|
-
message.fixedDustThreshold = new $util.LongBits(object.fixedDustThreshold.low >>> 0, object.fixedDustThreshold.high >>> 0).toNumber();
|
23794
24228
|
if (object.dangerousUseFixedSchnorrRng != null)
|
23795
24229
|
message.dangerousUseFixedSchnorrRng = Boolean(object.dangerousUseFixedSchnorrRng);
|
24230
|
+
if (object.builder != null) {
|
24231
|
+
if (typeof object.builder !== "object")
|
24232
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.builder: object expected");
|
24233
|
+
message.builder = $root.TW.BitcoinV2.Proto.TransactionBuilder.fromObject(object.builder);
|
24234
|
+
}
|
24235
|
+
if (object.psbt != null) {
|
24236
|
+
if (typeof object.psbt !== "object")
|
24237
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningInput.psbt: object expected");
|
24238
|
+
message.psbt = $root.TW.BitcoinV2.Proto.Psbt.fromObject(object.psbt);
|
24239
|
+
}
|
23796
24240
|
return message;
|
23797
24241
|
};
|
23798
24242
|
|
@@ -23812,25 +24256,11 @@
|
|
23812
24256
|
if (options.arrays || options.defaults) {
|
23813
24257
|
object.privateKeys = [];
|
23814
24258
|
object.publicKeys = [];
|
23815
|
-
object.inputs = [];
|
23816
|
-
object.outputs = [];
|
23817
24259
|
}
|
23818
24260
|
if (options.defaults) {
|
23819
|
-
object.version = options.enums === String ? "UseDefault" : 0;
|
23820
|
-
object.lockTime = 0;
|
23821
|
-
object.inputSelector = options.enums === String ? "SelectAscending" : 0;
|
23822
|
-
if ($util.Long) {
|
23823
|
-
var long = new $util.Long(0, 0, false);
|
23824
|
-
object.feePerVb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
23825
|
-
} else
|
23826
|
-
object.feePerVb = options.longs === String ? "0" : 0;
|
23827
|
-
object.changeOutput = null;
|
23828
|
-
object.maxAmountOutput = null;
|
23829
24261
|
object.chainInfo = null;
|
23830
24262
|
object.dangerousUseFixedSchnorrRng = false;
|
23831
24263
|
}
|
23832
|
-
if (message.version != null && message.hasOwnProperty("version"))
|
23833
|
-
object.version = options.enums === String ? $root.TW.BitcoinV2.Proto.TransactionVersion[message.version] : message.version;
|
23834
24264
|
if (message.privateKeys && message.privateKeys.length) {
|
23835
24265
|
object.privateKeys = [];
|
23836
24266
|
for (var j = 0; j < message.privateKeys.length; ++j)
|
@@ -23841,41 +24271,20 @@
|
|
23841
24271
|
for (var j = 0; j < message.publicKeys.length; ++j)
|
23842
24272
|
object.publicKeys[j] = options.bytes === String ? $util.base64.encode(message.publicKeys[j], 0, message.publicKeys[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKeys[j]) : message.publicKeys[j];
|
23843
24273
|
}
|
23844
|
-
if (message.lockTime != null && message.hasOwnProperty("lockTime"))
|
23845
|
-
object.lockTime = message.lockTime;
|
23846
|
-
if (message.inputs && message.inputs.length) {
|
23847
|
-
object.inputs = [];
|
23848
|
-
for (var j = 0; j < message.inputs.length; ++j)
|
23849
|
-
object.inputs[j] = $root.TW.BitcoinV2.Proto.Input.toObject(message.inputs[j], options);
|
23850
|
-
}
|
23851
|
-
if (message.outputs && message.outputs.length) {
|
23852
|
-
object.outputs = [];
|
23853
|
-
for (var j = 0; j < message.outputs.length; ++j)
|
23854
|
-
object.outputs[j] = $root.TW.BitcoinV2.Proto.Output.toObject(message.outputs[j], options);
|
23855
|
-
}
|
23856
|
-
if (message.inputSelector != null && message.hasOwnProperty("inputSelector"))
|
23857
|
-
object.inputSelector = options.enums === String ? $root.TW.BitcoinV2.Proto.InputSelector[message.inputSelector] : message.inputSelector;
|
23858
|
-
if (message.feePerVb != null && message.hasOwnProperty("feePerVb"))
|
23859
|
-
if (typeof message.feePerVb === "number")
|
23860
|
-
object.feePerVb = options.longs === String ? String(message.feePerVb) : message.feePerVb;
|
23861
|
-
else
|
23862
|
-
object.feePerVb = options.longs === String ? $util.Long.prototype.toString.call(message.feePerVb) : options.longs === Number ? new $util.LongBits(message.feePerVb.low >>> 0, message.feePerVb.high >>> 0).toNumber() : message.feePerVb;
|
23863
|
-
if (message.changeOutput != null && message.hasOwnProperty("changeOutput"))
|
23864
|
-
object.changeOutput = $root.TW.BitcoinV2.Proto.Output.toObject(message.changeOutput, options);
|
23865
|
-
if (message.maxAmountOutput != null && message.hasOwnProperty("maxAmountOutput"))
|
23866
|
-
object.maxAmountOutput = $root.TW.BitcoinV2.Proto.Output.toObject(message.maxAmountOutput, options);
|
23867
24274
|
if (message.chainInfo != null && message.hasOwnProperty("chainInfo"))
|
23868
24275
|
object.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.toObject(message.chainInfo, options);
|
23869
|
-
if (message.fixedDustThreshold != null && message.hasOwnProperty("fixedDustThreshold")) {
|
23870
|
-
if (typeof message.fixedDustThreshold === "number")
|
23871
|
-
object.fixedDustThreshold = options.longs === String ? String(message.fixedDustThreshold) : message.fixedDustThreshold;
|
23872
|
-
else
|
23873
|
-
object.fixedDustThreshold = options.longs === String ? $util.Long.prototype.toString.call(message.fixedDustThreshold) : options.longs === Number ? new $util.LongBits(message.fixedDustThreshold.low >>> 0, message.fixedDustThreshold.high >>> 0).toNumber() : message.fixedDustThreshold;
|
23874
|
-
if (options.oneofs)
|
23875
|
-
object.dustPolicy = "fixedDustThreshold";
|
23876
|
-
}
|
23877
24276
|
if (message.dangerousUseFixedSchnorrRng != null && message.hasOwnProperty("dangerousUseFixedSchnorrRng"))
|
23878
24277
|
object.dangerousUseFixedSchnorrRng = message.dangerousUseFixedSchnorrRng;
|
24278
|
+
if (message.builder != null && message.hasOwnProperty("builder")) {
|
24279
|
+
object.builder = $root.TW.BitcoinV2.Proto.TransactionBuilder.toObject(message.builder, options);
|
24280
|
+
if (options.oneofs)
|
24281
|
+
object.transaction = "builder";
|
24282
|
+
}
|
24283
|
+
if (message.psbt != null && message.hasOwnProperty("psbt")) {
|
24284
|
+
object.psbt = $root.TW.BitcoinV2.Proto.Psbt.toObject(message.psbt, options);
|
24285
|
+
if (options.oneofs)
|
24286
|
+
object.transaction = "psbt";
|
24287
|
+
}
|
23879
24288
|
return object;
|
23880
24289
|
};
|
23881
24290
|
|
@@ -24632,7 +25041,7 @@
|
|
24632
25041
|
* @memberof TW.BitcoinV2.Proto
|
24633
25042
|
* @interface ITransactionPlan
|
24634
25043
|
* @property {TW.Common.Proto.SigningError|null} [error] TransactionPlan error
|
24635
|
-
* @property {string|null} [errorMessage]
|
25044
|
+
* @property {string|null} [errorMessage] TransactionPlan errorMessage
|
24636
25045
|
* @property {Array.<TW.BitcoinV2.Proto.IInput>|null} [inputs] TransactionPlan inputs
|
24637
25046
|
* @property {Array.<TW.BitcoinV2.Proto.IOutput>|null} [outputs] TransactionPlan outputs
|
24638
25047
|
* @property {Long|null} [availableAmount] TransactionPlan availableAmount
|
@@ -24668,7 +25077,7 @@
|
|
24668
25077
|
TransactionPlan.prototype.error = 0;
|
24669
25078
|
|
24670
25079
|
/**
|
24671
|
-
*
|
25080
|
+
* TransactionPlan errorMessage.
|
24672
25081
|
* @member {string} errorMessage
|
24673
25082
|
* @memberof TW.BitcoinV2.Proto.TransactionPlan
|
24674
25083
|
* @instance
|
@@ -25215,7 +25624,7 @@
|
|
25215
25624
|
* @interface IPreSigningOutput
|
25216
25625
|
* @property {TW.Common.Proto.SigningError|null} [error] PreSigningOutput error
|
25217
25626
|
* @property {string|null} [errorMessage] PreSigningOutput errorMessage
|
25218
|
-
* @property {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>|null} [sighashes]
|
25627
|
+
* @property {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>|null} [sighashes] PreSigningOutput sighashes
|
25219
25628
|
*/
|
25220
25629
|
|
25221
25630
|
/**
|
@@ -25251,7 +25660,7 @@
|
|
25251
25660
|
PreSigningOutput.prototype.errorMessage = "";
|
25252
25661
|
|
25253
25662
|
/**
|
25254
|
-
*
|
25663
|
+
* PreSigningOutput sighashes.
|
25255
25664
|
* @member {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>} sighashes
|
25256
25665
|
* @memberof TW.BitcoinV2.Proto.PreSigningOutput
|
25257
25666
|
* @instance
|
@@ -26028,6 +26437,7 @@
|
|
26028
26437
|
* @property {Long|null} [vsize] SigningOutput vsize
|
26029
26438
|
* @property {Long|null} [weight] SigningOutput weight
|
26030
26439
|
* @property {Long|null} [fee] SigningOutput fee
|
26440
|
+
* @property {TW.BitcoinV2.Proto.IPsbt|null} [psbt] SigningOutput psbt
|
26031
26441
|
*/
|
26032
26442
|
|
26033
26443
|
/**
|
@@ -26109,6 +26519,14 @@
|
|
26109
26519
|
*/
|
26110
26520
|
SigningOutput.prototype.fee = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
|
26111
26521
|
|
26522
|
+
/**
|
26523
|
+
* SigningOutput psbt.
|
26524
|
+
* @member {TW.BitcoinV2.Proto.IPsbt|null|undefined} psbt
|
26525
|
+
* @memberof TW.BitcoinV2.Proto.SigningOutput
|
26526
|
+
* @instance
|
26527
|
+
*/
|
26528
|
+
SigningOutput.prototype.psbt = null;
|
26529
|
+
|
26112
26530
|
/**
|
26113
26531
|
* Creates a new SigningOutput instance using the specified properties.
|
26114
26532
|
* @function create
|
@@ -26149,6 +26567,8 @@
|
|
26149
26567
|
writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.weight);
|
26150
26568
|
if (message.fee != null && Object.hasOwnProperty.call(message, "fee"))
|
26151
26569
|
writer.uint32(/* id 8, wireType 0 =*/64).int64(message.fee);
|
26570
|
+
if (message.psbt != null && Object.hasOwnProperty.call(message, "psbt"))
|
26571
|
+
$root.TW.BitcoinV2.Proto.Psbt.encode(message.psbt, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
|
26152
26572
|
return writer;
|
26153
26573
|
};
|
26154
26574
|
|
@@ -26194,6 +26614,9 @@
|
|
26194
26614
|
case 8:
|
26195
26615
|
message.fee = reader.int64();
|
26196
26616
|
break;
|
26617
|
+
case 9:
|
26618
|
+
message.psbt = $root.TW.BitcoinV2.Proto.Psbt.decode(reader, reader.uint32());
|
26619
|
+
break;
|
26197
26620
|
default:
|
26198
26621
|
reader.skipType(tag & 7);
|
26199
26622
|
break;
|
@@ -26268,6 +26691,11 @@
|
|
26268
26691
|
if (message.fee != null && message.hasOwnProperty("fee"))
|
26269
26692
|
if (!$util.isInteger(message.fee) && !(message.fee && $util.isInteger(message.fee.low) && $util.isInteger(message.fee.high)))
|
26270
26693
|
return "fee: integer|Long expected";
|
26694
|
+
if (message.psbt != null && message.hasOwnProperty("psbt")) {
|
26695
|
+
var error = $root.TW.BitcoinV2.Proto.Psbt.verify(message.psbt);
|
26696
|
+
if (error)
|
26697
|
+
return "psbt." + error;
|
26698
|
+
}
|
26271
26699
|
return null;
|
26272
26700
|
};
|
26273
26701
|
|
@@ -26433,6 +26861,11 @@
|
|
26433
26861
|
message.fee = object.fee;
|
26434
26862
|
else if (typeof object.fee === "object")
|
26435
26863
|
message.fee = new $util.LongBits(object.fee.low >>> 0, object.fee.high >>> 0).toNumber();
|
26864
|
+
if (object.psbt != null) {
|
26865
|
+
if (typeof object.psbt !== "object")
|
26866
|
+
throw TypeError(".TW.BitcoinV2.Proto.SigningOutput.psbt: object expected");
|
26867
|
+
message.psbt = $root.TW.BitcoinV2.Proto.Psbt.fromObject(object.psbt);
|
26868
|
+
}
|
26436
26869
|
return message;
|
26437
26870
|
};
|
26438
26871
|
|
@@ -26482,6 +26915,7 @@
|
|
26482
26915
|
object.fee = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
26483
26916
|
} else
|
26484
26917
|
object.fee = options.longs === String ? "0" : 0;
|
26918
|
+
object.psbt = null;
|
26485
26919
|
}
|
26486
26920
|
if (message.error != null && message.hasOwnProperty("error"))
|
26487
26921
|
object.error = options.enums === String ? $root.TW.Common.Proto.SigningError[message.error] : message.error;
|
@@ -26508,6 +26942,8 @@
|
|
26508
26942
|
object.fee = options.longs === String ? String(message.fee) : message.fee;
|
26509
26943
|
else
|
26510
26944
|
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;
|
26945
|
+
if (message.psbt != null && message.hasOwnProperty("psbt"))
|
26946
|
+
object.psbt = $root.TW.BitcoinV2.Proto.Psbt.toObject(message.psbt, options);
|
26511
26947
|
return object;
|
26512
26948
|
};
|
26513
26949
|
|