@trustwallet/wallet-core 4.0.1 → 4.0.2

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.
@@ -67786,6 +67786,1014 @@
67786
67786
  return Icon;
67787
67787
  })();
67788
67788
 
67789
+ TW.InternetComputer = (function() {
67790
+
67791
+ /**
67792
+ * Namespace InternetComputer.
67793
+ * @memberof TW
67794
+ * @namespace
67795
+ */
67796
+ var InternetComputer = {};
67797
+
67798
+ InternetComputer.Proto = (function() {
67799
+
67800
+ /**
67801
+ * Namespace Proto.
67802
+ * @memberof TW.InternetComputer
67803
+ * @namespace
67804
+ */
67805
+ var Proto = {};
67806
+
67807
+ Proto.Transaction = (function() {
67808
+
67809
+ /**
67810
+ * Properties of a Transaction.
67811
+ * @memberof TW.InternetComputer.Proto
67812
+ * @interface ITransaction
67813
+ * @property {TW.InternetComputer.Proto.Transaction.ITransfer|null} [transfer] Transaction transfer
67814
+ */
67815
+
67816
+ /**
67817
+ * Constructs a new Transaction.
67818
+ * @memberof TW.InternetComputer.Proto
67819
+ * @classdesc Represents a Transaction.
67820
+ * @implements ITransaction
67821
+ * @constructor
67822
+ * @param {TW.InternetComputer.Proto.ITransaction=} [properties] Properties to set
67823
+ */
67824
+ function Transaction(properties) {
67825
+ if (properties)
67826
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
67827
+ if (properties[keys[i]] != null)
67828
+ this[keys[i]] = properties[keys[i]];
67829
+ }
67830
+
67831
+ /**
67832
+ * Transaction transfer.
67833
+ * @member {TW.InternetComputer.Proto.Transaction.ITransfer|null|undefined} transfer
67834
+ * @memberof TW.InternetComputer.Proto.Transaction
67835
+ * @instance
67836
+ */
67837
+ Transaction.prototype.transfer = null;
67838
+
67839
+ // OneOf field names bound to virtual getters and setters
67840
+ var $oneOfFields;
67841
+
67842
+ /**
67843
+ * Transaction transactionOneof.
67844
+ * @member {"transfer"|undefined} transactionOneof
67845
+ * @memberof TW.InternetComputer.Proto.Transaction
67846
+ * @instance
67847
+ */
67848
+ Object.defineProperty(Transaction.prototype, "transactionOneof", {
67849
+ get: $util.oneOfGetter($oneOfFields = ["transfer"]),
67850
+ set: $util.oneOfSetter($oneOfFields)
67851
+ });
67852
+
67853
+ /**
67854
+ * Creates a new Transaction instance using the specified properties.
67855
+ * @function create
67856
+ * @memberof TW.InternetComputer.Proto.Transaction
67857
+ * @static
67858
+ * @param {TW.InternetComputer.Proto.ITransaction=} [properties] Properties to set
67859
+ * @returns {TW.InternetComputer.Proto.Transaction} Transaction instance
67860
+ */
67861
+ Transaction.create = function create(properties) {
67862
+ return new Transaction(properties);
67863
+ };
67864
+
67865
+ /**
67866
+ * Encodes the specified Transaction message. Does not implicitly {@link TW.InternetComputer.Proto.Transaction.verify|verify} messages.
67867
+ * @function encode
67868
+ * @memberof TW.InternetComputer.Proto.Transaction
67869
+ * @static
67870
+ * @param {TW.InternetComputer.Proto.ITransaction} message Transaction message or plain object to encode
67871
+ * @param {$protobuf.Writer} [writer] Writer to encode to
67872
+ * @returns {$protobuf.Writer} Writer
67873
+ */
67874
+ Transaction.encode = function encode(message, writer) {
67875
+ if (!writer)
67876
+ writer = $Writer.create();
67877
+ if (message.transfer != null && Object.hasOwnProperty.call(message, "transfer"))
67878
+ $root.TW.InternetComputer.Proto.Transaction.Transfer.encode(message.transfer, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
67879
+ return writer;
67880
+ };
67881
+
67882
+ /**
67883
+ * Decodes a Transaction message from the specified reader or buffer.
67884
+ * @function decode
67885
+ * @memberof TW.InternetComputer.Proto.Transaction
67886
+ * @static
67887
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
67888
+ * @param {number} [length] Message length if known beforehand
67889
+ * @returns {TW.InternetComputer.Proto.Transaction} Transaction
67890
+ * @throws {Error} If the payload is not a reader or valid buffer
67891
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
67892
+ */
67893
+ Transaction.decode = function decode(reader, length) {
67894
+ if (!(reader instanceof $Reader))
67895
+ reader = $Reader.create(reader);
67896
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.InternetComputer.Proto.Transaction();
67897
+ while (reader.pos < end) {
67898
+ var tag = reader.uint32();
67899
+ switch (tag >>> 3) {
67900
+ case 1:
67901
+ message.transfer = $root.TW.InternetComputer.Proto.Transaction.Transfer.decode(reader, reader.uint32());
67902
+ break;
67903
+ default:
67904
+ reader.skipType(tag & 7);
67905
+ break;
67906
+ }
67907
+ }
67908
+ return message;
67909
+ };
67910
+
67911
+ /**
67912
+ * Verifies a Transaction message.
67913
+ * @function verify
67914
+ * @memberof TW.InternetComputer.Proto.Transaction
67915
+ * @static
67916
+ * @param {Object.<string,*>} message Plain object to verify
67917
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
67918
+ */
67919
+ Transaction.verify = function verify(message) {
67920
+ if (typeof message !== "object" || message === null)
67921
+ return "object expected";
67922
+ var properties = {};
67923
+ if (message.transfer != null && message.hasOwnProperty("transfer")) {
67924
+ properties.transactionOneof = 1;
67925
+ {
67926
+ var error = $root.TW.InternetComputer.Proto.Transaction.Transfer.verify(message.transfer);
67927
+ if (error)
67928
+ return "transfer." + error;
67929
+ }
67930
+ }
67931
+ return null;
67932
+ };
67933
+
67934
+ /**
67935
+ * Creates a Transaction message from a plain object. Also converts values to their respective internal types.
67936
+ * @function fromObject
67937
+ * @memberof TW.InternetComputer.Proto.Transaction
67938
+ * @static
67939
+ * @param {Object.<string,*>} object Plain object
67940
+ * @returns {TW.InternetComputer.Proto.Transaction} Transaction
67941
+ */
67942
+ Transaction.fromObject = function fromObject(object) {
67943
+ if (object instanceof $root.TW.InternetComputer.Proto.Transaction)
67944
+ return object;
67945
+ var message = new $root.TW.InternetComputer.Proto.Transaction();
67946
+ if (object.transfer != null) {
67947
+ if (typeof object.transfer !== "object")
67948
+ throw TypeError(".TW.InternetComputer.Proto.Transaction.transfer: object expected");
67949
+ message.transfer = $root.TW.InternetComputer.Proto.Transaction.Transfer.fromObject(object.transfer);
67950
+ }
67951
+ return message;
67952
+ };
67953
+
67954
+ /**
67955
+ * Creates a plain object from a Transaction message. Also converts values to other types if specified.
67956
+ * @function toObject
67957
+ * @memberof TW.InternetComputer.Proto.Transaction
67958
+ * @static
67959
+ * @param {TW.InternetComputer.Proto.Transaction} message Transaction
67960
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
67961
+ * @returns {Object.<string,*>} Plain object
67962
+ */
67963
+ Transaction.toObject = function toObject(message, options) {
67964
+ if (!options)
67965
+ options = {};
67966
+ var object = {};
67967
+ if (message.transfer != null && message.hasOwnProperty("transfer")) {
67968
+ object.transfer = $root.TW.InternetComputer.Proto.Transaction.Transfer.toObject(message.transfer, options);
67969
+ if (options.oneofs)
67970
+ object.transactionOneof = "transfer";
67971
+ }
67972
+ return object;
67973
+ };
67974
+
67975
+ /**
67976
+ * Converts this Transaction to JSON.
67977
+ * @function toJSON
67978
+ * @memberof TW.InternetComputer.Proto.Transaction
67979
+ * @instance
67980
+ * @returns {Object.<string,*>} JSON object
67981
+ */
67982
+ Transaction.prototype.toJSON = function toJSON() {
67983
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
67984
+ };
67985
+
67986
+ Transaction.Transfer = (function() {
67987
+
67988
+ /**
67989
+ * Properties of a Transfer.
67990
+ * @memberof TW.InternetComputer.Proto.Transaction
67991
+ * @interface ITransfer
67992
+ * @property {string|null} [toAccountIdentifier] Transfer toAccountIdentifier
67993
+ * @property {Long|null} [amount] Transfer amount
67994
+ * @property {Long|null} [memo] Transfer memo
67995
+ * @property {Long|null} [currentTimestampNanos] Transfer currentTimestampNanos
67996
+ */
67997
+
67998
+ /**
67999
+ * Constructs a new Transfer.
68000
+ * @memberof TW.InternetComputer.Proto.Transaction
68001
+ * @classdesc Represents a Transfer.
68002
+ * @implements ITransfer
68003
+ * @constructor
68004
+ * @param {TW.InternetComputer.Proto.Transaction.ITransfer=} [properties] Properties to set
68005
+ */
68006
+ function Transfer(properties) {
68007
+ if (properties)
68008
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
68009
+ if (properties[keys[i]] != null)
68010
+ this[keys[i]] = properties[keys[i]];
68011
+ }
68012
+
68013
+ /**
68014
+ * Transfer toAccountIdentifier.
68015
+ * @member {string} toAccountIdentifier
68016
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68017
+ * @instance
68018
+ */
68019
+ Transfer.prototype.toAccountIdentifier = "";
68020
+
68021
+ /**
68022
+ * Transfer amount.
68023
+ * @member {Long} amount
68024
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68025
+ * @instance
68026
+ */
68027
+ Transfer.prototype.amount = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
68028
+
68029
+ /**
68030
+ * Transfer memo.
68031
+ * @member {Long} memo
68032
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68033
+ * @instance
68034
+ */
68035
+ Transfer.prototype.memo = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
68036
+
68037
+ /**
68038
+ * Transfer currentTimestampNanos.
68039
+ * @member {Long} currentTimestampNanos
68040
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68041
+ * @instance
68042
+ */
68043
+ Transfer.prototype.currentTimestampNanos = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
68044
+
68045
+ /**
68046
+ * Creates a new Transfer instance using the specified properties.
68047
+ * @function create
68048
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68049
+ * @static
68050
+ * @param {TW.InternetComputer.Proto.Transaction.ITransfer=} [properties] Properties to set
68051
+ * @returns {TW.InternetComputer.Proto.Transaction.Transfer} Transfer instance
68052
+ */
68053
+ Transfer.create = function create(properties) {
68054
+ return new Transfer(properties);
68055
+ };
68056
+
68057
+ /**
68058
+ * Encodes the specified Transfer message. Does not implicitly {@link TW.InternetComputer.Proto.Transaction.Transfer.verify|verify} messages.
68059
+ * @function encode
68060
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68061
+ * @static
68062
+ * @param {TW.InternetComputer.Proto.Transaction.ITransfer} message Transfer message or plain object to encode
68063
+ * @param {$protobuf.Writer} [writer] Writer to encode to
68064
+ * @returns {$protobuf.Writer} Writer
68065
+ */
68066
+ Transfer.encode = function encode(message, writer) {
68067
+ if (!writer)
68068
+ writer = $Writer.create();
68069
+ if (message.toAccountIdentifier != null && Object.hasOwnProperty.call(message, "toAccountIdentifier"))
68070
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.toAccountIdentifier);
68071
+ if (message.amount != null && Object.hasOwnProperty.call(message, "amount"))
68072
+ writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.amount);
68073
+ if (message.memo != null && Object.hasOwnProperty.call(message, "memo"))
68074
+ writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.memo);
68075
+ if (message.currentTimestampNanos != null && Object.hasOwnProperty.call(message, "currentTimestampNanos"))
68076
+ writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.currentTimestampNanos);
68077
+ return writer;
68078
+ };
68079
+
68080
+ /**
68081
+ * Decodes a Transfer message from the specified reader or buffer.
68082
+ * @function decode
68083
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68084
+ * @static
68085
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
68086
+ * @param {number} [length] Message length if known beforehand
68087
+ * @returns {TW.InternetComputer.Proto.Transaction.Transfer} Transfer
68088
+ * @throws {Error} If the payload is not a reader or valid buffer
68089
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
68090
+ */
68091
+ Transfer.decode = function decode(reader, length) {
68092
+ if (!(reader instanceof $Reader))
68093
+ reader = $Reader.create(reader);
68094
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.InternetComputer.Proto.Transaction.Transfer();
68095
+ while (reader.pos < end) {
68096
+ var tag = reader.uint32();
68097
+ switch (tag >>> 3) {
68098
+ case 1:
68099
+ message.toAccountIdentifier = reader.string();
68100
+ break;
68101
+ case 2:
68102
+ message.amount = reader.uint64();
68103
+ break;
68104
+ case 3:
68105
+ message.memo = reader.uint64();
68106
+ break;
68107
+ case 4:
68108
+ message.currentTimestampNanos = reader.uint64();
68109
+ break;
68110
+ default:
68111
+ reader.skipType(tag & 7);
68112
+ break;
68113
+ }
68114
+ }
68115
+ return message;
68116
+ };
68117
+
68118
+ /**
68119
+ * Verifies a Transfer message.
68120
+ * @function verify
68121
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68122
+ * @static
68123
+ * @param {Object.<string,*>} message Plain object to verify
68124
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
68125
+ */
68126
+ Transfer.verify = function verify(message) {
68127
+ if (typeof message !== "object" || message === null)
68128
+ return "object expected";
68129
+ if (message.toAccountIdentifier != null && message.hasOwnProperty("toAccountIdentifier"))
68130
+ if (!$util.isString(message.toAccountIdentifier))
68131
+ return "toAccountIdentifier: string expected";
68132
+ if (message.amount != null && message.hasOwnProperty("amount"))
68133
+ if (!$util.isInteger(message.amount) && !(message.amount && $util.isInteger(message.amount.low) && $util.isInteger(message.amount.high)))
68134
+ return "amount: integer|Long expected";
68135
+ if (message.memo != null && message.hasOwnProperty("memo"))
68136
+ if (!$util.isInteger(message.memo) && !(message.memo && $util.isInteger(message.memo.low) && $util.isInteger(message.memo.high)))
68137
+ return "memo: integer|Long expected";
68138
+ if (message.currentTimestampNanos != null && message.hasOwnProperty("currentTimestampNanos"))
68139
+ if (!$util.isInteger(message.currentTimestampNanos) && !(message.currentTimestampNanos && $util.isInteger(message.currentTimestampNanos.low) && $util.isInteger(message.currentTimestampNanos.high)))
68140
+ return "currentTimestampNanos: integer|Long expected";
68141
+ return null;
68142
+ };
68143
+
68144
+ /**
68145
+ * Creates a Transfer message from a plain object. Also converts values to their respective internal types.
68146
+ * @function fromObject
68147
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68148
+ * @static
68149
+ * @param {Object.<string,*>} object Plain object
68150
+ * @returns {TW.InternetComputer.Proto.Transaction.Transfer} Transfer
68151
+ */
68152
+ Transfer.fromObject = function fromObject(object) {
68153
+ if (object instanceof $root.TW.InternetComputer.Proto.Transaction.Transfer)
68154
+ return object;
68155
+ var message = new $root.TW.InternetComputer.Proto.Transaction.Transfer();
68156
+ if (object.toAccountIdentifier != null)
68157
+ message.toAccountIdentifier = String(object.toAccountIdentifier);
68158
+ if (object.amount != null)
68159
+ if ($util.Long)
68160
+ (message.amount = $util.Long.fromValue(object.amount)).unsigned = true;
68161
+ else if (typeof object.amount === "string")
68162
+ message.amount = parseInt(object.amount, 10);
68163
+ else if (typeof object.amount === "number")
68164
+ message.amount = object.amount;
68165
+ else if (typeof object.amount === "object")
68166
+ message.amount = new $util.LongBits(object.amount.low >>> 0, object.amount.high >>> 0).toNumber(true);
68167
+ if (object.memo != null)
68168
+ if ($util.Long)
68169
+ (message.memo = $util.Long.fromValue(object.memo)).unsigned = true;
68170
+ else if (typeof object.memo === "string")
68171
+ message.memo = parseInt(object.memo, 10);
68172
+ else if (typeof object.memo === "number")
68173
+ message.memo = object.memo;
68174
+ else if (typeof object.memo === "object")
68175
+ message.memo = new $util.LongBits(object.memo.low >>> 0, object.memo.high >>> 0).toNumber(true);
68176
+ if (object.currentTimestampNanos != null)
68177
+ if ($util.Long)
68178
+ (message.currentTimestampNanos = $util.Long.fromValue(object.currentTimestampNanos)).unsigned = true;
68179
+ else if (typeof object.currentTimestampNanos === "string")
68180
+ message.currentTimestampNanos = parseInt(object.currentTimestampNanos, 10);
68181
+ else if (typeof object.currentTimestampNanos === "number")
68182
+ message.currentTimestampNanos = object.currentTimestampNanos;
68183
+ else if (typeof object.currentTimestampNanos === "object")
68184
+ message.currentTimestampNanos = new $util.LongBits(object.currentTimestampNanos.low >>> 0, object.currentTimestampNanos.high >>> 0).toNumber(true);
68185
+ return message;
68186
+ };
68187
+
68188
+ /**
68189
+ * Creates a plain object from a Transfer message. Also converts values to other types if specified.
68190
+ * @function toObject
68191
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68192
+ * @static
68193
+ * @param {TW.InternetComputer.Proto.Transaction.Transfer} message Transfer
68194
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
68195
+ * @returns {Object.<string,*>} Plain object
68196
+ */
68197
+ Transfer.toObject = function toObject(message, options) {
68198
+ if (!options)
68199
+ options = {};
68200
+ var object = {};
68201
+ if (options.defaults) {
68202
+ object.toAccountIdentifier = "";
68203
+ if ($util.Long) {
68204
+ var long = new $util.Long(0, 0, true);
68205
+ object.amount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
68206
+ } else
68207
+ object.amount = options.longs === String ? "0" : 0;
68208
+ if ($util.Long) {
68209
+ var long = new $util.Long(0, 0, true);
68210
+ object.memo = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
68211
+ } else
68212
+ object.memo = options.longs === String ? "0" : 0;
68213
+ if ($util.Long) {
68214
+ var long = new $util.Long(0, 0, true);
68215
+ object.currentTimestampNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
68216
+ } else
68217
+ object.currentTimestampNanos = options.longs === String ? "0" : 0;
68218
+ }
68219
+ if (message.toAccountIdentifier != null && message.hasOwnProperty("toAccountIdentifier"))
68220
+ object.toAccountIdentifier = message.toAccountIdentifier;
68221
+ if (message.amount != null && message.hasOwnProperty("amount"))
68222
+ if (typeof message.amount === "number")
68223
+ object.amount = options.longs === String ? String(message.amount) : message.amount;
68224
+ else
68225
+ object.amount = options.longs === String ? $util.Long.prototype.toString.call(message.amount) : options.longs === Number ? new $util.LongBits(message.amount.low >>> 0, message.amount.high >>> 0).toNumber(true) : message.amount;
68226
+ if (message.memo != null && message.hasOwnProperty("memo"))
68227
+ if (typeof message.memo === "number")
68228
+ object.memo = options.longs === String ? String(message.memo) : message.memo;
68229
+ else
68230
+ object.memo = options.longs === String ? $util.Long.prototype.toString.call(message.memo) : options.longs === Number ? new $util.LongBits(message.memo.low >>> 0, message.memo.high >>> 0).toNumber(true) : message.memo;
68231
+ if (message.currentTimestampNanos != null && message.hasOwnProperty("currentTimestampNanos"))
68232
+ if (typeof message.currentTimestampNanos === "number")
68233
+ object.currentTimestampNanos = options.longs === String ? String(message.currentTimestampNanos) : message.currentTimestampNanos;
68234
+ else
68235
+ object.currentTimestampNanos = options.longs === String ? $util.Long.prototype.toString.call(message.currentTimestampNanos) : options.longs === Number ? new $util.LongBits(message.currentTimestampNanos.low >>> 0, message.currentTimestampNanos.high >>> 0).toNumber(true) : message.currentTimestampNanos;
68236
+ return object;
68237
+ };
68238
+
68239
+ /**
68240
+ * Converts this Transfer to JSON.
68241
+ * @function toJSON
68242
+ * @memberof TW.InternetComputer.Proto.Transaction.Transfer
68243
+ * @instance
68244
+ * @returns {Object.<string,*>} JSON object
68245
+ */
68246
+ Transfer.prototype.toJSON = function toJSON() {
68247
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
68248
+ };
68249
+
68250
+ return Transfer;
68251
+ })();
68252
+
68253
+ return Transaction;
68254
+ })();
68255
+
68256
+ Proto.SigningInput = (function() {
68257
+
68258
+ /**
68259
+ * Properties of a SigningInput.
68260
+ * @memberof TW.InternetComputer.Proto
68261
+ * @interface ISigningInput
68262
+ * @property {Uint8Array|null} [privateKey] SigningInput privateKey
68263
+ * @property {TW.InternetComputer.Proto.ITransaction|null} [transaction] SigningInput transaction
68264
+ */
68265
+
68266
+ /**
68267
+ * Constructs a new SigningInput.
68268
+ * @memberof TW.InternetComputer.Proto
68269
+ * @classdesc Represents a SigningInput.
68270
+ * @implements ISigningInput
68271
+ * @constructor
68272
+ * @param {TW.InternetComputer.Proto.ISigningInput=} [properties] Properties to set
68273
+ */
68274
+ function SigningInput(properties) {
68275
+ if (properties)
68276
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
68277
+ if (properties[keys[i]] != null)
68278
+ this[keys[i]] = properties[keys[i]];
68279
+ }
68280
+
68281
+ /**
68282
+ * SigningInput privateKey.
68283
+ * @member {Uint8Array} privateKey
68284
+ * @memberof TW.InternetComputer.Proto.SigningInput
68285
+ * @instance
68286
+ */
68287
+ SigningInput.prototype.privateKey = $util.newBuffer([]);
68288
+
68289
+ /**
68290
+ * SigningInput transaction.
68291
+ * @member {TW.InternetComputer.Proto.ITransaction|null|undefined} transaction
68292
+ * @memberof TW.InternetComputer.Proto.SigningInput
68293
+ * @instance
68294
+ */
68295
+ SigningInput.prototype.transaction = null;
68296
+
68297
+ /**
68298
+ * Creates a new SigningInput instance using the specified properties.
68299
+ * @function create
68300
+ * @memberof TW.InternetComputer.Proto.SigningInput
68301
+ * @static
68302
+ * @param {TW.InternetComputer.Proto.ISigningInput=} [properties] Properties to set
68303
+ * @returns {TW.InternetComputer.Proto.SigningInput} SigningInput instance
68304
+ */
68305
+ SigningInput.create = function create(properties) {
68306
+ return new SigningInput(properties);
68307
+ };
68308
+
68309
+ /**
68310
+ * Encodes the specified SigningInput message. Does not implicitly {@link TW.InternetComputer.Proto.SigningInput.verify|verify} messages.
68311
+ * @function encode
68312
+ * @memberof TW.InternetComputer.Proto.SigningInput
68313
+ * @static
68314
+ * @param {TW.InternetComputer.Proto.ISigningInput} message SigningInput message or plain object to encode
68315
+ * @param {$protobuf.Writer} [writer] Writer to encode to
68316
+ * @returns {$protobuf.Writer} Writer
68317
+ */
68318
+ SigningInput.encode = function encode(message, writer) {
68319
+ if (!writer)
68320
+ writer = $Writer.create();
68321
+ if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey"))
68322
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.privateKey);
68323
+ if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction"))
68324
+ $root.TW.InternetComputer.Proto.Transaction.encode(message.transaction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
68325
+ return writer;
68326
+ };
68327
+
68328
+ /**
68329
+ * Decodes a SigningInput message from the specified reader or buffer.
68330
+ * @function decode
68331
+ * @memberof TW.InternetComputer.Proto.SigningInput
68332
+ * @static
68333
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
68334
+ * @param {number} [length] Message length if known beforehand
68335
+ * @returns {TW.InternetComputer.Proto.SigningInput} SigningInput
68336
+ * @throws {Error} If the payload is not a reader or valid buffer
68337
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
68338
+ */
68339
+ SigningInput.decode = function decode(reader, length) {
68340
+ if (!(reader instanceof $Reader))
68341
+ reader = $Reader.create(reader);
68342
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.InternetComputer.Proto.SigningInput();
68343
+ while (reader.pos < end) {
68344
+ var tag = reader.uint32();
68345
+ switch (tag >>> 3) {
68346
+ case 1:
68347
+ message.privateKey = reader.bytes();
68348
+ break;
68349
+ case 2:
68350
+ message.transaction = $root.TW.InternetComputer.Proto.Transaction.decode(reader, reader.uint32());
68351
+ break;
68352
+ default:
68353
+ reader.skipType(tag & 7);
68354
+ break;
68355
+ }
68356
+ }
68357
+ return message;
68358
+ };
68359
+
68360
+ /**
68361
+ * Verifies a SigningInput message.
68362
+ * @function verify
68363
+ * @memberof TW.InternetComputer.Proto.SigningInput
68364
+ * @static
68365
+ * @param {Object.<string,*>} message Plain object to verify
68366
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
68367
+ */
68368
+ SigningInput.verify = function verify(message) {
68369
+ if (typeof message !== "object" || message === null)
68370
+ return "object expected";
68371
+ if (message.privateKey != null && message.hasOwnProperty("privateKey"))
68372
+ if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey)))
68373
+ return "privateKey: buffer expected";
68374
+ if (message.transaction != null && message.hasOwnProperty("transaction")) {
68375
+ var error = $root.TW.InternetComputer.Proto.Transaction.verify(message.transaction);
68376
+ if (error)
68377
+ return "transaction." + error;
68378
+ }
68379
+ return null;
68380
+ };
68381
+
68382
+ /**
68383
+ * Creates a SigningInput message from a plain object. Also converts values to their respective internal types.
68384
+ * @function fromObject
68385
+ * @memberof TW.InternetComputer.Proto.SigningInput
68386
+ * @static
68387
+ * @param {Object.<string,*>} object Plain object
68388
+ * @returns {TW.InternetComputer.Proto.SigningInput} SigningInput
68389
+ */
68390
+ SigningInput.fromObject = function fromObject(object) {
68391
+ if (object instanceof $root.TW.InternetComputer.Proto.SigningInput)
68392
+ return object;
68393
+ var message = new $root.TW.InternetComputer.Proto.SigningInput();
68394
+ if (object.privateKey != null)
68395
+ if (typeof object.privateKey === "string")
68396
+ $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0);
68397
+ else if (object.privateKey.length)
68398
+ message.privateKey = object.privateKey;
68399
+ if (object.transaction != null) {
68400
+ if (typeof object.transaction !== "object")
68401
+ throw TypeError(".TW.InternetComputer.Proto.SigningInput.transaction: object expected");
68402
+ message.transaction = $root.TW.InternetComputer.Proto.Transaction.fromObject(object.transaction);
68403
+ }
68404
+ return message;
68405
+ };
68406
+
68407
+ /**
68408
+ * Creates a plain object from a SigningInput message. Also converts values to other types if specified.
68409
+ * @function toObject
68410
+ * @memberof TW.InternetComputer.Proto.SigningInput
68411
+ * @static
68412
+ * @param {TW.InternetComputer.Proto.SigningInput} message SigningInput
68413
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
68414
+ * @returns {Object.<string,*>} Plain object
68415
+ */
68416
+ SigningInput.toObject = function toObject(message, options) {
68417
+ if (!options)
68418
+ options = {};
68419
+ var object = {};
68420
+ if (options.defaults) {
68421
+ if (options.bytes === String)
68422
+ object.privateKey = "";
68423
+ else {
68424
+ object.privateKey = [];
68425
+ if (options.bytes !== Array)
68426
+ object.privateKey = $util.newBuffer(object.privateKey);
68427
+ }
68428
+ object.transaction = null;
68429
+ }
68430
+ if (message.privateKey != null && message.hasOwnProperty("privateKey"))
68431
+ object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey;
68432
+ if (message.transaction != null && message.hasOwnProperty("transaction"))
68433
+ object.transaction = $root.TW.InternetComputer.Proto.Transaction.toObject(message.transaction, options);
68434
+ return object;
68435
+ };
68436
+
68437
+ /**
68438
+ * Converts this SigningInput to JSON.
68439
+ * @function toJSON
68440
+ * @memberof TW.InternetComputer.Proto.SigningInput
68441
+ * @instance
68442
+ * @returns {Object.<string,*>} JSON object
68443
+ */
68444
+ SigningInput.prototype.toJSON = function toJSON() {
68445
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
68446
+ };
68447
+
68448
+ return SigningInput;
68449
+ })();
68450
+
68451
+ Proto.SigningOutput = (function() {
68452
+
68453
+ /**
68454
+ * Properties of a SigningOutput.
68455
+ * @memberof TW.InternetComputer.Proto
68456
+ * @interface ISigningOutput
68457
+ * @property {Uint8Array|null} [signedTransaction] SigningOutput signedTransaction
68458
+ * @property {TW.Common.Proto.SigningError|null} [error] SigningOutput error
68459
+ * @property {string|null} [errorMessage] SigningOutput errorMessage
68460
+ */
68461
+
68462
+ /**
68463
+ * Constructs a new SigningOutput.
68464
+ * @memberof TW.InternetComputer.Proto
68465
+ * @classdesc Represents a SigningOutput.
68466
+ * @implements ISigningOutput
68467
+ * @constructor
68468
+ * @param {TW.InternetComputer.Proto.ISigningOutput=} [properties] Properties to set
68469
+ */
68470
+ function SigningOutput(properties) {
68471
+ if (properties)
68472
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
68473
+ if (properties[keys[i]] != null)
68474
+ this[keys[i]] = properties[keys[i]];
68475
+ }
68476
+
68477
+ /**
68478
+ * SigningOutput signedTransaction.
68479
+ * @member {Uint8Array} signedTransaction
68480
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68481
+ * @instance
68482
+ */
68483
+ SigningOutput.prototype.signedTransaction = $util.newBuffer([]);
68484
+
68485
+ /**
68486
+ * SigningOutput error.
68487
+ * @member {TW.Common.Proto.SigningError} error
68488
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68489
+ * @instance
68490
+ */
68491
+ SigningOutput.prototype.error = 0;
68492
+
68493
+ /**
68494
+ * SigningOutput errorMessage.
68495
+ * @member {string} errorMessage
68496
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68497
+ * @instance
68498
+ */
68499
+ SigningOutput.prototype.errorMessage = "";
68500
+
68501
+ /**
68502
+ * Creates a new SigningOutput instance using the specified properties.
68503
+ * @function create
68504
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68505
+ * @static
68506
+ * @param {TW.InternetComputer.Proto.ISigningOutput=} [properties] Properties to set
68507
+ * @returns {TW.InternetComputer.Proto.SigningOutput} SigningOutput instance
68508
+ */
68509
+ SigningOutput.create = function create(properties) {
68510
+ return new SigningOutput(properties);
68511
+ };
68512
+
68513
+ /**
68514
+ * Encodes the specified SigningOutput message. Does not implicitly {@link TW.InternetComputer.Proto.SigningOutput.verify|verify} messages.
68515
+ * @function encode
68516
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68517
+ * @static
68518
+ * @param {TW.InternetComputer.Proto.ISigningOutput} message SigningOutput message or plain object to encode
68519
+ * @param {$protobuf.Writer} [writer] Writer to encode to
68520
+ * @returns {$protobuf.Writer} Writer
68521
+ */
68522
+ SigningOutput.encode = function encode(message, writer) {
68523
+ if (!writer)
68524
+ writer = $Writer.create();
68525
+ if (message.signedTransaction != null && Object.hasOwnProperty.call(message, "signedTransaction"))
68526
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signedTransaction);
68527
+ if (message.error != null && Object.hasOwnProperty.call(message, "error"))
68528
+ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.error);
68529
+ if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage"))
68530
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.errorMessage);
68531
+ return writer;
68532
+ };
68533
+
68534
+ /**
68535
+ * Decodes a SigningOutput message from the specified reader or buffer.
68536
+ * @function decode
68537
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68538
+ * @static
68539
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
68540
+ * @param {number} [length] Message length if known beforehand
68541
+ * @returns {TW.InternetComputer.Proto.SigningOutput} SigningOutput
68542
+ * @throws {Error} If the payload is not a reader or valid buffer
68543
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
68544
+ */
68545
+ SigningOutput.decode = function decode(reader, length) {
68546
+ if (!(reader instanceof $Reader))
68547
+ reader = $Reader.create(reader);
68548
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.TW.InternetComputer.Proto.SigningOutput();
68549
+ while (reader.pos < end) {
68550
+ var tag = reader.uint32();
68551
+ switch (tag >>> 3) {
68552
+ case 1:
68553
+ message.signedTransaction = reader.bytes();
68554
+ break;
68555
+ case 2:
68556
+ message.error = reader.int32();
68557
+ break;
68558
+ case 3:
68559
+ message.errorMessage = reader.string();
68560
+ break;
68561
+ default:
68562
+ reader.skipType(tag & 7);
68563
+ break;
68564
+ }
68565
+ }
68566
+ return message;
68567
+ };
68568
+
68569
+ /**
68570
+ * Verifies a SigningOutput message.
68571
+ * @function verify
68572
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68573
+ * @static
68574
+ * @param {Object.<string,*>} message Plain object to verify
68575
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
68576
+ */
68577
+ SigningOutput.verify = function verify(message) {
68578
+ if (typeof message !== "object" || message === null)
68579
+ return "object expected";
68580
+ if (message.signedTransaction != null && message.hasOwnProperty("signedTransaction"))
68581
+ if (!(message.signedTransaction && typeof message.signedTransaction.length === "number" || $util.isString(message.signedTransaction)))
68582
+ return "signedTransaction: buffer expected";
68583
+ if (message.error != null && message.hasOwnProperty("error"))
68584
+ switch (message.error) {
68585
+ default:
68586
+ return "error: enum value expected";
68587
+ case 0:
68588
+ case 1:
68589
+ case 2:
68590
+ case 3:
68591
+ case 4:
68592
+ case 5:
68593
+ case 15:
68594
+ case 16:
68595
+ case 17:
68596
+ case 18:
68597
+ case 6:
68598
+ case 7:
68599
+ case 8:
68600
+ case 9:
68601
+ case 10:
68602
+ case 11:
68603
+ case 12:
68604
+ case 13:
68605
+ case 14:
68606
+ case 19:
68607
+ case 20:
68608
+ case 21:
68609
+ case 22:
68610
+ case 23:
68611
+ case 24:
68612
+ break;
68613
+ }
68614
+ if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
68615
+ if (!$util.isString(message.errorMessage))
68616
+ return "errorMessage: string expected";
68617
+ return null;
68618
+ };
68619
+
68620
+ /**
68621
+ * Creates a SigningOutput message from a plain object. Also converts values to their respective internal types.
68622
+ * @function fromObject
68623
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68624
+ * @static
68625
+ * @param {Object.<string,*>} object Plain object
68626
+ * @returns {TW.InternetComputer.Proto.SigningOutput} SigningOutput
68627
+ */
68628
+ SigningOutput.fromObject = function fromObject(object) {
68629
+ if (object instanceof $root.TW.InternetComputer.Proto.SigningOutput)
68630
+ return object;
68631
+ var message = new $root.TW.InternetComputer.Proto.SigningOutput();
68632
+ if (object.signedTransaction != null)
68633
+ if (typeof object.signedTransaction === "string")
68634
+ $util.base64.decode(object.signedTransaction, message.signedTransaction = $util.newBuffer($util.base64.length(object.signedTransaction)), 0);
68635
+ else if (object.signedTransaction.length)
68636
+ message.signedTransaction = object.signedTransaction;
68637
+ switch (object.error) {
68638
+ case "OK":
68639
+ case 0:
68640
+ message.error = 0;
68641
+ break;
68642
+ case "Error_general":
68643
+ case 1:
68644
+ message.error = 1;
68645
+ break;
68646
+ case "Error_internal":
68647
+ case 2:
68648
+ message.error = 2;
68649
+ break;
68650
+ case "Error_low_balance":
68651
+ case 3:
68652
+ message.error = 3;
68653
+ break;
68654
+ case "Error_zero_amount_requested":
68655
+ case 4:
68656
+ message.error = 4;
68657
+ break;
68658
+ case "Error_missing_private_key":
68659
+ case 5:
68660
+ message.error = 5;
68661
+ break;
68662
+ case "Error_invalid_private_key":
68663
+ case 15:
68664
+ message.error = 15;
68665
+ break;
68666
+ case "Error_invalid_address":
68667
+ case 16:
68668
+ message.error = 16;
68669
+ break;
68670
+ case "Error_invalid_utxo":
68671
+ case 17:
68672
+ message.error = 17;
68673
+ break;
68674
+ case "Error_invalid_utxo_amount":
68675
+ case 18:
68676
+ message.error = 18;
68677
+ break;
68678
+ case "Error_wrong_fee":
68679
+ case 6:
68680
+ message.error = 6;
68681
+ break;
68682
+ case "Error_signing":
68683
+ case 7:
68684
+ message.error = 7;
68685
+ break;
68686
+ case "Error_tx_too_big":
68687
+ case 8:
68688
+ message.error = 8;
68689
+ break;
68690
+ case "Error_missing_input_utxos":
68691
+ case 9:
68692
+ message.error = 9;
68693
+ break;
68694
+ case "Error_not_enough_utxos":
68695
+ case 10:
68696
+ message.error = 10;
68697
+ break;
68698
+ case "Error_script_redeem":
68699
+ case 11:
68700
+ message.error = 11;
68701
+ break;
68702
+ case "Error_script_output":
68703
+ case 12:
68704
+ message.error = 12;
68705
+ break;
68706
+ case "Error_script_witness_program":
68707
+ case 13:
68708
+ message.error = 13;
68709
+ break;
68710
+ case "Error_invalid_memo":
68711
+ case 14:
68712
+ message.error = 14;
68713
+ break;
68714
+ case "Error_input_parse":
68715
+ case 19:
68716
+ message.error = 19;
68717
+ break;
68718
+ case "Error_no_support_n2n":
68719
+ case 20:
68720
+ message.error = 20;
68721
+ break;
68722
+ case "Error_signatures_count":
68723
+ case 21:
68724
+ message.error = 21;
68725
+ break;
68726
+ case "Error_invalid_params":
68727
+ case 22:
68728
+ message.error = 22;
68729
+ break;
68730
+ case "Error_invalid_requested_token_amount":
68731
+ case 23:
68732
+ message.error = 23;
68733
+ break;
68734
+ case "Error_not_supported":
68735
+ case 24:
68736
+ message.error = 24;
68737
+ break;
68738
+ }
68739
+ if (object.errorMessage != null)
68740
+ message.errorMessage = String(object.errorMessage);
68741
+ return message;
68742
+ };
68743
+
68744
+ /**
68745
+ * Creates a plain object from a SigningOutput message. Also converts values to other types if specified.
68746
+ * @function toObject
68747
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68748
+ * @static
68749
+ * @param {TW.InternetComputer.Proto.SigningOutput} message SigningOutput
68750
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
68751
+ * @returns {Object.<string,*>} Plain object
68752
+ */
68753
+ SigningOutput.toObject = function toObject(message, options) {
68754
+ if (!options)
68755
+ options = {};
68756
+ var object = {};
68757
+ if (options.defaults) {
68758
+ if (options.bytes === String)
68759
+ object.signedTransaction = "";
68760
+ else {
68761
+ object.signedTransaction = [];
68762
+ if (options.bytes !== Array)
68763
+ object.signedTransaction = $util.newBuffer(object.signedTransaction);
68764
+ }
68765
+ object.error = options.enums === String ? "OK" : 0;
68766
+ object.errorMessage = "";
68767
+ }
68768
+ if (message.signedTransaction != null && message.hasOwnProperty("signedTransaction"))
68769
+ object.signedTransaction = options.bytes === String ? $util.base64.encode(message.signedTransaction, 0, message.signedTransaction.length) : options.bytes === Array ? Array.prototype.slice.call(message.signedTransaction) : message.signedTransaction;
68770
+ if (message.error != null && message.hasOwnProperty("error"))
68771
+ object.error = options.enums === String ? $root.TW.Common.Proto.SigningError[message.error] : message.error;
68772
+ if (message.errorMessage != null && message.hasOwnProperty("errorMessage"))
68773
+ object.errorMessage = message.errorMessage;
68774
+ return object;
68775
+ };
68776
+
68777
+ /**
68778
+ * Converts this SigningOutput to JSON.
68779
+ * @function toJSON
68780
+ * @memberof TW.InternetComputer.Proto.SigningOutput
68781
+ * @instance
68782
+ * @returns {Object.<string,*>} JSON object
68783
+ */
68784
+ SigningOutput.prototype.toJSON = function toJSON() {
68785
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
68786
+ };
68787
+
68788
+ return SigningOutput;
68789
+ })();
68790
+
68791
+ return Proto;
68792
+ })();
68793
+
68794
+ return InternetComputer;
68795
+ })();
68796
+
67789
68797
  TW.IOST = (function() {
67790
68798
 
67791
68799
  /**