@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.umd.js CHANGED
@@ -25169,9 +25169,45 @@
25169
25169
  'account_witness_proxy': 13,
25170
25170
  'pow': 14,
25171
25171
  'custom': 15,
25172
+ 'report_over_production': 16,
25172
25173
  'delete_comment': 17,
25173
25174
  'custom_json': 18,
25174
25175
  'comment_options': 19,
25176
+ 'set_withdraw_vesting_route': 20,
25177
+ 'limit_order_create2': 21,
25178
+ 'claim_account': 22,
25179
+ 'create_claimed_account': 23,
25180
+ 'request_account_recovery': 24,
25181
+ 'recover_account': 25,
25182
+ 'change_recovery_account': 26,
25183
+ 'escrow_transfer': 27,
25184
+ 'escrow_dispute': 28,
25185
+ 'escrow_release': 29,
25186
+ 'pow2': 30,
25187
+ 'escrow_approve': 31,
25188
+ 'transfer_to_savings': 32,
25189
+ 'transfer_from_savings': 33,
25190
+ 'cancel_transfer_from_savings': 34,
25191
+ 'custom_binary': 35,
25192
+ 'decline_voting_rights': 36,
25193
+ 'reset_account': 37,
25194
+ 'set_reset_account': 38,
25195
+ 'claim_reward_balance': 39,
25196
+ 'delegate_vesting_shares': 40,
25197
+ 'account_create_with_delegation': 41,
25198
+ 'witness_set_properties': 42,
25199
+ 'account_update2': 43,
25200
+ 'create_proposal': 44,
25201
+ 'update_proposal_votes': 45,
25202
+ 'remove_proposal': 46,
25203
+ 'claim_reward_balance2': 47,
25204
+ 'fill_convert_request': 48,
25205
+ 'comment_reward': 49,
25206
+ 'liquidity_reward': 50,
25207
+ 'interest': 51,
25208
+ 'fill_vesting_withdraw': 52,
25209
+ 'fill_order': 53,
25210
+ 'fill_transfer_from_savings': 54,
25175
25211
  };
25176
25212
  const index = opMap[opType];
25177
25213
  if (index === undefined) {
@@ -25196,6 +25232,135 @@
25196
25232
  case 'account_create':
25197
25233
  serializeAccountCreate(bb, opData);
25198
25234
  break;
25235
+ case 'account_update':
25236
+ serializeAccountUpdate(bb, opData);
25237
+ break;
25238
+ case 'account_create_with_delegation':
25239
+ serializeAccountCreateWithDelegation(bb, opData);
25240
+ break;
25241
+ case 'create_claimed_account':
25242
+ serializeCreateClaimedAccount(bb, opData);
25243
+ break;
25244
+ case 'account_update2':
25245
+ serializeAccountUpdate2(bb, opData);
25246
+ break;
25247
+ case 'request_account_recovery':
25248
+ serializeRequestAccountRecovery(bb, opData);
25249
+ break;
25250
+ case 'recover_account':
25251
+ serializeRecoverAccount(bb, opData);
25252
+ break;
25253
+ case 'change_recovery_account':
25254
+ serializeChangeRecoveryAccount(bb, opData);
25255
+ break;
25256
+ case 'reset_account':
25257
+ serializeResetAccount(bb, opData);
25258
+ break;
25259
+ case 'set_reset_account':
25260
+ serializeSetResetAccount(bb, opData);
25261
+ break;
25262
+ case 'decline_voting_rights':
25263
+ serializeDeclineVotingRights(bb, opData);
25264
+ break;
25265
+ case 'transfer_to_vesting':
25266
+ serializeTransferToVesting(bb, opData);
25267
+ break;
25268
+ case 'withdraw_vesting':
25269
+ serializeWithdrawVesting(bb, opData);
25270
+ break;
25271
+ case 'set_withdraw_vesting_route':
25272
+ serializeSetWithdrawVestingRoute(bb, opData);
25273
+ break;
25274
+ case 'transfer_to_savings':
25275
+ serializeTransferToSavings(bb, opData);
25276
+ break;
25277
+ case 'transfer_from_savings':
25278
+ serializeTransferFromSavings(bb, opData);
25279
+ break;
25280
+ case 'cancel_transfer_from_savings':
25281
+ serializeCancelTransferFromSavings(bb, opData);
25282
+ break;
25283
+ case 'limit_order_create':
25284
+ serializeLimitOrderCreate(bb, opData);
25285
+ break;
25286
+ case 'limit_order_create2':
25287
+ serializeLimitOrderCreate2(bb, opData);
25288
+ break;
25289
+ case 'limit_order_cancel':
25290
+ serializeLimitOrderCancel(bb, opData);
25291
+ break;
25292
+ case 'feed_publish':
25293
+ serializeFeedPublish(bb, opData);
25294
+ break;
25295
+ case 'convert':
25296
+ serializeConvert(bb, opData);
25297
+ break;
25298
+ case 'fill_order':
25299
+ serializeFillOrder(bb, opData);
25300
+ break;
25301
+ case 'escrow_transfer':
25302
+ serializeEscrowTransfer(bb, opData);
25303
+ break;
25304
+ case 'escrow_dispute':
25305
+ serializeEscrowDispute(bb, opData);
25306
+ break;
25307
+ case 'escrow_release':
25308
+ serializeEscrowRelease(bb, opData);
25309
+ break;
25310
+ case 'escrow_approve':
25311
+ serializeEscrowApprove(bb, opData);
25312
+ break;
25313
+ case 'claim_reward_balance':
25314
+ serializeClaimRewardBalance(bb, opData);
25315
+ break;
25316
+ case 'claim_reward_balance2':
25317
+ serializeClaimRewardBalance2(bb, opData);
25318
+ break;
25319
+ case 'comment_reward':
25320
+ serializeCommentReward(bb, opData);
25321
+ break;
25322
+ case 'liquidity_reward':
25323
+ serializeLiquidityReward(bb, opData);
25324
+ break;
25325
+ case 'interest':
25326
+ serializeInterest(bb, opData);
25327
+ break;
25328
+ case 'fill_vesting_withdraw':
25329
+ serializeFillVestingWithdraw(bb, opData);
25330
+ break;
25331
+ case 'fill_convert_request':
25332
+ serializeFillConvertRequest(bb, opData);
25333
+ break;
25334
+ case 'fill_transfer_from_savings':
25335
+ serializeFillTransferFromSavings(bb, opData);
25336
+ break;
25337
+ case 'pow':
25338
+ serializePow(bb, opData);
25339
+ break;
25340
+ case 'pow2':
25341
+ serializePow2(bb, opData);
25342
+ break;
25343
+ case 'witness_update':
25344
+ serializeWitnessUpdate(bb, opData);
25345
+ break;
25346
+ case 'witness_set_properties':
25347
+ serializeWitnessSetProperties(bb, opData);
25348
+ break;
25349
+ case 'account_witness_vote':
25350
+ serializeAccountWitnessVote(bb, opData);
25351
+ break;
25352
+ case 'account_witness_proxy':
25353
+ serializeAccountWitnessProxy(bb, opData);
25354
+ break;
25355
+ case 'custom':
25356
+ serializeCustom(bb, opData);
25357
+ break;
25358
+ case 'custom_binary':
25359
+ serializeCustomBinary(bb, opData);
25360
+ break;
25361
+ case 'comment_options':
25362
+ serializeCommentOptions(bb, opData);
25363
+ break;
25199
25364
  case 'custom_json':
25200
25365
  serializeCustomJson(bb, opData);
25201
25366
  break;
@@ -25265,6 +25430,647 @@
25265
25430
  }
