@ton/ton 13.11.0 → 13.11.2

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.
@@ -9,7 +9,7 @@
9
9
  import { HttpApi } from "./api/HttpApi";
10
10
  import { AxiosAdapter } from 'axios';
11
11
  import { Address, Cell, Contract, ContractProvider, Message, Transaction, TupleItem, TupleReader, StateInit, OpenedContract } from '@ton/core';
12
- export declare type TonClientParameters = {
12
+ export type TonClientParameters = {
13
13
  /**
14
14
  * API Endpoint
15
15
  */
@@ -94,6 +94,7 @@ export declare class TonClient {
94
94
  hash?: string;
95
95
  to_lt?: string;
96
96
  inclusive?: boolean;
97
+ archival?: boolean;
97
98
  }): Promise<Transaction[]>;
98
99
  /**
99
100
  * Get transaction by it's id
@@ -277,6 +277,8 @@ function parseStackEntry(s) {
277
277
  return { type: 'cell', cell: core_1.Cell.fromBase64(s.cell) };
278
278
  case 'tvm.stackEntryTuple':
279
279
  return { type: 'tuple', items: s.tuple.elements.map(parseStackEntry) };
280
+ case 'tvm.stackEntryList':
281
+ return { type: 'list', items: s.list.elements.map(parseStackEntry) };
280
282
  default:
281
283
  throw Error("Unsupported item type: " + s["@type"]);
282
284
  }
@@ -6,10 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  /// <reference types="node" />
9
- import { AxiosAdapter } from "axios";
9
+ import { AxiosAdapter, InternalAxiosRequestConfig } from "axios";
10
10
  import { Address, Contract, ContractProvider, OpenedContract, StateInit, Transaction, TupleItem, TupleReader } from "@ton/core";
11
11
  import { z } from 'zod';
12
- export declare type TonClient4Parameters = {
12
+ export type TonClient4Parameters = {
13
13
  /**
14
14
  * API endpoint
15
15
  */
@@ -22,6 +22,10 @@ export declare type TonClient4Parameters = {
22
22
  * HTTP Adapter for axios
23
23
  */
24
24
  httpAdapter?: AxiosAdapter;
25
+ /**
26
+ * HTTP request interceptor for axios
27
+ */
28
+ requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
25
29
  };
26
30
  export declare class TonClient4 {
27
31
  #private;
@@ -1118,8 +1122,8 @@ declare const parsedTransactionCodec: z.ZodObject<{
1118
1122
  } | undefined;
1119
1123
  };
1120
1124
  }>;
