@ecency/sdk 1.5.26 → 1.5.28

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.
@@ -33,8 +33,315 @@ var __export = (target, all) => {
33
33
  for (var name in all)
34
34
  __defProp(target, name, { get: all[name], enumerable: true });
35
35
  };
36
+
37
+ // src/modules/core/errors/chain-errors.ts
38
+ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
39
+ ErrorType2["COMMON"] = "common";
40
+ ErrorType2["INFO"] = "info";
41
+ ErrorType2["INSUFFICIENT_RESOURCE_CREDITS"] = "insufficient_resource_credits";
42
+ ErrorType2["MISSING_AUTHORITY"] = "missing_authority";
43
+ ErrorType2["TOKEN_EXPIRED"] = "token_expired";
44
+ ErrorType2["NETWORK"] = "network";
45
+ ErrorType2["TIMEOUT"] = "timeout";
46
+ ErrorType2["VALIDATION"] = "validation";
47
+ return ErrorType2;
48
+ })(ErrorType || {});
49
+ function parseChainError(error) {
50
+ const errorDescription = error?.error_description ? String(error.error_description) : "";
51
+ const errorMessage = error?.message ? String(error.message) : "";
52
+ const errorString = errorDescription || errorMessage || String(error || "");
53
+ const testPattern = (pattern) => {
54
+ if (errorDescription && pattern.test(errorDescription)) return true;
55
+ if (errorMessage && pattern.test(errorMessage)) return true;
56
+ if (errorString && pattern.test(errorString)) return true;
57
+ return false;
58
+ };
59
+ if (testPattern(/please wait to transact/i) || testPattern(/insufficient rc/i) || testPattern(/rc mana|rc account|resource credits/i)) {
60
+ return {
61
+ message: "Insufficient Resource Credits. Please wait or power up.",
62
+ type: "insufficient_resource_credits" /* INSUFFICIENT_RESOURCE_CREDITS */,
63
+ originalError: error
64
+ };
65
+ }
66
+ if (testPattern(/you may only post once every/i)) {
67
+ return {
68
+ message: "Please wait before posting again (minimum 3 second interval between comments).",
69
+ type: "common" /* COMMON */,
70
+ originalError: error
71
+ };
72
+ }
73
+ if (testPattern(/your current vote on this comment is identical/i)) {
74
+ return {
75
+ message: "You have already voted with the same weight.",
76
+ type: "info" /* INFO */,
77
+ originalError: error
78
+ };
79
+ }
80
+ if (testPattern(/must claim something/i)) {
81
+ return {
82
+ message: "You must claim rewards before performing this action.",
83
+ type: "info" /* INFO */,
84
+ originalError: error
85
+ };
86
+ }
87
+ if (testPattern(/cannot claim that much vests/i)) {
88
+ return {
89
+ message: "Cannot claim that amount. Please check your pending rewards.",
90
+ type: "info" /* INFO */,
91
+ originalError: error
92
+ };
93
+ }
94
+ if (testPattern(/cannot delete a comment with net positive/i)) {
95
+ return {
96
+ message: "Cannot delete a comment with positive votes.",
97
+ type: "info" /* INFO */,
98
+ originalError: error
99
+ };
100
+ }
101
+ if (testPattern(/children == 0/i)) {
102
+ return {
103
+ message: "Cannot delete a comment with replies.",
104
+ type: "common" /* COMMON */,
105
+ originalError: error
106
+ };
107
+ }
108
+ if (testPattern(/comment_cashout/i)) {
109
+ return {
110
+ message: "Cannot modify a comment that has already been paid out.",
111
+ type: "common" /* COMMON */,
112
+ originalError: error
113
+ };
114
+ }
115
+ if (testPattern(/votes evaluating for comment that is paid out is forbidden/i)) {
116
+ return {
117
+ message: "Cannot vote on posts that have already been paid out.",
118
+ type: "common" /* COMMON */,
119
+ originalError: error
120
+ };
121
+ }
122
+ if (testPattern(/missing active authority/i)) {
123
+ return {
124
+ message: "Missing active authority. This operation requires your active key.",
125
+ type: "missing_authority" /* MISSING_AUTHORITY */,
126
+ originalError: error
127
+ };
128
+ }
129
+ if (testPattern(/missing owner authority/i)) {
130
+ return {
131
+ message: "Missing owner authority. This operation requires your owner key.",
132
+ type: "missing_authority" /* MISSING_AUTHORITY */,
133
+ originalError: error
134
+ };
135
+ }
136
+ if (testPattern(/missing (required )?posting authority/i)) {
137
+ return {
138
+ message: "Missing posting authority. Please check your login method.",
139
+ type: "missing_authority" /* MISSING_AUTHORITY */,
140
+ originalError: error
141
+ };
142
+ }
143
+ if (testPattern(/token expired/i) || testPattern(/invalid token/i)) {
144
+ return {
145
+ message: "Authentication token expired. Please log in again.",
146
+ type: "token_expired" /* TOKEN_EXPIRED */,
147
+ originalError: error
148
+ };
149
+ }
150
+ if (testPattern(/has already reblogged/i) || testPattern(/already reblogged this post/i)) {
151
+ return {
152
+ message: "You have already reblogged this post.",
153
+ type: "info" /* INFO */,
154
+ originalError: error
155
+ };
156
+ }
157
+ if (testPattern(/duplicate transaction/i)) {
158
+ return {
159
+ message: "This transaction has already been processed.",
160
+ type: "info" /* INFO */,
161
+ originalError: error
162
+ };
163
+ }
164
+ if (testPattern(/econnrefused/i) || testPattern(/connection refused/i) || testPattern(/failed to fetch/i) || testPattern(/\bnetwork[-\s]?(request|error|timeout|unreachable|down|failed)\b/i)) {
165
+ return {
166
+ message: "Network error. Please check your connection and try again.",
167
+ type: "network" /* NETWORK */,
168
+ originalError: error
169
+ };
170
+ }
171
+ if (testPattern(/timeout/i) || testPattern(/timed out/i)) {
172
+ return {
173
+ message: "Request timed out. Please try again.",
174
+ type: "timeout" /* TIMEOUT */,
175
+ originalError: error
176
+ };
177
+ }
178
+ if (testPattern(/account.*does not exist/i) || testPattern(/account not found/i)) {
179
+ return {
180
+ message: "Account not found. Please check the username.",
181
+ type: "validation" /* VALIDATION */,
182
+ originalError: error
183
+ };
184
+ }
185
+ if (testPattern(/invalid memo key/i)) {
186
+ return {
187
+ message: "Invalid memo key. Cannot encrypt message.",
188
+ type: "validation" /* VALIDATION */,
189
+ originalError: error
190
+ };
191
+ }
192
+ if (testPattern(/(?:insufficient.*(?:funds|balance)|(?:funds|balance).*insufficient)/i)) {
193
+ return {
194
+ message: "Insufficient funds for this transaction.",
195
+ type: "validation" /* VALIDATION */,
196
+ originalError: error
197
+ };
198
+ }
199
+ if (testPattern(/\b(invalid|validation)\b/i)) {
200
+ const message2 = (error?.message || errorString).substring(0, 150) || "Validation error occurred";
201
+ return {
202
+ message: message2,
203
+ type: "validation" /* VALIDATION */,
204
+ originalError: error
205
+ };
206
+ }
207
+ if (error?.error_description && typeof error.error_description === "string") {
208
+ return {
209
+ message: error.error_description.substring(0, 150),
210
+ type: "common" /* COMMON */,
211
+ originalError: error
212
+ };
213
+ }
214
+ if (error?.message && typeof error.message === "string") {
215
+ return {
216
+ message: error.message.substring(0, 150),
217
+ type: "common" /* COMMON */,
218
+ originalError: error
219
+ };
220
+ }
221
+ let message;
222
+ if (typeof error === "object" && error !== null) {
223
+ if (error.error_description) {
224
+ message = String(error.error_description);
225
+ } else if (error.code) {
226
+ message = `Error code: ${error.code}`;
227
+ } else if (errorString && errorString !== "[object Object]") {
228
+ message = errorString.substring(0, 150);
229
+ } else {
230
+ message = "Unknown error occurred";
231
+ }
232
+ } else {
233
+ message = errorString.substring(0, 150) || "Unknown error occurred";
234
+ }
235
+ return {
236
+ message,
237
+ type: "common" /* COMMON */,
238
+ originalError: error
239
+ };
240
+ }
241
+ function formatError(error) {
242
+ const parsed = parseChainError(error);
243
+ return [parsed.message, parsed.type];
244
+ }
245
+ function shouldTriggerAuthFallback(error) {
246
+ const { type } = parseChainError(error);
247
+ return type === "missing_authority" /* MISSING_AUTHORITY */ || type === "token_expired" /* TOKEN_EXPIRED */;
248
+ }
249
+ function isResourceCreditsError(error) {
250
+ const { type } = parseChainError(error);
251
+ return type === "insufficient_resource_credits" /* INSUFFICIENT_RESOURCE_CREDITS */;
252
+ }
253
+ function isInfoError(error) {
254
+ const { type } = parseChainError(error);
255
+ return type === "info" /* INFO */;
256
+ }
257
+ function isNetworkError(error) {
258
+ const { type } = parseChainError(error);
259
+ return type === "network" /* NETWORK */ || type === "timeout" /* TIMEOUT */;
260
+ }
261
+ async function broadcastWithFallback(username, ops2, auth, authority = "posting") {
262
+ const chain = auth?.fallbackChain ?? ["key", "hiveauth", "hivesigner", "keychain", "custom"];
263
+ const errors = /* @__PURE__ */ new Map();
264
+ const adapter = auth?.adapter;
265
+ for (const method of chain) {
266
+ try {
267
+ switch (method) {
268
+ case "key": {
269
+ if (!adapter) {
270
+ errors.set(method, new Error("Skipped: No adapter provided"));
271
+ break;
272
+ }
273
+ let key;
274
+ if (authority === "active" && adapter.getActiveKey) {
275
+ key = await adapter.getActiveKey(username);
276
+ } else if (authority === "posting") {
277
+ key = await adapter.getPostingKey(username);
278
+ }
279
+ if (!key) {
280
+ errors.set(method, new Error(`Skipped: No ${authority} key available`));
281
+ break;
282
+ }
283
+ const privateKey = dhive.PrivateKey.fromString(key);
284
+ return await CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
285
+ }
286
+ case "hiveauth": {
287
+ if (!adapter?.broadcastWithHiveAuth) {
288
+ errors.set(method, new Error("Skipped: HiveAuth not supported by adapter"));
289
+ break;
290
+ }
291
+ return await adapter.broadcastWithHiveAuth(username, ops2, authority);
292
+ }
293
+ case "hivesigner": {
294
+ if (!adapter) {
295
+ errors.set(method, new Error("Skipped: No adapter provided"));
296
+ break;
297
+ }
298
+ const token = await adapter.getAccessToken(username);
299
+ if (!token) {
300
+ errors.set(method, new Error("Skipped: No access token available"));
301
+ break;
302
+ }
303
+ const client = new hs__default.default.Client({ accessToken: token });
304
+ const response = await client.broadcast(ops2);
305
+ return response.result;
306
+ }
307
+ case "keychain": {
308
+ if (!adapter?.broadcastWithKeychain) {
309
+ errors.set(method, new Error("Skipped: Keychain not supported by adapter"));
310
+ break;
311
+ }
312
+ return await adapter.broadcastWithKeychain(username, ops2, authority);
313
+ }
314
+ case "custom": {
315
+ if (!auth?.broadcast) {
316
+ errors.set(method, new Error("Skipped: No custom broadcast function provided"));
317
+ break;
318
+ }
319
+ return await auth.broadcast(ops2, authority);
320
+ }
321
+ }
322
+ } catch (error) {
323
+ errors.set(method, error);
324
+ if (!shouldTriggerAuthFallback(error)) {
325
+ throw error;
326
+ }
327
+ }
328
+ }
329
+ const hasRealAttempts = Array.from(errors.values()).some(
330
+ (error) => !error.message.startsWith("Skipped:")
331
+ );
332
+ if (!hasRealAttempts) {
333
+ const skipReasons = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
334
+ throw new Error(
335
+ `[SDK][Broadcast] No auth methods attempted for ${username}. ${skipReasons}`
336
+ );
337
+ }
338
+ const errorMessages = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
339
+ throw new Error(
340
+ `[SDK][Broadcast] All auth methods failed for ${username}. Errors: ${errorMessages}`
341
+ );
342
+ }
36
343
  function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