25266
25431
  writeString(bb, String(dataObj.json_metadata || ''));
25267
25432
  }
25433
+ /**
25434
+ * Serialize account_update operation.
25435
+ * Format: account, optional owner (1 byte + authority?), optional active, optional posting, memo_key, json_metadata.
25436
+ */
25437
+ function serializeAccountUpdate(bb, data) {
25438
+ const dataObj = data;
25439
+ writeString(bb, String(dataObj.account || ''));
25440
+ // Optional authorities: 0 = not present, 1 = present then serialize authority
25441
+ if (dataObj.owner != null && dataObj.owner !== '') {
25442
+ bb.writeUint8(1);
25443
+ serializeAuthority(bb, typeof dataObj.owner === 'object' ? dataObj.owner : { weight_threshold: 1, account_auths: [], key_auths: [] });
25444
+ }
25445
+ else {
25446
+ bb.writeUint8(0);
25447
+ }
25448
+ if (dataObj.active != null && dataObj.active !== '') {
25449
+ bb.writeUint8(1);
25450
+ serializeAuthority(bb, typeof dataObj.active === 'object' ? dataObj.active : { weight_threshold: 1, account_auths: [], key_auths: [] });
25451
+ }
25452
+ else {
25453
+ bb.writeUint8(0);
25454
+ }
25455
+ if (dataObj.posting != null && dataObj.posting !== '') {
25456
+ bb.writeUint8(1);
25457
+ serializeAuthority(bb, typeof dataObj.posting === 'object' ? dataObj.posting : { weight_threshold: 1, account_auths: [], key_auths: [] });
25458
+ }
25459
+ else {
25460
+ bb.writeUint8(0);
25461
+ }
25462
+ // memo_key (public key, required)
25463
+ if (typeof dataObj.memo_key === 'string') {
25464
+ const pubKey = PublicKey.fromStringOrThrow(dataObj.memo_key);
25465
+ bb.append(pubKey.toBuffer());
25466
+ }
25467
+ else if (buffer.Buffer.isBuffer(dataObj.memo_key)) {
25468
+ bb.append(dataObj.memo_key);
25469
+ }
25470
+ else if (dataObj.memo_key && typeof dataObj.memo_key.toBuffer === 'function') {
25471
+ bb.append(dataObj.memo_key.toBuffer());
25472
+ }
25473
+ else {
25474
+ throw new Error('Invalid memo_key format');
25475
+ }
25476
+ writeString(bb, typeof dataObj.json_metadata === 'string'
25477
+ ? dataObj.json_metadata
25478
+ : dataObj.json_metadata != null
25479
+ ? JSON.stringify(dataObj.json_metadata)
25480
+ : '');
25481
+ }
25482
+ /**
25483
+ * Serialize account_create_with_delegation operation.
25484
+ * Fields (see FC_REFLECT): fee, delegation, creator, new_account_name,
25485
+ * owner, active, posting, memo_key, json_metadata, extensions.
25486
+ */
25487
+ function serializeAccountCreateWithDelegation(bb, data) {
25488
+ const dataObj = data;
25489
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
25490
+ serializeAsset(bb, String(dataObj.delegation || '0.000 VESTS'));
25491
+ writeString(bb, String(dataObj.creator || ''));
25492
+ writeString(bb, String(dataObj.new_account_name || ''));
25493
+ serializeAuthority(bb, dataObj.owner);
25494
+ serializeAuthority(bb, dataObj.active);
25495
+ serializeAuthority(bb, dataObj.posting);
25496
+ const memoKey = String(dataObj.memo_key || '');
25497
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
25498
+ bb.append(pubKey.toBuffer());
25499
+ writeString(bb, String(dataObj.json_metadata || ''));
25500
+ serializeExtensions(bb, dataObj.extensions);
25501
+ }
25502
+ /**
25503
+ * Serialize create_claimed_account operation.
25504
+ * Fields: creator, new_account_name, owner, active, posting,
25505
+ * memo_key, json_metadata, extensions.
25506
+ */
25507
+ function serializeCreateClaimedAccount(bb, data) {
25508
+ const dataObj = data;
25509
+ writeString(bb, String(dataObj.creator || ''));
25510
+ writeString(bb, String(dataObj.new_account_name || ''));
25511
+ serializeAuthority(bb, dataObj.owner);
25512
+ serializeAuthority(bb, dataObj.active);
25513
+ serializeAuthority(bb, dataObj.posting);
25514
+ const memoKey = String(dataObj.memo_key || '');
25515
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
25516
+ bb.append(pubKey.toBuffer());
25517
+ writeString(bb, String(dataObj.json_metadata || ''));
25518
+ serializeExtensions(bb, dataObj.extensions);
25519
+ }
25520
+ /**
25521
+ * Serialize account_update2 operation.
25522
+ * Fields: account, owner, active, posting, memo_key,
25523
+ * json_metadata, posting_json_metadata, extensions.
25524
+ */
25525
+ function serializeAccountUpdate2(bb, data) {
25526
+ const dataObj = data;
25527
+ writeString(bb, String(dataObj.account || ''));
25528
+ serializeAuthority(bb, dataObj.owner);
25529
+ serializeAuthority(bb, dataObj.active);
25530
+ serializeAuthority(bb, dataObj.posting);
25531
+ const memoKey = String(dataObj.memo_key || '');
25532
+ const pubKey = PublicKey.fromStringOrThrow(memoKey);
25533
+ bb.append(pubKey.toBuffer());
25534
+ writeString(bb, String(dataObj.json_metadata || ''));
25535
+ writeString(bb, String(dataObj.posting_json_metadata || ''));
25536
+ serializeExtensions(bb, dataObj.extensions);
25537
+ }
25538
+ /**
25539
+ * Serialize request_account_recovery operation.
25540
+ * Fields: recovery_account, account_to_recover, new_owner_authority, extensions.
25541
+ */
25542
+ function serializeRequestAccountRecovery(bb, data) {
25543
+ const dataObj = data;
25544
+ writeString(bb, String(dataObj.recovery_account || ''));
25545
+ writeString(bb, String(dataObj.account_to_recover || ''));
25546
+ serializeAuthority(bb, dataObj.new_owner_authority);
25547
+ serializeExtensions(bb, dataObj.extensions);
25548
+ }
25549
+ /**
25550
+ * Serialize recover_account operation.
25551
+ * Fields: account_to_recover, new_owner_authority, recent_owner_authority, extensions.
25552
+ */
25553
+ function serializeRecoverAccount(bb, data) {
25554
+ const dataObj = data;
25555
+ writeString(bb, String(dataObj.account_to_recover || ''));
25556
+ serializeAuthority(bb, dataObj.new_owner_authority);
25557
+ serializeAuthority(bb, dataObj.recent_owner_authority);
25558
+ serializeExtensions(bb, dataObj.extensions);
25559
+ }
25560
+ /**
25561
+ * Serialize change_recovery_account operation.
25562
+ * Fields: account_to_recover, new_recovery_account, extensions.
25563
+ */
25564
+ function serializeChangeRecoveryAccount(bb, data) {
25565
+ const dataObj = data;
25566
+ writeString(bb, String(dataObj.account_to_recover || ''));
25567
+ writeString(bb, String(dataObj.new_recovery_account || ''));
25568
+ serializeExtensions(bb, dataObj.extensions);
25569
+ }
25570
+ /**
25571
+ * Serialize reset_account operation.
25572
+ * Fields: reset_account, account_to_reset, new_owner_authority.
25573
+ */
25574
+ function serializeResetAccount(bb, data) {
25575
+ const dataObj = data;
25576
+ writeString(bb, String(dataObj.reset_account || ''));
25577
+ writeString(bb, String(dataObj.account_to_reset || ''));
25578
+ serializeAuthority(bb, dataObj.new_owner_authority);
25579
+ }
25580
+ /**
25581
+ * Serialize set_reset_account operation.
25582
+ * Fields: account, reset_account.
25583
+ */
25584
+ function serializeSetResetAccount(bb, data) {
25585
+ const dataObj = data;
25586
+ writeString(bb, String(dataObj.account || ''));
25587
+ writeString(bb, String(dataObj.reset_account || ''));
25588
+ }
25589
+ /**
25590
+ * Serialize decline_voting_rights operation.
25591
+ * Fields: account, decline.
25592
+ */
25593
+ function serializeDeclineVotingRights(bb, data) {
25594
+ const dataObj = data;
25595
+ writeString(bb, String(dataObj.account || ''));
25596
+ serializeBool(bb, dataObj.decline);
25597
+ }
25598
+ /**
25599
+ * Serialize transfer_to_vesting operation.
25600
+ * Fields: from, to, amount.
25601
+ */
25602
+ function serializeTransferToVesting(bb, data) {
25603
+ const dataObj = data;
25604
+ writeString(bb, String(dataObj.from || ''));
25605
+ writeString(bb, String(dataObj.to || ''));
25606
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
25607
+ }
25608
+ /**
25609
+ * Serialize withdraw_vesting operation.
25610
+ * Fields: account, vesting_shares.
25611
+ */
25612
+ function serializeWithdrawVesting(bb, data) {
25613
+ const dataObj = data;
25614
+ writeString(bb, String(dataObj.account || ''));
25615
+ serializeAsset(bb, String(dataObj.vesting_shares || '0.000 VESTS'));
25616
+ }
25617
+ /**
25618
+ * Serialize set_withdraw_vesting_route operation.
25619
+ * Fields: from_account, to_account, percent, auto_vest.
25620
+ */
25621
+ function serializeSetWithdrawVestingRoute(bb, data) {
25622
+ const dataObj = data;
25623
+ writeString(bb, String(dataObj.from_account || ''));
25624
+ writeString(bb, String(dataObj.to_account || ''));
25625
+ // percent is uint16
25626
+ bb.writeUint16(dataObj.percent ?? 0);
25627
+ serializeBool(bb, dataObj.auto_vest);
25628
+ }
25629
+ /**
25630
+ * Serialize transfer_to_savings operation.
25631
+ * Fields: from, to, amount, memo.
25632
+ */
25633
+ function serializeTransferToSavings(bb, data) {
25634
+ const dataObj = data;
25635
+ writeString(bb, String(dataObj.from || ''));
25636
+ writeString(bb, String(dataObj.to || ''));
25637
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
25638
+ writeString(bb, String(dataObj.memo || ''));
25639
+ }
25640
+ /**
25641
+ * Serialize transfer_from_savings operation.
25642
+ * Fields: from, request_id, to, amount, memo.
25643
+ */
25644
+ function serializeTransferFromSavings(bb, data) {
25645
+ const dataObj = data;
25646
+ writeString(bb, String(dataObj.from || ''));
25647
+ bb.writeUint32(dataObj.request_id ?? dataObj.requestID ?? 0);
25648
+ writeString(bb, String(dataObj.to || ''));
25649
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
25650
+ writeString(bb, String(dataObj.memo || ''));
25651
+ }
25652
+ /**
25653
+ * Serialize cancel_transfer_from_savings operation.
25654
+ * Fields: from, request_id.
25655
+ */
25656
+ function serializeCancelTransferFromSavings(bb, data) {
25657
+ const dataObj = data;
25658
+ writeString(bb, String(dataObj.from || ''));
25659
+ bb.writeUint32(dataObj.request_id ?? dataObj.requestID ?? 0);
25660
+ }
25661
+ /**
25662
+ * Serialize limit_order_create operation.
25663
+ * Fields: owner, orderid, amount_to_sell, min_to_receive, fill_or_kill, expiration.
25664
+ */
25665
+ function serializeLimitOrderCreate(bb, data) {
25666
+ const dataObj = data;
25667
+ writeString(bb, String(dataObj.owner || ''));
25668
+ bb.writeUint32(dataObj.orderid ?? 0);
25669
+ serializeAsset(bb, String(dataObj.amount_to_sell || '0.000 STEEM'));
25670
+ serializeAsset(bb, String(dataObj.min_to_receive || '0.000 STEEM'));
25671
+ serializeBool(bb, dataObj.fill_or_kill);
25672
+ serializeTimePointSec(bb, dataObj.expiration);
25673
+ }
25674
+ /**
25675
+ * Serialize limit_order_create2 operation.
25676
+ * Fields: owner, orderid, amount_to_sell, exchange_rate{base, quote}, fill_or_kill, expiration.
25677
+ */
25678
+ function serializeLimitOrderCreate2(bb, data) {
25679
+ const dataObj = data;
25680
+ writeString(bb, String(dataObj.owner || ''));
25681
+ bb.writeUint32(dataObj.orderid ?? 0);
25682
+ serializeAsset(bb, String(dataObj.amount_to_sell || '0.000 STEEM'));
25683
+ const rate = (dataObj.exchange_rate ?? dataObj.exchangeRate);
25684
+ const base = rate?.base ?? '0.000 STEEM';
25685
+ const quote = rate?.quote ?? '0.000 SBD';
25686
+ serializeAsset(bb, String(base));
25687
+ serializeAsset(bb, String(quote));
25688
+ serializeBool(bb, dataObj.fill_or_kill);
25689
+ serializeTimePointSec(bb, dataObj.expiration);
25690
+ }
25691
+ /**
25692
+ * Serialize limit_order_cancel operation.
25693
+ * Fields: owner, orderid.
25694
+ */
25695
+ function serializeLimitOrderCancel(bb, data) {
25696
+ const dataObj = data;
25697
+ writeString(bb, String(dataObj.owner || ''));
25698
+ bb.writeUint32(dataObj.orderid ?? 0);
25699
+ }
25700
+ /**
25701
+ * Serialize feed_publish operation.
25702
+ * Fields: publisher, exchange_rate{base, quote}.
25703
+ */
25704
+ function serializeFeedPublish(bb, data) {
25705
+ const dataObj = data;
25706
+ writeString(bb, String(dataObj.publisher || ''));
25707
+ const rate = (dataObj.exchange_rate ?? dataObj.exchangeRate);
25708
+ const base = rate?.base ?? '0.000 STEEM';
25709
+ const quote = rate?.quote ?? '0.000 SBD';
25710
+ serializeAsset(bb, String(base));
25711
+ serializeAsset(bb, String(quote));
25712
+ }
25713
+ /**
25714
+ * Serialize convert operation.
25715
+ * Fields: owner, requestid, amount.
25716
+ */
25717
+ function serializeConvert(bb, data) {
25718
+ const dataObj = data;
25719
+ writeString(bb, String(dataObj.owner || ''));
25720
+ bb.writeUint32(dataObj.requestid ?? dataObj.request_id ?? 0);
25721
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
25722
+ }
25723
+ /**
25724
+ * Serialize fill_order operation (virtual).
25725
+ * Fields: current_owner, current_orderid, current_pays,
25726
+ * open_owner, open_orderid, open_pays.
25727
+ */
25728
+ function serializeFillOrder(bb, data) {
25729
+ const dataObj = data;
25730
+ writeString(bb, String(dataObj.current_owner || ''));
25731
+ bb.writeUint32(dataObj.current_orderid ?? 0);
25732
+ serializeAsset(bb, String(dataObj.current_pays || '0.000 STEEM'));
25733
+ writeString(bb, String(dataObj.open_owner || ''));
25734
+ bb.writeUint32(dataObj.open_orderid ?? 0);
25735
+ serializeAsset(bb, String(dataObj.open_pays || '0.000 STEEM'));
25736
+ }
25737
+ /**
25738
+ * Serialize escrow_transfer operation.
25739
+ * Fields: from, to, sbd_amount, steem_amount, escrow_id, agent,
25740
+ * fee, json_meta, ratification_deadline, escrow_expiration.
25741
+ */
25742
+ function serializeEscrowTransfer(bb, data) {
25743
+ const dataObj = data;
25744
+ writeString(bb, String(dataObj.from || ''));
25745
+ writeString(bb, String(dataObj.to || ''));
25746
+ serializeAsset(bb, String(dataObj.sbd_amount || '0.000 SBD'));
25747
+ serializeAsset(bb, String(dataObj.steem_amount || '0.000 STEEM'));
25748
+ bb.writeUint32(dataObj.escrow_id ?? 0);
25749
+ writeString(bb, String(dataObj.agent || ''));
25750
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
25751
+ writeString(bb, String(dataObj.json_meta || ''));
25752
+ serializeTimePointSec(bb, dataObj.ratification_deadline);
25753
+ serializeTimePointSec(bb, dataObj.escrow_expiration);
25754
+ }
25755
+ /**
25756
+ * Serialize escrow_dispute operation.
25757
+ * Fields: from, to, who, escrow_id.
25758
+ */
25759
+ function serializeEscrowDispute(bb, data) {
25760
+ const dataObj = data;
25761
+ writeString(bb, String(dataObj.from || ''));
25762
+ writeString(bb, String(dataObj.to || ''));
25763
+ writeString(bb, String(dataObj.who || ''));
25764
+ bb.writeUint32(dataObj.escrow_id ?? 0);
25765
+ }
25766
+ /**
25767
+ * Serialize escrow_release operation.
25768
+ * Fields: from, to, who, escrow_id, sbd_amount, steem_amount.
25769
+ */
25770
+ function serializeEscrowRelease(bb, data) {
25771
+ const dataObj = data;
25772
+ writeString(bb, String(dataObj.from || ''));
25773
+ writeString(bb, String(dataObj.to || ''));
25774
+ writeString(bb, String(dataObj.who || ''));
25775
+ bb.writeUint32(dataObj.escrow_id ?? 0);
25776
+ serializeAsset(bb, String(dataObj.sbd_amount || '0.000 SBD'));
25777
+ serializeAsset(bb, String(dataObj.steem_amount || '0.000 STEEM'));
25778
+ }
25779
+ /**
25780
+ * Serialize escrow_approve operation.
25781
+ * Fields: from, to, agent, who, escrow_id, approve.
25782
+ */
25783
+ function serializeEscrowApprove(bb, data) {
25784
+ const dataObj = data;
25785
+ writeString(bb, String(dataObj.from || ''));
25786
+ writeString(bb, String(dataObj.to || ''));
25787
+ writeString(bb, String(dataObj.agent || ''));
25788
+ writeString(bb, String(dataObj.who || ''));
25789
+ bb.writeUint32(dataObj.escrow_id ?? 0);
25790
+ serializeBool(bb, dataObj.approve);
25791
+ }
25792
+ /**
25793
+ * Serialize claim_reward_balance operation.
25794
+ * Fields: account, reward_steem, reward_sbd, reward_vests.
25795
+ */
25796
+ function serializeClaimRewardBalance(bb, data) {
25797
+ const dataObj = data;
25798
+ writeString(bb, String(dataObj.account || ''));
25799
+ serializeAsset(bb, String(dataObj.reward_steem || '0.000 STEEM'));
25800
+ serializeAsset(bb, String(dataObj.reward_sbd || '0.000 SBD'));
25801
+ serializeAsset(bb, String(dataObj.reward_vests || '0.000000 VESTS'));
25802
+ }
25803
+ /**
25804
+ * Serialize claim_reward_balance2 operation.
25805
+ * Fields: account, extensions, reward_tokens (array of asset strings).
25806
+ */
25807
+ function serializeClaimRewardBalance2(bb, data) {
25808
+ const dataObj = data;
25809
+ writeString(bb, String(dataObj.account || ''));
25810
+ serializeExtensions(bb, dataObj.extensions);
25811
+ const tokens = Array.isArray(dataObj.reward_tokens) ? dataObj.reward_tokens : [];
25812
+ bb.writeVarint32(tokens.length);
25813
+ for (const tok of tokens) {
25814
+ serializeAsset(bb, typeof tok === 'string' ? tok : String(tok));
25815
+ }
25816
+ }
25817
+ /**
25818
+ * Serialize comment_reward operation.
25819
+ * Fields: author, permlink, payout.
25820
+ */
25821
+ function serializeCommentReward(bb, data) {
25822
+ const dataObj = data;
25823
+ writeString(bb, String(dataObj.author || ''));
25824
+ writeString(bb, String(dataObj.permlink || ''));
25825
+ serializeAsset(bb, String(dataObj.payout || '0.000 STEEM'));
25826
+ }
25827
+ /**
25828
+ * Serialize liquidity_reward operation.
25829
+ * Fields: owner, payout.
25830
+ */
25831
+ function serializeLiquidityReward(bb, data) {
25832
+ const dataObj = data;
25833
+ writeString(bb, String(dataObj.owner || ''));
25834
+ serializeAsset(bb, String(dataObj.payout || '0.000 STEEM'));
25835
+ }
25836
+ /**
25837
+ * Serialize interest operation.
25838
+ * Fields: owner, interest.
25839
+ */
25840
+ function serializeInterest(bb, data) {
25841
+ const dataObj = data;
25842
+ writeString(bb, String(dataObj.owner || ''));
25843
+ serializeAsset(bb, String(dataObj.interest || '0.000 STEEM'));
25844
+ }
25845
+ /**
25846
+ * Serialize fill_vesting_withdraw operation.
25847
+ * Fields: from_account, to_account, withdrawn, deposited.
25848
+ */
25849
+ function serializeFillVestingWithdraw(bb, data) {
25850
+ const dataObj = data;
25851
+ writeString(bb, String(dataObj.from_account || ''));
25852
+ writeString(bb, String(dataObj.to_account || ''));
25853
+ serializeAsset(bb, String(dataObj.withdrawn || '0.000000 VESTS'));
25854
+ serializeAsset(bb, String(dataObj.deposited || '0.000 STEEM'));
25855
+ }
25856
+ /**
25857
+ * Serialize fill_convert_request operation.
25858
+ * Fields: owner, requestid, amount_in, amount_out.
25859
+ */
25860
+ function serializeFillConvertRequest(bb, data) {
25861
+ const dataObj = data;
25862
+ writeString(bb, String(dataObj.owner || ''));
25863
+ bb.writeUint32(dataObj.requestid ?? 0);
25864
+ serializeAsset(bb, String(dataObj.amount_in || '0.000 STEEM'));
25865
+ serializeAsset(bb, String(dataObj.amount_out || '0.000 STEEM'));
25866
+ }
25867
+ /**
25868
+ * Serialize fill_transfer_from_savings operation.
25869
+ * Fields: from, to, amount, request_id, memo.
25870
+ */
25871
+ function serializeFillTransferFromSavings(bb, data) {
25872
+ const dataObj = data;
25873
+ writeString(bb, String(dataObj.from || ''));
25874
+ writeString(bb, String(dataObj.to || ''));
25875
+ serializeAsset(bb, String(dataObj.amount || '0.000 STEEM'));
25876
+ bb.writeUint32(dataObj.request_id ?? 0);
25877
+ writeString(bb, String(dataObj.memo || ''));
25878
+ }
25879
+ /**
25880
+ * Serialize ChainProperties (used in pow, witness_update).
25881
+ * Fields: account_creation_fee (asset string), maximum_block_size (uint32), sbd_interest_rate (uint16).
25882
+ */
25883
+ function serializeChainProperties(bb, props) {
25884
+ const p = props || {};
25885
+ const fee = p.account_creation_fee;
25886
+ if (typeof fee === 'string' && fee.split(' ').length >= 2) {
25887
+ serializeAsset(bb, fee);
25888
+ }
25889
+ else {
25890
+ serializeAsset(bb, '0.000 STEEM');
25891
+ }
25892
+ bb.writeUint32(p.maximum_block_size ?? 0);
25893
+ bb.writeUint16(p.sbd_interest_rate ?? 0);
25894
+ }
25895
+ /**
25896
+ * Serialize POW inner struct (worker, input, signature, work).
25897
+ */
25898
+ function serializePOWInner(bb, work) {
25899
+ const w = work || {};
25900
+ writeString(bb, String(w.worker || ''));
25901
+ writeString(bb, String(w.input || ''));
25902
+ writeString(bb, String(w.signature || ''));
25903
+ writeString(bb, String(w.work || ''));
25904
+ }
25905
+ /**
25906
+ * Serialize pow operation.
25907
+ * Fields: worker_account, block_id, nonce (optional), work (POW), props (ChainProperties).
25908
+ */
25909
+ function serializePow(bb, data) {
25910
+ const dataObj = data;
25911
+ writeString(bb, String(dataObj.worker_account || ''));
25912
+ writeString(bb, String(dataObj.block_id || ''));
25913
+ const nonce = dataObj.nonce;
25914
+ if (nonce !== undefined && nonce !== null) {
25915
+ bb.writeUint8(1);
25916
+ bb.writeUint64(Number(nonce));
25917
+ }
25918
+ else {
25919
+ bb.writeUint8(0);
25920
+ }
25921
+ serializePOWInner(bb, dataObj.work);
25922
+ serializeChainProperties(bb, dataObj.props);
25923
+ }
25924
+ /**
25925
+ * Serialize pow2 operation.
25926
+ * Fields: input, pow_summary (opaque bytes; if string treated as hex).
25927
+ */
25928
+ function serializePow2(bb, data) {
25929
+ const dataObj = data;
25930
+ writeString(bb, String(dataObj.input || ''));
25931
+ const summary = dataObj.pow_summary;
25932
+ let bytes;
25933
+ if (typeof summary === 'string') {
25934
+ const hex = summary.startsWith('0x') ? summary.slice(2) : summary;
25935
+ bytes = buffer.Buffer.from(hex, 'hex');
25936
+ }
25937
+ else if (buffer.Buffer.isBuffer(summary)) {
25938
+ bytes = summary;
25939
+ }
25940
+ else {
25941
+ bytes = buffer.Buffer.alloc(0);
25942
+ }
25943
+ bb.writeVarint32(bytes.length);
25944
+ bb.append(bytes);
25945
+ }
25946
+ /**
25947
+ * Serialize witness_update operation.
25948
+ * Fields: owner, url, block_signing_key, props (ChainProperties), fee.
25949
+ */
25950
+ function serializeWitnessUpdate(bb, data) {
25951
+ const dataObj = data;
25952
+ writeString(bb, String(dataObj.owner || ''));
25953
+ writeString(bb, String(dataObj.url || ''));
25954
+ const key = dataObj.block_signing_key;
25955
+ if (typeof key === 'string') {
25956
+ const pubKey = PublicKey.fromStringOrThrow(key);
25957
+ bb.append(pubKey.toBuffer());
25958
+ }
25959
+ else if (buffer.Buffer.isBuffer(key)) {
25960
+ bb.append(key);
25961
+ }
25962
+ else if (key && typeof key.toBuffer === 'function') {
25963
+ bb.append(key.toBuffer());
25964
+ }
25965
+ else {
25966
+ bb.append(buffer.Buffer.alloc(33));
25967
+ }
25968
+ serializeChainProperties(bb, dataObj.props);
25969
+ serializeAsset(bb, String(dataObj.fee || '0.000 STEEM'));
25970
+ }
25971
+ /**
25972
+ * Serialize witness_set_properties operation.
25973
+ * Fields: owner, props (map string -> bytes), extensions.
25974
+ */
25975
+ function serializeWitnessSetProperties(bb, data) {
25976
+ const dataObj = data;
25977
+ writeString(bb, String(dataObj.owner || ''));
25978
+ const props = dataObj.props;
25979
+ const keys = props ? Object.keys(props).sort() : [];
25980
+ bb.writeVarint32(keys.length);
25981
+ for (const k of keys) {
25982
+ writeString(bb, k);
25983
+ const v = props[k];
25984
+ const buf = typeof v === 'string' ? buffer.Buffer.from(v, 'utf8') : buffer.Buffer.isBuffer(v) ? v : buffer.Buffer.alloc(0);
25985
+ bb.writeVarint32(buf.length);
25986
+ bb.append(buf);
25987
+ }
25988
+ serializeExtensions(bb, dataObj.extensions);
25989
+ }
25990
+ /**
25991
+ * Serialize account_witness_vote operation.
25992
+ * Fields: account, witness, approve.
25993
+ */
25994
+ function serializeAccountWitnessVote(bb, data) {
25995
+ const dataObj = data;
25996
+ writeString(bb, String(dataObj.account || ''));
25997
+ writeString(bb, String(dataObj.witness || ''));
25998
+ serializeBool(bb, dataObj.approve);
25999
+ }
26000
+ /**
26001
+ * Serialize account_witness_proxy operation.
26002
+ * Fields: account, proxy.
26003
+ */
26004
+ function serializeAccountWitnessProxy(bb, data) {
26005
+ const dataObj = data;
26006
+ writeString(bb, String(dataObj.account || ''));
26007
+ writeString(bb, String(dataObj.proxy || ''));
26008
+ }
26009
+ /**
26010
+ * Serialize custom operation (required_auths, id, data).
26011
+ * id is uint16 in protocol; data is bytes.
26012
+ */
26013
+ function serializeCustom(bb, data) {
26014
+ const dataObj = data;
26015
+ const requiredAuths = Array.isArray(dataObj.required_auths)
26016
+ ? dataObj.required_auths.slice().sort()
26017
+ : [];
26018
+ bb.writeVarint32(requiredAuths.length);
26019
+ for (const account of requiredAuths) {
26020
+ writeString(bb, String(account));
26021
+ }
26022
+ bb.writeUint16(dataObj.id ?? 0);
26023
+ const dataBytes = dataObj.data;
26024
+ let buf;
26025
+ if (typeof dataBytes === 'string') {
26026
+ const hex = dataBytes.startsWith('0x') ? dataBytes.slice(2) : dataBytes;
26027
+ buf = buffer.Buffer.from(hex, 'hex');
26028
+ }
26029
+ else if (buffer.Buffer.isBuffer(dataBytes)) {
26030
+ buf = dataBytes;
26031
+ }
26032
+ else {
26033
+ buf = buffer.Buffer.alloc(0);
26034
+ }
26035
+ bb.writeVarint32(buf.length);
26036
+ bb.append(buf);
26037
+ }
26038
+ /**
26039
+ * Serialize custom_binary operation.
26040
+ * Fields: id (string), data (bytes).
26041
+ */
26042
+ function serializeCustomBinary(bb, data) {
26043
+ const dataObj = data;
26044
+ writeString(bb, String(dataObj.id || ''));
26045
+ const dataBytes = dataObj.data;
26046
+ let buf;
26047
+ if (typeof dataBytes === 'string') {
26048
+ const hex = dataBytes.startsWith('0x') ? dataBytes.slice(2) : dataBytes;
26049
+ buf = buffer.Buffer.from(hex, 'hex');
26050
+ }
26051
+ else if (buffer.Buffer.isBuffer(dataBytes)) {
26052
+ buf = dataBytes;
26053
+ }
26054
+ else {
26055
+ buf = buffer.Buffer.alloc(0);
26056
+ }
26057
+ bb.writeVarint32(buf.length);
26058
+ bb.append(buf);
26059
+ }
26060
+ /**
26061
+ * Serialize comment_options operation.
26062
+ * Fields: author, permlink, max_accepted_payout, percent_steem_dollars, allow_votes, allow_curation_rewards, extensions.
26063
+ */
26064
+ function serializeCommentOptions(bb, data) {
26065
+ const dataObj = data;
26066
+ writeString(bb, String(dataObj.author || ''));
26067
+ writeString(bb, String(dataObj.permlink || ''));
26068
+ serializeAsset(bb, String(dataObj.max_accepted_payout || '1000000.000 SBD'));
26069
+ bb.writeUint16(dataObj.percent_steem_dollars ?? 0);
26070
+ serializeBool(bb, dataObj.allow_votes);
26071
+ serializeBool(bb, dataObj.allow_curation_rewards);
26072
+ serializeExtensions(bb, dataObj.extensions);
26073
+ }
25268
26074
  /**
25269
26075
  * Serialize custom_json operation
25270
26076
  */
