@bitgo-beta/sdk-coin-trx 1.2.3-alpha.319 → 1.2.3-alpha.320

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.
Files changed (35) hide show
  1. package/dist/resources/protobuf/Contract.proto +16 -0
  2. package/dist/resources/protobuf/tron.d.ts +252 -0
  3. package/dist/resources/protobuf/tron.js +774 -0
  4. package/dist/resources/protobuf/tron.proto +2 -0
  5. package/dist/src/lib/constants.d.ts +2 -0
  6. package/dist/src/lib/constants.d.ts.map +1 -0
  7. package/dist/src/lib/constants.js +5 -0
  8. package/dist/src/lib/delegateResourceTxBuilder.d.ts +27 -0
  9. package/dist/src/lib/delegateResourceTxBuilder.d.ts.map +1 -0
  10. package/dist/src/lib/delegateResourceTxBuilder.js +98 -0
  11. package/dist/src/lib/enum.d.ts +9 -1
  12. package/dist/src/lib/enum.d.ts.map +1 -1
  13. package/dist/src/lib/enum.js +9 -1
  14. package/dist/src/lib/iface.d.ts +46 -1
  15. package/dist/src/lib/iface.d.ts.map +1 -1
  16. package/dist/src/lib/iface.js +1 -1
  17. package/dist/src/lib/resourceManagementTxBuilder.d.ts +72 -0
  18. package/dist/src/lib/resourceManagementTxBuilder.d.ts.map +1 -0
  19. package/dist/src/lib/resourceManagementTxBuilder.js +150 -0
  20. package/dist/src/lib/transaction.d.ts.map +1 -1
  21. package/dist/src/lib/transaction.js +13 -1
  22. package/dist/src/lib/utils.d.ts +8 -1
  23. package/dist/src/lib/utils.d.ts.map +1 -1
  24. package/dist/src/lib/utils.js +49 -1
  25. package/dist/src/lib/wrappedBuilder.d.ts +8 -0
  26. package/dist/src/lib/wrappedBuilder.d.ts.map +1 -1
  27. package/dist/src/lib/wrappedBuilder.js +13 -1
  28. package/dist/src/trx.d.ts +3 -1
  29. package/dist/src/trx.d.ts.map +1 -1
  30. package/dist/src/trx.js +5 -1
  31. package/package.json +6 -6
  32. package/resources/protobuf/Contract.proto +16 -0
  33. package/resources/protobuf/tron.d.ts +252 -0
  34. package/resources/protobuf/tron.js +774 -0
  35. package/resources/protobuf/tron.proto +2 -0
@@ -13393,6 +13393,766 @@ $root.protocol = (function () {
13393
13393
  return AccountPermissionUpdateContract;
13394
13394
  })();
13395
13395
 