37
- }, auth) {
344
+ }, auth, authority = "posting") {
38
345
  return reactQuery.useMutation({
39
346
  onSuccess,
40
347
  mutationKey: [...mutationKey, username],
@@ -44,20 +351,23 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
44
351
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
45
352
  );
46
353
  }
354
+ const ops2 = operations(payload);
355
+ if (auth?.enableFallback !== false && auth?.adapter) {
356
+ return broadcastWithFallback(username, ops2, auth, authority);
357
+ }
47
358
  if (auth?.broadcast) {
48
- return auth.broadcast(operations(payload), "posting");
359
+ return auth.broadcast(ops2, authority);
49
360
  }
50
361
  const postingKey = auth?.postingKey;
51
362
  if (postingKey) {
52
363
  const privateKey = dhive.PrivateKey.fromString(postingKey);
53
364
  return CONFIG.hiveClient.broadcast.sendOperations(
54
- operations(payload),
365
+ ops2,
55
366
  privateKey
56
367
  );
57
368
  }
58
369
  const accessToken = auth?.accessToken;
59
370
  if (accessToken) {
60
- const ops2 = operations(payload);
61
371
  const client = new hs__default.default.Client({ accessToken });
62
372
  const response = await client.broadcast(ops2);
63
373
  return response.result;
@@ -3346,123 +3656,1134 @@ function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
3346
3656
  }
3347
3657
  return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
3348
3658
  }