@@ -25336,7 +26142,12 @@
25336
26142
  }
25337
26143
  }
25338
26144
  /**
25339
- * Serialize asset (simplified)
26145
+ * Serialize asset (STEEM/SBD/VESTS style string) to binary.
26146
+ *
26147
+ * Format: int64 amount (little-endian) + uint8 precision + 7-byte symbol (UTF-8, null-padded).
26148
+ *
26149
+ * This helper is reused across all operations中涉及资产字段的地方,例如:
26150
+ * - amount / vesting_shares / reward_* / *_pays
25340
26151
  */
25341
26152
  function serializeAsset(bb, amount) {
25342
26153
  const parts = amount.split(' ');
@@ -25345,7 +26156,6 @@
25345
26156
  const [intPart, decPart = ''] = valueStr.split('.');
25346
26157
  const precision = decPart.length;
25347
26158
  const amountValue = parseInt(intPart + decPart.padEnd(precision, '0'), 10) || 0;
25348
- // ByteBuffer can accept number directly for small values
25349
26159
  bb.writeInt64(amountValue);
25350
26160
  bb.writeUint8(precision);
25351
26161
  const symbolBytes = buffer.Buffer.from(symbol, 'utf8');
@@ -25355,11 +26165,70 @@
25355
26165
  }
