@mtcute/core 0.23.2 → 0.24.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.
Files changed (131) hide show
  1. package/client.cjs +21 -2
  2. package/client.js +21 -2
  3. package/highlevel/base.cjs +15 -3
  4. package/highlevel/base.d.cts +4 -1
  5. package/highlevel/base.d.ts +4 -1
  6. package/highlevel/base.js +15 -3
  7. package/highlevel/client.d.cts +56 -7
  8. package/highlevel/client.d.ts +56 -7
  9. package/highlevel/client.types.d.cts +2 -1
  10. package/highlevel/client.types.d.ts +2 -1
  11. package/highlevel/methods/chats/get-chat-event-log.cjs +5 -3
  12. package/highlevel/methods/chats/get-chat-event-log.js +3 -1
  13. package/highlevel/methods/files/download-iterable.cjs +1 -1
  14. package/highlevel/methods/files/download-iterable.js +1 -1
  15. package/highlevel/methods/premium/_normalize-input-star-gift.cjs +6 -0
  16. package/highlevel/methods/premium/_normalize-input-star-gift.js +6 -0
  17. package/highlevel/methods/premium/buy-resale-gift.cjs +30 -0
  18. package/highlevel/methods/premium/buy-resale-gift.d.cts +13 -0
  19. package/highlevel/methods/premium/buy-resale-gift.d.ts +13 -0
  20. package/highlevel/methods/premium/buy-resale-gift.js +25 -0
  21. package/highlevel/methods/premium/get-resale-star-gifts.cjs +107 -0
  22. package/highlevel/methods/premium/get-resale-star-gifts.d.cts +45 -0
  23. package/highlevel/methods/premium/get-resale-star-gifts.d.ts +45 -0
  24. package/highlevel/methods/premium/get-resale-star-gifts.js +102 -0
  25. package/highlevel/methods/premium/get-unique-star-gift.cjs +1 -1
  26. package/highlevel/methods/premium/get-unique-star-gift.js +1 -1
  27. package/highlevel/methods/premium/set-gift-resale-price.cjs +19 -0
  28. package/highlevel/methods/premium/set-gift-resale-price.d.cts +9 -0
  29. package/highlevel/methods/premium/set-gift-resale-price.d.ts +9 -0
  30. package/highlevel/methods/premium/set-gift-resale-price.js +14 -0
  31. package/highlevel/methods/premium/transfer-star-gift.cjs +28 -13
  32. package/highlevel/methods/premium/transfer-star-gift.d.cts +1 -1
  33. package/highlevel/methods/premium/transfer-star-gift.d.ts +1 -1
  34. package/highlevel/methods/premium/transfer-star-gift.js +28 -13
  35. package/highlevel/methods/premium/upgrade-star-gift.cjs +26 -11
  36. package/highlevel/methods/premium/upgrade-star-gift.js +26 -11
  37. package/highlevel/methods/users/resolve-peer.cjs +63 -70
  38. package/highlevel/methods/users/resolve-peer.d.cts +2 -1
  39. package/highlevel/methods/users/resolve-peer.d.ts +2 -1
  40. package/highlevel/methods/users/resolve-peer.js +61 -68
  41. package/highlevel/methods/users/resolve-phone-number.cjs +36 -0
  42. package/highlevel/methods/users/resolve-phone-number.d.cts +10 -0
  43. package/highlevel/methods/users/resolve-phone-number.d.ts +10 -0
  44. package/highlevel/methods/users/resolve-phone-number.js +31 -0
  45. package/highlevel/methods.d.cts +10 -4
  46. package/highlevel/methods.d.ts +10 -4
  47. package/highlevel/types/messages/message-action.cjs +8 -2
  48. package/highlevel/types/messages/message-action.d.cts +6 -0
  49. package/highlevel/types/messages/message-action.d.ts +6 -0
  50. package/highlevel/types/messages/message-action.js +8 -2
  51. package/highlevel/types/peers/chat-event/actions.cjs +49 -1
  52. package/highlevel/types/peers/chat-event/actions.d.cts +60 -2
  53. package/highlevel/types/peers/chat-event/actions.d.ts +60 -2
  54. package/highlevel/types/peers/chat-event/actions.js +49 -1
  55. package/highlevel/types/peers/chat-event/filters.cjs +9 -0
  56. package/highlevel/types/peers/chat-event/filters.js +9 -0
  57. package/highlevel/types/peers/chat-event/index.cjs +3 -2
  58. package/highlevel/types/peers/chat-event/index.d.cts +2 -1
  59. package/highlevel/types/peers/chat-event/index.d.ts +2 -1
  60. package/highlevel/types/peers/chat-event/index.js +3 -2
  61. package/highlevel/types/peers/chat.cjs +5 -4
  62. package/highlevel/types/peers/chat.d.cts +2 -0
  63. package/highlevel/types/peers/chat.d.ts +2 -0
  64. package/highlevel/types/peers/chat.js +5 -4
  65. package/highlevel/types/peers/peer.d.cts +2 -3
  66. package/highlevel/types/peers/peer.d.ts +2 -3
  67. package/highlevel/types/peers/user.cjs +1 -4
  68. package/highlevel/types/peers/user.js +1 -4
  69. package/highlevel/types/premium/saved-star-gift.cjs +8 -0
  70. package/highlevel/types/premium/saved-star-gift.d.cts +4 -0
  71. package/highlevel/types/premium/saved-star-gift.d.ts +4 -0
  72. package/highlevel/types/premium/saved-star-gift.js +8 -0
  73. package/highlevel/types/premium/stars-gift-unique.cjs +13 -2
  74. package/highlevel/types/premium/stars-gift-unique.d.cts +6 -2
  75. package/highlevel/types/premium/stars-gift-unique.d.ts +6 -2
  76. package/highlevel/types/premium/stars-gift-unique.js +13 -2
  77. package/highlevel/types/premium/stars-gift.cjs +11 -1
  78. package/highlevel/types/premium/stars-gift.d.cts +8 -1
  79. package/highlevel/types/premium/stars-gift.d.ts +8 -1
  80. package/highlevel/types/premium/stars-gift.js +11 -1
  81. package/highlevel/types/premium/stars-transaction.cjs +7 -1
  82. package/highlevel/types/premium/stars-transaction.d.cts +9 -2
  83. package/highlevel/types/premium/stars-transaction.d.ts +9 -2
  84. package/highlevel/types/premium/stars-transaction.js +7 -1
  85. package/highlevel/types/reactions/emoji-status.cjs +6 -0
  86. package/highlevel/types/reactions/emoji-status.d.cts +1 -0
  87. package/highlevel/types/reactions/emoji-status.d.ts +1 -0
  88. package/highlevel/types/reactions/emoji-status.js +6 -0
  89. package/highlevel/types/utils.d.cts +4 -0
  90. package/highlevel/types/utils.d.ts +4 -0
  91. package/highlevel/updates/manager.cjs +35 -26
  92. package/highlevel/updates/manager.d.cts +6 -6
  93. package/highlevel/updates/manager.d.ts +6 -6
  94. package/highlevel/updates/manager.js +35 -26
  95. package/highlevel/updates/types.d.cts +6 -6
  96. package/highlevel/updates/types.d.ts +6 -6
  97. package/highlevel/utils/misc-utils.cjs +8 -0
  98. package/highlevel/utils/misc-utils.d.cts +2 -1
  99. package/highlevel/utils/misc-utils.d.ts +2 -1
  100. package/highlevel/utils/misc-utils.js +8 -0
  101. package/highlevel/worker/port.cjs +7 -5
  102. package/highlevel/worker/port.d.cts +3 -2
  103. package/highlevel/worker/port.d.ts +3 -2
  104. package/highlevel/worker/port.js +7 -5
  105. package/methods.cjs +8 -0
  106. package/methods.js +8 -0
  107. package/network/client.cjs +12 -8
  108. package/network/client.d.cts +4 -1
  109. package/network/client.d.ts +4 -1
  110. package/network/client.js +12 -8
  111. package/network/network-manager.cjs +1 -1
  112. package/network/network-manager.js +1 -1
  113. package/network/session-connection.cjs +1 -0
  114. package/network/session-connection.js +1 -0
  115. package/package.json +2 -2
  116. package/utils/binary/compat.cjs +9 -0
  117. package/utils/binary/compat.js +9 -0
  118. package/utils/index.d.cts +0 -1
  119. package/utils/index.d.ts +0 -1
  120. package/utils/sorted-array.cjs +6 -0
  121. package/utils/sorted-array.d.cts +2 -0
  122. package/utils/sorted-array.d.ts +2 -0
  123. package/utils/sorted-array.js +6 -0
  124. package/utils.cjs +1 -2
  125. package/utils.js +2 -3
  126. package/utils/linked-list.cjs +0 -65
  127. package/utils/linked-list.d.cts +0 -21
  128. package/utils/linked-list.d.ts +0 -21
  129. package/utils/linked-list.js +0 -60
  130. package/utils/linked-list.test.d.cts +0 -1
  131. package/utils/linked-list.test.d.ts +0 -1
