@trustwallet/wallet-core 4.1.8-rc2 → 4.1.8

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.
@@ -7675,6 +7675,9 @@ export namespace TW {
7675
7675
 
7676
7676
  /** ChainInfo p2shPrefix */
7677
7677
  p2shPrefix?: (number|null);
7678
+
7679
+ /** ChainInfo hrp */
7680
+ hrp?: (string|null);
7678
7681
  }
7679
7682
 
7680
7683
  /** Represents a ChainInfo. */
@@ -7692,6 +7695,9 @@ export namespace TW {
7692
7695
  /** ChainInfo p2shPrefix. */
7693
7696
  public p2shPrefix: number;
7694
7697
 
7698
+ /** ChainInfo hrp. */
7699
+ public hrp: string;
7700
+
7695
7701
  /**
7696
7702
  * Creates a new ChainInfo instance using the specified properties.
7697
7703
  * @param [properties] Properties to set
@@ -8171,7 +8177,7 @@ export namespace TW {
8171
8177
  /** TransactionPlan error */
8172
8178
  error?: (TW.Common.Proto.SigningError|null);
8173
8179
 
8174
- /** Error description. */
8180
+ /** TransactionPlan errorMessage */
8175
8181
  errorMessage?: (string|null);
8176
8182
 
8177
8183
  /** TransactionPlan inputs */
@@ -8208,7 +8214,7 @@ export namespace TW {
8208
8214
  /** TransactionPlan error. */
8209
8215
  public error: TW.Common.Proto.SigningError;
8210
8216
 
8211
- /** Error description. */
8217
+ /** TransactionPlan errorMessage. */
8212
8218
  public errorMessage: string;
8213
8219
 
8214
8220
  /** TransactionPlan inputs. */
@@ -8295,7 +8301,7 @@ export namespace TW {
8295
8301
  /** PreSigningOutput errorMessage */
8296
8302
  errorMessage?: (string|null);
8297
8303
 
8298
- /** The sighashes to be signed; ECDSA for legacy and Segwit, Schnorr for Taproot. */
8304
+ /** PreSigningOutput sighashes */
8299
8305
  sighashes?: (TW.BitcoinV2.Proto.PreSigningOutput.ISighash[]|null);
8300
8306
  }
8301
8307
 
@@ -8314,7 +8320,7 @@ export namespace TW {
8314
8320
  /** PreSigningOutput errorMessage. */
8315
8321
  public errorMessage: string;
8316
8322
 
8317
- /** The sighashes to be signed; ECDSA for legacy and Segwit, Schnorr for Taproot. */
8323
+ /** PreSigningOutput sighashes. */
8318
8324
  public sighashes: TW.BitcoinV2.Proto.PreSigningOutput.ISighash[];
8319
8325
 
8320
8326
  /**
@@ -8659,6 +8665,224 @@ export namespace TW {
8659
8665
  */
8660
8666
  public toJSON(): { [k: string]: any };
8661
8667
  }
8668
+
8669
+ /** Properties of a PsbtSigningInput. */
8670
+ interface IPsbtSigningInput {
8671
+
8672
+ /** PsbtSigningInput psbt */
8673
+ psbt?: (Uint8Array|null);
8674
+
8675
+ /** PsbtSigningInput privateKeys */
8676
+ privateKeys?: (Uint8Array[]|null);
8677
+
8678
+ /** PsbtSigningInput publicKeys */
8679
+ publicKeys?: (Uint8Array[]|null);
8680
+
8681
+ /** PsbtSigningInput chainInfo */
8682
+ chainInfo?: (TW.BitcoinV2.Proto.IChainInfo|null);
8683
+
8684
+ /** PsbtSigningInput dangerousUseFixedSchnorrRng */
8685
+ dangerousUseFixedSchnorrRng?: (boolean|null);
8686
+ }
8687
+
8688
+ /** Represents a PsbtSigningInput. */
8689
+ class PsbtSigningInput implements IPsbtSigningInput {
8690
+
8691
+ /**
8692
+ * Constructs a new PsbtSigningInput.
8693
+ * @param [properties] Properties to set
8694
+ */
8695
+ constructor(properties?: TW.BitcoinV2.Proto.IPsbtSigningInput);
8696
+
8697
+ /** PsbtSigningInput psbt. */
8698
+ public psbt: Uint8Array;
8699
+
8700
+ /** PsbtSigningInput privateKeys. */
8701
+ public privateKeys: Uint8Array[];
8702
+
8703
+ /** PsbtSigningInput publicKeys. */
8704
+ public publicKeys: Uint8Array[];
8705
+
8706
+ /** PsbtSigningInput chainInfo. */
8707
+ public chainInfo?: (TW.BitcoinV2.Proto.IChainInfo|null);
8708
+
8709
+ /** PsbtSigningInput dangerousUseFixedSchnorrRng. */
8710
+ public dangerousUseFixedSchnorrRng: boolean;
8711
+
8712
+ /**
8713
+ * Creates a new PsbtSigningInput instance using the specified properties.
8714
+ * @param [properties] Properties to set
8715
+ * @returns PsbtSigningInput instance
8716
+ */
8717
+ public static create(properties?: TW.BitcoinV2.Proto.IPsbtSigningInput): TW.BitcoinV2.Proto.PsbtSigningInput;
8718
+
8719
+ /**
8720
+ * Encodes the specified PsbtSigningInput message. Does not implicitly {@link TW.BitcoinV2.Proto.PsbtSigningInput.verify|verify} messages.
8721
+ * @param message PsbtSigningInput message or plain object to encode
8722
+ * @param [writer] Writer to encode to
8723
+ * @returns Writer
8724
+ */
8725
+ public static encode(message: TW.BitcoinV2.Proto.IPsbtSigningInput, writer?: $protobuf.Writer): $protobuf.Writer;
8726
+
8727
+ /**
8728
+ * Decodes a PsbtSigningInput message from the specified reader or buffer.
8729
+ * @param reader Reader or buffer to decode from
8730
+ * @param [length] Message length if known beforehand
8731
+ * @returns PsbtSigningInput
8732
+ * @throws {Error} If the payload is not a reader or valid buffer
8733
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
8734
+ */
8735
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TW.BitcoinV2.Proto.PsbtSigningInput;
8736
+
8737
+ /**
8738
+ * Verifies a PsbtSigningInput message.
8739
+ * @param message Plain object to verify
8740
+ * @returns `null` if valid, otherwise the reason why it is not
8741
+ */
8742
+ public static verify(message: { [k: string]: any }): (string|null);
8743
+
8744
+ /**
8745
+ * Creates a PsbtSigningInput message from a plain object. Also converts values to their respective internal types.
8746
+ * @param object Plain object
8747
+ * @returns PsbtSigningInput
8748
+ */
8749
+ public static fromObject(object: { [k: string]: any }): TW.BitcoinV2.Proto.PsbtSigningInput;
8750
+
8751
+ /**
8752
+ * Creates a plain object from a PsbtSigningInput message. Also converts values to other types if specified.
8753
+ * @param message PsbtSigningInput
8754
+ * @param [options] Conversion options
8755
+ * @returns Plain object
8756
+ */
8757
+ public static toObject(message: TW.BitcoinV2.Proto.PsbtSigningInput, options?: $protobuf.IConversionOptions): { [k: string]: any };
8758
+
8759
+ /**
8760
+ * Converts this PsbtSigningInput to JSON.
8761
+ * @returns JSON object
8762
+ */
8763
+ public toJSON(): { [k: string]: any };
8764
+ }
8765
+
8766
+ /** Properties of a PsbtSigningOutput. */
8767
+ interface IPsbtSigningOutput {
8768
+
8769
+ /** PsbtSigningOutput error */
8770
+ error?: (TW.Common.Proto.SigningError|null);
8771
+
8772
+ /** PsbtSigningOutput errorMessage */
8773
+ errorMessage?: (string|null);
8774
+
8775
+ /** PsbtSigningOutput transaction */
8776
+ transaction?: (TW.BitcoinV2.Proto.ITransaction|null);
8777
+
8778
+ /** PsbtSigningOutput encoded */
8779
+ encoded?: (Uint8Array|null);
8780
+
8781
+ /** PsbtSigningOutput txid */
8782
+ txid?: (Uint8Array|null);
8783
+
8784
+ /** PsbtSigningOutput vsize */
8785
+ vsize?: (Long|null);
8786
+
8787
+ /** PsbtSigningOutput weight */
8788
+ weight?: (Long|null);
8789
+
8790
+ /** PsbtSigningOutput fee */
8791
+ fee?: (Long|null);
8792
+
8793
+ /** PsbtSigningOutput psbt */
8794
+ psbt?: (Uint8Array|null);
8795
+ }
8796
+
8797
+ /** Represents a PsbtSigningOutput. */
8798
+ class PsbtSigningOutput implements IPsbtSigningOutput {
8799
+
8800
+ /**
8801
+ * Constructs a new PsbtSigningOutput.
8802
+ * @param [properties] Properties to set
8803
+ */
8804
+ constructor(properties?: TW.BitcoinV2.Proto.IPsbtSigningOutput);
8805
+
8806
+ /** PsbtSigningOutput error. */
8807
+ public error: TW.Common.Proto.SigningError;
8808
+
8809
+ /** PsbtSigningOutput errorMessage. */
8810
+ public errorMessage: string;
8811
+
8812
+ /** PsbtSigningOutput transaction. */
8813
+ public transaction?: (TW.BitcoinV2.Proto.ITransaction|null);
8814
+
8815
+ /** PsbtSigningOutput encoded. */
8816
+ public encoded: Uint8Array;
8817
+
8818
+ /** PsbtSigningOutput txid. */
8819
+ public txid: Uint8Array;
8820
+
8821
+ /** PsbtSigningOutput vsize. */
8822
+ public vsize: Long;
8823
+
8824
+ /** PsbtSigningOutput weight. */
8825
+ public weight: Long;
8826
+
8827
+ /** PsbtSigningOutput fee. */
8828
+ public fee: Long;
8829
+
8830
+ /** PsbtSigningOutput psbt. */
8831
+ public psbt: Uint8Array;
8832
+
8833
+ /**
8834
+ * Creates a new PsbtSigningOutput instance using the specified properties.
8835
+ * @param [properties] Properties to set
8836
+ * @returns PsbtSigningOutput instance
8837
+ */
8838
+ public static create(properties?: TW.BitcoinV2.Proto.IPsbtSigningOutput): TW.BitcoinV2.Proto.PsbtSigningOutput;
8839
+
8840
+ /**
8841
+ * Encodes the specified PsbtSigningOutput message. Does not implicitly {@link TW.BitcoinV2.Proto.PsbtSigningOutput.verify|verify} messages.
8842
+ * @param message PsbtSigningOutput message or plain object to encode
8843
+ * @param [writer] Writer to encode to
8844
+ * @returns Writer
8845
+ */
8846
+ public static encode(message: TW.BitcoinV2.Proto.IPsbtSigningOutput, writer?: $protobuf.Writer): $protobuf.Writer;
8847
+
8848
+ /**
8849
+ * Decodes a PsbtSigningOutput message from the specified reader or buffer.
8850
+ * @param reader Reader or buffer to decode from
8851
+ * @param [length] Message length if known beforehand
8852
+ * @returns PsbtSigningOutput
8853
+ * @throws {Error} If the payload is not a reader or valid buffer
8854
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
8855
+ */
8856
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TW.BitcoinV2.Proto.PsbtSigningOutput;
8857
+
8858
+ /**
8859
+ * Verifies a PsbtSigningOutput message.
8860
+ * @param message Plain object to verify
8861
+ * @returns `null` if valid, otherwise the reason why it is not
8862
+ */
8863
+ public static verify(message: { [k: string]: any }): (string|null);
8864
+
8865
+ /**
8866
+ * Creates a PsbtSigningOutput message from a plain object. Also converts values to their respective internal types.
8867
+ * @param object Plain object
8868
+ * @returns PsbtSigningOutput
8869
+ */
8870
+ public static fromObject(object: { [k: string]: any }): TW.BitcoinV2.Proto.PsbtSigningOutput;
8871
+
8872
+ /**
8873
+ * Creates a plain object from a PsbtSigningOutput message. Also converts values to other types if specified.
8874
+ * @param message PsbtSigningOutput
8875
+ * @param [options] Conversion options
8876
+ * @returns Plain object
8877
+ */
8878
+ public static toObject(message: TW.BitcoinV2.Proto.PsbtSigningOutput, options?: $protobuf.IConversionOptions): { [k: string]: any };
8879
+
8880
+ /**
8881
+ * Converts this PsbtSigningOutput to JSON.
8882
+ * @returns JSON object
8883
+ */
8884
+ public toJSON(): { [k: string]: any };
8885
+ }
8662
8886
  }
8663
8887
  }