25356
26166
  }
25357
26167
  /**
25358
- * Write a string using ByteBuffer's writeVString method
26168
+ * Write a string using ByteBuffer's writeVString method.
26169
+ * 所有字符串字段统一通过该 helper 序列化,避免直接到处调用 ByteBuffer API。
25359
26170
  */
25360
26171
  function writeString(bb, str) {
25361
26172
  bb.writeVString(str);
25362
26173
  }
26174
+ /**
26175
+ * Serialize a time_point_sec-style field.
26176
+ *
26177
+ * 接受 ISO 字符串 / Date / 秒级数字,最终写入 uint32(自 epoch 起的秒数)。
26178
+ * 常用于 proposal start/end、escrow_deadline 等字段。
26179
+ */
26180
+ function serializeTimePointSec(bb, value) {
26181
+ let seconds;
26182
+ if (typeof value === 'string') {
26183
+ const iso = value.endsWith('Z') ? value : `${value}Z`;
26184
+ const d = new Date(iso);
26185
+ seconds = Math.floor(d.getTime() / 1000);
26186
+ }
26187
+ else if (value instanceof Date) {
26188
+ seconds = Math.floor(value.getTime() / 1000);
26189
+ }
26190
+ else if (typeof value === 'number') {
26191
+ // 这里假定已是秒级时间戳
26192
+ seconds = value;
26193
+ }
26194
+ else {
26195
+ seconds = 0;
26196
+ }
26197
+ bb.writeUint32(seconds);
26198
+ }
26199
+ /**
26200
+ * Serialize a generic bool flag as uint8(0/1).
26201
+ * 后续在多处 optional / approve / decline 字段可统一复用。
26202
+ */
26203
+ function serializeBool(bb, value) {
26204
+ bb.writeUint8(value ? 1 : 0);
26205
+ }
26206
+ /**
26207
+ * Serialize a future_extensions / extensions 风格字段。
26208
+ *
26209
+ * 目前大多数链上交易中 extensions 仍为空集合,协议格式是:
26210
+ * - varint32 length
26211
+ * - 后续按约定序列化各元素(当前实现仅支持空或简单 JSON 字符串)
26212
+ *
26213
+ * 为兼容现有使用场景,这里暂时只写入长度,忽略实际内容;当需要支持
26214
+ * 具体 extension 类型时,可以在保持签名兼容性的前提下扩展实现。
26215
+ */
26216
+ function serializeExtensions(bb, extensions) {
26217
+ if (!Array.isArray(extensions) || extensions.length === 0) {
26218
+ bb.writeVarint32(0);
26219
+ return;
26220
+ }
26221
+ // 协议上 extensions 是 future_extensions,目前主网基本为 0。
26222
+ // 为避免序列化出与 C++ 节点不兼容的数据,这里保守起见仍写入 0。
26223
+ // 如果未来需要支持非空 extensions,可在测试验证后放开以下逻辑:
26224
+ //
26225
+ // bb.writeVarint32(extensions.length);
26226
+ // for (const ext of extensions) {
26227
+ // const json = JSON.stringify(ext ?? null);
26228
+ // writeString(bb, json);
26229
+ // }
26230
+ bb.writeVarint32(0);
26231
+ }
25363
26232
 
25364
26233
  class Serializer {
25365
26234
  static fromBuffer(buffer) {
@@ -28844,7 +29713,7 @@
28844
29713
  serializer,
28845
29714
  utils: utils$n,
28846
29715
  ...crypto$1,
28847
- version: '1.0.12',
29716
+ version: '1.0.13',
28848
29717
  config: {
28849
29718
  set: (options) => {
28850
29719
  // If nodes is provided, extract the first node as url for API