@steemit/steem-js 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -22174,9 +22174,45 @@ function getOperationTypeIndex(opType) {
22174
22174
  'account_witness_proxy': 13,
22175
22175
  'pow': 14,
22176
22176
  'custom': 15,
22177
+ 'report_over_production': 16,
22177
22178
  'delete_comment': 17,
22178
22179
  'custom_json': 18,
22179
22180
  'comment_options': 19,
22181
+ 'set_withdraw_vesting_route': 20,
22182
+ 'limit_order_create2': 21,
22183
+ 'claim_account': 22,
22184
+ 'create_claimed_account': 23,
22185
+ 'request_account_recovery': 24,
22186
+ 'recover_account': 25,
22187
+ 'change_recovery_account': 26,
22188
+ 'escrow_transfer': 27,
22189
+ 'escrow_dispute': 28,
22190
+ 'escrow_release': 29,
22191
+ 'pow2': 30,
22192
+ 'escrow_approve': 31,
22193
+ 'transfer_to_savings': 32,
22194
+ 'transfer_from_savings': 33,
22195
+ 'cancel_transfer_from_savings': 34,
22196
+ 'custom_binary': 35,
22197
+ 'decline_voting_rights': 36,
22198
+ 'reset_account': 37,
22199
+ 'set_reset_account': 38,
22200
+ 'claim_reward_balance': 39,
22201
+ 'delegate_vesting_shares': 40,
22202
+ 'account_create_with_delegation': 41,
22203
+ 'witness_set_properties': 42,
22204
+ 'account_update2': 43,
22205
+ 'create_proposal': 44,
22206
+ 'update_proposal_votes': 45,
22207
+ 'remove_proposal': 46,
22208
+ 'claim_reward_balance2': 47,
22209
+ 'fill_convert_request': 48,
22210
+ 'comment_reward': 49,
22211
+ 'liquidity_reward': 50,
22212
+ 'interest': 51,
22213
+ 'fill_vesting_withdraw': 52,
22214
+ 'fill_order': 53,
22215
+ 'fill_transfer_from_savings': 54,
22180
22216
  };
22181
22217
  const index = opMap[opType];
