@trustwallet/wallet-core 4.2.0-dev-rc1 → 4.2.0-dev-rc2

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.
@@ -40921,11 +40921,14 @@ export namespace TW {
40921
40921
  /** Transfer bounceable */
40922
40922
  bounceable?: (boolean|null);
40923
40923
 
40924
+ /** Transfer stateInit */
40925
+ stateInit?: (string|null);
40926
+
40924
40927
  /** Transfer jettonTransfer */
40925
40928
  jettonTransfer?: (TW.TheOpenNetwork.Proto.IJettonTransfer|null);
40926
40929
 
40927
40930
  /** Transfer customPayload */
40928
- customPayload?: (TW.TheOpenNetwork.Proto.ICustomPayload|null);
40931
+ customPayload?: (string|null);
40929
40932
  }
40930
40933
 
40931
40934
  /** Represents a Transfer. */
@@ -40952,11 +40955,14 @@ export namespace TW {
40952
40955
  /** Transfer bounceable. */
40953
40956
  public bounceable: boolean;
40954
40957
 
40958
+ /** Transfer stateInit. */
40959
+ public stateInit: string;
40960
+
40955
40961
  /** Transfer jettonTransfer. */
40956
40962
  public jettonTransfer?: (TW.TheOpenNetwork.Proto.IJettonTransfer|null);
40957
40963
 
40958
40964
  /** Transfer customPayload. */
40959
- public customPayload?: (TW.TheOpenNetwork.Proto.ICustomPayload|null);
40965
+ public customPayload?: (string|null);
40960
40966
 
40961
40967
  /** Transfer payload. */
40962
40968
  public payload?: ("jettonTransfer"|"customPayload");
@@ -41032,6 +41038,9 @@ export namespace TW {
41032
41038
 
41033
41039
  /** JettonTransfer forwardAmount */
41034
41040
  forwardAmount?: (Long|null);
41041
+
41042
+ /** JettonTransfer customPayload */
41043
+ customPayload?: (string|null);
41035
41044
  }
41036
41045
 
41037
41046
  /** Represents a JettonTransfer. */
@@ -41058,6 +41067,9 @@ export namespace TW {
41058
41067
  /** JettonTransfer forwardAmount. */
41059
41068
  public forwardAmount: Long;
41060
41069
 
41070
+ /** JettonTransfer customPayload. */
41071
+ public customPayload: string;
41072
+
41061
41073
  /**
41062
41074
  * Creates a new JettonTransfer instance using the specified properties.
41063
41075
  * @param [properties] Properties to set
@@ -41112,85 +41124,6 @@ export namespace TW {
41112
41124
  public toJSON(): { [k: string]: any };
41113
41125
  }
41114
41126
 
41115
- /** Properties of a CustomPayload. */
41116
- interface ICustomPayload {
41117
-
41118
- /** CustomPayload stateInit */
41119
- stateInit?: (string|null);
41120
-
41121
- /** CustomPayload payload */
41122
- payload?: (string|null);
41123
- }
41124
-
41125
- /** Represents a CustomPayload. */
41126
- class CustomPayload implements ICustomPayload {
41127
-
41128
- /**
41129
- * Constructs a new CustomPayload.
41130
- * @param [properties] Properties to set
41131
- */
41132
- constructor(properties?: TW.TheOpenNetwork.Proto.ICustomPayload);
41133
-
41134
- /** CustomPayload stateInit. */
41135
- public stateInit: string;
41136
-
41137
- /** CustomPayload payload. */
41138
- public payload: string;
41139
-
41140
- /**
41141
- * Creates a new CustomPayload instance using the specified properties.
41142
- * @param [properties] Properties to set
41143
- * @returns CustomPayload instance
41144
- */
41145
- public static create(properties?: TW.TheOpenNetwork.Proto.ICustomPayload): TW.TheOpenNetwork.Proto.CustomPayload;
41146
-
41147
- /**
41148
- * Encodes the specified CustomPayload message. Does not implicitly {@link TW.TheOpenNetwork.Proto.CustomPayload.verify|verify} messages.
41149
- * @param message CustomPayload message or plain object to encode
41150
- * @param [writer] Writer to encode to
41151
- * @returns Writer
41152
- */
41153
- public static encode(message: TW.TheOpenNetwork.Proto.ICustomPayload, writer?: $protobuf.Writer): $protobuf.Writer;
41154
-
41155
- /**
41156
- * Decodes a CustomPayload message from the specified reader or buffer.
41157
- * @param reader Reader or buffer to decode from
41158
- * @param [length] Message length if known beforehand
41159
- * @returns CustomPayload
41160
- * @throws {Error} If the payload is not a reader or valid buffer
41161
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
41162
- */
41163
- public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): TW.TheOpenNetwork.Proto.CustomPayload;
41164
-
41165
- /**
41166
- * Verifies a CustomPayload message.
41167
- * @param message Plain object to verify
41168
- * @returns `null` if valid, otherwise the reason why it is not
41169
- */
41170
- public static verify(message: { [k: string]: any }): (string|null);
41171
-
41172
- /**
41173
- * Creates a CustomPayload message from a plain object. Also converts values to their respective internal types.
41174
- * @param object Plain object
41175
- * @returns CustomPayload
41176
- */
41177
- public static fromObject(object: { [k: string]: any }): TW.TheOpenNetwork.Proto.CustomPayload;
41178
-
41179
- /**
41180
- * Creates a plain object from a CustomPayload message. Also converts values to other types if specified.
41181
- * @param message CustomPayload
41182
- * @param [options] Conversion options
41183
- * @returns Plain object
41184
- */
41185
- public static toObject(message: TW.TheOpenNetwork.Proto.CustomPayload, options?: $protobuf.IConversionOptions): { [k: string]: any };
41186
-
41187
- /**
41188
- * Converts this CustomPayload to JSON.
41189
- * @returns JSON object
41190
- */
41191
- public toJSON(): { [k: string]: any };
41192
- }
41193
-
41194
41127
  /** Properties of a SigningInput. */
41195
41128
  interface ISigningInput {
41196
41129
 
@@ -120826,8 +120826,9 @@
120826
120826
  * @property {number|null} [mode] Transfer mode
120827
120827
  * @property {string|null} [comment] Transfer comment
120828
120828
  * @property {boolean|null} [bounceable] Transfer bounceable
120829
+ * @property {string|null} [stateInit] Transfer stateInit
120829
120830
  * @property {TW.TheOpenNetwork.Proto.IJettonTransfer|null} [jettonTransfer] Transfer jettonTransfer
120830
- * @property {TW.TheOpenNetwork.Proto.ICustomPayload|null} [customPayload] Transfer customPayload
120831
+ * @property {string|null} [customPayload] Transfer customPayload
120831
120832
  */
120832
120833
 
120833
120834
  /**
@@ -120885,6 +120886,14 @@
120885
120886
  */
120886
120887
  Transfer.prototype.bounceable = false;
120887
120888
 
120889
+ /**
120890
+ * Transfer stateInit.
120891
+ * @member {string} stateInit
120892
+ * @memberof TW.TheOpenNetwork.Proto.Transfer
120893
+ * @instance
120894
+ */
120895
+ Transfer.prototype.stateInit = "";
120896
+
120888
120897
  /**
120889
120898
  * Transfer jettonTransfer.
120890
120899
  * @member {TW.TheOpenNetwork.Proto.IJettonTransfer|null|undefined} jettonTransfer
@@ -120895,7 +120904,7 @@
120895
120904
 
120896
120905
  /**
120897
120906
  * Transfer customPayload.
120898
- * @member {TW.TheOpenNetwork.Proto.ICustomPayload|null|undefined} customPayload
120907
+ * @member {string|null|undefined} customPayload
120899
120908
  * @memberof TW.TheOpenNetwork.Proto.Transfer
120900
120909
  * @instance
120901
120910
  */
@@ -120949,10 +120958,12 @@
120949
120958
  writer.uint32(/* id 4, wireType 2 =*/34).string(message.comment);
120950
120959
  if (message.bounceable != null && Object.hasOwnProperty.call(message, "bounceable"))
120951
120960
  writer.uint32(/* id 5, wireType 0 =*/40).bool(message.bounceable);
120961
+ if (message.stateInit != null && Object.hasOwnProperty.call(message, "stateInit"))
120962
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.stateInit);
120952
120963
  if (message.jettonTransfer != null && Object.hasOwnProperty.call(message, "jettonTransfer"))
120953
- $root.TW.TheOpenNetwork.Proto.JettonTransfer.encode(message.jettonTransfer, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
120964
+ $root.TW.TheOpenNetwork.Proto.JettonTransfer.encode(message.jettonTransfer, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
120954
120965
  if (message.customPayload != null && Object.hasOwnProperty.call(message, "customPayload"))
120955
- $root.TW.TheOpenNetwork.Proto.CustomPayload.encode(message.customPayload, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
120966
+ writer.uint32(/* id 8, wireType 2 =*/66).string(message.customPayload);
120956
120967
  return writer;
120957
120968
  };
120958
120969
 
@@ -120990,10 +121001,13 @@
120990
121001
  message.bounceable = reader.bool();
120991
121002
  break;
120992
121003
  case 6:
120993
- message.jettonTransfer = $root.TW.TheOpenNetwork.Proto.JettonTransfer.decode(reader, reader.uint32());
121004
+ message.stateInit = reader.string();
120994
121005
  break;
120995
121006
  case 7:
120996
- message.customPayload = $root.TW.TheOpenNetwork.Proto.CustomPayload.decode(reader, reader.uint32());
121007
+ message.jettonTransfer = $root.TW.TheOpenNetwork.Proto.JettonTransfer.decode(reader, reader.uint32());
121008
+ break;
121009
+ case 8:
121010
+ message.customPayload = reader.string();
120997
121011
  break;
120998
121012
  default:
120999
121013
  reader.skipType(tag & 7);
@@ -121030,6 +121044,9 @@
121030
121044
  if (message.bounceable != null && message.hasOwnProperty("bounceable"))
121031
121045
  if (typeof message.bounceable !== "boolean")
121032
121046
  return "bounceable: boolean expected";
121047
+ if (message.stateInit != null && message.hasOwnProperty("stateInit"))
121048
+ if (!$util.isString(message.stateInit))
121049
+ return "stateInit: string expected";
121033
121050
  if (message.jettonTransfer != null && message.hasOwnProperty("jettonTransfer")) {
121034
121051
  properties.payload = 1;
121035
121052
  {
@@ -121042,11 +121059,8 @@
121042
121059
  if (properties.payload === 1)
121043
121060
  return "payload: multiple values";
121044
121061
  properties.payload = 1;
121045
- {
121046
- var error = $root.TW.TheOpenNetwork.Proto.CustomPayload.verify(message.customPayload);
121047
- if (error)
121048
- return "customPayload." + error;
121049
- }
121062
+ if (!$util.isString(message.customPayload))
121063
+ return "customPayload: string expected";
121050
121064
  }
121051
121065
  return null;
121052
121066
  };
@@ -121080,16 +121094,15 @@
121080
121094
  message.comment = String(object.comment);
121081
121095
  if (object.bounceable != null)
121082
121096
  message.bounceable = Boolean(object.bounceable);
121097
+ if (object.stateInit != null)
121098
+ message.stateInit = String(object.stateInit);
121083
121099
  if (object.jettonTransfer != null) {
121084
121100
  if (typeof object.jettonTransfer !== "object")
121085
121101
  throw TypeError(".TW.TheOpenNetwork.Proto.Transfer.jettonTransfer: object expected");
121086
121102
  message.jettonTransfer = $root.TW.TheOpenNetwork.Proto.JettonTransfer.fromObject(object.jettonTransfer);
121087
121103
  }
121088
- if (object.customPayload != null) {
121089
- if (typeof object.customPayload !== "object")
121090
- throw TypeError(".TW.TheOpenNetwork.Proto.Transfer.customPayload: object expected");
121091
- message.customPayload = $root.TW.TheOpenNetwork.Proto.CustomPayload.fromObject(object.customPayload);
121092
- }
121104
+ if (object.customPayload != null)
121105
+ message.customPayload = String(object.customPayload);
121093
121106
  return message;
121094
121107
  };
121095
121108
 
@@ -121116,6 +121129,7 @@
121116
121129
  object.mode = 0;
121117
121130
  object.comment = "";
121118
121131
  object.bounceable = false;
121132
+ object.stateInit = "";
121119
121133
  }
121120
121134
  if (message.dest != null && message.hasOwnProperty("dest"))
121121
121135
  object.dest = message.dest;
@@ -121130,13 +121144,15 @@
121130
121144
  object.comment = message.comment;
121131
121145
  if (message.bounceable != null && message.hasOwnProperty("bounceable"))
121132
121146
  object.bounceable = message.bounceable;
121147
+ if (message.stateInit != null && message.hasOwnProperty("stateInit"))
121148
+ object.stateInit = message.stateInit;
121133
121149
  if (message.jettonTransfer != null && message.hasOwnProperty("jettonTransfer")) {
121134
121150
  object.jettonTransfer = $root.TW.TheOpenNetwork.Proto.JettonTransfer.toObject(message.jettonTransfer, options);
121135
121151
  if (options.oneofs)
121136
121152
  object.payload = "jettonTransfer";
121137
121153
  }
121138
121154
  if (message.customPayload != null && message.hasOwnProperty("customPayload")) {
121139
- object.customPayload = $root.TW.TheOpenNetwork.Proto.CustomPayload.toObject(message.customPayload, options);
121155
+ object.customPayload = message.customPayload;
121140
121156
  if (options.oneofs)
121141
121157
  object.payload = "customPayload";
121142
121158
  }
@@ -121168,6 +121184,7 @@
121168
121184
  * @property {string|null} [toOwner] JettonTransfer toOwner
121169
121185
  * @property {string|null} [responseAddress] JettonTransfer responseAddress
121170
121186
  * @property {Long|null} [forwardAmount] JettonTransfer forwardAmount
121187
+ * @property {string|null} [customPayload] JettonTransfer customPayload
121171
121188
  */
121172
121189
 
121173
121190
  /**
@@ -121225,6 +121242,14 @@
121225
121242
  */
121226
121243
  JettonTransfer.prototype.forwardAmount = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
121227
121244
 
121245
+ /**
121246
+ * JettonTransfer customPayload.
121247
+ * @member {string} customPayload
121248
+ * @memberof TW.TheOpenNetwork.Proto.JettonTransfer
121249
+ * @instance
121250
+ */
121251
+ JettonTransfer.prototype.customPayload = "";
121252
+
121228
121253
  /**
121229
121254
  * Creates a new JettonTransfer instance using the specified properties.
121230
121255
  * @function create
@@ -121259,6 +121284,8 @@
121259
121284
  writer.uint32(/* id 4, wireType 2 =*/34).string(message.responseAddress);