8664
8888
 
@@ -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
 
@@ -24632,7 +24654,7 @@
24632
24654
  * @memberof TW.BitcoinV2.Proto
24633
24655
  * @interface ITransactionPlan
24634
24656
  * @property {TW.Common.Proto.SigningError|null} [error] TransactionPlan error
24635
- * @property {string|null} [errorMessage] Error description.
24657
+ * @property {string|null} [errorMessage] TransactionPlan errorMessage
24636
24658
  * @property {Array.<TW.BitcoinV2.Proto.IInput>|null} [inputs] TransactionPlan inputs
24637
24659
  * @property {Array.<TW.BitcoinV2.Proto.IOutput>|null} [outputs] TransactionPlan outputs
24638
24660
  * @property {Long|null} [availableAmount] TransactionPlan availableAmount
@@ -24668,7 +24690,7 @@
24668
24690
  TransactionPlan.prototype.error = 0;
24669
24691
 
24670
24692
  /**
24671
- * Error description.
24693
+ * TransactionPlan errorMessage.
24672
24694
  * @member {string} errorMessage
24673
24695
  * @memberof TW.BitcoinV2.Proto.TransactionPlan
24674
24696
  * @instance
@@ -25215,7 +25237,7 @@
25215
25237
  * @interface IPreSigningOutput
25216
25238
  * @property {TW.Common.Proto.SigningError|null} [error] PreSigningOutput error
25217
25239
  * @property {string|null} [errorMessage] PreSigningOutput errorMessage
25218
- * @property {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>|null} [sighashes] The sighashes to be signed; ECDSA for legacy and Segwit, Schnorr for Taproot.
25240
+ * @property {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>|null} [sighashes] PreSigningOutput sighashes
25219
25241
  */
