@mtcute/core 0.25.8 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.cjs +18 -12
- package/client.js +21 -15
- package/highlevel/client.d.cts +78 -72
- package/highlevel/client.d.ts +78 -72
- package/highlevel/methods/forums/toggle-forum.cjs +0 -10
- package/highlevel/methods/forums/toggle-forum.d.cts +0 -10
- package/highlevel/methods/forums/toggle-forum.d.ts +0 -10
- package/highlevel/methods/forums/toggle-forum.js +0 -10
- package/highlevel/methods/premium/get-resale-star-gifts.cjs +0 -4
- package/highlevel/methods/premium/get-resale-star-gifts.d.cts +0 -6
- package/highlevel/methods/premium/get-resale-star-gifts.d.ts +0 -6
- package/highlevel/methods/premium/get-resale-star-gifts.js +0 -4
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +2 -1
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +4 -2
- package/highlevel/methods/premium/get-saved-star-gifts.js +2 -1
- package/highlevel/methods/{auth/run.cjs → premium/get-star-gift-value.cjs} +8 -5
- package/highlevel/methods/premium/get-star-gift-value.d.cts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.d.ts +9 -0
- package/highlevel/methods/premium/get-star-gift-value.js +11 -0
- package/highlevel/methods/premium/get-stars-transactions.cjs +3 -2
- package/highlevel/methods/premium/get-stars-transactions.d.cts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.d.ts +2 -0
- package/highlevel/methods/premium/get-stars-transactions.js +3 -2
- package/highlevel/methods/premium/iter-saved-star-gifts.cjs +15 -10
- package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +13 -19
- package/highlevel/methods/premium/iter-saved-star-gifts.js +15 -10
- package/highlevel/methods/premium/prepay-star-gift-upgrade.cjs +30 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.cts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.d.ts +23 -0
- package/highlevel/methods/premium/prepay-star-gift-upgrade.js +25 -0
- package/highlevel/methods/stickers/delete-sticker-from-set.d.cts +2 -4
- package/highlevel/methods/stickers/delete-sticker-from-set.d.ts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.cts +2 -4
- package/highlevel/methods/stickers/replace-sticker-in-set.d.ts +2 -4
- package/highlevel/methods/users/get-saved-music.cjs +38 -0
- package/highlevel/methods/users/get-saved-music.d.cts +13 -0
- package/highlevel/methods/users/get-saved-music.d.ts +13 -0
- package/highlevel/methods/users/get-saved-music.js +33 -0
- package/highlevel/methods/users/save-music-to-profile.cjs +57 -0
- package/highlevel/methods/users/save-music-to-profile.d.cts +19 -0
- package/highlevel/methods/users/save-music-to-profile.d.ts +19 -0
- package/highlevel/methods/users/save-music-to-profile.js +52 -0
- package/highlevel/methods/users/set-emoji-status.cjs +0 -8
- package/highlevel/methods/users/set-emoji-status.d.cts +0 -11
- package/highlevel/methods/users/set-emoji-status.d.ts +0 -11
- package/highlevel/methods/users/set-emoji-status.js +1 -9
- package/highlevel/methods.d.cts +5 -4
- package/highlevel/methods.d.ts +5 -4
- package/highlevel/storage/service/current-user.cjs +5 -4
- package/highlevel/storage/service/current-user.js +5 -4
- package/highlevel/types/files/utils.d.cts +7 -0
- package/highlevel/types/files/utils.d.ts +7 -0
- package/highlevel/types/media/document.d.cts +1 -1
- package/highlevel/types/media/document.d.ts +1 -1
- package/highlevel/types/messages/message-action.cjs +43 -21
- package/highlevel/types/messages/message-action.d.cts +58 -17
- package/highlevel/types/messages/message-action.d.ts +58 -17
- package/highlevel/types/messages/message-action.js +43 -21
- package/highlevel/types/peers/full-user.cjs +10 -1
- package/highlevel/types/peers/full-user.d.cts +3 -0
- package/highlevel/types/peers/full-user.d.ts +3 -0
- package/highlevel/types/peers/full-user.js +10 -1
- package/highlevel/types/premium/index.d.cts +1 -0
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/saved-star-gift.cjs +6 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
- package/highlevel/types/premium/saved-star-gift.js +6 -0
- package/highlevel/types/premium/star-gift-value.cjs +65 -0
- package/highlevel/types/premium/star-gift-value.d.cts +41 -0
- package/highlevel/types/premium/star-gift-value.d.ts +41 -0
- package/highlevel/types/premium/star-gift-value.js +60 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +10 -3
- package/highlevel/types/premium/stars-gift-unique.d.cts +1 -1
- package/highlevel/types/premium/stars-gift-unique.d.ts +1 -1
- package/highlevel/types/premium/stars-gift-unique.js +10 -3
- package/highlevel/types/premium/stars-transaction.cjs +9 -0
- package/highlevel/types/premium/stars-transaction.d.cts +10 -0
- package/highlevel/types/premium/stars-transaction.d.ts +10 -0
- package/highlevel/types/premium/stars-transaction.js +9 -0
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/methods.cjs +9 -5
- package/methods.js +12 -8
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +2 -2
- package/utils/binary/compat.cjs +35 -4
- package/utils/binary/compat.js +35 -4
- package/highlevel/methods/auth/run.d.cts +0 -16
- package/highlevel/methods/auth/run.d.ts +0 -16
- package/highlevel/methods/auth/run.js +0 -8
|
@@ -7,6 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
9
9
|
const memoize = require("../../utils/memoize.cjs");
|
|
10
|
+
const documentUtils = require("../media/document-utils.cjs");
|
|
10
11
|
const photo = require("../media/photo.cjs");
|
|
11
12
|
const businessAccount = require("../premium/business-account.cjs");
|
|
12
13
|
const botVerification = require("./bot-verification.cjs");
|
|
@@ -234,6 +235,13 @@ class FullUser extends user.User {
|
|
|
234
235
|
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
235
236
|
};
|
|
236
237
|
}
|
|
238
|
+
/** User's last saved audio file, to be displayed in the profile under their name */
|
|
239
|
+
get lastSavedMusic() {
|
|
240
|
+
if (this.full.savedMusic?._ !== "document") return null;
|
|
241
|
+
const doc = documentUtils.parseDocument(this.full.savedMusic);
|
|
242
|
+
if (doc.type !== "audio") return null;
|
|
243
|
+
return doc;
|
|
244
|
+
}
|
|
237
245
|
}
|
|
238
246
|
const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
239
247
|
"fullPhoto",
|
|
@@ -243,7 +251,8 @@ const FullUser$1 = /* @__PURE__ */ memoize.memoizeGetters(FullUser, [
|
|
|
243
251
|
"personalChannel",
|
|
244
252
|
"business",
|
|
245
253
|
"botVerification",
|
|
246
|
-
"starsRatingPending"
|
|
254
|
+
"starsRatingPending",
|
|
255
|
+
"lastSavedMusic"
|
|
247
256
|
]);
|
|
248
257
|
const FullUser$2 = /* @__PURE__ */ inspectable.makeInspectable(FullUser$1);
|
|
249
258
|
exports.FullUser = FullUser$2;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { Audio } from '../media/audio.js';
|
|
2
3
|
import { Photo } from '../media/photo.js';
|
|
3
4
|
import { BusinessAccount } from '../premium/business-account.js';
|
|
4
5
|
import { BotVerification } from './bot-verification.js';
|
|
@@ -132,4 +133,6 @@ export declare class FullUser extends User {
|
|
|
132
133
|
rating: tl.RawStarsRating;
|
|
133
134
|
date: Date;
|
|
134
135
|
} | null;
|
|
136
|
+
/** User's last saved audio file, to be displayed in the profile under their name */
|
|
137
|
+
get lastSavedMusic(): Audio | null;
|
|
135
138
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { Audio } from '../media/audio.js';
|
|
2
3
|
import { Photo } from '../media/photo.js';
|
|
3
4
|
import { BusinessAccount } from '../premium/business-account.js';
|
|
4
5
|
import { BotVerification } from './bot-verification.js';
|
|
@@ -132,4 +133,6 @@ export declare class FullUser extends User {
|
|
|
132
133
|
rating: tl.RawStarsRating;
|
|
133
134
|
date: Date;
|
|
134
135
|
} | null;
|
|
136
|
+
/** User's last saved audio file, to be displayed in the profile under their name */
|
|
137
|
+
get lastSavedMusic(): Audio | null;
|
|
135
138
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
2
2
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
|
+
import { parseDocument } from "../media/document-utils.js";
|
|
3
4
|
import { Photo as Photo$2 } from "../media/photo.js";
|
|
4
5
|
import { BusinessAccount as BusinessAccount$2 } from "../premium/business-account.js";
|
|
5
6
|
import { BotVerification as BotVerification$1 } from "./bot-verification.js";
|
|
@@ -227,6 +228,13 @@ class FullUser extends User$2 {
|
|
|
227
228
|
date: new Date(this.full.starsMyPendingRatingDate * 1e3)
|
|
228
229
|
};
|
|
229
230
|
}
|
|
231
|
+
/** User's last saved audio file, to be displayed in the profile under their name */
|
|
232
|
+
get lastSavedMusic() {
|
|
233
|
+
if (this.full.savedMusic?._ !== "document") return null;
|
|
234
|
+
const doc = parseDocument(this.full.savedMusic);
|
|
235
|
+
if (doc.type !== "audio") return null;
|
|
236
|
+
return doc;
|
|
237
|
+
}
|
|
230
238
|
}
|
|
231
239
|
const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
232
240
|
"fullPhoto",
|
|
@@ -236,7 +244,8 @@ const FullUser$1 = /* @__PURE__ */ memoizeGetters(FullUser, [
|
|
|
236
244
|
"personalChannel",
|
|
237
245
|
"business",
|
|
238
246
|
"botVerification",
|
|
239
|
-
"starsRatingPending"
|
|
247
|
+
"starsRatingPending",
|
|
248
|
+
"lastSavedMusic"
|
|
240
249
|
]);
|
|
241
250
|
const FullUser$2 = /* @__PURE__ */ makeInspectable(FullUser$1);
|
|
242
251
|
export {
|
|
@@ -8,6 +8,7 @@ export * from './business-intro.js';
|
|
|
8
8
|
export * from './business-location.js';
|
|
9
9
|
export * from './business-work-hours.js';
|
|
10
10
|
export * from './saved-star-gift.js';
|
|
11
|
+
export * from './star-gift-value.js';
|
|
11
12
|
export * from './stars-gift-unique.js';
|
|
12
13
|
export * from './stars-gift.js';
|
|
13
14
|
export * from './stars-status.js';
|
|
@@ -8,6 +8,7 @@ export * from './business-intro.js';
|
|
|
8
8
|
export * from './business-location.js';
|
|
9
9
|
export * from './business-work-hours.js';
|
|
10
10
|
export * from './saved-star-gift.js';
|
|
11
|
+
export * from './star-gift-value.js';
|
|
11
12
|
export * from './stars-gift-unique.js';
|
|
12
13
|
export * from './stars-gift.js';
|
|
13
14
|
export * from './stars-status.js';
|
|
@@ -90,6 +90,12 @@ class SavedStarGift {
|
|
|
90
90
|
get collectionIds() {
|
|
91
91
|
return this.raw.collectionId ?? [];
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade`
|
|
95
|
+
*/
|
|
96
|
+
get prepaidUpgradeHash() {
|
|
97
|
+
return this.raw.prepaidUpgradeHash ?? null;
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
const SavedStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(SavedStarGift);
|
|
95
101
|
const SavedStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
@@ -44,4 +44,8 @@ export declare class SavedStarGift {
|
|
|
44
44
|
get canResellAt(): Date | null;
|
|
45
45
|
/** IDs of the collections this gift belongs to */
|
|
46
46
|
get collectionIds(): number[];
|
|
47
|
+
/**
|
|
48
|
+
* If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade`
|
|
49
|
+
*/
|
|
50
|
+
get prepaidUpgradeHash(): string | null;
|
|
47
51
|
}
|
|
@@ -44,4 +44,8 @@ export declare class SavedStarGift {
|
|
|
44
44
|
get canResellAt(): Date | null;
|
|
45
45
|
/** IDs of the collections this gift belongs to */
|
|
46
46
|
get collectionIds(): number[];
|
|
47
|
+
/**
|
|
48
|
+
* If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade`
|
|
49
|
+
*/
|
|
50
|
+
get prepaidUpgradeHash(): string | null;
|
|
47
51
|
}
|
|
@@ -83,6 +83,12 @@ class SavedStarGift {
|
|
|
83
83
|
get collectionIds() {
|
|
84
84
|
return this.raw.collectionId ?? [];
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade`
|
|
88
|
+
*/
|
|
89
|
+
get prepaidUpgradeHash() {
|
|
90
|
+
return this.raw.prepaidUpgradeHash ?? null;
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
const SavedStarGift$1 = /* @__PURE__ */ makeInspectable(SavedStarGift);
|
|
88
94
|
const SavedStarGift$2 = /* @__PURE__ */ memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const inspectable = require("../../utils/inspectable.cjs");
|
|
9
|
+
const memoize = require("../../utils/memoize.cjs");
|
|
10
|
+
class StarGiftValue {
|
|
11
|
+
constructor(raw) {
|
|
12
|
+
this.raw = raw;
|
|
13
|
+
}
|
|
14
|
+
/** Currency of values in this object */
|
|
15
|
+
get currency() {
|
|
16
|
+
return this.raw.currency;
|
|
17
|
+
}
|
|
18
|
+
/** Information about the initial sale of the gift */
|
|
19
|
+
get initialSale() {
|
|
20
|
+
return {
|
|
21
|
+
date: new Date(this.raw.initialSaleDate * 1e3),
|
|
22
|
+
stars: this.raw.initialSaleStars,
|
|
23
|
+
price: this.raw.initialSalePrice
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Information about the last sale of the gift on the secondary market (Telegram and Fragment) */
|
|
27
|
+
get lastSale() {
|
|
28
|
+
if (!this.raw.lastSaleDate || !this.raw.lastSalePrice) return null;
|
|
29
|
+
return {
|
|
30
|
+
date: new Date(this.raw.lastSaleDate * 1e3),
|
|
31
|
+
price: this.raw.lastSalePrice,
|
|
32
|
+
fragment: this.raw.lastSaleOnFragment
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Whether {@link value} is calculated as an after-market average over the past month */
|
|
36
|
+
get isValueAverage() {
|
|
37
|
+
return this.raw.valueIsAverage;
|
|
38
|
+
}
|
|
39
|
+
/** Estimated value of the gift (in {@link currency}) */
|
|
40
|
+
get value() {
|
|
41
|
+
return this.raw.value;
|
|
42
|
+
}
|
|
43
|
+
/** Floor price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
44
|
+
get floorPrice() {
|
|
45
|
+
return this.raw.floorPrice ?? null;
|
|
46
|
+
}
|
|
47
|
+
/** Average price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
48
|
+
get averagePrice() {
|
|
49
|
+
return this.raw.averagePrice ?? null;
|
|
50
|
+
}
|
|
51
|
+
/** Number of such gifts listed on the secondary market (Telegram and Fragment) */
|
|
52
|
+
get listedCount() {
|
|
53
|
+
return {
|
|
54
|
+
telegram: this.raw.listedCount ?? 0,
|
|
55
|
+
fragment: this.raw.fragmentListedCount ?? 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** URL to the collectible on Fragment */
|
|
59
|
+
get fragmentUrl() {
|
|
60
|
+
return this.raw.fragmentListedUrl ?? null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const StarGiftValue$1 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftValue, ["initialSale", "lastSale"]);
|
|
64
|
+
const StarGiftValue$2 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftValue$1);
|
|
65
|
+
exports.StarGiftValue = StarGiftValue$2;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/** Information about the value of a star gift */
|
|
3
|
+
export declare class StarGiftValue {
|
|
4
|
+
private readonly raw;
|
|
5
|
+
constructor(raw: tl.payments.TypeUniqueStarGiftValueInfo);
|
|
6
|
+
/** Currency of values in this object */
|
|
7
|
+
get currency(): string;
|
|
8
|
+
/** Information about the initial sale of the gift */
|
|
9
|
+
get initialSale(): {
|
|
10
|
+
/** Date when the first such gift was sold */
|
|
11
|
+
date: Date;
|
|
12
|
+
/** Number of stars the gift was sold for */
|
|
13
|
+
stars: tl.Long;
|
|
14
|
+
/** Price of the gift in {@link currency} at the time of the sale */
|
|
15
|
+
price: tl.Long;
|
|
16
|
+
};
|
|
17
|
+
/** Information about the last sale of the gift on the secondary market (Telegram and Fragment) */
|
|
18
|
+
get lastSale(): {
|
|
19
|
+
/** Date when the last such gift was sold */
|
|
20
|
+
date: Date;
|
|
21
|
+
/** Price of the gift in {@link currency} at the time of the sale */
|
|
22
|
+
price: tl.Long;
|
|
23
|
+
/** Whether the sale was made on Fragment */
|
|
24
|
+
fragment: boolean;
|
|
25
|
+
} | null;
|
|
26
|
+
/** Whether {@link value} is calculated as an after-market average over the past month */
|
|
27
|
+
get isValueAverage(): boolean;
|
|
28
|
+
/** Estimated value of the gift (in {@link currency}) */
|
|
29
|
+
get value(): tl.Long;
|
|
30
|
+
/** Floor price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
31
|
+
get floorPrice(): tl.Long | null;
|
|
32
|
+
/** Average price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
33
|
+
get averagePrice(): tl.Long | null;
|
|
34
|
+
/** Number of such gifts listed on the secondary market (Telegram and Fragment) */
|
|
35
|
+
get listedCount(): {
|
|
36
|
+
telegram: number;
|
|
37
|
+
fragment: number;
|
|
38
|
+
};
|
|
39
|
+
/** URL to the collectible on Fragment */
|
|
40
|
+
get fragmentUrl(): string | null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/** Information about the value of a star gift */
|
|
3
|
+
export declare class StarGiftValue {
|
|
4
|
+
private readonly raw;
|
|
5
|
+
constructor(raw: tl.payments.TypeUniqueStarGiftValueInfo);
|
|
6
|
+
/** Currency of values in this object */
|
|
7
|
+
get currency(): string;
|
|
8
|
+
/** Information about the initial sale of the gift */
|
|
9
|
+
get initialSale(): {
|
|
10
|
+
/** Date when the first such gift was sold */
|
|
11
|
+
date: Date;
|
|
12
|
+
/** Number of stars the gift was sold for */
|
|
13
|
+
stars: tl.Long;
|
|
14
|
+
/** Price of the gift in {@link currency} at the time of the sale */
|
|
15
|
+
price: tl.Long;
|
|
16
|
+
};
|
|
17
|
+
/** Information about the last sale of the gift on the secondary market (Telegram and Fragment) */
|
|
18
|
+
get lastSale(): {
|
|
19
|
+
/** Date when the last such gift was sold */
|
|
20
|
+
date: Date;
|
|
21
|
+
/** Price of the gift in {@link currency} at the time of the sale */
|
|
22
|
+
price: tl.Long;
|
|
23
|
+
/** Whether the sale was made on Fragment */
|
|
24
|
+
fragment: boolean;
|
|
25
|
+
} | null;
|
|
26
|
+
/** Whether {@link value} is calculated as an after-market average over the past month */
|
|
27
|
+
get isValueAverage(): boolean;
|
|
28
|
+
/** Estimated value of the gift (in {@link currency}) */
|
|
29
|
+
get value(): tl.Long;
|
|
30
|
+
/** Floor price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
31
|
+
get floorPrice(): tl.Long | null;
|
|
32
|
+
/** Average price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
33
|
+
get averagePrice(): tl.Long | null;
|
|
34
|
+
/** Number of such gifts listed on the secondary market (Telegram and Fragment) */
|
|
35
|
+
get listedCount(): {
|
|
36
|
+
telegram: number;
|
|
37
|
+
fragment: number;
|
|
38
|
+
};
|
|
39
|
+
/** URL to the collectible on Fragment */
|
|
40
|
+
get fragmentUrl(): string | null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { makeInspectable } from "../../utils/inspectable.js";
|
|
2
|
+
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
|
+
class StarGiftValue {
|
|
4
|
+
constructor(raw) {
|
|
5
|
+
this.raw = raw;
|
|
6
|
+
}
|
|
7
|
+
/** Currency of values in this object */
|
|
8
|
+
get currency() {
|
|
9
|
+
return this.raw.currency;
|
|
10
|
+
}
|
|
11
|
+
/** Information about the initial sale of the gift */
|
|
12
|
+
get initialSale() {
|
|
13
|
+
return {
|
|
14
|
+
date: new Date(this.raw.initialSaleDate * 1e3),
|
|
15
|
+
stars: this.raw.initialSaleStars,
|
|
16
|
+
price: this.raw.initialSalePrice
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Information about the last sale of the gift on the secondary market (Telegram and Fragment) */
|
|
20
|
+
get lastSale() {
|
|
21
|
+
if (!this.raw.lastSaleDate || !this.raw.lastSalePrice) return null;
|
|
22
|
+
return {
|
|
23
|
+
date: new Date(this.raw.lastSaleDate * 1e3),
|
|
24
|
+
price: this.raw.lastSalePrice,
|
|
25
|
+
fragment: this.raw.lastSaleOnFragment
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Whether {@link value} is calculated as an after-market average over the past month */
|
|
29
|
+
get isValueAverage() {
|
|
30
|
+
return this.raw.valueIsAverage;
|
|
31
|
+
}
|
|
32
|
+
/** Estimated value of the gift (in {@link currency}) */
|
|
33
|
+
get value() {
|
|
34
|
+
return this.raw.value;
|
|
35
|
+
}
|
|
36
|
+
/** Floor price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
37
|
+
get floorPrice() {
|
|
38
|
+
return this.raw.floorPrice ?? null;
|
|
39
|
+
}
|
|
40
|
+
/** Average price for the gift on the secondary market (Telegram and Fragment), if available */
|
|
41
|
+
get averagePrice() {
|
|
42
|
+
return this.raw.averagePrice ?? null;
|
|
43
|
+
}
|
|
44
|
+
/** Number of such gifts listed on the secondary market (Telegram and Fragment) */
|
|
45
|
+
get listedCount() {
|
|
46
|
+
return {
|
|
47
|
+
telegram: this.raw.listedCount ?? 0,
|
|
48
|
+
fragment: this.raw.fragmentListedCount ?? 0
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** URL to the collectible on Fragment */
|
|
52
|
+
get fragmentUrl() {
|
|
53
|
+
return this.raw.fragmentListedUrl ?? null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const StarGiftValue$1 = /* @__PURE__ */ memoizeGetters(StarGiftValue, ["initialSale", "lastSale"]);
|
|
57
|
+
const StarGiftValue$2 = /* @__PURE__ */ makeInspectable(StarGiftValue$1);
|
|
58
|
+
export {
|
|
59
|
+
StarGiftValue$2 as StarGiftValue
|
|
60
|
+
};
|
|
@@ -172,9 +172,8 @@ class StarGiftUnique {
|
|
|
172
172
|
get availabilityTotal() {
|
|
173
173
|
return this.raw.availabilityTotal;
|
|
174
174
|
}
|
|
175
|
-
// todo for breaking: rename to resellPriceStars
|
|
176
175
|
/** Number of stars this gift is up for resell for */
|
|
177
|
-
get
|
|
176
|
+
get resellPriceStars() {
|
|
178
177
|
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
179
178
|
return resellPriceStars?.amount ?? null;
|
|
180
179
|
}
|
|
@@ -217,7 +216,15 @@ class StarGiftUnique {
|
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
const StarGiftUnique$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftUnique);
|
|
220
|
-
const StarGiftUnique$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftUnique$1, [
|
|
219
|
+
const StarGiftUnique$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftUnique$1, [
|
|
220
|
+
"model",
|
|
221
|
+
"pattern",
|
|
222
|
+
"backdrop",
|
|
223
|
+
"originalDetails",
|
|
224
|
+
"resellPriceStars",
|
|
225
|
+
"resellPriceTon",
|
|
226
|
+
"releasedBy"
|
|
227
|
+
]);
|
|
221
228
|
exports.StarGiftUnique = StarGiftUnique$2;
|
|
222
229
|
exports.StarGiftUniqueAttribute = StarGiftUniqueAttribute$2;
|
|
223
230
|
exports.StarGiftUniqueBackdrop = StarGiftUniqueBackdrop$1;
|
|
@@ -88,7 +88,7 @@ export declare class StarGiftUnique {
|
|
|
88
88
|
get availabilityIssued(): number;
|
|
89
89
|
get availabilityTotal(): number;
|
|
90
90
|
/** Number of stars this gift is up for resell for */
|
|
91
|
-
get
|
|
91
|
+
get resellPriceStars(): tl.Long | null;
|
|
92
92
|
/** Number of nanoton this gift is up for resell for */
|
|
93
93
|
get resellPriceTon(): tl.Long | null;
|
|
94
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
@@ -88,7 +88,7 @@ export declare class StarGiftUnique {
|
|
|
88
88
|
get availabilityIssued(): number;
|
|
89
89
|
get availabilityTotal(): number;
|
|
90
90
|
/** Number of stars this gift is up for resell for */
|
|
91
|
-
get
|
|
91
|
+
get resellPriceStars(): tl.Long | null;
|
|
92
92
|
/** Number of nanoton this gift is up for resell for */
|
|
93
93
|
get resellPriceTon(): tl.Long | null;
|
|
94
94
|
/** Model (i.e. the gift itself) of the unique star gift */
|
|
@@ -165,9 +165,8 @@ class StarGiftUnique {
|
|
|
165
165
|
get availabilityTotal() {
|
|
166
166
|
return this.raw.availabilityTotal;
|
|
167
167
|
}
|
|
168
|
-
// todo for breaking: rename to resellPriceStars
|
|
169
168
|
/** Number of stars this gift is up for resell for */
|
|
170
|
-
get
|
|
169
|
+
get resellPriceStars() {
|
|
171
170
|
const resellPriceStars = this.raw.resellAmount?.find((it) => it._ === "starsAmount");
|
|
172
171
|
return resellPriceStars?.amount ?? null;
|
|
173
172
|
}
|
|
@@ -210,7 +209,15 @@ class StarGiftUnique {
|
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
const StarGiftUnique$1 = /* @__PURE__ */ makeInspectable(StarGiftUnique);
|
|
213
|
-
const StarGiftUnique$2 = /* @__PURE__ */ memoizeGetters(StarGiftUnique$1, [
|
|
212
|
+
const StarGiftUnique$2 = /* @__PURE__ */ memoizeGetters(StarGiftUnique$1, [
|
|
213
|
+
"model",
|
|
214
|
+
"pattern",
|
|
215
|
+
"backdrop",
|
|
216
|
+
"originalDetails",
|
|
217
|
+
"resellPriceStars",
|
|
218
|
+
"resellPriceTon",
|
|
219
|
+
"releasedBy"
|
|
220
|
+
]);
|
|
214
221
|
export {
|
|
215
222
|
StarGiftUnique$2 as StarGiftUnique,
|
|
216
223
|
StarGiftUniqueAttribute$2 as StarGiftUniqueAttribute,
|
|
@@ -92,6 +92,9 @@ class StarsTransaction {
|
|
|
92
92
|
return { type: "unsupported" };
|
|
93
93
|
case "starsTransactionPeer": {
|
|
94
94
|
const peer$1 = peer.parsePeer(this.raw.peer.peer, this.peers);
|
|
95
|
+
if (this.raw.postsSearch) {
|
|
96
|
+
return { type: "paid_search" };
|
|
97
|
+
}
|
|
95
98
|
if (this.raw.giveawayPostId) {
|
|
96
99
|
return {
|
|
97
100
|
type: "giveaway",
|
|
@@ -132,6 +135,12 @@ class StarsTransaction {
|
|
|
132
135
|
peer: peer$1,
|
|
133
136
|
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
|
|
134
137
|
};
|
|
138
|
+
} else if (this.raw.stargiftPrepaidUpgrade) {
|
|
139
|
+
return {
|
|
140
|
+
peer: peer$1,
|
|
141
|
+
gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers),
|
|
142
|
+
type: "star_gift_prepaid_upgrade"
|
|
143
|
+
};
|
|
135
144
|
} else {
|
|
136
145
|
return {
|
|
137
146
|
type: "star_gift_transfer",
|
|
@@ -28,6 +28,8 @@ import { StarGift } from './stars-gift.js';
|
|
|
28
28
|
* - `api_floodskip`: This transaction is a payment for a paid bot broadcast
|
|
29
29
|
* - `bot_referral`: This transaction is proceeds from a bot referral program
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
|
+
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
|
+
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
31
33
|
*/
|
|
32
34
|
export type StarsTransactionType = {
|
|
33
35
|
type: 'unsupported';
|
|
@@ -164,6 +166,14 @@ export type StarsTransactionType = {
|
|
|
164
166
|
fromDate: Date;
|
|
165
167
|
/** End of the period */
|
|
166
168
|
toDate: Date;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'paid_search';
|
|
171
|
+
} | {
|
|
172
|
+
type: 'star_gift_prepaid_upgrade';
|
|
173
|
+
/** Related peer */
|
|
174
|
+
peer: Peer;
|
|
175
|
+
/** The upgraded gift */
|
|
176
|
+
gift: StarGiftUnique;
|
|
167
177
|
};
|
|
168
178
|
export declare class StarsTransaction {
|
|
169
179
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -28,6 +28,8 @@ import { StarGift } from './stars-gift.js';
|
|
|
28
28
|
* - `api_floodskip`: This transaction is a payment for a paid bot broadcast
|
|
29
29
|
* - `bot_referral`: This transaction is proceeds from a bot referral program
|
|
30
30
|
* - `ads_proceeds`: This transaction is proceeds from Telegram Ads
|
|
31
|
+
* - `paid_search`: This transaction is a payment for a paid search
|
|
32
|
+
* - `star_gift_prepaid_upgrade`: This transaction is for a star gift prepaid upgrade
|
|
31
33
|
*/
|
|
32
34
|
export type StarsTransactionType = {
|
|
33
35
|
type: 'unsupported';
|
|
@@ -164,6 +166,14 @@ export type StarsTransactionType = {
|
|
|
164
166
|
fromDate: Date;
|
|
165
167
|
/** End of the period */
|
|
166
168
|
toDate: Date;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'paid_search';
|
|
171
|
+
} | {
|
|
172
|
+
type: 'star_gift_prepaid_upgrade';
|
|
173
|
+
/** Related peer */
|
|
174
|
+
peer: Peer;
|
|
175
|
+
/** The upgraded gift */
|
|
176
|
+
gift: StarGiftUnique;
|
|
167
177
|
};
|
|
168
178
|
export declare class StarsTransaction {
|
|
169
179
|
readonly raw: tl.RawStarsTransaction;
|
|
@@ -85,6 +85,9 @@ class StarsTransaction {
|
|
|
85
85
|
return { type: "unsupported" };
|
|
86
86
|
case "starsTransactionPeer": {
|
|
87
87
|
const peer = parsePeer(this.raw.peer.peer, this.peers);
|
|
88
|
+
if (this.raw.postsSearch) {
|
|
89
|
+
return { type: "paid_search" };
|
|
90
|
+
}
|
|
88
91
|
if (this.raw.giveawayPostId) {
|
|
89
92
|
return {
|
|
90
93
|
type: "giveaway",
|
|
@@ -125,6 +128,12 @@ class StarsTransaction {
|
|
|
125
128
|
peer,
|
|
126
129
|
gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
|
|
127
130
|
};
|
|
131
|
+
} else if (this.raw.stargiftPrepaidUpgrade) {
|
|
132
|
+
return {
|
|
133
|
+
peer,
|
|
134
|
+
gift: new StarGiftUnique$2(this.raw.stargift, this.peers),
|
|
135
|
+
type: "star_gift_prepaid_upgrade"
|
|
136
|
+
};
|
|
128
137
|
} else {
|
|
129
138
|
return {
|
|
130
139
|
type: "star_gift_transfer",
|
package/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ const businessIntro = require("./highlevel/types/premium/business-intro.cjs");
|
|
|
93
93
|
const businessLocation = require("./highlevel/types/premium/business-location.cjs");
|
|
94
94
|
const businessWorkHours = require("./highlevel/types/premium/business-work-hours.cjs");
|
|
95
95
|
const savedStarGift = require("./highlevel/types/premium/saved-star-gift.cjs");
|
|
96
|
+
const starGiftValue = require("./highlevel/types/premium/star-gift-value.cjs");
|
|
96
97
|
const starsGiftUnique = require("./highlevel/types/premium/stars-gift-unique.cjs");
|
|
97
98
|
const starsGift = require("./highlevel/types/premium/stars-gift.cjs");
|
|
98
99
|
const starsStatus = require("./highlevel/types/premium/stars-status.cjs");
|
|
@@ -269,6 +270,7 @@ exports.BusinessLocation = businessLocation.BusinessLocation;
|
|
|
269
270
|
exports.BusinessWorkHours = businessWorkHours.BusinessWorkHours;
|
|
270
271
|
exports.businessWorkHoursDaysToRaw = businessWorkHours.businessWorkHoursDaysToRaw;
|
|
271
272
|
exports.SavedStarGift = savedStarGift.SavedStarGift;
|
|
273
|
+
exports.StarGiftValue = starGiftValue.StarGiftValue;
|
|
272
274
|
exports.StarGiftUnique = starsGiftUnique.StarGiftUnique;
|
|
273
275
|
exports.StarGiftUniqueAttribute = starsGiftUnique.StarGiftUniqueAttribute;
|
|
274
276
|
exports.StarGiftUniqueBackdrop = starsGiftUnique.StarGiftUniqueBackdrop;
|
package/index.js
CHANGED
|
@@ -86,6 +86,7 @@ import { BusinessIntro } from "./highlevel/types/premium/business-intro.js";
|
|
|
86
86
|
import { BusinessLocation } from "./highlevel/types/premium/business-location.js";
|
|
87
87
|
import { BusinessWorkHours, businessWorkHoursDaysToRaw } from "./highlevel/types/premium/business-work-hours.js";
|
|
88
88
|
import { SavedStarGift } from "./highlevel/types/premium/saved-star-gift.js";
|
|
89
|
+
import { StarGiftValue } from "./highlevel/types/premium/star-gift-value.js";
|
|
89
90
|
import { StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop, StarGiftUniqueOriginalDetails } from "./highlevel/types/premium/stars-gift-unique.js";
|
|
90
91
|
import { StarGift } from "./highlevel/types/premium/stars-gift.js";
|
|
91
92
|
import { StarsStatus } from "./highlevel/types/premium/stars-status.js";
|
|
@@ -277,6 +278,7 @@ export {
|
|
|
277
278
|
StarGiftUniqueAttribute,
|
|
278
279
|
StarGiftUniqueBackdrop,
|
|
279
280
|
StarGiftUniqueOriginalDetails,
|
|
281
|
+
StarGiftValue,
|
|
280
282
|
StarsStatus,
|
|
281
283
|
StarsTransaction,
|
|
282
284
|
Sticker,
|