@ton/ton 15.1.0 → 15.2.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.
@@ -197,6 +197,11 @@ export declare class TonClient {
197
197
  */
198
198
  getContractState(address: Address): Promise<{
199
199
  balance: bigint;
200
+ extra_currencies: {
201
+ '@type': "extraCurrency";
202
+ id: number;
203
+ amount: string;
204
+ }[];
200
205
  state: "active" | "uninitialized" | "frozen";
201
206
  code: Buffer | null;
202
207
  data: Buffer | null;
@@ -235,6 +235,7 @@ class TonClient {
235
235
  let state = info.state;
236
236
  return {
237
237
  balance,
238
+ extra_currencies: info.extra_currencies,
238
239
  state,
239
240
  code: info.code !== '' ? Buffer.from(info.code, 'base64') : null,
240
241
  data: info.data !== '' ? Buffer.from(info.data, 'base64') : null,
@@ -340,6 +341,7 @@ function createProvider(client, address, init) {
340
341
  let state = await client.getContractState(address);
341
342
  let balance = state.balance;
342
343
  let last = state.lastTransaction ? { lt: BigInt(state.lastTransaction.lt), hash: Buffer.from(state.lastTransaction.hash, 'base64') } : null;
344
+ let ecMap = null;
343
345
  let storage;
344
346
  if (state.state === 'active') {
345
347
  storage = {
@@ -362,8 +364,15 @@ function createProvider(client, address, init) {
362
364
  else {
363
365
  throw Error('Unsupported state');
364
366
  }
367
+ if (state.extra_currencies.length > 0) {
368
+ ecMap = {};
369
+ for (let ec of state.extra_currencies) {
370
+ ecMap[ec.id] = BigInt(ec.amount);
371
+ }
372
+ }
365
373
  return {
366
374
  balance,
375
+ extracurrency: ecMap,
367
376
  last,
368
377
  state: storage,
369
378
  };
@@ -430,6 +439,7 @@ function createProvider(client, address, init) {
430
439
  value,
431
440
  bounce,
432
441
  sendMode: message.sendMode,
442
+ extracurrency: message.extracurrency,
433
443
  init: neededInit,
434
444
  body
435
445
  });
@@ -34,6 +34,17 @@ describeConditional('TonClient', () => {
34
34
  let wcShards = await client.getWorkchainShards(info.latestSeqno);
35
35
  console.log(info, shardInfo, wcShards);
36
36
  });
37
+ it('should get extra currency info', async () => {
38
+ // EC is rolled out only in testned yet
39
+ let testClient = new TonClient_1.TonClient({
40
+ endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC'
41
+ });
42
+ let testAddr = core_1.Address.parse("0:D36CFC9E0C57F43C1A719CB9F540ED87A694693AE1535B7654B645F52814AFD7");
43
+ let res = await testClient.getContractState(testAddr);
44
+ let expectedEc = res.extra_currencies.find(e => e.id == 100);
45
+ expect(expectedEc).not.toBeUndefined();
46
+ expect(BigInt(expectedEc.amount)).toBe(10000000n);
47
+ });
37
48
  it('should locate source/result tx', async () => {
38
49
  let source = core_1.Address.parse('UQDDT0TOC4PMp894jtCo3-d1-8ltSjXMX2EuWww_pCNibsUH');
39
50
  let createdLt = '37508996000002';
@@ -96,6 +96,7 @@ export declare class TonClient4 {
96
96
  account: {
97
97
  balance: {
98
98
  coins: string;
99
+ currencies: Record<string, string>;
99
100
  };
100
101
  state: {
101
102
  type: "uninit";
@@ -139,6 +140,7 @@ export declare class TonClient4 {
139
140
  account: {
140
141
  balance: {
141
142
  coins: string;
143
+ currencies: Record<string, string>;
142
144
  };
143
145
  state: {
144
146
  type: "uninit";
@@ -775,6 +777,7 @@ declare const parsedTransactionCodec: z.ZodObject<{
775
777
  }, "strip", z.ZodTypeAny, {
776
778
  status: "success" | "failed" | "pending";
777
779
  seqno: number | null;
780
+ amount: string;
778
781
  body: {
779
782
  type: "comment";
780
783
  comment: string;
@@ -785,12 +788,12 @@ declare const parsedTransactionCodec: z.ZodObject<{
785
788
  dest: string | null;
786
789
  bounced: boolean;
787
790
  kind: "out" | "in";
788
- amount: string;
789
791
  resolvedAddress: string;
790
792
  mentioned: string[];
791
793
  }, {
792
794
  status: "success" | "failed" | "pending";
793
795
  seqno: number | null;
796
+ amount: string;
794
797
  body: {
795
798
  type: "comment";
796
799
  comment: string;
@@ -801,7 +804,6 @@ declare const parsedTransactionCodec: z.ZodObject<{
801
804
  dest: string | null;
802
805
  bounced: boolean;
803
806
  kind: "out" | "in";
804
- amount: string;
805
807
  resolvedAddress: string;
806
808
  mentioned: string[];
807
809
  }>;
@@ -812,20 +814,20 @@ declare const parsedTransactionCodec: z.ZodObject<{
812
814
  kind: z.ZodLiteral<"ton">;
813
815
  amount: z.ZodString;
814
816
  }, "strip", z.ZodTypeAny, {
815
- kind: "ton";
816
817
  amount: string;
817
- }, {
818
818
  kind: "ton";
819
+ }, {
819
820
  amount: string;
821
+ kind: "ton";
820
822
  }>, z.ZodObject<{
821
823
  kind: z.ZodLiteral<"token">;
822
824
  amount: z.ZodString;
823
825
  }, "strip", z.ZodTypeAny, {
824
- kind: "token";
825
826
  amount: string;
826
- }, {
827
827
  kind: "token";
828
+ }, {
828
829
  amount: string;
830
+ kind: "token";
829
831
  }>]>, "many">;
830
832
  op: z.ZodOptional<z.ZodObject<{
831
833
  type: z.ZodUnion<[z.ZodLiteral<"jetton::excesses">, z.ZodLiteral<"jetton::transfer">, z.ZodLiteral<"jetton::transfer_notification">, z.ZodLiteral<"deposit">, z.ZodLiteral<"deposit::ok">, z.ZodLiteral<"withdraw">, z.ZodLiteral<"withdraw::all">, z.ZodLiteral<"withdraw::delayed">, z.ZodLiteral<"withdraw::ok">, z.ZodLiteral<"airdrop">]>;
@@ -839,11 +841,11 @@ declare const parsedTransactionCodec: z.ZodObject<{
839
841
  }>>;
840
842
  }, "strip", z.ZodTypeAny, {
841
843
  items: ({
842
- kind: "ton";
843
844
  amount: string;
845
+ kind: "ton";
844
846
  } | {
845
- kind: "token";
846
847
  amount: string;
848
+ kind: "token";
847
849
  })[];
848
850
  address: string;
849
851
  comment?: string | undefined;
@@ -853,11 +855,11 @@ declare const parsedTransactionCodec: z.ZodObject<{
853
855
  } | undefined;
854
856
  }, {
855
857
  items: ({
856
- kind: "ton";
857
858
  amount: string;
859
+ kind: "ton";
858
860
  } | {
859
- kind: "token";
860
861
  amount: string;
862
+ kind: "token";
861
863
  })[];
862
864
  address: string;
863
865
  comment?: string | undefined;
@@ -964,6 +966,7 @@ declare const parsedTransactionCodec: z.ZodObject<{
964
966
  parsed: {
965
967
  status: "success" | "failed" | "pending";
966
968
  seqno: number | null;
969
+ amount: string;
967
970
  body: {
968
971
  type: "comment";
969
972
  comment: string;
@@ -974,17 +977,16 @@ declare const parsedTransactionCodec: z.ZodObject<{
974
977
  dest: string | null;
975
978
  bounced: boolean;
976
979
  kind: "out" | "in";
977
- amount: string;
978
980
  resolvedAddress: string;
979
981
  mentioned: string[];
980
982
  };
981
983
  operation: {
982
984
  items: ({
983
- kind: "ton";
984
985
  amount: string;
986
+ kind: "ton";
985
987
  } | {
986
- kind: "token";
987
988
  amount: string;
989
+ kind: "token";
988
990
  })[];
989
991
  address: string;
990
992
  comment?: string | undefined;
@@ -1091,6 +1093,7 @@ declare const parsedTransactionCodec: z.ZodObject<{
1091
1093
  parsed: {
1092
1094
  status: "success" | "failed" | "pending";
1093
1095
  seqno: number | null;
1096
+ amount: string;
1094
1097
  body: {
1095
1098
  type: "comment";
1096
1099
  comment: string;
@@ -1101,17 +1104,16 @@ declare const parsedTransactionCodec: z.ZodObject<{
1101
1104
  dest: string | null;
1102
1105
  bounced: boolean;
1103
1106
  kind: "out" | "in";
1104
- amount: string;
1105
1107
  resolvedAddress: string;
1106
1108
  mentioned: string[];
1107
1109
  };
1108
1110
  operation: {
1109
1111
  items: ({
1110
- kind: "ton";
1111
1112
  amount: string;
1113
+ kind: "ton";
1112
1114
  } | {
1113
- kind: "token";
1114
1115
  amount: string;
1116
+ kind: "token";
1115
1117
  })[];
1116
1118
  address: string;
1117
1119
  comment?: string | undefined;
@@ -314,8 +314,17 @@ function createProvider(client, block, address, init) {
314
314
  else {
315
315
  throw Error('Unsupported state');
316
316
  }
317
+ let ecMap = null;
318
+ if (state.account.balance.currencies) {
319
+ ecMap = {};
320
+ let currencies = state.account.balance.currencies;
321
+ for (let [k, v] of Object.entries(currencies)) {
322
+ ecMap[Number(k)] = BigInt(v);
323
+ }
324
+ }
317
325
  return {
318
326
  balance: BigInt(state.account.balance.coins),
327
+ extracurrency: ecMap,
319
328
  last: last,
320
329
  state: storage
321
330
  };
@@ -390,6 +399,7 @@ function createProvider(client, block, address, init) {
390
399
  await via.send({
391
400
  to: address,
392
401
  value,
402
+ extracurrency: message.extracurrency,
393
403
  bounce,
394
404
  sendMode: message.sendMode,
395
405
  init: neededInit,
@@ -491,7 +501,8 @@ const accountCodec = zod_1.z.object({
491
501
  zod_1.z.object({ type: zod_1.z.literal('frozen'), stateHash: zod_1.z.string() })
492
502
  ]),
493
503
  balance: zod_1.z.object({
494
- coins: zod_1.z.string()
504
+ coins: zod_1.z.string(),
505
+ currencies: zod_1.z.record(zod_1.z.string(), zod_1.z.string())
495
506
  }),
496
507
  last: zod_1.z.union([
497
508
  zod_1.z.null(),
@@ -518,7 +529,8 @@ const accountLiteCodec = zod_1.z.object({
518
529
  zod_1.z.object({ type: zod_1.z.literal('frozen'), stateHash: zod_1.z.string() })
519
530
  ]),
520
531
  balance: zod_1.z.object({
521
- coins: zod_1.z.string()
532
+ coins: zod_1.z.string(),
533
+ currencies: zod_1.z.record(zod_1.z.string(), zod_1.z.string())
522
534
  }),
523
535
  last: zod_1.z.union([
524
536
  zod_1.z.null(),
@@ -35,6 +35,31 @@ describeConditional('TonClient', () => {
35
35
  let result = await client.getBlock(seqno);
36
36
  console.log(result);
37
37
  });
38
+ it('should get extra currency info', async () => {
39
+ let testAddresses = [
40
+ "-1:0000000000000000000000000000000000000000000000000000000000000000",
41
+ "0:C4CAC12F5BC7EEF4CF5EC84EE68CCF860921A06CA0395EC558E53E37B13C3B08",
42
+ "0:F5FFA780ACEE2A41663C1E32F50D771327275A42FC9D3FAB4F4D9CDE11CCA897"
43
+ ].map(a => core_1.Address.parse(a));
44
+ let knownEc = [239, 4294967279];
45
+ let expectedEc = [
46
+ { 239: 663333333334n, 4294967279: 998444444446n },
47
+ { 239: 989097920n },
48
+ { 239: 666666666n, 4294967279: 777777777n }
49
+ ];
50
+ for (let i = 0; i < testAddresses.length; i++) {
51
+ let res = await (0, time_1.backoff)(async () => await client.getAccount(seqno, testAddresses[i]), false);
52
+ let resLite = await (0, time_1.backoff)(async () => await client.getAccountLite(seqno, testAddresses[i]), false);
53
+ let expected = expectedEc[i];
54
+ for (let testEc of knownEc) {
55
+ let expCur = expected[testEc];
56
+ if (expCur) {
57
+ expect(BigInt(res.account.balance.currencies[testEc])).toEqual(expCur);
58
+ expect(BigInt(resLite.account.balance.currencies[testEc])).toEqual(expCur);
59
+ }
60
+ }
61
+ }
62
+ });
38
63
  it('should run method', async () => {
39
64
  let result = await client.runMethod(seqno, testAddress, 'seqno');
40
65
  console.log(result);
@@ -440,6 +440,11 @@ 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
+ }[];
443
448
  state: "active" | "uninitialized" | "frozen";
444
449
  last_transaction_id: {
445
450
  '@type': "internal.transactionId";
@@ -26,6 +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({
30
+ '@type': zod_1.z.literal("extraCurrency"),
31
+ id: zod_1.z.number(),
32
+ amount: zod_1.z.string()
33
+ })),
29
34
  state: zod_1.z.union([zod_1.z.literal('active'), zod_1.z.literal('uninitialized'), zod_1.z.literal('frozen')]),
30
35
  data: zod_1.z.string(),
31
36
  code: zod_1.z.string(),
@@ -0,0 +1,13 @@
1
+ import { OpenedContract } from '@ton/core';
2
+ import { WalletContractV5R1 } from '../wallets/v5r1/WalletContractV5R1';
3
+ import { WalletContractV5Beta } from '../wallets/v5beta/WalletContractV5Beta';
4
+ import { WalletContractV4 } from '../wallets/WalletContractV4';
5
+ import { WalletContractV3R2 } from '../wallets/WalletContractV3R2';
6
+ import { WalletContractV3R1 } from '../wallets/WalletContractV3R1';
7
+ import { WalletContractV2R2 } from '../wallets/WalletContractV2R2';
8
+ import { WalletContractV2R1 } from '../wallets/WalletContractV2R1';
9
+ import { WalletContractV1R2 } from '../wallets/WalletContractV1R2';
10
+ import { WalletContractV1R1 } from '../wallets/WalletContractV1R1';
11
+ type WalletContract = WalletContractV5R1 | WalletContractV5Beta | WalletContractV4 | WalletContractV3R2 | WalletContractV3R1 | WalletContractV2R2 | WalletContractV2R1 | WalletContractV1R2 | WalletContractV1R1;
12
+ export declare const tillNextSeqno: (wallet: OpenedContract<WalletContract>, oldSeqno: number, maxTries?: number) => Promise<void>;
13
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tillNextSeqno = void 0;
4
+ const tillNextSeqno = async (wallet, oldSeqno, maxTries = 10) => {
5
+ let seqNoAfter = oldSeqno;
6
+ let tried = 0;
7
+ do {
8
+ await new Promise((resolve, reject) => {
9
+ setTimeout(resolve, 2000);
10
+ });
11
+ seqNoAfter = await wallet.getSeqno();
12
+ if (tried++ > maxTries) {
13
+ throw Error("To many retries, transaction likely failed!");
14
+ }
15
+ } while (seqNoAfter == oldSeqno);
16
+ };
17
+ exports.tillNextSeqno = tillNextSeqno;
@@ -87,6 +87,7 @@ class WalletContractV1R1 {
87
87
  message: (0, core_1.internal)({
88
88
  to: args.to,
89
89
  value: args.value,
90
+ extracurrency: args.extracurrency,
90
91
  init: args.init,
91
92
  body: args.body,
92
93
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV1R1_1 = require("./WalletContractV1R1");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV1R1', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV1R1', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perform extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV1R1_1.WalletContractV1R1.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ message: (0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.01',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v1r1!'
61
+ })
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -88,6 +88,7 @@ class WalletContractV1R2 {
88
88
  message: (0, core_1.internal)({
89
89
  to: args.to,
90
90
  value: args.value,
91
+ extracurrency: args.extracurrency,
91
92
  init: args.init,
92
93
  body: args.body,
93
94
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV1R2_1 = require("./WalletContractV1R2");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV1R2', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV1R2', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perform extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV1R2_1.WalletContractV1R2.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ message: (0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.01',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v1r2!'
61
+ })
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -89,6 +89,7 @@ class WalletContractV2R1 {
89
89
  messages: [(0, core_1.internal)({
90
90
  to: args.to,
91
91
  value: args.value,
92
+ extracurrency: args.extracurrency,
92
93
  init: args.init,
93
94
  body: args.body,
94
95
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV2R1_1 = require("./WalletContractV2R1");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV2R1', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV2R1', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perform extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV2R1_1.WalletContractV2R1.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ messages: [(0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.01',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v2r1!'
61
+ })]
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -89,6 +89,7 @@ class WalletContractV2R2 {
89
89
  messages: [(0, core_1.internal)({
90
90
  to: args.to,
91
91
  value: args.value,
92
+ extracurrency: args.extracurrency,
92
93
  init: args.init,
93
94
  body: args.body,
94
95
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV2R2_1 = require("./WalletContractV2R2");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV2R2', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV2R2', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perfrorm extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV2R2_1.WalletContractV2R2.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ messages: [(0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.01',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v2r2!'
61
+ })]
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -91,6 +91,7 @@ class WalletContractV3R1 {
91
91
  messages: [(0, core_1.internal)({
92
92
  to: args.to,
93
93
  value: args.value,
94
+ extracurrency: args.extracurrency,
94
95
  init: args.init,
95
96
  body: args.body,
96
97
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV3R1_1 = require("./WalletContractV3R1");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV3R1', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV3R1', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perform extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV3R1_1.WalletContractV3R1.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ messages: [(0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.05',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v3r1!'
61
+ })]
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -91,6 +91,7 @@ class WalletContractV3R2 {
91
91
  messages: [(0, core_1.internal)({
92
92
  to: args.to,
93
93
  value: args.value,
94
+ extracurrency: args.extracurrency,
94
95
  init: args.init,
95
96
  body: args.body,
96
97
  bounce: args.bounce
@@ -11,6 +11,7 @@ const randomTestKey_1 = require("../utils/randomTestKey");
11
11
  const createTestClient4_1 = require("../utils/createTestClient4");
12
12
  const core_1 = require("@ton/core");
13
13
  const WalletContractV3R2_1 = require("./WalletContractV3R2");
14
+ const testWallets_1 = require("../utils/testWallets");
14
15
  describe('WalletContractV3R1', () => {
15
16
  it('should has balance and correct address', async () => {
16
17
  // Create contract
@@ -40,5 +41,27 @@ describe('WalletContractV3R1', () => {
40
41
  });
41
42
  // Perform transfer
42
43
  await contract.send(transfer);
44
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
45
+ });
46
+ it('should perform extra currency transfer', async () => {
47
+ // Create contract
48
+ let client = (0, createTestClient4_1.createTestClient4)();
49
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
50
+ let contract = client.open(WalletContractV3R2_1.WalletContractV3R2.create({ workchain: 0, publicKey: key.publicKey }));
51
+ // Prepare transfer
52
+ let seqno = await contract.getSeqno();
53
+ let transfer = contract.createTransfer({
54
+ seqno,
55
+ secretKey: key.secretKey,
56
+ messages: [(0, core_1.internal)({
57
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
58
+ value: '0.05',
59
+ extracurrency: { 100: BigInt(10 ** 6) },
60
+ body: 'Hello, extra currency v3r2!'
61
+ })]
62
+ });
63
+ // Perform transfer
64
+ await contract.send(transfer);
65
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
43
66
  });
44
67
  });
@@ -92,6 +92,7 @@ class WalletContractV4 {
92
92
  messages: [(0, core_1.internal)({
93
93
  to: args.to,
94
94
  value: args.value,
95
+ extracurrency: args.extracurrency,
95
96
  init: args.init,
96
97
  body: args.body,
97
98
  bounce: args.bounce
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const randomTestKey_1 = require("../utils/randomTestKey");
11
+ const testWallets_1 = require("../utils/testWallets");
11
12
  const WalletContractV4_1 = require("./WalletContractV4");
12
13
  const createTestClient4_1 = require("../utils/createTestClient4");
13
14
  const core_1 = require("@ton/core");
@@ -44,5 +45,29 @@ describe('WalletContractV4', () => {
44
45
  });
45
46
  // Perform transfer
46
47
  await contract.send(transfer);
48
+ // Awaiting update
49
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
50
+ });
51
+ it('should perform extra currency transfer', async () => {
52
+ // Create contract
53
+ let client = (0, createTestClient4_1.createTestClient4)();
54
+ let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
55
+ let contract = client.open(WalletContractV4_1.WalletContractV4.create({ workchain: 0, publicKey: key.publicKey }));
56
+ // Prepare transfer
57
+ let seqno = await contract.getSeqno();
58
+ let transfer = contract.createTransfer({
59
+ seqno,
60
+ secretKey: key.secretKey,
61
+ messages: [(0, core_1.internal)({
62
+ to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
63
+ value: '0.01',
64
+ extracurrency: { 100: BigInt(10 ** 6) },
65
+ body: 'Hello extra currency v4'
66
+ })]
67
+ });
68
+ // Perform transfer
69
+ await contract.send(transfer);
70
+ // Awaiting update
71
+ await (0, testWallets_1.tillNextSeqno)(contract, seqno);
47
72
  });
48
73
  });
@@ -193,6 +193,7 @@ class WalletContractV5Beta {
193
193
  messages: [(0, core_1.internal)({
194
194
  to: args.to,
195
195
  value: args.value,
196
+ extracurrency: args.extracurrency,
196
197
  init: args.init,
197
198
  body: args.body,
198
199
  bounce: args.bounce
@@ -12,6 +12,7 @@ const core_1 = require("@ton/core");
12
12
  const WalletContractV5Beta_1 = require("./WalletContractV5Beta");
13
13
  const crypto_1 = require("@ton/crypto");
14
14
  const createTestClient4_1 = require("../../utils/createTestClient4");
15
+ const testWallets_1 = require("../../utils/testWallets");
15
16
  const getExtensionsArray = async (wallet) => {
16
17
  try {
17
18
  return await wallet.getExtensionsArray();
@@ -52,6 +53,24 @@ describe('WalletContractV5Beta', () => {
52
53
  })]
53
54
  });
54
55
  await wallet.send(transfer);
56
+ await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
57
+ });
58
+ it('should perform extra currency transfer', async () => {
59
+ const seqno = await wallet.getSeqno();
60
+ const transfer = wallet.createTransfer({
61
+ seqno,
62
+ secretKey: walletKey.secretKey,
63
+ sendMode: core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS,
64
+ messages: [(0, core_1.internal)({
65
+ bounce: false,
66
+ to: 'UQB-2r0kM28L4lmq-4V8ppQGcnO1tXC7FZmbnDzWZVBkp6jE',
67
+ value: '0.01',
68
+ extracurrency: { 100: BigInt(10 ** 6) },
69
+ body: 'Hello extra currency w5beta!'
70
+ })]
71
+ });
72
+ await wallet.send(transfer);
73
+ await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
55
74
  });
56
75
  it('should perform single transfer with async signing', async () => {
57
76
  const seqno = await wallet.getSeqno();
@@ -189,6 +189,7 @@ class WalletContractV5R1 {
189
189
  messages: [(0, core_1.internal)({
190
190
  to: args.to,
191
191
  value: args.value,
192
+ extracurrency: args.extracurrency,
192
193
  init: args.init,
193
194
  body: args.body,
194
195
  bounce: args.bounce
@@ -12,6 +12,7 @@ const core_1 = require("@ton/core");
12
12
  const crypto_1 = require("@ton/crypto");
13
13
  const createTestClient4_1 = require("../../utils/createTestClient4");
14
14
  const WalletContractV5R1_1 = require("./WalletContractV5R1");
15
+ const testWallets_1 = require("../../utils/testWallets");
15
16
  const getExtensionsArray = async (wallet) => {
16
17
  try {
17
18
  return await wallet.getExtensionsArray();
@@ -54,6 +55,24 @@ describe('WalletContractV5R1', () => {
54
55
  const sendMode = getTransferSendMode(transfer);
55
56
  expect(sendMode).toBe(core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS);
56
57
  await wallet.send(transfer);
58
+ await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
59
+ });
60
+ it('should perform extra currency transfer', async () => {
61
+ const seqno = await wallet.getSeqno();
62
+ const transfer = wallet.createTransfer({
63
+ seqno,
64
+ secretKey: walletKey.secretKey,
65
+ sendMode: core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS,
66
+ messages: [(0, core_1.internal)({
67
+ bounce: false,
68
+ to: 'UQB-2r0kM28L4lmq-4V8ppQGcnO1tXC7FZmbnDzWZVBkp6jE',
69
+ value: '0.01',
70
+ extracurrency: { 100: BigInt(10 ** 6) },
71
+ body: 'Hello extra currency w5r1!'
72
+ })]
73
+ });
74
+ await wallet.send(transfer);
75
+ await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
57
76
  });
58
77
  it('should perform single transfer with async signing', async () => {
59
78
  const seqno = await wallet.getSeqno();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/ton",
3
- "version": "15.1.0",
3
+ "version": "15.2.0",
4
4
  "repository": "https://github.com/ton-org/ton.git",
5
5
  "author": "Whales Corp. <developers@whalescorp.com>",
6
6
  "license": "MIT",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@release-it/keep-a-changelog": "^5.0.0",
19
- "@ton/core": "^0.59.0",
19
+ "@ton/core": "^0.60.0",
20
20
  "@ton/crypto": "3.2.0",
21
21
  "@ton/emulator": "^2.1.1",
22
22
  "@types/jest": "^27.0.1",
@@ -47,7 +47,7 @@
47
47
  "zod": "^3.21.4"
48
48
  },
49
49
  "peerDependencies": {
50
- "@ton/core": ">=0.59.0",
50
+ "@ton/core": ">=0.60.0",
51
51
  "@ton/crypto": ">=3.2.0"
52
52
  },
53
53
  "publishConfig": {