22182
22218
  if (index === undefined) {
@@ -22201,6 +22237,135 @@ function serializeOperationData(bb, opType, opData) {
22201
22237
  case 'account_create':
22202
22238
  serializeAccountCreate(bb, opData);
22203
22239
  break;
22240
+ case 'account_update':
22241
+ serializeAccountUpdate(bb, opData);
22242
+ break;
22243
+ case 'account_create_with_delegation':
22244
+ serializeAccountCreateWithDelegation(bb, opData);
22245
+ break;
22246
+ case 'create_claimed_account':
22247
+ serializeCreateClaimedAccount(bb, opData);
22248
+ break;
22249
+ case 'account_update2':
22250
+ serializeAccountUpdate2(bb, opData);
22251
+ break;
22252
+ case 'request_account_recovery':
22253
+ serializeRequestAccountRecovery(bb, opData);
22254
+ break;
22255
+ case 'recover_account':
22256
+ serializeRecoverAccount(bb, opData);
22257
+ break;
22258
+ case 'change_recovery_account':
22259
+ serializeChangeRecoveryAccount(bb, opData);
22260
+ break;
22261
+ case 'reset_account':
22262
+ serializeResetAccount(bb, opData);
22263
+ break;
22264
+ case 'set_reset_account':
22265
+ serializeSetResetAccount(bb, opData);
22266
+ break;
22267
+ case 'decline_voting_rights':
22268
+ serializeDeclineVotingRights(bb, opData);
22269
+ break;
22270
+ case 'transfer_to_vesting':
22271
+ serializeTransferToVesting(bb, opData);
22272
+ break;
22273
+ case 'withdraw_vesting':
22274
+ serializeWithdrawVesting(bb, opData);
22275
+ break;
22276
+ case 'set_withdraw_vesting_route':
22277
+ serializeSetWithdrawVestingRoute(bb, opData);
22278
+ break;
22279
+ case 'transfer_to_savings':
22280
+ serializeTransferToSavings(bb, opData);
22281
+ break;
22282
+ case 'transfer_from_savings':
22283
+ serializeTransferFromSavings(bb, opData);
22284
+ break;
22285
+ case 'cancel_transfer_from_savings':
22286
+ serializeCancelTransferFromSavings(bb, opData);
22287
+ break;
22288
+ case 'limit_order_create':
22289
+ serializeLimitOrderCreate(bb, opData);
22290
+ break;
22291
+ case 'limit_order_create2':
22292
+ serializeLimitOrderCreate2(bb, opData);
22293
+ break;
22294
+ case 'limit_order_cancel':
22295
+ serializeLimitOrderCancel(bb, opData);
22296
+ break;
22297
+ case 'feed_publish':
22298
+ serializeFeedPublish(bb, opData);
22299
+ break;
22300
+ case 'convert':
22301
+ serializeConvert(bb, opData);
22302
+ break;
22303
+ case 'fill_order':
22304
+ serializeFillOrder(bb, opData);
22305
+ break;
22306
+ case 'escrow_transfer':
22307
+ serializeEscrowTransfer(bb, opData);
22308
+ break;
22309
+ case 'escrow_dispute':
22310
+ serializeEscrowDispute(bb, opData);
22311
+ break;
22312
+ case 'escrow_release':
22313
+ serializeEscrowRelease(bb, opData);
22314
+ break;
22315
+ case 'escrow_approve':
22316
+ serializeEscrowApprove(bb, opData);
22317
+ break;
22318
+ case 'claim_reward_balance':
22319
+ serializeClaimRewardBalance(bb, opData);
22320
+ break;
22321
+ case 'claim_reward_balance2':
22322
+ serializeClaimRewardBalance2(bb, opData);
22323
+ break;
22324
+ case 'comment_reward':
22325
+ serializeCommentReward(bb, opData);
22326
+ break;
22327
+ case 'liquidity_reward':
22328
+ serializeLiquidityReward(bb, opData);
22329
+ break;
22330
+ case 'interest':
22331
+ serializeInterest(bb, opData);
22332
+ break;
22333
+ case 'fill_vesting_withdraw':
22334
+ serializeFillVestingWithdraw(bb, opData);
22335
+ break;
22336
+ case 'fill_convert_request':
22337
+ serializeFillConvertRequest(bb, opData);
22338
+ break;
22339
+ case 'fill_transfer_from_savings':
22340
+ serializeFillTransferFromSavings(bb, opData);
22341
+ break;
22342
+ case 'pow':
22343
+ serializePow(bb, opData);
22344
+ break;
22345
+ case 'pow2':
22346
+ serializePow2(bb, opData);
22347
+ break;
22348
+ case 'witness_update':
22349
+ serializeWitnessUpdate(bb, opData);
22350
+ break;
22351
+ case 'witness_set_properties':
22352
+ serializeWitnessSetProperties(bb, opData);
22353
+ break;
22354
+ case 'account_witness_vote':
22355
+ serializeAccountWitnessVote(bb, opData);
22356
+ break;
22357
+ case 'account_witness_proxy':
22358
+ serializeAccountWitnessProxy(bb, opData);
22359
+ break;
22360
+ case 'custom':
22361
+ serializeCustom(bb, opData);
22362
+ break;
22363
+ case 'custom_binary':
22364
+ serializeCustomBinary(bb, opData);
22365
+ break;
22366
+ case 'comment_options':
22367
+ serializeCommentOptions(bb, opData);
22368
+ break;
22204
22369
  case 'custom_json':
22205
22370
  serializeCustomJson(bb, opData);
22206
22371
  break;
@@ -22270,6 +22435,647 @@ function serializeAccountCreate(bb, data) {
22270
22435
  }
22271
22436
  writeString(bb, String(dataObj.json_metadata || ''));
22272
22437
  }
22438
+ /**
22439
+ * Serialize account_update operation.
22440
+ * Format: account, optional owner (1 byte + authority?), optional active, optional posting, memo_key, json_metadata.
22441
+ */
22442
+ function serializeAccountUpdate(bb, data) {
22443
+ const dataObj = data;
22444
+ writeString(bb, String(dataObj.account || ''));
22445
+ // Optional authorities: 0 = not present, 1 = present then serialize authority
22446
+ if (dataObj.owner != null && dataObj.owner !== '') {
22447
+ bb.writeUint8(1);
22448
+ serializeAuthority(bb, typeof dataObj.owner === 'object' ? dataObj.owner : { weight_threshold: 1, account_auths: [], key_auths: [] });
22449
+ }
22450
+ else {
22451
+ bb.writeUint8(0);
22452
+ }
22453
+ if (dataObj.active != null && dataObj.active !== '') {
22454
+ bb.writeUint8(1);
22455
+ serializeAuthority(bb, typeof dataObj.active === 'object' ? dataObj.active : { weight_threshold: 1, account_auths: [], key_auths: [] });
22456
+ }
22457
+ else {
22458
+ bb.writeUint8(0);
22459
+ }
22460
+ if (dataObj.posting != null && dataObj.posting !== '') {
22461
+ bb.writeUint8(1);
22462
+ serializeAuthority(bb, typeof dataObj.posting === 'object' ? dataObj.posting : { weight_threshold: 1, account_auths: [], key_auths: [] });
22463
+ }
22464
+ else {
22465
+ bb.writeUint8(0);
22466
+ }
22467
+ // memo_key (public key, required)
22468
+ if (typeof dataObj.memo_key === 'string') {
22469
+ const pubKey = PublicKey.fromStringOrThrow(dataObj.memo_key);
22470
+ bb.append(pubKey.toBuffer());
22471
+ }
22472
+ else if (Buffer.isBuffer(dataObj.memo_key)) {
22473
+ bb.append(dataObj.memo_key);
22474
+ }
22475
+ else if (dataObj.memo_key && typeof dataObj.memo_key.toBuffer === 'function') {
22476
+ bb.append(dataObj.memo_key.toBuffer());
22477
+ }
22478
+ else {
22479
+ throw new Error('Invalid memo_key format');
22480
+ }
22481
+ writeString(bb, typeof dataObj.json_metadata === 'string'
22482
+ ? dataObj.json_metadata
22483
+ : dataObj.json_metadata != null
22484
+ ? JSON.stringify(dataObj.json_metadata)
22485
+ : '');
22486
+ }
22487
+ /**
22488
+ * Serialize account_create_with_delegation operation.
22489
+ * Fields (see FC_REFLECT): fee, delegation, creator, new_account_name,
22490
+ * owner, active, posting, memo_key, json_metadata, extensions.
22491
+ */
22492
+ function serializeAccountCreateWithDelegation(bb, data) {
22493
+ const dataObj = data;
22494
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
22495
+ serializeAsset(bb, String(dataObj.delegation || '0.000 VESTS'));
22496
+ writeString(bb, String(dataObj.creator || ''));
22497
+ writeString(bb, String(dataObj.new_account_name || ''));
22498
+ serializeAuthority(bb, dataObj.owner);
22499
+ serializeAuthority(bb, dataObj.active);
22500
+ serializeAuthority(bb, dataObj.posting);
22501
+ const memoKey = String(dataObj.memo_key || '');
22502
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
22503
+ bb.append(pubKey.toBuffer());
22504
+ writeString(bb, String(dataObj.json_metadata || ''));
22505
+ serializeExtensions(bb, dataObj.extensions);
22506
+ }
22507
+ /**
22508
+ * Serialize create_claimed_account operation.
22509
+ * Fields: creator, new_account_name, owner, active, posting,
22510
+ * memo_key, json_metadata, extensions.
22511
+ */
22512
+ function serializeCreateClaimedAccount(bb, data) {
22513
+ const dataObj = data;
22514
+ writeString(bb, String(dataObj.creator || ''));
22515
+ writeString(bb, String(dataObj.new_account_name || ''));
22516
+ serializeAuthority(bb, dataObj.owner);
22517
+ serializeAuthority(bb, dataObj.active);
22518
+ serializeAuthority(bb, dataObj.posting);
22519
+ const memoKey = String(dataObj.memo_key || '');
22520
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
22521
+ bb.append(pubKey.toBuffer());
22522
+ writeString(bb, String(dataObj.json_metadata || ''));
22523
+ serializeExtensions(bb, dataObj.extensions);
22524
+ }
22525
+ /**
22526
+ * Serialize account_update2 operation.
22527
+ * Fields: account, owner, active, posting, memo_key,
22528
+ * json_metadata, posting_json_metadata, extensions.
22529
+ */
22530
+ function serializeAccountUpdate2(bb, data) {
22531
+ const dataObj = data;
22532
+ writeString(bb, String(dataObj.account || ''));
22533
+ serializeAuthority(bb, dataObj.owner);
22534
+ serializeAuthority(bb, dataObj.active);
22535
+ serializeAuthority(bb, dataObj.posting);
22536
+ const memoKey = String(dataObj.memo_key || '');
22537
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
22538
+ bb.append(pubKey.toBuffer());
22539
+ writeString(bb, String(dataObj.json_metadata || ''));
22540
+ writeString(bb, String(dataObj.posting_json_metadata || ''));
22541
+ serializeExtensions(bb, dataObj.extensions);
22542
+ }
22543
+ /**
22544
+ * Serialize request_account_recovery operation.
22545
+ * Fields: recovery_account, account_to_recover, new_owner_authority, extensions.
22546
+ */
22547
+ function serializeRequestAccountRecovery(bb, data) {
22548
+ const dataObj = data;
22549
+ writeString(bb, String(dataObj.recovery_account || ''));
22550
+ writeString(bb, String(dataObj.account_to_recover || ''));
22551
+ serializeAuthority(bb, dataObj.new_owner_authority);
22552
+ serializeExtensions(bb, dataObj.extensions);
22553
+ }
22554
+ /**
22555
+ * Serialize recover_account operation.
22556
+ * Fields: account_to_recover, new_owner_authority, recent_owner_authority, extensions.
22557
+ */
22558
+ function serializeRecoverAccount(bb, data) {
22559
+ const dataObj = data;
22560
+ writeString(bb, String(dataObj.account_to_recover || ''));
22561
+ serializeAuthority(bb, dataObj.new_owner_authority);
22562
+ serializeAuthority(bb, dataObj.recent_owner_authority);
22563
+ serializeExtensions(bb, dataObj.extensions);
22564
+ }
22565
+ /**
22566
+ * Serialize change_recovery_account operation.
22567
+ * Fields: account_to_recover, new_recovery_account, extensions.
22568
+ */
22569
+ function serializeChangeRecoveryAccount(bb, data) {
22570
+ const dataObj = data;
22571
+ writeString(bb, String(dataObj.account_to_recover || ''));
22572
+ writeString(bb, String(dataObj.new_recovery_account || ''));
22573
+ serializeExtensions(bb, dataObj.extensions);
22574
+ }
22575
+ /**
22576
+ * Serialize reset_account operation.
22577
+ * Fields: reset_account, account_to_reset, new_owner_authority.
22578
+ */
22579
+ function serializeResetAccount(bb, data) {
22580
+ const dataObj = data;
22581
+ writeString(bb, String(dataObj.reset_account || ''));
22582
+ writeString(bb, String(dataObj.account_to_reset || ''));
22583
+ serializeAuthority(bb, dataObj.new_owner_authority);
22584
+ }
22585
+ /**
22586
+ * Serialize set_reset_account operation.
22587
+ * Fields: account, reset_account.
22588
+ */
22589
+ function serializeSetResetAccount(bb, data) {
22590
+ const dataObj = data;
22591
+ writeString(bb, String(dataObj.account || ''));
22592
+ writeString(bb, String(dataObj.reset_account || ''));
22593
+ }
22594
+ /**
22595
+ * Serialize decline_voting_rights operation.
22596
+ * Fields: account, decline.
22597
+ */
22598
+ function serializeDeclineVotingRights(bb, data) {
22599
+ const dataObj = data;
22600
+ writeString(bb, String(dataObj.account || ''));
22601
+ serializeBool(bb, dataObj.decline);
22602
+ }
22603
+ /**
22604
+ * Serialize transfer_to_vesting operation.
22605
+ * Fields: from, to, amount.
22606
+ */
22607
+ function serializeTransferToVesting(bb, data) {
22608
+ const dataObj = data;
22609
+ writeString(bb, String(dataObj.from || ''));
22610
+ writeString(bb, String(dataObj.to || ''));
22611
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
22612
+ }
22613
+ /**
22614
+ * Serialize withdraw_vesting operation.
22615
+ * Fields: account, vesting_shares.
22616
+ */
22617
+ function serializeWithdrawVesting(bb, data) {
22618
+ const dataObj = data;
22619
+ writeString(bb, String(dataObj.account || ''));
22620
+ serializeAsset(bb, String(dataObj.vesting_shares || '0.000 VESTS'));
22621
+ }
22622
+ /**
22623
+ * Serialize set_withdraw_vesting_route operation.
22624
+ * Fields: from_account, to_account, percent, auto_vest.
22625
+ */
22626
+ function serializeSetWithdrawVestingRoute(bb, data) {
22627
+ const dataObj = data;
22628
+ writeString(bb, String(dataObj.from_account || ''));
22629
+ writeString(bb, String(dataObj.to_account || ''));
22630
+ // percent is uint16
22631
+ bb.writeUint16(dataObj.percent ?? 0);
22632
+ serializeBool(bb, dataObj.auto_vest);
22633
+ }
22634
+ /**
22635
+ * Serialize transfer_to_savings operation.
22636
+ * Fields: from, to, amount, memo.
22637
+ */
22638
+ function serializeTransferToSavings(bb, data) {
22639
+ const dataObj = data;
22640
+ writeString(bb, String(dataObj.from || ''));
22641
+ writeString(bb, String(dataObj.to || ''));
22642
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
22643
+ writeString(bb, String(dataObj.memo || ''));
22644
+ }
22645
+ /**
22646
+ * Serialize transfer_from_savings operation.
22647
+ * Fields: from, request_id, to, amount, memo.
22648
+ */
22649
+ function serializeTransferFromSavings(bb, data) {
22650
+ const dataObj = data;
22651
+ writeString(bb, String(dataObj.from || ''));
22652
+ bb.writeUint32(dataObj.request_id ?? dataObj.requestID ?? 0);
22653
+ writeString(bb, String(dataObj.to || ''));
22654
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
22655
+ writeString(bb, String(dataObj.memo || ''));
22656
+ }
22657
+ /**
22658
+ * Serialize cancel_transfer_from_savings operation.
22659
+ * Fields: from, request_id.
22660
+ */
22661
+ function serializeCancelTransferFromSavings(bb, data) {
22662
+ const dataObj = data;
22663
+ writeString(bb, String(dataObj.from || ''));
22664
+ bb.writeUint32(dataObj.request_id ?? dataObj.requestID ?? 0);
22665
+ }
22666
+ /**
22667
+ * Serialize limit_order_create operation.
22668
+ * Fields: owner, orderid, amount_to_sell, min_to_receive, fill_or_kill, expiration.
22669
+ */
22670
+ function serializeLimitOrderCreate(bb, data) {
22671
+ const dataObj = data;
22672
+ writeString(bb, String(dataObj.owner || ''));
22673
+ bb.writeUint32(dataObj.orderid ?? 0);
22674
+ serializeAsset(bb, String(dataObj.amount_to_sell || '0.000 STEEM'));
22675
+ serializeAsset(bb, String(dataObj.min_to_receive || '0.000 STEEM'));
22676
+ serializeBool(bb, dataObj.fill_or_kill);
22677
+ serializeTimePointSec(bb, dataObj.expiration);
22678
+ }
22679
+ /**
22680
+ * Serialize limit_order_create2 operation.
22681
+ * Fields: owner, orderid, amount_to_sell, exchange_rate{base, quote}, fill_or_kill, expiration.
22682
+ */
22683
+ function serializeLimitOrderCreate2(bb, data) {
22684
+ const dataObj = data;
22685
+ writeString(bb, String(dataObj.owner || ''));
22686
+ bb.writeUint32(dataObj.orderid ?? 0);
22687
+ serializeAsset(bb, String(dataObj.amount_to_sell || '0.000 STEEM'));
22688
+ const rate = (dataObj.exchange_rate ?? dataObj.exchangeRate);
22689
+ const base = rate?.base ?? '0.000 STEEM';
22690
+ const quote = rate?.quote ?? '0.000 SBD';
22691
+ serializeAsset(bb, String(base));
22692
+ serializeAsset(bb, String(quote));
22693
+ serializeBool(bb, dataObj.fill_or_kill);
22694
+ serializeTimePointSec(bb, dataObj.expiration);
22695
+ }
22696
+ /**
22697
+ * Serialize limit_order_cancel operation.
22698
+ * Fields: owner, orderid.
22699
+ */
22700
+ function serializeLimitOrderCancel(bb, data) {
22701
+ const dataObj = data;
22702
+ writeString(bb, String(dataObj.owner || ''));
22703
+ bb.writeUint32(dataObj.orderid ?? 0);
22704
+ }
22705
+ /**
22706
+ * Serialize feed_publish operation.
22707
+ * Fields: publisher, exchange_rate{base, quote}.
22708
+ */
22709
+ function serializeFeedPublish(bb, data) {
22710
+ const dataObj = data;
22711
+ writeString(bb, String(dataObj.publisher || ''));
22712
+ const rate = (dataObj.exchange_rate ?? dataObj.exchangeRate);
22713
+ const base = rate?.base ?? '0.000 STEEM';
22714
+ const quote = rate?.quote ?? '0.000 SBD';
22715
+ serializeAsset(bb, String(base));
22716
+ serializeAsset(bb, String(quote));
22717
+ }
22718
+ /**
22719
+ * Serialize convert operation.
22720
+ * Fields: owner, requestid, amount.
22721
+ */
22722
+ function serializeConvert(bb, data) {
22723
+ const dataObj = data;
22724
+ writeString(bb, String(dataObj.owner || ''));
22725
+ bb.writeUint32(dataObj.requestid ?? dataObj.request_id ?? 0);
22726
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
22727
+ }
22728
+ /**
22729
+ * Serialize fill_order operation (virtual).
22730
+ * Fields: current_owner, current_orderid, current_pays,
22731
+ * open_owner, open_orderid, open_pays.
22732
+ */
22733
+ function serializeFillOrder(bb, data) {
22734
+ const dataObj = data;
22735
+ writeString(bb, String(dataObj.current_owner || ''));
22736
+ bb.writeUint32(dataObj.current_orderid ?? 0);
22737
+ serializeAsset(bb, String(dataObj.current_pays || '0.000 STEEM'));
22738
+ writeString(bb, String(dataObj.open_owner || ''));
22739
+ bb.writeUint32(dataObj.open_orderid ?? 0);
22740
+ serializeAsset(bb, String(dataObj.open_pays || '0.000 STEEM'));
22741
+ }
22742
+ /**
22743
+ * Serialize escrow_transfer operation.
22744
+ * Fields: from, to, sbd_amount, steem_amount, escrow_id, agent,
22745
+ * fee, json_meta, ratification_deadline, escrow_expiration.
22746
+ */
22747
+ function serializeEscrowTransfer(bb, data) {
22748
+ const dataObj = data;
22749
+ writeString(bb, String(dataObj.from || ''));
22750
+ writeString(bb, String(dataObj.to || ''));
22751
+ serializeAsset(bb, String(dataObj.sbd_amount || '0.000 SBD'));
22752
+ serializeAsset(bb, String(dataObj.steem_amount || '0.000 STEEM'));
22753
+ bb.writeUint32(dataObj.escrow_id ?? 0);
22754
+ writeString(bb, String(dataObj.agent || ''));
22755
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
22756
+ writeString(bb, String(dataObj.json_meta || ''));
22757
+ serializeTimePointSec(bb, dataObj.ratification_deadline);
22758
+ serializeTimePointSec(bb, dataObj.escrow_expiration);
22759
+ }
22760
+ /**
22761
+ * Serialize escrow_dispute operation.
22762
+ * Fields: from, to, who, escrow_id.
22763
+ */
22764
+ function serializeEscrowDispute(bb, data) {
22765
+ const dataObj = data;
22766
+ writeString(bb, String(dataObj.from || ''));
22767
+ writeString(bb, String(dataObj.to || ''));
22768
+ writeString(bb, String(dataObj.who || ''));
22769
+ bb.writeUint32(dataObj.escrow_id ?? 0);
22770
+ }
22771
+ /**
22772
+ * Serialize escrow_release operation.
22773
+ * Fields: from, to, who, escrow_id, sbd_amount, steem_amount.
22774
+ */
22775
+ function serializeEscrowRelease(bb, data) {
22776
+ const dataObj = data;
22777
+ writeString(bb, String(dataObj.from || ''));
22778
+ writeString(bb, String(dataObj.to || ''));
22779
+ writeString(bb, String(dataObj.who || ''));
22780
+ bb.writeUint32(dataObj.escrow_id ?? 0);
22781
+ serializeAsset(bb, String(dataObj.sbd_amount || '0.000 SBD'));
22782
+ serializeAsset(bb, String(dataObj.steem_amount || '0.000 STEEM'));
22783
+ }
22784
+ /**
22785
+ * Serialize escrow_approve operation.
22786
+ * Fields: from, to, agent, who, escrow_id, approve.
22787
+ */
22788
+ function serializeEscrowApprove(bb, data) {
22789
+ const dataObj = data;
22790
+ writeString(bb, String(dataObj.from || ''));
22791
+ writeString(bb, String(dataObj.to || ''));
22792
+ writeString(bb, String(dataObj.agent || ''));
22793
+ writeString(bb, String(dataObj.who || ''));
22794
+ bb.writeUint32(dataObj.escrow_id ?? 0);
22795
+ serializeBool(bb, dataObj.approve);
22796
+ }
22797
+ /**
22798
+ * Serialize claim_reward_balance operation.
22799
+ * Fields: account, reward_steem, reward_sbd, reward_vests.
22800
+ */
22801
+ function serializeClaimRewardBalance(bb, data) {
22802
+ const dataObj = data;
22803
+ writeString(bb, String(dataObj.account || ''));
22804
+ serializeAsset(bb, String(dataObj.reward_steem || '0.000 STEEM'));
22805
+ serializeAsset(bb, String(dataObj.reward_sbd || '0.000 SBD'));
22806
+ serializeAsset(bb, String(dataObj.reward_vests || '0.000000 VESTS'));
22807
+ }
22808
+ /**
22809
+ * Serialize claim_reward_balance2 operation.
22810
+ * Fields: account, extensions, reward_tokens (array of asset strings).
22811
+ */
22812
+ function serializeClaimRewardBalance2(bb, data) {
22813
+ const dataObj = data;
22814
+ writeString(bb, String(dataObj.account || ''));
22815
+ serializeExtensions(bb, dataObj.extensions);
22816
+ const tokens = Array.isArray(dataObj.reward_tokens) ? dataObj.reward_tokens : [];
22817
+ bb.writeVarint32(tokens.length);
22818
+ for (const tok of tokens) {
22819
+ serializeAsset(bb, typeof tok === 'string' ? tok : String(tok));
22820
+ }
22821
+ }
22822
+ /**
22823
+ * Serialize comment_reward operation.
22824
+ * Fields: author, permlink, payout.
22825
+ */
22826
+ function serializeCommentReward(bb, data) {
22827
+ const dataObj = data;
22828
+ writeString(bb, String(dataObj.author || ''));
22829
+ writeString(bb, String(dataObj.permlink || ''));
22830
+ serializeAsset(bb, String(dataObj.payout || '0.000 STEEM'));
22831
+ }
22832
+ /**
22833
+ * Serialize liquidity_reward operation.
22834
+ * Fields: owner, payout.
22835
+ */
22836
+ function serializeLiquidityReward(bb, data) {
22837
+ const dataObj = data;
22838
+ writeString(bb, String(dataObj.owner || ''));
22839
+ serializeAsset(bb, String(dataObj.payout || '0.000 STEEM'));
22840
+ }
22841
+ /**
22842
+ * Serialize interest operation.
22843
+ * Fields: owner, interest.
22844
+ */
22845
+ function serializeInterest(bb, data) {
22846
+ const dataObj = data;
22847
+ writeString(bb, String(dataObj.owner || ''));
22848
+ serializeAsset(bb, String(dataObj.interest || '0.000 STEEM'));
22849
+ }
22850
+ /**
22851
+ * Serialize fill_vesting_withdraw operation.
22852
+ * Fields: from_account, to_account, withdrawn, deposited.
22853
+ */
22854
+ function serializeFillVestingWithdraw(bb, data) {
22855
+ const dataObj = data;
22856
+ writeString(bb, String(dataObj.from_account || ''));
22857
+ writeString(bb, String(dataObj.to_account || ''));
22858
+ serializeAsset(bb, String(dataObj.withdrawn || '0.000000 VESTS'));
22859
+ serializeAsset(bb, String(dataObj.deposited || '0.000 STEEM'));
22860
+ }
22861
+ /**
22862
+ * Serialize fill_convert_request operation.
22863
+ * Fields: owner, requestid, amount_in, amount_out.
22864
+ */
22865
+ function serializeFillConvertRequest(bb, data) {
22866
+ const dataObj = data;
22867
+ writeString(bb, String(dataObj.owner || ''));
22868
+ bb.writeUint32(dataObj.requestid ?? 0);
22869
+ serializeAsset(bb, String(dataObj.amount_in || '0.000 STEEM'));
22870
+ serializeAsset(bb, String(dataObj.amount_out || '0.000 STEEM'));
22871
+ }
22872
+ /**
22873
+ * Serialize fill_transfer_from_savings operation.
22874
+ * Fields: from, to, amount, request_id, memo.
22875
+ */
22876
+ function serializeFillTransferFromSavings(bb, data) {
22877
+ const dataObj = data;
22878
+ writeString(bb, String(dataObj.from || ''));
22879
+ writeString(bb, String(dataObj.to || ''));
22880
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
22881
+ bb.writeUint32(dataObj.request_id ?? 0);
22882
+ writeString(bb, String(dataObj.memo || ''));
22883
+ }
22884
+ /**
22885
+ * Serialize ChainProperties (used in pow, witness_update).
22886
+ * Fields: account_creation_fee (asset string), maximum_block_size (uint32), sbd_interest_rate (uint16).
22887
+ */
22888
+ function serializeChainProperties(bb, props) {
22889
+ const p = props || {};
22890
+ const fee = p.account_creation_fee;
22891
+ if (typeof fee === 'string' && fee.split(' ').length >= 2) {
22892
+ serializeAsset(bb, fee);
22893
+ }
22894
+ else {
22895
+ serializeAsset(bb, '0.000 STEEM');
22896
+ }
22897
+ bb.writeUint32(p.maximum_block_size ?? 0);
22898
+ bb.writeUint16(p.sbd_interest_rate ?? 0);
22899
+ }
22900
+ /**
22901
+ * Serialize POW inner struct (worker, input, signature, work).
22902
+ */
22903
+ function serializePOWInner(bb, work) {
22904
+ const w = work || {};
22905
+ writeString(bb, String(w.worker || ''));
22906
+ writeString(bb, String(w.input || ''));
22907
+ writeString(bb, String(w.signature || ''));
22908
+ writeString(bb, String(w.work || ''));
22909
+ }
22910
+ /**
22911
+ * Serialize pow operation.
22912
+ * Fields: worker_account, block_id, nonce (optional), work (POW), props (ChainProperties).
22913
+ */
22914
+ function serializePow(bb, data) {
22915
+ const dataObj = data;
22916
+ writeString(bb, String(dataObj.worker_account || ''));
22917
+ writeString(bb, String(dataObj.block_id || ''));
22918
+ const nonce = dataObj.nonce;
22919
+ if (nonce !== undefined && nonce !== null) {
22920
+ bb.writeUint8(1);
22921
+ bb.writeUint64(Number(nonce));
22922
+ }
22923
+ else {
22924
+ bb.writeUint8(0);
22925
+ }
22926
+ serializePOWInner(bb, dataObj.work);
22927
+ serializeChainProperties(bb, dataObj.props);
22928
+ }
22929
+ /**
22930
+ * Serialize pow2 operation.
22931
+ * Fields: input, pow_summary (opaque bytes; if string treated as hex).
22932
+ */
22933
+ function serializePow2(bb, data) {
22934
+ const dataObj = data;
22935
+ writeString(bb, String(dataObj.input || ''));
22936
+ const summary = dataObj.pow_summary;
22937
+ let bytes;
22938
+ if (typeof summary === 'string') {
22939
+ const hex = summary.startsWith('0x') ? summary.slice(2) : summary;
22940
+ bytes = Buffer.from(hex, 'hex');
22941
+ }
22942
+ else if (Buffer.isBuffer(summary)) {
22943
+ bytes = summary;
22944
+ }
22945
+ else {
22946
+ bytes = Buffer.alloc(0);
22947
+ }
22948
+ bb.writeVarint32(bytes.length);
22949
+ bb.append(bytes);
22950
+ }
22951
+ /**
22952
+ * Serialize witness_update operation.
22953
+ * Fields: owner, url, block_signing_key, props (ChainProperties), fee.
22954
+ */
22955
+ function serializeWitnessUpdate(bb, data) {
22956
+ const dataObj = data;
22957
+ writeString(bb, String(dataObj.owner || ''));
22958
+ writeString(bb, String(dataObj.url || ''));
22959
+ const key = dataObj.block_signing_key;
22960
+ if (typeof key === 'string') {
22961
+ const pubKey = PublicKey.fromStringOrThrow(key);
22962
+ bb.append(pubKey.toBuffer());
22963
+ }
22964
+ else if (Buffer.isBuffer(key)) {
22965
+ bb.append(key);
22966
+ }
22967
+ else if (key && typeof key.toBuffer === 'function') {
22968
+ bb.append(key.toBuffer());
22969
+ }
22970
+ else {
22971
+ bb.append(Buffer.alloc(33));
22972
+ }
22973
+ serializeChainProperties(bb, dataObj.props);
22974
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
22975
+ }
22976
+ /**
22977
+ * Serialize witness_set_properties operation.
22978
+ * Fields: owner, props (map string -> bytes), extensions.
22979
+ */
22980
+ function serializeWitnessSetProperties(bb, data) {
22981
+ const dataObj = data;
22982
+ writeString(bb, String(dataObj.owner || ''));
22983
+ const props = dataObj.props;
22984
+ const keys = props ? Object.keys(props).sort() : [];
22985
+ bb.writeVarint32(keys.length);
22986
+ for (const k of keys) {
22987
+ writeString(bb, k);
22988
+ const v = props[k];
22989
+ const buf = typeof v === 'string' ? Buffer.from(v, 'utf8') : Buffer.isBuffer(v) ? v : Buffer.alloc(0);
22990
+ bb.writeVarint32(buf.length);
22991
+ bb.append(buf);
22992
+ }
22993
+ serializeExtensions(bb, dataObj.extensions);
22994
+ }
22995
+ /**
22996
+ * Serialize account_witness_vote operation.
22997
+ * Fields: account, witness, approve.
22998
+ */
22999
+ function serializeAccountWitnessVote(bb, data) {
23000
+ const dataObj = data;
23001
+ writeString(bb, String(dataObj.account || ''));
23002
+ writeString(bb, String(dataObj.witness || ''));
23003
+ serializeBool(bb, dataObj.approve);
23004
+ }
23005
+ /**
23006
+ * Serialize account_witness_proxy operation.
23007
+ * Fields: account, proxy.
23008
+ */
23009
+ function serializeAccountWitnessProxy(bb, data) {
23010
+ const dataObj = data;
23011
+ writeString(bb, String(dataObj.account || ''));
23012
+ writeString(bb, String(dataObj.proxy || ''));
23013
+ }
23014
+ /**
23015
+ * Serialize custom operation (required_auths, id, data).
23016
+ * id is uint16 in protocol; data is bytes.
23017
+ */
23018
+ function serializeCustom(bb, data) {
23019
+ const dataObj = data;
23020
+ const requiredAuths = Array.isArray(dataObj.required_auths)
23021
+ ? dataObj.required_auths.slice().sort()
23022
+ : [];
23023
+ bb.writeVarint32(requiredAuths.length);
23024
+ for (const account of requiredAuths) {
23025
+ writeString(bb, String(account));
23026
+ }
23027
+ bb.writeUint16(dataObj.id ?? 0);
23028
+ const dataBytes = dataObj.data;
23029
+ let buf;
23030
+ if (typeof dataBytes === 'string') {
23031
+ const hex = dataBytes.startsWith('0x') ? dataBytes.slice(2) : dataBytes;
23032
+ buf = Buffer.from(hex, 'hex');
23033
+ }
23034
+ else if (Buffer.isBuffer(dataBytes)) {
23035
+ buf = dataBytes;
23036
+ }
23037
+ else {
23038
+ buf = Buffer.alloc(0);
23039
+ }
23040
+ bb.writeVarint32(buf.length);
23041
+ bb.append(buf);
23042
+ }
23043
+ /**
23044
+ * Serialize custom_binary operation.
23045
+ * Fields: id (string), data (bytes).
23046
+ */
23047
+ function serializeCustomBinary(bb, data) {
23048
+ const dataObj = data;
23049
+ writeString(bb, String(dataObj.id || ''));
23050
+ const dataBytes = dataObj.data;
23051
+ let buf;
23052
+ if (typeof dataBytes === 'string') {
23053
+ const hex = dataBytes.startsWith('0x') ? dataBytes.slice(2) : dataBytes;
23054
+ buf = Buffer.from(hex, 'hex');
23055
+ }
23056
+ else if (Buffer.isBuffer(dataBytes)) {
23057
+ buf = dataBytes;
23058
+ }
23059
+ else {
23060
+ buf = Buffer.alloc(0);
23061
+ }
23062
+ bb.writeVarint32(buf.length);
23063
+ bb.append(buf);
23064
+ }
23065
+ /**
23066
+ * Serialize comment_options operation.
23067
+ * Fields: author, permlink, max_accepted_payout, percent_steem_dollars, allow_votes, allow_curation_rewards, extensions.
23068
+ */
23069
+ function serializeCommentOptions(bb, data) {
23070
+ const dataObj = data;
23071
+ writeString(bb, String(dataObj.author || ''));
23072
+ writeString(bb, String(dataObj.permlink || ''));
23073
+ serializeAsset(bb, String(dataObj.max_accepted_payout || '1000000.000 SBD'));
23074
+ bb.writeUint16(dataObj.percent_steem_dollars ?? 0);
23075
+ serializeBool(bb, dataObj.allow_votes);
23076
+ serializeBool(bb, dataObj.allow_curation_rewards);
23077
+ serializeExtensions(bb, dataObj.extensions);
23078
+ }
22273
23079
  /**
22274
23080
  * Serialize custom_json operation
22275
23081
  */
@@ -22341,7 +23147,12 @@ function serializeAuthority(bb, auth) {
22341
23147
  }
22342
23148
  }