25220
25242
 
25221
25243
  /**
@@ -25251,7 +25273,7 @@
25251
25273
  PreSigningOutput.prototype.errorMessage = "";
25252
25274
 
25253
25275
  /**
25254
- * The sighashes to be signed; ECDSA for legacy and Segwit, Schnorr for Taproot.
25276
+ * PreSigningOutput sighashes.
25255
25277
  * @member {Array.<TW.BitcoinV2.Proto.PreSigningOutput.ISighash>} sighashes
25256
25278
  * @memberof TW.BitcoinV2.Proto.PreSigningOutput
25257
25279
  * @instance
@@ -26525,6 +26547,849 @@
26525
26547
  return SigningOutput;
26526
26548
  })();
26527
26549
 
26550
+ Proto.PsbtSigningInput = (function() {
26551
+
26552
+ /**
26553
+ * Properties of a PsbtSigningInput.
26554
+ * @memberof TW.BitcoinV2.Proto
26555
+ * @interface IPsbtSigningInput
26556
+ * @property {Uint8Array|null} [psbt] PsbtSigningInput psbt
26557
+ * @property {Array.<Uint8Array>|null} [privateKeys] PsbtSigningInput privateKeys
26558
+ * @property {Array.<Uint8Array>|null} [publicKeys] PsbtSigningInput publicKeys
26559
+ * @property {TW.BitcoinV2.Proto.IChainInfo|null} [chainInfo] PsbtSigningInput chainInfo
26560
+ * @property {boolean|null} [dangerousUseFixedSchnorrRng] PsbtSigningInput dangerousUseFixedSchnorrRng
26561
+ */
26562
+
26563
+ /**
26564
+ * Constructs a new PsbtSigningInput.
26565
+ * @memberof TW.BitcoinV2.Proto
26566
+ * @classdesc Represents a PsbtSigningInput.
26567
+ * @implements IPsbtSigningInput
26568
+ * @constructor
26569
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningInput=} [properties] Properties to set
26570
+ */
26571
+ function PsbtSigningInput(properties) {
26572
+ this.privateKeys = [];
26573
+ this.publicKeys = [];
26574
+ if (properties)
26575
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
26576
+ if (properties[keys[i]] != null)
26577
+ this[keys[i]] = properties[keys[i]];
26578
+ }
26579
+
26580
+ /**
26581
+ * PsbtSigningInput psbt.
26582
+ * @member {Uint8Array} psbt
26583
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26584
+ * @instance
26585
+ */
26586
+ PsbtSigningInput.prototype.psbt = $util.newBuffer([]);
26587
+
26588
+ /**
26589
+ * PsbtSigningInput privateKeys.
26590
+ * @member {Array.<Uint8Array>} privateKeys
26591
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26592
+ * @instance
26593
+ */
26594
+ PsbtSigningInput.prototype.privateKeys = $util.emptyArray;
26595
+
26596
+ /**
26597
+ * PsbtSigningInput publicKeys.
26598
+ * @member {Array.<Uint8Array>} publicKeys
26599
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26600
+ * @instance
26601
+ */
26602
+ PsbtSigningInput.prototype.publicKeys = $util.emptyArray;
26603
+
26604
+ /**
26605
+ * PsbtSigningInput chainInfo.
26606
+ * @member {TW.BitcoinV2.Proto.IChainInfo|null|undefined} chainInfo
26607
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26608
+ * @instance
26609
+ */
26610
+ PsbtSigningInput.prototype.chainInfo = null;
26611
+
26612
+ /**
26613
+ * PsbtSigningInput dangerousUseFixedSchnorrRng.
26614
+ * @member {boolean} dangerousUseFixedSchnorrRng
26615
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26616
+ * @instance
26617
+ */
26618
+ PsbtSigningInput.prototype.dangerousUseFixedSchnorrRng = false;
26619
+
26620
+ /**
26621
+ * Creates a new PsbtSigningInput instance using the specified properties.
26622
+ * @function create
26623
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26624
+ * @static
26625
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningInput=} [properties] Properties to set
26626
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningInput} PsbtSigningInput instance
26627
+ */
26628
+ PsbtSigningInput.create = function create(properties) {
26629
+ return new PsbtSigningInput(properties);
26630
+ };
26631
+
26632
+ /**
26633
+ * Encodes the specified PsbtSigningInput message. Does not implicitly {@link TW.BitcoinV2.Proto.PsbtSigningInput.verify|verify} messages.
26634
+ * @function encode
26635
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26636
+ * @static
26637
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningInput} message PsbtSigningInput message or plain object to encode
26638
+ * @param {$protobuf.Writer} [writer] Writer to encode to
26639
+ * @returns {$protobuf.Writer} Writer
26640
+ */
26641
+ PsbtSigningInput.encode = function encode(message, writer) {
26642
+ if (!writer)
26643
+ writer = $Writer.create();
26644
+ if (message.psbt != null && Object.hasOwnProperty.call(message, "psbt"))
26645
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.psbt);
26646
+ if (message.privateKeys != null && message.privateKeys.length)
26647
+ for (var i = 0; i < message.privateKeys.length; ++i)
26648
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.privateKeys[i]);
26649
+ if (message.publicKeys != null && message.publicKeys.length)
26650
+ for (var i = 0; i < message.publicKeys.length; ++i)
26651
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.publicKeys[i]);
26652
+ if (message.chainInfo != null && Object.hasOwnProperty.call(message, "chainInfo"))
26653
+ $root.TW.BitcoinV2.Proto.ChainInfo.encode(message.chainInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
26654
+ if (message.dangerousUseFixedSchnorrRng != null && Object.hasOwnProperty.call(message, "dangerousUseFixedSchnorrRng"))
26655
+ writer.uint32(/* id 5, wireType 0 =*/40).bool(message.dangerousUseFixedSchnorrRng);
26656
+ return writer;
26657
+ };
26658
+
26659
+ /**
26660
+ * Decodes a PsbtSigningInput message from the specified reader or buffer.
26661
+ * @function decode
26662
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26663
+ * @static
26664
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
26665
+ * @param {number} [length] Message length if known beforehand
26666
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningInput} PsbtSigningInput
26667
+ * @throws {Error} If the payload is not a reader or valid buffer
26668
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
26669
+ */
26670
+ PsbtSigningInput.decode = function decode(reader, length) {
26671
+ if (!(reader instanceof $Reader))
26672
+ reader = $Reader.create(reader);
26673
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.BitcoinV2.Proto.PsbtSigningInput();
26674
+ while (reader.pos < end) {
26675
+ var tag = reader.uint32();
26676
+ switch (tag >>> 3) {
26677
+ case 1:
26678
+ message.psbt = reader.bytes();
26679
+ break;
26680
+ case 2:
26681
+ if (!(message.privateKeys && message.privateKeys.length))
26682
+ message.privateKeys = [];
26683
+ message.privateKeys.push(reader.bytes());
26684
+ break;
26685
+ case 3:
26686
+ if (!(message.publicKeys && message.publicKeys.length))
26687
+ message.publicKeys = [];
26688
+ message.publicKeys.push(reader.bytes());
26689
+ break;
26690
+ case 4:
26691
+ message.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.decode(reader, reader.uint32());
26692
+ break;
26693
+ case 5:
26694
+ message.dangerousUseFixedSchnorrRng = reader.bool();
26695
+ break;
26696
+ default:
26697
+ reader.skipType(tag & 7);
26698
+ break;
26699
+ }
26700
+ }
26701
+ return message;
26702
+ };
26703
+
26704
+ /**
26705
+ * Verifies a PsbtSigningInput message.
26706
+ * @function verify
26707
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26708
+ * @static
26709
+ * @param {Object.<string,*>} message Plain object to verify
26710
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
26711
+ */
26712
+ PsbtSigningInput.verify = function verify(message) {
26713
+ if (typeof message !== "object" || message === null)
26714
+ return "object expected";
26715
+ if (message.psbt != null && message.hasOwnProperty("psbt"))
26716
+ if (!(message.psbt && typeof message.psbt.length === "number" || $util.isString(message.psbt)))
26717
+ return "psbt: buffer expected";
26718
+ if (message.privateKeys != null && message.hasOwnProperty("privateKeys")) {
26719
+ if (!Array.isArray(message.privateKeys))
26720
+ return "privateKeys: array expected";
26721
+ for (var i = 0; i < message.privateKeys.length; ++i)
26722
+ if (!(message.privateKeys[i] && typeof message.privateKeys[i].length === "number" || $util.isString(message.privateKeys[i])))
26723
+ return "privateKeys: buffer[] expected";
26724
+ }
26725
+ if (message.publicKeys != null && message.hasOwnProperty("publicKeys")) {
26726
+ if (!Array.isArray(message.publicKeys))
26727
+ return "publicKeys: array expected";
26728
+ for (var i = 0; i < message.publicKeys.length; ++i)
26729
+ if (!(message.publicKeys[i] && typeof message.publicKeys[i].length === "number" || $util.isString(message.publicKeys[i])))
26730
+ return "publicKeys: buffer[] expected";
26731
+ }
26732
+ if (message.chainInfo != null && message.hasOwnProperty("chainInfo")) {
26733
+ var error = $root.TW.BitcoinV2.Proto.ChainInfo.verify(message.chainInfo);
26734
+ if (error)
26735
+ return "chainInfo." + error;
26736
+ }
26737
+ if (message.dangerousUseFixedSchnorrRng != null && message.hasOwnProperty("dangerousUseFixedSchnorrRng"))
26738
+ if (typeof message.dangerousUseFixedSchnorrRng !== "boolean")
26739
+ return "dangerousUseFixedSchnorrRng: boolean expected";
26740
+ return null;
26741
+ };
26742
+
26743
+ /**
26744
+ * Creates a PsbtSigningInput message from a plain object. Also converts values to their respective internal types.
26745
+ * @function fromObject
26746
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26747
+ * @static
26748
+ * @param {Object.<string,*>} object Plain object
26749
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningInput} PsbtSigningInput
26750
+ */
26751
+ PsbtSigningInput.fromObject = function fromObject(object) {
26752
+ if (object instanceof $root.TW.BitcoinV2.Proto.PsbtSigningInput)
26753
+ return object;
26754
+ var message = new $root.TW.BitcoinV2.Proto.PsbtSigningInput();
26755
+ if (object.psbt != null)
26756
+ if (typeof object.psbt === "string")
26757
+ $util.base64.decode(object.psbt, message.psbt = $util.newBuffer($util.base64.length(object.psbt)), 0);
26758
+ else if (object.psbt.length)
26759
+ message.psbt = object.psbt;
26760
+ if (object.privateKeys) {
26761
+ if (!Array.isArray(object.privateKeys))
26762
+ throw TypeError(".TW.BitcoinV2.Proto.PsbtSigningInput.privateKeys: array expected");
26763
+ message.privateKeys = [];
26764
+ for (var i = 0; i < object.privateKeys.length; ++i)
26765
+ if (typeof object.privateKeys[i] === "string")
26766
+ $util.base64.decode(object.privateKeys[i], message.privateKeys[i] = $util.newBuffer($util.base64.length(object.privateKeys[i])), 0);
26767
+ else if (object.privateKeys[i].length)
26768
+ message.privateKeys[i] = object.privateKeys[i];
26769
+ }
26770
+ if (object.publicKeys) {
26771
+ if (!Array.isArray(object.publicKeys))
26772
+ throw TypeError(".TW.BitcoinV2.Proto.PsbtSigningInput.publicKeys: array expected");
26773
+ message.publicKeys = [];
26774
+ for (var i = 0; i < object.publicKeys.length; ++i)
26775
+ if (typeof object.publicKeys[i] === "string")
26776
+ $util.base64.decode(object.publicKeys[i], message.publicKeys[i] = $util.newBuffer($util.base64.length(object.publicKeys[i])), 0);
26777
+ else if (object.publicKeys[i].length)
26778
+ message.publicKeys[i] = object.publicKeys[i];
26779
+ }
26780
+ if (object.chainInfo != null) {
26781
+ if (typeof object.chainInfo !== "object")
26782
+ throw TypeError(".TW.BitcoinV2.Proto.PsbtSigningInput.chainInfo: object expected");
26783
+ message.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.fromObject(object.chainInfo);
26784
+ }
26785
+ if (object.dangerousUseFixedSchnorrRng != null)
26786
+ message.dangerousUseFixedSchnorrRng = Boolean(object.dangerousUseFixedSchnorrRng);
26787
+ return message;
26788
+ };
26789
+
26790
+ /**
26791
+ * Creates a plain object from a PsbtSigningInput message. Also converts values to other types if specified.
26792
+ * @function toObject
26793
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26794
+ * @static
26795
+ * @param {TW.BitcoinV2.Proto.PsbtSigningInput} message PsbtSigningInput
26796
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
26797
+ * @returns {Object.<string,*>} Plain object
26798
+ */
26799
+ PsbtSigningInput.toObject = function toObject(message, options) {
26800
+ if (!options)
26801
+ options = {};
26802
+ var object = {};
26803
+ if (options.arrays || options.defaults) {
26804
+ object.privateKeys = [];
26805
+ object.publicKeys = [];
26806
+ }
26807
+ if (options.defaults) {
26808
+ if (options.bytes === String)
26809
+ object.psbt = "";
26810
+ else {
26811
+ object.psbt = [];
26812
+ if (options.bytes !== Array)
26813
+ object.psbt = $util.newBuffer(object.psbt);
26814
+ }
26815
+ object.chainInfo = null;
26816
+ object.dangerousUseFixedSchnorrRng = false;
26817
+ }
26818
+ if (message.psbt != null && message.hasOwnProperty("psbt"))
26819
+ 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;
26820
+ if (message.privateKeys && message.privateKeys.length) {
26821
+ object.privateKeys = [];
26822
+ for (var j = 0; j < message.privateKeys.length; ++j)
26823
+ object.privateKeys[j] = options.bytes === String ? $util.base64.encode(message.privateKeys[j], 0, message.privateKeys[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKeys[j]) : message.privateKeys[j];
26824
+ }
26825
+ if (message.publicKeys && message.publicKeys.length) {
26826
+ object.publicKeys = [];
26827
+ for (var j = 0; j < message.publicKeys.length; ++j)
26828
+ 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];
26829
+ }
26830
+ if (message.chainInfo != null && message.hasOwnProperty("chainInfo"))
26831
+ object.chainInfo = $root.TW.BitcoinV2.Proto.ChainInfo.toObject(message.chainInfo, options);
26832
+ if (message.dangerousUseFixedSchnorrRng != null && message.hasOwnProperty("dangerousUseFixedSchnorrRng"))
26833
+ object.dangerousUseFixedSchnorrRng = message.dangerousUseFixedSchnorrRng;
26834
+ return object;
26835
+ };
26836
+
26837
+ /**
26838
+ * Converts this PsbtSigningInput to JSON.
26839
+ * @function toJSON
26840
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningInput
26841
+ * @instance
26842
+ * @returns {Object.<string,*>} JSON object
26843
+ */
26844
+ PsbtSigningInput.prototype.toJSON = function toJSON() {
26845
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
26846
+ };
26847
+
26848
+ return PsbtSigningInput;
26849
+ })();
26850
+
26851
+ Proto.PsbtSigningOutput = (function() {
26852
+
26853
+ /**
26854
+ * Properties of a PsbtSigningOutput.
26855
+ * @memberof TW.BitcoinV2.Proto
26856
+ * @interface IPsbtSigningOutput
26857
+ * @property {TW.Common.Proto.SigningError|null} [error] PsbtSigningOutput error
26858
+ * @property {string|null} [errorMessage] PsbtSigningOutput errorMessage
26859
+ * @property {TW.BitcoinV2.Proto.ITransaction|null} [transaction] PsbtSigningOutput transaction
26860
+ * @property {Uint8Array|null} [encoded] PsbtSigningOutput encoded
26861
+ * @property {Uint8Array|null} [txid] PsbtSigningOutput txid
26862
+ * @property {Long|null} [vsize] PsbtSigningOutput vsize
26863
+ * @property {Long|null} [weight] PsbtSigningOutput weight
26864
+ * @property {Long|null} [fee] PsbtSigningOutput fee
26865
+ * @property {Uint8Array|null} [psbt] PsbtSigningOutput psbt
26866
+ */
26867
+
26868
+ /**
26869
+ * Constructs a new PsbtSigningOutput.
26870
+ * @memberof TW.BitcoinV2.Proto
26871
+ * @classdesc Represents a PsbtSigningOutput.
26872
+ * @implements IPsbtSigningOutput
26873
+ * @constructor
26874
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningOutput=} [properties] Properties to set
26875
+ */
26876
+ function PsbtSigningOutput(properties) {
26877
+ if (properties)
26878
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
26879
+ if (properties[keys[i]] != null)
26880
+ this[keys[i]] = properties[keys[i]];
26881
+ }
26882
+
26883
+ /**
26884
+ * PsbtSigningOutput error.
26885
+ * @member {TW.Common.Proto.SigningError} error
26886
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26887
+ * @instance
26888
+ */
26889
+ PsbtSigningOutput.prototype.error = 0;
26890
+
26891
+ /**
26892
+ * PsbtSigningOutput errorMessage.
26893
+ * @member {string} errorMessage
26894
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26895
+ * @instance
26896
+ */
26897
+ PsbtSigningOutput.prototype.errorMessage = "";
26898
+
26899
+ /**
26900
+ * PsbtSigningOutput transaction.
26901
+ * @member {TW.BitcoinV2.Proto.ITransaction|null|undefined} transaction
26902
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26903
+ * @instance
26904
+ */
26905
+ PsbtSigningOutput.prototype.transaction = null;
26906
+
26907
+ /**
26908
+ * PsbtSigningOutput encoded.
26909
+ * @member {Uint8Array} encoded
26910
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26911
+ * @instance
26912
+ */
26913
+ PsbtSigningOutput.prototype.encoded = $util.newBuffer([]);
26914
+
26915
+ /**
26916
+ * PsbtSigningOutput txid.
26917
+ * @member {Uint8Array} txid
26918
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26919
+ * @instance
26920
+ */
26921
+ PsbtSigningOutput.prototype.txid = $util.newBuffer([]);
26922
+
26923
+ /**
26924
+ * PsbtSigningOutput vsize.
26925
+ * @member {Long} vsize
26926
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26927
+ * @instance
26928
+ */
26929
+ PsbtSigningOutput.prototype.vsize = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
26930
+
26931
+ /**
26932
+ * PsbtSigningOutput weight.
26933
+ * @member {Long} weight
26934
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26935
+ * @instance
26936
+ */
26937
+ PsbtSigningOutput.prototype.weight = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
26938
+
26939
+ /**
26940
+ * PsbtSigningOutput fee.
26941
+ * @member {Long} fee
26942
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26943
+ * @instance
26944
+ */
26945
+ PsbtSigningOutput.prototype.fee = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
26946
+
26947
+ /**
26948
+ * PsbtSigningOutput psbt.
26949
+ * @member {Uint8Array} psbt
26950
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26951
+ * @instance
26952
+ */
26953
+ PsbtSigningOutput.prototype.psbt = $util.newBuffer([]);
26954
+
26955
+ /**
26956
+ * Creates a new PsbtSigningOutput instance using the specified properties.
26957
+ * @function create
26958
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26959
+ * @static
26960
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningOutput=} [properties] Properties to set
26961
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningOutput} PsbtSigningOutput instance
26962
+ */
26963
+ PsbtSigningOutput.create = function create(properties) {
26964
+ return new PsbtSigningOutput(properties);
26965
+ };
26966
+
26967
+ /**
26968
+ * Encodes the specified PsbtSigningOutput message. Does not implicitly {@link TW.BitcoinV2.Proto.PsbtSigningOutput.verify|verify} messages.
26969
+ * @function encode
26970
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
26971
+ * @static
26972
+ * @param {TW.BitcoinV2.Proto.IPsbtSigningOutput} message PsbtSigningOutput message or plain object to encode
26973
+ * @param {$protobuf.Writer} [writer] Writer to encode to
26974
+ * @returns {$protobuf.Writer} Writer
26975
+ */
26976
+ PsbtSigningOutput.encode = function encode(message, writer) {
26977
+ if (!writer)
26978
+ writer = $Writer.create();
26979
+ if (message.error != null && Object.hasOwnProperty.call(message, "error"))
26980
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.error);
26981
+ if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage"))
26982
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage);
26983
+ if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction"))
26984
+ $root.TW.BitcoinV2.Proto.Transaction.encode(message.transaction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
26985
+ if (message.encoded != null && Object.hasOwnProperty.call(message, "encoded"))
26986
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.encoded);
26987
+ if (message.txid != null && Object.hasOwnProperty.call(message, "txid"))
26988
+ writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.txid);
26989
+ if (message.vsize != null && Object.hasOwnProperty.call(message, "vsize"))
26990
+ writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.vsize);
26991
+ if (message.weight != null && Object.hasOwnProperty.call(message, "weight"))
26992
+ writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.weight);
26993
+ if (message.fee != null && Object.hasOwnProperty.call(message, "fee"))
26994
+ writer.uint32(/* id 8, wireType 0 =*/64).int64(message.fee);
26995
+ if (message.psbt != null && Object.hasOwnProperty.call(message, "psbt"))
26996
+ writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.psbt);
26997
+ return writer;
26998
+ };
26999
+
27000
+ /**
27001
+ * Decodes a PsbtSigningOutput message from the specified reader or buffer.
27002
+ * @function decode
27003
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
27004
+ * @static
27005
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
27006
+ * @param {number} [length] Message length if known beforehand
27007
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningOutput} PsbtSigningOutput
27008
+ * @throws {Error} If the payload is not a reader or valid buffer
27009
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
27010
+ */
27011
+ PsbtSigningOutput.decode = function decode(reader, length) {
27012
+ if (!(reader instanceof $Reader))
27013
+ reader = $Reader.create(reader);
27014
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.BitcoinV2.Proto.PsbtSigningOutput();
27015
+ while (reader.pos < end) {
27016
+ var tag = reader.uint32();
27017
+ switch (tag >>> 3) {
27018
+ case 1:
27019
+ message.error = reader.int32();
27020
+ break;
27021
+ case 2:
27022
+ message.errorMessage = reader.string();
27023
+ break;
27024
+ case 3:
27025
+ message.transaction = $root.TW.BitcoinV2.Proto.Transaction.decode(reader, reader.uint32());
27026
+ break;
27027
+ case 4:
27028
+ message.encoded = reader.bytes();
27029
+ break;
27030
+ case 5:
27031
+ message.txid = reader.bytes();
27032
+ break;
27033
+ case 6:
27034
+ message.vsize = reader.uint64();
27035
+ break;
27036
+ case 7:
27037
+ message.weight = reader.uint64();
27038
+ break;
27039
+ case 8:
27040
+ message.fee = reader.int64();
27041
+ break;
27042
+ case 9:
27043
+ message.psbt = reader.bytes();
27044
+ break;
27045
+ default:
27046
+ reader.skipType(tag & 7);
27047
+ break;
27048
+ }
27049
+ }
27050
+ return message;
27051
+ };
27052
+
27053
+ /**
27054
+ * Verifies a PsbtSigningOutput message.
27055
+ * @function verify
27056
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
27057
+ * @static
27058
+ * @param {Object.<string,*>} message Plain object to verify
27059
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
27060
+ */
27061
+ PsbtSigningOutput.verify = function verify(message) {
27062
+ if (typeof message !== "object" || message === null)
27063
+ return "object expected";
27064
+ if (message.error != null && message.hasOwnProperty("error"))
27065
+ switch (message.error) {
27066
+ default:
27067
+ return "error: enum value expected";
27068
+ case 0:
27069
+ case 1:
27070
+ case 2:
27071
+ case 3:
27072
+ case 4:
27073
+ case 5:
27074
+ case 15:
27075
+ case 16:
27076
+ case 17:
27077
+ case 18:
27078
+ case 6:
27079
+ case 7:
27080
+ case 8:
27081
+ case 9:
27082
+ case 10:
27083
+ case 11:
27084
+ case 12:
27085
+ case 13:
27086
+ case 14:
27087
+ case 19:
27088
+ case 20:
27089
+ case 21:
27090
+ case 22:
27091
+ case 23:
27092
+ case 24:
27093
+ case 25:
27094
+ break;
27095
+ }
27096
+ if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
27097
+ if (!$util.isString(message.errorMessage))
27098
+ return "errorMessage: string expected";
27099
+ if (message.transaction != null && message.hasOwnProperty("transaction")) {
27100
+ var error = $root.TW.BitcoinV2.Proto.Transaction.verify(message.transaction);
27101
+ if (error)
27102
+ return "transaction." + error;
27103
+ }
27104
+ if (message.encoded != null && message.hasOwnProperty("encoded"))
27105
+ if (!(message.encoded && typeof message.encoded.length === "number" || $util.isString(message.encoded)))
27106
+ return "encoded: buffer expected";
27107
+ if (message.txid != null && message.hasOwnProperty("txid"))
27108
+ if (!(message.txid && typeof message.txid.length === "number" || $util.isString(message.txid)))
27109
+ return "txid: buffer expected";
27110
+ if (message.vsize != null && message.hasOwnProperty("vsize"))
27111
+ if (!$util.isInteger(message.vsize) && !(message.vsize && $util.isInteger(message.vsize.low) && $util.isInteger(message.vsize.high)))
27112
+ return "vsize: integer|Long expected";
27113
+ if (message.weight != null && message.hasOwnProperty("weight"))
27114
+ if (!$util.isInteger(message.weight) && !(message.weight && $util.isInteger(message.weight.low) && $util.isInteger(message.weight.high)))
27115
+ return "weight: integer|Long expected";
27116
+ if (message.fee != null && message.hasOwnProperty("fee"))
27117
+ if (!$util.isInteger(message.fee) && !(message.fee && $util.isInteger(message.fee.low) && $util.isInteger(message.fee.high)))
27118
+ return "fee: integer|Long expected";
27119
+ if (message.psbt != null && message.hasOwnProperty("psbt"))
27120
+ if (!(message.psbt && typeof message.psbt.length === "number" || $util.isString(message.psbt)))
27121
+ return "psbt: buffer expected";
27122
+ return null;
27123
+ };
27124
+
27125
+ /**
27126
+ * Creates a PsbtSigningOutput message from a plain object. Also converts values to their respective internal types.
27127
+ * @function fromObject
27128
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
27129
+ * @static
27130
+ * @param {Object.<string,*>} object Plain object
27131
+ * @returns {TW.BitcoinV2.Proto.PsbtSigningOutput} PsbtSigningOutput
27132
+ */
27133
+ PsbtSigningOutput.fromObject = function fromObject(object) {
27134
+ if (object instanceof $root.TW.BitcoinV2.Proto.PsbtSigningOutput)
27135
+ return object;
27136
+ var message = new $root.TW.BitcoinV2.Proto.PsbtSigningOutput();
27137
+ switch (object.error) {
27138
+ case "OK":
27139
+ case 0:
27140
+ message.error = 0;
27141
+ break;
27142
+ case "Error_general":
27143
+ case 1:
27144
+ message.error = 1;
27145
+ break;
27146
+ case "Error_internal":
27147
+ case 2:
27148
+ message.error = 2;
27149
+ break;
27150
+ case "Error_low_balance":
27151
+ case 3:
27152
+ message.error = 3;
27153
+ break;
27154
+ case "Error_zero_amount_requested":
27155
+ case 4:
27156
+ message.error = 4;
27157
+ break;
27158
+ case "Error_missing_private_key":
27159
+ case 5:
27160
+ message.error = 5;
27161
+ break;
27162
+ case "Error_invalid_private_key":
27163
+ case 15:
27164
+ message.error = 15;
27165
+ break;
27166
+ case "Error_invalid_address":
27167
+ case 16:
27168
+ message.error = 16;
27169
+ break;
27170
+ case "Error_invalid_utxo":
27171
+ case 17:
27172
+ message.error = 17;
27173
+ break;
27174
+ case "Error_invalid_utxo_amount":
27175
+ case 18:
27176
+ message.error = 18;
27177
+ break;
27178
+ case "Error_wrong_fee":
27179
+ case 6:
27180
+ message.error = 6;
27181
+ break;
27182
+ case "Error_signing":
27183
+ case 7:
27184
+ message.error = 7;
27185
+ break;
27186
+ case "Error_tx_too_big":
27187
+ case 8:
27188
+ message.error = 8;
27189
+ break;
27190
+ case "Error_missing_input_utxos":
27191
+ case 9:
27192
+ message.error = 9;
27193
+ break;
27194
+ case "Error_not_enough_utxos":
27195
+ case 10:
27196
+ message.error = 10;
27197
+ break;
27198
+ case "Error_script_redeem":
27199
+ case 11:
27200
+ message.error = 11;
27201
+ break;
27202
+ case "Error_script_output":
27203
+ case 12:
27204
+ message.error = 12;
27205
+ break;
27206
+ case "Error_script_witness_program":
27207
+ case 13:
27208
+ message.error = 13;
27209
+ break;
27210
+ case "Error_invalid_memo":
27211
+ case 14:
27212
+ message.error = 14;
27213
+ break;
27214
+ case "Error_input_parse":
27215
+ case 19:
27216
+ message.error = 19;
27217
+ break;
27218
+ case "Error_no_support_n2n":
27219
+ case 20:
27220
+ message.error = 20;
27221
+ break;
27222
+ case "Error_signatures_count":
27223
+ case 21:
27224
+ message.error = 21;
27225
+ break;
27226
+ case "Error_invalid_params":
27227
+ case 22:
27228
+ message.error = 22;
27229
+ break;
27230
+ case "Error_invalid_requested_token_amount":
27231
+ case 23:
27232
+ message.error = 23;
27233
+ break;
27234
+ case "Error_not_supported":
27235
+ case 24:
27236
+ message.error = 24;
27237
+ break;
27238
+ case "Error_dust_amount_requested":
27239
+ case 25:
27240
+ message.error = 25;
27241
+ break;
27242
+ }
27243
+ if (object.errorMessage != null)
27244
+ message.errorMessage = String(object.errorMessage);
27245
+ if (object.transaction != null) {
27246
+ if (typeof object.transaction !== "object")
27247
+ throw TypeError(".TW.BitcoinV2.Proto.PsbtSigningOutput.transaction: object expected");
27248
+ message.transaction = $root.TW.BitcoinV2.Proto.Transaction.fromObject(object.transaction);
27249
+ }
27250
+ if (object.encoded != null)
27251
+ if (typeof object.encoded === "string")
27252
+ $util.base64.decode(object.encoded, message.encoded = $util.newBuffer($util.base64.length(object.encoded)), 0);
27253
+ else if (object.encoded.length)
27254
+ message.encoded = object.encoded;
27255
+ if (object.txid != null)
27256
+ if (typeof object.txid === "string")
27257
+ $util.base64.decode(object.txid, message.txid = $util.newBuffer($util.base64.length(object.txid)), 0);
27258
+ else if (object.txid.length)
27259
+ message.txid = object.txid;
27260
+ if (object.vsize != null)
27261
+ if ($util.Long)
27262
+ (message.vsize = $util.Long.fromValue(object.vsize)).unsigned = true;
27263
+ else if (typeof object.vsize === "string")
27264
+ message.vsize = parseInt(object.vsize, 10);
27265
+ else if (typeof object.vsize === "number")
27266
+ message.vsize = object.vsize;
27267
+ else if (typeof object.vsize === "object")
27268
+ message.vsize = new $util.LongBits(object.vsize.low >>> 0, object.vsize.high >>> 0).toNumber(true);
27269
+ if (object.weight != null)
27270
+ if ($util.Long)
27271
+ (message.weight = $util.Long.fromValue(object.weight)).unsigned = true;
27272
+ else if (typeof object.weight === "string")
27273
+ message.weight = parseInt(object.weight, 10);
27274
+ else if (typeof object.weight === "number")
27275
+ message.weight = object.weight;
27276
+ else if (typeof object.weight === "object")
27277
+ message.weight = new $util.LongBits(object.weight.low >>> 0, object.weight.high >>> 0).toNumber(true);
27278
+ if (object.fee != null)
27279
+ if ($util.Long)
27280
+ (message.fee = $util.Long.fromValue(object.fee)).unsigned = false;
27281
+ else if (typeof object.fee === "string")
27282
+ message.fee = parseInt(object.fee, 10);
27283
+ else if (typeof object.fee === "number")
27284
+ message.fee = object.fee;
27285
+ else if (typeof object.fee === "object")
27286
+ message.fee = new $util.LongBits(object.fee.low >>> 0, object.fee.high >>> 0).toNumber();
27287
+ if (object.psbt != null)
27288
+ if (typeof object.psbt === "string")
27289
+ $util.base64.decode(object.psbt, message.psbt = $util.newBuffer($util.base64.length(object.psbt)), 0);
27290
+ else if (object.psbt.length)
27291
+ message.psbt = object.psbt;
27292
+ return message;
27293
+ };
27294
+
27295
+ /**
27296
+ * Creates a plain object from a PsbtSigningOutput message. Also converts values to other types if specified.
27297
+ * @function toObject
27298
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
27299
+ * @static
27300
+ * @param {TW.BitcoinV2.Proto.PsbtSigningOutput} message PsbtSigningOutput
27301
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
27302
+ * @returns {Object.<string,*>} Plain object
27303
+ */
27304
+ PsbtSigningOutput.toObject = function toObject(message, options) {
27305
+ if (!options)
27306
+ options = {};
27307
+ var object = {};
27308
+ if (options.defaults) {
27309
+ object.error = options.enums === String ? "OK" : 0;
27310
+ object.errorMessage = "";
27311
+ object.transaction = null;
27312
+ if (options.bytes === String)
27313
+ object.encoded = "";
27314
+ else {
27315
+ object.encoded = [];
27316
+ if (options.bytes !== Array)
27317
+ object.encoded = $util.newBuffer(object.encoded);
27318
+ }
27319
+ if (options.bytes === String)
27320
+ object.txid = "";
27321
+ else {
27322
+ object.txid = [];
27323
+ if (options.bytes !== Array)
27324
+ object.txid = $util.newBuffer(object.txid);
27325
+ }
27326
+ if ($util.Long) {
27327
+ var long = new $util.Long(0, 0, true);
27328
+ object.vsize = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
27329
+ } else
27330
+ object.vsize = options.longs === String ? "0" : 0;
27331
+ if ($util.Long) {
27332
+ var long = new $util.Long(0, 0, true);
27333
+ object.weight = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
27334
+ } else
27335
+ object.weight = options.longs === String ? "0" : 0;
27336
+ if ($util.Long) {
27337
+ var long = new $util.Long(0, 0, false);
27338
+ object.fee = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
27339
+ } else
27340
+ object.fee = options.longs === String ? "0" : 0;
27341
+ if (options.bytes === String)
27342
+ object.psbt = "";
27343
+ else {
27344
+ object.psbt = [];
27345
+ if (options.bytes !== Array)
27346
+ object.psbt = $util.newBuffer(object.psbt);
27347
+ }
27348
+ }
27349
+ if (message.error != null && message.hasOwnProperty("error"))
27350
+ object.error = options.enums === String ? $root.TW.Common.Proto.SigningError[message.error] : message.error;
27351
+ if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
27352
+ object.errorMessage = message.errorMessage;
27353
+ if (message.transaction != null && message.hasOwnProperty("transaction"))
27354
+ object.transaction = $root.TW.BitcoinV2.Proto.Transaction.toObject(message.transaction, options);
27355
+ if (message.encoded != null && message.hasOwnProperty("encoded"))
27356
+ 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;
27357
+ if (message.txid != null && message.hasOwnProperty("txid"))
27358
+ 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;
27359
+ if (message.vsize != null && message.hasOwnProperty("vsize"))
27360
+ if (typeof message.vsize === "number")
27361
+ object.vsize = options.longs === String ? String(message.vsize) : message.vsize;
27362
+ else
27363
+ 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;
27364
+ if (message.weight != null && message.hasOwnProperty("weight"))
27365
+ if (typeof message.weight === "number")
27366
+ object.weight = options.longs === String ? String(message.weight) : message.weight;
27367
+ else
27368
+ 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;
27369
+ if (message.fee != null && message.hasOwnProperty("fee"))
27370
+ if (typeof message.fee === "number")
27371
+ object.fee = options.longs === String ? String(message.fee) : message.fee;
27372
+ else
27373
+ 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;
27374
+ if (message.psbt != null && message.hasOwnProperty("psbt"))
27375
+ 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;
27376
+ return object;
27377
+ };
27378
+
27379
+ /**
27380
+ * Converts this PsbtSigningOutput to JSON.
27381
+ * @function toJSON
27382
+ * @memberof TW.BitcoinV2.Proto.PsbtSigningOutput
27383
+ * @instance
27384
+ * @returns {Object.<string,*>} JSON object
27385
+ */
27386
+ PsbtSigningOutput.prototype.toJSON = function toJSON() {
27387
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
27388
+ };
27389
+
27390
+ return PsbtSigningOutput;
27391
+ })();
27392
+
26528
27393
  return Proto;