1121
- export declare type ParsedTransaction = z.infer<typeof parsedTransactionCodec>;
1122
- export declare type ParsedTransactions = {
1125
+ export type ParsedTransaction = z.infer<typeof parsedTransactionCodec>;
1126
+ export type ParsedTransactions = {
1123
1127
  blocks: z.infer<typeof blocksCodec>;
1124
1128
  transactions: ParsedTransaction[];
1125
1129
  };
@@ -20,7 +20,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
20
20
  var __importDefault = (this && this.__importDefault) || function (mod) {
21
21
  return (mod && mod.__esModule) ? mod : { "default": mod };
22
22
  };
23
- var _TonClient4_endpoint, _TonClient4_timeout, _TonClient4_adapter;
23
+ var _TonClient4_endpoint, _TonClient4_timeout, _TonClient4_adapter, _TonClient4_axios;
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.TonClient4 = void 0;
26
26
  const axios_1 = __importDefault(require("axios"));
@@ -32,16 +32,21 @@ class TonClient4 {
32
32
  _TonClient4_endpoint.set(this, void 0);
33
33
  _TonClient4_timeout.set(this, void 0);
34
34
  _TonClient4_adapter.set(this, void 0);
35
+ _TonClient4_axios.set(this, void 0);
36
+ __classPrivateFieldSet(this, _TonClient4_axios, axios_1.default.create(), "f");
35
37
  __classPrivateFieldSet(this, _TonClient4_endpoint, args.endpoint, "f");
36
38
  __classPrivateFieldSet(this, _TonClient4_timeout, args.timeout || 5000, "f");
37
39
  __classPrivateFieldSet(this, _TonClient4_adapter, args.httpAdapter, "f");
40
+ if (args.requestInterceptor) {
41
+ __classPrivateFieldGet(this, _TonClient4_axios, "f").interceptors.request.use(args.requestInterceptor);
42
+ }
38
43
  }
39
44
  /**
40
45
  * Get Last Block
41
46
  * @returns last block info
42
47
  */
43
48
  async getLastBlock() {
44
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/latest', { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
49
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/latest', { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
45
50
  let lastBlock = lastBlockCodec.safeParse(res.data);
46
51
  if (!lastBlock.success) {
47
52
  throw Error('Mailformed response: ' + lastBlock.error.format()._errors.join(', '));
@@ -54,7 +59,7 @@ class TonClient4 {
54
59
  * @returns block info
55
60
  */
56
61
  async getBlock(seqno) {
57
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
62
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
58
63
  let block = blockCodec.safeParse(res.data);
59
64
  if (!block.success) {
60
65
  throw Error('Mailformed response');
@@ -70,7 +75,7 @@ class TonClient4 {
70
75
  * @returns block info
71
76
  */
72
77
  async getBlockByUtime(ts) {
73
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/utime/' + ts, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
78
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/utime/' + ts, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
74
79
  let block = blockCodec.safeParse(res.data);
75
80
  if (!block.success) {
76
81
  throw Error('Mailformed response');
@@ -87,7 +92,7 @@ class TonClient4 {
87
92
  * @returns account info
88
93
  */
89
94
  async getAccount(seqno, address) {
90
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
95
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
91
96
  let account = accountCodec.safeParse(res.data);
92
97
  if (!account.success) {
93
98
  throw Error('Mailformed response');
@@ -101,7 +106,7 @@ class TonClient4 {
101
106
  * @returns account lite info
102
107
  */
103
108
  async getAccountLite(seqno, address) {
104
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }) + '/lite', { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
109
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }) + '/lite', { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
105
110
  let account = accountLiteCodec.safeParse(res.data);
106
111
  if (!account.success) {
107
112
  throw Error('Mailformed response');
@@ -125,7 +130,7 @@ class TonClient4 {
125
130
  * @returns account change info
126
131
  */
127
132
  async isAccountChanged(seqno, address, lt) {
128
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }) + '/changed/' + lt.toString(10), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
133
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }) + '/changed/' + lt.toString(10), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
129
134
  let changed = changedCodec.safeParse(res.data);
130
135
  if (!changed.success) {
131
136
  throw Error('Mailformed response');
@@ -140,7 +145,7 @@ class TonClient4 {
140
145
  * @returns unparsed transactions
141
146
  */
142
147
  async getAccountTransactions(address, lt, hash) {
143
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toString({ urlSafe: true }) + '/tx/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
148
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toString({ urlSafe: true }) + '/tx/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
144
149
  let transactions = transactionsCodec.safeParse(res.data);
145
150
  if (!transactions.success) {
146
151
  throw Error('Mailformed response');
@@ -165,7 +170,7 @@ class TonClient4 {
165
170
  * @returns parsed transactions
166
171
  */
167
172
  async getAccountTransactionsParsed(address, lt, hash, count = 20) {
168
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toString({ urlSafe: true }) + '/tx/parsed/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), {
173
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toString({ urlSafe: true }) + '/tx/parsed/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), {
169
174
  adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"),
170
175
  timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f"),
171
176
  params: {
@@ -189,7 +194,7 @@ class TonClient4 {
189
194
  if (ids && ids.length > 0) {
190
195
  tail = '/' + [...ids].sort().join(',');
191
196
  }
192
- let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/config' + tail, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
197
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/config' + tail, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
193
198
  let config = configCodec.safeParse(res.data);
194
199
  if (!config.success) {
195
200
  throw Error('Mailformed response');
@@ -207,7 +212,7 @@ class TonClient4 {
207
212
  async runMethod(seqno, address, name, args) {
208
213
  let tail = args && args.length > 0 ? '/' + (0, toUrlSafe_1.toUrlSafe)((0, core_1.serializeTuple)(args).toBoc({ idx: false, crc32: false }).toString('base64')) : '';
209
214
  let url = __classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/block/' + seqno + '/' + address.toString({ urlSafe: true }) + '/run/' + encodeURIComponent(name) + tail;
210
- let res = await axios_1.default.get(url, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
215
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").get(url, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
211
216
  let runMethod = runMethodCodec.safeParse(res.data);
212
217
  if (!runMethod.success) {
213
218
  throw Error('Mailformed response');
@@ -228,7 +233,7 @@ class TonClient4 {
228
233
  * @returns message status
229
234
  */
230
235
  async sendMessage(message) {
231
- let res = await axios_1.default.post(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/send', { boc: message.toString('base64') }, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
236
+ let res = await __classPrivateFieldGet(this, _TonClient4_axios, "f").post(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/send', { boc: message.toString('base64') }, { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") });
232
237
  let send = sendCodec.safeParse(res.data);
233
238
  if (!send.success) {
234
239
  throw Error('Mailformed response');
@@ -273,7 +278,7 @@ class TonClient4 {
273
278
  }
274
279
  }
275
280
  exports.TonClient4 = TonClient4;
276
- _TonClient4_endpoint = new WeakMap(), _TonClient4_timeout = new WeakMap(), _TonClient4_adapter = new WeakMap();
281
+ _TonClient4_endpoint = new WeakMap(), _TonClient4_timeout = new WeakMap(), _TonClient4_adapter = new WeakMap(), _TonClient4_axios = new WeakMap();
277
282
  function createProvider(client, block, address, init) {
278
283
  return {
279
284
  async getState() {
@@ -55,10 +55,9 @@ declare const message: z.ZodObject<{
55
55
  '@type': "msg.dataEncryptedText";
56
56
  text: string;
57
57
  }>]>;
58
- message: z.ZodString;
58
+ message: z.ZodOptional<z.ZodString>;
59
59
  }, "strip", z.ZodTypeAny, {
60
60
  value: string;
61
- message: string;
62
61
  fwd_fee: string;
63
62
  source: string;
64
63
  destination: string;
@@ -78,9 +77,9 @@ declare const message: z.ZodObject<{
78
77
  '@type': "msg.dataEncryptedText";
79
78
  text: string;
80
79
  };
80
+ message?: string | undefined;
81
81
  }, {
82
82
  value: string;
83
- message: string;
84
83
  fwd_fee: string;
85
84
  source: string;
86
85
  destination: string;
@@ -100,6 +99,7 @@ declare const message: z.ZodObject<{
100
99
  '@type': "msg.dataEncryptedText";
101
100
  text: string;
102
101
  };
102
+ message?: string | undefined;
103
103
  }>;
104
104
  declare const getTransactions: z.ZodArray<z.ZodObject<{
105
105
  data: z.ZodString;
@@ -162,10 +162,9 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
162
162
  '@type': "msg.dataEncryptedText";
163
163
  text: string;
164
164
  }>]>;
165
- message: z.ZodString;
165
+ message: z.ZodOptional<z.ZodString>;
166
166
  }, "strip", z.ZodTypeAny, {
167
167
  value: string;
168
- message: string;
169
168
  fwd_fee: string;
170
169
  source: string;
171
170
  destination: string;
@@ -185,9 +184,9 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
185
184
  '@type': "msg.dataEncryptedText";
186
185
  text: string;
187
186
  };
187
+ message?: string | undefined;
188
188
  }, {
189
189
  value: string;
190
- message: string;
191
190
  fwd_fee: string;
192
191
  source: string;
193
192
  destination: string;
@@ -207,6 +206,7 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
207
206
  '@type': "msg.dataEncryptedText";
208
207
  text: string;
209
208
  };
209
+ message?: string | undefined;
210
210
  }>]>;
211
211
  out_msgs: z.ZodArray<z.ZodObject<{
212
212
  source: z.ZodString;
@@ -253,10 +253,9 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
253
253
  '@type': "msg.dataEncryptedText";
254
254
  text: string;
255
255
  }>]>;
256
- message: z.ZodString;
256
+ message: z.ZodOptional<z.ZodString>;
257
257
  }, "strip", z.ZodTypeAny, {
258
258
  value: string;
259
- message: string;
260
259
  fwd_fee: string;
261
260
  source: string;
262
261
  destination: string;
@@ -276,9 +275,9 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
276
275
  '@type': "msg.dataEncryptedText";
277
276
  text: string;
278
277
  };
278
+ message?: string | undefined;
279
279
  }, {
280
280
  value: string;
281
- message: string;
282
281
  fwd_fee: string;
283
282
  source: string;
284
283
  destination: string;
@@ -298,6 +297,7 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
298
297
  '@type': "msg.dataEncryptedText";
299
298
  text: string;
300
299
  };
300
+ message?: string | undefined;
301
301
  }>, "many">;
302
302
  }, "strip", z.ZodTypeAny, {
303
303
  data: string;
@@ -311,7 +311,6 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
311
311
  other_fee: string;
312
312
  out_msgs: {
313
313
  value: string;
314
- message: string;
315
314
  fwd_fee: string;
316
315
  source: string;
317
316
  destination: string;
@@ -331,10 +330,10 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
331
330
  '@type': "msg.dataEncryptedText";
332
331
  text: string;
333
332
  };
333
+ message?: string | undefined;
334
334
  }[];
335
335
  in_msg?: {
336
336
  value: string;
337
- message: string;
338
337
  fwd_fee: string;
339
338
  source: string;
340
339
  destination: string;
@@ -354,6 +353,7 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
354
353
  '@type': "msg.dataEncryptedText";
355
354
  text: string;
356
355
  };
356
+ message?: string | undefined;
357
357
  } | undefined;
358
358
  }, {
359
359
  data: string;
@@ -367,7 +367,6 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
367
367
  other_fee: string;
368
368
  out_msgs: {
369
369
  value: string;
370
- message: string;
371
370
  fwd_fee: string;
372
371
  source: string;
373
372
  destination: string;
@@ -387,10 +386,10 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
387
386
  '@type': "msg.dataEncryptedText";
388
387
  text: string;
389
388
  };
389
+ message?: string | undefined;
390
390
  }[];
391
391
  in_msg?: {
392
392
  value: string;
393
- message: string;
394
393
  fwd_fee: string;
395
394
  source: string;
396
395
  destination: string;
@@ -410,10 +409,11 @@ declare const getTransactions: z.ZodArray<z.ZodObject<{
410
409
  '@type': "msg.dataEncryptedText";
411
410
  text: string;
412
411
  };
412
+ message?: string | undefined;
413
413
  } | undefined;
414
414
  }>, "many">;
415
- export declare type HTTPTransaction = z.TypeOf<typeof getTransactions>[number];
416
- export declare type HTTPMessage = z.TypeOf<typeof message>;
415
+ export type HTTPTransaction = z.TypeOf<typeof getTransactions>[number];
416
+ export type HTTPMessage = z.TypeOf<typeof message>;
417
417
  export interface HttpApiParameters {
418
418
  /**
419
419
  * HTTP request timeout in milliseconds.
@@ -463,6 +463,7 @@ export declare class HttpApi {
463
463
  hash?: string;
464
464
  to_lt?: string;
465
465
  inclusive?: boolean;
466
+ archival?: boolean;
466
467
  }): Promise<{
467
468
  data: string;
468
469
  storage_fee: string;
@@ -475,7 +476,6 @@ export declare class HttpApi {
475
476
  other_fee: string;
476
477
  out_msgs: {
477
478
  value: string;
478
- message: string;
479
479
  fwd_fee: string;
480
480
  source: string;
481
481
  destination: string;
@@ -495,10 +495,10 @@ export declare class HttpApi {
495
495
  '@type': "msg.dataEncryptedText";
496
496
  text: string;
497
497
  };
498
+ message?: string | undefined;
498
499
  }[];
499
500
  in_msg?: {
500
501
  value: string;
501
- message: string;
502
502
  fwd_fee: string;
503
503
  source: string;
504
504
  destination: string;
@@ -518,6 +518,7 @@ export declare class HttpApi {
518
518
  '@type': "msg.dataEncryptedText";
519
519
  text: string;
520
520
  };
521
+ message?: string | undefined;
521
522
  } | undefined;
522
523
  }[]>;
523
524
  getMasterchainInfo(): Promise<{
@@ -578,7 +579,6 @@ export declare class HttpApi {
578
579
  other_fee: string;
579
580
  out_msgs: {
580
581
  value: string;
581
- message: string;
582
582
  fwd_fee: string;
583
583
  source: string;
584
584
  destination: string;
@@ -598,10 +598,10 @@ export declare class HttpApi {
598
598
  '@type': "msg.dataEncryptedText";
599
599
  text: string;
600
600
  };
601
+ message?: string | undefined;
601
602
  }[];
602
603
  in_msg?: {
603
604
  value: string;
604
- message: string;
605
605
  fwd_fee: string;
606
606
  source: string;
607
607
  destination: string;
@@ -621,6 +621,7 @@ export declare class HttpApi {
621
621
  '@type': "msg.dataEncryptedText";
622
622
  text: string;
623
623
  };
624
+ message?: string | undefined;
624
625
  } | undefined;
625
626
  } | null>;
626
627
  callGetMethod(address: Address, method: string, stack: TupleItem[]): Promise<{
@@ -656,7 +657,6 @@ export declare class HttpApi {
656
657
  other_fee: string;
657
658
  out_msgs: {
658
659
  value: string;
659
- message: string;
660
660
  fwd_fee: string;
661
661
  source: string;
662
662
  destination: string;
@@ -676,10 +676,10 @@ export declare class HttpApi {
676
676
  '@type': "msg.dataEncryptedText";
677
677
  text: string;
678
678
  };
679
+ message?: string | undefined;
679
680
  }[];
680
681
  in_msg?: {
681
682
  value: string;
682
- message: string;
683
683
  fwd_fee: string;
684
684
  source: string;
685
685
  destination: string;
@@ -699,6 +699,7 @@ export declare class HttpApi {
699
699
  '@type': "msg.dataEncryptedText";
700
700
  text: string;
701
701
  };
702
+ message?: string | undefined;
702
703
  } | undefined;
703
704
  }>;
704
705
  tryLocateSourceTx(source: Address, destination: Address, created_lt: string): Promise<{
@@ -713,7 +714,6 @@ export declare class HttpApi {
713
714
  other_fee: string;
714
715
  out_msgs: {
715
716
  value: string;
716
- message: string;
717
717
  fwd_fee: string;
718
718
  source: string;
719
719
  destination: string;
@@ -733,10 +733,10 @@ export declare class HttpApi {
733
733
  '@type': "msg.dataEncryptedText";
734
734
  text: string;
735
735
  };
736
+ message?: string | undefined;
736
737
  }[];
737
738
  in_msg?: {
738
739
  value: string;
739
- message: string;
740
740
  fwd_fee: string;
741
741
  source: string;
742
742
  destination: string;
@@ -756,6 +756,7 @@ export declare class HttpApi {
756
756
  '@type': "msg.dataEncryptedText";
757
757
  text: string;
758
758
  };
759
+ message?: string | undefined;
759
760
  } | undefined;
760
761
  }>;
761
762
  private doCall;
@@ -82,7 +82,7 @@ const message = zod_1.z.object({
82
82
  created_lt: zod_1.z.string(),
83
83
  body_hash: zod_1.z.string(),
84
84
  msg_data: messageData,
85
- message: zod_1.z.string()
85
+ message: zod_1.z.string().optional()
86
86
  });
87
87
  const transaction = zod_1.z.object({
88
88
  data: zod_1.z.string(),
@@ -58,7 +58,7 @@ export declare function configParse17(slice: Slice | null | undefined): {
58
58
  minTotalStake: bigint;
59
59
  maxStakeFactor: number;
60
60
  };
61
- export declare type StoragePrices = {
61
+ export type StoragePrices = {
62
62
  utime_since: number;
63
63
  bit_price_ps: bigint;
64
64
  cell_price_ps: bigint;
@@ -84,7 +84,7 @@ export declare function configParse40(slice: Slice | null | undefined): {
84
84
  mediumProportionalMult: number;
85
85
  } | null;
86
86
  export declare function configParseWorkchainDescriptor(slice: Slice): WorkchainDescriptor;
87
- export declare type WorkchainDescriptor = {
87
+ export type WorkchainDescriptor = {
88
88
  enabledSince: number;
89
89
  actialMinSplit: number;
90
90
  min_split: number;
@@ -131,7 +131,7 @@ export declare function configParseBridge(slice: Slice | null | undefined): {
131
131
  oracles: Map<string, Buffer>;
132
132
  externalChainAddress: Buffer;
133
133
  } | null;
134
- export declare type GasLimitsPrices = ReturnType<typeof configParseGasLimitsPrices>;
134
+ export type GasLimitsPrices = ReturnType<typeof configParseGasLimitsPrices>;
135
135
  export declare function configParseGasLimitsPrices(slice: Slice | null | undefined): {
136
136
  flatLimit: bigint;
137
137
  flatGasPrice: bigint;
@@ -153,7 +153,7 @@ export declare function configParseGasLimitsPrices(slice: Slice | null | undefin
153
153
  specialGasLimit?: undefined;
154
154
  };
155
155
  };
156
- export declare type MsgPrices = ReturnType<typeof configParseMsgPrices>;
156
+ export type MsgPrices = ReturnType<typeof configParseMsgPrices>;
157
157
  export declare function configParseMsgPrices(slice: Slice | null | undefined): {
158
158
  lumpPrice: bigint;
159
159
  bitPrice: bigint;
@@ -27,14 +27,14 @@ const EntitiesDictValue = {
27
27
  }
28
28
  };
29
29
  class ElectorContract {
30
- constructor() {
31
- // Please note that we are NOT loading address from config to avoid mistake and send validator money to a wrong contract
32
- this.address = core_1.Address.parseRaw('-1:3333333333333333333333333333333333333333333333333333333333333333');
33
- }
34
30
  //readonly source: ContractSource = new UnknownContractSource('org.ton.elector', -1, 'Elector Contract');
35
31
  static create() {
36
32
  return new ElectorContract();
37
33
  }
34
+ constructor() {
35
+ // Please note that we are NOT loading address from config to avoid mistake and send validator money to a wrong contract
36
+ this.address = core_1.Address.parseRaw('-1:3333333333333333333333333333333333333333333333333333333333333333');
37
+ }
38
38
  async getReturnedStake(provider, address) {
39
39
  if (address.workChain !== -1) {
40
40
  throw Error('Only masterchain addresses could have stake');
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  export * from '@ton/core';
9
- export { HttpApi } from './client/api/HttpApi';
10
- export { TonClient } from './client/TonClient';
9
+ export { HttpApi, HttpApiParameters } from './client/api/HttpApi';
10
+ export { TonClient, TonClientParameters } from './client/TonClient';
11
11
  export { TonClient4, TonClient4Parameters } from './client/TonClient4';
12
12
  export { WalletContractV1R1 } from './wallets/WalletContractV1R1';
13
13
  export { WalletContractV1R2 } from './wallets/WalletContractV1R2';
package/dist/index.js CHANGED
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -10,12 +10,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.JettonMaster = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  class JettonMaster {
13
- constructor(address) {
14
- this.address = address;
15
- }
16
13
  static create(address) {
17
14
  return new JettonMaster(address);
18
15
  }
16
+ constructor(address) {
17
+ this.address = address;
18
+ }
19
19
  async getWalletAddress(provider, owner) {
20
20
  let res = await provider.get('get_wallet_address', [{ type: 'slice', cell: (0, core_1.beginCell)().storeAddress(owner).endCell() }]);
21
21
  return res.stack.readAddress();
@@ -9,12 +9,12 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.JettonWallet = void 0;
11
11
  class JettonWallet {
12
- constructor(address) {
13
- this.address = address;
14
- }
15
12
  static create(address) {
16
13
  return new JettonWallet(address);
17
14
  }
15
+ constructor(address) {
16
+ this.address = address;
17
+ }
18
18
  async getBalance(provider) {
19
19
  let state = await provider.getState();
20
20
  if (state.state.type !== 'active') {
@@ -5,4 +5,4 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- export declare type Maybe<T> = T | null | undefined;
8
+ export type Maybe<T> = T | null | undefined;
@@ -11,6 +11,9 @@ exports.WalletContractV1R1 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV1R1 {
14
+ static create(args) {
15
+ return new WalletContractV1R1(args.workchain, args.publicKey);
16
+ }
14
17
  constructor(workchain, publicKey) {
15
18
  this.workchain = workchain;
16
19
  this.publicKey = publicKey;
@@ -23,9 +26,6 @@ class WalletContractV1R1 {
23
26
  this.init = { code, data };
24
27
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
25
28
  }
26
- static create(args) {
27
- return new WalletContractV1R1(args.workchain, args.publicKey);
28
- }
29
29
  /**
30
30
  * Get Wallet Balance
31
31
  */
@@ -11,6 +11,9 @@ exports.WalletContractV1R2 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV1R2 {
14
+ static create(args) {
15
+ return new WalletContractV1R2(args.workchain, args.publicKey);
16
+ }
14
17
  constructor(workchain, publicKey) {
15
18
  this.workchain = workchain;
16
19
  this.publicKey = publicKey;
@@ -23,9 +26,6 @@ class WalletContractV1R2 {
23
26
  this.init = { code, data };
24
27
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
25
28
  }
26
- static create(args) {
27
- return new WalletContractV1R2(args.workchain, args.publicKey);
28
- }
29
29
  /**
30
30
  * Get Wallet Balance
31
31
  */
@@ -11,6 +11,9 @@ exports.WalletContractV1R3 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV1R3 {
14
+ static create(args) {
15
+ return new WalletContractV1R3(args.workchain, args.publicKey);
16
+ }
14
17
  constructor(workchain, publicKey) {
15
18
  this.workchain = workchain;
16
19
  this.publicKey = publicKey;
@@ -23,9 +26,6 @@ class WalletContractV1R3 {
23
26
  this.init = { code, data };
24
27
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
25
28
  }
26
- static create(args) {
27
- return new WalletContractV1R3(args.workchain, args.publicKey);
28
- }
29
29
  /**
30
30
  * Get Wallet Balance
31
31
  */
@@ -11,6 +11,9 @@ exports.WalletContractV2R1 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV2R1 {
14
+ static create(args) {
15
+ return new WalletContractV2R1(args.workchain, args.publicKey);
16
+ }
14
17
  constructor(workchain, publicKey) {
15
18
  this.workchain = workchain;
16
19
  this.publicKey = publicKey;
@@ -23,9 +26,6 @@ class WalletContractV2R1 {
23
26
  this.init = { code, data };
24
27
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
25
28
  }
26
- static create(args) {
27
- return new WalletContractV2R1(args.workchain, args.publicKey);
28
- }
29
29
  /**
30
30
  * Get Wallet Balance
31
31
  */
@@ -11,6 +11,9 @@ exports.WalletContractV2R2 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV2R2 {
14
+ static create(args) {
15
+ return new WalletContractV2R2(args.workchain, args.publicKey);
16
+ }
14
17
  constructor(workchain, publicKey) {
15
18
  this.workchain = workchain;
16
19
  this.publicKey = publicKey;
@@ -23,9 +26,6 @@ class WalletContractV2R2 {
23
26
  this.init = { code, data };
24
27
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
25
28
  }
26
- static create(args) {
27
- return new WalletContractV2R2(args.workchain, args.publicKey);
28
- }
29
29
  /**
30
30
  * Get Wallet Balance
31
31
  */
@@ -11,6 +11,9 @@ exports.WalletContractV3R1 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV3R1 {
14
+ static create(args) {
15
+ return new WalletContractV3R1(args.workchain, args.publicKey, args.walletId);
16
+ }
14
17
  constructor(workchain, publicKey, walletId) {
15
18
  // Resolve parameters
16
19
  this.workchain = workchain;
@@ -31,9 +34,6 @@ class WalletContractV3R1 {
31
34
  this.init = { code, data };
32
35
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
33
36
  }
34
- static create(args) {
35
- return new WalletContractV3R1(args.workchain, args.publicKey, args.walletId);
36
- }
37
37
  /**
38
38
  * Get wallet balance
39
39
  */
@@ -11,6 +11,9 @@ exports.WalletContractV3R2 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV3R2 {
14
+ static create(args) {
15
+ return new WalletContractV3R2(args.workchain, args.publicKey, args.walletId);
16
+ }
14
17
  constructor(workchain, publicKey, walletId) {
15
18
  // Resolve parameters
16
19
  this.workchain = workchain;
@@ -31,9 +34,6 @@ class WalletContractV3R2 {
31
34
  this.init = { code, data };
32
35
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
33
36
  }
34
- static create(args) {
35
- return new WalletContractV3R2(args.workchain, args.publicKey, args.walletId);
36
- }
37
37
  /**
38
38
  * Get wallet balance
39
39
  */
@@ -11,6 +11,9 @@ exports.WalletContractV4 = void 0;
11
11
  const core_1 = require("@ton/core");
12
12
  const createWalletTransfer_1 = require("./signing/createWalletTransfer");
13
13
  class WalletContractV4 {
14
+ static create(args) {
15
+ return new WalletContractV4(args.workchain, args.publicKey, args.walletId);
16
+ }
14
17
  constructor(workchain, publicKey, walletId) {
15
18
  // Resolve parameters
16
19
  this.workchain = workchain;
@@ -32,9 +35,6 @@ class WalletContractV4 {
32
35
  this.init = { code, data };
33
36
  this.address = (0, core_1.contractAddress)(workchain, { code, data });
34
37
  }
35
- static create(args) {
36
- return new WalletContractV4(args.workchain, args.publicKey, args.walletId);
37
- }
38
38
  /**
39
39
  * Get Wallet Balance
40
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/ton",
3
- "version": "13.11.0",
3
+ "version": "13.11.2",
4
4
  "repository": "https://github.com/ton-org/ton.git",
5
5
  "author": "Whales Corp. <developers@whalescorp.com>",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "release": "yarn build && yarn release-it --npm.yarn1"
16
16
  },
17
17
  "devDependencies": {
18
- "@release-it/keep-a-changelog": "^3.1.0",
18
+ "@release-it/keep-a-changelog": "^5.0.0",
19
19
  "@ton/core": "^0.56.0",
20
20
  "@ton/crypto": "3.2.0",
21
21
  "@ton/emulator": "^2.1.1",
@@ -31,7 +31,7 @@
31
31
  "karma-typescript": "^5.5.2",
32
32
  "karma-webpack": "^5.0.0",
33
33
  "prando": "^6.0.1",
34
- "release-it": "^15.5.1",
34
+ "release-it": "^17.1.1",
35
35
  "ts-jest": "^27.0.5",
36
36
  "ts-loader": "^9.2.5",
37
37
  "ts-node": "^10.7.0",
@@ -40,7 +40,7 @@
40
40
  "webpack": "^5.51.2"
41
41
  },
42
42
  "dependencies": {
43
- "axios": "^0.25.0",
43
+ "axios": "^1.6.7",
44
44
  "dataloader": "^2.0.0",
45
45
  "symbol.inspect": "1.0.1",
46
46
  "teslabot": "^1.3.0",