22343
23149
  /**
22344
- * Serialize asset (simplified)
23150
+ * Serialize asset (STEEM/SBD/VESTS style string) to binary.
23151
+ *
23152
+ * Format: int64 amount (little-endian) + uint8 precision + 7-byte symbol (UTF-8, null-padded).
23153
+ *
23154
+ * This helper is reused across all operations中涉及资产字段的地方,例如:
23155
+ * - amount / vesting_shares / reward_* / *_pays
22345
23156
  */
22346
23157
  function serializeAsset(bb, amount) {
22347
23158
  const parts = amount.split(' ');
@@ -22350,7 +23161,6 @@ function serializeAsset(bb, amount) {
22350
23161
  const [intPart, decPart = ''] = valueStr.split('.');
22351
23162
  const precision = decPart.length;
22352
23163
  const amountValue = parseInt(intPart + decPart.padEnd(precision, '0'), 10) || 0;
22353
- // ByteBuffer can accept number directly for small values
22354
23164
  bb.writeInt64(amountValue);
22355
23165
  bb.writeUint8(precision);
22356
23166
  const symbolBytes = Buffer.from(symbol, 'utf8');
@@ -22360,11 +23170,70 @@ function serializeAsset(bb, amount) {
22360
23170
  }
22361
23171
  }
22362
23172
  /**
22363
- * Write a string using ByteBuffer's writeVString method
23173
+ * Write a string using ByteBuffer's writeVString method.
23174
+ * 所有字符串字段统一通过该 helper 序列化,避免直接到处调用 ByteBuffer API。
22364
23175
  */
22365
23176
  function writeString(bb, str) {
22366
23177
  bb.writeVString(str);
22367
23178
  }
23179
+ /**
23180
+ * Serialize a time_point_sec-style field.
23181
+ *
23182
+ * 接受 ISO 字符串 / Date / 秒级数字,最终写入 uint32(自 epoch 起的秒数)。
23183
+ * 常用于 proposal start/end、escrow_deadline 等字段。
23184
+ */
23185
+ function serializeTimePointSec(bb, value) {
23186
+ let seconds;
23187
+ if (typeof value === 'string') {
23188
+ const iso = value.endsWith('Z') ? value : `${value}Z`;
23189
+ const d = new Date(iso);
23190
+ seconds = Math.floor(d.getTime() / 1000);
23191
+ }
23192
+ else if (value instanceof Date) {
23193
+ seconds = Math.floor(value.getTime() / 1000);
23194
+ }
23195
+ else if (typeof value === 'number') {
23196
+ // 这里假定已是秒级时间戳
23197
+ seconds = value;
23198
+ }
23199
+ else {
23200
+ seconds = 0;
23201
+ }
23202
+ bb.writeUint32(seconds);
23203
+ }
23204
+ /**
23205
+ * Serialize a generic bool flag as uint8(0/1).
23206
+ * 后续在多处 optional / approve / decline 字段可统一复用。
23207
+ */
23208
+ function serializeBool(bb, value) {
23209
+ bb.writeUint8(value ? 1 : 0);
23210
+ }
23211
+ /**
23212
+ * Serialize a future_extensions / extensions 风格字段。
23213
+ *
23214
+ * 目前大多数链上交易中 extensions 仍为空集合,协议格式是:
23215
+ * - varint32 length
23216
+ * - 后续按约定序列化各元素(当前实现仅支持空或简单 JSON 字符串)
23217
+ *
23218
+ * 为兼容现有使用场景,这里暂时只写入长度,忽略实际内容;当需要支持
23219
+ * 具体 extension 类型时,可以在保持签名兼容性的前提下扩展实现。
23220
+ */
23221
+ function serializeExtensions(bb, extensions) {
23222
+ if (!Array.isArray(extensions) || extensions.length === 0) {
23223
+ bb.writeVarint32(0);
23224
+ return;
23225
+ }
23226
+ // 协议上 extensions 是 future_extensions,目前主网基本为 0。
23227
+ // 为避免序列化出与 C++ 节点不兼容的数据,这里保守起见仍写入 0。
23228
+ // 如果未来需要支持非空 extensions,可在测试验证后放开以下逻辑:
23229
+ //
23230
+ // bb.writeVarint32(extensions.length);
23231
+ // for (const ext of extensions) {
23232
+ // const json = JSON.stringify(ext ?? null);
23233
+ // writeString(bb, json);
23234
+ // }
23235
+ bb.writeVarint32(0);
23236
+ }
22368
23237
 
22369
23238
  class Serializer {
22370
23239
  static fromBuffer(buffer) {
@@ -25837,7 +26706,7 @@ const steem = {
25837
26706
  operations,
25838
26707
  serializer,
25839
26708
  utils: utils$3,
25840
- version: '1.0.12',
26709
+ version: '1.0.13',
25841
26710
  config: {
25842
26711
  set: (options) => {
25843
26712
  // If nodes is provided, extract the first node as url for API