@ton/ton 15.2.0 → 15.3.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.
@@ -201,7 +201,7 @@ export declare class TonClient {
201
201
  '@type': "extraCurrency";
202
202
  id: number;
203
203
  amount: string;
204
- }[];
204
+ }[] | undefined;
205
205
  state: "active" | "uninitialized" | "frozen";
206
206
  code: Buffer | null;
207
207
  data: Buffer | null;
@@ -364,7 +364,7 @@ function createProvider(client, address, init) {
364
364
  else {
365
365
  throw Error('Unsupported state');
366
366
  }
367
- if (state.extra_currencies.length > 0) {
367
+ if (state.extra_currencies && state.extra_currencies.length > 0) {
368
368
  ecMap = {};
369
369
  for (let ec of state.extra_currencies) {
370
370
  ecMap[ec.id] = BigInt(ec.amount);
@@ -5,7 +5,7 @@ const TonClient_1 = require("./TonClient");
5
5
  let describeConditional = process.env.TEST_CLIENTS ? describe : describe.skip;
6
6
  describeConditional('TonClient', () => {
7
7
  let client = new TonClient_1.TonClient({
8
- endpoint: 'https://mainnet.tonhubapi.com/jsonRPC',
8
+ endpoint: 'https://toncenter.com/api/v2/jsonRPC',
9
9
  });
10
10
  const testAddress = core_1.Address.parse('EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N');
11
11
  it('should get contract state', async () => {
@@ -34,6 +34,9 @@ describeConditional('TonClient', () => {
34
34
  let wcShards = await client.getWorkchainShards(info.latestSeqno);
35
35
  console.log(info, shardInfo, wcShards);
36
36
  });
37
+ it('should check contract is deployed', async () => {
38
+ expect(await client.isContractDeployed(testAddress)).toBe(true);
39
+ });
37
40
  it('should get extra currency info', async () => {
38
41
  // EC is rolled out only in testned yet
39
42
  let testClient = new TonClient_1.TonClient({
@@ -41,7 +44,7 @@ describeConditional('TonClient', () => {
41
44
  });
42
45
  let testAddr = core_1.Address.parse("0:D36CFC9E0C57F43C1A719CB9F540ED87A694693AE1535B7654B645F52814AFD7");
43
46
  let res = await testClient.getContractState(testAddr);
44
- let expectedEc = res.extra_currencies.find(e => e.id == 100);
47
+ let expectedEc = res.extra_currencies?.find(e => e.id == 100);
45
48
  expect(expectedEc).not.toBeUndefined();
46
49
  expect(BigInt(expectedEc.amount)).toBe(10000000n);
47
50
  });
@@ -118,7 +118,7 @@ export declare class TonClient4 {
118
118
  used: {
119
119
  bits: number;
120
120
  cells: number;
121
- publicCells: number;
121
+ publicCells?: number | undefined;
122
122
  };
123
123
  } | null;
124
124
  };
@@ -162,7 +162,7 @@ export declare class TonClient4 {
162
162
  used: {
163
163
  bits: number;
164
164
  cells: number;
165
- publicCells: number;
165
+ publicCells?: number | undefined;
166
166
  };
167
167
  } | null;
168
168
  };
@@ -490,7 +490,7 @@ const storageStatCodec = zod_1.z.object({
490
490
  used: zod_1.z.object({
491
491
  bits: zod_1.z.number(),
492
492
  cells: zod_1.z.number(),
493
- publicCells: zod_1.z.number()
493
+ publicCells: zod_1.z.number().optional()
494
494
  })
495
495
  });
496
496
  const accountCodec = zod_1.z.object({
@@ -440,11 +440,6 @@ export declare class HttpApi {
440
440
  data: string;
441
441
  code: string;
442
442
  balance: string | number;
443
- extra_currencies: {
444
- '@type': "extraCurrency";
445
- id: number;
446
- amount: string;
447
- }[];
448
443
  state: "active" | "uninitialized" | "frozen";
449
444
  last_transaction_id: {
450
445
  '@type': "internal.transactionId";
@@ -460,6 +455,11 @@ export declare class HttpApi {
460
455
  file_hash: string;
461
456
  };
462
457
  sync_utime: number;
458
+ extra_currencies?: {
459
+ '@type': "extraCurrency";
460
+ id: number;
461
+ amount: string;
462
+ }[] | undefined;
463
463
  }>;
464
464
  getTransactions(address: Address, opts: {
465
465
  limit: number;
@@ -26,11 +26,11 @@ const blockIdExt = zod_1.z.object({
26
26
  });
27
27
  const addressInformation = zod_1.z.object({
28
28
  balance: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
29
- extra_currencies: zod_1.z.array(zod_1.z.object({
29
+ extra_currencies: zod_1.z.optional(zod_1.z.array(zod_1.z.object({
30
30
  '@type': zod_1.z.literal("extraCurrency"),
31
31
  id: zod_1.z.number(),
32
32
  amount: zod_1.z.string()
33
- })),
33
+ }))),
34
34
  state: zod_1.z.union([zod_1.z.literal('active'), zod_1.z.literal('uninitialized'), zod_1.z.literal('frozen')]),
35
35
  data: zod_1.z.string(),
36
36
  code: zod_1.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/ton",
3
- "version": "15.2.0",
3
+ "version": "15.3.0",
4
4
  "repository": "https://github.com/ton-org/ton.git",
5
5
  "author": "Whales Corp. <developers@whalescorp.com>",
6
6
  "license": "MIT",