13396
+ protocol.DelegateResourceContract = (function () {
13397
+ /**
13398
+ * Properties of a DelegateResourceContract.
13399
+ * @memberof protocol
13400
+ * @interface IDelegateResourceContract
13401
+ * @property {Uint8Array|null} [ownerAddress] DelegateResourceContract ownerAddress
13402
+ * @property {protocol.ResourceCode|null} [resource] DelegateResourceContract resource
13403
+ * @property {number|Long|null} [balance] DelegateResourceContract balance
13404
+ * @property {Uint8Array|null} [receiverAddress] DelegateResourceContract receiverAddress
13405
+ * @property {boolean|null} [lock] DelegateResourceContract lock
13406
+ * @property {number|Long|null} [lockPeriod] DelegateResourceContract lockPeriod
13407
+ */
13408
+
13409
+ /**
13410
+ * Constructs a new DelegateResourceContract.
13411
+ * @memberof protocol
13412
+ * @classdesc Represents a DelegateResourceContract.
13413
+ * @implements IDelegateResourceContract
13414
+ * @constructor
13415
+ * @param {protocol.IDelegateResourceContract=} [properties] Properties to set
13416
+ */
13417
+ function DelegateResourceContract(properties) {
13418
+ if (properties)
13419
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
13420
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
13421
+ }
13422
+
13423
+ /**
13424
+ * DelegateResourceContract ownerAddress.
13425
+ * @member {Uint8Array} ownerAddress
13426
+ * @memberof protocol.DelegateResourceContract
13427
+ * @instance
13428
+ */
13429
+ DelegateResourceContract.prototype.ownerAddress = $util.newBuffer([]);
13430
+
13431
+ /**
13432
+ * DelegateResourceContract resource.
13433
+ * @member {protocol.ResourceCode} resource
13434
+ * @memberof protocol.DelegateResourceContract
13435
+ * @instance
13436
+ */
13437
+ DelegateResourceContract.prototype.resource = 0;
13438
+
13439
+ /**
13440
+ * DelegateResourceContract balance.
13441
+ * @member {number|Long} balance
13442
+ * @memberof protocol.DelegateResourceContract
13443
+ * @instance
13444
+ */
13445
+ DelegateResourceContract.prototype.balance = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13446
+
13447
+ /**
13448
+ * DelegateResourceContract receiverAddress.
13449
+ * @member {Uint8Array} receiverAddress
13450
+ * @memberof protocol.DelegateResourceContract
13451
+ * @instance
13452
+ */
13453
+ DelegateResourceContract.prototype.receiverAddress = $util.newBuffer([]);
13454
+
13455
+ /**
13456
+ * DelegateResourceContract lock.
13457
+ * @member {boolean} lock
13458
+ * @memberof protocol.DelegateResourceContract
13459
+ * @instance
13460
+ */
13461
+ DelegateResourceContract.prototype.lock = false;
13462
+
13463
+ /**
13464
+ * DelegateResourceContract lockPeriod.
13465
+ * @member {number|Long} lockPeriod
13466
+ * @memberof protocol.DelegateResourceContract
13467
+ * @instance
13468
+ */
13469
+ DelegateResourceContract.prototype.lockPeriod = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13470
+
13471
+ /**
13472
+ * Creates a new DelegateResourceContract instance using the specified properties.
13473
+ * @function create
13474
+ * @memberof protocol.DelegateResourceContract
13475
+ * @static
13476
+ * @param {protocol.IDelegateResourceContract=} [properties] Properties to set
13477
+ * @returns {protocol.DelegateResourceContract} DelegateResourceContract instance
13478
+ */
13479
+ DelegateResourceContract.create = function create(properties) {
13480
+ return new DelegateResourceContract(properties);
13481
+ };
13482
+
13483
+ /**
13484
+ * Encodes the specified DelegateResourceContract message. Does not implicitly {@link protocol.DelegateResourceContract.verify|verify} messages.
13485
+ * @function encode
13486
+ * @memberof protocol.DelegateResourceContract
13487
+ * @static
13488
+ * @param {protocol.IDelegateResourceContract} message DelegateResourceContract message or plain object to encode
13489
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13490
+ * @returns {$protobuf.Writer} Writer
13491
+ */
13492
+ DelegateResourceContract.encode = function encode(message, writer) {
13493
+ if (!writer) writer = $Writer.create();
13494
+ if (message.ownerAddress != null && Object.hasOwnProperty.call(message, 'ownerAddress'))
13495
+ writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.ownerAddress);
13496
+ if (message.resource != null && Object.hasOwnProperty.call(message, 'resource'))
13497
+ writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.resource);
13498
+ if (message.balance != null && Object.hasOwnProperty.call(message, 'balance'))
13499
+ writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.balance);
13500
+ if (message.receiverAddress != null && Object.hasOwnProperty.call(message, 'receiverAddress'))
13501
+ writer.uint32(/* id 4, wireType 2 =*/ 34).bytes(message.receiverAddress);
13502
+ if (message.lock != null && Object.hasOwnProperty.call(message, 'lock'))
13503
+ writer.uint32(/* id 5, wireType 0 =*/ 40).bool(message.lock);
13504
+ if (message.lockPeriod != null && Object.hasOwnProperty.call(message, 'lockPeriod'))
13505
+ writer.uint32(/* id 6, wireType 0 =*/ 48).int64(message.lockPeriod);
13506
+ return writer;
13507
+ };
13508
+
13509
+ /**
13510
+ * Encodes the specified DelegateResourceContract message, length delimited. Does not implicitly {@link protocol.DelegateResourceContract.verify|verify} messages.
13511
+ * @function encodeDelimited
13512
+ * @memberof protocol.DelegateResourceContract
13513
+ * @static
13514
+ * @param {protocol.IDelegateResourceContract} message DelegateResourceContract message or plain object to encode
13515
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13516
+ * @returns {$protobuf.Writer} Writer
13517
+ */
13518
+ DelegateResourceContract.encodeDelimited = function encodeDelimited(message, writer) {
13519
+ return this.encode(message, writer).ldelim();
13520
+ };
13521
+
13522
+ /**
13523
+ * Decodes a DelegateResourceContract message from the specified reader or buffer.
13524
+ * @function decode
13525
+ * @memberof protocol.DelegateResourceContract
13526
+ * @static
13527
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
13528
+ * @param {number} [length] Message length if known beforehand
13529
+ * @returns {protocol.DelegateResourceContract} DelegateResourceContract
13530
+ * @throws {Error} If the payload is not a reader or valid buffer
13531
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
13532
+ */
13533
+ DelegateResourceContract.decode = function decode(reader, length) {
13534
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
13535
+ var end = length === undefined ? reader.len : reader.pos + length,
13536
+ message = new $root.protocol.DelegateResourceContract();
13537
+ while (reader.pos < end) {
13538
+ var tag = reader.uint32();
13539
+ switch (tag >>> 3) {
13540
+ case 1: {
13541
+ message.ownerAddress = reader.bytes();
13542
+ break;
13543
+ }
13544
+ case 2: {
13545
+ message.resource = reader.int32();
13546
+ break;
13547
+ }
13548
+ case 3: {
13549
+ message.balance = reader.int64();
13550
+ break;
13551
+ }
13552
+ case 4: {
13553
+ message.receiverAddress = reader.bytes();
13554
+ break;
13555
+ }
13556
+ case 5: {
13557
+ message.lock = reader.bool();
13558
+ break;
13559
+ }
13560
+ case 6: {
13561
+ message.lockPeriod = reader.int64();
13562
+ break;
13563
+ }
13564
+ default:
13565
+ reader.skipType(tag & 7);
13566
+ break;
13567
+ }
13568
+ }
13569
+ return message;
13570
+ };
13571
+
13572
+ /**
13573
+ * Decodes a DelegateResourceContract message from the specified reader or buffer, length delimited.
13574
+ * @function decodeDelimited
13575
+ * @memberof protocol.DelegateResourceContract
13576
+ * @static
13577
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
13578
+ * @returns {protocol.DelegateResourceContract} DelegateResourceContract
13579
+ * @throws {Error} If the payload is not a reader or valid buffer
13580
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
13581
+ */
13582
+ DelegateResourceContract.decodeDelimited = function decodeDelimited(reader) {
13583
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
13584
+ return this.decode(reader, reader.uint32());
13585
+ };
13586
+
13587
+ /**
13588
+ * Verifies a DelegateResourceContract message.
13589
+ * @function verify
13590
+ * @memberof protocol.DelegateResourceContract
13591
+ * @static
13592
+ * @param {Object.<string,*>} message Plain object to verify
13593
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
13594
+ */
13595
+ DelegateResourceContract.verify = function verify(message) {
13596
+ if (typeof message !== 'object' || message === null) return 'object expected';
13597
+ if (message.ownerAddress != null && message.hasOwnProperty('ownerAddress'))
13598
+ if (
13599
+ !(
13600
+ (message.ownerAddress && typeof message.ownerAddress.length === 'number') ||
13601
+ $util.isString(message.ownerAddress)
13602
+ )
13603
+ )
13604
+ return 'ownerAddress: buffer expected';
13605
+ if (message.resource != null && message.hasOwnProperty('resource'))
13606
+ switch (message.resource) {
13607
+ default:
13608
+ return 'resource: enum value expected';
13609
+ case 0:
13610
+ case 1:
13611
+ break;
13612
+ }
13613
+ if (message.balance != null && message.hasOwnProperty('balance'))
13614
+ if (
13615
+ !$util.isInteger(message.balance) &&
13616
+ !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))
13617
+ )
13618
+ return 'balance: integer|Long expected';
13619
+ if (message.receiverAddress != null && message.hasOwnProperty('receiverAddress'))
13620
+ if (
13621
+ !(
13622
+ (message.receiverAddress && typeof message.receiverAddress.length === 'number') ||
13623
+ $util.isString(message.receiverAddress)
13624
+ )
13625
+ )
13626
+ return 'receiverAddress: buffer expected';
13627
+ if (message.lock != null && message.hasOwnProperty('lock'))
13628
+ if (typeof message.lock !== 'boolean') return 'lock: boolean expected';
13629
+ if (message.lockPeriod != null && message.hasOwnProperty('lockPeriod'))
13630
+ if (
13631
+ !$util.isInteger(message.lockPeriod) &&
13632
+ !(message.lockPeriod && $util.isInteger(message.lockPeriod.low) && $util.isInteger(message.lockPeriod.high))
13633
+ )
13634
+ return 'lockPeriod: integer|Long expected';
13635
+ return null;
13636
+ };
13637
+
13638
+ /**
13639
+ * Creates a DelegateResourceContract message from a plain object. Also converts values to their respective internal types.
13640
+ * @function fromObject
13641
+ * @memberof protocol.DelegateResourceContract
13642
+ * @static
13643
+ * @param {Object.<string,*>} object Plain object
13644
+ * @returns {protocol.DelegateResourceContract} DelegateResourceContract
13645
+ */
13646
+ DelegateResourceContract.fromObject = function fromObject(object) {
13647
+ if (object instanceof $root.protocol.DelegateResourceContract) return object;
13648
+ var message = new $root.protocol.DelegateResourceContract();
13649
+ if (object.ownerAddress != null)
13650
+ if (typeof object.ownerAddress === 'string')
13651
+ $util.base64.decode(
13652
+ object.ownerAddress,
13653
+ (message.ownerAddress = $util.newBuffer($util.base64.length(object.ownerAddress))),
13654
+ 0
13655
+ );
13656
+ else if (object.ownerAddress.length >= 0) message.ownerAddress = object.ownerAddress;
13657
+ switch (object.resource) {
13658
+ default:
13659
+ if (typeof object.resource === 'number') {
13660
+ message.resource = object.resource;
13661
+ break;
13662
+ }
13663
+ break;
13664
+ case 'BANDWIDTH':
13665
+ case 0:
13666
+ message.resource = 0;
13667
+ break;
13668
+ case 'ENERGY':
13669
+ case 1:
13670
+ message.resource = 1;
13671
+ break;
13672
+ }
13673
+ if (object.balance != null)
13674
+ if ($util.Long) (message.balance = $util.Long.fromValue(object.balance)).unsigned = false;
13675
+ else if (typeof object.balance === 'string') message.balance = parseInt(object.balance, 10);
13676
+ else if (typeof object.balance === 'number') message.balance = object.balance;
13677
+ else if (typeof object.balance === 'object')
13678
+ message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber();
13679
+ if (object.receiverAddress != null)
13680
+ if (typeof object.receiverAddress === 'string')
13681
+ $util.base64.decode(
13682
+ object.receiverAddress,
13683
+ (message.receiverAddress = $util.newBuffer($util.base64.length(object.receiverAddress))),
13684
+ 0
13685
+ );
13686
+ else if (object.receiverAddress.length >= 0) message.receiverAddress = object.receiverAddress;
13687
+ if (object.lock != null) message.lock = Boolean(object.lock);
13688
+ if (object.lockPeriod != null)
13689
+ if ($util.Long) (message.lockPeriod = $util.Long.fromValue(object.lockPeriod)).unsigned = false;
13690
+ else if (typeof object.lockPeriod === 'string') message.lockPeriod = parseInt(object.lockPeriod, 10);
13691
+ else if (typeof object.lockPeriod === 'number') message.lockPeriod = object.lockPeriod;
13692
+ else if (typeof object.lockPeriod === 'object')
13693
+ message.lockPeriod = new $util.LongBits(object.lockPeriod.low >>> 0, object.lockPeriod.high >>> 0).toNumber();
13694
+ return message;
13695
+ };
13696
+
13697
+ /**
13698
+ * Creates a plain object from a DelegateResourceContract message. Also converts values to other types if specified.
13699
+ * @function toObject
13700
+ * @memberof protocol.DelegateResourceContract
13701
+ * @static
13702
+ * @param {protocol.DelegateResourceContract} message DelegateResourceContract
13703
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
13704
+ * @returns {Object.<string,*>} Plain object
13705
+ */
13706
+ DelegateResourceContract.toObject = function toObject(message, options) {
13707
+ if (!options) options = {};
13708
+ var object = {};
13709
+ if (options.defaults) {
13710
+ if (options.bytes === String) object.ownerAddress = '';
13711
+ else {
13712
+ object.ownerAddress = [];
13713
+ if (options.bytes !== Array) object.ownerAddress = $util.newBuffer(object.ownerAddress);
13714
+ }
13715
+ object.resource = options.enums === String ? 'BANDWIDTH' : 0;
13716
+ if ($util.Long) {
13717
+ var long = new $util.Long(0, 0, false);
13718
+ object.balance =
13719
+ options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13720
+ } else object.balance = options.longs === String ? '0' : 0;
13721
+ if (options.bytes === String) object.receiverAddress = '';
13722
+ else {
13723
+ object.receiverAddress = [];
13724
+ if (options.bytes !== Array) object.receiverAddress = $util.newBuffer(object.receiverAddress);
13725
+ }
13726
+ object.lock = false;
13727
+ if ($util.Long) {
13728
+ var long = new $util.Long(0, 0, false);
13729
+ object.lockPeriod =
13730
+ options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13731
+ } else object.lockPeriod = options.longs === String ? '0' : 0;
13732
+ }
13733
+ if (message.ownerAddress != null && message.hasOwnProperty('ownerAddress'))
13734
+ object.ownerAddress =
13735
+ options.bytes === String
13736
+ ? $util.base64.encode(message.ownerAddress, 0, message.ownerAddress.length)
13737
+ : options.bytes === Array
13738
+ ? Array.prototype.slice.call(message.ownerAddress)
13739
+ : message.ownerAddress;
13740
+ if (message.resource != null && message.hasOwnProperty('resource'))
13741
+ object.resource =
13742
+ options.enums === String
13743
+ ? $root.protocol.ResourceCode[message.resource] === undefined
13744
+ ? message.resource
13745
+ : $root.protocol.ResourceCode[message.resource]
13746
+ : message.resource;
13747
+ if (message.balance != null && message.hasOwnProperty('balance'))
13748
+ if (typeof message.balance === 'number')
13749
+ object.balance = options.longs === String ? String(message.balance) : message.balance;
13750
+ else
13751
+ object.balance =
13752
+ options.longs === String
13753
+ ? $util.Long.prototype.toString.call(message.balance)
13754
+ : options.longs === Number
13755
+ ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber()
13756
+ : message.balance;
13757
+ if (message.receiverAddress != null && message.hasOwnProperty('receiverAddress'))
13758
+ object.receiverAddress =
13759
+ options.bytes === String
13760
+ ? $util.base64.encode(message.receiverAddress, 0, message.receiverAddress.length)
13761
+ : options.bytes === Array
13762
+ ? Array.prototype.slice.call(message.receiverAddress)
13763
+ : message.receiverAddress;
13764
+ if (message.lock != null && message.hasOwnProperty('lock')) object.lock = message.lock;
13765
+ if (message.lockPeriod != null && message.hasOwnProperty('lockPeriod'))
13766
+ if (typeof message.lockPeriod === 'number')
13767
+ object.lockPeriod = options.longs === String ? String(message.lockPeriod) : message.lockPeriod;
13768
+ else
13769
+ object.lockPeriod =
13770
+ options.longs === String
13771
+ ? $util.Long.prototype.toString.call(message.lockPeriod)
13772
+ : options.longs === Number
13773
+ ? new $util.LongBits(message.lockPeriod.low >>> 0, message.lockPeriod.high >>> 0).toNumber()
13774
+ : message.lockPeriod;
13775
+ return object;
13776
+ };
13777
+
13778
+ /**
13779
+ * Converts this DelegateResourceContract to JSON.
13780
+ * @function toJSON
13781
+ * @memberof protocol.DelegateResourceContract
13782
+ * @instance
13783
+ * @returns {Object.<string,*>} JSON object
13784
+ */
13785
+ DelegateResourceContract.prototype.toJSON = function toJSON() {
13786
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
13787
+ };
13788
+
13789
+ /**
13790
+ * Gets the default type url for DelegateResourceContract
13791
+ * @function getTypeUrl
13792
+ * @memberof protocol.DelegateResourceContract
13793
+ * @static
13794
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
13795
+ * @returns {string} The default type url
13796
+ */
13797
+ DelegateResourceContract.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
13798
+ if (typeUrlPrefix === undefined) {
13799
+ typeUrlPrefix = 'type.googleapis.com';
13800
+ }
13801
+ return typeUrlPrefix + '/protocol.DelegateResourceContract';
13802
+ };
13803
+
13804
+ return DelegateResourceContract;
13805
+ })();
13806
+
13807
+ protocol.UnDelegateResourceContract = (function () {
13808
+ /**
13809
+ * Properties of an UnDelegateResourceContract.
13810
+ * @memberof protocol
13811
+ * @interface IUnDelegateResourceContract
13812
+ * @property {Uint8Array|null} [ownerAddress] UnDelegateResourceContract ownerAddress
13813
+ * @property {protocol.ResourceCode|null} [resource] UnDelegateResourceContract resource
13814
+ * @property {number|Long|null} [balance] UnDelegateResourceContract balance
13815
+ * @property {Uint8Array|null} [receiverAddress] UnDelegateResourceContract receiverAddress
13816
+ */
13817
+
13818
+ /**
13819
+ * Constructs a new UnDelegateResourceContract.
13820
+ * @memberof protocol
13821
+ * @classdesc Represents an UnDelegateResourceContract.
13822
+ * @implements IUnDelegateResourceContract
13823
+ * @constructor
13824
+ * @param {protocol.IUnDelegateResourceContract=} [properties] Properties to set
13825
+ */
13826
+ function UnDelegateResourceContract(properties) {
13827
+ if (properties)
13828
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
13829
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
13830
+ }
13831
+
13832
+ /**
13833
+ * UnDelegateResourceContract ownerAddress.
13834
+ * @member {Uint8Array} ownerAddress
13835
+ * @memberof protocol.UnDelegateResourceContract
13836
+ * @instance
13837
+ */
13838
+ UnDelegateResourceContract.prototype.ownerAddress = $util.newBuffer([]);
13839
+
13840
+ /**
13841
+ * UnDelegateResourceContract resource.
13842
+ * @member {protocol.ResourceCode} resource
13843
+ * @memberof protocol.UnDelegateResourceContract
13844
+ * @instance
13845
+ */
13846
+ UnDelegateResourceContract.prototype.resource = 0;
13847
+
13848
+ /**
13849
+ * UnDelegateResourceContract balance.
13850
+ * @member {number|Long} balance
13851
+ * @memberof protocol.UnDelegateResourceContract
13852
+ * @instance
13853
+ */
13854
+ UnDelegateResourceContract.prototype.balance = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13855
+
13856
+ /**
13857
+ * UnDelegateResourceContract receiverAddress.
13858
+ * @member {Uint8Array} receiverAddress
13859
+ * @memberof protocol.UnDelegateResourceContract
13860
+ * @instance
13861
+ */
13862
+ UnDelegateResourceContract.prototype.receiverAddress = $util.newBuffer([]);
13863
+
13864
+ /**
13865
+ * Creates a new UnDelegateResourceContract instance using the specified properties.
13866
+ * @function create
13867
+ * @memberof protocol.UnDelegateResourceContract
13868
+ * @static
13869
+ * @param {protocol.IUnDelegateResourceContract=} [properties] Properties to set
13870
+ * @returns {protocol.UnDelegateResourceContract} UnDelegateResourceContract instance
13871
+ */
13872
+ UnDelegateResourceContract.create = function create(properties) {
13873
+ return new UnDelegateResourceContract(properties);
13874
+ };
13875
+
13876
+ /**
13877
+ * Encodes the specified UnDelegateResourceContract message. Does not implicitly {@link protocol.UnDelegateResourceContract.verify|verify} messages.
13878
+ * @function encode
13879
+ * @memberof protocol.UnDelegateResourceContract
13880
+ * @static
13881
+ * @param {protocol.IUnDelegateResourceContract} message UnDelegateResourceContract message or plain object to encode
13882
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13883
+ * @returns {$protobuf.Writer} Writer
13884
+ */
13885
+ UnDelegateResourceContract.encode = function encode(message, writer) {
13886
+ if (!writer) writer = $Writer.create();
13887
+ if (message.ownerAddress != null && Object.hasOwnProperty.call(message, 'ownerAddress'))
13888
+ writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.ownerAddress);
13889
+ if (message.resource != null && Object.hasOwnProperty.call(message, 'resource'))
13890
+ writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.resource);
13891
+ if (message.balance != null && Object.hasOwnProperty.call(message, 'balance'))
13892
+ writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.balance);
13893
+ if (message.receiverAddress != null && Object.hasOwnProperty.call(message, 'receiverAddress'))
13894
+ writer.uint32(/* id 4, wireType 2 =*/ 34).bytes(message.receiverAddress);
13895
+ return writer;
13896
+ };
13897
+
13898
+ /**
13899
+ * Encodes the specified UnDelegateResourceContract message, length delimited. Does not implicitly {@link protocol.UnDelegateResourceContract.verify|verify} messages.
13900
+ * @function encodeDelimited
13901
+ * @memberof protocol.UnDelegateResourceContract
13902
+ * @static
13903
+ * @param {protocol.IUnDelegateResourceContract} message UnDelegateResourceContract message or plain object to encode
13904
+ * @param {$protobuf.Writer} [writer] Writer to encode to
13905
+ * @returns {$protobuf.Writer} Writer
13906
+ */
13907
+ UnDelegateResourceContract.encodeDelimited = function encodeDelimited(message, writer) {
13908
+ return this.encode(message, writer).ldelim();
13909
+ };
13910
+
13911
+ /**
13912
+ * Decodes an UnDelegateResourceContract message from the specified reader or buffer.
13913
+ * @function decode
13914
+ * @memberof protocol.UnDelegateResourceContract
13915
+ * @static
13916
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
13917
+ * @param {number} [length] Message length if known beforehand
13918
+ * @returns {protocol.UnDelegateResourceContract} UnDelegateResourceContract
13919
+ * @throws {Error} If the payload is not a reader or valid buffer
13920
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
13921
+ */
13922
+ UnDelegateResourceContract.decode = function decode(reader, length) {
13923
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
13924
+ var end = length === undefined ? reader.len : reader.pos + length,
13925
+ message = new $root.protocol.UnDelegateResourceContract();
13926
+ while (reader.pos < end) {
13927
+ var tag = reader.uint32();
13928
+ switch (tag >>> 3) {
13929
+ case 1: {
13930
+ message.ownerAddress = reader.bytes();
13931
+ break;
13932
+ }
13933
+ case 2: {
13934
+ message.resource = reader.int32();
13935
+ break;
13936
+ }
13937
+ case 3: {
13938
+ message.balance = reader.int64();
13939
+ break;
13940
+ }
13941
+ case 4: {
13942
+ message.receiverAddress = reader.bytes();
13943
+ break;
13944
+ }
13945
+ default:
13946
+ reader.skipType(tag & 7);
13947
+ break;
13948
+ }
13949
+ }
13950
+ return message;
13951
+ };
13952
+
13953
+ /**
13954
+ * Decodes an UnDelegateResourceContract message from the specified reader or buffer, length delimited.
13955
+ * @function decodeDelimited
13956
+ * @memberof protocol.UnDelegateResourceContract
13957
+ * @static
13958
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
13959
+ * @returns {protocol.UnDelegateResourceContract} UnDelegateResourceContract
13960
+ * @throws {Error} If the payload is not a reader or valid buffer
13961
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
13962
+ */
13963
+ UnDelegateResourceContract.decodeDelimited = function decodeDelimited(reader) {
13964
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
13965
+ return this.decode(reader, reader.uint32());
13966
+ };
13967
+
13968
+ /**
13969
+ * Verifies an UnDelegateResourceContract message.
13970
+ * @function verify
13971
+ * @memberof protocol.UnDelegateResourceContract
13972
+ * @static
13973
+ * @param {Object.<string,*>} message Plain object to verify
13974
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
13975
+ */
13976
+ UnDelegateResourceContract.verify = function verify(message) {
13977
+ if (typeof message !== 'object' || message === null) return 'object expected';
13978
+ if (message.ownerAddress != null && message.hasOwnProperty('ownerAddress'))
13979
+ if (
13980
+ !(
13981
+ (message.ownerAddress && typeof message.ownerAddress.length === 'number') ||
13982
+ $util.isString(message.ownerAddress)
13983
+ )
13984
+ )
13985
+ return 'ownerAddress: buffer expected';
13986
+ if (message.resource != null && message.hasOwnProperty('resource'))
13987
+ switch (message.resource) {
13988
+ default:
13989
+ return 'resource: enum value expected';
13990
+ case 0:
13991
+ case 1:
13992
+ break;
13993
+ }
13994
+ if (message.balance != null && message.hasOwnProperty('balance'))
13995
+ if (
13996
+ !$util.isInteger(message.balance) &&
13997
+ !(message.balance && $util.isInteger(message.balance.low) && $util.isInteger(message.balance.high))
13998
+ )
13999
+ return 'balance: integer|Long expected';
14000
+ if (message.receiverAddress != null && message.hasOwnProperty('receiverAddress'))
14001
+ if (
14002
+ !(
14003
+ (message.receiverAddress && typeof message.receiverAddress.length === 'number') ||
14004
+ $util.isString(message.receiverAddress)
14005
+ )
14006
+ )
14007
+ return 'receiverAddress: buffer expected';
14008
+ return null;
14009
+ };
14010
+
14011
+ /**
14012
+ * Creates an UnDelegateResourceContract message from a plain object. Also converts values to their respective internal types.
14013
+ * @function fromObject
14014
+ * @memberof protocol.UnDelegateResourceContract
14015
+ * @static
14016
+ * @param {Object.<string,*>} object Plain object
14017
+ * @returns {protocol.UnDelegateResourceContract} UnDelegateResourceContract
14018
+ */
14019
+ UnDelegateResourceContract.fromObject = function fromObject(object) {
14020
+ if (object instanceof $root.protocol.UnDelegateResourceContract) return object;
14021
+ var message = new $root.protocol.UnDelegateResourceContract();
14022
+ if (object.ownerAddress != null)
14023
+ if (typeof object.ownerAddress === 'string')
14024
+ $util.base64.decode(
14025
+ object.ownerAddress,
14026
+ (message.ownerAddress = $util.newBuffer($util.base64.length(object.ownerAddress))),
14027
+ 0
14028
+ );
14029
+ else if (object.ownerAddress.length >= 0) message.ownerAddress = object.ownerAddress;
14030
+ switch (object.resource) {
14031
+ default:
14032
+ if (typeof object.resource === 'number') {
14033
+ message.resource = object.resource;
14034
+ break;
14035
+ }
14036
+ break;
14037
+ case 'BANDWIDTH':
14038
+ case 0:
14039
+ message.resource = 0;
14040
+ break;
14041
+ case 'ENERGY':
14042
+ case 1:
14043
+ message.resource = 1;
14044
+ break;
14045
+ }
14046
+ if (object.balance != null)
14047
+ if ($util.Long) (message.balance = $util.Long.fromValue(object.balance)).unsigned = false;
14048
+ else if (typeof object.balance === 'string') message.balance = parseInt(object.balance, 10);
14049
+ else if (typeof object.balance === 'number') message.balance = object.balance;
14050
+ else if (typeof object.balance === 'object')
14051
+ message.balance = new $util.LongBits(object.balance.low >>> 0, object.balance.high >>> 0).toNumber();
14052
+ if (object.receiverAddress != null)
14053
+ if (typeof object.receiverAddress === 'string')
14054
+ $util.base64.decode(
14055
+ object.receiverAddress,
14056
+ (message.receiverAddress = $util.newBuffer($util.base64.length(object.receiverAddress))),
14057
+ 0
14058
+ );
14059
+ else if (object.receiverAddress.length >= 0) message.receiverAddress = object.receiverAddress;
14060
+ return message;
14061
+ };
14062
+
14063
+ /**
14064
+ * Creates a plain object from an UnDelegateResourceContract message. Also converts values to other types if specified.
14065
+ * @function toObject
14066
+ * @memberof protocol.UnDelegateResourceContract
14067
+ * @static
14068
+ * @param {protocol.UnDelegateResourceContract} message UnDelegateResourceContract
14069
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
14070
+ * @returns {Object.<string,*>} Plain object
14071
+ */
14072
+ UnDelegateResourceContract.toObject = function toObject(message, options) {
14073
+ if (!options) options = {};
14074
+ var object = {};
14075
+ if (options.defaults) {
14076
+ if (options.bytes === String) object.ownerAddress = '';
14077
+ else {
14078
+ object.ownerAddress = [];
14079
+ if (options.bytes !== Array) object.ownerAddress = $util.newBuffer(object.ownerAddress);
14080
+ }
14081
+ object.resource = options.enums === String ? 'BANDWIDTH' : 0;
14082
+ if ($util.Long) {
14083
+ var long = new $util.Long(0, 0, false);
14084
+ object.balance =
14085
+ options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
14086
+ } else object.balance = options.longs === String ? '0' : 0;
14087
+ if (options.bytes === String) object.receiverAddress = '';
14088
+ else {
14089
+ object.receiverAddress = [];
14090
+ if (options.bytes !== Array) object.receiverAddress = $util.newBuffer(object.receiverAddress);
14091
+ }
14092
+ }
14093
+ if (message.ownerAddress != null && message.hasOwnProperty('ownerAddress'))
14094
+ object.ownerAddress =
14095
+ options.bytes === String
14096
+ ? $util.base64.encode(message.ownerAddress, 0, message.ownerAddress.length)
14097
+ : options.bytes === Array
14098
+ ? Array.prototype.slice.call(message.ownerAddress)
14099
+ : message.ownerAddress;
14100
+ if (message.resource != null && message.hasOwnProperty('resource'))
14101
+ object.resource =
14102
+ options.enums === String
14103
+ ? $root.protocol.ResourceCode[message.resource] === undefined
14104
+ ? message.resource
14105
+ : $root.protocol.ResourceCode[message.resource]
14106
+ : message.resource;
14107
+ if (message.balance != null && message.hasOwnProperty('balance'))
14108
+ if (typeof message.balance === 'number')
14109
+ object.balance = options.longs === String ? String(message.balance) : message.balance;
14110
+ else
14111
+ object.balance =
14112
+ options.longs === String
14113
+ ? $util.Long.prototype.toString.call(message.balance)
14114
+ : options.longs === Number
14115
+ ? new $util.LongBits(message.balance.low >>> 0, message.balance.high >>> 0).toNumber()
14116
+ : message.balance;
14117
+ if (message.receiverAddress != null && message.hasOwnProperty('receiverAddress'))
14118
+ object.receiverAddress =
14119
+ options.bytes === String
14120
+ ? $util.base64.encode(message.receiverAddress, 0, message.receiverAddress.length)
14121
+ : options.bytes === Array
14122
+ ? Array.prototype.slice.call(message.receiverAddress)
14123
+ : message.receiverAddress;
14124
+ return object;
14125
+ };
14126
+
14127
+ /**
14128
+ * Converts this UnDelegateResourceContract to JSON.
14129
+ * @function toJSON
14130
+ * @memberof protocol.UnDelegateResourceContract
14131
+ * @instance
14132
+ * @returns {Object.<string,*>} JSON object
14133
+ */
14134
+ UnDelegateResourceContract.prototype.toJSON = function toJSON() {
14135
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
14136
+ };
14137
+
14138
+ /**
14139
+ * Gets the default type url for UnDelegateResourceContract
14140
+ * @function getTypeUrl
14141
+ * @memberof protocol.UnDelegateResourceContract
14142
+ * @static
14143
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
14144
+ * @returns {string} The default type url
14145
+ */
14146
+ UnDelegateResourceContract.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
14147
+ if (typeUrlPrefix === undefined) {
14148
+ typeUrlPrefix = 'type.googleapis.com';
14149
+ }
14150
+ return typeUrlPrefix + '/protocol.UnDelegateResourceContract';
14151
+ };
14152
+
14153
+ return UnDelegateResourceContract;
14154
+ })();
14155
+
13396
14156
  /**
13397
14157
  * AccountType enum.
13398
14158
  * @name protocol.AccountType
@@ -22545,6 +23305,8 @@ $root.protocol = (function () {
22545
23305
  case 54:
22546
23306
  case 55:
22547
23307
  case 56:
23308
+ case 57:
23309
+ case 58:
22548
23310
  break;
22549
23311
  }
22550
23312
  if (message.parameter != null && message.hasOwnProperty('parameter')) {
@@ -22725,6 +23487,14 @@ $root.protocol = (function () {
22725
23487
  case 56:
22726
23488
  message.type = 56;
22727
23489
  break;
23490
+ case 'DelegateResourceContract':
23491
+ case 57:
23492
+ message.type = 57;
23493
+ break;
23494
+ case 'UnDelegateResourceContract':
23495
+ case 58:
23496
+ message.type = 58;
23497
+ break;
22728
23498
  }
22729
23499
  if (object.parameter != null) {
22730
23500
  if (typeof object.parameter !== 'object')
@@ -22871,6 +23641,8 @@ $root.protocol = (function () {
22871
23641
  * @property {number} FreezeBalanceV2Contract=54 FreezeBalanceV2Contract value
22872
23642
  * @property {number} UnfreezeBalanceV2Contract=55 UnfreezeBalanceV2Contract value
22873
23643
  * @property {number} WithdrawExpireUnfreezeContract=56 WithdrawExpireUnfreezeContract value
23644
+ * @property {number} DelegateResourceContract=57 DelegateResourceContract value
23645
+ * @property {number} UnDelegateResourceContract=58 UnDelegateResourceContract value
22874
23646
  */
22875
23647
  Contract.ContractType = (function () {
22876
23648
  var valuesById = {},
@@ -22910,6 +23682,8 @@ $root.protocol = (function () {
22910
23682
  values[(valuesById[54] = 'FreezeBalanceV2Contract')] = 54;
22911
23683
  values[(valuesById[55] = 'UnfreezeBalanceV2Contract')] = 55;
22912
23684
  values[(valuesById[56] = 'WithdrawExpireUnfreezeContract')] = 56;
23685
+ values[(valuesById[57] = 'DelegateResourceContract')] = 57;
23686
+ values[(valuesById[58] = 'UnDelegateResourceContract')] = 58;
22913
23687
  return values;
22914
23688
  })();
22915
23689