@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.js
CHANGED
|
@@ -23097,7 +23097,7 @@ function serializeCommentOptions(bb, data) {
|
|
|
23097
23097
|
bb.writeUint16(dataObj.percent_steem_dollars ?? 0);
|
|
23098
23098
|
serializeBool(bb, dataObj.allow_votes);
|
|
23099
23099
|
serializeBool(bb, dataObj.allow_curation_rewards);
|
|
23100
|
-
|
|
23100
|
+
serializeCommentOptionsExtensions(bb, dataObj.extensions);
|
|
23101
23101
|
}
|
|
23102
23102
|
/**
|
|
23103
23103
|
* Serialize custom_json operation
|
|
@@ -23174,7 +23174,7 @@ function serializeAuthority(bb, auth) {
|
|
|
23174
23174
|
*
|
|
23175
23175
|
* Format: int64 amount (little-endian) + uint8 precision + 7-byte symbol (UTF-8, null-padded).
|
|
23176
23176
|
*
|
|
23177
|
-
* This helper is reused across all operations
|
|
23177
|
+
* This helper is reused for asset fields across all operations, e.g.
|
|
23178
23178
|
* - amount / vesting_shares / reward_* / *_pays
|
|
23179
23179
|
*/
|
|
23180
23180
|
function serializeAsset(bb, amount) {
|
|
@@ -23194,7 +23194,7 @@ function serializeAsset(bb, amount) {
|
|
|
23194
23194
|
}
|
|
23195
23195
|
/**
|
|
23196
23196
|
* Write a string using ByteBuffer's writeVString method.
|
|
23197
|
-
*
|
|
23197
|
+
* All string fields are serialized through this helper to avoid calling ByteBuffer API directly everywhere.
|
|
23198
23198
|
*/
|
|
23199
23199
|
function writeString(bb, str) {
|
|
23200
23200
|
bb.writeVString(str);
|
|
@@ -23202,8 +23202,8 @@ function writeString(bb, str) {
|
|
|
23202
23202
|
/**
|
|
23203
23203
|
* Serialize a time_point_sec-style field.
|
|
23204
23204
|
*
|
|
23205
|
-
*
|
|
23206
|
-
*
|
|
23205
|
+
* Accepts ISO string / Date / seconds number; writes uint32 (seconds since epoch).
|
|
23206
|
+
* Used for proposal start/end, escrow_deadline, and similar fields.
|
|
23207
23207
|
*/
|
|
23208
23208
|
function serializeTimePointSec(bb, value) {
|
|
23209
23209
|
let seconds;
|
|
@@ -23216,7 +23216,7 @@ function serializeTimePointSec(bb, value) {
|
|
|
23216
23216
|
seconds = Math.floor(value.getTime() / 1000);
|
|
23217
23217
|
}
|
|
23218
23218
|
else if (typeof value === 'number') {
|
|
23219
|
-
//
|
|
23219
|
+
// Assume value is already in seconds
|
|
23220
23220
|
seconds = value;
|
|
23221
23221
|
}
|
|
23222
23222
|
else {
|
|
@@ -23226,29 +23226,61 @@ function serializeTimePointSec(bb, value) {
|
|
|
23226
23226
|
}
|
|
23227
23227
|
/**
|
|
23228
23228
|
* Serialize a generic bool flag as uint8(0/1).
|
|
23229
|
-
*
|
|
23229
|
+
* Reused for optional / approve / decline and similar fields.
|
|
23230
23230
|
*/
|
|
23231
23231
|
function serializeBool(bb, value) {
|
|
23232
23232
|
bb.writeUint8(value ? 1 : 0);
|
|
23233
23233
|
}
|
|
23234
23234
|
/**
|
|
23235
|
-
* Serialize
|
|
23235
|
+
* Serialize comment_options extensions (flat_set<comment_options_extension>).
|
|
23236
|
+
* Used only for comment_options operation. Supports tag 0 (comment_payout_beneficiaries).
|
|
23237
|
+
* Beneficiaries are sorted alphabetically by account name before encoding to satisfy Steem protocol.
|
|
23238
|
+
* Other extension tags are skipped; only tag 0 is serialized.
|
|
23239
|
+
*/
|
|
23240
|
+
function serializeCommentOptionsExtensions(bb, extensions) {
|
|
23241
|
+
if (!Array.isArray(extensions) || extensions.length === 0) {
|
|
23242
|
+
bb.writeVarint32(0);
|
|
23243
|
+
return;
|
|
23244
|
+
}
|
|
23245
|
+
// Only serialize tag 0 (comment_payout_beneficiaries); skip unknown tags
|
|
23246
|
+
const supported = extensions.filter((ext) => {
|
|
23247
|
+
const tag = Array.isArray(ext) && ext.length >= 1 ? Number(ext[0]) : -1;
|
|
23248
|
+
return tag === 0;
|
|
23249
|
+
});
|
|
23250
|
+
bb.writeVarint32(supported.length);
|
|
23251
|
+
for (const ext of supported) {
|
|
23252
|
+
const tag = ext[0];
|
|
23253
|
+
const value = ext[1];
|
|
23254
|
+
bb.writeVarint32(tag);
|
|
23255
|
+
if (tag === 0) {
|
|
23256
|
+
const beneficiaries = Array.isArray(value?.beneficiaries) ? value.beneficiaries.slice() : [];
|
|
23257
|
+
beneficiaries.sort((a, b) => String(a.account).localeCompare(String(b.account)));
|
|
23258
|
+
bb.writeVarint32(beneficiaries.length);
|
|
23259
|
+
for (const b of beneficiaries) {
|
|
23260
|
+
writeString(bb, String(b.account ?? ''));
|
|
23261
|
+
bb.writeUint16(Number(b.weight) & 0xffff);
|
|
23262
|
+
}
|
|
23263
|
+
}
|
|
23264
|
+
}
|
|
23265
|
+
}
|
|
23266
|
+
/**
|
|
23267
|
+
* Serialize a future_extensions / extensions-style field.
|
|
23236
23268
|
*
|
|
23237
|
-
*
|
|
23269
|
+
* For most on-chain transactions extensions are still an empty set. Protocol format:
|
|
23238
23270
|
* - varint32 length
|
|
23239
|
-
* -
|
|
23271
|
+
* - then each element serialized per convention (current implementation supports empty only).
|
|
23240
23272
|
*
|
|
23241
|
-
*
|
|
23242
|
-
*
|
|
23273
|
+
* To stay compatible with existing usage, we only write length 0 and ignore content here;
|
|
23274
|
+
* when supporting specific extension types, extend this after verification.
|
|
23243
23275
|
*/
|
|
23244
23276
|
function serializeExtensions(bb, extensions) {
|
|
23245
23277
|
if (!Array.isArray(extensions) || extensions.length === 0) {
|
|
23246
23278
|
bb.writeVarint32(0);
|
|
23247
23279
|
return;
|
|
23248
23280
|
}
|
|
23249
|
-
//
|
|
23250
|
-
//
|
|
23251
|
-
//
|
|
23281
|
+
// Protocol-wise extensions are future_extensions; on mainnet they are typically 0.
|
|
23282
|
+
// To avoid serializing data incompatible with C++ nodes, we still write 0 conservatively.
|
|
23283
|
+
// To support non-empty extensions in the future, enable the logic below after tests:
|
|
23252
23284
|
//
|
|
23253
23285
|
// bb.writeVarint32(extensions.length);
|
|
23254
23286
|
// for (const ext of extensions) {
|
|
@@ -26324,7 +26356,7 @@ const steem = {
|
|
|
26324
26356
|
memo,
|
|
26325
26357
|
operations,
|
|
26326
26358
|
utils: utils$3,
|
|
26327
|
-
version: '1.0.
|
|
26359
|
+
version: '1.0.15',
|
|
26328
26360
|
config: {
|
|
26329
26361
|
set: (options) => {
|
|
26330
26362
|
// If nodes is provided, extract the first node as url for API
|