@mtcute/core 0.21.0 → 0.21.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.
@@ -134,9 +134,9 @@ class BaseTelegramClient {
134
134
  this.log.prefix = "[USER n/a] ";
135
135
  await this.storage.self.store(null);
136
136
  const primaryDc = this.mt.network.getPrimaryDcId();
137
- for (const dc of this.mt.network.config.getCached()?.dcOptions ?? []) {
138
- if (dc.id === primaryDc) continue;
139
- await this.mt.storage.provider.authKeys.deleteByDc(dc.id);
137
+ for (const dcId of [1, 2, 3, 4, 5]) {
138
+ if (dcId === primaryDc) continue;
139
+ await this.mt.storage.provider.authKeys.deleteByDc(dcId);
140
140
  }
141
141
  }
142
142
  async notifyChannelOpened(channelId, pts) {
package/highlevel/base.js CHANGED
@@ -127,9 +127,9 @@ class BaseTelegramClient {
127
127
  this.log.prefix = "[USER n/a] ";
128
128
  await this.storage.self.store(null);
129
129
  const primaryDc = this.mt.network.getPrimaryDcId();
130
- for (const dc of this.mt.network.config.getCached()?.dcOptions ?? []) {
131
- if (dc.id === primaryDc) continue;
132
- await this.mt.storage.provider.authKeys.deleteByDc(dc.id);
130
+ for (const dcId of [1, 2, 3, 4, 5]) {
131
+ if (dcId === primaryDc) continue;
132
+ await this.mt.storage.provider.authKeys.deleteByDc(dcId);
133
133
  }
134
134
  }
135
135
  async notifyChannelOpened(channelId, pts) {
@@ -15,9 +15,15 @@ const inputMessageId = require("../../types/messages/input-message-id.cjs");
15
15
  const peersIndex = require("../../types/peers/peers-index.cjs");
16
16
  const messageReactions = require("../../types/messages/message-reactions.cjs");
17
17
  async function sendPaidReaction(client, params) {
18
- const { anonymous, count = 1 } = params;
18
+ const { anonymous, asPeer, count = 1 } = params;
19
19
  const { chatId, message } = inputMessageId.normalizeInputMessageId(params);
20
20
  const peer = await resolvePeer.resolvePeer(client, chatId);
21
+ let privacy;
22
+ if (anonymous !== void 0) {
23
+ privacy = { _: anonymous ? "paidReactionPrivacyAnonymous" : "paidReactionPrivacyDefault" };
24
+ } else if (asPeer) {
25
+ privacy = { _: "paidReactionPrivacyPeer", peer: await resolvePeer.resolvePeer(client, asPeer) };
26
+ }
21
27
  let res;
22
28
  for (let i = 0; i < 3; i++) {
23
29
  try {
@@ -26,7 +32,7 @@ async function sendPaidReaction(client, params) {
26
32
  peer,
27
33
  msgId: message,
28
34
  count,
29
- private: anonymous,
35
+ private: privacy,
30
36
  randomId: await client.getMtprotoMessageId()
31
37
  });
32
38
  break;
@@ -1,5 +1,5 @@
1
1
  import { ITelegramClient } from '../../client.types.js';
2
- import { InputMessageId, MessageReactions } from '../../types/index.js';
2
+ import { InputMessageId, InputPeerLike, MessageReactions } from '../../types/index.js';
3
3
  /**
4
4
  * Send a paid reaction using Telegram Stars.
5
5
  *
@@ -8,8 +8,14 @@ import { InputMessageId, MessageReactions } from '../../types/index.js';
8
8
  * The message is normally available for users, but may not be available for bots in PMs.
9
9
  */
10
10
  export declare function sendPaidReaction(client: ITelegramClient, params: InputMessageId & {
11
- /** Whether to send the reaction anonymously */
11
+ /**
12
+ * Whether to send the reaction anonymously
13
+ */
12
14
  anonymous?: boolean;
15
+ /**
16
+ * Peer as which to send the reaction, mutually exclusive with `anonymous`
17
+ */
18
+ asPeer?: InputPeerLike;
13
19
  /**
14
20
  * Number of reactions to send
15
21
  *
@@ -1,5 +1,5 @@
1
1
  import { ITelegramClient } from '../../client.types.js';
2
- import { InputMessageId, MessageReactions } from '../../types/index.js';
2
+ import { InputMessageId, InputPeerLike, MessageReactions } from '../../types/index.js';
3
3
  /**
4
4
  * Send a paid reaction using Telegram Stars.
5
5
  *
@@ -8,8 +8,14 @@ import { InputMessageId, MessageReactions } from '../../types/index.js';
8
8
  * The message is normally available for users, but may not be available for bots in PMs.
9
9
  */
10
10
  export declare function sendPaidReaction(client: ITelegramClient, params: InputMessageId & {
11
- /** Whether to send the reaction anonymously */
11
+ /**
12
+ * Whether to send the reaction anonymously
13
+ */
12
14
  anonymous?: boolean;
15
+ /**
16
+ * Peer as which to send the reaction, mutually exclusive with `anonymous`
17
+ */
18
+ asPeer?: InputPeerLike;
13
19
  /**
14
20
  * Number of reactions to send
15
21
  *
@@ -8,9 +8,15 @@ import { normalizeInputMessageId } from "../../types/messages/input-message-id.j
8
8
  import { PeersIndex } from "../../types/peers/peers-index.js";
9
9
  import { MessageReactions as MessageReactions$2 } from "../../types/messages/message-reactions.js";
10
10
  async function sendPaidReaction(client, params) {
11
- const { anonymous, count = 1 } = params;
11
+ const { anonymous, asPeer, count = 1 } = params;
12
12
  const { chatId, message } = normalizeInputMessageId(params);
13
13
  const peer = await resolvePeer(client, chatId);
14
+ let privacy;
15
+ if (anonymous !== void 0) {
16
+ privacy = { _: anonymous ? "paidReactionPrivacyAnonymous" : "paidReactionPrivacyDefault" };
17
+ } else if (asPeer) {
18
+ privacy = { _: "paidReactionPrivacyPeer", peer: await resolvePeer(client, asPeer) };
19
+ }
14
20
  let res;
15
21
  for (let i = 0; i < 3; i++) {
16
22
  try {
@@ -19,7 +25,7 @@ async function sendPaidReaction(client, params) {
19
25
  peer,
20
26
  msgId: message,
21
27
  count,
22
- private: anonymous,
28
+ private: privacy,
23
29
  randomId: await client.getMtprotoMessageId()
24
30
  });
25
31
  break;
@@ -152,6 +152,10 @@ class StarGiftUnique {
152
152
  get ownerAddress() {
153
153
  return this.raw.ownerAddress ?? null;
154
154
  }
155
+ /** TON address of the gift NFT */
156
+ get giftAddress() {
157
+ return this.raw.giftAddress ?? null;
158
+ }
155
159
  }
156
160
  const StarGiftUnique$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGiftUnique);
157
161
  const StarGiftUnique$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGiftUnique$1, ["model", "pattern", "backdrop", "originalDetails"]);
@@ -73,4 +73,6 @@ export declare class StarGiftUnique {
73
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
74
  /** TON address of the owner of the unique star gift */
75
75
  get ownerAddress(): string | null;
76
+ /** TON address of the gift NFT */
77
+ get giftAddress(): string | null;
76
78
  }
@@ -73,4 +73,6 @@ export declare class StarGiftUnique {
73
73
  get originalDetails(): StarGiftUniqueOriginalDetails | null;
74
74
  /** TON address of the owner of the unique star gift */
75
75
  get ownerAddress(): string | null;
76
+ /** TON address of the gift NFT */
77
+ get giftAddress(): string | null;
76
78
  }
@@ -145,6 +145,10 @@ class StarGiftUnique {
145
145
  get ownerAddress() {
146
146
  return this.raw.ownerAddress ?? null;
147
147
  }
148
+ /** TON address of the gift NFT */
149
+ get giftAddress() {
150
+ return this.raw.giftAddress ?? null;
151
+ }
148
152
  }
149
153
  const StarGiftUnique$1 = /* @__PURE__ */ makeInspectable(StarGiftUnique);
150
154
  const StarGiftUnique$2 = /* @__PURE__ */ memoizeGetters(StarGiftUnique$1, ["model", "pattern", "backdrop", "originalDetails"]);
@@ -220,7 +220,7 @@ class NetworkManager {
220
220
  _: "initConnection",
221
221
  deviceModel,
222
222
  systemVersion: "1.0",
223
- appVersion: "0.21.0",
223
+ appVersion: "0.21.1",
224
224
  systemLangCode: "en",
225
225
  langPack: "",
226
226
  // "langPacks are for official apps only"
@@ -213,7 +213,7 @@ class NetworkManager {
213
213
  _: "initConnection",
214
214
  deviceModel,
215
215
  systemVersion: "1.0",
216
- appVersion: "0.21.0",
216
+ appVersion: "0.21.1",
217
217
  systemLangCode: "en",
218
218
  langPack: "",
219
219
  // "langPacks are for official apps only"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/core",
3
3
  "type": "module",
4
- "version": "0.21.0",
4
+ "version": "0.21.1",
5
5
  "description": "Type-safe library for MTProto (Telegram API)",
6
6
  "license": "MIT",
7
7
  "scripts": {},
@@ -10,7 +10,7 @@
10
10
  "@fuman/net": "0.0.9",
11
11
  "@fuman/utils": "0.0.4",
12
12
  "@mtcute/file-id": "^0.19.0",
13
- "@mtcute/tl": "^198.0.0",
13
+ "@mtcute/tl": "^199.0.0",
14
14
  "@mtcute/tl-runtime": "^0.19.0",
15
15
  "@types/events": "3.0.0",
16
16
  "long": "5.2.3"