26529
27394
  })();
26530
27395
 
@@ -34,7 +34,7 @@ function Ra(){H++;g.monitorRunDependencies&&g.monitorRunDependencies(H);assert(!
34
34
  function Sa(){return K.startsWith("data:application/octet-stream;base64,")}function ma(a){return a.startsWith("file://")}function M(a){return function(){var b=g.asm;assert(Na,"native function `"+a+"` called before runtime initialization");b[a]||assert(b[a],"exported native function `"+a+"` not found");return b[a].apply(null,arguments)}}var K;K="wallet-core.wasm";if(!Sa()){var Ta=K;K=g.locateFile?g.locateFile(Ta,x):x+Ta}
35
35
  function Ua(){var a=K;try{if(a==K&&qa)return new Uint8Array(qa);if(ka)return ka(a);throw"both async and sync fetching of the wasm failed";}catch(b){n(b)}}
36
36
  function Va(){if(!qa&&(ea||fa)){if("function"==typeof fetch&&!ma(K))return fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Ua()});if(ja)return new Promise(function(a,b){ja(K,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return Ua()})}
37
- var Wa,Xa,Ya={2078740:()=>{if(void 0===g.ea)try{var a="object"===typeof window?window:self,b="undefined"!==typeof a.crypto?a.crypto:a.msCrypto;a=function(){var d=new Uint32Array(1);b.getRandomValues(d);return d[0]>>>0};a();g.ea=a}catch(d){try{var c=require("crypto");a=function(){var e=c.randomBytes(4);return(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0};a();g.ea=a}catch(e){throw"No secure random number generator found";}}},2079462:()=>g.ea()};function Za(a){for(;0<a.length;)a.shift()(g)}
37
+ var Wa,Xa,Ya={2081492:()=>{if(void 0===g.ea)try{var a="object"===typeof window?window:self,b="undefined"!==typeof a.crypto?a.crypto:a.msCrypto;a=function(){var d=new Uint32Array(1);b.getRandomValues(d);return d[0]>>>0};a();g.ea=a}catch(d){try{var c=require("crypto");a=function(){var e=c.randomBytes(4);return(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0};a();g.ea=a}catch(e){throw"No secure random number generator found";}}},2082214:()=>g.ea()};function Za(a){for(;0<a.length;)a.shift()(g)}
38
38
  function va(a){assert("number"===typeof a);return"0x"+a.toString(16).padStart(8,"0")}function pa(a){$a||($a={});$a[a]||($a[a]=1,v&&(a="warning: "+a),y(a))}var $a;function ab(a){this.l=a-24;this.Na=function(b){G[this.l+4>>2]=b};this.Ia=function(b){G[this.l+8>>2]=b};this.Ja=function(){F[this.l>>2]=0};this.Ea=function(){D[this.l+12>>0]=0};this.Ka=function(){D[this.l+13>>0]=0};this.I=function(b,c){this.Da();this.Na(b);this.Ia(c);this.Ja();this.Ea();this.Ka()};this.Da=function(){G[this.l+16>>2]=0}}
39
39
  var bb=0,cb=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},db=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=cb(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},eb=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b},fb=
40
40
  a=>{if("/"===a)return"/";a=db(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)};
Binary file
@@ -131,6 +131,10 @@ export class BitcoinMessageSigner {
131
131
  static signMessage(privateKey: PrivateKey, address: string, message: string): string;
132
132
  static verifyMessage(address: string, message: string, signature: string): boolean;
133
133
  }
134
+ export class BitcoinPsbt {
135
+ static sign(input: Uint8Array | Buffer, coin: CoinType): Uint8Array;
136
+ static plan(input: Uint8Array | Buffer, coin: CoinType): Uint8Array;
137
+ }
134
138
  export class BitcoinScript {
135
139
  static equal(lhs: BitcoinScript, rhs: BitcoinScript): boolean;
136
140
  static buildPayToPublicKey(pubkey: Uint8Array | Buffer): BitcoinScript;
@@ -1030,6 +1034,7 @@ export interface WalletCore {
1030
1034
  Base64: typeof Base64;
1031
1035
  BitcoinAddress: typeof BitcoinAddress;
1032
1036
  BitcoinMessageSigner: typeof BitcoinMessageSigner;
1037
+ BitcoinPsbt: typeof BitcoinPsbt;
1033
1038
  BitcoinScript: typeof BitcoinScript;
1034
1039
  BitcoinSigHashType: typeof BitcoinSigHashType;
1035
1040
  Blockchain: typeof Blockchain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/wallet-core",
3
- "version": "4.1.8-rc2",
3
+ "version": "4.1.8",
4
4
  "description": "wallet core wasm and protobuf models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",