@ecency/sdk 1.5.28 → 2.0.1
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/index.d.ts +360 -2
- package/dist/browser/index.js +1579 -1293
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +1585 -1292
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +1579 -1293
- package/dist/node/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -233,67 +233,210 @@ function isNetworkError(error) {
|
|
|
233
233
|
const { type } = parseChainError(error);
|
|
234
234
|
return type === "network" /* NETWORK */ || type === "timeout" /* TIMEOUT */;
|
|
235
235
|
}
|
|
236
|
+
async function broadcastWithMethod(method, username, ops2, auth, authority = "posting", fetchedKey, fetchedToken) {
|
|
237
|
+
const adapter = auth?.adapter;
|
|
238
|
+
switch (method) {
|
|
239
|
+
case "key": {
|
|
240
|
+
if (!adapter) {
|
|
241
|
+
throw new Error("No adapter provided for key-based auth");
|
|
242
|
+
}
|
|
243
|
+
let key = fetchedKey;
|
|
244
|
+
if (key === void 0) {
|
|
245
|
+
switch (authority) {
|
|
246
|
+
case "owner":
|
|
247
|
+
if (adapter.getOwnerKey) {
|
|
248
|
+
key = await adapter.getOwnerKey(username);
|
|
249
|
+
} else {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Owner key not supported by adapter. Owner operations (like account recovery) require master password login or manual key entry.`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
case "active":
|
|
256
|
+
if (adapter.getActiveKey) {
|
|
257
|
+
key = await adapter.getActiveKey(username);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case "memo":
|
|
261
|
+
if (adapter.getMemoKey) {
|
|
262
|
+
key = await adapter.getMemoKey(username);
|
|
263
|
+
} else {
|
|
264
|
+
throw new Error(
|
|
265
|
+
`Memo key not supported by adapter. Use memo encryption methods instead.`
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "posting":
|
|
270
|
+
default:
|
|
271
|
+
key = await adapter.getPostingKey(username);
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (!key) {
|
|
276
|
+
throw new Error(`No ${authority} key available for ${username}`);
|
|
277
|
+
}
|
|
278
|
+
const privateKey = PrivateKey.fromString(key);
|
|
279
|
+
return await CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
|
|
280
|
+
}
|
|
281
|
+
case "hiveauth": {
|
|
282
|
+
if (!adapter?.broadcastWithHiveAuth) {
|
|
283
|
+
throw new Error("HiveAuth not supported by adapter");
|
|
284
|
+
}
|
|
285
|
+
return await adapter.broadcastWithHiveAuth(username, ops2, authority);
|
|
286
|
+
}
|
|
287
|
+
case "hivesigner": {
|
|
288
|
+
if (!adapter) {
|
|
289
|
+
throw new Error("No adapter provided for HiveSigner auth");
|
|
290
|
+
}
|
|
291
|
+
const token = fetchedToken !== void 0 ? fetchedToken : await adapter.getAccessToken(username);
|
|
292
|
+
if (!token) {
|
|
293
|
+
throw new Error(`No access token available for ${username}`);
|
|
294
|
+
}
|
|
295
|
+
const client = new hs.Client({ accessToken: token });
|
|
296
|
+
const response = await client.broadcast(ops2);
|
|
297
|
+
return response.result;
|
|
298
|
+
}
|
|
299
|
+
case "keychain": {
|
|
300
|
+
if (!adapter?.broadcastWithKeychain) {
|
|
301
|
+
throw new Error("Keychain not supported by adapter");
|
|
302
|
+
}
|
|
303
|
+
return await adapter.broadcastWithKeychain(username, ops2, authority);
|
|
304
|
+
}
|
|
305
|
+
case "custom": {
|
|
306
|
+
if (!auth?.broadcast) {
|
|
307
|
+
throw new Error("No custom broadcast function provided");
|
|
308
|
+
}
|
|
309
|
+
return await auth.broadcast(ops2, authority);
|
|
310
|
+
}
|
|
311
|
+
default:
|
|
312
|
+
throw new Error(`Unknown auth method: ${method}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
236
315
|
async function broadcastWithFallback(username, ops2, auth, authority = "posting") {
|
|
316
|
+
const adapter = auth?.adapter;
|
|
317
|
+
if (adapter?.getLoginType) {
|
|
318
|
+
const loginType = await adapter.getLoginType(username);
|
|
319
|
+
if (loginType) {
|
|
320
|
+
const hasPostingAuth = adapter.hasPostingAuthorization ? await adapter.hasPostingAuthorization(username) : false;
|
|
321
|
+
if (authority === "posting" && hasPostingAuth && loginType === "key") {
|
|
322
|
+
try {
|
|
323
|
+
return await broadcastWithMethod("hivesigner", username, ops2, auth, authority);
|
|
324
|
+
} catch (error) {
|
|
325
|
+
if (!shouldTriggerAuthFallback(error)) {
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
console.warn("[SDK] HiveSigner token auth failed, falling back to key:", error);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (authority === "posting" && hasPostingAuth && loginType === "hiveauth") {
|
|
332
|
+
try {
|
|
333
|
+
return await broadcastWithMethod("hivesigner", username, ops2, auth, authority);
|
|
334
|
+
} catch (error) {
|
|
335
|
+
if (!shouldTriggerAuthFallback(error)) {
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
console.warn("[SDK] HiveSigner token auth failed, falling back to HiveAuth:", error);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
return await broadcastWithMethod(loginType, username, ops2, auth, authority);
|
|
343
|
+
} catch (error) {
|
|
344
|
+
if (shouldTriggerAuthFallback(error)) {
|
|
345
|
+
if (adapter.showAuthUpgradeUI && (authority === "posting" || authority === "active")) {
|
|
346
|
+
const operationName = ops2.length > 0 ? ops2[0][0] : "unknown";
|
|
347
|
+
const selectedMethod = await adapter.showAuthUpgradeUI(authority, operationName);
|
|
348
|
+
if (!selectedMethod) {
|
|
349
|
+
throw new Error(`Operation requires ${authority} authority. User declined alternate auth.`);
|
|
350
|
+
}
|
|
351
|
+
return await broadcastWithMethod(selectedMethod, username, ops2, auth, authority);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
237
358
|
const chain = auth?.fallbackChain ?? ["key", "hiveauth", "hivesigner", "keychain", "custom"];
|
|
238
359
|
const errors = /* @__PURE__ */ new Map();
|
|
239
|
-
const adapter = auth?.adapter;
|
|
240
360
|
for (const method of chain) {
|
|
241
361
|
try {
|
|
362
|
+
let shouldSkip = false;
|
|
363
|
+
let skipReason = "";
|
|
364
|
+
let prefetchedKey;
|
|
365
|
+
let prefetchedToken;
|
|
242
366
|
switch (method) {
|
|
243
|
-
case "key":
|
|
367
|
+
case "key":
|
|
244
368
|
if (!adapter) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
369
|
+
shouldSkip = true;
|
|
370
|
+
skipReason = "No adapter provided";
|
|
371
|
+
} else {
|
|
372
|
+
let key;
|
|
373
|
+
switch (authority) {
|
|
374
|
+
case "owner":
|
|
375
|
+
if (adapter.getOwnerKey) {
|
|
376
|
+
key = await adapter.getOwnerKey(username);
|
|
377
|
+
}
|
|
378
|
+
break;
|
|
379
|
+
case "active":
|
|
380
|
+
if (adapter.getActiveKey) {
|
|
381
|
+
key = await adapter.getActiveKey(username);
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case "memo":
|
|
385
|
+
if (adapter.getMemoKey) {
|
|
386
|
+
key = await adapter.getMemoKey(username);
|
|
387
|
+
}
|
|
388
|
+
break;
|
|
389
|
+
case "posting":
|
|
390
|
+
default:
|
|
391
|
+
key = await adapter.getPostingKey(username);
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
if (!key) {
|
|
395
|
+
shouldSkip = true;
|
|
396
|
+
skipReason = `No ${authority} key available`;
|
|
397
|
+
} else {
|
|
398
|
+
prefetchedKey = key;
|
|
399
|
+
}
|
|
257
400
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
case "hiveauth": {
|
|
401
|
+
break;
|
|
402
|
+
case "hiveauth":
|
|
262
403
|
if (!adapter?.broadcastWithHiveAuth) {
|
|
263
|
-
|
|
264
|
-
|
|
404
|
+
shouldSkip = true;
|
|
405
|
+
skipReason = "HiveAuth not supported by adapter";
|
|
265
406
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
case "hivesigner": {
|
|
407
|
+
break;
|
|
408
|
+
case "hivesigner":
|
|
269
409
|
if (!adapter) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
410
|
+
shouldSkip = true;
|
|
411
|
+
skipReason = "No adapter provided";
|
|
412
|
+
} else {
|
|
413
|
+
const token = await adapter.getAccessToken(username);
|
|
414
|
+
if (!token) {
|
|
415
|
+
shouldSkip = true;
|
|
416
|
+
skipReason = "No access token available";
|
|
417
|
+
} else {
|
|
418
|
+
prefetchedToken = token;
|
|
419
|
+
}
|
|
277
420
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return response.result;
|
|
281
|
-
}
|
|
282
|
-
case "keychain": {
|
|
421
|
+
break;
|
|
422
|
+
case "keychain":
|
|
283
423
|
if (!adapter?.broadcastWithKeychain) {
|
|
284
|
-
|
|
285
|
-
|
|
424
|
+
shouldSkip = true;
|
|
425
|
+
skipReason = "Keychain not supported by adapter";
|
|
286
426
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
case "custom": {
|
|
427
|
+
break;
|
|
428
|
+
case "custom":
|
|
290
429
|
if (!auth?.broadcast) {
|
|
291
|
-
|
|
292
|
-
|
|
430
|
+
shouldSkip = true;
|
|
431
|
+
skipReason = "No custom broadcast function provided";
|
|
293
432
|
}
|
|
294
|
-
|
|
295
|
-
}
|
|
433
|
+
break;
|
|
296
434
|
}
|
|
435
|
+
if (shouldSkip) {
|
|
436
|
+
errors.set(method, new Error(`Skipped: ${skipReason}`));
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
return await broadcastWithMethod(method, username, ops2, auth, authority, prefetchedKey, prefetchedToken);
|
|
297
440
|
} catch (error) {
|
|
298
441
|
errors.set(method, error);
|
|
299
442
|
if (!shouldTriggerAuthFallback(error)) {
|
|
@@ -335,6 +478,11 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
335
478
|
}
|
|
336
479
|
const postingKey = auth?.postingKey;
|
|
337
480
|
if (postingKey) {
|
|
481
|
+
if (authority !== "posting") {
|
|
482
|
+
throw new Error(
|
|
483
|
+
`[SDK][Broadcast] Legacy auth only supports posting authority, but '${authority}' was requested. Use AuthContextV2 with an adapter for ${authority} operations.`
|
|
484
|
+
);
|
|
485
|
+
}
|
|
338
486
|
const privateKey = PrivateKey.fromString(postingKey);
|
|
339
487
|
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
340
488
|
ops2,
|
|
@@ -3105,1542 +3253,1670 @@ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError)
|
|
|
3105
3253
|
}
|
|
3106
3254
|
});
|
|
3107
3255
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
code
|
|
3127
|
-
})
|
|
3128
|
-
}
|
|
3129
|
-
);
|
|
3130
|
-
return response.json();
|
|
3131
|
-
},
|
|
3132
|
-
onSuccess: () => {
|
|
3133
|
-
onSuccess();
|
|
3134
|
-
getQueryClient().invalidateQueries({
|
|
3135
|
-
queryKey: ["accounts", "bookmarks", username]
|
|
3136
|
-
});
|
|
3137
|
-
},
|
|
3138
|
-
onError
|
|
3139
|
-
});
|
|
3140
|
-
}
|
|
3141
|
-
function useBookmarkDelete(username, code, onSuccess, onError) {
|
|
3142
|
-
return useMutation({
|
|
3143
|
-
mutationKey: ["accounts", "bookmarks", "delete", username],
|
|
3144
|
-
mutationFn: async (bookmarkId) => {
|
|
3145
|
-
if (!username || !code) {
|
|
3146
|
-
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
3147
|
-
}
|
|
3148
|
-
const fetchApi = getBoundFetch();
|
|
3149
|
-
const response = await fetchApi(
|
|
3150
|
-
CONFIG.privateApiHost + "/private-api/bookmarks-delete",
|
|
3151
|
-
{
|
|
3152
|
-
method: "POST",
|
|
3153
|
-
headers: {
|
|
3154
|
-
"Content-Type": "application/json"
|
|
3155
|
-
},
|
|
3156
|
-
body: JSON.stringify({
|
|
3157
|
-
id: bookmarkId,
|
|
3158
|
-
code
|
|
3159
|
-
})
|
|
3160
|
-
}
|
|
3161
|
-
);
|
|
3162
|
-
return response.json();
|
|
3163
|
-
},
|
|
3164
|
-
onSuccess: () => {
|
|
3165
|
-
onSuccess();
|
|
3166
|
-
getQueryClient().invalidateQueries({
|
|
3167
|
-
queryKey: ["accounts", "bookmarks", username]
|
|
3168
|
-
});
|
|
3169
|
-
},
|
|
3170
|
-
onError
|
|
3171
|
-
});
|
|
3256
|
+
|
|
3257
|
+
// src/modules/operations/builders/content.ts
|
|
3258
|
+
function buildVoteOp(voter, author, permlink, weight) {
|
|
3259
|
+
if (!voter || !author || !permlink) {
|
|
3260
|
+
throw new Error("[SDK][buildVoteOp] Missing required parameters");
|
|
3261
|
+
}
|
|
3262
|
+
if (weight < -1e4 || weight > 1e4) {
|
|
3263
|
+
throw new Error("[SDK][buildVoteOp] Weight must be between -10000 and 10000");
|
|
3264
|
+
}
|
|
3265
|
+
return [
|
|
3266
|
+
"vote",
|
|
3267
|
+
{
|
|
3268
|
+
voter,
|
|
3269
|
+
author,
|
|
3270
|
+
permlink,
|
|
3271
|
+
weight
|
|
3272
|
+
}
|
|
3273
|
+
];
|
|
3172
3274
|
}
|
|
3173
|
-
function
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
account,
|
|
3190
|
-
code
|
|
3191
|
-
})
|
|
3192
|
-
}
|
|
3193
|
-
);
|
|
3194
|
-
return response.json();
|
|
3195
|
-
},
|
|
3196
|
-
onSuccess: () => {
|
|
3197
|
-
onSuccess();
|
|
3198
|
-
getQueryClient().invalidateQueries({
|
|
3199
|
-
queryKey: ["accounts", "favourites", username]
|
|
3200
|
-
});
|
|
3201
|
-
},
|
|
3202
|
-
onError
|
|
3203
|
-
});
|
|
3275
|
+
function buildCommentOp(author, permlink, parentAuthor, parentPermlink, title, body, jsonMetadata) {
|
|
3276
|
+
if (!author || !permlink || parentPermlink === void 0 || !body) {
|
|
3277
|
+
throw new Error("[SDK][buildCommentOp] Missing required parameters");
|
|
3278
|
+
}
|
|
3279
|
+
return [
|
|
3280
|
+
"comment",
|
|
3281
|
+
{
|
|
3282
|
+
parent_author: parentAuthor,
|
|
3283
|
+
parent_permlink: parentPermlink,
|
|
3284
|
+
author,
|
|
3285
|
+
permlink,
|
|
3286
|
+
title,
|
|
3287
|
+
body,
|
|
3288
|
+
json_metadata: JSON.stringify(jsonMetadata)
|
|
3289
|
+
}
|
|
3290
|
+
];
|
|
3204
3291
|
}
|
|
3205
|
-
function
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
account,
|
|
3222
|
-
code
|
|
3223
|
-
})
|
|
3224
|
-
}
|
|
3225
|
-
);
|
|
3226
|
-
return response.json();
|
|
3227
|
-
},
|
|
3228
|
-
onSuccess: () => {
|
|
3229
|
-
onSuccess();
|
|
3230
|
-
getQueryClient().invalidateQueries({
|
|
3231
|
-
queryKey: ["accounts", "favourites", username]
|
|
3232
|
-
});
|
|
3233
|
-
},
|
|
3234
|
-
onError
|
|
3235
|
-
});
|
|
3292
|
+
function buildCommentOptionsOp(author, permlink, maxAcceptedPayout, percentHbd, allowVotes, allowCurationRewards, extensions) {
|
|
3293
|
+
if (!author || !permlink) {
|
|
3294
|
+
throw new Error("[SDK][buildCommentOptionsOp] Missing required parameters");
|
|
3295
|
+
}
|
|
3296
|
+
return [
|
|
3297
|
+
"comment_options",
|
|
3298
|
+
{
|
|
3299
|
+
author,
|
|
3300
|
+
permlink,
|
|
3301
|
+
max_accepted_payout: maxAcceptedPayout,
|
|
3302
|
+
percent_hbd: percentHbd,
|
|
3303
|
+
allow_votes: allowVotes,
|
|
3304
|
+
allow_curation_rewards: allowCurationRewards,
|
|
3305
|
+
extensions
|
|
3306
|
+
}
|
|
3307
|
+
];
|
|
3236
3308
|
}
|
|
3237
|
-
function
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
}
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
}) => {
|
|
3258
|
-
if (keys.length === 0) {
|
|
3259
|
-
throw new Error(
|
|
3260
|
-
"[SDK][Update password] \u2013 no new keys provided"
|
|
3261
|
-
);
|
|
3262
|
-
}
|
|
3263
|
-
if (!accountData) {
|
|
3264
|
-
throw new Error(
|
|
3265
|
-
"[SDK][Update password] \u2013 cannot update keys for anon user"
|
|
3266
|
-
);
|
|
3267
|
-
}
|
|
3268
|
-
const prepareAuth = (keyName) => {
|
|
3269
|
-
const auth = R4.clone(accountData[keyName]);
|
|
3270
|
-
const keysToRevokeForAuthority = keysToRevokeByAuthority[keyName] || [];
|
|
3271
|
-
const allKeysToRevoke = [
|
|
3272
|
-
...keysToRevokeForAuthority,
|
|
3273
|
-
...keysToRevokeByAuthority[keyName] === void 0 ? keysToRevoke : []
|
|
3274
|
-
];
|
|
3275
|
-
const existingKeys = keepCurrent ? auth.key_auths.filter(([key]) => !allKeysToRevoke.includes(key.toString())) : [];
|
|
3276
|
-
auth.key_auths = dedupeAndSortKeyAuths(
|
|
3277
|
-
existingKeys,
|
|
3278
|
-
keys.map(
|
|
3279
|
-
(values, i) => [values[keyName].createPublic().toString(), i + 1]
|
|
3280
|
-
)
|
|
3281
|
-
);
|
|
3282
|
-
return auth;
|
|
3283
|
-
};
|
|
3284
|
-
return CONFIG.hiveClient.broadcast.updateAccount(
|
|
3285
|
-
{
|
|
3286
|
-
account: username,
|
|
3287
|
-
json_metadata: accountData.json_metadata,
|
|
3288
|
-
owner: prepareAuth("owner"),
|
|
3289
|
-
active: prepareAuth("active"),
|
|
3290
|
-
posting: prepareAuth("posting"),
|
|
3291
|
-
// Always use new memo key when adding new keys
|
|
3292
|
-
memo_key: keys[0].memo_key.createPublic().toString()
|
|
3293
|
-
},
|
|
3294
|
-
currentKey
|
|
3295
|
-
);
|
|
3296
|
-
},
|
|
3297
|
-
...options
|
|
3298
|
-
});
|
|
3299
|
-
}
|
|
3300
|
-
function useAccountUpdatePassword(username, options) {
|
|
3301
|
-
const { data: accountData } = useQuery(getAccountFullQueryOptions(username));
|
|
3302
|
-
const { mutateAsync: updateKeys } = useAccountUpdateKeyAuths(username);
|
|
3303
|
-
return useMutation({
|
|
3304
|
-
mutationKey: ["accounts", "password-update", username],
|
|
3305
|
-
mutationFn: async ({
|
|
3306
|
-
newPassword,
|
|
3307
|
-
currentPassword,
|
|
3308
|
-
keepCurrent
|
|
3309
|
-
}) => {
|
|
3310
|
-
if (!accountData) {
|
|
3311
|
-
throw new Error(
|
|
3312
|
-
"[SDK][Update password] \u2013 cannot update password for anon user"
|
|
3313
|
-
);
|
|
3314
|
-
}
|
|
3315
|
-
const currentKey = PrivateKey.fromLogin(
|
|
3316
|
-
username,
|
|
3317
|
-
currentPassword,
|
|
3318
|
-
"owner"
|
|
3319
|
-
);
|
|
3320
|
-
return updateKeys({
|
|
3321
|
-
currentKey,
|
|
3322
|
-
keepCurrent,
|
|
3323
|
-
keys: [
|
|
3324
|
-
{
|
|
3325
|
-
owner: PrivateKey.fromLogin(username, newPassword, "owner"),
|
|
3326
|
-
active: PrivateKey.fromLogin(username, newPassword, "active"),
|
|
3327
|
-
posting: PrivateKey.fromLogin(username, newPassword, "posting"),
|
|
3328
|
-
memo_key: PrivateKey.fromLogin(username, newPassword, "memo")
|
|
3329
|
-
}
|
|
3330
|
-
]
|
|
3331
|
-
});
|
|
3332
|
-
},
|
|
3333
|
-
...options
|
|
3334
|
-
});
|
|
3335
|
-
}
|
|
3336
|
-
function useAccountRevokePosting(username, options, auth) {
|
|
3337
|
-
const queryClient = useQueryClient();
|
|
3338
|
-
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
3339
|
-
return useMutation({
|
|
3340
|
-
mutationKey: ["accounts", "revoke-posting", data?.name],
|
|
3341
|
-
mutationFn: async ({ accountName, type, key }) => {
|
|
3342
|
-
if (!data) {
|
|
3343
|
-
throw new Error(
|
|
3344
|
-
"[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user"
|
|
3345
|
-
);
|
|
3346
|
-
}
|
|
3347
|
-
const posting = R4.pipe(
|
|
3348
|
-
{},
|
|
3349
|
-
R4.mergeDeep(data.posting)
|
|
3350
|
-
);
|
|
3351
|
-
posting.account_auths = posting.account_auths.filter(
|
|
3352
|
-
([account]) => account !== accountName
|
|
3353
|
-
);
|
|
3354
|
-
const operationBody = {
|
|
3355
|
-
account: data.name,
|
|
3356
|
-
posting,
|
|
3357
|
-
memo_key: data.memo_key,
|
|
3358
|
-
json_metadata: data.json_metadata
|
|
3359
|
-
};
|
|
3360
|
-
if (type === "key" && key) {
|
|
3361
|
-
return CONFIG.hiveClient.broadcast.updateAccount(operationBody, key);
|
|
3362
|
-
} else if (type === "keychain") {
|
|
3363
|
-
if (!auth?.broadcast) {
|
|
3364
|
-
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
3365
|
-
}
|
|
3366
|
-
return auth.broadcast([["account_update", operationBody]], "active");
|
|
3367
|
-
} else {
|
|
3368
|
-
const params = {
|
|
3369
|
-
callback: `https://ecency.com/@${data.name}/permissions`
|
|
3370
|
-
};
|
|
3371
|
-
return hs.sendOperation(
|
|
3372
|
-
["account_update", operationBody],
|
|
3373
|
-
params,
|
|
3374
|
-
() => {
|
|
3375
|
-
}
|
|
3376
|
-
);
|
|
3377
|
-
}
|
|
3378
|
-
},
|
|
3379
|
-
onError: options.onError,
|
|
3380
|
-
onSuccess: (resp, payload, ctx) => {
|
|
3381
|
-
options.onSuccess?.(resp, payload, ctx);
|
|
3382
|
-
queryClient.setQueryData(
|
|
3383
|
-
getAccountFullQueryOptions(username).queryKey,
|
|
3384
|
-
(data2) => ({
|
|
3385
|
-
...data2,
|
|
3386
|
-
posting: {
|
|
3387
|
-
...data2?.posting,
|
|
3388
|
-
account_auths: data2?.posting?.account_auths?.filter(
|
|
3389
|
-
([account]) => account !== payload.accountName
|
|
3390
|
-
) ?? []
|
|
3391
|
-
}
|
|
3392
|
-
})
|
|
3393
|
-
);
|
|
3394
|
-
}
|
|
3395
|
-
});
|
|
3396
|
-
}
|
|
3397
|
-
function useAccountUpdateRecovery(username, code, options, auth) {
|
|
3398
|
-
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
3399
|
-
return useMutation({
|
|
3400
|
-
mutationKey: ["accounts", "recovery", data?.name],
|
|
3401
|
-
mutationFn: async ({ accountName, type, key, email }) => {
|
|
3402
|
-
if (!data) {
|
|
3403
|
-
throw new Error(
|
|
3404
|
-
"[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user"
|
|
3405
|
-
);
|
|
3406
|
-
}
|
|
3407
|
-
const operationBody = {
|
|
3408
|
-
account_to_recover: data.name,
|
|
3409
|
-
new_recovery_account: accountName,
|
|
3410
|
-
extensions: []
|
|
3411
|
-
};
|
|
3412
|
-
if (type === "ecency") {
|
|
3413
|
-
if (!code) {
|
|
3414
|
-
throw new Error("[SDK][Accounts] \u2013 missing access token");
|
|
3415
|
-
}
|
|
3416
|
-
const fetchApi = getBoundFetch();
|
|
3417
|
-
return fetchApi(CONFIG.privateApiHost + "/private-api/recoveries-add", {
|
|
3418
|
-
method: "POST",
|
|
3419
|
-
body: JSON.stringify({
|
|
3420
|
-
code,
|
|
3421
|
-
email,
|
|
3422
|
-
publicKeys: [
|
|
3423
|
-
...data.owner.key_auths,
|
|
3424
|
-
...data.active.key_auths,
|
|
3425
|
-
...data.posting.key_auths,
|
|
3426
|
-
data.memo_key
|
|
3427
|
-
]
|
|
3428
|
-
})
|
|
3429
|
-
});
|
|
3430
|
-
} else if (type === "key" && key) {
|
|
3431
|
-
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
3432
|
-
[["change_recovery_account", operationBody]],
|
|
3433
|
-
key
|
|
3434
|
-
);
|
|
3435
|
-
} else if (type === "keychain") {
|
|
3436
|
-
if (!auth?.broadcast) {
|
|
3437
|
-
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
3438
|
-
}
|
|
3439
|
-
return auth.broadcast([["change_recovery_account", operationBody]], "owner");
|
|
3440
|
-
} else {
|
|
3441
|
-
const params = {
|
|
3442
|
-
callback: `https://ecency.com/@${data.name}/permissions`
|
|
3443
|
-
};
|
|
3444
|
-
return hs.sendOperation(
|
|
3445
|
-
["change_recovery_account", operationBody],
|
|
3446
|
-
params,
|
|
3447
|
-
() => {
|
|
3448
|
-
}
|
|
3449
|
-
);
|
|
3450
|
-
}
|
|
3451
|
-
},
|
|
3452
|
-
onError: options.onError,
|
|
3453
|
-
onSuccess: options.onSuccess
|
|
3454
|
-
});
|
|
3455
|
-
}
|
|
3456
|
-
function useAccountRevokeKey(username, options) {
|
|
3457
|
-
const { data: accountData } = useQuery(getAccountFullQueryOptions(username));
|
|
3458
|
-
return useMutation({
|
|
3459
|
-
mutationKey: ["accounts", "revoke-key", accountData?.name],
|
|
3460
|
-
mutationFn: async ({ currentKey, revokingKey }) => {
|
|
3461
|
-
if (!accountData) {
|
|
3462
|
-
throw new Error(
|
|
3463
|
-
"[SDK][Update password] \u2013 cannot update keys for anon user"
|
|
3464
|
-
);
|
|
3465
|
-
}
|
|
3466
|
-
const prepareAuth = (keyName) => {
|
|
3467
|
-
const auth = R4.clone(accountData[keyName]);
|
|
3468
|
-
auth.key_auths = auth.key_auths.filter(
|
|
3469
|
-
([key]) => key !== revokingKey.toString()
|
|
3470
|
-
);
|
|
3471
|
-
return auth;
|
|
3472
|
-
};
|
|
3473
|
-
return CONFIG.hiveClient.broadcast.updateAccount(
|
|
3474
|
-
{
|
|
3475
|
-
account: accountData.name,
|
|
3476
|
-
json_metadata: accountData.json_metadata,
|
|
3477
|
-
owner: prepareAuth("owner"),
|
|
3478
|
-
active: prepareAuth("active"),
|
|
3479
|
-
posting: prepareAuth("posting"),
|
|
3480
|
-
memo_key: accountData.memo_key
|
|
3481
|
-
},
|
|
3482
|
-
currentKey
|
|
3483
|
-
);
|
|
3484
|
-
},
|
|
3485
|
-
...options
|
|
3486
|
-
});
|
|
3487
|
-
}
|
|
3488
|
-
|
|
3489
|
-
// src/modules/accounts/utils/account-power.ts
|
|
3490
|
-
var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
|
|
3491
|
-
function vestsToRshares(vests, votingPowerValue, votePerc) {
|
|
3492
|
-
const vestingShares = vests * 1e6;
|
|
3493
|
-
const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
|
|
3494
|
-
return power * vestingShares / 1e4;
|
|
3495
|
-
}
|
|
3496
|
-
function toDhiveAccountForVotingMana(account) {
|
|
3497
|
-
return {
|
|
3498
|
-
id: 0,
|
|
3499
|
-
name: account.name,
|
|
3500
|
-
owner: account.owner,
|
|
3501
|
-
active: account.active,
|
|
3502
|
-
posting: account.posting,
|
|
3503
|
-
memo_key: account.memo_key,
|
|
3504
|
-
json_metadata: account.json_metadata,
|
|
3505
|
-
posting_json_metadata: account.posting_json_metadata,
|
|
3506
|
-
proxy: account.proxy ?? "",
|
|
3507
|
-
last_owner_update: "",
|
|
3508
|
-
last_account_update: "",
|
|
3509
|
-
created: account.created,
|
|
3510
|
-
mined: false,
|
|
3511
|
-
owner_challenged: false,
|
|
3512
|
-
active_challenged: false,
|
|
3513
|
-
last_owner_proved: "",
|
|
3514
|
-
last_active_proved: "",
|
|
3515
|
-
recovery_account: account.recovery_account ?? "",
|
|
3516
|
-
reset_account: "",
|
|
3517
|
-
last_account_recovery: "",
|
|
3518
|
-
comment_count: 0,
|
|
3519
|
-
lifetime_vote_count: 0,
|
|
3520
|
-
post_count: account.post_count,
|
|
3521
|
-
can_vote: true,
|
|
3522
|
-
voting_power: account.voting_power,
|
|
3523
|
-
last_vote_time: account.last_vote_time,
|
|
3524
|
-
voting_manabar: account.voting_manabar,
|
|
3525
|
-
balance: account.balance,
|
|
3526
|
-
savings_balance: account.savings_balance,
|
|
3527
|
-
hbd_balance: account.hbd_balance,
|
|
3528
|
-
hbd_seconds: "0",
|
|
3529
|
-
hbd_seconds_last_update: "",
|
|
3530
|
-
hbd_last_interest_payment: "",
|
|
3531
|
-
savings_hbd_balance: account.savings_hbd_balance,
|
|
3532
|
-
savings_hbd_seconds: account.savings_hbd_seconds,
|
|
3533
|
-
savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
|
|
3534
|
-
savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
|
|
3535
|
-
savings_withdraw_requests: 0,
|
|
3536
|
-
reward_hbd_balance: account.reward_hbd_balance,
|
|
3537
|
-
reward_hive_balance: account.reward_hive_balance,
|
|
3538
|
-
reward_vesting_balance: account.reward_vesting_balance,
|
|
3539
|
-
reward_vesting_hive: account.reward_vesting_hive,
|
|
3540
|
-
curation_rewards: 0,
|
|
3541
|
-
posting_rewards: 0,
|
|
3542
|
-
vesting_shares: account.vesting_shares,
|
|
3543
|
-
delegated_vesting_shares: account.delegated_vesting_shares,
|
|
3544
|
-
received_vesting_shares: account.received_vesting_shares,
|
|
3545
|
-
vesting_withdraw_rate: account.vesting_withdraw_rate,
|
|
3546
|
-
next_vesting_withdrawal: account.next_vesting_withdrawal,
|
|
3547
|
-
withdrawn: account.withdrawn,
|
|
3548
|
-
to_withdraw: account.to_withdraw,
|
|
3549
|
-
withdraw_routes: 0,
|
|
3550
|
-
proxied_vsf_votes: account.proxied_vsf_votes ?? [],
|
|
3551
|
-
witnesses_voted_for: 0,
|
|
3552
|
-
average_bandwidth: 0,
|
|
3553
|
-
lifetime_bandwidth: 0,
|
|
3554
|
-
last_bandwidth_update: "",
|
|
3555
|
-
average_market_bandwidth: 0,
|
|
3556
|
-
lifetime_market_bandwidth: 0,
|
|
3557
|
-
last_market_bandwidth_update: "",
|
|
3558
|
-
last_post: account.last_post,
|
|
3559
|
-
last_root_post: ""
|
|
3309
|
+
function buildDeleteCommentOp(author, permlink) {
|
|
3310
|
+
if (!author || !permlink) {
|
|
3311
|
+
throw new Error("[SDK][buildDeleteCommentOp] Missing required parameters");
|
|
3312
|
+
}
|
|
3313
|
+
return [
|
|
3314
|
+
"delete_comment",
|
|
3315
|
+
{
|
|
3316
|
+
author,
|
|
3317
|
+
permlink
|
|
3318
|
+
}
|
|
3319
|
+
];
|
|
3320
|
+
}
|
|
3321
|
+
function buildReblogOp(account, author, permlink, deleteReblog = false) {
|
|
3322
|
+
if (!account || !author || !permlink) {
|
|
3323
|
+
throw new Error("[SDK][buildReblogOp] Missing required parameters");
|
|
3324
|
+
}
|
|
3325
|
+
const json = {
|
|
3326
|
+
account,
|
|
3327
|
+
author,
|
|
3328
|
+
permlink
|
|
3560
3329
|
};
|
|
3330
|
+
if (deleteReblog) {
|
|
3331
|
+
json.delete = "delete";
|
|
3332
|
+
}
|
|
3333
|
+
return [
|
|
3334
|
+
"custom_json",
|
|
3335
|
+
{
|
|
3336
|
+
id: "follow",
|
|
3337
|
+
json: JSON.stringify(["reblog", json]),
|
|
3338
|
+
required_auths: [],
|
|
3339
|
+
required_posting_auths: [account]
|
|
3340
|
+
}
|
|
3341
|
+
];
|
|
3561
3342
|
}
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3343
|
+
|
|
3344
|
+
// src/modules/operations/builders/wallet.ts
|
|
3345
|
+
function buildTransferOp(from, to, amount, memo) {
|
|
3346
|
+
if (!from || !to || !amount) {
|
|
3347
|
+
throw new Error("[SDK][buildTransferOp] Missing required parameters");
|
|
3348
|
+
}
|
|
3349
|
+
return [
|
|
3350
|
+
"transfer",
|
|
3351
|
+
{
|
|
3352
|
+
from,
|
|
3353
|
+
to,
|
|
3354
|
+
amount,
|
|
3355
|
+
memo: memo || ""
|
|
3356
|
+
}
|
|
3357
|
+
];
|
|
3358
|
+
}
|
|
3359
|
+
function buildMultiTransferOps(from, destinations, amount, memo) {
|
|
3360
|
+
if (!from || !destinations || !amount) {
|
|
3361
|
+
throw new Error("[SDK][buildMultiTransferOps] Missing required parameters");
|
|
3362
|
+
}
|
|
3363
|
+
const destArray = destinations.trim().split(/[\s,]+/).filter(Boolean);
|
|
3364
|
+
return destArray.map(
|
|
3365
|
+
(dest) => buildTransferOp(from, dest.trim(), amount, memo)
|
|
3565
3366
|
);
|
|
3566
|
-
return calc.percentage / 100;
|
|
3567
3367
|
}
|
|
3568
|
-
function
|
|
3569
|
-
if (!
|
|
3570
|
-
throw new
|
|
3368
|
+
function buildRecurrentTransferOp(from, to, amount, memo, recurrence, executions) {
|
|
3369
|
+
if (!from || !to || !amount) {
|
|
3370
|
+
throw new Error("[SDK][buildRecurrentTransferOp] Missing required parameters");
|
|
3571
3371
|
}
|
|
3572
|
-
if (
|
|
3573
|
-
throw new
|
|
3372
|
+
if (recurrence < 24) {
|
|
3373
|
+
throw new Error("[SDK][buildRecurrentTransferOp] Recurrence must be at least 24 hours");
|
|
3574
3374
|
}
|
|
3575
|
-
|
|
3576
|
-
|
|
3375
|
+
return [
|
|
3376
|
+
"recurrent_transfer",
|
|
3377
|
+
{
|
|
3378
|
+
from,
|
|
3379
|
+
to,
|
|
3380
|
+
amount,
|
|
3381
|
+
memo: memo || "",
|
|
3382
|
+
recurrence,
|
|
3383
|
+
executions,
|
|
3384
|
+
extensions: []
|
|
3385
|
+
}
|
|
3386
|
+
];
|
|
3577
3387
|
}
|
|
3578
|
-
function
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
const maxMana = totalShares * 1e6 / 4;
|
|
3582
|
-
if (maxMana <= 0) {
|
|
3583
|
-
return 0;
|
|
3584
|
-
}
|
|
3585
|
-
let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
|
|
3586
|
-
if (currentMana > maxMana) {
|
|
3587
|
-
currentMana = maxMana;
|
|
3388
|
+
function buildTransferToSavingsOp(from, to, amount, memo) {
|
|
3389
|
+
if (!from || !to || !amount) {
|
|
3390
|
+
throw new Error("[SDK][buildTransferToSavingsOp] Missing required parameters");
|
|
3588
3391
|
}
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3392
|
+
return [
|
|
3393
|
+
"transfer_to_savings",
|
|
3394
|
+
{
|
|
3395
|
+
from,
|
|
3396
|
+
to,
|
|
3397
|
+
amount,
|
|
3398
|
+
memo: memo || ""
|
|
3399
|
+
}
|
|
3400
|
+
];
|
|
3401
|
+
}
|
|
3402
|
+
function buildTransferFromSavingsOp(from, to, amount, memo, requestId) {
|
|
3403
|
+
if (!from || !to || !amount || requestId === void 0) {
|
|
3404
|
+
throw new Error("[SDK][buildTransferFromSavingsOp] Missing required parameters");
|
|
3592
3405
|
}
|
|
3593
|
-
|
|
3594
|
-
|
|
3406
|
+
return [
|
|
3407
|
+
"transfer_from_savings",
|
|
3408
|
+
{
|
|
3409
|
+
from,
|
|
3410
|
+
to,
|
|
3411
|
+
amount,
|
|
3412
|
+
memo: memo || "",
|
|
3413
|
+
request_id: requestId
|
|
3414
|
+
}
|
|
3415
|
+
];
|
|
3416
|
+
}
|
|
3417
|
+
function buildCancelTransferFromSavingsOp(from, requestId) {
|
|
3418
|
+
if (!from || requestId === void 0) {
|
|
3419
|
+
throw new Error("[SDK][buildCancelTransferFromSavingsOp] Missing required parameters");
|
|
3595
3420
|
}
|
|
3596
|
-
return
|
|
3421
|
+
return [
|
|
3422
|
+
"cancel_transfer_from_savings",
|
|
3423
|
+
{
|
|
3424
|
+
from,
|
|
3425
|
+
request_id: requestId
|
|
3426
|
+
}
|
|
3427
|
+
];
|
|
3597
3428
|
}
|
|
3598
|
-
function
|
|
3599
|
-
|
|
3600
|
-
|
|
3429
|
+
function buildClaimInterestOps(from, to, amount, memo, requestId) {
|
|
3430
|
+
if (!from || !to || !amount || requestId === void 0) {
|
|
3431
|
+
throw new Error("[SDK][buildClaimInterestOps] Missing required parameters");
|
|
3432
|
+
}
|
|
3433
|
+
return [
|
|
3434
|
+
buildTransferFromSavingsOp(from, to, amount, memo, requestId),
|
|
3435
|
+
buildCancelTransferFromSavingsOp(from, requestId)
|
|
3436
|
+
];
|
|
3601
3437
|
}
|
|
3602
|
-
function
|
|
3603
|
-
if (!
|
|
3604
|
-
|
|
3438
|
+
function buildTransferToVestingOp(from, to, amount) {
|
|
3439
|
+
if (!from || !to || !amount) {
|
|
3440
|
+
throw new Error("[SDK][buildTransferToVestingOp] Missing required parameters");
|
|
3605
3441
|
}
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3442
|
+
return [
|
|
3443
|
+
"transfer_to_vesting",
|
|
3444
|
+
{
|
|
3445
|
+
from,
|
|
3446
|
+
to,
|
|
3447
|
+
amount
|
|
3448
|
+
}
|
|
3449
|
+
];
|
|
3450
|
+
}
|
|
3451
|
+
function buildWithdrawVestingOp(account, vestingShares) {
|
|
3452
|
+
if (!account || !vestingShares) {
|
|
3453
|
+
throw new Error("[SDK][buildWithdrawVestingOp] Missing required parameters");
|
|
3609
3454
|
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3455
|
+
return [
|
|
3456
|
+
"withdraw_vesting",
|
|
3457
|
+
{
|
|
3458
|
+
account,
|
|
3459
|
+
vesting_shares: vestingShares
|
|
3460
|
+
}
|
|
3461
|
+
];
|
|
3462
|
+
}
|
|
3463
|
+
function buildDelegateVestingSharesOp(delegator, delegatee, vestingShares) {
|
|
3464
|
+
if (!delegator || !delegatee || !vestingShares) {
|
|
3465
|
+
throw new Error("[SDK][buildDelegateVestingSharesOp] Missing required parameters");
|
|
3612
3466
|
}
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
return 0;
|
|
3467
|
+
return [
|
|
3468
|
+
"delegate_vesting_shares",
|
|
3469
|
+
{
|
|
3470
|
+
delegator,
|
|
3471
|
+
delegatee,
|
|
3472
|
+
vesting_shares: vestingShares
|
|
3620
3473
|
}
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3474
|
+
];
|
|
3475
|
+
}
|
|
3476
|
+
function buildSetWithdrawVestingRouteOp(fromAccount, toAccount, percent, autoVest) {
|
|
3477
|
+
if (!fromAccount || !toAccount || percent === void 0) {
|
|
3478
|
+
throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Missing required parameters");
|
|
3624
3479
|
}
|
|
3625
|
-
if (
|
|
3626
|
-
|
|
3480
|
+
if (percent < 0 || percent > 1e4) {
|
|
3481
|
+
throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");
|
|
3627
3482
|
}
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3483
|
+
return [
|
|
3484
|
+
"set_withdraw_vesting_route",
|
|
3485
|
+
{
|
|
3486
|
+
from_account: fromAccount,
|
|
3487
|
+
to_account: toAccount,
|
|
3488
|
+
percent,
|
|
3489
|
+
auto_vest: autoVest
|
|
3490
|
+
}
|
|
3491
|
+
];
|
|
3492
|
+
}
|
|
3493
|
+
function buildConvertOp(owner, amount, requestId) {
|
|
3494
|
+
if (!owner || !amount || requestId === void 0) {
|
|
3495
|
+
throw new Error("[SDK][buildConvertOp] Missing required parameters");
|
|
3631
3496
|
}
|
|
3632
|
-
return
|
|
3497
|
+
return [
|
|
3498
|
+
"convert",
|
|
3499
|
+
{
|
|
3500
|
+
owner,
|
|
3501
|
+
amount,
|
|
3502
|
+
requestid: requestId
|
|
3503
|
+
}
|
|
3504
|
+
];
|
|
3633
3505
|
}
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
if (!voter || !author || !permlink) {
|
|
3638
|
-
throw new Error("[SDK][buildVoteOp] Missing required parameters");
|
|
3506
|
+
function buildCollateralizedConvertOp(owner, amount, requestId) {
|
|
3507
|
+
if (!owner || !amount || requestId === void 0) {
|
|
3508
|
+
throw new Error("[SDK][buildCollateralizedConvertOp] Missing required parameters");
|
|
3639
3509
|
}
|
|
3640
|
-
|
|
3641
|
-
|
|
3510
|
+
return [
|
|
3511
|
+
"collateralized_convert",
|
|
3512
|
+
{
|
|
3513
|
+
owner,
|
|
3514
|
+
amount,
|
|
3515
|
+
requestid: requestId
|
|
3516
|
+
}
|
|
3517
|
+
];
|
|
3518
|
+
}
|
|
3519
|
+
function buildDelegateRcOp(from, delegatees, maxRc) {
|
|
3520
|
+
if (!from || !delegatees || maxRc === void 0) {
|
|
3521
|
+
throw new Error("[SDK][buildDelegateRcOp] Missing required parameters");
|
|
3642
3522
|
}
|
|
3523
|
+
const delegateeArray = delegatees.includes(",") ? delegatees.split(",").map((d) => d.trim()) : [delegatees];
|
|
3643
3524
|
return [
|
|
3644
|
-
"
|
|
3525
|
+
"custom_json",
|
|
3645
3526
|
{
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3527
|
+
id: "rc",
|
|
3528
|
+
json: JSON.stringify([
|
|
3529
|
+
"delegate_rc",
|
|
3530
|
+
{
|
|
3531
|
+
from,
|
|
3532
|
+
delegatees: delegateeArray,
|
|
3533
|
+
max_rc: maxRc
|
|
3534
|
+
}
|
|
3535
|
+
]),
|
|
3536
|
+
required_auths: [],
|
|
3537
|
+
required_posting_auths: [from]
|
|
3650
3538
|
}
|
|
3651
3539
|
];
|
|
3652
3540
|
}
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3541
|
+
|
|
3542
|
+
// src/modules/operations/builders/social.ts
|
|
3543
|
+
function buildFollowOp(follower, following) {
|
|
3544
|
+
if (!follower || !following) {
|
|
3545
|
+
throw new Error("[SDK][buildFollowOp] Missing required parameters");
|
|
3656
3546
|
}
|
|
3657
3547
|
return [
|
|
3658
|
-
"
|
|
3548
|
+
"custom_json",
|
|
3659
3549
|
{
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3550
|
+
id: "follow",
|
|
3551
|
+
json: JSON.stringify([
|
|
3552
|
+
"follow",
|
|
3553
|
+
{
|
|
3554
|
+
follower,
|
|
3555
|
+
following,
|
|
3556
|
+
what: ["blog"]
|
|
3557
|
+
}
|
|
3558
|
+
]),
|
|
3559
|
+
required_auths: [],
|
|
3560
|
+
required_posting_auths: [follower]
|
|
3667
3561
|
}
|
|
3668
3562
|
];
|
|
3669
3563
|
}
|
|
3670
|
-
function
|
|
3671
|
-
if (!
|
|
3672
|
-
throw new Error("[SDK][
|
|
3564
|
+
function buildUnfollowOp(follower, following) {
|
|
3565
|
+
if (!follower || !following) {
|
|
3566
|
+
throw new Error("[SDK][buildUnfollowOp] Missing required parameters");
|
|
3673
3567
|
}
|
|
3674
3568
|
return [
|
|
3675
|
-
"
|
|
3569
|
+
"custom_json",
|
|
3676
3570
|
{
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3571
|
+
id: "follow",
|
|
3572
|
+
json: JSON.stringify([
|
|
3573
|
+
"follow",
|
|
3574
|
+
{
|
|
3575
|
+
follower,
|
|
3576
|
+
following,
|
|
3577
|
+
what: []
|
|
3578
|
+
}
|
|
3579
|
+
]),
|
|
3580
|
+
required_auths: [],
|
|
3581
|
+
required_posting_auths: [follower]
|
|
3684
3582
|
}
|
|
3685
3583
|
];
|
|
3686
3584
|
}
|
|
3687
|
-
function
|
|
3688
|
-
if (!
|
|
3689
|
-
throw new Error("[SDK][
|
|
3585
|
+
function buildIgnoreOp(follower, following) {
|
|
3586
|
+
if (!follower || !following) {
|
|
3587
|
+
throw new Error("[SDK][buildIgnoreOp] Missing required parameters");
|
|
3690
3588
|
}
|
|
3691
3589
|
return [
|
|
3692
|
-
"
|
|
3590
|
+
"custom_json",
|
|
3693
3591
|
{
|
|
3694
|
-
|
|
3695
|
-
|
|
3592
|
+
id: "follow",
|
|
3593
|
+
json: JSON.stringify([
|
|
3594
|
+
"follow",
|
|
3595
|
+
{
|
|
3596
|
+
follower,
|
|
3597
|
+
following,
|
|
3598
|
+
what: ["ignore"]
|
|
3599
|
+
}
|
|
3600
|
+
]),
|
|
3601
|
+
required_auths: [],
|
|
3602
|
+
required_posting_auths: [follower]
|
|
3696
3603
|
}
|
|
3697
3604
|
];
|
|
3698
3605
|
}
|
|
3699
|
-
function
|
|
3700
|
-
if (!
|
|
3701
|
-
throw new Error("[SDK][
|
|
3606
|
+
function buildUnignoreOp(follower, following) {
|
|
3607
|
+
if (!follower || !following) {
|
|
3608
|
+
throw new Error("[SDK][buildUnignoreOp] Missing required parameters");
|
|
3702
3609
|
}
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
if (deleteReblog) {
|
|
3709
|
-
json.delete = "delete";
|
|
3610
|
+
return buildUnfollowOp(follower, following);
|
|
3611
|
+
}
|
|
3612
|
+
function buildSetLastReadOps(username, date) {
|
|
3613
|
+
if (!username) {
|
|
3614
|
+
throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");
|
|
3710
3615
|
}
|
|
3711
|
-
|
|
3616
|
+
const lastReadDate = date || (/* @__PURE__ */ new Date()).toISOString().split(".")[0];
|
|
3617
|
+
const notifyOp = [
|
|
3712
3618
|
"custom_json",
|
|
3713
3619
|
{
|
|
3714
|
-
id: "
|
|
3715
|
-
json: JSON.stringify(["
|
|
3620
|
+
id: "notify",
|
|
3621
|
+
json: JSON.stringify(["setLastRead", { date: lastReadDate }]),
|
|
3716
3622
|
required_auths: [],
|
|
3717
|
-
required_posting_auths: [
|
|
3623
|
+
required_posting_auths: [username]
|
|
3718
3624
|
}
|
|
3719
3625
|
];
|
|
3626
|
+
const ecencyNotifyOp = [
|
|
3627
|
+
"custom_json",
|
|
3628
|
+
{
|
|
3629
|
+
id: "ecency_notify",
|
|
3630
|
+
json: JSON.stringify(["setLastRead", { date: lastReadDate }]),
|
|
3631
|
+
required_auths: [],
|
|
3632
|
+
required_posting_auths: [username]
|
|
3633
|
+
}
|
|
3634
|
+
];
|
|
3635
|
+
return [notifyOp, ecencyNotifyOp];
|
|
3720
3636
|
}
|
|
3721
3637
|
|
|
3722
|
-
// src/modules/operations/builders/
|
|
3723
|
-
function
|
|
3724
|
-
if (!
|
|
3725
|
-
throw new Error("[SDK][
|
|
3638
|
+
// src/modules/operations/builders/governance.ts
|
|
3639
|
+
function buildWitnessVoteOp(account, witness, approve) {
|
|
3640
|
+
if (!account || !witness || approve === void 0) {
|
|
3641
|
+
throw new Error("[SDK][buildWitnessVoteOp] Missing required parameters");
|
|
3726
3642
|
}
|
|
3727
3643
|
return [
|
|
3728
|
-
"
|
|
3644
|
+
"account_witness_vote",
|
|
3729
3645
|
{
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
memo: memo || ""
|
|
3646
|
+
account,
|
|
3647
|
+
witness,
|
|
3648
|
+
approve
|
|
3734
3649
|
}
|
|
3735
3650
|
];
|
|
3736
3651
|
}
|
|
3737
|
-
function
|
|
3738
|
-
if (!
|
|
3739
|
-
throw new Error("[SDK][
|
|
3652
|
+
function buildWitnessProxyOp(account, proxy) {
|
|
3653
|
+
if (!account || proxy === void 0) {
|
|
3654
|
+
throw new Error("[SDK][buildWitnessProxyOp] Missing required parameters");
|
|
3740
3655
|
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3656
|
+
return [
|
|
3657
|
+
"account_witness_proxy",
|
|
3658
|
+
{
|
|
3659
|
+
account,
|
|
3660
|
+
proxy
|
|
3661
|
+
}
|
|
3662
|
+
];
|
|
3745
3663
|
}
|
|
3746
|
-
function
|
|
3747
|
-
if (!
|
|
3748
|
-
throw new Error("[SDK][
|
|
3664
|
+
function buildProposalCreateOp(creator, payload) {
|
|
3665
|
+
if (!creator || !payload.receiver || !payload.subject || !payload.permlink || !payload.start || !payload.end || !payload.dailyPay) {
|
|
3666
|
+
throw new Error("[SDK][buildProposalCreateOp] Missing required parameters");
|
|
3749
3667
|
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3668
|
+
const startDate = new Date(payload.start);
|
|
3669
|
+
const endDate = new Date(payload.end);
|
|
3670
|
+
if (startDate.toString() === "Invalid Date" || endDate.toString() === "Invalid Date") {
|
|
3671
|
+
throw new Error(
|
|
3672
|
+
"[SDK][buildProposalCreateOp] Invalid date format: start and end must be valid ISO date strings"
|
|
3673
|
+
);
|
|
3752
3674
|
}
|
|
3753
3675
|
return [
|
|
3754
|
-
"
|
|
3676
|
+
"create_proposal",
|
|
3755
3677
|
{
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3678
|
+
creator,
|
|
3679
|
+
receiver: payload.receiver,
|
|
3680
|
+
start_date: payload.start,
|
|
3681
|
+
end_date: payload.end,
|
|
3682
|
+
daily_pay: payload.dailyPay,
|
|
3683
|
+
subject: payload.subject,
|
|
3684
|
+
permlink: payload.permlink,
|
|
3762
3685
|
extensions: []
|
|
3763
3686
|
}
|
|
3764
3687
|
];
|
|
3765
3688
|
}
|
|
3766
|
-
function
|
|
3767
|
-
if (!
|
|
3768
|
-
throw new Error("[SDK][
|
|
3689
|
+
function buildProposalVoteOp(voter, proposalIds, approve) {
|
|
3690
|
+
if (!voter || !proposalIds || proposalIds.length === 0 || approve === void 0) {
|
|
3691
|
+
throw new Error("[SDK][buildProposalVoteOp] Missing required parameters");
|
|
3769
3692
|
}
|
|
3770
3693
|
return [
|
|
3771
|
-
"
|
|
3694
|
+
"update_proposal_votes",
|
|
3772
3695
|
{
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3696
|
+
voter,
|
|
3697
|
+
proposal_ids: proposalIds,
|
|
3698
|
+
approve,
|
|
3699
|
+
extensions: []
|
|
3777
3700
|
}
|
|
3778
3701
|
];
|
|
3779
3702
|
}
|
|
3780
|
-
function
|
|
3781
|
-
if (!
|
|
3782
|
-
throw new Error("[SDK][
|
|
3703
|
+
function buildRemoveProposalOp(proposalOwner, proposalIds) {
|
|
3704
|
+
if (!proposalOwner || !proposalIds || proposalIds.length === 0) {
|
|
3705
|
+
throw new Error("[SDK][buildRemoveProposalOp] Missing required parameters");
|
|
3783
3706
|
}
|
|
3784
3707
|
return [
|
|
3785
|
-
"
|
|
3708
|
+
"remove_proposal",
|
|
3709
|
+
{
|
|
3710
|
+
proposal_owner: proposalOwner,
|
|
3711
|
+
proposal_ids: proposalIds,
|
|
3712
|
+
extensions: []
|
|
3713
|
+
}
|
|
3714
|
+
];
|
|
3715
|
+
}
|
|
3716
|
+
function buildUpdateProposalOp(proposalId, creator, dailyPay, subject, permlink) {
|
|
3717
|
+
if (proposalId === void 0 || proposalId === null || typeof proposalId !== "number" || !creator || !dailyPay || !subject || !permlink) {
|
|
3718
|
+
throw new Error("[SDK][buildUpdateProposalOp] Missing required parameters");
|
|
3719
|
+
}
|
|
3720
|
+
return [
|
|
3721
|
+
"update_proposal",
|
|
3722
|
+
{
|
|
3723
|
+
proposal_id: proposalId,
|
|
3724
|
+
creator,
|
|
3725
|
+
daily_pay: dailyPay,
|
|
3726
|
+
subject,
|
|
3727
|
+
permlink,
|
|
3728
|
+
extensions: []
|
|
3729
|
+
}
|
|
3730
|
+
];
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
// src/modules/operations/builders/community.ts
|
|
3734
|
+
function buildSubscribeOp(username, community) {
|
|
3735
|
+
if (!username || !community) {
|
|
3736
|
+
throw new Error("[SDK][buildSubscribeOp] Missing required parameters");
|
|
3737
|
+
}
|
|
3738
|
+
return [
|
|
3739
|
+
"custom_json",
|
|
3786
3740
|
{
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
request_id: requestId
|
|
3741
|
+
id: "community",
|
|
3742
|
+
json: JSON.stringify(["subscribe", { community }]),
|
|
3743
|
+
required_auths: [],
|
|
3744
|
+
required_posting_auths: [username]
|
|
3792
3745
|
}
|
|
3793
3746
|
];
|
|
3794
3747
|
}
|
|
3795
|
-
function
|
|
3796
|
-
if (!
|
|
3797
|
-
throw new Error("[SDK][
|
|
3748
|
+
function buildUnsubscribeOp(username, community) {
|
|
3749
|
+
if (!username || !community) {
|
|
3750
|
+
throw new Error("[SDK][buildUnsubscribeOp] Missing required parameters");
|
|
3798
3751
|
}
|
|
3799
3752
|
return [
|
|
3800
|
-
"
|
|
3753
|
+
"custom_json",
|
|
3801
3754
|
{
|
|
3802
|
-
|
|
3803
|
-
|
|
3755
|
+
id: "community",
|
|
3756
|
+
json: JSON.stringify(["unsubscribe", { community }]),
|
|
3757
|
+
required_auths: [],
|
|
3758
|
+
required_posting_auths: [username]
|
|
3804
3759
|
}
|
|
3805
3760
|
];
|
|
3806
3761
|
}
|
|
3807
|
-
function
|
|
3808
|
-
if (!
|
|
3809
|
-
throw new Error("[SDK][
|
|
3762
|
+
function buildSetRoleOp(username, community, account, role) {
|
|
3763
|
+
if (!username || !community || !account || !role) {
|
|
3764
|
+
throw new Error("[SDK][buildSetRoleOp] Missing required parameters");
|
|
3810
3765
|
}
|
|
3811
3766
|
return [
|
|
3812
|
-
|
|
3813
|
-
|
|
3767
|
+
"custom_json",
|
|
3768
|
+
{
|
|
3769
|
+
id: "community",
|
|
3770
|
+
json: JSON.stringify(["setRole", { community, account, role }]),
|
|
3771
|
+
required_auths: [],
|
|
3772
|
+
required_posting_auths: [username]
|
|
3773
|
+
}
|
|
3814
3774
|
];
|
|
3815
3775
|
}
|
|
3816
|
-
function
|
|
3817
|
-
if (!
|
|
3818
|
-
throw new Error("[SDK][
|
|
3776
|
+
function buildUpdateCommunityOp(username, community, props) {
|
|
3777
|
+
if (!username || !community || !props) {
|
|
3778
|
+
throw new Error("[SDK][buildUpdateCommunityOp] Missing required parameters");
|
|
3819
3779
|
}
|
|
3820
3780
|
return [
|
|
3821
|
-
"
|
|
3781
|
+
"custom_json",
|
|
3822
3782
|
{
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3783
|
+
id: "community",
|
|
3784
|
+
json: JSON.stringify(["updateProps", { community, props }]),
|
|
3785
|
+
required_auths: [],
|
|
3786
|
+
required_posting_auths: [username]
|
|
3826
3787
|
}
|
|
3827
3788
|
];
|
|
3828
3789
|
}
|
|
3829
|
-
function
|
|
3830
|
-
if (!account || !
|
|
3831
|
-
throw new Error("[SDK][
|
|
3790
|
+
function buildPinPostOp(username, community, account, permlink, pin) {
|
|
3791
|
+
if (!username || !community || !account || !permlink || pin === void 0) {
|
|
3792
|
+
throw new Error("[SDK][buildPinPostOp] Missing required parameters");
|
|
3832
3793
|
}
|
|
3794
|
+
const action = pin ? "pinPost" : "unpinPost";
|
|
3833
3795
|
return [
|
|
3834
|
-
"
|
|
3796
|
+
"custom_json",
|
|
3835
3797
|
{
|
|
3836
|
-
|
|
3837
|
-
|
|
3798
|
+
id: "community",
|
|
3799
|
+
json: JSON.stringify([action, { community, account, permlink }]),
|
|
3800
|
+
required_auths: [],
|
|
3801
|
+
required_posting_auths: [username]
|
|
3838
3802
|
}
|
|
3839
3803
|
];
|
|
3840
3804
|
}
|
|
3841
|
-
function
|
|
3842
|
-
if (!
|
|
3843
|
-
throw new Error("[SDK][
|
|
3805
|
+
function buildMutePostOp(username, community, account, permlink, notes, mute) {
|
|
3806
|
+
if (!username || !community || !account || !permlink || mute === void 0) {
|
|
3807
|
+
throw new Error("[SDK][buildMutePostOp] Missing required parameters");
|
|
3844
3808
|
}
|
|
3809
|
+
const action = mute ? "mutePost" : "unmutePost";
|
|
3845
3810
|
return [
|
|
3846
|
-
"
|
|
3811
|
+
"custom_json",
|
|
3847
3812
|
{
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3813
|
+
id: "community",
|
|
3814
|
+
json: JSON.stringify([action, { community, account, permlink, notes }]),
|
|
3815
|
+
required_auths: [],
|
|
3816
|
+
required_posting_auths: [username]
|
|
3851
3817
|
}
|
|
3852
3818
|
];
|
|
3853
3819
|
}
|
|
3854
|
-
function
|
|
3855
|
-
if (!
|
|
3856
|
-
throw new Error("[SDK][
|
|
3857
|
-
}
|
|
3858
|
-
if (percent < 0 || percent > 1e4) {
|
|
3859
|
-
throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");
|
|
3820
|
+
function buildMuteUserOp(username, community, account, notes, mute) {
|
|
3821
|
+
if (!username || !community || !account || mute === void 0) {
|
|
3822
|
+
throw new Error("[SDK][buildMuteUserOp] Missing required parameters");
|
|
3860
3823
|
}
|
|
3824
|
+
const action = mute ? "muteUser" : "unmuteUser";
|
|
3861
3825
|
return [
|
|
3862
|
-
"
|
|
3826
|
+
"custom_json",
|
|
3863
3827
|
{
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3828
|
+
id: "community",
|
|
3829
|
+
json: JSON.stringify([action, { community, account, notes }]),
|
|
3830
|
+
required_auths: [],
|
|
3831
|
+
required_posting_auths: [username]
|
|
3868
3832
|
}
|
|
3869
3833
|
];
|
|
3870
3834
|
}
|
|
3871
|
-
function
|
|
3872
|
-
if (!
|
|
3873
|
-
throw new Error("[SDK][
|
|
3835
|
+
function buildFlagPostOp(username, community, account, permlink, notes) {
|
|
3836
|
+
if (!username || !community || !account || !permlink) {
|
|
3837
|
+
throw new Error("[SDK][buildFlagPostOp] Missing required parameters");
|
|
3874
3838
|
}
|
|
3875
3839
|
return [
|
|
3876
|
-
"
|
|
3840
|
+
"custom_json",
|
|
3877
3841
|
{
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3842
|
+
id: "community",
|
|
3843
|
+
json: JSON.stringify(["flagPost", { community, account, permlink, notes }]),
|
|
3844
|
+
required_auths: [],
|
|
3845
|
+
required_posting_auths: [username]
|
|
3881
3846
|
}
|
|
3882
3847
|
];
|
|
3883
3848
|
}
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3849
|
+
|
|
3850
|
+
// src/modules/operations/builders/market.ts
|
|
3851
|
+
var BuySellTransactionType = /* @__PURE__ */ ((BuySellTransactionType2) => {
|
|
3852
|
+
BuySellTransactionType2["Buy"] = "buy";
|
|
3853
|
+
BuySellTransactionType2["Sell"] = "sell";
|
|
3854
|
+
return BuySellTransactionType2;
|
|
3855
|
+
})(BuySellTransactionType || {});
|
|
3856
|
+
var OrderIdPrefix = /* @__PURE__ */ ((OrderIdPrefix2) => {
|
|
3857
|
+
OrderIdPrefix2["EMPTY"] = "";
|
|
3858
|
+
OrderIdPrefix2["SWAP"] = "9";
|
|
3859
|
+
return OrderIdPrefix2;
|
|
3860
|
+
})(OrderIdPrefix || {});
|
|
3861
|
+
function buildLimitOrderCreateOp(owner, amountToSell, minToReceive, fillOrKill, expiration, orderId) {
|
|
3862
|
+
if (!owner || !amountToSell || !minToReceive || !expiration || orderId === void 0) {
|
|
3863
|
+
throw new Error("[SDK][buildLimitOrderCreateOp] Missing required parameters");
|
|
3887
3864
|
}
|
|
3888
3865
|
return [
|
|
3889
|
-
"
|
|
3866
|
+
"limit_order_create",
|
|
3890
3867
|
{
|
|
3891
3868
|
owner,
|
|
3892
|
-
|
|
3893
|
-
|
|
3869
|
+
orderid: orderId,
|
|
3870
|
+
amount_to_sell: amountToSell,
|
|
3871
|
+
min_to_receive: minToReceive,
|
|
3872
|
+
fill_or_kill: fillOrKill,
|
|
3873
|
+
expiration
|
|
3894
3874
|
}
|
|
3895
3875
|
];
|
|
3896
3876
|
}
|
|
3897
|
-
function
|
|
3898
|
-
|
|
3899
|
-
|
|
3877
|
+
function formatNumber(value, decimals = 3) {
|
|
3878
|
+
return value.toFixed(decimals);
|
|
3879
|
+
}
|
|
3880
|
+
function buildLimitOrderCreateOpWithType(owner, amountToSell, minToReceive, orderType, idPrefix = "" /* EMPTY */) {
|
|
3881
|
+
if (!owner || orderType === void 0 || !Number.isFinite(amountToSell) || amountToSell <= 0 || !Number.isFinite(minToReceive) || minToReceive <= 0) {
|
|
3882
|
+
throw new Error("[SDK][buildLimitOrderCreateOpWithType] Missing or invalid parameters");
|
|
3900
3883
|
}
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
];
|
|
3884
|
+
const expiration = new Date(Date.now());
|
|
3885
|
+
expiration.setDate(expiration.getDate() + 27);
|
|
3886
|
+
const expirationStr = expiration.toISOString().split(".")[0];
|
|
3887
|
+
const orderId = Number(
|
|
3888
|
+
`${idPrefix}${Math.floor(Date.now() / 1e3).toString().slice(2)}`
|
|
3889
|
+
);
|
|
3890
|
+
const formattedAmountToSell = orderType === "buy" /* Buy */ ? `${formatNumber(amountToSell, 3)} HBD` : `${formatNumber(amountToSell, 3)} HIVE`;
|
|
3891
|
+
const formattedMinToReceive = orderType === "buy" /* Buy */ ? `${formatNumber(minToReceive, 3)} HIVE` : `${formatNumber(minToReceive, 3)} HBD`;
|
|
3892
|
+
return buildLimitOrderCreateOp(
|
|
3893
|
+
owner,
|
|
3894
|
+
formattedAmountToSell,
|
|
3895
|
+
formattedMinToReceive,
|
|
3896
|
+
false,
|
|
3897
|
+
expirationStr,
|
|
3898
|
+
orderId
|
|
3899
|
+
);
|
|
3918
3900
|
}
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
if (!follower || !following) {
|
|
3923
|
-
throw new Error("[SDK][buildFollowOp] Missing required parameters");
|
|
3901
|
+
function buildLimitOrderCancelOp(owner, orderId) {
|
|
3902
|
+
if (!owner || orderId === void 0) {
|
|
3903
|
+
throw new Error("[SDK][buildLimitOrderCancelOp] Missing required parameters");
|
|
3924
3904
|
}
|
|
3925
3905
|
return [
|
|
3926
|
-
"
|
|
3906
|
+
"limit_order_cancel",
|
|
3927
3907
|
{
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
"follow",
|
|
3931
|
-
{
|
|
3932
|
-
follower,
|
|
3933
|
-
following,
|
|
3934
|
-
what: ["blog"]
|
|
3935
|
-
}
|
|
3936
|
-
]),
|
|
3937
|
-
required_auths: [],
|
|
3938
|
-
required_posting_auths: [follower]
|
|
3908
|
+
owner,
|
|
3909
|
+
orderid: orderId
|
|
3939
3910
|
}
|
|
3940
3911
|
];
|
|
3941
3912
|
}
|
|
3942
|
-
function
|
|
3943
|
-
if (!
|
|
3944
|
-
throw new Error("[SDK][
|
|
3913
|
+
function buildClaimRewardBalanceOp(account, rewardHive, rewardHbd, rewardVests) {
|
|
3914
|
+
if (!account || !rewardHive || !rewardHbd || !rewardVests) {
|
|
3915
|
+
throw new Error("[SDK][buildClaimRewardBalanceOp] Missing required parameters");
|
|
3945
3916
|
}
|
|
3946
3917
|
return [
|
|
3947
|
-
"
|
|
3918
|
+
"claim_reward_balance",
|
|
3948
3919
|
{
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
follower,
|
|
3954
|
-
following,
|
|
3955
|
-
what: []
|
|
3956
|
-
}
|
|
3957
|
-
]),
|
|
3958
|
-
required_auths: [],
|
|
3959
|
-
required_posting_auths: [follower]
|
|
3920
|
+
account,
|
|
3921
|
+
reward_hive: rewardHive,
|
|
3922
|
+
reward_hbd: rewardHbd,
|
|
3923
|
+
reward_vests: rewardVests
|
|
3960
3924
|
}
|
|
3961
3925
|
];
|
|
3962
3926
|
}
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3927
|
+
|
|
3928
|
+
// src/modules/operations/builders/account.ts
|
|
3929
|
+
function buildAccountUpdateOp(account, owner, active, posting, memoKey, jsonMetadata) {
|
|
3930
|
+
if (!account || !memoKey) {
|
|
3931
|
+
throw new Error("[SDK][buildAccountUpdateOp] Missing required parameters");
|
|
3966
3932
|
}
|
|
3967
3933
|
return [
|
|
3968
|
-
"
|
|
3934
|
+
"account_update",
|
|
3969
3935
|
{
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
what: ["ignore"]
|
|
3977
|
-
}
|
|
3978
|
-
]),
|
|
3979
|
-
required_auths: [],
|
|
3980
|
-
required_posting_auths: [follower]
|
|
3936
|
+
account,
|
|
3937
|
+
owner,
|
|
3938
|
+
active,
|
|
3939
|
+
posting,
|
|
3940
|
+
memo_key: memoKey,
|
|
3941
|
+
json_metadata: jsonMetadata
|
|
3981
3942
|
}
|
|
3982
3943
|
];
|
|
3983
3944
|
}
|
|
3984
|
-
function
|
|
3985
|
-
if (!
|
|
3986
|
-
throw new Error("[SDK][
|
|
3987
|
-
}
|
|
3988
|
-
return buildUnfollowOp(follower, following);
|
|
3989
|
-
}
|
|
3990
|
-
function buildSetLastReadOps(username, date) {
|
|
3991
|
-
if (!username) {
|
|
3992
|
-
throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");
|
|
3945
|
+
function buildAccountUpdate2Op(account, jsonMetadata, postingJsonMetadata, extensions) {
|
|
3946
|
+
if (!account || postingJsonMetadata === void 0) {
|
|
3947
|
+
throw new Error("[SDK][buildAccountUpdate2Op] Missing required parameters");
|
|
3993
3948
|
}
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
"custom_json",
|
|
3949
|
+
return [
|
|
3950
|
+
"account_update2",
|
|
3997
3951
|
{
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
3952
|
+
account,
|
|
3953
|
+
json_metadata: jsonMetadata || "",
|
|
3954
|
+
posting_json_metadata: postingJsonMetadata,
|
|
3955
|
+
extensions: extensions || []
|
|
4002
3956
|
}
|
|
4003
3957
|
];
|
|
4004
|
-
|
|
4005
|
-
|
|
3958
|
+
}
|
|
3959
|
+
function buildAccountCreateOp(creator, newAccountName, keys, fee) {
|
|
3960
|
+
if (!creator || !newAccountName || !keys || !fee) {
|
|
3961
|
+
throw new Error("[SDK][buildAccountCreateOp] Missing required parameters");
|
|
3962
|
+
}
|
|
3963
|
+
const owner = {
|
|
3964
|
+
weight_threshold: 1,
|
|
3965
|
+
account_auths: [],
|
|
3966
|
+
key_auths: [[keys.ownerPublicKey, 1]]
|
|
3967
|
+
};
|
|
3968
|
+
const active = {
|
|
3969
|
+
weight_threshold: 1,
|
|
3970
|
+
account_auths: [],
|
|
3971
|
+
key_auths: [[keys.activePublicKey, 1]]
|
|
3972
|
+
};
|
|
3973
|
+
const posting = {
|
|
3974
|
+
weight_threshold: 1,
|
|
3975
|
+
account_auths: [["ecency.app", 1]],
|
|
3976
|
+
key_auths: [[keys.postingPublicKey, 1]]
|
|
3977
|
+
};
|
|
3978
|
+
return [
|
|
3979
|
+
"account_create",
|
|
4006
3980
|
{
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
3981
|
+
creator,
|
|
3982
|
+
new_account_name: newAccountName,
|
|
3983
|
+
owner,
|
|
3984
|
+
active,
|
|
3985
|
+
posting,
|
|
3986
|
+
memo_key: keys.memoPublicKey,
|
|
3987
|
+
json_metadata: "",
|
|
3988
|
+
extensions: [],
|
|
3989
|
+
fee
|
|
4011
3990
|
}
|
|
4012
3991
|
];
|
|
4013
|
-
return [notifyOp, ecencyNotifyOp];
|
|
4014
3992
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
if (!account || !witness || approve === void 0) {
|
|
4019
|
-
throw new Error("[SDK][buildWitnessVoteOp] Missing required parameters");
|
|
3993
|
+
function buildCreateClaimedAccountOp(creator, newAccountName, keys) {
|
|
3994
|
+
if (!creator || !newAccountName || !keys) {
|
|
3995
|
+
throw new Error("[SDK][buildCreateClaimedAccountOp] Missing required parameters");
|
|
4020
3996
|
}
|
|
3997
|
+
const owner = {
|
|
3998
|
+
weight_threshold: 1,
|
|
3999
|
+
account_auths: [],
|
|
4000
|
+
key_auths: [[keys.ownerPublicKey, 1]]
|
|
4001
|
+
};
|
|
4002
|
+
const active = {
|
|
4003
|
+
weight_threshold: 1,
|
|
4004
|
+
account_auths: [],
|
|
4005
|
+
key_auths: [[keys.activePublicKey, 1]]
|
|
4006
|
+
};
|
|
4007
|
+
const posting = {
|
|
4008
|
+
weight_threshold: 1,
|
|
4009
|
+
account_auths: [["ecency.app", 1]],
|
|
4010
|
+
key_auths: [[keys.postingPublicKey, 1]]
|
|
4011
|
+
};
|
|
4021
4012
|
return [
|
|
4022
|
-
"
|
|
4013
|
+
"create_claimed_account",
|
|
4023
4014
|
{
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4015
|
+
creator,
|
|
4016
|
+
new_account_name: newAccountName,
|
|
4017
|
+
owner,
|
|
4018
|
+
active,
|
|
4019
|
+
posting,
|
|
4020
|
+
memo_key: keys.memoPublicKey,
|
|
4021
|
+
json_metadata: "",
|
|
4022
|
+
extensions: []
|
|
4027
4023
|
}
|
|
4028
4024
|
];
|
|
4029
4025
|
}
|
|
4030
|
-
function
|
|
4031
|
-
if (!
|
|
4032
|
-
throw new Error("[SDK][
|
|
4026
|
+
function buildClaimAccountOp(creator, fee) {
|
|
4027
|
+
if (!creator || !fee) {
|
|
4028
|
+
throw new Error("[SDK][buildClaimAccountOp] Missing required parameters");
|
|
4033
4029
|
}
|
|
4034
4030
|
return [
|
|
4035
|
-
"
|
|
4031
|
+
"claim_account",
|
|
4036
4032
|
{
|
|
4037
|
-
|
|
4038
|
-
|
|
4033
|
+
creator,
|
|
4034
|
+
fee,
|
|
4035
|
+
extensions: []
|
|
4039
4036
|
}
|
|
4040
4037
|
];
|
|
4041
4038
|
}
|
|
4042
|
-
function
|
|
4043
|
-
if (!
|
|
4044
|
-
throw new Error("[SDK][
|
|
4039
|
+
function buildGrantPostingPermissionOp(account, currentPosting, grantedAccount, weightThreshold, memoKey, jsonMetadata) {
|
|
4040
|
+
if (!account || !currentPosting || !grantedAccount || !memoKey) {
|
|
4041
|
+
throw new Error("[SDK][buildGrantPostingPermissionOp] Missing required parameters");
|
|
4045
4042
|
}
|
|
4046
|
-
const
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4043
|
+
const existingIndex = currentPosting.account_auths.findIndex(
|
|
4044
|
+
([acc]) => acc === grantedAccount
|
|
4045
|
+
);
|
|
4046
|
+
const newAccountAuths = [...currentPosting.account_auths];
|
|
4047
|
+
if (existingIndex >= 0) {
|
|
4048
|
+
newAccountAuths[existingIndex] = [grantedAccount, weightThreshold];
|
|
4049
|
+
} else {
|
|
4050
|
+
newAccountAuths.push([grantedAccount, weightThreshold]);
|
|
4052
4051
|
}
|
|
4052
|
+
const newPosting = {
|
|
4053
|
+
...currentPosting,
|
|
4054
|
+
account_auths: newAccountAuths
|
|
4055
|
+
};
|
|
4056
|
+
newPosting.account_auths.sort((a, b) => a[0] > b[0] ? 1 : -1);
|
|
4053
4057
|
return [
|
|
4054
|
-
"
|
|
4058
|
+
"account_update",
|
|
4055
4059
|
{
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
daily_pay: payload.dailyPay,
|
|
4061
|
-
subject: payload.subject,
|
|
4062
|
-
permlink: payload.permlink,
|
|
4063
|
-
extensions: []
|
|
4060
|
+
account,
|
|
4061
|
+
posting: newPosting,
|
|
4062
|
+
memo_key: memoKey,
|
|
4063
|
+
json_metadata: jsonMetadata
|
|
4064
4064
|
}
|
|
4065
4065
|
];
|
|
4066
4066
|
}
|
|
4067
|
-
function
|
|
4068
|
-
if (!
|
|
4069
|
-
throw new Error("[SDK][
|
|
4067
|
+
function buildRevokePostingPermissionOp(account, currentPosting, revokedAccount, memoKey, jsonMetadata) {
|
|
4068
|
+
if (!account || !currentPosting || !revokedAccount || !memoKey) {
|
|
4069
|
+
throw new Error("[SDK][buildRevokePostingPermissionOp] Missing required parameters");
|
|
4070
4070
|
}
|
|
4071
|
+
const newPosting = {
|
|
4072
|
+
...currentPosting,
|
|
4073
|
+
account_auths: currentPosting.account_auths.filter(
|
|
4074
|
+
([acc]) => acc !== revokedAccount
|
|
4075
|
+
)
|
|
4076
|
+
};
|
|
4071
4077
|
return [
|
|
4072
|
-
"
|
|
4078
|
+
"account_update",
|
|
4073
4079
|
{
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4080
|
+
account,
|
|
4081
|
+
posting: newPosting,
|
|
4082
|
+
memo_key: memoKey,
|
|
4083
|
+
json_metadata: jsonMetadata
|
|
4078
4084
|
}
|
|
4079
4085
|
];
|
|
4080
4086
|
}
|
|
4081
|
-
function
|
|
4082
|
-
if (!
|
|
4083
|
-
throw new Error("[SDK][
|
|
4087
|
+
function buildChangeRecoveryAccountOp(accountToRecover, newRecoveryAccount, extensions = []) {
|
|
4088
|
+
if (!accountToRecover || !newRecoveryAccount) {
|
|
4089
|
+
throw new Error("[SDK][buildChangeRecoveryAccountOp] Missing required parameters");
|
|
4084
4090
|
}
|
|
4085
4091
|
return [
|
|
4086
|
-
"
|
|
4092
|
+
"change_recovery_account",
|
|
4087
4093
|
{
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
extensions
|
|
4094
|
+
account_to_recover: accountToRecover,
|
|
4095
|
+
new_recovery_account: newRecoveryAccount,
|
|
4096
|
+
extensions
|
|
4091
4097
|
}
|
|
4092
4098
|
];
|
|
4093
4099
|
}
|
|
4094
|
-
function
|
|
4095
|
-
if (
|
|
4096
|
-
throw new Error("[SDK][
|
|
4100
|
+
function buildRequestAccountRecoveryOp(recoveryAccount, accountToRecover, newOwnerAuthority, extensions = []) {
|
|
4101
|
+
if (!recoveryAccount || !accountToRecover || !newOwnerAuthority) {
|
|
4102
|
+
throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");
|
|
4097
4103
|
}
|
|
4098
4104
|
return [
|
|
4099
|
-
"
|
|
4105
|
+
"request_account_recovery",
|
|
4100
4106
|
{
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
permlink,
|
|
4106
|
-
extensions: []
|
|
4107
|
+
recovery_account: recoveryAccount,
|
|
4108
|
+
account_to_recover: accountToRecover,
|
|
4109
|
+
new_owner_authority: newOwnerAuthority,
|
|
4110
|
+
extensions
|
|
4107
4111
|
}
|
|
4108
4112
|
];
|
|
4109
4113
|
}
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
if (!username || !community) {
|
|
4114
|
-
throw new Error("[SDK][buildSubscribeOp] Missing required parameters");
|
|
4114
|
+
function buildRecoverAccountOp(accountToRecover, newOwnerAuthority, recentOwnerAuthority, extensions = []) {
|
|
4115
|
+
if (!accountToRecover || !newOwnerAuthority || !recentOwnerAuthority) {
|
|
4116
|
+
throw new Error("[SDK][buildRecoverAccountOp] Missing required parameters");
|
|
4115
4117
|
}
|
|
4116
4118
|
return [
|
|
4117
|
-
"
|
|
4119
|
+
"recover_account",
|
|
4118
4120
|
{
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4121
|
+
account_to_recover: accountToRecover,
|
|
4122
|
+
new_owner_authority: newOwnerAuthority,
|
|
4123
|
+
recent_owner_authority: recentOwnerAuthority,
|
|
4124
|
+
extensions
|
|
4123
4125
|
}
|
|
4124
4126
|
];
|
|
4125
4127
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4128
|
+
|
|
4129
|
+
// src/modules/operations/builders/ecency.ts
|
|
4130
|
+
function buildBoostOp(user, author, permlink, amount) {
|
|
4131
|
+
if (!user || !author || !permlink || !amount) {
|
|
4132
|
+
throw new Error("[SDK][buildBoostOp] Missing required parameters");
|
|
4129
4133
|
}
|
|
4130
4134
|
return [
|
|
4131
4135
|
"custom_json",
|
|
4132
4136
|
{
|
|
4133
|
-
id: "
|
|
4134
|
-
json: JSON.stringify(
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
+
id: "ecency_boost",
|
|
4138
|
+
json: JSON.stringify({
|
|
4139
|
+
user,
|
|
4140
|
+
author,
|
|
4141
|
+
permlink,
|
|
4142
|
+
amount
|
|
4143
|
+
}),
|
|
4144
|
+
required_auths: [user],
|
|
4145
|
+
required_posting_auths: []
|
|
4137
4146
|
}
|
|
4138
4147
|
];
|
|
4139
4148
|
}
|
|
4140
|
-
function
|
|
4141
|
-
if (!
|
|
4142
|
-
throw new Error("[SDK][
|
|
4149
|
+
function buildBoostOpWithPoints(user, author, permlink, points) {
|
|
4150
|
+
if (!user || !author || !permlink || !Number.isFinite(points)) {
|
|
4151
|
+
throw new Error("[SDK][buildBoostOpWithPoints] Missing required parameters");
|
|
4152
|
+
}
|
|
4153
|
+
return buildBoostOp(user, author, permlink, `${points.toFixed(3)} POINT`);
|
|
4154
|
+
}
|
|
4155
|
+
function buildBoostPlusOp(user, account, duration) {
|
|
4156
|
+
if (!user || !account || !Number.isFinite(duration)) {
|
|
4157
|
+
throw new Error("[SDK][buildBoostPlusOp] Missing required parameters");
|
|
4143
4158
|
}
|
|
4144
4159
|
return [
|
|
4145
4160
|
"custom_json",
|
|
4146
4161
|
{
|
|
4147
|
-
id: "
|
|
4148
|
-
json: JSON.stringify(
|
|
4149
|
-
|
|
4150
|
-
|
|
4162
|
+
id: "ecency_boost_plus",
|
|
4163
|
+
json: JSON.stringify({
|
|
4164
|
+
user,
|
|
4165
|
+
account,
|
|
4166
|
+
duration
|
|
4167
|
+
}),
|
|
4168
|
+
required_auths: [user],
|
|
4169
|
+
required_posting_auths: []
|
|
4151
4170
|
}
|
|
4152
4171
|
];
|
|
4153
4172
|
}
|
|
4154
|
-
function
|
|
4155
|
-
if (!
|
|
4156
|
-
throw new Error("[SDK][
|
|
4173
|
+
function buildPromoteOp(user, author, permlink, duration) {
|
|
4174
|
+
if (!user || !author || !permlink || !Number.isFinite(duration)) {
|
|
4175
|
+
throw new Error("[SDK][buildPromoteOp] Missing required parameters");
|
|
4157
4176
|
}
|
|
4158
4177
|
return [
|
|
4159
4178
|
"custom_json",
|
|
4160
4179
|
{
|
|
4161
|
-
id: "
|
|
4162
|
-
json: JSON.stringify(
|
|
4163
|
-
|
|
4164
|
-
|
|
4180
|
+
id: "ecency_promote",
|
|
4181
|
+
json: JSON.stringify({
|
|
4182
|
+
user,
|
|
4183
|
+
author,
|
|
4184
|
+
permlink,
|
|
4185
|
+
duration
|
|
4186
|
+
}),
|
|
4187
|
+
required_auths: [user],
|
|
4188
|
+
required_posting_auths: []
|
|
4165
4189
|
}
|
|
4166
4190
|
];
|
|
4167
4191
|
}
|
|
4168
|
-
function
|
|
4169
|
-
if (!
|
|
4170
|
-
throw new Error("[SDK][
|
|
4192
|
+
function buildPointTransferOp(sender, receiver, amount, memo) {
|
|
4193
|
+
if (!sender || !receiver || !amount) {
|
|
4194
|
+
throw new Error("[SDK][buildPointTransferOp] Missing required parameters");
|
|
4171
4195
|
}
|
|
4172
|
-
const action = pin ? "pinPost" : "unpinPost";
|
|
4173
4196
|
return [
|
|
4174
4197
|
"custom_json",
|
|
4175
4198
|
{
|
|
4176
|
-
id: "
|
|
4177
|
-
json: JSON.stringify(
|
|
4178
|
-
|
|
4179
|
-
|
|
4199
|
+
id: "ecency_point_transfer",
|
|
4200
|
+
json: JSON.stringify({
|
|
4201
|
+
sender,
|
|
4202
|
+
receiver,
|
|
4203
|
+
amount,
|
|
4204
|
+
memo: memo || ""
|
|
4205
|
+
}),
|
|
4206
|
+
required_auths: [sender],
|
|
4207
|
+
required_posting_auths: []
|
|
4180
4208
|
}
|
|
4181
4209
|
];
|
|
4182
4210
|
}
|
|
4183
|
-
function
|
|
4184
|
-
if (!
|
|
4185
|
-
throw new Error("[SDK][
|
|
4211
|
+
function buildMultiPointTransferOps(sender, destinations, amount, memo) {
|
|
4212
|
+
if (!sender || !destinations || !amount) {
|
|
4213
|
+
throw new Error("[SDK][buildMultiPointTransferOps] Missing required parameters");
|
|
4214
|
+
}
|
|
4215
|
+
const destArray = destinations.trim().split(/[\s,]+/).filter(Boolean);
|
|
4216
|
+
if (destArray.length === 0) {
|
|
4217
|
+
throw new Error("[SDK][buildMultiPointTransferOps] Missing valid destinations");
|
|
4218
|
+
}
|
|
4219
|
+
return destArray.map(
|
|
4220
|
+
(dest) => buildPointTransferOp(sender, dest.trim(), amount, memo)
|
|
4221
|
+
);
|
|
4222
|
+
}
|
|
4223
|
+
function buildCommunityRegistrationOp(name) {
|
|
4224
|
+
if (!name) {
|
|
4225
|
+
throw new Error("[SDK][buildCommunityRegistrationOp] Missing required parameters");
|
|
4186
4226
|
}
|
|
4187
|
-
const action = mute ? "mutePost" : "unmutePost";
|
|
4188
4227
|
return [
|
|
4189
4228
|
"custom_json",
|
|
4190
4229
|
{
|
|
4191
|
-
id: "
|
|
4192
|
-
json: JSON.stringify(
|
|
4193
|
-
|
|
4194
|
-
|
|
4230
|
+
id: "ecency_registration",
|
|
4231
|
+
json: JSON.stringify({
|
|
4232
|
+
name
|
|
4233
|
+
}),
|
|
4234
|
+
required_auths: [name],
|
|
4235
|
+
required_posting_auths: []
|
|
4195
4236
|
}
|
|
4196
4237
|
];
|
|
4197
4238
|
}
|
|
4198
|
-
function
|
|
4199
|
-
if (!username || !
|
|
4200
|
-
throw new Error("[SDK][
|
|
4239
|
+
function buildActiveCustomJsonOp(username, operationId, json) {
|
|
4240
|
+
if (!username || !operationId || !json) {
|
|
4241
|
+
throw new Error("[SDK][buildActiveCustomJsonOp] Missing required parameters");
|
|
4201
4242
|
}
|
|
4202
|
-
const action = mute ? "muteUser" : "unmuteUser";
|
|
4203
4243
|
return [
|
|
4204
4244
|
"custom_json",
|
|
4205
4245
|
{
|
|
4206
|
-
id:
|
|
4207
|
-
json: JSON.stringify(
|
|
4208
|
-
required_auths: [],
|
|
4209
|
-
required_posting_auths: [
|
|
4246
|
+
id: operationId,
|
|
4247
|
+
json: JSON.stringify(json),
|
|
4248
|
+
required_auths: [username],
|
|
4249
|
+
required_posting_auths: []
|
|
4210
4250
|
}
|
|
4211
4251
|
];
|
|
4212
4252
|
}
|
|
4213
|
-
function
|
|
4214
|
-
if (!username || !
|
|
4215
|
-
throw new Error("[SDK][
|
|
4253
|
+
function buildPostingCustomJsonOp(username, operationId, json) {
|
|
4254
|
+
if (!username || !operationId || !json) {
|
|
4255
|
+
throw new Error("[SDK][buildPostingCustomJsonOp] Missing required parameters");
|
|
4216
4256
|
}
|
|
4217
4257
|
return [
|
|
4218
4258
|
"custom_json",
|
|
4219
4259
|
{
|
|
4220
|
-
id:
|
|
4221
|
-
json: JSON.stringify(
|
|
4260
|
+
id: operationId,
|
|
4261
|
+
json: JSON.stringify(json),
|
|
4222
4262
|
required_auths: [],
|
|
4223
4263
|
required_posting_auths: [username]
|
|
4224
4264
|
}
|
|
4225
4265
|
];
|
|
4226
4266
|
}
|
|
4227
4267
|
|
|
4228
|
-
// src/modules/
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
owner,
|
|
4247
|
-
orderid: orderId,
|
|
4248
|
-
amount_to_sell: amountToSell,
|
|
4249
|
-
min_to_receive: minToReceive,
|
|
4250
|
-
fill_or_kill: fillOrKill,
|
|
4251
|
-
expiration
|
|
4252
|
-
}
|
|
4253
|
-
];
|
|
4268
|
+
// src/modules/accounts/mutations/use-follow.ts
|
|
4269
|
+
function useFollow(username, auth) {
|
|
4270
|
+
return useBroadcastMutation(
|
|
4271
|
+
["accounts", "follow"],
|
|
4272
|
+
username,
|
|
4273
|
+
({ following }) => [
|
|
4274
|
+
buildFollowOp(username, following)
|
|
4275
|
+
],
|
|
4276
|
+
async (_result, variables) => {
|
|
4277
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
4278
|
+
await auth.adapter.invalidateQueries([
|
|
4279
|
+
["accounts", "relations", username, variables.following],
|
|
4280
|
+
["accounts", "full", variables.following]
|
|
4281
|
+
]);
|
|
4282
|
+
}
|
|
4283
|
+
},
|
|
4284
|
+
auth
|
|
4285
|
+
);
|
|
4254
4286
|
}
|
|
4255
|
-
|
|
4256
|
-
|
|
4287
|
+
|
|
4288
|
+
// src/modules/accounts/mutations/use-unfollow.ts
|
|
4289
|
+
function useUnfollow(username, auth) {
|
|
4290
|
+
return useBroadcastMutation(
|
|
4291
|
+
["accounts", "unfollow"],
|
|
4292
|
+
username,
|
|
4293
|
+
({ following }) => [
|
|
4294
|
+
buildUnfollowOp(username, following)
|
|
4295
|
+
],
|
|
4296
|
+
async (_result, variables) => {
|
|
4297
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
4298
|
+
await auth.adapter.invalidateQueries([
|
|
4299
|
+
["accounts", "relations", username, variables.following],
|
|
4300
|
+
["accounts", "full", variables.following]
|
|
4301
|
+
]);
|
|
4302
|
+
}
|
|
4303
|
+
},
|
|
4304
|
+
auth
|
|
4305
|
+
);
|
|
4306
|
+
}
|
|
4307
|
+
function useBookmarkAdd(username, code, onSuccess, onError) {
|
|
4308
|
+
return useMutation({
|
|
4309
|
+
mutationKey: ["accounts", "bookmarks", "add", username],
|
|
4310
|
+
mutationFn: async ({ author, permlink }) => {
|
|
4311
|
+
if (!username || !code) {
|
|
4312
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
4313
|
+
}
|
|
4314
|
+
const fetchApi = getBoundFetch();
|
|
4315
|
+
const response = await fetchApi(
|
|
4316
|
+
CONFIG.privateApiHost + "/private-api/bookmarks-add",
|
|
4317
|
+
{
|
|
4318
|
+
method: "POST",
|
|
4319
|
+
headers: {
|
|
4320
|
+
"Content-Type": "application/json"
|
|
4321
|
+
},
|
|
4322
|
+
body: JSON.stringify({
|
|
4323
|
+
author,
|
|
4324
|
+
permlink,
|
|
4325
|
+
code
|
|
4326
|
+
})
|
|
4327
|
+
}
|
|
4328
|
+
);
|
|
4329
|
+
return response.json();
|
|
4330
|
+
},
|
|
4331
|
+
onSuccess: () => {
|
|
4332
|
+
onSuccess();
|
|
4333
|
+
getQueryClient().invalidateQueries({
|
|
4334
|
+
queryKey: ["accounts", "bookmarks", username]
|
|
4335
|
+
});
|
|
4336
|
+
},
|
|
4337
|
+
onError
|
|
4338
|
+
});
|
|
4339
|
+
}
|
|
4340
|
+
function useBookmarkDelete(username, code, onSuccess, onError) {
|
|
4341
|
+
return useMutation({
|
|
4342
|
+
mutationKey: ["accounts", "bookmarks", "delete", username],
|
|
4343
|
+
mutationFn: async (bookmarkId) => {
|
|
4344
|
+
if (!username || !code) {
|
|
4345
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
4346
|
+
}
|
|
4347
|
+
const fetchApi = getBoundFetch();
|
|
4348
|
+
const response = await fetchApi(
|
|
4349
|
+
CONFIG.privateApiHost + "/private-api/bookmarks-delete",
|
|
4350
|
+
{
|
|
4351
|
+
method: "POST",
|
|
4352
|
+
headers: {
|
|
4353
|
+
"Content-Type": "application/json"
|
|
4354
|
+
},
|
|
4355
|
+
body: JSON.stringify({
|
|
4356
|
+
id: bookmarkId,
|
|
4357
|
+
code
|
|
4358
|
+
})
|
|
4359
|
+
}
|
|
4360
|
+
);
|
|
4361
|
+
return response.json();
|
|
4362
|
+
},
|
|
4363
|
+
onSuccess: () => {
|
|
4364
|
+
onSuccess();
|
|
4365
|
+
getQueryClient().invalidateQueries({
|
|
4366
|
+
queryKey: ["accounts", "bookmarks", username]
|
|
4367
|
+
});
|
|
4368
|
+
},
|
|
4369
|
+
onError
|
|
4370
|
+
});
|
|
4371
|
+
}
|
|
4372
|
+
function useAccountFavouriteAdd(username, code, onSuccess, onError) {
|
|
4373
|
+
return useMutation({
|
|
4374
|
+
mutationKey: ["accounts", "favourites", "add", username],
|
|
4375
|
+
mutationFn: async (account) => {
|
|
4376
|
+
if (!username || !code) {
|
|
4377
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
4378
|
+
}
|
|
4379
|
+
const fetchApi = getBoundFetch();
|
|
4380
|
+
const response = await fetchApi(
|
|
4381
|
+
CONFIG.privateApiHost + "/private-api/favorites-add",
|
|
4382
|
+
{
|
|
4383
|
+
method: "POST",
|
|
4384
|
+
headers: {
|
|
4385
|
+
"Content-Type": "application/json"
|
|
4386
|
+
},
|
|
4387
|
+
body: JSON.stringify({
|
|
4388
|
+
account,
|
|
4389
|
+
code
|
|
4390
|
+
})
|
|
4391
|
+
}
|
|
4392
|
+
);
|
|
4393
|
+
return response.json();
|
|
4394
|
+
},
|
|
4395
|
+
onSuccess: () => {
|
|
4396
|
+
onSuccess();
|
|
4397
|
+
getQueryClient().invalidateQueries({
|
|
4398
|
+
queryKey: ["accounts", "favourites", username]
|
|
4399
|
+
});
|
|
4400
|
+
},
|
|
4401
|
+
onError
|
|
4402
|
+
});
|
|
4257
4403
|
}
|
|
4258
|
-
function
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4404
|
+
function useAccountFavouriteDelete(username, code, onSuccess, onError) {
|
|
4405
|
+
return useMutation({
|
|
4406
|
+
mutationKey: ["accounts", "favourites", "add", username],
|
|
4407
|
+
mutationFn: async (account) => {
|
|
4408
|
+
if (!username || !code) {
|
|
4409
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
4410
|
+
}
|
|
4411
|
+
const fetchApi = getBoundFetch();
|
|
4412
|
+
const response = await fetchApi(
|
|
4413
|
+
CONFIG.privateApiHost + "/private-api/favorites-delete",
|
|
4414
|
+
{
|
|
4415
|
+
method: "POST",
|
|
4416
|
+
headers: {
|
|
4417
|
+
"Content-Type": "application/json"
|
|
4418
|
+
},
|
|
4419
|
+
body: JSON.stringify({
|
|
4420
|
+
account,
|
|
4421
|
+
code
|
|
4422
|
+
})
|
|
4423
|
+
}
|
|
4424
|
+
);
|
|
4425
|
+
return response.json();
|
|
4426
|
+
},
|
|
4427
|
+
onSuccess: () => {
|
|
4428
|
+
onSuccess();
|
|
4429
|
+
getQueryClient().invalidateQueries({
|
|
4430
|
+
queryKey: ["accounts", "favourites", username]
|
|
4431
|
+
});
|
|
4432
|
+
},
|
|
4433
|
+
onError
|
|
4434
|
+
});
|
|
4278
4435
|
}
|
|
4279
|
-
function
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
}
|
|
4289
|
-
];
|
|
4436
|
+
function dedupeAndSortKeyAuths(existing, additions) {
|
|
4437
|
+
const merged = /* @__PURE__ */ new Map();
|
|
4438
|
+
existing.forEach(([key, weight]) => {
|
|
4439
|
+
merged.set(key.toString(), weight);
|
|
4440
|
+
});
|
|
4441
|
+
additions.forEach(([key, weight]) => {
|
|
4442
|
+
merged.set(key.toString(), weight);
|
|
4443
|
+
});
|
|
4444
|
+
return Array.from(merged.entries()).sort(([keyA], [keyB]) => keyA.localeCompare(keyB)).map(([key, weight]) => [key, weight]);
|
|
4290
4445
|
}
|
|
4291
|
-
function
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4446
|
+
function useAccountUpdateKeyAuths(username, options) {
|
|
4447
|
+
const { data: accountData } = useQuery(getAccountFullQueryOptions(username));
|
|
4448
|
+
return useMutation({
|
|
4449
|
+
mutationKey: ["accounts", "keys-update", username],
|
|
4450
|
+
mutationFn: async ({
|
|
4451
|
+
keys,
|
|
4452
|
+
keepCurrent = false,
|
|
4453
|
+
currentKey,
|
|
4454
|
+
keysToRevoke = [],
|
|
4455
|
+
keysToRevokeByAuthority = {}
|
|
4456
|
+
}) => {
|
|
4457
|
+
if (keys.length === 0) {
|
|
4458
|
+
throw new Error(
|
|
4459
|
+
"[SDK][Update password] \u2013 no new keys provided"
|
|
4460
|
+
);
|
|
4461
|
+
}
|
|
4462
|
+
if (!accountData) {
|
|
4463
|
+
throw new Error(
|
|
4464
|
+
"[SDK][Update password] \u2013 cannot update keys for anon user"
|
|
4465
|
+
);
|
|
4466
|
+
}
|
|
4467
|
+
const prepareAuth = (keyName) => {
|
|
4468
|
+
const auth = R4.clone(accountData[keyName]);
|
|
4469
|
+
const keysToRevokeForAuthority = keysToRevokeByAuthority[keyName] || [];
|
|
4470
|
+
const allKeysToRevoke = [
|
|
4471
|
+
...keysToRevokeForAuthority,
|
|
4472
|
+
...keysToRevokeByAuthority[keyName] === void 0 ? keysToRevoke : []
|
|
4473
|
+
];
|
|
4474
|
+
const existingKeys = keepCurrent ? auth.key_auths.filter(([key]) => !allKeysToRevoke.includes(key.toString())) : [];
|
|
4475
|
+
auth.key_auths = dedupeAndSortKeyAuths(
|
|
4476
|
+
existingKeys,
|
|
4477
|
+
keys.map(
|
|
4478
|
+
(values, i) => [values[keyName].createPublic().toString(), i + 1]
|
|
4479
|
+
)
|
|
4480
|
+
);
|
|
4481
|
+
return auth;
|
|
4482
|
+
};
|
|
4483
|
+
return CONFIG.hiveClient.broadcast.updateAccount(
|
|
4484
|
+
{
|
|
4485
|
+
account: username,
|
|
4486
|
+
json_metadata: accountData.json_metadata,
|
|
4487
|
+
owner: prepareAuth("owner"),
|
|
4488
|
+
active: prepareAuth("active"),
|
|
4489
|
+
posting: prepareAuth("posting"),
|
|
4490
|
+
// Always use new memo key when adding new keys
|
|
4491
|
+
memo_key: keys[0].memo_key.createPublic().toString()
|
|
4492
|
+
},
|
|
4493
|
+
currentKey
|
|
4494
|
+
);
|
|
4495
|
+
},
|
|
4496
|
+
...options
|
|
4497
|
+
});
|
|
4304
4498
|
}
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4499
|
+
function useAccountUpdatePassword(username, options) {
|
|
4500
|
+
const { data: accountData } = useQuery(getAccountFullQueryOptions(username));
|
|
4501
|
+
const { mutateAsync: updateKeys } = useAccountUpdateKeyAuths(username);
|
|
4502
|
+
return useMutation({
|
|
4503
|
+
mutationKey: ["accounts", "password-update", username],
|
|
4504
|
+
mutationFn: async ({
|
|
4505
|
+
newPassword,
|
|
4506
|
+
currentPassword,
|
|
4507
|
+
keepCurrent
|
|
4508
|
+
}) => {
|
|
4509
|
+
if (!accountData) {
|
|
4510
|
+
throw new Error(
|
|
4511
|
+
"[SDK][Update password] \u2013 cannot update password for anon user"
|
|
4512
|
+
);
|
|
4513
|
+
}
|
|
4514
|
+
const currentKey = PrivateKey.fromLogin(
|
|
4515
|
+
username,
|
|
4516
|
+
currentPassword,
|
|
4517
|
+
"owner"
|
|
4518
|
+
);
|
|
4519
|
+
return updateKeys({
|
|
4520
|
+
currentKey,
|
|
4521
|
+
keepCurrent,
|
|
4522
|
+
keys: [
|
|
4523
|
+
{
|
|
4524
|
+
owner: PrivateKey.fromLogin(username, newPassword, "owner"),
|
|
4525
|
+
active: PrivateKey.fromLogin(username, newPassword, "active"),
|
|
4526
|
+
posting: PrivateKey.fromLogin(username, newPassword, "posting"),
|
|
4527
|
+
memo_key: PrivateKey.fromLogin(username, newPassword, "memo")
|
|
4528
|
+
}
|
|
4529
|
+
]
|
|
4530
|
+
});
|
|
4531
|
+
},
|
|
4532
|
+
...options
|
|
4533
|
+
});
|
|
4322
4534
|
}
|
|
4323
|
-
function
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4535
|
+
function useAccountRevokePosting(username, options, auth) {
|
|
4536
|
+
const queryClient = useQueryClient();
|
|
4537
|
+
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
4538
|
+
return useMutation({
|
|
4539
|
+
mutationKey: ["accounts", "revoke-posting", data?.name],
|
|
4540
|
+
mutationFn: async ({ accountName, type, key }) => {
|
|
4541
|
+
if (!data) {
|
|
4542
|
+
throw new Error(
|
|
4543
|
+
"[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user"
|
|
4544
|
+
);
|
|
4545
|
+
}
|
|
4546
|
+
const posting = R4.pipe(
|
|
4547
|
+
{},
|
|
4548
|
+
R4.mergeDeep(data.posting)
|
|
4549
|
+
);
|
|
4550
|
+
posting.account_auths = posting.account_auths.filter(
|
|
4551
|
+
([account]) => account !== accountName
|
|
4552
|
+
);
|
|
4553
|
+
const operationBody = {
|
|
4554
|
+
account: data.name,
|
|
4555
|
+
posting,
|
|
4556
|
+
memo_key: data.memo_key,
|
|
4557
|
+
json_metadata: data.json_metadata
|
|
4558
|
+
};
|
|
4559
|
+
if (type === "key" && key) {
|
|
4560
|
+
return CONFIG.hiveClient.broadcast.updateAccount(operationBody, key);
|
|
4561
|
+
} else if (type === "keychain") {
|
|
4562
|
+
if (!auth?.broadcast) {
|
|
4563
|
+
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
4564
|
+
}
|
|
4565
|
+
return auth.broadcast([["account_update", operationBody]], "active");
|
|
4566
|
+
} else {
|
|
4567
|
+
const params = {
|
|
4568
|
+
callback: `https://ecency.com/@${data.name}/permissions`
|
|
4569
|
+
};
|
|
4570
|
+
return hs.sendOperation(
|
|
4571
|
+
["account_update", operationBody],
|
|
4572
|
+
params,
|
|
4573
|
+
() => {
|
|
4574
|
+
}
|
|
4575
|
+
);
|
|
4576
|
+
}
|
|
4577
|
+
},
|
|
4578
|
+
onError: options.onError,
|
|
4579
|
+
onSuccess: (resp, payload, ctx) => {
|
|
4580
|
+
options.onSuccess?.(resp, payload, ctx);
|
|
4581
|
+
queryClient.setQueryData(
|
|
4582
|
+
getAccountFullQueryOptions(username).queryKey,
|
|
4583
|
+
(data2) => ({
|
|
4584
|
+
...data2,
|
|
4585
|
+
posting: {
|
|
4586
|
+
...data2?.posting,
|
|
4587
|
+
account_auths: data2?.posting?.account_auths?.filter(
|
|
4588
|
+
([account]) => account !== payload.accountName
|
|
4589
|
+
) ?? []
|
|
4590
|
+
}
|
|
4591
|
+
})
|
|
4592
|
+
);
|
|
4334
4593
|
}
|
|
4335
|
-
|
|
4594
|
+
});
|
|
4336
4595
|
}
|
|
4337
|
-
function
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4596
|
+
function useAccountUpdateRecovery(username, code, options, auth) {
|
|
4597
|
+
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
4598
|
+
return useMutation({
|
|
4599
|
+
mutationKey: ["accounts", "recovery", data?.name],
|
|
4600
|
+
mutationFn: async ({ accountName, type, key, email }) => {
|
|
4601
|
+
if (!data) {
|
|
4602
|
+
throw new Error(
|
|
4603
|
+
"[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user"
|
|
4604
|
+
);
|
|
4605
|
+
}
|
|
4606
|
+
const operationBody = {
|
|
4607
|
+
account_to_recover: data.name,
|
|
4608
|
+
new_recovery_account: accountName,
|
|
4609
|
+
extensions: []
|
|
4610
|
+
};
|
|
4611
|
+
if (type === "ecency") {
|
|
4612
|
+
if (!code) {
|
|
4613
|
+
throw new Error("[SDK][Accounts] \u2013 missing access token");
|
|
4614
|
+
}
|
|
4615
|
+
const fetchApi = getBoundFetch();
|
|
4616
|
+
return fetchApi(CONFIG.privateApiHost + "/private-api/recoveries-add", {
|
|
4617
|
+
method: "POST",
|
|
4618
|
+
body: JSON.stringify({
|
|
4619
|
+
code,
|
|
4620
|
+
email,
|
|
4621
|
+
publicKeys: [
|
|
4622
|
+
...data.owner.key_auths,
|
|
4623
|
+
...data.active.key_auths,
|
|
4624
|
+
...data.posting.key_auths,
|
|
4625
|
+
data.memo_key
|
|
4626
|
+
]
|
|
4627
|
+
})
|
|
4628
|
+
});
|
|
4629
|
+
} else if (type === "key" && key) {
|
|
4630
|
+
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
4631
|
+
[["change_recovery_account", operationBody]],
|
|
4632
|
+
key
|
|
4633
|
+
);
|
|
4634
|
+
} else if (type === "keychain") {
|
|
4635
|
+
if (!auth?.broadcast) {
|
|
4636
|
+
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
4637
|
+
}
|
|
4638
|
+
return auth.broadcast([["change_recovery_account", operationBody]], "owner");
|
|
4639
|
+
} else {
|
|
4640
|
+
const params = {
|
|
4641
|
+
callback: `https://ecency.com/@${data.name}/permissions`
|
|
4642
|
+
};
|
|
4643
|
+
return hs.sendOperation(
|
|
4644
|
+
["change_recovery_account", operationBody],
|
|
4645
|
+
params,
|
|
4646
|
+
() => {
|
|
4647
|
+
}
|
|
4648
|
+
);
|
|
4649
|
+
}
|
|
4650
|
+
},
|
|
4651
|
+
onError: options.onError,
|
|
4652
|
+
onSuccess: options.onSuccess
|
|
4653
|
+
});
|
|
4370
4654
|
}
|
|
4371
|
-
function
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
];
|
|
4655
|
+
function useAccountRevokeKey(username, options) {
|
|
4656
|
+
const { data: accountData } = useQuery(getAccountFullQueryOptions(username));
|
|
4657
|
+
return useMutation({
|
|
4658
|
+
mutationKey: ["accounts", "revoke-key", accountData?.name],
|
|
4659
|
+
mutationFn: async ({ currentKey, revokingKey }) => {
|
|
4660
|
+
if (!accountData) {
|
|
4661
|
+
throw new Error(
|
|
4662
|
+
"[SDK][Update password] \u2013 cannot update keys for anon user"
|
|
4663
|
+
);
|
|
4664
|
+
}
|
|
4665
|
+
const prepareAuth = (keyName) => {
|
|
4666
|
+
const auth = R4.clone(accountData[keyName]);
|
|
4667
|
+
auth.key_auths = auth.key_auths.filter(
|
|
4668
|
+
([key]) => key !== revokingKey.toString()
|
|
4669
|
+
);
|
|
4670
|
+
return auth;
|
|
4671
|
+
};
|
|
4672
|
+
return CONFIG.hiveClient.broadcast.updateAccount(
|
|
4673
|
+
{
|
|
4674
|
+
account: accountData.name,
|
|
4675
|
+
json_metadata: accountData.json_metadata,
|
|
4676
|
+
owner: prepareAuth("owner"),
|
|
4677
|
+
active: prepareAuth("active"),
|
|
4678
|
+
posting: prepareAuth("posting"),
|
|
4679
|
+
memo_key: accountData.memo_key
|
|
4680
|
+
},
|
|
4681
|
+
currentKey
|
|
4682
|
+
);
|
|
4683
|
+
},
|
|
4684
|
+
...options
|
|
4685
|
+
});
|
|
4403
4686
|
}
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
creator,
|
|
4412
|
-
fee,
|
|
4413
|
-
extensions: []
|
|
4414
|
-
}
|
|
4415
|
-
];
|
|
4687
|
+
|
|
4688
|
+
// src/modules/accounts/utils/account-power.ts
|
|
4689
|
+
var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
|
|
4690
|
+
function vestsToRshares(vests, votingPowerValue, votePerc) {
|
|
4691
|
+
const vestingShares = vests * 1e6;
|
|
4692
|
+
const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
|
|
4693
|
+
return power * vestingShares / 1e4;
|
|
4416
4694
|
}
|
|
4417
|
-
function
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4695
|
+
function toDhiveAccountForVotingMana(account) {
|
|
4696
|
+
return {
|
|
4697
|
+
id: 0,
|
|
4698
|
+
name: account.name,
|
|
4699
|
+
owner: account.owner,
|
|
4700
|
+
active: account.active,
|
|
4701
|
+
posting: account.posting,
|
|
4702
|
+
memo_key: account.memo_key,
|
|
4703
|
+
json_metadata: account.json_metadata,
|
|
4704
|
+
posting_json_metadata: account.posting_json_metadata,
|
|
4705
|
+
proxy: account.proxy ?? "",
|
|
4706
|
+
last_owner_update: "",
|
|
4707
|
+
last_account_update: "",
|
|
4708
|
+
created: account.created,
|
|
4709
|
+
mined: false,
|
|
4710
|
+
owner_challenged: false,
|
|
4711
|
+
active_challenged: false,
|
|
4712
|
+
last_owner_proved: "",
|
|
4713
|
+
last_active_proved: "",
|
|
4714
|
+
recovery_account: account.recovery_account ?? "",
|
|
4715
|
+
reset_account: "",
|
|
4716
|
+
last_account_recovery: "",
|
|
4717
|
+
comment_count: 0,
|
|
4718
|
+
lifetime_vote_count: 0,
|
|
4719
|
+
post_count: account.post_count,
|
|
4720
|
+
can_vote: true,
|
|
4721
|
+
voting_power: account.voting_power,
|
|
4722
|
+
last_vote_time: account.last_vote_time,
|
|
4723
|
+
voting_manabar: account.voting_manabar,
|
|
4724
|
+
balance: account.balance,
|
|
4725
|
+
savings_balance: account.savings_balance,
|
|
4726
|
+
hbd_balance: account.hbd_balance,
|
|
4727
|
+
hbd_seconds: "0",
|
|
4728
|
+
hbd_seconds_last_update: "",
|
|
4729
|
+
hbd_last_interest_payment: "",
|
|
4730
|
+
savings_hbd_balance: account.savings_hbd_balance,
|
|
4731
|
+
savings_hbd_seconds: account.savings_hbd_seconds,
|
|
4732
|
+
savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
|
|
4733
|
+
savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
|
|
4734
|
+
savings_withdraw_requests: 0,
|
|
4735
|
+
reward_hbd_balance: account.reward_hbd_balance,
|
|
4736
|
+
reward_hive_balance: account.reward_hive_balance,
|
|
4737
|
+
reward_vesting_balance: account.reward_vesting_balance,
|
|
4738
|
+
reward_vesting_hive: account.reward_vesting_hive,
|
|
4739
|
+
curation_rewards: 0,
|
|
4740
|
+
posting_rewards: 0,
|
|
4741
|
+
vesting_shares: account.vesting_shares,
|
|
4742
|
+
delegated_vesting_shares: account.delegated_vesting_shares,
|
|
4743
|
+
received_vesting_shares: account.received_vesting_shares,
|
|
4744
|
+
vesting_withdraw_rate: account.vesting_withdraw_rate,
|
|
4745
|
+
next_vesting_withdrawal: account.next_vesting_withdrawal,
|
|
4746
|
+
withdrawn: account.withdrawn,
|
|
4747
|
+
to_withdraw: account.to_withdraw,
|
|
4748
|
+
withdraw_routes: 0,
|
|
4749
|
+
proxied_vsf_votes: account.proxied_vsf_votes ?? [],
|
|
4750
|
+
witnesses_voted_for: 0,
|
|
4751
|
+
average_bandwidth: 0,
|
|
4752
|
+
lifetime_bandwidth: 0,
|
|
4753
|
+
last_bandwidth_update: "",
|
|
4754
|
+
average_market_bandwidth: 0,
|
|
4755
|
+
lifetime_market_bandwidth: 0,
|
|
4756
|
+
last_market_bandwidth_update: "",
|
|
4757
|
+
last_post: account.last_post,
|
|
4758
|
+
last_root_post: ""
|
|
4433
4759
|
};
|
|
4434
|
-
newPosting.account_auths.sort((a, b) => a[0] > b[0] ? 1 : -1);
|
|
4435
|
-
return [
|
|
4436
|
-
"account_update",
|
|
4437
|
-
{
|
|
4438
|
-
account,
|
|
4439
|
-
posting: newPosting,
|
|
4440
|
-
memo_key: memoKey,
|
|
4441
|
-
json_metadata: jsonMetadata
|
|
4442
|
-
}
|
|
4443
|
-
];
|
|
4444
4760
|
}
|
|
4445
|
-
function
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
...currentPosting,
|
|
4451
|
-
account_auths: currentPosting.account_auths.filter(
|
|
4452
|
-
([acc]) => acc !== revokedAccount
|
|
4453
|
-
)
|
|
4454
|
-
};
|
|
4455
|
-
return [
|
|
4456
|
-
"account_update",
|
|
4457
|
-
{
|
|
4458
|
-
account,
|
|
4459
|
-
posting: newPosting,
|
|
4460
|
-
memo_key: memoKey,
|
|
4461
|
-
json_metadata: jsonMetadata
|
|
4462
|
-
}
|
|
4463
|
-
];
|
|
4761
|
+
function votingPower(account) {
|
|
4762
|
+
const calc = CONFIG.hiveClient.rc.calculateVPMana(
|
|
4763
|
+
toDhiveAccountForVotingMana(account)
|
|
4764
|
+
);
|
|
4765
|
+
return calc.percentage / 100;
|
|
4464
4766
|
}
|
|
4465
|
-
function
|
|
4466
|
-
if (!
|
|
4467
|
-
throw new
|
|
4767
|
+
function powerRechargeTime(power) {
|
|
4768
|
+
if (!Number.isFinite(power)) {
|
|
4769
|
+
throw new TypeError("Voting power must be a finite number");
|
|
4468
4770
|
}
|
|
4469
|
-
|
|
4470
|
-
"
|
|
4471
|
-
{
|
|
4472
|
-
account_to_recover: accountToRecover,
|
|
4473
|
-
new_recovery_account: newRecoveryAccount,
|
|
4474
|
-
extensions
|
|
4475
|
-
}
|
|
4476
|
-
];
|
|
4477
|
-
}
|
|
4478
|
-
function buildRequestAccountRecoveryOp(recoveryAccount, accountToRecover, newOwnerAuthority, extensions = []) {
|
|
4479
|
-
if (!recoveryAccount || !accountToRecover || !newOwnerAuthority) {
|
|
4480
|
-
throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");
|
|
4771
|
+
if (power < 0 || power > 100) {
|
|
4772
|
+
throw new RangeError("Voting power must be between 0 and 100");
|
|
4481
4773
|
}
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
{
|
|
4485
|
-
recovery_account: recoveryAccount,
|
|
4486
|
-
account_to_recover: accountToRecover,
|
|
4487
|
-
new_owner_authority: newOwnerAuthority,
|
|
4488
|
-
extensions
|
|
4489
|
-
}
|
|
4490
|
-
];
|
|
4774
|
+
const missingPower = 100 - power;
|
|
4775
|
+
return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
|
|
4491
4776
|
}
|
|
4492
|
-
function
|
|
4493
|
-
|
|
4494
|
-
|
|
4777
|
+
function downVotingPower(account) {
|
|
4778
|
+
const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
|
|
4779
|
+
const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
|
|
4780
|
+
const maxMana = totalShares * 1e6 / 4;
|
|
4781
|
+
if (maxMana <= 0) {
|
|
4782
|
+
return 0;
|
|
4495
4783
|
}
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
account_to_recover: accountToRecover,
|
|
4500
|
-
new_owner_authority: newOwnerAuthority,
|
|
4501
|
-
recent_owner_authority: recentOwnerAuthority,
|
|
4502
|
-
extensions
|
|
4503
|
-
}
|
|
4504
|
-
];
|
|
4505
|
-
}
|
|
4506
|
-
|
|
4507
|
-
// src/modules/operations/builders/ecency.ts
|
|
4508
|
-
function buildBoostOp(user, author, permlink, amount) {
|
|
4509
|
-
if (!user || !author || !permlink || !amount) {
|
|
4510
|
-
throw new Error("[SDK][buildBoostOp] Missing required parameters");
|
|
4784
|
+
let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
|
|
4785
|
+
if (currentMana > maxMana) {
|
|
4786
|
+
currentMana = maxMana;
|
|
4511
4787
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
id: "ecency_boost",
|
|
4516
|
-
json: JSON.stringify({
|
|
4517
|
-
user,
|
|
4518
|
-
author,
|
|
4519
|
-
permlink,
|
|
4520
|
-
amount
|
|
4521
|
-
}),
|
|
4522
|
-
required_auths: [user],
|
|
4523
|
-
required_posting_auths: []
|
|
4524
|
-
}
|
|
4525
|
-
];
|
|
4526
|
-
}
|
|
4527
|
-
function buildBoostOpWithPoints(user, author, permlink, points) {
|
|
4528
|
-
if (!user || !author || !permlink || !Number.isFinite(points)) {
|
|
4529
|
-
throw new Error("[SDK][buildBoostOpWithPoints] Missing required parameters");
|
|
4788
|
+
const currentManaPerc = currentMana * 100 / maxMana;
|
|
4789
|
+
if (isNaN(currentManaPerc)) {
|
|
4790
|
+
return 0;
|
|
4530
4791
|
}
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
function buildBoostPlusOp(user, account, duration) {
|
|
4534
|
-
if (!user || !account || !Number.isFinite(duration)) {
|
|
4535
|
-
throw new Error("[SDK][buildBoostPlusOp] Missing required parameters");
|
|
4792
|
+
if (currentManaPerc > 100) {
|
|
4793
|
+
return 100;
|
|
4536
4794
|
}
|
|
4537
|
-
return
|
|
4538
|
-
"custom_json",
|
|
4539
|
-
{
|
|
4540
|
-
id: "ecency_boost_plus",
|
|
4541
|
-
json: JSON.stringify({
|
|
4542
|
-
user,
|
|
4543
|
-
account,
|
|
4544
|
-
duration
|
|
4545
|
-
}),
|
|
4546
|
-
required_auths: [user],
|
|
4547
|
-
required_posting_auths: []
|
|
4548
|
-
}
|
|
4549
|
-
];
|
|
4795
|
+
return currentManaPerc;
|
|
4550
4796
|
}
|
|
4551
|
-
function
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
}
|
|
4555
|
-
return [
|
|
4556
|
-
"custom_json",
|
|
4557
|
-
{
|
|
4558
|
-
id: "ecency_promote",
|
|
4559
|
-
json: JSON.stringify({
|
|
4560
|
-
user,
|
|
4561
|
-
author,
|
|
4562
|
-
permlink,
|
|
4563
|
-
duration
|
|
4564
|
-
}),
|
|
4565
|
-
required_auths: [user],
|
|
4566
|
-
required_posting_auths: []
|
|
4567
|
-
}
|
|
4568
|
-
];
|
|
4797
|
+
function rcPower(account) {
|
|
4798
|
+
const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
|
|
4799
|
+
return calc.percentage / 100;
|
|
4569
4800
|
}
|
|
4570
|
-
function
|
|
4571
|
-
if (!
|
|
4572
|
-
|
|
4801
|
+
function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
|
|
4802
|
+
if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
|
|
4803
|
+
return 0;
|
|
4573
4804
|
}
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4805
|
+
const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
|
|
4806
|
+
if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
|
|
4807
|
+
return 0;
|
|
4808
|
+
}
|
|
4809
|
+
if (fundRecentClaims === 0 || quote === 0) {
|
|
4810
|
+
return 0;
|
|
4811
|
+
}
|
|
4812
|
+
let totalVests = 0;
|
|
4813
|
+
try {
|
|
4814
|
+
const vesting = parseAsset(account.vesting_shares).amount;
|
|
4815
|
+
const received = parseAsset(account.received_vesting_shares).amount;
|
|
4816
|
+
const delegated = parseAsset(account.delegated_vesting_shares).amount;
|
|
4817
|
+
if (![vesting, received, delegated].every(Number.isFinite)) {
|
|
4818
|
+
return 0;
|
|
4586
4819
|
}
|
|
4587
|
-
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
|
-
if (!sender || !destinations || !amount) {
|
|
4591
|
-
throw new Error("[SDK][buildMultiPointTransferOps] Missing required parameters");
|
|
4820
|
+
totalVests = vesting + received - delegated;
|
|
4821
|
+
} catch {
|
|
4822
|
+
return 0;
|
|
4592
4823
|
}
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
throw new Error("[SDK][buildMultiPointTransferOps] Missing valid destinations");
|
|
4824
|
+
if (!Number.isFinite(totalVests)) {
|
|
4825
|
+
return 0;
|
|
4596
4826
|
}
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4827
|
+
const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
|
|
4828
|
+
if (!Number.isFinite(rShares)) {
|
|
4829
|
+
return 0;
|
|
4830
|
+
}
|
|
4831
|
+
return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
|
|
4600
4832
|
}
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4833
|
+
|
|
4834
|
+
// src/modules/operations/authority-map.ts
|
|
4835
|
+
var OPERATION_AUTHORITY_MAP = {
|
|
4836
|
+
// Posting authority operations
|
|
4837
|
+
vote: "posting",
|
|
4838
|
+
comment: "posting",
|
|
4839
|
+
delete_comment: "posting",
|
|
4840
|
+
comment_options: "posting",
|
|
4841
|
+
claim_reward_balance: "posting",
|
|
4842
|
+
// Active authority operations - Financial
|
|
4843
|
+
cancel_transfer_from_savings: "active",
|
|
4844
|
+
collateralized_convert: "active",
|
|
4845
|
+
convert: "active",
|
|
4846
|
+
delegate_vesting_shares: "active",
|
|
4847
|
+
recurrent_transfer: "active",
|
|
4848
|
+
set_withdraw_vesting_route: "active",
|
|
4849
|
+
transfer: "active",
|
|
4850
|
+
transfer_from_savings: "active",
|
|
4851
|
+
transfer_to_savings: "active",
|
|
4852
|
+
transfer_to_vesting: "active",
|
|
4853
|
+
withdraw_vesting: "active",
|
|
4854
|
+
// Active authority operations - Market
|
|
4855
|
+
limit_order_create: "active",
|
|
4856
|
+
limit_order_cancel: "active",
|
|
4857
|
+
// Active authority operations - Account Management
|
|
4858
|
+
account_update: "active",
|
|
4859
|
+
account_update2: "active",
|
|
4860
|
+
create_claimed_account: "active",
|
|
4861
|
+
// Active authority operations - Governance
|
|
4862
|
+
account_witness_proxy: "active",
|
|
4863
|
+
account_witness_vote: "active",
|
|
4864
|
+
remove_proposal: "active",
|
|
4865
|
+
update_proposal_votes: "active",
|
|
4866
|
+
// Owner authority operations - Security & Account Recovery
|
|
4867
|
+
change_recovery_account: "owner",
|
|
4868
|
+
request_account_recovery: "owner",
|
|
4869
|
+
recover_account: "owner",
|
|
4870
|
+
reset_account: "owner",
|
|
4871
|
+
set_reset_account: "owner"
|
|
4872
|
+
// Note: Some operations are handled separately via content inspection:
|
|
4873
|
+
// - custom_json: via getCustomJsonAuthority() - posting or active based on required_auths
|
|
4874
|
+
// - create_proposal/update_proposal: via getProposalAuthority() - typically active
|
|
4875
|
+
};
|
|
4876
|
+
function getCustomJsonAuthority(customJsonOp) {
|
|
4877
|
+
const opType = customJsonOp[0];
|
|
4878
|
+
const payload = customJsonOp[1];
|
|
4879
|
+
if (opType !== "custom_json") {
|
|
4880
|
+
throw new Error("Operation is not a custom_json operation");
|
|
4604
4881
|
}
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
required_posting_auths: []
|
|
4614
|
-
}
|
|
4615
|
-
];
|
|
4882
|
+
const customJson = payload;
|
|
4883
|
+
if (customJson.required_auths && customJson.required_auths.length > 0) {
|
|
4884
|
+
return "active";
|
|
4885
|
+
}
|
|
4886
|
+
if (customJson.required_posting_auths && customJson.required_posting_auths.length > 0) {
|
|
4887
|
+
return "posting";
|
|
4888
|
+
}
|
|
4889
|
+
return "posting";
|
|
4616
4890
|
}
|
|
4617
|
-
function
|
|
4618
|
-
|
|
4619
|
-
|
|
4891
|
+
function getProposalAuthority(proposalOp) {
|
|
4892
|
+
const opType = proposalOp[0];
|
|
4893
|
+
if (opType !== "create_proposal" && opType !== "update_proposal") {
|
|
4894
|
+
throw new Error("Operation is not a proposal operation");
|
|
4620
4895
|
}
|
|
4621
|
-
return
|
|
4622
|
-
"custom_json",
|
|
4623
|
-
{
|
|
4624
|
-
id: operationId,
|
|
4625
|
-
json: JSON.stringify(json),
|
|
4626
|
-
required_auths: [username],
|
|
4627
|
-
required_posting_auths: []
|
|
4628
|
-
}
|
|
4629
|
-
];
|
|
4896
|
+
return "active";
|
|
4630
4897
|
}
|
|
4631
|
-
function
|
|
4632
|
-
|
|
4633
|
-
|
|
4898
|
+
function getOperationAuthority(op) {
|
|
4899
|
+
const opType = op[0];
|
|
4900
|
+
if (opType === "custom_json") {
|
|
4901
|
+
return getCustomJsonAuthority(op);
|
|
4634
4902
|
}
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4903
|
+
if (opType === "create_proposal" || opType === "update_proposal") {
|
|
4904
|
+
return getProposalAuthority(op);
|
|
4905
|
+
}
|
|
4906
|
+
return OPERATION_AUTHORITY_MAP[opType] ?? "posting";
|
|
4907
|
+
}
|
|
4908
|
+
function getRequiredAuthority(ops2) {
|
|
4909
|
+
let highestAuthority = "posting";
|
|
4910
|
+
for (const op of ops2) {
|
|
4911
|
+
const authority = getOperationAuthority(op);
|
|
4912
|
+
if (authority === "owner") {
|
|
4913
|
+
return "owner";
|
|
4642
4914
|
}
|
|
4643
|
-
|
|
4915
|
+
if (authority === "active" && highestAuthority === "posting") {
|
|
4916
|
+
highestAuthority = "active";
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
return highestAuthority;
|
|
4644
4920
|
}
|
|
4645
4921
|
function useSignOperationByKey(username) {
|
|
4646
4922
|
return useMutation({
|
|
@@ -5433,7 +5709,9 @@ function useComment(username, auth) {
|
|
|
5433
5709
|
if (auth?.adapter?.invalidateQueries) {
|
|
5434
5710
|
const queriesToInvalidate = [
|
|
5435
5711
|
["posts", "feed", username],
|
|
5436
|
-
["posts", "blog", username]
|
|
5712
|
+
["posts", "blog", username],
|
|
5713
|
+
["account", username, "rc"]
|
|
5714
|
+
// RC decreases after posting/commenting
|
|
5437
5715
|
];
|
|
5438
5716
|
if (!isPost) {
|
|
5439
5717
|
queriesToInvalidate.push([
|
|
@@ -5441,6 +5719,14 @@ function useComment(username, auth) {
|
|
|
5441
5719
|
"entry",
|
|
5442
5720
|
`/@${variables.parentAuthor}/${variables.parentPermlink}`
|
|
5443
5721
|
]);
|
|
5722
|
+
const discussionsAuthor = variables.rootAuthor || variables.parentAuthor;
|
|
5723
|
+
const discussionsPermlink = variables.rootPermlink || variables.parentPermlink;
|
|
5724
|
+
queriesToInvalidate.push({
|
|
5725
|
+
predicate: (query) => {
|
|
5726
|
+
const key = query.queryKey;
|
|
5727
|
+
return Array.isArray(key) && key[0] === "posts" && key[1] === "discussions" && key[2] === discussionsAuthor && key[3] === discussionsPermlink;
|
|
5728
|
+
}
|
|
5729
|
+
});
|
|
5444
5730
|
}
|
|
5445
5731
|
await auth.adapter.invalidateQueries(queriesToInvalidate);
|
|
5446
5732
|
}
|
|
@@ -7634,6 +7920,6 @@ async function getSpkMarkets() {
|
|
|
7634
7920
|
return await response.json();
|
|
7635
7921
|
}
|
|
7636
7922
|
|
|
7637
|
-
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, BuySellTransactionType, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, ErrorType, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, OrderIdPrefix, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildAccountCreateOp, buildAccountUpdate2Op, buildAccountUpdateOp, buildActiveCustomJsonOp, buildBoostOp, buildBoostOpWithPoints, buildBoostPlusOp, buildCancelTransferFromSavingsOp, buildChangeRecoveryAccountOp, buildClaimAccountOp, buildClaimInterestOps, buildClaimRewardBalanceOp, buildCollateralizedConvertOp, buildCommentOp, buildCommentOptionsOp, buildCommunityRegistrationOp, buildConvertOp, buildCreateClaimedAccountOp, buildDelegateRcOp, buildDelegateVestingSharesOp, buildDeleteCommentOp, buildFlagPostOp, buildFollowOp, buildGrantPostingPermissionOp, buildIgnoreOp, buildLimitOrderCancelOp, buildLimitOrderCreateOp, buildLimitOrderCreateOpWithType, buildMultiPointTransferOps, buildMultiTransferOps, buildMutePostOp, buildMuteUserOp, buildPinPostOp, buildPointTransferOp, buildPostingCustomJsonOp, buildProfileMetadata, buildPromoteOp, buildProposalCreateOp, buildProposalVoteOp, buildReblogOp, buildRecoverAccountOp, buildRecurrentTransferOp, buildRemoveProposalOp, buildRequestAccountRecoveryOp, buildRevokePostingPermissionOp, buildSetLastReadOps, buildSetRoleOp, buildSetWithdrawVestingRouteOp, buildSubscribeOp, buildTransferFromSavingsOp, buildTransferOp, buildTransferToSavingsOp, buildTransferToVestingOp, buildUnfollowOp, buildUnignoreOp, buildUnsubscribeOp, buildUpdateCommunityOp, buildUpdateProposalOp, buildVoteOp, buildWithdrawVestingOp, buildWitnessProxyOp, buildWitnessVoteOp, checkFavouriteQueryOptions, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, formatError, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getAnnouncementsQueryOptions, getBookmarksInfiniteQueryOptions, getBookmarksQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getCurrentMedianHistoryPriceQueryOptions, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFavouritesInfiniteQueryOptions, getFavouritesQueryOptions, getFeedHistoryQueryOptions, getFollowCountQueryOptions, getFollowersQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPortfolioQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getRebloggedByQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getRecurrentTransfersQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardFundQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserPostVoteQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, isInfoError, isNetworkError, isResourceCreditsError, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseChainError, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, shouldTriggerAuthFallback, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddDraft, useAddFragment, useAddImage, useAddSchedule, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useComment, useDeleteDraft, useDeleteImage, useDeleteSchedule, useEditFragment, useGameClaim, useMarkNotificationsRead, useMoveSchedule, useProposalVote, useReblog, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, useTransfer, useUpdateDraft, useUploadImage, useVote, usrActivity, validatePostCreating, votingPower, votingValue };
|
|
7923
|
+
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, BuySellTransactionType, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, ErrorType, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, OPERATION_AUTHORITY_MAP, OrderIdPrefix, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildAccountCreateOp, buildAccountUpdate2Op, buildAccountUpdateOp, buildActiveCustomJsonOp, buildBoostOp, buildBoostOpWithPoints, buildBoostPlusOp, buildCancelTransferFromSavingsOp, buildChangeRecoveryAccountOp, buildClaimAccountOp, buildClaimInterestOps, buildClaimRewardBalanceOp, buildCollateralizedConvertOp, buildCommentOp, buildCommentOptionsOp, buildCommunityRegistrationOp, buildConvertOp, buildCreateClaimedAccountOp, buildDelegateRcOp, buildDelegateVestingSharesOp, buildDeleteCommentOp, buildFlagPostOp, buildFollowOp, buildGrantPostingPermissionOp, buildIgnoreOp, buildLimitOrderCancelOp, buildLimitOrderCreateOp, buildLimitOrderCreateOpWithType, buildMultiPointTransferOps, buildMultiTransferOps, buildMutePostOp, buildMuteUserOp, buildPinPostOp, buildPointTransferOp, buildPostingCustomJsonOp, buildProfileMetadata, buildPromoteOp, buildProposalCreateOp, buildProposalVoteOp, buildReblogOp, buildRecoverAccountOp, buildRecurrentTransferOp, buildRemoveProposalOp, buildRequestAccountRecoveryOp, buildRevokePostingPermissionOp, buildSetLastReadOps, buildSetRoleOp, buildSetWithdrawVestingRouteOp, buildSubscribeOp, buildTransferFromSavingsOp, buildTransferOp, buildTransferToSavingsOp, buildTransferToVestingOp, buildUnfollowOp, buildUnignoreOp, buildUnsubscribeOp, buildUpdateCommunityOp, buildUpdateProposalOp, buildVoteOp, buildWithdrawVestingOp, buildWitnessProxyOp, buildWitnessVoteOp, checkFavouriteQueryOptions, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, formatError, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getAnnouncementsQueryOptions, getBookmarksInfiniteQueryOptions, getBookmarksQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getCurrentMedianHistoryPriceQueryOptions, getCustomJsonAuthority, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFavouritesInfiniteQueryOptions, getFavouritesQueryOptions, getFeedHistoryQueryOptions, getFollowCountQueryOptions, getFollowersQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOperationAuthority, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPortfolioQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalAuthority, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getRebloggedByQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getRecurrentTransfersQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRequiredAuthority, getRewardFundQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserPostVoteQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, isInfoError, isNetworkError, isResourceCreditsError, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseChainError, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, shouldTriggerAuthFallback, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddDraft, useAddFragment, useAddImage, useAddSchedule, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useComment, useDeleteDraft, useDeleteImage, useDeleteSchedule, useEditFragment, useFollow, useGameClaim, useMarkNotificationsRead, useMoveSchedule, useProposalVote, useReblog, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, useTransfer, useUnfollow, useUpdateDraft, useUploadImage, useVote, usrActivity, validatePostCreating, votingPower, votingValue };
|
|
7638
7924
|
//# sourceMappingURL=index.js.map
|
|
7639
7925
|
//# sourceMappingURL=index.js.map
|