121260
121285
  if (message.forwardAmount != null && Object.hasOwnProperty.call(message, "forwardAmount"))
121261
121286
  writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.forwardAmount);
121287
+ if (message.customPayload != null && Object.hasOwnProperty.call(message, "customPayload"))
121288
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.customPayload);
121262
121289
  return writer;
121263
121290
  };
121264
121291
 
@@ -121295,6 +121322,9 @@
121295
121322
  case 5:
121296
121323
  message.forwardAmount = reader.uint64();
121297
121324
  break;
121325
+ case 6:
121326
+ message.customPayload = reader.string();
121327
+ break;
121298
121328
  default:
121299
121329
  reader.skipType(tag & 7);
121300
121330
  break;
@@ -121329,6 +121359,9 @@
121329
121359
  if (message.forwardAmount != null && message.hasOwnProperty("forwardAmount"))
121330
121360
  if (!$util.isInteger(message.forwardAmount) && !(message.forwardAmount && $util.isInteger(message.forwardAmount.low) && $util.isInteger(message.forwardAmount.high)))
121331
121361
  return "forwardAmount: integer|Long expected";
121362
+ if (message.customPayload != null && message.hasOwnProperty("customPayload"))
121363
+ if (!$util.isString(message.customPayload))
121364
+ return "customPayload: string expected";
121332
121365
  return null;
