@ecency/sdk 1.5.27 → 2.0.0
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 +1920 -60
- package/dist/browser/index.js +1959 -97
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +2040 -96
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +1959 -97
- package/dist/node/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/index.browser.mjs +0 -1663
- package/dist/index.browser.mjs.map +0 -1
- package/dist/index.cjs +0 -1747
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -1106
- package/dist/index.mjs +0 -1659
- package/dist/index.mjs.map +0 -1
package/dist/browser/index.js
CHANGED
|
@@ -8,8 +8,458 @@ var __export = (target, all) => {
|
|
|
8
8
|
for (var name in all)
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
// src/modules/core/errors/chain-errors.ts
|
|
13
|
+
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
14
|
+
ErrorType2["COMMON"] = "common";
|
|
15
|
+
ErrorType2["INFO"] = "info";
|
|
16
|
+
ErrorType2["INSUFFICIENT_RESOURCE_CREDITS"] = "insufficient_resource_credits";
|
|
17
|
+
ErrorType2["MISSING_AUTHORITY"] = "missing_authority";
|
|
18
|
+
ErrorType2["TOKEN_EXPIRED"] = "token_expired";
|
|
19
|
+
ErrorType2["NETWORK"] = "network";
|
|
20
|
+
ErrorType2["TIMEOUT"] = "timeout";
|
|
21
|
+
ErrorType2["VALIDATION"] = "validation";
|
|
22
|
+
return ErrorType2;
|
|
23
|
+
})(ErrorType || {});
|
|
24
|
+
function parseChainError(error) {
|
|
25
|
+
const errorDescription = error?.error_description ? String(error.error_description) : "";
|
|
26
|
+
const errorMessage = error?.message ? String(error.message) : "";
|
|
27
|
+
const errorString = errorDescription || errorMessage || String(error || "");
|
|
28
|
+
const testPattern = (pattern) => {
|
|
29
|
+
if (errorDescription && pattern.test(errorDescription)) return true;
|
|
30
|
+
if (errorMessage && pattern.test(errorMessage)) return true;
|
|
31
|
+
if (errorString && pattern.test(errorString)) return true;
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
if (testPattern(/please wait to transact/i) || testPattern(/insufficient rc/i) || testPattern(/rc mana|rc account|resource credits/i)) {
|
|
35
|
+
return {
|
|
36
|
+
message: "Insufficient Resource Credits. Please wait or power up.",
|
|
37
|
+
type: "insufficient_resource_credits" /* INSUFFICIENT_RESOURCE_CREDITS */,
|
|
38
|
+
originalError: error
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (testPattern(/you may only post once every/i)) {
|
|
42
|
+
return {
|
|
43
|
+
message: "Please wait before posting again (minimum 3 second interval between comments).",
|
|
44
|
+
type: "common" /* COMMON */,
|
|
45
|
+
originalError: error
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (testPattern(/your current vote on this comment is identical/i)) {
|
|
49
|
+
return {
|
|
50
|
+
message: "You have already voted with the same weight.",
|
|
51
|
+
type: "info" /* INFO */,
|
|
52
|
+
originalError: error
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (testPattern(/must claim something/i)) {
|
|
56
|
+
return {
|
|
57
|
+
message: "You must claim rewards before performing this action.",
|
|
58
|
+
type: "info" /* INFO */,
|
|
59
|
+
originalError: error
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (testPattern(/cannot claim that much vests/i)) {
|
|
63
|
+
return {
|
|
64
|
+
message: "Cannot claim that amount. Please check your pending rewards.",
|
|
65
|
+
type: "info" /* INFO */,
|
|
66
|
+
originalError: error
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (testPattern(/cannot delete a comment with net positive/i)) {
|
|
70
|
+
return {
|
|
71
|
+
message: "Cannot delete a comment with positive votes.",
|
|
72
|
+
type: "info" /* INFO */,
|
|
73
|
+
originalError: error
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (testPattern(/children == 0/i)) {
|
|
77
|
+
return {
|
|
78
|
+
message: "Cannot delete a comment with replies.",
|
|
79
|
+
type: "common" /* COMMON */,
|
|
80
|
+
originalError: error
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (testPattern(/comment_cashout/i)) {
|
|
84
|
+
return {
|
|
85
|
+
message: "Cannot modify a comment that has already been paid out.",
|
|
86
|
+
type: "common" /* COMMON */,
|
|
87
|
+
originalError: error
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (testPattern(/votes evaluating for comment that is paid out is forbidden/i)) {
|
|
91
|
+
return {
|
|
92
|
+
message: "Cannot vote on posts that have already been paid out.",
|
|
93
|
+
type: "common" /* COMMON */,
|
|
94
|
+
originalError: error
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (testPattern(/missing active authority/i)) {
|
|
98
|
+
return {
|
|
99
|
+
message: "Missing active authority. This operation requires your active key.",
|
|
100
|
+
type: "missing_authority" /* MISSING_AUTHORITY */,
|
|
101
|
+
originalError: error
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (testPattern(/missing owner authority/i)) {
|
|
105
|
+
return {
|
|
106
|
+
message: "Missing owner authority. This operation requires your owner key.",
|
|
107
|
+
type: "missing_authority" /* MISSING_AUTHORITY */,
|
|
108
|
+
originalError: error
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (testPattern(/missing (required )?posting authority/i)) {
|
|
112
|
+
return {
|
|
113
|
+
message: "Missing posting authority. Please check your login method.",
|
|
114
|
+
type: "missing_authority" /* MISSING_AUTHORITY */,
|
|
115
|
+
originalError: error
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (testPattern(/token expired/i) || testPattern(/invalid token/i)) {
|
|
119
|
+
return {
|
|
120
|
+
message: "Authentication token expired. Please log in again.",
|
|
121
|
+
type: "token_expired" /* TOKEN_EXPIRED */,
|
|
122
|
+
originalError: error
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (testPattern(/has already reblogged/i) || testPattern(/already reblogged this post/i)) {
|
|
126
|
+
return {
|
|
127
|
+
message: "You have already reblogged this post.",
|
|
128
|
+
type: "info" /* INFO */,
|
|
129
|
+
originalError: error
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (testPattern(/duplicate transaction/i)) {
|
|
133
|
+
return {
|
|
134
|
+
message: "This transaction has already been processed.",
|
|
135
|
+
type: "info" /* INFO */,
|
|
136
|
+
originalError: error
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (testPattern(/econnrefused/i) || testPattern(/connection refused/i) || testPattern(/failed to fetch/i) || testPattern(/\bnetwork[-\s]?(request|error|timeout|unreachable|down|failed)\b/i)) {
|
|
140
|
+
return {
|
|
141
|
+
message: "Network error. Please check your connection and try again.",
|
|
142
|
+
type: "network" /* NETWORK */,
|
|
143
|
+
originalError: error
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (testPattern(/timeout/i) || testPattern(/timed out/i)) {
|
|
147
|
+
return {
|
|
148
|
+
message: "Request timed out. Please try again.",
|
|
149
|
+
type: "timeout" /* TIMEOUT */,
|
|
150
|
+
originalError: error
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (testPattern(/account.*does not exist/i) || testPattern(/account not found/i)) {
|
|
154
|
+
return {
|
|
155
|
+
message: "Account not found. Please check the username.",
|
|
156
|
+
type: "validation" /* VALIDATION */,
|
|
157
|
+
originalError: error
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (testPattern(/invalid memo key/i)) {
|
|
161
|
+
return {
|
|
162
|
+
message: "Invalid memo key. Cannot encrypt message.",
|
|
163
|
+
type: "validation" /* VALIDATION */,
|
|
164
|
+
originalError: error
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (testPattern(/(?:insufficient.*(?:funds|balance)|(?:funds|balance).*insufficient)/i)) {
|
|
168
|
+
return {
|
|
169
|
+
message: "Insufficient funds for this transaction.",
|
|
170
|
+
type: "validation" /* VALIDATION */,
|
|
171
|
+
originalError: error
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (testPattern(/\b(invalid|validation)\b/i)) {
|
|
175
|
+
const message2 = (error?.message || errorString).substring(0, 150) || "Validation error occurred";
|
|
176
|
+
return {
|
|
177
|
+
message: message2,
|
|
178
|
+
type: "validation" /* VALIDATION */,
|
|
179
|
+
originalError: error
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (error?.error_description && typeof error.error_description === "string") {
|
|
183
|
+
return {
|
|
184
|
+
message: error.error_description.substring(0, 150),
|
|
185
|
+
type: "common" /* COMMON */,
|
|
186
|
+
originalError: error
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
if (error?.message && typeof error.message === "string") {
|
|
190
|
+
return {
|
|
191
|
+
message: error.message.substring(0, 150),
|
|
192
|
+
type: "common" /* COMMON */,
|
|
193
|
+
originalError: error
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
let message;
|
|
197
|
+
if (typeof error === "object" && error !== null) {
|
|
198
|
+
if (error.error_description) {
|
|
199
|
+
message = String(error.error_description);
|
|
200
|
+
} else if (error.code) {
|
|
201
|
+
message = `Error code: ${error.code}`;
|
|
202
|
+
} else if (errorString && errorString !== "[object Object]") {
|
|
203
|
+
message = errorString.substring(0, 150);
|
|
204
|
+
} else {
|
|
205
|
+
message = "Unknown error occurred";
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
message = errorString.substring(0, 150) || "Unknown error occurred";
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
message,
|
|
212
|
+
type: "common" /* COMMON */,
|
|
213
|
+
originalError: error
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function formatError(error) {
|
|
217
|
+
const parsed = parseChainError(error);
|
|
218
|
+
return [parsed.message, parsed.type];
|
|
219
|
+
}
|
|
220
|
+
function shouldTriggerAuthFallback(error) {
|
|
221
|
+
const { type } = parseChainError(error);
|
|
222
|
+
return type === "missing_authority" /* MISSING_AUTHORITY */ || type === "token_expired" /* TOKEN_EXPIRED */;
|
|
223
|
+
}
|
|
224
|
+
function isResourceCreditsError(error) {
|
|
225
|
+
const { type } = parseChainError(error);
|
|
226
|
+
return type === "insufficient_resource_credits" /* INSUFFICIENT_RESOURCE_CREDITS */;
|
|
227
|
+
}
|
|
228
|
+
function isInfoError(error) {
|
|
229
|
+
const { type } = parseChainError(error);
|
|
230
|
+
return type === "info" /* INFO */;
|
|
231
|
+
}
|
|
232
|
+
function isNetworkError(error) {
|
|
233
|
+
const { type } = parseChainError(error);
|
|
234
|
+
return type === "network" /* NETWORK */ || type === "timeout" /* TIMEOUT */;
|
|
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
|
+
}
|
|
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
|
+
}
|
|
358
|
+
const chain = auth?.fallbackChain ?? ["key", "hiveauth", "hivesigner", "keychain", "custom"];
|
|
359
|
+
const errors = /* @__PURE__ */ new Map();
|
|
360
|
+
for (const method of chain) {
|
|
361
|
+
try {
|
|
362
|
+
let shouldSkip = false;
|
|
363
|
+
let skipReason = "";
|
|
364
|
+
let prefetchedKey;
|
|
365
|
+
let prefetchedToken;
|
|
366
|
+
switch (method) {
|
|
367
|
+
case "key":
|
|
368
|
+
if (!adapter) {
|
|
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
|
+
}
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
case "hiveauth":
|
|
403
|
+
if (!adapter?.broadcastWithHiveAuth) {
|
|
404
|
+
shouldSkip = true;
|
|
405
|
+
skipReason = "HiveAuth not supported by adapter";
|
|
406
|
+
}
|
|
407
|
+
break;
|
|
408
|
+
case "hivesigner":
|
|
409
|
+
if (!adapter) {
|
|
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
|
+
}
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
case "keychain":
|
|
423
|
+
if (!adapter?.broadcastWithKeychain) {
|
|
424
|
+
shouldSkip = true;
|
|
425
|
+
skipReason = "Keychain not supported by adapter";
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
case "custom":
|
|
429
|
+
if (!auth?.broadcast) {
|
|
430
|
+
shouldSkip = true;
|
|
431
|
+
skipReason = "No custom broadcast function provided";
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
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);
|
|
440
|
+
} catch (error) {
|
|
441
|
+
errors.set(method, error);
|
|
442
|
+
if (!shouldTriggerAuthFallback(error)) {
|
|
443
|
+
throw error;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const hasRealAttempts = Array.from(errors.values()).some(
|
|
448
|
+
(error) => !error.message.startsWith("Skipped:")
|
|
449
|
+
);
|
|
450
|
+
if (!hasRealAttempts) {
|
|
451
|
+
const skipReasons = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
|
|
452
|
+
throw new Error(
|
|
453
|
+
`[SDK][Broadcast] No auth methods attempted for ${username}. ${skipReasons}`
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
const errorMessages = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
|
|
457
|
+
throw new Error(
|
|
458
|
+
`[SDK][Broadcast] All auth methods failed for ${username}. Errors: ${errorMessages}`
|
|
459
|
+
);
|
|
460
|
+
}
|
|
11
461
|
function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
|
|
12
|
-
}, auth) {
|
|
462
|
+
}, auth, authority = "posting") {
|
|
13
463
|
return useMutation({
|
|
14
464
|
onSuccess,
|
|
15
465
|
mutationKey: [...mutationKey, username],
|
|
@@ -19,20 +469,28 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
19
469
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
20
470
|
);
|
|
21
471
|
}
|
|
472
|
+
const ops2 = operations(payload);
|
|
473
|
+
if (auth?.enableFallback !== false && auth?.adapter) {
|
|
474
|
+
return broadcastWithFallback(username, ops2, auth, authority);
|
|
475
|
+
}
|
|
22
476
|
if (auth?.broadcast) {
|
|
23
|
-
return auth.broadcast(
|
|
477
|
+
return auth.broadcast(ops2, authority);
|
|
24
478
|
}
|
|
25
479
|
const postingKey = auth?.postingKey;
|
|
26
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
|
+
}
|
|
27
486
|
const privateKey = PrivateKey.fromString(postingKey);
|
|
28
487
|
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
29
|
-
|
|
488
|
+
ops2,
|
|
30
489
|
privateKey
|
|
31
490
|
);
|
|
32
491
|
}
|
|
33
492
|
const accessToken = auth?.accessToken;
|
|
34
493
|
if (accessToken) {
|
|
35
|
-
const ops2 = operations(payload);
|
|
36
494
|
const client = new hs.Client({ accessToken });
|
|
37
495
|
const response = await client.broadcast(ops2);
|
|
38
496
|
return response.result;
|
|
@@ -2795,100 +3253,1151 @@ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError)
|
|
|
2795
3253
|
}
|
|
2796
3254
|
});
|
|
2797
3255
|
}
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
code
|
|
2817
|
-
})
|
|
2818
|
-
}
|
|
2819
|
-
);
|
|
2820
|
-
return response.json();
|
|
2821
|
-
},
|
|
2822
|
-
onSuccess: () => {
|
|
2823
|
-
onSuccess();
|
|
2824
|
-
getQueryClient().invalidateQueries({
|
|
2825
|
-
queryKey: ["accounts", "bookmarks", username]
|
|
2826
|
-
});
|
|
2827
|
-
},
|
|
2828
|
-
onError
|
|
2829
|
-
});
|
|
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
|
+
];
|
|
2830
3274
|
}
|
|
2831
|
-
function
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
id: bookmarkId,
|
|
2848
|
-
code
|
|
2849
|
-
})
|
|
2850
|
-
}
|
|
2851
|
-
);
|
|
2852
|
-
return response.json();
|
|
2853
|
-
},
|
|
2854
|
-
onSuccess: () => {
|
|
2855
|
-
onSuccess();
|
|
2856
|
-
getQueryClient().invalidateQueries({
|
|
2857
|
-
queryKey: ["accounts", "bookmarks", username]
|
|
2858
|
-
});
|
|
2859
|
-
},
|
|
2860
|
-
onError
|
|
2861
|
-
});
|
|
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
|
+
];
|
|
2862
3291
|
}
|
|
2863
|
-
function
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
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
|
+
];
|
|
3308
|
+
}
|
|
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
|
|
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
|
+
];
|
|
3342
|
+
}
|
|
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)
|
|
3366
|
+
);
|
|
3367
|
+
}
|
|
3368
|
+
function buildRecurrentTransferOp(from, to, amount, memo, recurrence, executions) {
|
|
3369
|
+
if (!from || !to || !amount) {
|
|
3370
|
+
throw new Error("[SDK][buildRecurrentTransferOp] Missing required parameters");
|
|
3371
|
+
}
|
|
3372
|
+
if (recurrence < 24) {
|
|
3373
|
+
throw new Error("[SDK][buildRecurrentTransferOp] Recurrence must be at least 24 hours");
|
|
3374
|
+
}
|
|
3375
|
+
return [
|
|
3376
|
+
"recurrent_transfer",
|
|
3377
|
+
{
|
|
3378
|
+
from,
|
|
3379
|
+
to,
|
|
3380
|
+
amount,
|
|
3381
|
+
memo: memo || "",
|
|
3382
|
+
recurrence,
|
|
3383
|
+
executions,
|
|
3384
|
+
extensions: []
|
|
3385
|
+
}
|
|
3386
|
+
];
|
|
3387
|
+
}
|
|
3388
|
+
function buildTransferToSavingsOp(from, to, amount, memo) {
|
|
3389
|
+
if (!from || !to || !amount) {
|
|
3390
|
+
throw new Error("[SDK][buildTransferToSavingsOp] Missing required parameters");
|
|
3391
|
+
}
|
|
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");
|
|
3405
|
+
}
|
|
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");
|
|
3420
|
+
}
|
|
3421
|
+
return [
|
|
3422
|
+
"cancel_transfer_from_savings",
|
|
3423
|
+
{
|
|
3424
|
+
from,
|
|
3425
|
+
request_id: requestId
|
|
3426
|
+
}
|
|
3427
|
+
];
|
|
3428
|
+
}
|
|
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
|
+
];
|
|
3437
|
+
}
|
|
3438
|
+
function buildTransferToVestingOp(from, to, amount) {
|
|
3439
|
+
if (!from || !to || !amount) {
|
|
3440
|
+
throw new Error("[SDK][buildTransferToVestingOp] Missing required parameters");
|
|
3441
|
+
}
|
|
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");
|
|
3454
|
+
}
|
|
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");
|
|
3466
|
+
}
|
|
3467
|
+
return [
|
|
3468
|
+
"delegate_vesting_shares",
|
|
3469
|
+
{
|
|
3470
|
+
delegator,
|
|
3471
|
+
delegatee,
|
|
3472
|
+
vesting_shares: vestingShares
|
|
3473
|
+
}
|
|
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");
|
|
3479
|
+
}
|
|
3480
|
+
if (percent < 0 || percent > 1e4) {
|
|
3481
|
+
throw new Error("[SDK][buildSetWithdrawVestingRouteOp] Percent must be between 0 and 10000");
|
|
3482
|
+
}
|
|
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");
|
|
3496
|
+
}
|
|
3497
|
+
return [
|
|
3498
|
+
"convert",
|
|
3499
|
+
{
|
|
3500
|
+
owner,
|
|
3501
|
+
amount,
|
|
3502
|
+
requestid: requestId
|
|
3503
|
+
}
|
|
3504
|
+
];
|
|
3505
|
+
}
|
|
3506
|
+
function buildCollateralizedConvertOp(owner, amount, requestId) {
|
|
3507
|
+
if (!owner || !amount || requestId === void 0) {
|
|
3508
|
+
throw new Error("[SDK][buildCollateralizedConvertOp] Missing required parameters");
|
|
3509
|
+
}
|
|
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");
|
|
3522
|
+
}
|
|
3523
|
+
const delegateeArray = delegatees.includes(",") ? delegatees.split(",").map((d) => d.trim()) : [delegatees];
|
|
3524
|
+
return [
|
|
3525
|
+
"custom_json",
|
|
3526
|
+
{
|
|
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]
|
|
3538
|
+
}
|
|
3539
|
+
];
|
|
3540
|
+
}
|
|
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");
|
|
3546
|
+
}
|
|
3547
|
+
return [
|
|
3548
|
+
"custom_json",
|
|
3549
|
+
{
|
|
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]
|
|
3561
|
+
}
|
|
3562
|
+
];
|
|
3563
|
+
}
|
|
3564
|
+
function buildUnfollowOp(follower, following) {
|
|
3565
|
+
if (!follower || !following) {
|
|
3566
|
+
throw new Error("[SDK][buildUnfollowOp] Missing required parameters");
|
|
3567
|
+
}
|
|
3568
|
+
return [
|
|
3569
|
+
"custom_json",
|
|
3570
|
+
{
|
|
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]
|
|
3582
|
+
}
|
|
3583
|
+
];
|
|
3584
|
+
}
|
|
3585
|
+
function buildIgnoreOp(follower, following) {
|
|
3586
|
+
if (!follower || !following) {
|
|
3587
|
+
throw new Error("[SDK][buildIgnoreOp] Missing required parameters");
|
|
3588
|
+
}
|
|
3589
|
+
return [
|
|
3590
|
+
"custom_json",
|
|
3591
|
+
{
|
|
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]
|
|
3603
|
+
}
|
|
3604
|
+
];
|
|
3605
|
+
}
|
|
3606
|
+
function buildUnignoreOp(follower, following) {
|
|
3607
|
+
if (!follower || !following) {
|
|
3608
|
+
throw new Error("[SDK][buildUnignoreOp] Missing required parameters");
|
|
3609
|
+
}
|
|
3610
|
+
return buildUnfollowOp(follower, following);
|
|
3611
|
+
}
|
|
3612
|
+
function buildSetLastReadOps(username, date) {
|
|
3613
|
+
if (!username) {
|
|
3614
|
+
throw new Error("[SDK][buildSetLastReadOps] Missing required parameters");
|
|
3615
|
+
}
|
|
3616
|
+
const lastReadDate = date || (/* @__PURE__ */ new Date()).toISOString().split(".")[0];
|
|
3617
|
+
const notifyOp = [
|
|
3618
|
+
"custom_json",
|
|
3619
|
+
{
|
|
3620
|
+
id: "notify",
|
|
3621
|
+
json: JSON.stringify(["setLastRead", { date: lastReadDate }]),
|
|
3622
|
+
required_auths: [],
|
|
3623
|
+
required_posting_auths: [username]
|
|
3624
|
+
}
|
|
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];
|
|
3636
|
+
}
|
|
3637
|
+
|
|
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");
|
|
3642
|
+
}
|
|
3643
|
+
return [
|
|
3644
|
+
"account_witness_vote",
|
|
3645
|
+
{
|
|
3646
|
+
account,
|
|
3647
|
+
witness,
|
|
3648
|
+
approve
|
|
3649
|
+
}
|
|
3650
|
+
];
|
|
3651
|
+
}
|
|
3652
|
+
function buildWitnessProxyOp(account, proxy) {
|
|
3653
|
+
if (!account || proxy === void 0) {
|
|
3654
|
+
throw new Error("[SDK][buildWitnessProxyOp] Missing required parameters");
|
|
3655
|
+
}
|
|
3656
|
+
return [
|
|
3657
|
+
"account_witness_proxy",
|
|
3658
|
+
{
|
|
3659
|
+
account,
|
|
3660
|
+
proxy
|
|
3661
|
+
}
|
|
3662
|
+
];
|
|
3663
|
+
}
|
|
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");
|
|
3667
|
+
}
|
|
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
|
+
);
|
|
3674
|
+
}
|
|
3675
|
+
return [
|
|
3676
|
+
"create_proposal",
|
|
3677
|
+
{
|
|
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,
|
|
3685
|
+
extensions: []
|
|
3686
|
+
}
|
|
3687
|
+
];
|
|
3688
|
+
}
|
|
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");
|
|
3692
|
+
}
|
|
3693
|
+
return [
|
|
3694
|
+
"update_proposal_votes",
|
|
3695
|
+
{
|
|
3696
|
+
voter,
|
|
3697
|
+
proposal_ids: proposalIds,
|
|
3698
|
+
approve,
|
|
3699
|
+
extensions: []
|
|
3700
|
+
}
|
|
3701
|
+
];
|
|
3702
|
+
}
|
|
3703
|
+
function buildRemoveProposalOp(proposalOwner, proposalIds) {
|
|
3704
|
+
if (!proposalOwner || !proposalIds || proposalIds.length === 0) {
|
|
3705
|
+
throw new Error("[SDK][buildRemoveProposalOp] Missing required parameters");
|
|
3706
|
+
}
|
|
3707
|
+
return [
|
|
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",
|
|
3740
|
+
{
|
|
3741
|
+
id: "community",
|
|
3742
|
+
json: JSON.stringify(["subscribe", { community }]),
|
|
3743
|
+
required_auths: [],
|
|
3744
|
+
required_posting_auths: [username]
|
|
3745
|
+
}
|
|
3746
|
+
];
|
|
3747
|
+
}
|
|
3748
|
+
function buildUnsubscribeOp(username, community) {
|
|
3749
|
+
if (!username || !community) {
|
|
3750
|
+
throw new Error("[SDK][buildUnsubscribeOp] Missing required parameters");
|
|
3751
|
+
}
|
|
3752
|
+
return [
|
|
3753
|
+
"custom_json",
|
|
3754
|
+
{
|
|
3755
|
+
id: "community",
|
|
3756
|
+
json: JSON.stringify(["unsubscribe", { community }]),
|
|
3757
|
+
required_auths: [],
|
|
3758
|
+
required_posting_auths: [username]
|
|
3759
|
+
}
|
|
3760
|
+
];
|
|
3761
|
+
}
|
|
3762
|
+
function buildSetRoleOp(username, community, account, role) {
|
|
3763
|
+
if (!username || !community || !account || !role) {
|
|
3764
|
+
throw new Error("[SDK][buildSetRoleOp] Missing required parameters");
|
|
3765
|
+
}
|
|
3766
|
+
return [
|
|
3767
|
+
"custom_json",
|
|
3768
|
+
{
|
|
3769
|
+
id: "community",
|
|
3770
|
+
json: JSON.stringify(["setRole", { community, account, role }]),
|
|
3771
|
+
required_auths: [],
|
|
3772
|
+
required_posting_auths: [username]
|
|
3773
|
+
}
|
|
3774
|
+
];
|
|
3775
|
+
}
|
|
3776
|
+
function buildUpdateCommunityOp(username, community, props) {
|
|
3777
|
+
if (!username || !community || !props) {
|
|
3778
|
+
throw new Error("[SDK][buildUpdateCommunityOp] Missing required parameters");
|
|
3779
|
+
}
|
|
3780
|
+
return [
|
|
3781
|
+
"custom_json",
|
|
3782
|
+
{
|
|
3783
|
+
id: "community",
|
|
3784
|
+
json: JSON.stringify(["updateProps", { community, props }]),
|
|
3785
|
+
required_auths: [],
|
|
3786
|
+
required_posting_auths: [username]
|
|
3787
|
+
}
|
|
3788
|
+
];
|
|
3789
|
+
}
|
|
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");
|
|
3793
|
+
}
|
|
3794
|
+
const action = pin ? "pinPost" : "unpinPost";
|
|
3795
|
+
return [
|
|
3796
|
+
"custom_json",
|
|
3797
|
+
{
|
|
3798
|
+
id: "community",
|
|
3799
|
+
json: JSON.stringify([action, { community, account, permlink }]),
|
|
3800
|
+
required_auths: [],
|
|
3801
|
+
required_posting_auths: [username]
|
|
3802
|
+
}
|
|
3803
|
+
];
|
|
3804
|
+
}
|
|
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");
|
|
3808
|
+
}
|
|
3809
|
+
const action = mute ? "mutePost" : "unmutePost";
|
|
3810
|
+
return [
|
|
3811
|
+
"custom_json",
|
|
3812
|
+
{
|
|
3813
|
+
id: "community",
|
|
3814
|
+
json: JSON.stringify([action, { community, account, permlink, notes }]),
|
|
3815
|
+
required_auths: [],
|
|
3816
|
+
required_posting_auths: [username]
|
|
3817
|
+
}
|
|
3818
|
+
];
|
|
3819
|
+
}
|
|
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");
|
|
3823
|
+
}
|
|
3824
|
+
const action = mute ? "muteUser" : "unmuteUser";
|
|
3825
|
+
return [
|
|
3826
|
+
"custom_json",
|
|
3827
|
+
{
|
|
3828
|
+
id: "community",
|
|
3829
|
+
json: JSON.stringify([action, { community, account, notes }]),
|
|
3830
|
+
required_auths: [],
|
|
3831
|
+
required_posting_auths: [username]
|
|
3832
|
+
}
|
|
3833
|
+
];
|
|
3834
|
+
}
|
|
3835
|
+
function buildFlagPostOp(username, community, account, permlink, notes) {
|
|
3836
|
+
if (!username || !community || !account || !permlink) {
|
|
3837
|
+
throw new Error("[SDK][buildFlagPostOp] Missing required parameters");
|
|
3838
|
+
}
|
|
3839
|
+
return [
|
|
3840
|
+
"custom_json",
|
|
3841
|
+
{
|
|
3842
|
+
id: "community",
|
|
3843
|
+
json: JSON.stringify(["flagPost", { community, account, permlink, notes }]),
|
|
3844
|
+
required_auths: [],
|
|
3845
|
+
required_posting_auths: [username]
|
|
3846
|
+
}
|
|
3847
|
+
];
|
|
3848
|
+
}
|
|
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");
|
|
3864
|
+
}
|
|
3865
|
+
return [
|
|
3866
|
+
"limit_order_create",
|
|
3867
|
+
{
|
|
3868
|
+
owner,
|
|
3869
|
+
orderid: orderId,
|
|
3870
|
+
amount_to_sell: amountToSell,
|
|
3871
|
+
min_to_receive: minToReceive,
|
|
3872
|
+
fill_or_kill: fillOrKill,
|
|
3873
|
+
expiration
|
|
3874
|
+
}
|
|
3875
|
+
];
|
|
3876
|
+
}
|
|
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");
|
|
3883
|
+
}
|
|
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
|
+
);
|
|
3900
|
+
}
|
|
3901
|
+
function buildLimitOrderCancelOp(owner, orderId) {
|
|
3902
|
+
if (!owner || orderId === void 0) {
|
|
3903
|
+
throw new Error("[SDK][buildLimitOrderCancelOp] Missing required parameters");
|
|
3904
|
+
}
|
|
3905
|
+
return [
|
|
3906
|
+
"limit_order_cancel",
|
|
3907
|
+
{
|
|
3908
|
+
owner,
|
|
3909
|
+
orderid: orderId
|
|
3910
|
+
}
|
|
3911
|
+
];
|
|
3912
|
+
}
|
|
3913
|
+
function buildClaimRewardBalanceOp(account, rewardHive, rewardHbd, rewardVests) {
|
|
3914
|
+
if (!account || !rewardHive || !rewardHbd || !rewardVests) {
|
|
3915
|
+
throw new Error("[SDK][buildClaimRewardBalanceOp] Missing required parameters");
|
|
3916
|
+
}
|
|
3917
|
+
return [
|
|
3918
|
+
"claim_reward_balance",
|
|
3919
|
+
{
|
|
3920
|
+
account,
|
|
3921
|
+
reward_hive: rewardHive,
|
|
3922
|
+
reward_hbd: rewardHbd,
|
|
3923
|
+
reward_vests: rewardVests
|
|
3924
|
+
}
|
|
3925
|
+
];
|
|
3926
|
+
}
|
|
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");
|
|
3932
|
+
}
|
|
3933
|
+
return [
|
|
3934
|
+
"account_update",
|
|
3935
|
+
{
|
|
3936
|
+
account,
|
|
3937
|
+
owner,
|
|
3938
|
+
active,
|
|
3939
|
+
posting,
|
|
3940
|
+
memo_key: memoKey,
|
|
3941
|
+
json_metadata: jsonMetadata
|
|
3942
|
+
}
|
|
3943
|
+
];
|
|
3944
|
+
}
|
|
3945
|
+
function buildAccountUpdate2Op(account, jsonMetadata, postingJsonMetadata, extensions) {
|
|
3946
|
+
if (!account || postingJsonMetadata === void 0) {
|
|
3947
|
+
throw new Error("[SDK][buildAccountUpdate2Op] Missing required parameters");
|
|
3948
|
+
}
|
|
3949
|
+
return [
|
|
3950
|
+
"account_update2",
|
|
3951
|
+
{
|
|
3952
|
+
account,
|
|
3953
|
+
json_metadata: jsonMetadata || "",
|
|
3954
|
+
posting_json_metadata: postingJsonMetadata,
|
|
3955
|
+
extensions: extensions || []
|
|
3956
|
+
}
|
|
3957
|
+
];
|
|
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",
|
|
3980
|
+
{
|
|
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
|
|
3990
|
+
}
|
|
3991
|
+
];
|
|
3992
|
+
}
|
|
3993
|
+
function buildCreateClaimedAccountOp(creator, newAccountName, keys) {
|
|
3994
|
+
if (!creator || !newAccountName || !keys) {
|
|
3995
|
+
throw new Error("[SDK][buildCreateClaimedAccountOp] Missing required parameters");
|
|
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
|
+
};
|
|
4012
|
+
return [
|
|
4013
|
+
"create_claimed_account",
|
|
4014
|
+
{
|
|
4015
|
+
creator,
|
|
4016
|
+
new_account_name: newAccountName,
|
|
4017
|
+
owner,
|
|
4018
|
+
active,
|
|
4019
|
+
posting,
|
|
4020
|
+
memo_key: keys.memoPublicKey,
|
|
4021
|
+
json_metadata: "",
|
|
4022
|
+
extensions: []
|
|
4023
|
+
}
|
|
4024
|
+
];
|
|
4025
|
+
}
|
|
4026
|
+
function buildClaimAccountOp(creator, fee) {
|
|
4027
|
+
if (!creator || !fee) {
|
|
4028
|
+
throw new Error("[SDK][buildClaimAccountOp] Missing required parameters");
|
|
4029
|
+
}
|
|
4030
|
+
return [
|
|
4031
|
+
"claim_account",
|
|
4032
|
+
{
|
|
4033
|
+
creator,
|
|
4034
|
+
fee,
|
|
4035
|
+
extensions: []
|
|
4036
|
+
}
|
|
4037
|
+
];
|
|
4038
|
+
}
|
|
4039
|
+
function buildGrantPostingPermissionOp(account, currentPosting, grantedAccount, weightThreshold, memoKey, jsonMetadata) {
|
|
4040
|
+
if (!account || !currentPosting || !grantedAccount || !memoKey) {
|
|
4041
|
+
throw new Error("[SDK][buildGrantPostingPermissionOp] Missing required parameters");
|
|
4042
|
+
}
|
|
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]);
|
|
4051
|
+
}
|
|
4052
|
+
const newPosting = {
|
|
4053
|
+
...currentPosting,
|
|
4054
|
+
account_auths: newAccountAuths
|
|
4055
|
+
};
|
|
4056
|
+
newPosting.account_auths.sort((a, b) => a[0] > b[0] ? 1 : -1);
|
|
4057
|
+
return [
|
|
4058
|
+
"account_update",
|
|
4059
|
+
{
|
|
4060
|
+
account,
|
|
4061
|
+
posting: newPosting,
|
|
4062
|
+
memo_key: memoKey,
|
|
4063
|
+
json_metadata: jsonMetadata
|
|
4064
|
+
}
|
|
4065
|
+
];
|
|
4066
|
+
}
|
|
4067
|
+
function buildRevokePostingPermissionOp(account, currentPosting, revokedAccount, memoKey, jsonMetadata) {
|
|
4068
|
+
if (!account || !currentPosting || !revokedAccount || !memoKey) {
|
|
4069
|
+
throw new Error("[SDK][buildRevokePostingPermissionOp] Missing required parameters");
|
|
4070
|
+
}
|
|
4071
|
+
const newPosting = {
|
|
4072
|
+
...currentPosting,
|
|
4073
|
+
account_auths: currentPosting.account_auths.filter(
|
|
4074
|
+
([acc]) => acc !== revokedAccount
|
|
4075
|
+
)
|
|
4076
|
+
};
|
|
4077
|
+
return [
|
|
4078
|
+
"account_update",
|
|
4079
|
+
{
|
|
4080
|
+
account,
|
|
4081
|
+
posting: newPosting,
|
|
4082
|
+
memo_key: memoKey,
|
|
4083
|
+
json_metadata: jsonMetadata
|
|
4084
|
+
}
|
|
4085
|
+
];
|
|
4086
|
+
}
|
|
4087
|
+
function buildChangeRecoveryAccountOp(accountToRecover, newRecoveryAccount, extensions = []) {
|
|
4088
|
+
if (!accountToRecover || !newRecoveryAccount) {
|
|
4089
|
+
throw new Error("[SDK][buildChangeRecoveryAccountOp] Missing required parameters");
|
|
4090
|
+
}
|
|
4091
|
+
return [
|
|
4092
|
+
"change_recovery_account",
|
|
4093
|
+
{
|
|
4094
|
+
account_to_recover: accountToRecover,
|
|
4095
|
+
new_recovery_account: newRecoveryAccount,
|
|
4096
|
+
extensions
|
|
4097
|
+
}
|
|
4098
|
+
];
|
|
4099
|
+
}
|
|
4100
|
+
function buildRequestAccountRecoveryOp(recoveryAccount, accountToRecover, newOwnerAuthority, extensions = []) {
|
|
4101
|
+
if (!recoveryAccount || !accountToRecover || !newOwnerAuthority) {
|
|
4102
|
+
throw new Error("[SDK][buildRequestAccountRecoveryOp] Missing required parameters");
|
|
4103
|
+
}
|
|
4104
|
+
return [
|
|
4105
|
+
"request_account_recovery",
|
|
4106
|
+
{
|
|
4107
|
+
recovery_account: recoveryAccount,
|
|
4108
|
+
account_to_recover: accountToRecover,
|
|
4109
|
+
new_owner_authority: newOwnerAuthority,
|
|
4110
|
+
extensions
|
|
4111
|
+
}
|
|
4112
|
+
];
|
|
4113
|
+
}
|
|
4114
|
+
function buildRecoverAccountOp(accountToRecover, newOwnerAuthority, recentOwnerAuthority, extensions = []) {
|
|
4115
|
+
if (!accountToRecover || !newOwnerAuthority || !recentOwnerAuthority) {
|
|
4116
|
+
throw new Error("[SDK][buildRecoverAccountOp] Missing required parameters");
|
|
4117
|
+
}
|
|
4118
|
+
return [
|
|
4119
|
+
"recover_account",
|
|
4120
|
+
{
|
|
4121
|
+
account_to_recover: accountToRecover,
|
|
4122
|
+
new_owner_authority: newOwnerAuthority,
|
|
4123
|
+
recent_owner_authority: recentOwnerAuthority,
|
|
4124
|
+
extensions
|
|
4125
|
+
}
|
|
4126
|
+
];
|
|
4127
|
+
}
|
|
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");
|
|
4133
|
+
}
|
|
4134
|
+
return [
|
|
4135
|
+
"custom_json",
|
|
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: []
|
|
4146
|
+
}
|
|
4147
|
+
];
|
|
4148
|
+
}
|
|
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");
|
|
4158
|
+
}
|
|
4159
|
+
return [
|
|
4160
|
+
"custom_json",
|
|
4161
|
+
{
|
|
4162
|
+
id: "ecency_boost_plus",
|
|
4163
|
+
json: JSON.stringify({
|
|
4164
|
+
user,
|
|
4165
|
+
account,
|
|
4166
|
+
duration
|
|
4167
|
+
}),
|
|
4168
|
+
required_auths: [user],
|
|
4169
|
+
required_posting_auths: []
|
|
4170
|
+
}
|
|
4171
|
+
];
|
|
4172
|
+
}
|
|
4173
|
+
function buildPromoteOp(user, author, permlink, duration) {
|
|
4174
|
+
if (!user || !author || !permlink || !Number.isFinite(duration)) {
|
|
4175
|
+
throw new Error("[SDK][buildPromoteOp] Missing required parameters");
|
|
4176
|
+
}
|
|
4177
|
+
return [
|
|
4178
|
+
"custom_json",
|
|
4179
|
+
{
|
|
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: []
|
|
4189
|
+
}
|
|
4190
|
+
];
|
|
4191
|
+
}
|
|
4192
|
+
function buildPointTransferOp(sender, receiver, amount, memo) {
|
|
4193
|
+
if (!sender || !receiver || !amount) {
|
|
4194
|
+
throw new Error("[SDK][buildPointTransferOp] Missing required parameters");
|
|
4195
|
+
}
|
|
4196
|
+
return [
|
|
4197
|
+
"custom_json",
|
|
4198
|
+
{
|
|
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: []
|
|
4208
|
+
}
|
|
4209
|
+
];
|
|
4210
|
+
}
|
|
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");
|
|
4226
|
+
}
|
|
4227
|
+
return [
|
|
4228
|
+
"custom_json",
|
|
4229
|
+
{
|
|
4230
|
+
id: "ecency_registration",
|
|
4231
|
+
json: JSON.stringify({
|
|
4232
|
+
name
|
|
4233
|
+
}),
|
|
4234
|
+
required_auths: [name],
|
|
4235
|
+
required_posting_auths: []
|
|
4236
|
+
}
|
|
4237
|
+
];
|
|
4238
|
+
}
|
|
4239
|
+
function buildActiveCustomJsonOp(username, operationId, json) {
|
|
4240
|
+
if (!username || !operationId || !json) {
|
|
4241
|
+
throw new Error("[SDK][buildActiveCustomJsonOp] Missing required parameters");
|
|
4242
|
+
}
|
|
4243
|
+
return [
|
|
4244
|
+
"custom_json",
|
|
4245
|
+
{
|
|
4246
|
+
id: operationId,
|
|
4247
|
+
json: JSON.stringify(json),
|
|
4248
|
+
required_auths: [username],
|
|
4249
|
+
required_posting_auths: []
|
|
4250
|
+
}
|
|
4251
|
+
];
|
|
4252
|
+
}
|
|
4253
|
+
function buildPostingCustomJsonOp(username, operationId, json) {
|
|
4254
|
+
if (!username || !operationId || !json) {
|
|
4255
|
+
throw new Error("[SDK][buildPostingCustomJsonOp] Missing required parameters");
|
|
4256
|
+
}
|
|
4257
|
+
return [
|
|
4258
|
+
"custom_json",
|
|
4259
|
+
{
|
|
4260
|
+
id: operationId,
|
|
4261
|
+
json: JSON.stringify(json),
|
|
4262
|
+
required_auths: [],
|
|
4263
|
+
required_posting_auths: [username]
|
|
4264
|
+
}
|
|
4265
|
+
];
|
|
4266
|
+
}
|
|
4267
|
+
|
|
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
|
+
);
|
|
4286
|
+
}
|
|
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
|
+
},
|
|
2892
4401
|
onError
|
|
2893
4402
|
});
|
|
2894
4403
|
}
|
|
@@ -3321,6 +4830,94 @@ function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
|
|
|
3321
4830
|
}
|
|
3322
4831
|
return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
|
|
3323
4832
|
}
|
|
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");
|
|
4881
|
+
}
|
|
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";
|
|
4890
|
+
}
|
|
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");
|
|
4895
|
+
}
|
|
4896
|
+
return "active";
|
|
4897
|
+
}
|
|
4898
|
+
function getOperationAuthority(op) {
|
|
4899
|
+
const opType = op[0];
|
|
4900
|
+
if (opType === "custom_json") {
|
|
4901
|
+
return getCustomJsonAuthority(op);
|
|
4902
|
+
}
|
|
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";
|
|
4914
|
+
}
|
|
4915
|
+
if (authority === "active" && highestAuthority === "posting") {
|
|
4916
|
+
highestAuthority = "active";
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
return highestAuthority;
|
|
4920
|
+
}
|
|
3324
4921
|
function useSignOperationByKey(username) {
|
|
3325
4922
|
return useMutation({
|
|
3326
4923
|
mutationKey: ["operations", "sign", username],
|
|
@@ -3998,6 +5595,138 @@ function useUploadImage(onSuccess, onError) {
|
|
|
3998
5595
|
});
|
|
3999
5596
|
}
|
|
4000
5597
|
|
|
5598
|
+
// src/modules/posts/mutations/use-vote.ts
|
|
5599
|
+
function useVote(username, auth) {
|
|
5600
|
+
return useBroadcastMutation(
|
|
5601
|
+
["posts", "vote"],
|
|
5602
|
+
username,
|
|
5603
|
+
({ author, permlink, weight }) => [
|
|
5604
|
+
buildVoteOp(username, author, permlink, weight)
|
|
5605
|
+
],
|
|
5606
|
+
async (result, variables) => {
|
|
5607
|
+
if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
|
|
5608
|
+
await auth.adapter.recordActivity(120, result.block_num, result.id);
|
|
5609
|
+
}
|
|
5610
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
5611
|
+
await auth.adapter.invalidateQueries([
|
|
5612
|
+
["posts", "entry", `/@${variables.author}/${variables.permlink}`],
|
|
5613
|
+
["account", username, "votingPower"]
|
|
5614
|
+
]);
|
|
5615
|
+
}
|
|
5616
|
+
},
|
|
5617
|
+
auth
|
|
5618
|
+
);
|
|
5619
|
+
}
|
|
5620
|
+
|
|
5621
|
+
// src/modules/posts/mutations/use-reblog.ts
|
|
5622
|
+
function useReblog(username, auth) {
|
|
5623
|
+
return useBroadcastMutation(
|
|
5624
|
+
["posts", "reblog"],
|
|
5625
|
+
username,
|
|
5626
|
+
({ author, permlink, deleteReblog }) => [
|
|
5627
|
+
buildReblogOp(username, author, permlink, deleteReblog ?? false)
|
|
5628
|
+
],
|
|
5629
|
+
async (result, variables) => {
|
|
5630
|
+
if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
|
|
5631
|
+
await auth.adapter.recordActivity(130, result.block_num, result.id);
|
|
5632
|
+
}
|
|
5633
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
5634
|
+
await auth.adapter.invalidateQueries([
|
|
5635
|
+
["posts", "blog", username],
|
|
5636
|
+
["posts", "entry", `/@${variables.author}/${variables.permlink}`]
|
|
5637
|
+
]);
|
|
5638
|
+
}
|
|
5639
|
+
},
|
|
5640
|
+
auth
|
|
5641
|
+
);
|
|
5642
|
+
}
|
|
5643
|
+
|
|
5644
|
+
// src/modules/posts/mutations/use-comment.ts
|
|
5645
|
+
function useComment(username, auth) {
|
|
5646
|
+
return useBroadcastMutation(
|
|
5647
|
+
["posts", "comment"],
|
|
5648
|
+
username,
|
|
5649
|
+
(payload) => {
|
|
5650
|
+
const operations = [];
|
|
5651
|
+
operations.push(
|
|
5652
|
+
buildCommentOp(
|
|
5653
|
+
payload.author,
|
|
5654
|
+
payload.permlink,
|
|
5655
|
+
payload.parentAuthor,
|
|
5656
|
+
payload.parentPermlink,
|
|
5657
|
+
payload.title,
|
|
5658
|
+
payload.body,
|
|
5659
|
+
payload.jsonMetadata
|
|
5660
|
+
)
|
|
5661
|
+
);
|
|
5662
|
+
if (payload.options) {
|
|
5663
|
+
const {
|
|
5664
|
+
maxAcceptedPayout = "1000000.000 HBD",
|
|
5665
|
+
percentHbd = 1e4,
|
|
5666
|
+
allowVotes = true,
|
|
5667
|
+
allowCurationRewards = true,
|
|
5668
|
+
beneficiaries = []
|
|
5669
|
+
} = payload.options;
|
|
5670
|
+
const extensions = [];
|
|
5671
|
+
if (beneficiaries.length > 0) {
|
|
5672
|
+
const sortedBeneficiaries = [...beneficiaries].sort(
|
|
5673
|
+
(a, b) => a.account.localeCompare(b.account)
|
|
5674
|
+
);
|
|
5675
|
+
extensions.push([
|
|
5676
|
+
0,
|
|
5677
|
+
{
|
|
5678
|
+
beneficiaries: sortedBeneficiaries.map((b) => ({
|
|
5679
|
+
account: b.account,
|
|
5680
|
+
weight: b.weight
|
|
5681
|
+
}))
|
|
5682
|
+
}
|
|
5683
|
+
]);
|
|
5684
|
+
}
|
|
5685
|
+
operations.push(
|
|
5686
|
+
buildCommentOptionsOp(
|
|
5687
|
+
payload.author,
|
|
5688
|
+
payload.permlink,
|
|
5689
|
+
maxAcceptedPayout,
|
|
5690
|
+
percentHbd,
|
|
5691
|
+
allowVotes,
|
|
5692
|
+
allowCurationRewards,
|
|
5693
|
+
extensions
|
|
5694
|
+
)
|
|
5695
|
+
);
|
|
5696
|
+
}
|
|
5697
|
+
return operations;
|
|
5698
|
+
},
|
|
5699
|
+
async (result, variables) => {
|
|
5700
|
+
const isPost = !variables.parentAuthor;
|
|
5701
|
+
const activityType = isPost ? 100 : 110;
|
|
5702
|
+
if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
|
|
5703
|
+
try {
|
|
5704
|
+
await auth.adapter.recordActivity(activityType, result.block_num, result.id);
|
|
5705
|
+
} catch (err) {
|
|
5706
|
+
console.warn("[useComment] Failed to record activity:", err);
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
5710
|
+
const queriesToInvalidate = [
|
|
5711
|
+
["posts", "feed", username],
|
|
5712
|
+
["posts", "blog", username],
|
|
5713
|
+
["account", username, "rc"]
|
|
5714
|
+
// RC decreases after posting/commenting
|
|
5715
|
+
];
|
|
5716
|
+
if (!isPost) {
|
|
5717
|
+
queriesToInvalidate.push([
|
|
5718
|
+
"posts",
|
|
5719
|
+
"entry",
|
|
5720
|
+
`/@${variables.parentAuthor}/${variables.parentPermlink}`
|
|
5721
|
+
]);
|
|
5722
|
+
}
|
|
5723
|
+
await auth.adapter.invalidateQueries(queriesToInvalidate);
|
|
5724
|
+
}
|
|
5725
|
+
},
|
|
5726
|
+
auth
|
|
5727
|
+
);
|
|
5728
|
+
}
|
|
5729
|
+
|
|
4001
5730
|
// src/modules/posts/utils/validate-post-creating.ts
|
|
4002
5731
|
var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
|
|
4003
5732
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -4859,6 +6588,35 @@ function getUserProposalVotesQueryOptions(voter) {
|
|
|
4859
6588
|
}
|
|
4860
6589
|
});
|
|
4861
6590
|
}
|
|
6591
|
+
|
|
6592
|
+
// src/modules/proposals/mutations/use-proposal-vote.ts
|
|
6593
|
+
function useProposalVote(username, auth) {
|
|
6594
|
+
return useBroadcastMutation(
|
|
6595
|
+
["proposals", "vote"],
|
|
6596
|
+
username,
|
|
6597
|
+
({ proposalIds, approve }) => [
|
|
6598
|
+
buildProposalVoteOp(username, proposalIds, approve)
|
|
6599
|
+
],
|
|
6600
|
+
async (result) => {
|
|
6601
|
+
try {
|
|
6602
|
+
if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
|
|
6603
|
+
await auth.adapter.recordActivity(150, result.block_num, result.id);
|
|
6604
|
+
}
|
|
6605
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
6606
|
+
await auth.adapter.invalidateQueries([
|
|
6607
|
+
["proposals", "list"],
|
|
6608
|
+
["proposals", "votes", username]
|
|
6609
|
+
]);
|
|
6610
|
+
}
|
|
6611
|
+
} catch (error) {
|
|
6612
|
+
console.warn("[useProposalVote] Post-broadcast side-effect failed:", error);
|
|
6613
|
+
}
|
|
6614
|
+
},
|
|
6615
|
+
auth,
|
|
6616
|
+
"active"
|
|
6617
|
+
// Use active authority for proposal votes (required by blockchain)
|
|
6618
|
+
);
|
|
6619
|
+
}
|
|
4862
6620
|
function getVestingDelegationsQueryOptions(username, limit = 50) {
|
|
4863
6621
|
return infiniteQueryOptions({
|
|
4864
6622
|
queryKey: ["wallet", "vesting-delegations", username, limit],
|
|
@@ -5149,6 +6907,110 @@ function getPortfolioQueryOptions(username, currency = "usd", onlyEnabled = true
|
|
|
5149
6907
|
}
|
|
5150
6908
|
});
|
|
5151
6909
|
}
|
|
6910
|
+
async function broadcastTransferWithFallback(username, ops2, auth) {
|
|
6911
|
+
const chain = auth?.fallbackChain ?? ["key", "hiveauth", "hivesigner", "keychain"];
|
|
6912
|
+
const errors = /* @__PURE__ */ new Map();
|
|
6913
|
+
const adapter = auth?.adapter;
|
|
6914
|
+
for (const method of chain) {
|
|
6915
|
+
try {
|
|
6916
|
+
switch (method) {
|
|
6917
|
+
case "key": {
|
|
6918
|
+
if (!adapter) break;
|
|
6919
|
+
const key = await adapter.getActiveKey?.(username);
|
|
6920
|
+
if (key) {
|
|
6921
|
+
const privateKey = PrivateKey.fromString(key);
|
|
6922
|
+
return await CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
|
|
6923
|
+
}
|
|
6924
|
+
break;
|
|
6925
|
+
}
|
|
6926
|
+
case "hiveauth": {
|
|
6927
|
+
if (adapter?.broadcastWithHiveAuth) {
|
|
6928
|
+
return await adapter.broadcastWithHiveAuth(username, ops2, "active");
|
|
6929
|
+
}
|
|
6930
|
+
break;
|
|
6931
|
+
}
|
|
6932
|
+
case "hivesigner": {
|
|
6933
|
+
if (!adapter) break;
|
|
6934
|
+
const token = await adapter.getAccessToken(username);
|
|
6935
|
+
if (token) {
|
|
6936
|
+
const client = new hs.Client({ accessToken: token });
|
|
6937
|
+
const response = await client.broadcast(ops2);
|
|
6938
|
+
return response.result;
|
|
6939
|
+
}
|
|
6940
|
+
break;
|
|
6941
|
+
}
|
|
6942
|
+
case "keychain": {
|
|
6943
|
+
if (adapter?.broadcastWithKeychain) {
|
|
6944
|
+
return await adapter.broadcastWithKeychain(username, ops2, "active");
|
|
6945
|
+
}
|
|
6946
|
+
break;
|
|
6947
|
+
}
|
|
6948
|
+
case "custom": {
|
|
6949
|
+
if (auth?.broadcast) {
|
|
6950
|
+
return await auth.broadcast(ops2, "active");
|
|
6951
|
+
}
|
|
6952
|
+
break;
|
|
6953
|
+
}
|
|
6954
|
+
}
|
|
6955
|
+
} catch (error) {
|
|
6956
|
+
errors.set(method, error);
|
|
6957
|
+
if (!shouldTriggerAuthFallback(error)) {
|
|
6958
|
+
throw error;
|
|
6959
|
+
}
|
|
6960
|
+
}
|
|
6961
|
+
}
|
|
6962
|
+
const errorMessages = Array.from(errors.entries()).map(([method, error]) => `${method}: ${error.message}`).join(", ");
|
|
6963
|
+
throw new Error(
|
|
6964
|
+
`[SDK][Transfer] All auth methods failed for ${username}. Errors: ${errorMessages}`
|
|
6965
|
+
);
|
|
6966
|
+
}
|
|
6967
|
+
function useTransfer(username, auth) {
|
|
6968
|
+
return useMutation({
|
|
6969
|
+
mutationKey: ["wallet", "transfer", username],
|
|
6970
|
+
mutationFn: async (payload) => {
|
|
6971
|
+
if (!username) {
|
|
6972
|
+
throw new Error(
|
|
6973
|
+
"[SDK][Transfer] Attempted to call transfer API with anon user"
|
|
6974
|
+
);
|
|
6975
|
+
}
|
|
6976
|
+
const ops2 = [buildTransferOp(username, payload.to, payload.amount, payload.memo)];
|
|
6977
|
+
if (auth?.enableFallback !== false && auth?.adapter) {
|
|
6978
|
+
return broadcastTransferWithFallback(username, ops2, auth);
|
|
6979
|
+
}
|
|
6980
|
+
if (auth?.broadcast) {
|
|
6981
|
+
return auth.broadcast(ops2, "active");
|
|
6982
|
+
}
|
|
6983
|
+
if (auth?.adapter?.getActiveKey) {
|
|
6984
|
+
const activeKey = await auth.adapter.getActiveKey(username);
|
|
6985
|
+
if (activeKey) {
|
|
6986
|
+
const privateKey = PrivateKey.fromString(activeKey);
|
|
6987
|
+
return CONFIG.hiveClient.broadcast.sendOperations(ops2, privateKey);
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
const accessToken = auth?.accessToken;
|
|
6991
|
+
if (accessToken) {
|
|
6992
|
+
const client = new hs.Client({ accessToken });
|
|
6993
|
+
const response = await client.broadcast(ops2);
|
|
6994
|
+
return response.result;
|
|
6995
|
+
}
|
|
6996
|
+
throw new Error(
|
|
6997
|
+
"[SDK][Transfer] \u2013 cannot broadcast transfer w/o active key or token"
|
|
6998
|
+
);
|
|
6999
|
+
},
|
|
7000
|
+
onSuccess: async (result, variables) => {
|
|
7001
|
+
if (auth?.adapter?.recordActivity && result?.block_num && result?.id) {
|
|
7002
|
+
await auth.adapter.recordActivity(140, result.block_num, result.id);
|
|
7003
|
+
}
|
|
7004
|
+
if (auth?.adapter?.invalidateQueries) {
|
|
7005
|
+
await auth.adapter.invalidateQueries([
|
|
7006
|
+
["wallet", "balances", username],
|
|
7007
|
+
["wallet", "balances", variables.to],
|
|
7008
|
+
["wallet", "transactions", username]
|
|
7009
|
+
]);
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
});
|
|
7013
|
+
}
|
|
5152
7014
|
function getWitnessesInfiniteQueryOptions(limit) {
|
|
5153
7015
|
return infiniteQueryOptions({
|
|
5154
7016
|
queryKey: ["witnesses", "list", limit],
|
|
@@ -6050,6 +7912,6 @@ async function getSpkMarkets() {
|
|
|
6050
7912
|
return await response.json();
|
|
6051
7913
|
}
|
|
6052
7914
|
|
|
6053
|
-
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkFavouriteQueryOptions, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, 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, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddDraft, useAddFragment, useAddImage, useAddSchedule, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useDeleteDraft, useDeleteImage, useDeleteSchedule, useEditFragment, useGameClaim, useMarkNotificationsRead, useMoveSchedule, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, useUpdateDraft, useUploadImage, usrActivity, validatePostCreating, votingPower, votingValue };
|
|
7915
|
+
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 };
|
|
6054
7916
|
//# sourceMappingURL=index.js.map
|
|
6055
7917
|
//# sourceMappingURL=index.js.map
|