@@ -231,6 +231,10 @@ class Chat {
231
231
  get hasSignatures() {
232
232
  return this.raw._ === "channel" && this.raw.signatures;
233
233
  }
234
+ /** Whether this chat/channel has auto-translation enabled */
235
+ get hasAutoTranslation() {
236
+ return this.raw._ === "channel" && this.raw.autotranslation;
237
+ }
234
238
  /** Chat title */
235
239
  get title() {
236
240
  return this.raw.title;
@@ -322,10 +326,7 @@ class Chat {
322
326
  */
323
327
  get emojiStatus() {
324
328
  if (this.raw._ !== "channel") return null;
325
- if (!this.raw.emojiStatus || this.raw.emojiStatus._ === "emojiStatusEmpty" || this.raw.emojiStatus._ === "inputEmojiStatusCollectible") {
326
- return null;
327
- }
328
- return new EmojiStatus$1(this.raw.emojiStatus);
329
+ return EmojiStatus$1.fromTl(this.raw.emojiStatus);
329
330
  }
330
331
  /**
331
332
  * If non-null, this user was verified by a bot, and this field contains
@@ -10,8 +10,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
10
10
  /**
11
11
  * Type that can be used as an input peer to most of the high-level methods. Can be:
12
12
  * - `number`, representing peer's marked ID*
13
- * - `string`, representing peer's username (without preceding `@`)
14
- * - `string`, representing user's phone number
13
+ * - `string`, representing user's username
15
14
  * - `"me"` and `"self"` which will be replaced with the current user/bot
16
15
  * - Any object with `inputPeer: tl.TypeInputPeer` property
17
16
  * - Raw TL object
@@ -19,7 +18,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
19
18
  * > * Telegram has moved to int64 IDs. Though, Levin [has confirmed](https://t.me/tdlibchat/25071)
20
19
  * > that new IDs *will* still fit into int53, meaning JS integers are fine.
21
20
  */
22
- export type InputPeerLike = string | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
21
+ export type InputPeerLike = 'me' | 'self' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
23
22
  inputPeer: tl.TypeInputPeer;
24
23
  };
25
24
  /**
@@ -10,8 +10,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
10
10
  /**
11
11
  * Type that can be used as an input peer to most of the high-level methods. Can be:
12
12
  * - `number`, representing peer's marked ID*
13
- * - `string`, representing peer's username (without preceding `@`)
14
- * - `string`, representing user's phone number
13
+ * - `string`, representing user's username
15
14
  * - `"me"` and `"self"` which will be replaced with the current user/bot
16
15
  * - Any object with `inputPeer: tl.TypeInputPeer` property
17
16
  * - Raw TL object
@@ -19,7 +18,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
19
18
  * > * Telegram has moved to int64 IDs. Though, Levin [has confirmed](https://t.me/tdlibchat/25071)
20
19
  * > that new IDs *will* still fit into int53, meaning JS integers are fine.
21
20
  */
22
- export type InputPeerLike = string | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
21
+ export type InputPeerLike = 'me' | 'self' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
23
22
  inputPeer: tl.TypeInputPeer;
24
23
  };
25
24
  /**
@@ -335,10 +335,7 @@ class User {
335
335
  * User's emoji status, if any.
336
336
  */
337
337
  get emojiStatus() {
338
- if (!this.raw.emojiStatus || this.raw.emojiStatus._ === "emojiStatusEmpty" || this.raw.emojiStatus._ === "inputEmojiStatusCollectible") {
339
- return null;
340
- }
341
- return new emojiStatus.EmojiStatus(this.raw.emojiStatus);
338
+ return emojiStatus.EmojiStatus.fromTl(this.raw.emojiStatus);
342
339
  }
343
340
  /** Whether you have hidden (arhived) this user's stories */
344
341
  get storiesHidden() {
@@ -328,10 +328,7 @@ class User {
328
328
  * User's emoji status, if any.
329
329
  */
330
330
  get emojiStatus() {
331
- if (!this.raw.emojiStatus || this.raw.emojiStatus._ === "emojiStatusEmpty" || this.raw.emojiStatus._ === "inputEmojiStatusCollectible") {
332
- return null;
333
- }
334
- return new EmojiStatus$1(this.raw.emojiStatus);
331
+ return EmojiStatus$1.fromTl(this.raw.emojiStatus);
335
332
  }
336
333
  /** Whether you have hidden (arhived) this user's stories */
337
334
  get storiesHidden() {
@@ -78,6 +78,14 @@ class SavedStarGift {
78
78
  get canExportAt() {
79
79
  return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
80
80
  }
81
+ /** Date when the gift can be transferred */
82
+ get canTransferAt() {
83
+ return this.raw.canTransferAt ? new Date(this.raw.canTransferAt * 1e3) : null;
84
+ }
85
+ /** Date when the gift can be resold */
86
+ get canResellAt() {
87
+ return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
88
+ }
81
89
  }
82
90
  const SavedStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(SavedStarGift);
83
91
  const SavedStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
@@ -38,4 +38,8 @@ export declare class SavedStarGift {
38
38
  get transferStars(): tl.Long | null;
39
39
  /** Date when the gift can be exported to blockchain */
40
40
  get canExportAt(): Date | null;
41
+ /** Date when the gift can be transferred */
42
+ get canTransferAt(): Date | null;
43
+ /** Date when the gift can be resold */
44
+ get canResellAt(): Date | null;
41
45
  }
@@ -38,4 +38,8 @@ export declare class SavedStarGift {
38
38
  get transferStars(): tl.Long | null;
39
39
  /** Date when the gift can be exported to blockchain */
40
40
  get canExportAt(): Date | null;
41
+ /** Date when the gift can be transferred */
42
+ get canTransferAt(): Date | null;
43
+ /** Date when the gift can be resold */
44
+ get canResellAt(): Date | null;
41
45
  }
@@ -71,6 +71,14 @@ class SavedStarGift {
71
71
  get canExportAt() {
72
72
  return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
73
73
  }
74
+ /** Date when the gift can be transferred */
75
+ get canTransferAt() {
76
+ return this.raw.canTransferAt ? new Date(this.raw.canTransferAt * 1e3) : null;
77
+ }
78
+ /** Date when the gift can be resold */
79
+ get canResellAt() {
80
+ return this.raw.canResellAt ? new Date(this.raw.canResellAt * 1e3) : null;
81
+ }
74
82
  }
75
83
  const SavedStarGift$1 = /* @__PURE__ */ makeInspectable(SavedStarGift);
76
84
  const SavedStarGift$2 = /* @__PURE__ */ memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
@@ -36,6 +36,10 @@ class StarGiftUniqueBackdrop {
36
36
  constructor(raw) {
37
37
  this.raw = raw;
38
38
  }
39
+ /** ID of the backdrop */
40
+ get id() {
41
+ return this.raw.backdropId;
42
+ }
39
43
  /** Rarity permille of the attribute */
40
44
  get permille() {
41
45
  return this.raw.rarityPermille;
@@ -81,10 +85,11 @@ class StarGiftUniqueOriginalDetails {
81
85
  /**
82
86
  * Peer who received the original star gift, if available
83
87
  *
84
- * > Note: {@link recipientId} is always available. If ID is available, but this field throws an error,
88
+ * > Note: {@link recipientId} is always available. If ID is available, but this field is null,
85
89
  * > you should try fetching the peer manually using {@link getPeer})
86
90
  */
87
91
  get recipient() {
92
+ if (!this._peers.has(this.raw.recipientId)) return null;
88
93
  return peer.parsePeer(this.raw.recipientId, this._peers);
89
94
  }
90
95
  /** ID of the peer who received the original star gift */
@@ -100,6 +105,7 @@ class StarGiftUniqueOriginalDetails {
100
105
  return this.raw.message ?? null;
101
106
  }
102
107
  }
108
+ const StarGiftUniqueOriginalDetails$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftUniqueOriginalDetails);
103
109
  class StarGiftUnique {
104
110
  constructor(raw, _peers) {
105
111
  this.raw = raw;
@@ -155,12 +161,17 @@ class StarGiftUnique {
155
161
  get ownerName() {
156
162
  return this.raw.ownerName ?? null;
157
163
  }
164
+ // todo: merge into one property
158
165
  get availabilityIssued() {
159
166
  return this.raw.availabilityIssued;
160
167
  }
161
168
  get availabilityTotal() {
162
169
  return this.raw.availabilityTotal;
163
170
  }
171
+ /** Number of stars this gift is up for resell for */
172
+ get resellPrice() {
173
+ return this.raw.resellStars ?? null;
174
+ }
164
175
  /** Model (i.e. the gift itself) of the unique star gift */
165
176
  get model() {
166
177
  return new StarGiftUniqueAttribute(this._model);
@@ -192,4 +203,4 @@ const StarGiftUnique$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftUnique$1
192
203
  exports.StarGiftUnique = StarGiftUnique$2;
193
204
  exports.StarGiftUniqueAttribute = StarGiftUniqueAttribute$2;
194
205
  exports.StarGiftUniqueBackdrop = StarGiftUniqueBackdrop$1;
195
- exports.StarGiftUniqueOriginalDetails = StarGiftUniqueOriginalDetails;
206
+ exports.StarGiftUniqueOriginalDetails = StarGiftUniqueOriginalDetails$1;
@@ -17,6 +17,8 @@ export declare class StarGiftUniqueAttribute {
17
17
  export declare class StarGiftUniqueBackdrop {
18
18
  readonly raw: tl.RawStarGiftAttributeBackdrop;
19
19
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
+ /** ID of the backdrop */
21
+ get id(): number;
20
22
  /** Rarity permille of the attribute */
21
23
  get permille(): number;
22
24
  /** Display name of the attribute */
@@ -43,10 +45,10 @@ export declare class StarGiftUniqueOriginalDetails {
43
45
  /**
44
46
  * Peer who received the original star gift, if available
45
47
  *
46
- * > Note: {@link recipientId} is always available. If ID is available, but this field throws an error,
48
+ * > Note: {@link recipientId} is always available. If ID is available, but this field is null,
47
49
  * > you should try fetching the peer manually using {@link getPeer})
48
50
  */
49
- get recipient(): Peer;
51
+ get recipient(): Peer | null;
50
52
  /** ID of the peer who received the original star gift */
51
53
  get recipientId(): number;
52
54
  /** Date when the original star gift was sent */
@@ -83,6 +85,8 @@ export declare class StarGiftUnique {
83
85
  get ownerName(): string | null;
84
86
  get availabilityIssued(): number;
85
87
  get availabilityTotal(): number;
88
+ /** Number of stars this gift is up for resell for */
89
+ get resellPrice(): tl.Long | null;
86
90
  /** Model (i.e. the gift itself) of the unique star gift */
87
91
  get model(): StarGiftUniqueAttribute;
88
92
  /** Pattern of the unique star gift */
@@ -17,6 +17,8 @@ export declare class StarGiftUniqueAttribute {
17
17
  export declare class StarGiftUniqueBackdrop {
18
18
  readonly raw: tl.RawStarGiftAttributeBackdrop;
19
19
  constructor(raw: tl.RawStarGiftAttributeBackdrop);
20
+ /** ID of the backdrop */
21
+ get id(): number;
20
22
  /** Rarity permille of the attribute */
21
23
  get permille(): number;
22
24
  /** Display name of the attribute */
@@ -43,10 +45,10 @@ export declare class StarGiftUniqueOriginalDetails {
43
45
  /**
44
46
  * Peer who received the original star gift, if available
45
47
  *
46
- * > Note: {@link recipientId} is always available. If ID is available, but this field throws an error,
48
+ * > Note: {@link recipientId} is always available. If ID is available, but this field is null,
47
49
  * > you should try fetching the peer manually using {@link getPeer})
48
50
  */
49
- get recipient(): Peer;
51
+ get recipient(): Peer | null;
50
52
  /** ID of the peer who received the original star gift */
51
53
  get recipientId(): number;
52
54
  /** Date when the original star gift was sent */
@@ -83,6 +85,8 @@ export declare class StarGiftUnique {
83
85
  get ownerName(): string | null;
84
86
  get availabilityIssued(): number;
85
87
  get availabilityTotal(): number;
88
+ /** Number of stars this gift is up for resell for */
89
+ get resellPrice(): tl.Long | null;
86
90
  /** Model (i.e. the gift itself) of the unique star gift */
87
91
  get model(): StarGiftUniqueAttribute;
88
92
  /** Pattern of the unique star gift */
@@ -29,6 +29,10 @@ class StarGiftUniqueBackdrop {
29
29
  constructor(raw) {
30
30
  this.raw = raw;
31
31
  }
32
+ /** ID of the backdrop */
33
+ get id() {
34
+ return this.raw.backdropId;
35
+ }
32
36
  /** Rarity permille of the attribute */
33
37
  get permille() {
34
38
  return this.raw.rarityPermille;
@@ -74,10 +78,11 @@ class StarGiftUniqueOriginalDetails {
74
78
  /**
75
79
  * Peer who received the original star gift, if available
76
80
  *
77
- * > Note: {@link recipientId} is always available. If ID is available, but this field throws an error,
81
+ * > Note: {@link recipientId} is always available. If ID is available, but this field is null,
78
82
  * > you should try fetching the peer manually using {@link getPeer})
79
83
  */
80
84
  get recipient() {
85
+ if (!this._peers.has(this.raw.recipientId)) return null;
81
86
  return parsePeer(this.raw.recipientId, this._peers);
82
87
  }
83
88
  /** ID of the peer who received the original star gift */
@@ -93,6 +98,7 @@ class StarGiftUniqueOriginalDetails {
93
98
  return this.raw.message ?? null;
94
99
  }
95
100
  }
101
+ const StarGiftUniqueOriginalDetails$1 = /* @__PURE__ */ makeInspectable(StarGiftUniqueOriginalDetails);
96
102
  class StarGiftUnique {
97
103
  constructor(raw, _peers) {
98
104
  this.raw = raw;
@@ -148,12 +154,17 @@ class StarGiftUnique {
148
154
  get ownerName() {
149
155
  return this.raw.ownerName ?? null;
150
156
  }
157
+ // todo: merge into one property
151
158
  get availabilityIssued() {
152
159
  return this.raw.availabilityIssued;
153
160
  }
154
161
  get availabilityTotal() {
155
162
  return this.raw.availabilityTotal;
156
163
  }
164
+ /** Number of stars this gift is up for resell for */
165
+ get resellPrice() {
166
+ return this.raw.resellStars ?? null;
167
+ }
157
168
  /** Model (i.e. the gift itself) of the unique star gift */
158
169
  get model() {
159
170
  return new StarGiftUniqueAttribute(this._model);
@@ -186,5 +197,5 @@ export {
186
197
  StarGiftUnique$2 as StarGiftUnique,
187
198
  StarGiftUniqueAttribute$2 as StarGiftUniqueAttribute,
188
199
  StarGiftUniqueBackdrop$1 as StarGiftUniqueBackdrop,
189
- StarGiftUniqueOriginalDetails
200
+ StarGiftUniqueOriginalDetails$1 as StarGiftUniqueOriginalDetails
190
201
  };
@@ -5,6 +5,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
5
5
  }
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const Long = require("long");
8
9
  const errors = require("../../../types/errors.cjs");
9
10
  const typeAssertions = require("../../../utils/type-assertions.cjs");
10
11
  const inspectable = require("../../utils/inspectable.cjs");
@@ -73,9 +74,18 @@ class StarGift {
73
74
  }
74
75
  return {
75
76
  remains: this.raw.availabilityRemains,
76
- total: this.raw.availabilityTotal
77
+ total: this.raw.availabilityTotal,
78
+ resale: this.raw.availabilityResale ?? Long.ZERO
77
79
  };
78
80
  }
81
+ /** Floor price for the gift on the secondary market */
82
+ get resaleFloorPrice() {
83
+ return this.raw.resellMinStars ?? null;
84
+ }
85
+ /** Title of the gift */
86
+ get title() {
87
+ return this.raw.title ?? null;
88
+ }
79
89
  }
80
90
  const StarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGift);
81
91
  const StarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGift$1, ["sticker"]);
@@ -2,6 +2,7 @@ import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
3
  import { Message } from '../messages/message.js';
4
4
  import { InputPeerLike } from '../peers/peer.js';
5
+ import { default as Long } from 'long';
5
6
  export type InputStarGift = {
6
7
  /** ID of the message containing the gift */
7
8
  message: number | Message;
@@ -10,7 +11,7 @@ export type InputStarGift = {
10
11
  owner: InputPeerLike;
11
12
  /** ID of the gift */
12
13
  savedId: tl.Long;
13
- };
14
+ } | string;
14
15
  /**
15
16
  * A gift bought with stars
16
17
  */
@@ -51,5 +52,11 @@ export declare class StarGift {
51
52
  get availability(): {
52
53
  remains: number;
53
54
  total: number;
55
+ /** Number of gifts available on the secondary market */
56
+ resale: Long;
54
57
  } | null;
58
+ /** Floor price for the gift on the secondary market */
59
+ get resaleFloorPrice(): tl.Long | null;
60
+ /** Title of the gift */
61
+ get title(): string | null;
55
62
  }
@@ -2,6 +2,7 @@ import { tl } from '@mtcute/tl';
2
2
  import { Sticker } from '../media/sticker.js';
3
3
  import { Message } from '../messages/message.js';
4
4
  import { InputPeerLike } from '../peers/peer.js';
5
+ import { default as Long } from 'long';
5
6
  export type InputStarGift = {
6
7
  /** ID of the message containing the gift */
7
8
  message: number | Message;
@@ -10,7 +11,7 @@ export type InputStarGift = {
10
11
  owner: InputPeerLike;
11
12
  /** ID of the gift */
12
13
  savedId: tl.Long;
13
- };
14
+ } | string;
14
15
  /**
15
16
  * A gift bought with stars
16
17
  */
@@ -51,5 +52,11 @@ export declare class StarGift {
51
52
  get availability(): {
52
53
  remains: number;
53
54
  total: number;
55
+ /** Number of gifts available on the secondary market */
56
+ resale: Long;
54
57
  } | null;
58
+ /** Floor price for the gift on the secondary market */
59
+ get resaleFloorPrice(): tl.Long | null;
60
+ /** Title of the gift */
61
+ get title(): string | null;
55
62
  }
@@ -1,3 +1,4 @@
1
+ import Long from "long";
1
2
  import { MtTypeAssertionError } from "../../../types/errors.js";
2
3
  import { assertTypeIs } from "../../../utils/type-assertions.js";
3
4
  import { makeInspectable } from "../../utils/inspectable.js";
@@ -66,9 +67,18 @@ class StarGift {
66
67
  }
67
68
  return {
68
69
  remains: this.raw.availabilityRemains,
69
- total: this.raw.availabilityTotal
70
+ total: this.raw.availabilityTotal,
71
+ resale: this.raw.availabilityResale ?? Long.ZERO
70
72
  };
71
73
  }
74
+ /** Floor price for the gift on the secondary market */
75
+ get resaleFloorPrice() {
76
+ return this.raw.resellMinStars ?? null;
77
+ }
78
+ /** Title of the gift */
79
+ get title() {
80
+ return this.raw.title ?? null;
81
+ }
72
82
  }
73
83
  const StarGift$1 = /* @__PURE__ */ makeInspectable(StarGift);
74
84
  const StarGift$2 = /* @__PURE__ */ memoizeGetters(StarGift$1, ["sticker"]);
@@ -123,10 +123,16 @@ class StarsTransaction {
123
123
  peer: peer$1,
124
124
  gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
125
125
  };
126
+ } else if (this.raw.stargiftResale) {
127
+ return {
128
+ type: "star_gift_resale",
129
+ peer: peer$1,
130
+ gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
131
+ };
126
132
  } else {
127
133
  return {
128
134
  type: "star_gift_transfer",
129
- recepient: peer$1,
135
+ recipient: peer$1,
130
136
  gift: new starsGiftUnique.StarGiftUnique(this.raw.stargift, this.peers)
131
137
  };
132
138
  }
@@ -21,6 +21,7 @@ import { StarGift } from './stars-gift.js';
21
21
  * - `star_gift`: This transaction is either a star gift to a user (if outgoing), or converting a star gift to stars (if incoming)
22
22
  * - `star_gift_upgrade`: This transaction is for a star gift upgrade
23
23
  * - `star_gift_transfer`: This transaction is for a star gift transfer
24
+ * - `star_gift_resale`: This transaction is for a star gift resale
24
25
  * - `paid_message`: This transaction is a payment for a paid message
25
26
  * - `premium_gift`: This transaction is a payment for a premium gift to a user
26
27
  * - `api_*`: This transaction is a payment for paid API features
@@ -119,10 +120,16 @@ export type StarsTransactionType = {
119
120
  peer: Peer;
120
121
  /** The upgraded gift */
121
122
  gift: StarGiftUnique;
123
+ } | {
124
+ type: 'star_gift_resale';
125
+ /** Related peer */
126
+ peer: Peer;
127
+ /** The resold gift */
128
+ gift: StarGiftUnique;
122
129
  } | {
123
130
  type: 'star_gift_transfer';
124
- /** Recepient peer */
125
- recepient: Peer;
131
+ /** Recipient peer */
132
+ recipient: Peer;
126
133
  /** The upgraded gift */
127
134
  gift: StarGiftUnique;
128
135
  } | {
@@ -21,6 +21,7 @@ import { StarGift } from './stars-gift.js';
21
21
  * - `star_gift`: This transaction is either a star gift to a user (if outgoing), or converting a star gift to stars (if incoming)
22
22
  * - `star_gift_upgrade`: This transaction is for a star gift upgrade
23
23
  * - `star_gift_transfer`: This transaction is for a star gift transfer
24
+ * - `star_gift_resale`: This transaction is for a star gift resale
24
25
  * - `paid_message`: This transaction is a payment for a paid message
25
26
  * - `premium_gift`: This transaction is a payment for a premium gift to a user
26
27
  * - `api_*`: This transaction is a payment for paid API features
@@ -119,10 +120,16 @@ export type StarsTransactionType = {
119
120
  peer: Peer;
120
121
  /** The upgraded gift */
121
122
  gift: StarGiftUnique;
123
+ } | {
124
+ type: 'star_gift_resale';
125
+ /** Related peer */
126
+ peer: Peer;
127
+ /** The resold gift */
128
+ gift: StarGiftUnique;
122
129
  } | {
123
130
  type: 'star_gift_transfer';
124
- /** Recepient peer */
125
- recepient: Peer;
131
+ /** Recipient peer */
132
+ recipient: Peer;
126
133
  /** The upgraded gift */
127
134
  gift: StarGiftUnique;
128
135
  } | {
@@ -116,10 +116,16 @@ class StarsTransaction {
116
116
  peer,
117
117
  gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
118
118
  };
119
+ } else if (this.raw.stargiftResale) {
120
+ return {
121
+ type: "star_gift_resale",
122
+ peer,
123
+ gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
124
+ };
119
125
  } else {
120
126
  return {
121
127
  type: "star_gift_transfer",
122
- recepient: peer,
128
+ recipient: peer,
123
129
  gift: new StarGiftUnique$2(this.raw.stargift, this.peers)
124
130
  };
125
131
  }
@@ -41,6 +41,12 @@ class EmojiStatus {
41
41
  constructor(raw) {
42
42
  this.raw = raw;
43
43
  }
44
+ static fromTl(status) {
45
+ if (!status || status._ === "emojiStatusEmpty" || status._ === "inputEmojiStatusCollectible") {
46
+ return null;
47
+ }
48
+ return new EmojiStatus(status);
49
+ }
44
50
  /** ID of the custom emoji */
45
51
  get emoji() {
46
52
  return this.raw.documentId;
@@ -24,6 +24,7 @@ export declare class EmojiStatusCollectible {
24
24
  export declare class EmojiStatus {
25
25
  readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>;
26
26
  constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>);
27
+ static fromTl(status?: tl.TypeEmojiStatus): EmojiStatus | null;
27
28
  /** ID of the custom emoji */
28
29
  get emoji(): tl.Long;
29
30
  /** This status is valid at most until this date */
@@ -24,6 +24,7 @@ export declare class EmojiStatusCollectible {
24
24
  export declare class EmojiStatus {
25
25
  readonly raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>;
26
26
  constructor(raw: Exclude<tl.TypeEmojiStatus, tl.RawEmojiStatusEmpty | tl.RawInputEmojiStatusCollectible>);
27
+ static fromTl(status?: tl.TypeEmojiStatus): EmojiStatus | null;
27
28
  /** ID of the custom emoji */
28
29
  get emoji(): tl.Long;
29
30
  /** This status is valid at most until this date */
@@ -34,6 +34,12 @@ class EmojiStatus {
34
34
  constructor(raw) {
35
35
  this.raw = raw;
36
36
  }
37
+ static fromTl(status) {
38
+ if (!status || status._ === "emojiStatusEmpty" || status._ === "inputEmojiStatusCollectible") {
39
+ return null;
40
+ }
41
+ return new EmojiStatus(status);
42
+ }
37
43
  /** ID of the custom emoji */
38
44
  get emoji() {
39
45
  return this.raw.documentId;
@@ -7,6 +7,10 @@ export type ArrayPaginated<T, Offset> = T[] & {
7
7
  total: number;
8
8
  next?: Offset;
9
9
  };
10
+ export type ArrayPaginatedWithMeta<T, Offset, Meta> = T[] & {
11
+ total: number;
12
+ next?: Offset;
13
+ } & Meta;
10
14
  export type ParametersSkip1<T> = T extends (a: any, ...args: infer P) => any ? P : never;
11
15
  export type ParametersSkip2<T> = T extends (a: any, b: any, ...args: infer P) => any ? P : never;
12
16
  export type ParametersSkip3<T> = T extends (a: any, b: any, c: any, ...args: infer P) => any ? P : never;
@@ -7,6 +7,10 @@ export type ArrayPaginated<T, Offset> = T[] & {
7
7
  total: number;
8
8
  next?: Offset;
9
9
  };
10
+ export type ArrayPaginatedWithMeta<T, Offset, Meta> = T[] & {
11
+ total: number;
12
+ next?: Offset;
13
+ } & Meta;
10
14
  export type ParametersSkip1<T> = T extends (a: any, ...args: infer P) => any ? P : never;
11
15
  export type ParametersSkip2<T> = T extends (a: any, b: any, ...args: infer P) => any ? P : never;
12
16
  export type ParametersSkip3<T> = T extends (a: any, b: any, c: any, ...args: infer P) => any ? P : never;