121333
121366
  };
121334
121367
 
@@ -121375,6 +121408,8 @@
121375
121408
  message.forwardAmount = object.forwardAmount;
121376
121409
  else if (typeof object.forwardAmount === "object")
121377
121410
  message.forwardAmount = new $util.LongBits(object.forwardAmount.low >>> 0, object.forwardAmount.high >>> 0).toNumber(true);
121411
+ if (object.customPayload != null)
121412
+ message.customPayload = String(object.customPayload);
121378
121413
  return message;
121379
121414
  };
121380
121415
 
@@ -121409,6 +121444,7 @@
121409
121444
  object.forwardAmount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
121410
121445
  } else
121411
121446
  object.forwardAmount = options.longs === String ? "0" : 0;
121447
+ object.customPayload = "";
121412
121448
  }
121413
121449
  if (message.queryId != null && message.hasOwnProperty("queryId"))
121414
121450
  if (typeof message.queryId === "number")
@@ -121429,6 +121465,8 @@
121429
121465
  object.forwardAmount = options.longs === String ? String(message.forwardAmount) : message.forwardAmount;
121430
121466
  else
121431
121467
  object.forwardAmount = options.longs === String ? $util.Long.prototype.toString.call(message.forwardAmount) : options.longs === Number ? new $util.LongBits(message.forwardAmount.low >>> 0, message.forwardAmount.high >>> 0).toNumber(true) : message.forwardAmount;