3349
- function useSignOperationByKey(username) {
3350
- return reactQuery.useMutation({
3351
- mutationKey: ["operations", "sign", username],
3352
- mutationFn: ({
3353
- operation,
3354
- keyOrSeed
3355
- }) => {
3356
- if (!username) {
3357
- throw new Error("[Operations][Sign] \u2013 cannot sign op with anon user");
3358
- }
3359
- let privateKey;
3360
- if (keyOrSeed.split(" ").length === 12) {
3361
- privateKey = dhive.PrivateKey.fromLogin(username, keyOrSeed, "active");
3362
- } else if (dhive.cryptoUtils.isWif(keyOrSeed)) {
3363
- privateKey = dhive.PrivateKey.fromString(keyOrSeed);
3364
- } else {
3365
- privateKey = dhive.PrivateKey.from(keyOrSeed);
3366
- }
3367
- return CONFIG.hiveClient.broadcast.sendOperations(
3368
- [operation],
3369
- privateKey
3370
- );
3659
+
3660
+ // src/modules/operations/builders/content.ts
3661
+ function buildVoteOp(voter, author, permlink, weight) {
3662
+ if (!voter || !author || !permlink) {
3663
+ throw new Error("[SDK][buildVoteOp] Missing required parameters");
3664
+ }
3665
+ if (weight < -1e4 || weight > 1e4) {
3666
+ throw new Error("[SDK][buildVoteOp] Weight must be between -10000 and 10000");
3667
+ }
3668
+ return [
3669
+ "vote",
3670
+ {
3671
+ voter,
3672
+ author,
3673
+ permlink,
3674
+ weight
3371
3675
  }
3372
- });
3676
+ ];
3373
3677
  }
3374
- function useSignOperationByKeychain(username, auth, keyType = "active") {
3375
- return reactQuery.useMutation({
3376
- mutationKey: ["operations", "sign-keychain", username],
3377
- mutationFn: ({ operation }) => {
3378
- if (!username) {
3379
- throw new Error(
3380
- "[SDK][Keychain] \u2013\xA0cannot sign operation with anon user"
3381
- );
3382
- }
3383
- if (!auth?.broadcast) {
3384
- throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");
3385
- }
3386
- return auth.broadcast([operation], keyType);
3678
+ function buildCommentOp(author, permlink, parentAuthor, parentPermlink, title, body, jsonMetadata) {
3679
+ if (!author || !permlink || parentPermlink === void 0 || !body) {
3680
+ throw new Error("[SDK][buildCommentOp] Missing required parameters");
3681
+ }
3682
+ return [
3683
+ "comment",
3684
+ {
3685
+ parent_author: parentAuthor,
3686
+ parent_permlink: parentPermlink,
3687
+ author,
3688
+ permlink,
3689
+ title,
3690
+ body,
3691
+ json_metadata: JSON.stringify(jsonMetadata)
3387
3692
  }
3388
- });
3693
+ ];
3389
3694
  }
3390
- function useSignOperationByHivesigner(callbackUri = "/") {
3391
- return reactQuery.useMutation({
3392
- mutationKey: ["operations", "sign-hivesigner", callbackUri],
3393
- mutationFn: async ({ operation }) => {
3394
- return hs__default.default.sendOperation(operation, { callback: callbackUri }, () => {
3395
- });
3695
+ function buildCommentOptionsOp(author, permlink, maxAcceptedPayout, percentHbd, allowVotes, allowCurationRewards, extensions) {
3696
+ if (!author || !permlink) {
3697
+ throw new Error("[SDK][buildCommentOptionsOp] Missing required parameters");
3698
+ }
3699
+ return [
3700
+ "comment_options",
3701
+ {
3702
+ author,
3703
+ permlink,
3704
+ max_accepted_payout: maxAcceptedPayout,
3705
+ percent_hbd: percentHbd,
3706
+ allow_votes: allowVotes,
3707
+ allow_curation_rewards: allowCurationRewards,
3708
+ extensions
3396
3709
  }
3397
- });
3710
+ ];
3398
3711
  }
3399
- function getChainPropertiesQueryOptions() {
3400
- return reactQuery.queryOptions({
3401
- queryKey: ["operations", "chain-properties"],
3402
- queryFn: async () => {
3403
- return await CONFIG.hiveClient.database.getChainProperties();
3712
+ function buildDeleteCommentOp(author, permlink) {
3713
+ if (!author || !permlink) {
3714
+ throw new Error("[SDK][buildDeleteCommentOp] Missing required parameters");
3715
+ }
3716
+ return [
3717
+ "delete_comment",
3718
+ {
3719
+ author,
3720
+ permlink
3404
3721
  }
3405
- });
3722
+ ];
3406
3723
  }
3407
- function useAddFragment(username, code) {
3408
- return reactQuery.useMutation({
3409
- mutationKey: ["posts", "add-fragment", username],
3410
- mutationFn: async ({ title, body }) => {
3411
- if (!code) {
3412
- throw new Error("[SDK][Posts] Missing access token");
3413
- }
3414
- const fetchApi = getBoundFetch();
3415
- const response = await fetchApi(
3416
- CONFIG.privateApiHost + "/private-api/fragments-add",
3417
- {
3418
- method: "POST",
3419
- body: JSON.stringify({
3420
- code,
3421
- title,
3422
- body
3423
- }),
3424
- headers: {
3425
- "Content-Type": "application/json"
3426
- }
3427
- }
3428
- );
3429
- return response.json();
3430
- },
3431
- onSuccess(response) {
3432
- const queryClient = getQueryClient();
3433
- queryClient.setQueryData(
3434
- getFragmentsQueryOptions(username, code).queryKey,
3435
- (data) => [response, ...data ?? []]
3436
- );
3437
- queryClient.setQueriesData(
3438
- { queryKey: ["posts", "fragments", "infinite", username] },
3439
- (oldData) => {
3440
- if (!oldData) return oldData;
3441
- return {
3442
- ...oldData,
3443
- pages: oldData.pages.map(
3444
- (page, index) => index === 0 ? { ...page, data: [response, ...page.data] } : page
3445
- )
3446
- };
3447
- }
3448
- );
3724
+ function buildReblogOp(account, author, permlink, deleteReblog = false) {
3725
+ if (!account || !author || !permlink) {
3726
+ throw new Error("[SDK][buildReblogOp] Missing required parameters");
3727
+ }
3728
+ const json = {
3729
+ account,
3730
+ author,
3731
+ permlink
3732
+ };
3733
+ if (deleteReblog) {
3734
+ json.delete = "delete";
3735
+ }
3736
+ return [
3737
+ "custom_json",
3738
+ {
3739
+ id: "follow",
3740
+ json: JSON.stringify(["reblog", json]),
3741
+ required_auths: [],
3742
+ required_posting_auths: [account]
3449
3743
  }
3450
- });
3744
+ ];
3451
3745
  }
3452
- function useEditFragment(username, code) {
3453
- return reactQuery.useMutation({
3454
- mutationKey: ["posts", "edit-fragment", username],
3455
- mutationFn: async ({
3456
- fragmentId,
3457
- title,
3458
- body
3459
- }) => {
3460
- if (!code) {
3461
- throw new Error("[SDK][Posts] Missing access token");
3462
- }
3463
- const fetchApi = getBoundFetch();
3464
- const response = await fetchApi(
3465
- CONFIG.privateApiHost + "/private-api/fragments-update",
3746
+
3747
+ // src/modules/operations/builders/wallet.ts
3748
+ function buildTransferOp(from, to, amount, memo) {
3749
+ if (!from || !to || !amount) {
3750
+ throw new Error("[SDK][buildTransferOp] Missing required parameters");
3751
+ }
3752
+ return [
3753
+ "transfer",
3754
+ {
3755
+ from,
3756
+ to,
3757
+ amount,
3758
+ memo: memo || ""
3759
+ }
3760
+ ];
3761
+ }
3762
+ function buildMultiTransferOps(from, destinations, amount, memo) {
3763
+ if (!from || !destinations || !amount) {
3764
+ throw new Error("[SDK][buildMultiTransferOps] Missing required parameters");
3765
+ }
3766
+ const destArray = destinations.trim().split(/[\s,]+/).filter(Boolean);
3767
+ return destArray.map(
3768
+ (dest) => buildTransferOp(from, dest.trim(), amount, memo)
3769
+ );
3770
+ }
3771
+ function buildRecurrentTransferOp(from, to, amount, memo, recurrence, executions) {
3772
+ if (!from || !to || !amount) {
3773
+ throw new Error("[SDK][buildRecurrentTransferOp] Missing required parameters");
3774
+ }
3775
+ if (recurrence < 24) {
3776
+ throw new Error("[SDK][buildRecurrentTransferOp] Recurrence must be at least 24 hours");
3777
+ }
3778
+ return [
3779
+ "recurrent_transfer",
3780
+ {
3781
+ from,
3782
+ to,
3783
+ amount,
3784
+ memo: memo || "",
3785
+ recurrence,
3786
+ executions,
3787
+ extensions: []
3788
+ }
3789
+ ];
3790
+ }
3791
+ function buildTransferToSavingsOp(from, to, amount, memo) {
3792
+ if (!from || !to || !amount) {
3793
+ throw new Error("[SDK][buildTransferToSavingsOp] Missing required parameters");
3794
+ }
3795
+ return [
3796
+ "transfer_to_savings",
3797
+ {
3798
+ from,
3799
+ to,
3800
+ amount,
3801
+ memo: memo || ""
3802
+ }
3803
+ ];
3804
+ }
3805
+ function buildTransferFromSavingsOp(from, to, amount, memo, requestId) {
3806
+ if (!from || !to || !amount || requestId === void 0) {
3807
+ throw new Error("[SDK][buildTransferFromSavingsOp] Missing required parameters");
3808
+ }
3809
+ return [
3810
+ "transfer_from_savings",
3811
+ {
3812
+ from,
3813
+ to,
3814
+ amount,
3815
+ memo: memo || "",
3816
+ request_id: requestId
3817
+ }
3818
+ ];
3819
+ }
3820
+ function buildCancelTransferFromSavingsOp(from, requestId) {
3821
+ if (!from || requestId === void 0) {
3822
+ throw new Error("[SDK][buildCancelTransferFromSavingsOp] Missing required parameters");
3823
+ }
3824
+ return [
3825
+ "cancel_transfer_from_savings",
3826
+ {
3827
+ from,
3828
+ request_id: requestId
3829
+ }
3830
+ ];
3831
+ }
3832
+ function buildClaimInterestOps(from, to, amount, memo, requestId) {
3833
+ if (!from || !to || !amount || requestId === void 0) {
3834
+ throw new Error("[SDK][buildClaimInterestOps] Missing required parameters");
3835
+ }
3836
+ return [
3837
+ buildTransferFromSavingsOp(from, to, amount, memo, requestId),
3838
+ buildCancelTransferFromSavingsOp(from, requestId)
3839
+ ];
3840
+ }
3841
+ function buildTransferToVestingOp(from, to, amount) {
3842
+ if (!from || !to || !amount) {
3843
+ throw new Error("[SDK][buildTransferToVestingOp] Missing required parameters");
3844
+ }
3845
+ return [
3846
+ "transfer_to_vesting",
3847
+ {
3848
+ from,
3849
+ to,
3850
+ amount
3851
+ }
3852
+ ];
3853
+ }
3854
+ function buildWithdrawVestingOp(account, vestingShares) {
3855
+ if (!account || !vestingShares) {
3856
+ throw new Error("[SDK][buildWithdrawVestingOp] Missing required parameters");
3857
+ }
3858
+ return [
3859
+ "withdraw_vesting",
3860
+ {
3861
+ account,
3862
+ vesting_shares: vestingShares
3863
+ }
3864
+ ];
3865
+ }
3866
+ function buildDelegateVestingSharesOp(delegator, delegatee, vestingShares) {
3867
+ if (!delegator || !delegatee || !vestingShares) {
3868
+ throw new Error("[SDK][buildDelegateVestingSharesOp] Missing required parameters");
3869
+ }
3870
+ return [
3871
+ "delegate_vesting_shares",
3872
+ {
3873
+ delegator,
3874
+ delegatee,
3875
+ vesting_shares: vestingShares
3876
+ }
3877
+ ];
3878
+ }
3879
+ function buildSetWithdrawVestingRouteOp(fromAccount, toAccount, percent, autoVest) {
3880
+ if (!fromAccount || !toAccount || percent === void 0) {
3881
+ throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Missing required parameters");
3882
+ }
3883
+ if (percent < 0 || percent > 1e4) {
3884
+ throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");
3885
+ }
3886
+ return [
3887
+ "set_withdraw_vesting_route",
3888
+ {
3889
+ from_account: fromAccount,
3890
+ to_account: toAccount,
3891
+ percent,
3892
+ auto_vest: autoVest
3893
+ }
3894
+ ];
3895
+ }
3896
+ function buildConvertOp(owner, amount, requestId) {
3897
+ if (!owner || !amount || requestId === void 0) {
3898
+ throw new Error("[SDK][buildConvertOp] Missing required parameters");
3899
+ }
3900
+ return [
3901
+ "convert",
3902
+ {
3903
+ owner,
3904
+ amount,
3905
+ requestid: requestId
3906
+ }
3907
+ ];
3908
+ }
3909
+ function buildCollateralizedConvertOp(owner, amount, requestId) {
3910
+ if (!owner || !amount || requestId === void 0) {
3911
+ throw new Error("[SDK][buildCollateralizedConvertOp] Missing required parameters");
3912
+ }
3913
+ return [
3914
+ "collateralized_convert",
3915
+ {
3916
+ owner,
3917
+ amount,
3918
+ requestid: requestId
3919
+ }
3920
+ ];
3921
+ }
3922
+ function buildDelegateRcOp(from, delegatees, maxRc) {
3923
+ if (!from || !delegatees || maxRc === void 0) {
3924
+ throw new Error("[SDK][buildDelegateRcOp] Missing required parameters");
3925
+ }
3926
+ const delegateeArray = delegatees.includes(",") ? delegatees.split(",").map((d) => d.trim()) : [delegatees];
3927
+ return [
3928
+ "custom_json",
3929
+ {
3930
+ id: "rc",
3931
+ json: JSON.stringify([
3932
+ "delegate_rc",
3933
+ {
3934
+ from,
3935
+ delegatees: delegateeArray,
3936
+ max_rc: maxRc
3937
+ }
3938
+ ]),
3939
+ required_auths: [],
3940
+ required_posting_auths: [from]
3941
+ }
3942
+ ];
3943
+ }
3944
+
3945
+ // src/modules/operations/builders/social.ts
3946
+ function buildFollowOp(follower, following) {
3947
+ if (!follower || !following) {
3948
+ throw new Error("[SDK][buildFollowOp] Missing required parameters");
3949
+ }
3950
+ return [
3951
+ "custom_json",
3952
+ {
3953
+ id: "follow",
3954
+ json: JSON.stringify([
3955
+ "follow",
3956
+ {
3957
+ follower,
3958
+ following,
3959
+ what: ["blog"]
3960
+ }
3961
+ ]),
3962
+ required_auths: [],
3963
+ required_posting_auths: [follower]
3964
+ }
3965
+ ];
3966
+ }
3967
+ function buildUnfollowOp(follower, following) {
3968
+ if (!follower || !following) {
3969
+ throw new Error("[SDK][buildUnfollowOp] Missing required parameters");
3970
+ }
3971
+ return [
3972
+ "custom_json",
3973
+ {
3974
+ id: "follow",
3975
+ json: JSON.stringify([
3976
+ "follow",
3977
+ {
3978
+ follower,
3979
+ following,
3980
+ what: []
3981
+ }
3982
+ ]),
3983
+ required_auths: [],
3984
+ required_posting_auths: [follower]
3985
+ }
3986
+ ];
3987
+ }
3988
+ function buildIgnoreOp(follower, following) {
3989
+ if (!follower || !following) {
3990
+ throw new Error("[SDK][buildIgnoreOp] Missing required parameters");
3991
+ }
3992
+ return [
3993
+ "custom_json",
3994
+ {
3995
+ id: "follow",
3996
+ json: JSON.stringify([
3997
+ "follow",
3998
+ {
3999
+ follower,
4000
+ following,
4001
+ what: ["ignore"]
4002
+ }
4003
+ ]),
4004
+ required_auths: [],
4005
+ required_posting_auths: [follower]
4006
+ }
4007
+ ];
4008
+ }
4009
+ function buildUnignoreOp(follower, following) {
4010
+ if (!follower || !following) {
4011
+ throw new Error("[SDK][buildUnignoreOp] Missing required parameters");
4012
+ }
4013
+ return buildUnfollowOp(follower, following);
4014
+ }
4015
+ function buildSetLastReadOps(username, date) {
4016
+ if (!username) {
4017
+ throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");
4018
+ }
4019
+ const lastReadDate = date || (/* @__PURE__ */ new Date()).toISOString().split(".")[0];
4020
+ const notifyOp = [
4021
+ "custom_json",
4022
+ {
4023
+ id: "notify",
4024
+ json: JSON.stringify(["setLastRead", { date: lastReadDate }]),
4025
+ required_auths: [],
4026
+ required_posting_auths: [username]
4027
+ }
4028
+ ];
4029
+ const ecencyNotifyOp = [
4030
+ "custom_json",
4031
+ {
4032
+ id: "ecency_notify",
4033
+ json: JSON.stringify(["setLastRead", { date: lastReadDate }]),
4034
+ required_auths: [],
4035
+ required_posting_auths: [username]
4036
+ }
4037
+ ];
4038
+ return [notifyOp, ecencyNotifyOp];
4039
+ }
4040
+
4041
+ // src/modules/operations/builders/governance.ts
4042
+ function buildWitnessVoteOp(account, witness, approve) {
4043
+ if (!account || !witness || approve === void 0) {
4044
+ throw new Error("[SDK][buildWitnessVoteOp] Missing required parameters");
4045
+ }
4046
+ return [
4047
+ "account_witness_vote",
4048
+ {
4049
+ account,
4050
+ witness,
4051
+ approve
4052
+ }
4053
+ ];
4054
+ }
4055
+ function buildWitnessProxyOp(account, proxy) {
4056
+ if (!account || proxy === void 0) {
4057
+ throw new Error("[SDK][buildWitnessProxyOp] Missing required parameters");
4058
+ }
4059
+ return [
4060
+ "account_witness_proxy",
4061
+ {
4062
+ account,
4063
+ proxy
4064
+ }
4065
+ ];
4066
+ }
4067
+ function buildProposalCreateOp(creator, payload) {
4068
+ if (!creator || !payload.receiver || !payload.subject || !payload.permlink || !payload.start || !payload.end || !payload.dailyPay) {
4069
+ throw new Error("[SDK][buildProposalCreateOp] Missing required parameters");
4070
+ }
4071
+ const startDate = new Date(payload.start);
4072
+ const endDate = new Date(payload.end);
4073
+ if (startDate.toString() === "Invalid Date" || endDate.toString() === "Invalid Date") {
4074
+ throw new Error(
4075
+ "[SDK][buildProposalCreateOp] Invalid date format: start and end must be valid ISO date strings"
4076
+ );
4077
+ }
4078
+ return [
4079
+ "create_proposal",
4080
+ {
4081
+ creator,
4082
+ receiver: payload.receiver,
4083
+ start_date: payload.start,
4084
+ end_date: payload.end,
4085
+ daily_pay: payload.dailyPay,
4086
+ subject: payload.subject,
4087
+ permlink: payload.permlink,
4088
+ extensions: []
4089
+ }
4090
+ ];
4091
+ }
4092
+ function buildProposalVoteOp(voter, proposalIds, approve) {
4093
+ if (!voter || !proposalIds || proposalIds.length === 0 || approve === void 0) {
4094
+ throw new Error("[SDK][buildProposalVoteOp] Missing required parameters");
4095
+ }
4096
+ return [
4097
+ "update_proposal_votes",
4098
+ {
4099
+ voter,
4100
+ proposal_ids: proposalIds,
4101
+ approve,
4102
+ extensions: []
4103
+ }
4104
+ ];
4105
+ }
4106
+ function buildRemoveProposalOp(proposalOwner, proposalIds) {
4107
+ if (!proposalOwner || !proposalIds || proposalIds.length === 0) {
4108
+ throw new Error("[SDK][buildRemoveProposalOp] Missing required parameters");
4109
+ }
4110
+ return [
4111
+ "remove_proposal",
4112
+ {
4113
+ proposal_owner: proposalOwner,
4114
+ proposal_ids: proposalIds,
4115
+ extensions: []
4116
+ }
4117
+ ];
4118
+ }
4119
+ function buildUpdateProposalOp(proposalId, creator, dailyPay, subject, permlink) {
4120
+ if (proposalId === void 0 || proposalId === null || typeof proposalId !== "number" || !creator || !dailyPay || !subject || !permlink) {
4121
+ throw new Error("[SDK][buildUpdateProposalOp] Missing required parameters");
4122
+ }
4123
+ return [
4124
+ "update_proposal",
4125
+ {
4126
+ proposal_id: proposalId,
4127
+ creator,
4128
+ daily_pay: dailyPay,
4129
+ subject,
4130
+ permlink,
4131
+ extensions: []
4132
+ }
4133
+ ];
4134
+ }
4135
+
4136
+ // src/modules/operations/builders/community.ts
4137
+ function buildSubscribeOp(username, community) {
4138
+ if (!username || !community) {
4139
+ throw new Error("[SDK][buildSubscribeOp] Missing required parameters");
4140
+ }
4141
+ return [
4142
+ "custom_json",
4143
+ {
4144
+ id: "community",
4145
+ json: JSON.stringify(["subscribe", { community }]),
4146
+ required_auths: [],
4147
+ required_posting_auths: [username]
4148
+ }
4149
+ ];
4150
+ }
4151
+ function buildUnsubscribeOp(username, community) {
4152
+ if (!username || !community) {
4153
+ throw new Error("[SDK][buildUnsubscribeOp] Missing required parameters");
4154
+ }
4155
+ return [
4156
+ "custom_json",
4157
+ {
4158
+ id: "community",
4159
+ json: JSON.stringify(["unsubscribe", { community }]),
4160
+ required_auths: [],
4161
+ required_posting_auths: [username]
4162
+ }
4163
+ ];
4164
+ }
4165
+ function buildSetRoleOp(username, community, account, role) {
4166
+ if (!username || !community || !account || !role) {
4167
+ throw new Error("[SDK][buildSetRoleOp] Missing required parameters");
4168
+ }
4169
+ return [
4170
+ "custom_json",
4171
+ {
4172
+ id: "community",
4173
+ json: JSON.stringify(["setRole", { community, account, role }]),
4174
+ required_auths: [],
4175
+ required_posting_auths: [username]
4176
+ }
4177
+ ];
4178
+ }
4179
+ function buildUpdateCommunityOp(username, community, props) {
4180
+ if (!username || !community || !props) {
4181
+ throw new Error("[SDK][buildUpdateCommunityOp] Missing required parameters");
4182
+ }
4183
+ return [
4184
+ "custom_json",
4185
+ {
4186
+ id: "community",
4187
+ json: JSON.stringify(["updateProps", { community, props }]),
4188
+ required_auths: [],
4189
+ required_posting_auths: [username]
4190
+ }
4191
+ ];
4192
+ }
4193
+ function buildPinPostOp(username, community, account, permlink, pin) {
4194
+ if (!username || !community || !account || !permlink || pin === void 0) {
4195
+ throw new Error("[SDK][buildPinPostOp] Missing required parameters");
4196
+ }
4197
+ const action = pin ? "pinPost" : "unpinPost";
4198
+ return [
4199
+ "custom_json",
4200
+ {
4201
+ id: "community",
4202
+ json: JSON.stringify([action, { community, account, permlink }]),
4203
+ required_auths: [],
4204
+ required_posting_auths: [username]
4205
+ }
4206
+ ];
4207
+ }
4208
+ function buildMutePostOp(username, community, account, permlink, notes, mute) {
4209
+ if (!username || !community || !account || !permlink || mute === void 0) {
4210
+ throw new Error("[SDK][buildMutePostOp] Missing required parameters");
4211
+ }
4212
+ const action = mute ? "mutePost" : "unmutePost";
4213
+ return [
4214
+ "custom_json",
4215
+ {
4216
+ id: "community",
4217
+ json: JSON.stringify([action, { community, account, permlink, notes }]),
4218
+ required_auths: [],
4219
+ required_posting_auths: [username]
4220
+ }
4221
+ ];
4222
+ }
4223
+ function buildMuteUserOp(username, community, account, notes, mute) {
4224
+ if (!username || !community || !account || mute === void 0) {
4225
+ throw new Error("[SDK][buildMuteUserOp] Missing required parameters");
4226
+ }
4227
+ const action = mute ? "muteUser" : "unmuteUser";
4228
+ return [
4229
+ "custom_json",
4230
+ {
4231
+ id: "community",
4232
+ json: JSON.stringify([action, { community, account, notes }]),
4233
+ required_auths: [],
4234
+ required_posting_auths: [username]
4235
+ }
4236
+ ];
4237
+ }
4238
+ function buildFlagPostOp(username, community, account, permlink, notes) {
4239
+ if (!username || !community || !account || !permlink) {
4240
+ throw new Error("[SDK][buildFlagPostOp] Missing required parameters");
4241
+ }
4242
+ return [
4243
+ "custom_json",
4244
+ {
4245
+ id: "community",
4246
+ json: JSON.stringify(["flagPost", { community, account, permlink, notes }]),
4247
+ required_auths: [],
4248
+ required_posting_auths: [username]
4249
+ }
4250
+ ];
4251
+ }
4252
+
4253
+ // src/modules/operations/builders/market.ts
4254
+ var BuySellTransactionType = /* @__PURE__ */ ((BuySellTransactionType2) => {
4255
+ BuySellTransactionType2["Buy"] = "buy";
4256
+ BuySellTransactionType2["Sell"] = "sell";
4257
+ return BuySellTransactionType2;
4258
+ })(BuySellTransactionType || {});
4259
+ var OrderIdPrefix = /* @__PURE__ */ ((OrderIdPrefix2) => {
4260
+ OrderIdPrefix2["EMPTY"] = "";
4261
+ OrderIdPrefix2["SWAP"] = "9";
4262
+ return OrderIdPrefix2;
4263
+ })(OrderIdPrefix || {});
4264
+ function buildLimitOrderCreateOp(owner, amountToSell, minToReceive, fillOrKill, expiration, orderId) {
4265
+ if (!owner || !amountToSell || !minToReceive || !expiration || orderId === void 0) {
4266
+ throw new Error("[SDK][buildLimitOrderCreateOp] Missing required parameters");
4267
+ }
4268
+ return [
4269
+ "limit_order_create",
4270
+ {
4271
+ owner,
4272
+ orderid: orderId,
4273
+ amount_to_sell: amountToSell,
4274
+ min_to_receive: minToReceive,
4275
+ fill_or_kill: fillOrKill,
4276
+ expiration
4277
+ }
4278
+ ];
4279
+ }
4280
+ function formatNumber(value, decimals = 3) {
4281
+ return value.toFixed(decimals);
4282
+ }
4283
+ function buildLimitOrderCreateOpWithType(owner, amountToSell, minToReceive, orderType, idPrefix = "" /* EMPTY */) {
4284
+ if (!owner || orderType === void 0 || !Number.isFinite(amountToSell) || amountToSell <= 0 || !Number.isFinite(minToReceive) || minToReceive <= 0) {
4285
+ throw new Error("[SDK][buildLimitOrderCreateOpWithType] Missing or invalid parameters");
4286
+ }
4287
+ const expiration = new Date(Date.now());
4288
+ expiration.setDate(expiration.getDate() + 27);
4289
+ const expirationStr = expiration.toISOString().split(".")[0];
4290
+ const orderId = Number(
4291
+ `${idPrefix}${Math.floor(Date.now() / 1e3).toString().slice(2)}`
4292
+ );
4293
+ const formattedAmountToSell = orderType === "buy" /* Buy */ ? `${formatNumber(amountToSell, 3)} HBD` : `${formatNumber(amountToSell, 3)} HIVE`;
4294
+ const formattedMinToReceive = orderType === "buy" /* Buy */ ? `${formatNumber(minToReceive, 3)} HIVE` : `${formatNumber(minToReceive, 3)} HBD`;
4295
+ return buildLimitOrderCreateOp(
4296
+ owner,
4297
+ formattedAmountToSell,
4298
+ formattedMinToReceive,
4299
+ false,
4300
+ expirationStr,
4301
+ orderId
4302
+ );
4303
+ }
4304
+ function buildLimitOrderCancelOp(owner, orderId) {
4305
+ if (!owner || orderId === void 0) {
4306
+ throw new Error("[SDK][buildLimitOrderCancelOp] Missing required parameters");
4307
+ }
4308
+ return [
4309
+ "limit_order_cancel",
4310
+ {
4311
+ owner,
4312
+ orderid: orderId
4313
+ }
4314
+ ];
4315
+ }
4316
+ function buildClaimRewardBalanceOp(account, rewardHive, rewardHbd, rewardVests) {
4317
+ if (!account || !rewardHive || !rewardHbd || !rewardVests) {
4318
+ throw new Error("[SDK][buildClaimRewardBalanceOp] Missing required parameters");
4319
+ }
4320
+ return [
4321
+ "claim_reward_balance",
4322
+ {
4323
+ account,
4324
+ reward_hive: rewardHive,
4325
+ reward_hbd: rewardHbd,
4326
+ reward_vests: rewardVests
4327
+ }
4328
+ ];
4329
+ }
4330
+
4331
+ // src/modules/operations/builders/account.ts
4332
+ function buildAccountUpdateOp(account, owner, active, posting, memoKey, jsonMetadata) {
4333
+ if (!account || !memoKey) {
4334
+ throw new Error("[SDK][buildAccountUpdateOp] Missing required parameters");
4335
+ }
4336
+ return [
4337
+ "account_update",
4338
+ {
4339
+ account,
4340
+ owner,
4341
+ active,
4342
+ posting,
4343
+ memo_key: memoKey,
4344
+ json_metadata: jsonMetadata
4345
+ }
4346
+ ];
4347
+ }
4348
+ function buildAccountUpdate2Op(account, jsonMetadata, postingJsonMetadata, extensions) {
4349
+ if (!account || postingJsonMetadata === void 0) {
4350
+ throw new Error("[SDK][buildAccountUpdate2Op] Missing required parameters");
4351
+ }
4352
+ return [
4353
+ "account_update2",
4354
+ {
4355
+ account,
4356
+ json_metadata: jsonMetadata || "",
4357
+ posting_json_metadata: postingJsonMetadata,
4358
+ extensions: extensions || []
4359
+ }
4360
+ ];
4361
+ }
4362
+ function buildAccountCreateOp(creator, newAccountName, keys, fee) {
4363
+ if (!creator || !newAccountName || !keys || !fee) {
4364
+ throw new Error("[SDK][buildAccountCreateOp] Missing required parameters");
4365
+ }
4366
+ const owner = {
4367
+ weight_threshold: 1,
4368
+ account_auths: [],
4369
+ key_auths: [[keys.ownerPublicKey, 1]]
4370
+ };
4371
+ const active = {
4372
+ weight_threshold: 1,
4373
+ account_auths: [],
4374
+ key_auths: [[keys.activePublicKey, 1]]
4375
+ };
4376
+ const posting = {
4377
+ weight_threshold: 1,
4378
+ account_auths: [["ecency.app", 1]],
4379
+ key_auths: [[keys.postingPublicKey, 1]]
4380
+ };
4381
+ return [
4382
+ "account_create",
4383
+ {
4384
+ creator,
4385
+ new_account_name: newAccountName,
4386
+ owner,
4387
+ active,
4388
+ posting,
4389
+ memo_key: keys.memoPublicKey,
4390
+ json_metadata: "",
4391
+ extensions: [],
4392
+ fee
4393
+ }
4394
+ ];
4395
+ }
4396
+ function buildCreateClaimedAccountOp(creator, newAccountName, keys) {
4397
+ if (!creator || !newAccountName || !keys) {
4398
+ throw new Error("[SDK][buildCreateClaimedAccountOp] Missing required parameters");
4399
+ }
4400
+ const owner = {
4401
+ weight_threshold: 1,
4402
+ account_auths: [],
4403
+ key_auths: [[keys.ownerPublicKey, 1]]
4404
+ };
4405
+ const active = {
4406
+ weight_threshold: 1,
4407
+ account_auths: [],
4408
+ key_auths: [[keys.activePublicKey, 1]]
4409
+ };
4410
+ const posting = {
4411
+ weight_threshold: 1,
4412
+ account_auths: [["ecency.app", 1]],
4413
+ key_auths: [[keys.postingPublicKey, 1]]
4414
+ };
4415
+ return [
4416
+ "create_claimed_account",
4417
+ {
4418
+ creator,
4419
+ new_account_name: newAccountName,
4420
+ owner,
4421
+ active,
4422
+ posting,
4423
+ memo_key: keys.memoPublicKey,
4424
+ json_metadata: "",
4425
+ extensions: []
4426
+ }
4427
+ ];
4428
+ }
4429
+ function buildClaimAccountOp(creator, fee) {
4430
+ if (!creator || !fee) {
4431
+ throw new Error("[SDK][buildClaimAccountOp] Missing required parameters");
4432
+ }
4433
+ return [
4434
+ "claim_account",
4435
+ {
4436
+ creator,
4437
+ fee,
4438
+ extensions: []
4439
+ }
4440
+ ];
4441
+ }
4442
+ function buildGrantPostingPermissionOp(account, currentPosting, grantedAccount, weightThreshold, memoKey, jsonMetadata) {
4443
+ if (!account || !currentPosting || !grantedAccount || !memoKey) {
4444
+ throw new Error("[SDK][buildGrantPostingPermissionOp] Missing required parameters");
4445
+ }
4446
+ const existingIndex = currentPosting.account_auths.findIndex(
4447
+ ([acc]) => acc === grantedAccount
4448
+ );
4449
+ const newAccountAuths = [...currentPosting.account_auths];
4450
+ if (existingIndex >= 0) {
4451
+ newAccountAuths[existingIndex] = [grantedAccount, weightThreshold];
4452
+ } else {
4453
+ newAccountAuths.push([grantedAccount, weightThreshold]);
4454
+ }
4455
+ const newPosting = {
4456
+ ...currentPosting,
4457
+ account_auths: newAccountAuths
4458
+ };
4459
+ newPosting.account_auths.sort((a, b) => a[0] > b[0] ? 1 : -1);
4460
+ return [
4461
+ "account_update",
4462
+ {
4463
+ account,
4464
+ posting: newPosting,
4465
+ memo_key: memoKey,
4466
+ json_metadata: jsonMetadata
4467
+ }
4468
+ ];
4469
+ }
4470
+ function buildRevokePostingPermissionOp(account, currentPosting, revokedAccount, memoKey, jsonMetadata) {
4471
+ if (!account || !currentPosting || !revokedAccount || !memoKey) {
4472
+ throw new Error("[SDK][buildRevokePostingPermissionOp] Missing required parameters");
4473
+ }
4474
+ const newPosting = {
4475
+ ...currentPosting,
4476
+ account_auths: currentPosting.account_auths.filter(
4477
+ ([acc]) => acc !== revokedAccount
4478
+ )
4479
+ };
4480
+ return [
4481
+ "account_update",
4482
+ {
4483
+ account,
4484
+ posting: newPosting,
4485
+ memo_key: memoKey,
4486
+ json_metadata: jsonMetadata
4487
+ }
4488
+ ];
4489
+ }
4490
+ function buildChangeRecoveryAccountOp(accountToRecover, newRecoveryAccount, extensions = []) {
4491
+ if (!accountToRecover || !newRecoveryAccount) {
4492
+ throw new Error("[SDK][buildChangeRecoveryAccountOp] Missing required parameters");
4493
+ }
4494
+ return [
4495
+ "change_recovery_account",
4496
+ {
4497
+ account_to_recover: accountToRecover,
4498
+ new_recovery_account: newRecoveryAccount,
4499
+ extensions
4500
+ }
4501
+ ];
4502
+ }
4503
+ function buildRequestAccountRecoveryOp(recoveryAccount, accountToRecover, newOwnerAuthority, extensions = []) {
4504
+ if (!recoveryAccount || !accountToRecover || !newOwnerAuthority) {
4505
+ throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");
4506
+ }
4507
+ return [
4508
+ "request_account_recovery",
4509
+ {
4510
+ recovery_account: recoveryAccount,
4511
+ account_to_recover: accountToRecover,
4512
+ new_owner_authority: newOwnerAuthority,
4513
+ extensions
4514
+ }
4515
+ ];
4516
+ }
4517
+ function buildRecoverAccountOp(accountToRecover, newOwnerAuthority, recentOwnerAuthority, extensions = []) {
4518
+ if (!accountToRecover || !newOwnerAuthority || !recentOwnerAuthority) {
4519
+ throw new Error("[SDK][buildRecoverAccountOp] Missing required parameters");
4520
+ }
4521
+ return [
4522
+ "recover_account",
4523
+ {
4524
+ account_to_recover: accountToRecover,
4525
+ new_owner_authority: newOwnerAuthority,
4526
+ recent_owner_authority: recentOwnerAuthority,
4527
+ extensions
4528
+ }
4529
+ ];
4530
+ }
4531
+
4532
+ // src/modules/operations/builders/ecency.ts
4533
+ function buildBoostOp(user, author, permlink, amount) {
4534
+ if (!user || !author || !permlink || !amount) {
4535
+ throw new Error("[SDK][buildBoostOp] Missing required parameters");
4536
+ }
4537
+ return [
4538
+ "custom_json",
4539
+ {
4540
+ id: "ecency_boost",
4541
+ json: JSON.stringify({
4542
+ user,
4543
+ author,
4544
+ permlink,
4545
+ amount
4546
+ }),
4547
+ required_auths: [user],
4548
+ required_posting_auths: []
4549
+ }
4550
+ ];
4551
+ }
4552
+ function buildBoostOpWithPoints(user, author, permlink, points) {
4553
+ if (!user || !author || !permlink || !Number.isFinite(points)) {
4554
+ throw new Error("[SDK][buildBoostOpWithPoints] Missing required parameters");
4555
+ }
4556
+ return buildBoostOp(user, author, permlink, `${points.toFixed(3)} POINT`);
4557
+ }
4558
+ function buildBoostPlusOp(user, account, duration) {
4559
+ if (!user || !account || !Number.isFinite(duration)) {
4560
+ throw new Error("[SDK][buildBoostPlusOp] Missing required parameters");
4561
+ }
4562
+ return [
4563
+ "custom_json",
4564
+ {
4565
+ id: "ecency_boost_plus",
4566
+ json: JSON.stringify({
4567
+ user,
4568
+ account,
4569
+ duration
4570
+ }),
4571
+ required_auths: [user],
4572
+ required_posting_auths: []
4573
+ }
4574
+ ];
4575
+ }
4576
+ function buildPromoteOp(user, author, permlink, duration) {
4577
+ if (!user || !author || !permlink || !Number.isFinite(duration)) {
4578
+ throw new Error("[SDK][buildPromoteOp] Missing required parameters");
4579
+ }
4580
+ return [
4581
+ "custom_json",
4582
+ {
4583
+ id: "ecency_promote",
4584
+ json: JSON.stringify({
4585
+ user,
4586
+ author,
4587
+ permlink,
4588
+ duration
4589
+ }),
4590
+ required_auths: [user],
4591
+ required_posting_auths: []
4592
+ }
4593
+ ];
4594
+ }
4595
+ function buildPointTransferOp(sender, receiver, amount, memo) {
4596
+ if (!sender || !receiver || !amount) {
4597
+ throw new Error("[SDK][buildPointTransferOp] Missing required parameters");
4598
+ }
4599
+ return [
4600
+ "custom_json",
4601
+ {
4602
+ id: "ecency_point_transfer",
4603
+ json: JSON.stringify({
4604
+ sender,
4605
+ receiver,
4606
+ amount,
4607
+ memo: memo || ""
4608
+ }),
4609
+ required_auths: [sender],
4610
+ required_posting_auths: []
4611
+ }
4612
+ ];
4613
+ }
4614
+ function buildMultiPointTransferOps(sender, destinations, amount, memo) {
4615
+ if (!sender || !destinations || !amount) {
4616
+ throw new Error("[SDK][buildMultiPointTransferOps] Missing required parameters");
4617
+ }
4618
+ const destArray = destinations.trim().split(/[\s,]+/).filter(Boolean);
4619
+ if (destArray.length === 0) {
4620
+ throw new Error("[SDK][buildMultiPointTransferOps] Missing valid destinations");
4621
+ }
4622
+ return destArray.map(
4623
+ (dest) => buildPointTransferOp(sender, dest.trim(), amount, memo)
4624
+ );
4625
+ }
4626
+ function buildCommunityRegistrationOp(name) {
4627
+ if (!name) {
4628
+ throw new Error("[SDK][buildCommunityRegistrationOp] Missing required parameters");
4629
+ }
4630
+ return [
4631
+ "custom_json",
4632
+ {
4633
+ id: "ecency_registration",
4634
+ json: JSON.stringify({
4635
+ name
4636
+ }),
4637
+ required_auths: [name],
4638
+ required_posting_auths: []
4639
+ }
4640
+ ];
4641
+ }
4642
+ function buildActiveCustomJsonOp(username, operationId, json) {
4643
+ if (!username || !operationId || !json) {
4644
+ throw new Error("[SDK][buildActiveCustomJsonOp] Missing required parameters");
4645
+ }
4646
+ return [
4647
+ "custom_json",
4648
+ {
4649
+ id: operationId,
4650
+ json: JSON.stringify(json),
4651
+ required_auths: [username],
4652
+ required_posting_auths: []
4653
+ }
4654
+ ];
4655
+ }
4656
+ function buildPostingCustomJsonOp(username, operationId, json) {
4657
+ if (!username || !operationId || !json) {
4658
+ throw new Error("[SDK][buildPostingCustomJsonOp] Missing required parameters");
4659
+ }
4660
+ return [
4661
+ "custom_json",
4662
+ {
4663
+ id: operationId,
4664
+ json: JSON.stringify(json),
4665
+ required_auths: [],
4666
+ required_posting_auths: [username]
4667
+ }
4668
+ ];
4669
+ }
4670
+ function useSignOperationByKey(username) {
4671
+ return reactQuery.useMutation({
4672
+ mutationKey: ["operations", "sign", username],
4673
+ mutationFn: ({
4674
+ operation,
4675
+ keyOrSeed
4676
+ }) => {
4677
+ if (!username) {
4678
+ throw new Error("[Operations][Sign] \u2013 cannot sign op with anon user");
4679
+ }
4680
+ let privateKey;
4681
+ if (keyOrSeed.split(" ").length === 12) {
4682
+ privateKey = dhive.PrivateKey.fromLogin(username, keyOrSeed, "active");
4683
+ } else if (dhive.cryptoUtils.isWif(keyOrSeed)) {
4684
+ privateKey = dhive.PrivateKey.fromString(keyOrSeed);
4685
+ } else {
4686
+ privateKey = dhive.PrivateKey.from(keyOrSeed);
4687
+ }
4688
+ return CONFIG.hiveClient.broadcast.sendOperations(
4689
+ [operation],
4690
+ privateKey
4691
+ );
4692
+ }
4693
+ });
4694
+ }
4695
+ function useSignOperationByKeychain(username, auth, keyType = "active") {
4696
+ return reactQuery.useMutation({
4697
+ mutationKey: ["operations", "sign-keychain", username],
4698
+ mutationFn: ({ operation }) => {
4699
+ if (!username) {
4700
+ throw new Error(
4701
+ "[SDK][Keychain] \u2013\xA0cannot sign operation with anon user"
4702
+ );
4703
+ }
4704
+ if (!auth?.broadcast) {
4705
+ throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");
4706
+ }
4707
+ return auth.broadcast([operation], keyType);
4708
+ }
4709
+ });
4710
+ }
4711
+ function useSignOperationByHivesigner(callbackUri = "/") {
4712
+ return reactQuery.useMutation({
4713
+ mutationKey: ["operations", "sign-hivesigner", callbackUri],
4714
+ mutationFn: async ({ operation }) => {
4715
+ return hs__default.default.sendOperation(operation, { callback: callbackUri }, () => {
4716
+ });
4717
+ }
4718
+ });
4719
+ }
4720
+ function getChainPropertiesQueryOptions() {
4721
+ return reactQuery.queryOptions({
4722
+ queryKey: ["operations", "chain-properties"],
4723
+ queryFn: async () => {
4724
+ return await CONFIG.hiveClient.database.getChainProperties();
4725
+ }
4726
+ });
4727
+ }
4728
+ function useAddFragment(username, code) {
4729
+ return reactQuery.useMutation({
4730
+ mutationKey: ["posts", "add-fragment", username],
4731
+ mutationFn: async ({ title, body }) => {
4732
+ if (!code) {
4733
+ throw new Error("[SDK][Posts] Missing access token");
4734
+ }
4735
+ const fetchApi = getBoundFetch();
4736
+ const response = await fetchApi(
4737
+ CONFIG.privateApiHost + "/private-api/fragments-add",
4738
+ {
4739
+ method: "POST",
4740
+ body: JSON.stringify({
4741
+ code,
4742
+ title,
4743
+ body
4744
+ }),
4745
+ headers: {
4746
+ "Content-Type": "application/json"
4747
+ }
4748
+ }
4749
+ );
4750
+ return response.json();
4751
+ },
4752
+ onSuccess(response) {
4753
+ const queryClient = getQueryClient();
4754
+ queryClient.setQueryData(
4755
+ getFragmentsQueryOptions(username, code).queryKey,
4756
+ (data) => [response, ...data ?? []]
4757
+ );
4758
+ queryClient.setQueriesData(
4759
+ { queryKey: ["posts", "fragments", "infinite", username] },
4760
+ (oldData) => {
4761
+ if (!oldData) return oldData;
4762
+ return {
4763
+ ...oldData,
4764
+ pages: oldData.pages.map(
4765
+ (page, index) => index === 0 ? { ...page, data: [response, ...page.data] } : page
4766
+ )
4767
+ };
4768
+ }
4769
+ );
4770
+ }
4771
+ });
4772
+ }
4773
+ function useEditFragment(username, code) {
4774
+ return reactQuery.useMutation({
4775
+ mutationKey: ["posts", "edit-fragment", username],
4776
+ mutationFn: async ({
4777
+ fragmentId,
4778
+ title,
4779
+ body
4780
+ }) => {
4781
+ if (!code) {
4782
+ throw new Error("[SDK][Posts] Missing access token");
4783
+ }
4784
+ const fetchApi = getBoundFetch();
4785
+ const response = await fetchApi(
4786
+ CONFIG.privateApiHost + "/private-api/fragments-update",
3466
4787
  {
3467
4788
  method: "POST",
3468
4789
  body: JSON.stringify({
@@ -4023,6 +5344,136 @@ function useUploadImage(onSuccess, onError) {
4023
5344
  });
4024
5345
  }
4025
5346
 
5347
+ // src/modules/posts/mutations/use-vote.ts
5348
+ function useVote(username, auth) {
5349
+ return useBroadcastMutation(
5350
+ ["posts", "vote"],
5351
+ username,
5352
+ ({ author, permlink, weight }) => [
5353
+ buildVoteOp(username, author, permlink, weight)
5354
+ ],
5355
+ async (result, variables) => {
5356
+ if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
5357
+ await auth.adapter.recordActivity(120, result.block_num, result.id);
5358
+ }
5359
+ if (auth?.adapter?.invalidateQueries) {
5360
+ await auth.adapter.invalidateQueries([
5361
+ ["posts", "entry", `/@${variables.author}/${variables.permlink}`],
5362
+ ["account", username, "votingPower"]
5363
+ ]);
5364
+ }
5365
+ },
5366
+ auth
5367
+ );
5368
+ }
5369
+
5370
+ // src/modules/posts/mutations/use-reblog.ts
5371
+ function useReblog(username, auth) {
5372
+ return useBroadcastMutation(
5373
+ ["posts", "reblog"],
5374
+ username,
5375
+ ({ author, permlink, deleteReblog }) => [
5376
+ buildReblogOp(username, author, permlink, deleteReblog ?? false)
5377
+ ],
5378
+ async (result, variables) => {
5379
+ if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
5380
+ await auth.adapter.recordActivity(130, result.block_num, result.id);
5381
+ }
5382
+ if (auth?.adapter?.invalidateQueries) {
5383
+ await auth.adapter.invalidateQueries([
5384
+ ["posts", "blog", username],
5385
+ ["posts", "entry", `/@${variables.author}/${variables.permlink}`]
5386
+ ]);
5387
+ }
5388
+ },
5389
+ auth
5390
+ );
5391
+ }
5392
+
5393
+ // src/modules/posts/mutations/use-comment.ts
5394
+ function useComment(username, auth) {
5395
+ return useBroadcastMutation(
5396
+ ["posts", "comment"],
5397
+ username,
5398
+ (payload) => {
5399
+ const operations = [];
5400
+ operations.push(
5401
+ buildCommentOp(
5402
+ payload.author,
5403
+ payload.permlink,
5404
+ payload.parentAuthor,
5405
+ payload.parentPermlink,
5406
+ payload.title,
5407
+ payload.body,
5408
+ payload.jsonMetadata
5409
+ )
5410
+ );
5411
+ if (payload.options) {
5412
+ const {
5413
+ maxAcceptedPayout = "1000000.000 HBD",
5414
+ percentHbd = 1e4,
5415
+ allowVotes = true,
5416
+ allowCurationRewards = true,
5417
+ beneficiaries = []
5418
+ } = payload.options;
5419
+ const extensions = [];
5420
+ if (beneficiaries.length > 0) {
5421
+ const sortedBeneficiaries = [...beneficiaries].sort(
5422
+ (a, b) => a.account.localeCompare(b.account)
5423
+ );
5424
+ extensions.push([
5425
+ 0,
5426
+ {
5427
+ beneficiaries: sortedBeneficiaries.map((b) => ({
5428
+ account: b.account,
5429
+ weight: b.weight
5430
+ }))
5431
+ }
5432
+ ]);
5433
+ }
5434
+ operations.push(
5435
+ buildCommentOptionsOp(
5436
+ payload.author,
5437
+ payload.permlink,
5438
+ maxAcceptedPayout,
5439
+ percentHbd,
5440
+ allowVotes,
5441
+ allowCurationRewards,
5442
+ extensions
5443
+ )
5444
+ );
5445
+ }
5446
+ return operations;
5447
+ },
5448
+ async (result, variables) => {
5449
+ const isPost = !variables.parentAuthor;
5450
+ const activityType = isPost ? 100 : 110;
5451
+ if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
5452
+ try {
5453
+ await auth.adapter.recordActivity(activityType, result.block_num, result.id);
5454
+ } catch (err) {
5455
+ console.warn("[useComment] Failed to record activity:", err);
5456
+ }
5457
+ }
5458
+ if (auth?.adapter?.invalidateQueries) {
5459
+ const queriesToInvalidate = [
5460
+ ["posts", "feed", username],
5461
+ ["posts", "blog", username]
5462
+ ];
5463
+ if (!isPost) {
5464
+ queriesToInvalidate.push([
5465
+ "posts",
5466
+ "entry",
5467
+ `/@${variables.parentAuthor}/${variables.parentPermlink}`
5468
+ ]);
5469
+ }
5470
+ await auth.adapter.invalidateQueries(queriesToInvalidate);
5471
+ }
5472
+ },
5473
+ auth
5474
+ );
5475
+ }
5476
+
4026
5477
  // src/modules/posts/utils/validate-post-creating.ts
4027
5478
  var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
4028
5479
  var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -4137,8 +5588,10 @@ function getDiscoverCurationQueryOptions(duration) {
4137
5588
  });
4138
5589
  }
4139
5590
  function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "pageviews", "visit_duration"], dateRange) {
5591
+ const sortedDimensions = [...dimensions].sort();
5592
+ const sortedMetrics = [...metrics].sort();
4140
5593
  return reactQuery.queryOptions({
4141
- queryKey: ["analytics", "page-stats", url, dimensions, metrics, dateRange],
5594
+ queryKey: ["analytics", "page-stats", url, sortedDimensions, sortedMetrics, dateRange],
4142
5595
  queryFn: async ({ signal }) => {
4143
5596
  const response = await fetch(CONFIG.privateApiHost + "/api/stats", {
4144
5597
  method: "POST",
@@ -4158,7 +5611,9 @@ function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "
4158
5611
  }
4159
5612
  return response.json();
4160
5613
  },
4161
- enabled: !!url
5614
+ enabled: !!url,
5615
+ // Analytics data should always be fresh - users expect current stats when changing range
5616
+ staleTime: 0
4162
5617
  });
4163
5618
  }
4164
5619
 
@@ -4880,6 +6335,35 @@ function getUserProposalVotesQueryOptions(voter) {
4880
6335
  }
4881
6336
  });
4882
6337
  }
6338
+
6339
+ // src/modules/proposals/mutations/use-proposal-vote.ts
6340
+ function useProposalVote(username, auth) {
6341
+ return useBroadcastMutation(
6342
+ ["proposals", "vote"],
6343
+ username,
6344
+ ({ proposalIds, approve }) => [
6345
+ buildProposalVoteOp(username, proposalIds, approve)
6346
+ ],
6347
+ async (result) => {
6348
+ try {
6349
+ if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
6350
+ await auth.adapter.recordActivity(150, result.block_num, result.id);
6351
+ }
6352
+ if (auth?.adapter?.invalidateQueries) {
6353
+ await auth.adapter.invalidateQueries([
6354
+ ["proposals", "list"],
6355
+ ["proposals", "votes", username]
6356
+ ]);
6357
+ }
6358
+ } catch (error) {
6359
+ console.warn("[useProposalVote] Post-broadcast side-effect failed:", error);
6360
+ }
6361
+ },
6362
+ auth,
6363
+ "active"
6364
+ // Use active authority for proposal votes (required by blockchain)
6365
+ );
6366
+ }
4883
6367
  function getVestingDelegationsQueryOptions(username, limit = 50) {
4884
6368
  return reactQuery.infiniteQueryOptions({
4885
6369
  queryKey: ["wallet", "vesting-delegations", username, limit],
@@ -5170,6 +6654,110 @@ function getPortfolioQueryOptions(username, currency = "usd", onlyEnabled = true
5170
6654
  }
5171
6655
  });
5172
6656
  }
6657
+ async function broadcastTransferWithFallback(username, ops2, auth) {
6658
+ const chain = auth?.fallbackChain ?? ["key", "hiveauth", "hivesigner", "keychain"];
6659
+ const errors = /* @__PURE__ */ new Map();
6660
+ const adapter = auth?.adapter;
6661
+ for (const method of chain) {
6662
+ try {
6663
+ switch (method) {
6664
+ case "key": {
6665
+ if (!adapter) break;
6666
+ const key = await adapter.getActiveKey?.(username);
6667
+ if (key) {
6668
+ const privateKey = dhive.PrivateKey.fromString(key);
6669
+ return await CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
6670
+ }
6671
+ break;
6672
+ }
6673
+ case "hiveauth": {
6674
+ if (adapter?.broadcastWithHiveAuth) {
6675
+ return await adapter.broadcastWithHiveAuth(username, ops2, "active");
6676
+ }
6677
+ break;
6678
+ }
6679
+ case "hivesigner": {
6680
+ if (!adapter) break;
6681
+ const token = await adapter.getAccessToken(username);
6682
+ if (token) {
6683
+ const client = new hs__default.default.Client({ accessToken: token });
6684
+ const response = await client.broadcast(ops2);
6685
+ return response.result;
6686
+ }
6687
+ break;
6688
+ }
6689
+ case "keychain": {
6690
+ if (adapter?.broadcastWithKeychain) {
6691
+ return await adapter.broadcastWithKeychain(username, ops2, "active");
6692
+ }
6693
+ break;
6694
+ }
6695
+ case "custom": {
6696
+ if (auth?.broadcast) {
6697
+ return await auth.broadcast(ops2, "active");
6698
+ }
6699
+ break;
6700
+ }
6701
+ }
6702
+ } catch (error) {
6703
+ errors.set(method, error);
6704
+ if (!shouldTriggerAuthFallback(error)) {
6705
+ throw error;
6706
+ }
6707
+ }
6708
+ }
6709
+ const errorMessages = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
6710
+ throw new Error(
6711
+ `[SDK][Transfer] All auth methods failed for ${username}. Errors: ${errorMessages}`
6712
+ );
6713
+ }
6714
+ function useTransfer(username, auth) {
6715
+ return reactQuery.useMutation({
6716
+ mutationKey: ["wallet", "transfer", username],
6717
+ mutationFn: async (payload) => {
6718
+ if (!username) {
6719
+ throw new Error(
6720
+ "[SDK][Transfer] Attempted to call transfer API with anon user"
6721
+ );
6722
+ }
6723
+ const ops2 = [buildTransferOp(username, payload.to, payload.amount, payload.memo)];
6724
+ if (auth?.enableFallback !== false && auth?.adapter) {
6725
+ return broadcastTransferWithFallback(username, ops2, auth);
6726
+ }
6727
+ if (auth?.broadcast) {
6728
+ return auth.broadcast(ops2, "active");
6729
+ }
6730
+ if (auth?.adapter?.getActiveKey) {
6731
+ const activeKey = await auth.adapter.getActiveKey(username);
6732
+ if (activeKey) {
6733
+ const privateKey = dhive.PrivateKey.fromString(activeKey);
6734
+ return CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
6735
+ }
6736
+ }
6737
+ const accessToken = auth?.accessToken;
6738
+ if (accessToken) {
6739
+ const client = new hs__default.default.Client({ accessToken });
6740
+ const response = await client.broadcast(ops2);
6741
+ return response.result;
6742
+ }
6743
+ throw new Error(
6744
+ "[SDK][Transfer] \u2013 cannot broadcast transfer w/o active key or token"
6745
+ );
6746
+ },
6747
+ onSuccess: async (result, variables) => {
6748
+ if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
6749
+ await auth.adapter.recordActivity(140, result.block_num, result.id);
6750
+ }
6751
+ if (auth?.adapter?.invalidateQueries) {
6752
+ await auth.adapter.invalidateQueries([
6753
+ ["wallet", "balances", username],
6754
+ ["wallet", "balances", variables.to],
6755
+ ["wallet", "transactions", username]
6756
+ ]);
6757
+ }
6758
+ }
6759
+ });
6760
+ }
5173
6761
  function getWitnessesInfiniteQueryOptions(limit) {
5174
6762
  return reactQuery.infiniteQueryOptions({
5175
6763
  queryKey: ["witnesses", "list", limit],
@@ -6074,13 +7662,16 @@ async function getSpkMarkets() {
6074
7662
  exports.ACCOUNT_OPERATION_GROUPS = ACCOUNT_OPERATION_GROUPS;
6075
7663
  exports.ALL_ACCOUNT_OPERATIONS = ALL_ACCOUNT_OPERATIONS;
6076
7664
  exports.ALL_NOTIFY_TYPES = ALL_NOTIFY_TYPES;
7665
+ exports.BuySellTransactionType = BuySellTransactionType;
6077
7666
  exports.CONFIG = CONFIG;
6078
7667
  exports.EcencyAnalytics = mutations_exports;
7668
+ exports.ErrorType = ErrorType;
6079
7669
  exports.HiveSignerIntegration = HiveSignerIntegration;
6080
7670
  exports.NaiMap = NaiMap;
6081
7671
  exports.NotificationFilter = NotificationFilter;
6082
7672
  exports.NotificationViewType = NotificationViewType;
6083
7673
  exports.NotifyTypes = NotifyTypes;
7674
+ exports.OrderIdPrefix = OrderIdPrefix;
6084
7675
  exports.ROLES = ROLES;
6085
7676
  exports.SortOrder = SortOrder;
6086
7677
  exports.Symbol = Symbol2;
@@ -6090,7 +7681,68 @@ exports.addImage = addImage;
6090
7681
  exports.addSchedule = addSchedule;
6091
7682
  exports.bridgeApiCall = bridgeApiCall;
6092
7683
  exports.broadcastJson = broadcastJson;
7684
+ exports.buildAccountCreateOp = buildAccountCreateOp;
7685
+ exports.buildAccountUpdate2Op = buildAccountUpdate2Op;
7686
+ exports.buildAccountUpdateOp = buildAccountUpdateOp;
7687
+ exports.buildActiveCustomJsonOp = buildActiveCustomJsonOp;
7688
+ exports.buildBoostOp = buildBoostOp;
7689
+ exports.buildBoostOpWithPoints = buildBoostOpWithPoints;
7690
+ exports.buildBoostPlusOp = buildBoostPlusOp;
7691
+ exports.buildCancelTransferFromSavingsOp = buildCancelTransferFromSavingsOp;
7692
+ exports.buildChangeRecoveryAccountOp = buildChangeRecoveryAccountOp;
7693
+ exports.buildClaimAccountOp = buildClaimAccountOp;
7694
+ exports.buildClaimInterestOps = buildClaimInterestOps;
7695
+ exports.buildClaimRewardBalanceOp = buildClaimRewardBalanceOp;
7696
+ exports.buildCollateralizedConvertOp = buildCollateralizedConvertOp;
7697
+ exports.buildCommentOp = buildCommentOp;
7698
+ exports.buildCommentOptionsOp = buildCommentOptionsOp;
7699
+ exports.buildCommunityRegistrationOp = buildCommunityRegistrationOp;
7700
+ exports.buildConvertOp = buildConvertOp;
7701
+ exports.buildCreateClaimedAccountOp = buildCreateClaimedAccountOp;
7702
+ exports.buildDelegateRcOp = buildDelegateRcOp;
7703
+ exports.buildDelegateVestingSharesOp = buildDelegateVestingSharesOp;
7704
+ exports.buildDeleteCommentOp = buildDeleteCommentOp;
7705
+ exports.buildFlagPostOp = buildFlagPostOp;
7706
+ exports.buildFollowOp = buildFollowOp;
7707
+ exports.buildGrantPostingPermissionOp = buildGrantPostingPermissionOp;
7708
+ exports.buildIgnoreOp = buildIgnoreOp;
7709
+ exports.buildLimitOrderCancelOp = buildLimitOrderCancelOp;
7710
+ exports.buildLimitOrderCreateOp = buildLimitOrderCreateOp;
7711
+ exports.buildLimitOrderCreateOpWithType = buildLimitOrderCreateOpWithType;
7712
+ exports.buildMultiPointTransferOps = buildMultiPointTransferOps;
7713
+ exports.buildMultiTransferOps = buildMultiTransferOps;
7714
+ exports.buildMutePostOp = buildMutePostOp;
7715
+ exports.buildMuteUserOp = buildMuteUserOp;
7716
+ exports.buildPinPostOp = buildPinPostOp;
7717
+ exports.buildPointTransferOp = buildPointTransferOp;
7718
+ exports.buildPostingCustomJsonOp = buildPostingCustomJsonOp;
6093
7719
  exports.buildProfileMetadata = buildProfileMetadata;
7720
+ exports.buildPromoteOp = buildPromoteOp;
7721
+ exports.buildProposalCreateOp = buildProposalCreateOp;
7722
+ exports.buildProposalVoteOp = buildProposalVoteOp;
7723
+ exports.buildReblogOp = buildReblogOp;
7724
+ exports.buildRecoverAccountOp = buildRecoverAccountOp;
7725
+ exports.buildRecurrentTransferOp = buildRecurrentTransferOp;
7726
+ exports.buildRemoveProposalOp = buildRemoveProposalOp;
7727
+ exports.buildRequestAccountRecoveryOp = buildRequestAccountRecoveryOp;
7728
+ exports.buildRevokePostingPermissionOp = buildRevokePostingPermissionOp;
7729
+ exports.buildSetLastReadOps = buildSetLastReadOps;
7730
+ exports.buildSetRoleOp = buildSetRoleOp;
7731
+ exports.buildSetWithdrawVestingRouteOp = buildSetWithdrawVestingRouteOp;
7732
+ exports.buildSubscribeOp = buildSubscribeOp;
7733
+ exports.buildTransferFromSavingsOp = buildTransferFromSavingsOp;
7734
+ exports.buildTransferOp = buildTransferOp;
7735
+ exports.buildTransferToSavingsOp = buildTransferToSavingsOp;
7736
+ exports.buildTransferToVestingOp = buildTransferToVestingOp;
7737
+ exports.buildUnfollowOp = buildUnfollowOp;
7738
+ exports.buildUnignoreOp = buildUnignoreOp;
7739
+ exports.buildUnsubscribeOp = buildUnsubscribeOp;
7740
+ exports.buildUpdateCommunityOp = buildUpdateCommunityOp;
7741
+ exports.buildUpdateProposalOp = buildUpdateProposalOp;
7742
+ exports.buildVoteOp = buildVoteOp;
7743
+ exports.buildWithdrawVestingOp = buildWithdrawVestingOp;
7744
+ exports.buildWitnessProxyOp = buildWitnessProxyOp;
7745
+ exports.buildWitnessVoteOp = buildWitnessVoteOp;
6094
7746
  exports.checkFavouriteQueryOptions = checkFavouriteQueryOptions;
6095
7747
  exports.checkUsernameWalletsPendingQueryOptions = checkUsernameWalletsPendingQueryOptions;
6096
7748
  exports.decodeObj = decodeObj;
@@ -6101,6 +7753,7 @@ exports.deleteSchedule = deleteSchedule;
6101
7753
  exports.downVotingPower = downVotingPower;
6102
7754
  exports.encodeObj = encodeObj;
6103
7755
  exports.extractAccountProfile = extractAccountProfile;
7756
+ exports.formatError = formatError;
6104
7757
  exports.getAccountFullQueryOptions = getAccountFullQueryOptions;
6105
7758
  exports.getAccountNotificationsInfiniteQueryOptions = getAccountNotificationsInfiniteQueryOptions;
6106
7759
  exports.getAccountPendingRecoveryQueryOptions = getAccountPendingRecoveryQueryOptions;
@@ -6252,6 +7905,9 @@ exports.getWithdrawRoutesQueryOptions = getWithdrawRoutesQueryOptions;
6252
7905
  exports.getWitnessesInfiniteQueryOptions = getWitnessesInfiniteQueryOptions;
6253
7906
  exports.hsTokenRenew = hsTokenRenew;
6254
7907
  exports.isCommunity = isCommunity;
7908
+ exports.isInfoError = isInfoError;
7909
+ exports.isNetworkError = isNetworkError;
7910
+ exports.isResourceCreditsError = isResourceCreditsError;
6255
7911
  exports.isWrappedResponse = isWrappedResponse;
6256
7912
  exports.lookupAccountsQueryOptions = lookupAccountsQueryOptions;
6257
7913
  exports.makeQueryClient = makeQueryClient;
@@ -6264,6 +7920,7 @@ exports.normalizeWaveEntryFromApi = normalizeWaveEntryFromApi;
6264
7920
  exports.onboardEmail = onboardEmail;
6265
7921
  exports.parseAccounts = parseAccounts;
6266
7922
  exports.parseAsset = parseAsset;
7923
+ exports.parseChainError = parseChainError;
6267
7924
  exports.parseProfileMetadata = parseProfileMetadata;
6268
7925
  exports.powerRechargeTime = powerRechargeTime;
6269
7926
  exports.rcPower = rcPower;
@@ -6275,6 +7932,7 @@ exports.searchAccount = searchAccount;
6275
7932
  exports.searchPath = searchPath;
6276
7933
  exports.searchQueryOptions = searchQueryOptions;
6277
7934
  exports.searchTag = searchTag;
7935
+ exports.shouldTriggerAuthFallback = shouldTriggerAuthFallback;
6278
7936
  exports.signUp = signUp;
6279
7937
  exports.sortDiscussions = sortDiscussions;
6280
7938
  exports.subscribeEmail = subscribeEmail;
@@ -6297,6 +7955,7 @@ exports.useAddSchedule = useAddSchedule;
6297
7955
  exports.useBookmarkAdd = useBookmarkAdd;
6298
7956
  exports.useBookmarkDelete = useBookmarkDelete;
6299
7957
  exports.useBroadcastMutation = useBroadcastMutation;
7958
+ exports.useComment = useComment;
6300
7959
  exports.useDeleteDraft = useDeleteDraft;
6301
7960
  exports.useDeleteImage = useDeleteImage;
6302
7961
  exports.useDeleteSchedule = useDeleteSchedule;
@@ -6304,13 +7963,17 @@ exports.useEditFragment = useEditFragment;
6304
7963
  exports.useGameClaim = useGameClaim;
6305
7964
  exports.useMarkNotificationsRead = useMarkNotificationsRead;
6306
7965
  exports.useMoveSchedule = useMoveSchedule;
7966
+ exports.useProposalVote = useProposalVote;
7967
+ exports.useReblog = useReblog;
6307
7968
  exports.useRecordActivity = useRecordActivity;
6308
7969
  exports.useRemoveFragment = useRemoveFragment;
6309
7970
  exports.useSignOperationByHivesigner = useSignOperationByHivesigner;
6310
7971
  exports.useSignOperationByKey = useSignOperationByKey;
6311
7972
  exports.useSignOperationByKeychain = useSignOperationByKeychain;
7973
+ exports.useTransfer = useTransfer;
6312
7974
  exports.useUpdateDraft = useUpdateDraft;
6313
7975
  exports.useUploadImage = useUploadImage;
7976
+ exports.useVote = useVote;
6314
7977
  exports.usrActivity = usrActivity;
6315
7978
  exports.validatePostCreating = validatePostCreating;
6316
7979
  exports.votingPower = votingPower;