@steemit/steem-js 1.0.14 → 1.0.15
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/browser.esm.js +48 -16
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs +48 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -16
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +48 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -23117,7 +23117,7 @@ function serializeCommentOptions(bb, data) {
|
|
|
23117
23117
|
bb.writeUint16(dataObj.percent_steem_dollars ?? 0);
|
|
23118
23118
|
serializeBool(bb, dataObj.allow_votes);
|
|
23119
23119
|
serializeBool(bb, dataObj.allow_curation_rewards);
|
|
23120
|
-
|
|
23120
|
+
serializeCommentOptionsExtensions(bb, dataObj.extensions);
|
|
23121
23121
|
}
|
|
23122
23122
|
/**
|
|
23123
23123
|
* Serialize custom_json operation
|
|
@@ -23194,7 +23194,7 @@ function serializeAuthority(bb, auth) {
|
|
|
23194
23194
|
*
|
|
23195
23195
|
* Format: int64 amount (little-endian) + uint8 precision + 7-byte symbol (UTF-8, null-padded).
|
|
23196
23196
|
*
|
|
23197
|
-
* This helper is reused across all operations
|
|
23197
|
+
* This helper is reused for asset fields across all operations, e.g.
|
|
23198
23198
|
* - amount / vesting_shares / reward_* / *_pays
|
|
23199
23199
|
*/
|
|
23200
23200
|
function serializeAsset(bb, amount) {
|
|
@@ -23214,7 +23214,7 @@ function serializeAsset(bb, amount) {
|
|
|
23214
23214
|
}
|
|
23215
23215
|
/**
|
|
23216
23216
|
* Write a string using ByteBuffer's writeVString method.
|
|
23217
|
-
*
|
|
23217
|
+
* All string fields are serialized through this helper to avoid calling ByteBuffer API directly everywhere.
|
|
23218
23218
|
*/
|
|
23219
23219
|
function writeString(bb, str) {
|
|
23220
23220
|
bb.writeVString(str);
|
|
@@ -23222,8 +23222,8 @@ function writeString(bb, str) {
|
|
|
23222
23222
|
/**
|
|
23223
23223
|
* Serialize a time_point_sec-style field.
|
|
23224
23224
|
*
|
|
23225
|
-
*
|
|
23226
|
-
*
|
|
23225
|
+
* Accepts ISO string / Date / seconds number; writes uint32 (seconds since epoch).
|
|
23226
|
+
* Used for proposal start/end, escrow_deadline, and similar fields.
|
|
23227
23227
|
*/
|
|
23228
23228
|
function serializeTimePointSec(bb, value) {
|
|
23229
23229
|
let seconds;
|
|
@@ -23236,7 +23236,7 @@ function serializeTimePointSec(bb, value) {
|
|
|
23236
23236
|
seconds = Math.floor(value.getTime() / 1000);
|
|
23237
23237
|
}
|
|
23238
23238
|
else if (typeof value === 'number') {
|
|
23239
|
-
//
|
|
23239
|
+
// Assume value is already in seconds
|
|
23240
23240
|
seconds = value;
|
|
23241
23241
|
}
|
|
23242
23242
|
else {
|
|
@@ -23246,29 +23246,61 @@ function serializeTimePointSec(bb, value) {
|
|
|
23246
23246
|
}
|
|
23247
23247
|
/**
|
|
23248
23248
|
* Serialize a generic bool flag as uint8(0/1).
|
|
23249
|
-
*
|
|
23249
|
+
* Reused for optional / approve / decline and similar fields.
|
|
23250
23250
|
*/
|
|
23251
23251
|
function serializeBool(bb, value) {
|
|
23252
23252
|
bb.writeUint8(value ? 1 : 0);
|
|
23253
23253
|
}
|
|
23254
23254
|
/**
|
|
23255
|
-
* Serialize
|
|
23255
|
+
* Serialize comment_options extensions (flat_set<comment_options_extension>).
|
|
23256
|
+
* Used only for comment_options operation. Supports tag 0 (comment_payout_beneficiaries).
|
|
23257
|
+
* Beneficiaries are sorted alphabetically by account name before encoding to satisfy Steem protocol.
|
|
23258
|
+
* Other extension tags are skipped; only tag 0 is serialized.
|
|
23259
|
+
*/
|
|
23260
|
+
function serializeCommentOptionsExtensions(bb, extensions) {
|
|
23261
|
+
if (!Array.isArray(extensions) || extensions.length === 0) {
|
|
23262
|
+
bb.writeVarint32(0);
|
|
23263
|
+
return;
|
|
23264
|
+
}
|
|
23265
|
+
// Only serialize tag 0 (comment_payout_beneficiaries); skip unknown tags
|
|
23266
|
+
const supported = extensions.filter((ext) => {
|
|
23267
|
+
const tag = Array.isArray(ext) && ext.length >= 1 ? Number(ext[0]) : -1;
|
|
23268
|
+
return tag === 0;
|
|
23269
|
+
});
|
|
23270
|
+
bb.writeVarint32(supported.length);
|
|
23271
|
+
for (const ext of supported) {
|
|
23272
|
+
const tag = ext[0];
|
|
23273
|
+
const value = ext[1];
|
|
23274
|
+
bb.writeVarint32(tag);
|
|
23275
|
+
if (tag === 0) {
|
|
23276
|
+
const beneficiaries = Array.isArray(value?.beneficiaries) ? value.beneficiaries.slice() : [];
|
|
23277
|
+
beneficiaries.sort((a, b) => String(a.account).localeCompare(String(b.account)));
|
|
23278
|
+
bb.writeVarint32(beneficiaries.length);
|
|
23279
|
+
for (const b of beneficiaries) {
|
|
23280
|
+
writeString(bb, String(b.account ?? ''));
|
|
23281
|
+
bb.writeUint16(Number(b.weight) & 0xffff);
|
|
23282
|
+
}
|
|
23283
|
+
}
|
|
23284
|
+
}
|
|
23285
|
+
}
|
|
23286
|
+
/**
|
|
23287
|
+
* Serialize a future_extensions / extensions-style field.
|
|
23256
23288
|
*
|
|
23257
|
-
*
|
|
23289
|
+
* For most on-chain transactions extensions are still an empty set. Protocol format:
|
|
23258
23290
|
* - varint32 length
|
|
23259
|
-
* -
|
|
23291
|
+
* - then each element serialized per convention (current implementation supports empty only).
|
|
23260
23292
|
*
|
|
23261
|
-
*
|
|
23262
|
-
*
|
|
23293
|
+
* To stay compatible with existing usage, we only write length 0 and ignore content here;
|
|
23294
|
+
* when supporting specific extension types, extend this after verification.
|
|
23263
23295
|
*/
|
|
23264
23296
|
function serializeExtensions(bb, extensions) {
|
|
23265
23297
|
if (!Array.isArray(extensions) || extensions.length === 0) {
|
|
23266
23298
|
bb.writeVarint32(0);
|
|
23267
23299
|
return;
|
|
23268
23300
|
}
|
|
23269
|
-
//
|
|
23270
|
-
//
|
|
23271
|
-
//
|
|
23301
|
+
// Protocol-wise extensions are future_extensions; on mainnet they are typically 0.
|
|
23302
|
+
// To avoid serializing data incompatible with C++ nodes, we still write 0 conservatively.
|
|
23303
|
+
// To support non-empty extensions in the future, enable the logic below after tests:
|
|
23272
23304
|
//
|
|
23273
23305
|
// bb.writeVarint32(extensions.length);
|
|
23274
23306
|
// for (const ext of extensions) {
|
|
@@ -26344,7 +26376,7 @@ const steem = {
|
|
|
26344
26376
|
memo,
|
|
26345
26377
|
operations,
|
|
26346
26378
|
utils: utils$3,
|
|
26347
|
-
version: '1.0.
|
|
26379
|
+
version: '1.0.15',
|
|
26348
26380
|
config: {
|
|
26349
26381
|
set: (options) => {
|
|
26350
26382
|
// If nodes is provided, extract the first node as url for API
|