121468
+ if (message.customPayload != null && message.hasOwnProperty("customPayload"))
121469
+ object.customPayload = message.customPayload;
121432
121470
  return object;
121433
121471
  };
121434
121472
 
@@ -121446,187 +121484,6 @@
121446
121484
  return JettonTransfer;
121447
121485
  })();
121448
121486
 
121449
- Proto.CustomPayload = (function() {
121450
-
121451
- /**
121452
- * Properties of a CustomPayload.
121453
- * @memberof TW.TheOpenNetwork.Proto
121454
- * @interface ICustomPayload
121455
- * @property {string|null} [stateInit] CustomPayload stateInit
121456
- * @property {string|null} [payload] CustomPayload payload
121457
- */
121458
-
121459
- /**
121460
- * Constructs a new CustomPayload.
121461
- * @memberof TW.TheOpenNetwork.Proto
121462
- * @classdesc Represents a CustomPayload.
121463
- * @implements ICustomPayload
121464
- * @constructor
121465
- * @param {TW.TheOpenNetwork.Proto.ICustomPayload=} [properties] Properties to set
121466
- */
121467
- function CustomPayload(properties) {
121468
- if (properties)
121469
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
121470
- if (properties[keys[i]] != null)
121471
- this[keys[i]] = properties[keys[i]];
121472
- }
121473
-
121474
- /**
121475
- * CustomPayload stateInit.
121476
- * @member {string} stateInit
121477
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121478
- * @instance
121479
- */
121480
- CustomPayload.prototype.stateInit = "";
121481
-
121482
- /**
121483
- * CustomPayload payload.
121484
- * @member {string} payload
121485
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121486
- * @instance
121487
- */
121488
- CustomPayload.prototype.payload = "";
121489
-
121490
- /**
121491
- * Creates a new CustomPayload instance using the specified properties.
121492
- * @function create
121493
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121494
- * @static
121495
- * @param {TW.TheOpenNetwork.Proto.ICustomPayload=} [properties] Properties to set
121496
- * @returns {TW.TheOpenNetwork.Proto.CustomPayload} CustomPayload instance
121497
- */
121498
- CustomPayload.create = function create(properties) {
121499
- return new CustomPayload(properties);
121500
- };
121501
-
121502
- /**
121503
- * Encodes the specified CustomPayload message. Does not implicitly {@link TW.TheOpenNetwork.Proto.CustomPayload.verify|verify} messages.
121504
- * @function encode
121505
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121506
- * @static
121507
- * @param {TW.TheOpenNetwork.Proto.ICustomPayload} message CustomPayload message or plain object to encode
121508
- * @param {$protobuf.Writer} [writer] Writer to encode to
121509
- * @returns {$protobuf.Writer} Writer
121510
- */
121511
- CustomPayload.encode = function encode(message, writer) {
121512
- if (!writer)
121513
- writer = $Writer.create();
121514
- if (message.stateInit != null && Object.hasOwnProperty.call(message, "stateInit"))
121515
- writer.uint32(/* id 1, wireType 2 =*/10).string(message.stateInit);
121516
- if (message.payload != null && Object.hasOwnProperty.call(message, "payload"))
121517
- writer.uint32(/* id 2, wireType 2 =*/18).string(message.payload);
121518
- return writer;
121519
- };
121520
-
121521
- /**
121522
- * Decodes a CustomPayload message from the specified reader or buffer.
121523
- * @function decode
121524
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121525
- * @static
121526
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
121527
- * @param {number} [length] Message length if known beforehand
121528
- * @returns {TW.TheOpenNetwork.Proto.CustomPayload} CustomPayload
121529
- * @throws {Error} If the payload is not a reader or valid buffer
121530
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
121531
- */
121532
- CustomPayload.decode = function decode(reader, length) {
121533
- if (!(reader instanceof $Reader))
121534
- reader = $Reader.create(reader);
121535
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.TheOpenNetwork.Proto.CustomPayload();
121536
- while (reader.pos < end) {
121537
- var tag = reader.uint32();
121538
- switch (tag >>> 3) {
121539
- case 1:
121540
- message.stateInit = reader.string();
121541
- break;
121542
- case 2:
121543
- message.payload = reader.string();
121544
- break;
121545
- default:
121546
- reader.skipType(tag & 7);
121547
- break;
121548
- }
121549
- }
121550
- return message;
121551
- };
121552
-
121553
- /**
121554
- * Verifies a CustomPayload message.
121555
- * @function verify
121556
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121557
- * @static
121558
- * @param {Object.<string,*>} message Plain object to verify
121559
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
121560
- */
121561
- CustomPayload.verify = function verify(message) {
121562
- if (typeof message !== "object" || message === null)
121563
- return "object expected";
121564
- if (message.stateInit != null && message.hasOwnProperty("stateInit"))
121565
- if (!$util.isString(message.stateInit))
121566
- return "stateInit: string expected";
121567
- if (message.payload != null && message.hasOwnProperty("payload"))
121568
- if (!$util.isString(message.payload))
121569
- return "payload: string expected";
121570
- return null;
121571
- };
121572
-
121573
- /**
121574
- * Creates a CustomPayload message from a plain object. Also converts values to their respective internal types.
121575
- * @function fromObject
121576
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121577
- * @static
121578
- * @param {Object.<string,*>} object Plain object
121579
- * @returns {TW.TheOpenNetwork.Proto.CustomPayload} CustomPayload
121580
- */
121581
- CustomPayload.fromObject = function fromObject(object) {
121582
- if (object instanceof $root.TW.TheOpenNetwork.Proto.CustomPayload)
121583
- return object;
121584
- var message = new $root.TW.TheOpenNetwork.Proto.CustomPayload();
121585
- if (object.stateInit != null)
121586
- message.stateInit = String(object.stateInit);
121587
- if (object.payload != null)
121588
- message.payload = String(object.payload);
121589
- return message;
121590
- };
121591
-
121592
- /**
121593
- * Creates a plain object from a CustomPayload message. Also converts values to other types if specified.
121594
- * @function toObject
121595
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121596
- * @static
121597
- * @param {TW.TheOpenNetwork.Proto.CustomPayload} message CustomPayload
121598
- * @param {$protobuf.IConversionOptions} [options] Conversion options
121599
- * @returns {Object.<string,*>} Plain object
121600
- */
121601
- CustomPayload.toObject = function toObject(message, options) {
121602
- if (!options)
121603
- options = {};
121604
- var object = {};
121605
- if (options.defaults) {
121606
- object.stateInit = "";
121607
- object.payload = "";
121608
- }
121609
- if (message.stateInit != null && message.hasOwnProperty("stateInit"))
121610
- object.stateInit = message.stateInit;
121611
- if (message.payload != null && message.hasOwnProperty("payload"))
121612
- object.payload = message.payload;
121613
- return object;
121614
- };
121615
-
121616
- /**
121617
- * Converts this CustomPayload to JSON.
121618
- * @function toJSON
121619
- * @memberof TW.TheOpenNetwork.Proto.CustomPayload
121620
- * @instance
121621
- * @returns {Object.<string,*>} JSON object
121622
- */
121623
- CustomPayload.prototype.toJSON = function toJSON() {
121624
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
121625
- };
121626
-
121627
- return CustomPayload;
121628
- })();
121629
-
121630
121487
  Proto.SigningInput = (function() {
121631
121488
 
121632
121489
  /**
@@ -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={2081044:()=>{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";}}},2081766:()=>g.ea()};function Za(a){for(;0<a.length;)a.shift()(g)}
37
+ var Wa,Xa,Ya={2109780:()=>{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";}}},2110502:()=>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
@@ -13,6 +13,7 @@ export declare class Default implements Types.IKeyStore {
13
13
  importWallet(wallet: Types.Wallet): Promise<void>;
14
14
  import(mnemonic: string, name: string, password: string, coins: CoinType[], encryption: StoredKeyEncryption): Promise<Types.Wallet>;
15
15
  importKey(key: Uint8Array, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Types.Wallet>;
16
+ importTON(tonMnemonic: string, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Types.Wallet>;
16
17
  addAccounts(id: string, password: string, coins: CoinType[]): Promise<Types.Wallet>;
17
18
  getKey(id: string, password: string, account: Types.ActiveAccount): Promise<PrivateKey>;
18
19
  export(id: string, password: string): Promise<string | Uint8Array>;
@@ -75,6 +75,23 @@ var Default = /** @class */ (function () {
75
75
  .catch(function (error) { return reject(error); });
76
76
  });
77
77
  };
78
+ Default.prototype.importTON = function (tonMnemonic, name, password, coin, encryption) {
79
+ var _this = this;
80
+ return new Promise(function (resolve, reject) {
81
+ var _a = _this.core, StoredKey = _a.StoredKey, TONWallet = _a.TONWallet;
82
+ var passphrase = "";
83
+ if (!TONWallet.isValidMnemonic(tonMnemonic, passphrase)) {
84
+ throw Types.Error.InvalidMnemonic;
85
+ }
86
+ var pass = Buffer.from(password);
87
+ var storedKey = StoredKey.importTONWalletWithEncryption(tonMnemonic, name, pass, coin, encryption);
88
+ var wallet = _this.mapWallet(storedKey);
89
+ storedKey.delete();
90
+ _this.importWallet(wallet)
91
+ .then(function () { return resolve(wallet); })
92
+ .catch(function (error) { return reject(error); });
93
+ });
94
+ };
78
95
  Default.prototype.addAccounts = function (id, password, coins) {
79
96
  var _this = this;
80
97
  return this.load(id).then(function (wallet) {
@@ -93,11 +110,21 @@ var Default = /** @class */ (function () {
93
110
  var _this = this;
94
111
  return this.load(id).then(function (wallet) {
95
112
  var storedKey = _this.mapStoredKey(wallet);
96
- var hdWallet = storedKey.wallet(Buffer.from(password));
97
113
  var coin = _this.core.CoinType.values["" + account.coin];
98
- var privateKey = hdWallet.getKey(coin, account.derivationPath);
114
+ var privateKey;
115
+ switch (wallet.type) {
116
+ // In case of BIP39 mnemonic, we should use the custom derivation path.
117
+ case Types.WalletType.Mnemonic:
118
+ var hdWallet = storedKey.wallet(Buffer.from(password));
119
+ privateKey = hdWallet.getKey(coin, account.derivationPath);
120
+ hdWallet.delete();
121
+ break;
122
+ // Otherwise, use the default implementation.
123
+ default:
124
+ privateKey = storedKey.privateKey(coin, Buffer.from(password));
125
+ break;
126
+ }
99
127
  storedKey.delete();
100
- hdWallet.delete();
101
128
  return privateKey;
102
129
  });
103
130
  };
@@ -113,6 +140,9 @@ var Default = /** @class */ (function () {
113
140
  case Types.WalletType.PrivateKey:
114
141
  value = storedKey.decryptPrivateKey(Buffer.from(password));
115
142
  break;
143
+ case Types.WalletType.TonMnemonic:
144
+ value = storedKey.decryptTONMnemonic(Buffer.from(password));
145
+ break;
116
146
  default:
117
147
  throw Types.Error.InvalidJSON;
118
148
  }
@@ -3,7 +3,8 @@ export declare enum WalletType {
3
3
  Mnemonic = "mnemonic",
4
4
  PrivateKey = "privateKey",
5
5
  WatchOnly = "watchOnly",
6
- Hardware = "hardware"
6
+ Hardware = "hardware",
7
+ TonMnemonic = "ton-mnemonic"
7
8
  }
8
9
  export declare enum Error {
9
10
  WalletNotFound = "wallet not found",
@@ -34,6 +35,7 @@ export interface IKeyStore {
34
35
  import(mnemonic: string, name: string, password: string, coins: CoinType[], encryption: StoredKeyEncryption): Promise<Wallet>;
35
36
  importKey(key: Uint8Array, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Wallet>;
36
37
  importWallet(wallet: Wallet): Promise<void>;
38
+ importTON(tonMnemonic: string, name: string, password: string, coin: CoinType, encryption: StoredKeyEncryption): Promise<Wallet>;
37
39
  addAccounts(id: string, password: string, coins: CoinType[]): Promise<Wallet>;
38
40
  getKey(id: string, password: string, account: ActiveAccount): Promise<PrivateKey>;
39
41
  delete(id: string, password: string): Promise<void>;
@@ -10,6 +10,7 @@ var WalletType;
10
10
  WalletType["PrivateKey"] = "privateKey";
11
11
  WalletType["WatchOnly"] = "watchOnly";
12
12
  WalletType["Hardware"] = "hardware";
13
+ WalletType["TonMnemonic"] = "ton-mnemonic";
13
14
  })(WalletType = exports.WalletType || (exports.WalletType = {}));
14
15
  var Error;
15
16
  (function (Error) {
@@ -928,6 +928,8 @@ export class StoredKey {
928
928
  static importPrivateKeyWithEncryption(privateKey: Uint8Array | Buffer, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
929
929
  static importHDWallet(mnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType): StoredKey;
930
930
  static importHDWalletWithEncryption(mnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
931
+ static importTONWallet(tonMnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType): StoredKey;
932
+ static importTONWalletWithEncryption(tonMnemonic: string, name: string, password: Uint8Array | Buffer, coin: CoinType, encryption: StoredKeyEncryption): StoredKey;
931
933
  static importJSON(json: Uint8Array | Buffer): StoredKey;
932
934
  static createLevel(name: string, password: Uint8Array | Buffer, encryptionLevel: StoredKeyEncryptionLevel): StoredKey;
933
935
  static createLevelAndEncryption(name: string, password: Uint8Array | Buffer, encryptionLevel: StoredKeyEncryptionLevel, encryption: StoredKeyEncryption): StoredKey;
@@ -936,6 +938,7 @@ export class StoredKey {
936
938
  identifier(): string;
937
939
  name(): string;
938
940
  isMnemonic(): boolean;
941
+ isTONMnemonic(): boolean;
939
942
  accountCount(): number;
940
943
  encryptionParameters(): string;
941
944
  account(index: number): Account;
@@ -949,6 +952,7 @@ export class StoredKey {
949
952
  store(path: string): boolean;
950
953
  decryptPrivateKey(password: Uint8Array | Buffer): Uint8Array;
951
954
  decryptMnemonic(password: Uint8Array | Buffer): string;
955
+ decryptTONMnemonic(password: Uint8Array | Buffer): string;
952
956
  privateKey(coin: CoinType, password: Uint8Array | Buffer): PrivateKey;
953
957
  wallet(password: Uint8Array | Buffer): HDWallet;
954
958
  exportJSON(): Uint8Array;
@@ -982,7 +986,11 @@ export class TONMessageSigner {
982
986
  static signMessage(privateKey: PrivateKey, message: string): string;
983
987
  }
984
988
  export class TONWallet {
989
+ static isValidMnemonic(mnemonic: string, passphrase: string): boolean;
985
990
  static buildV4R2StateInit(publicKey: PublicKey, workchain: number, walletId: number): string;
991
+ static createWithMnemonic(mnemonic: string, passphrase: string): TONWallet;
992
+ getKey(): PrivateKey;
993
+ delete(): void;
986
994
  }
987
995
  export class TezosMessageSigner {
988
996
  static formatMessage(message: string, url: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/wallet-core",
3
- "version": "4.2.0-dev-rc1",
3
+ "version": "4.2.0-dev-rc2",
4
4
  "description": "wallet core wasm and protobuf models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",