@ton/ton 15.0.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.
Files changed (62) hide show
  1. package/dist/client/TonClient.d.ts +5 -1
  2. package/dist/client/TonClient.js +14 -1
  3. package/dist/client/TonClient.spec.js +11 -0
  4. package/dist/client/TonClient4.d.ts +18 -17
  5. package/dist/client/TonClient4.js +17 -2
  6. package/dist/client/TonClient4.spec.js +25 -0
  7. package/dist/client/api/HttpApi.d.ts +5 -1
  8. package/dist/client/api/HttpApi.js +6 -1
  9. package/dist/config/ConfigParser.d.ts +0 -1
  10. package/dist/config/ConfigParser.js +25 -26
  11. package/dist/elector/ElectorContract.d.ts +0 -1
  12. package/dist/multisig/MultisigOrder.d.ts +0 -1
  13. package/dist/multisig/MultisigWallet.d.ts +0 -1
  14. package/dist/utils/createTestClient.js +1 -2
  15. package/dist/utils/createTestClient4.js +1 -2
  16. package/dist/utils/fees.js +5 -6
  17. package/dist/utils/fees.spec.js +1 -1
  18. package/dist/utils/randomTestKey.js +1 -2
  19. package/dist/utils/testWallets.d.ts +13 -0
  20. package/dist/utils/testWallets.js +17 -0
  21. package/dist/utils/time.js +5 -6
  22. package/dist/utils/toUrlSafe.js +1 -2
  23. package/dist/wallets/WalletContractV1R1.d.ts +0 -1
  24. package/dist/wallets/WalletContractV1R1.js +1 -0
  25. package/dist/wallets/WalletContractV1R1.spec.js +23 -0
  26. package/dist/wallets/WalletContractV1R2.d.ts +0 -1
  27. package/dist/wallets/WalletContractV1R2.js +1 -0
  28. package/dist/wallets/WalletContractV1R2.spec.js +23 -0
  29. package/dist/wallets/WalletContractV1R3.d.ts +0 -1
  30. package/dist/wallets/WalletContractV2R1.d.ts +0 -1
  31. package/dist/wallets/WalletContractV2R1.js +1 -0
  32. package/dist/wallets/WalletContractV2R1.spec.js +23 -0
  33. package/dist/wallets/WalletContractV2R2.d.ts +0 -1
  34. package/dist/wallets/WalletContractV2R2.js +1 -0
  35. package/dist/wallets/WalletContractV2R2.spec.js +23 -0
  36. package/dist/wallets/WalletContractV3R1.d.ts +0 -1
  37. package/dist/wallets/WalletContractV3R1.js +1 -0
  38. package/dist/wallets/WalletContractV3R1.spec.js +23 -0
  39. package/dist/wallets/WalletContractV3R2.d.ts +0 -1
  40. package/dist/wallets/WalletContractV3R2.js +1 -0
  41. package/dist/wallets/WalletContractV3R2.spec.js +23 -0
  42. package/dist/wallets/WalletContractV4.d.ts +0 -1
  43. package/dist/wallets/WalletContractV4.js +1 -0
  44. package/dist/wallets/WalletContractV4.spec.js +25 -0
  45. package/dist/wallets/signing/createWalletTransfer.d.ts +0 -1
  46. package/dist/wallets/signing/createWalletTransfer.js +6 -7
  47. package/dist/wallets/signing/singer.d.ts +0 -1
  48. package/dist/wallets/signing/singer.js +1 -2
  49. package/dist/wallets/v5beta/WalletContractV5Beta.d.ts +0 -1
  50. package/dist/wallets/v5beta/WalletContractV5Beta.js +1 -0
  51. package/dist/wallets/v5beta/WalletContractV5Beta.spec.js +19 -0
  52. package/dist/wallets/v5beta/WalletV5BetaActions.js +4 -5
  53. package/dist/wallets/v5beta/WalletV5BetaWalletId.d.ts +0 -1
  54. package/dist/wallets/v5beta/WalletV5BetaWalletId.js +2 -3
  55. package/dist/wallets/v5beta/WalletV5OutActions.js +2 -3
  56. package/dist/wallets/v5r1/WalletContractV5R1.d.ts +0 -1
  57. package/dist/wallets/v5r1/WalletContractV5R1.js +1 -0
  58. package/dist/wallets/v5r1/WalletContractV5R1.spec.js +19 -0
  59. package/dist/wallets/v5r1/WalletV5R1Actions.js +6 -7
  60. package/dist/wallets/v5r1/WalletV5R1WalletId.d.ts +0 -1
  61. package/dist/wallets/v5r1/WalletV5R1WalletId.js +3 -4
  62. package/package.json +4 -4
@@ -5,7 +5,6 @@
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
- /// <reference types="node" />
9
8
  import { Address, Cell, Contract, ContractProvider, MessageRelaxed, Sender, SendMode } from "@ton/core";
10
9
  import { Maybe } from "../../utils/maybe";
11
10
  import { SendArgsSignable, SendArgsSigned } from "../signing/singer";
@@ -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();
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadOutListExtendedV5Beta = exports.storeOutListExtendedV5Beta = exports.loadOutActionV5BetaExtended = exports.storeOutActionExtendedV5Beta = void 0;
3
+ exports.storeOutActionExtendedV5Beta = storeOutActionExtendedV5Beta;
4
+ exports.loadOutActionV5BetaExtended = loadOutActionV5BetaExtended;
5
+ exports.storeOutListExtendedV5Beta = storeOutListExtendedV5Beta;
6
+ exports.loadOutListExtendedV5Beta = loadOutListExtendedV5Beta;
4
7
  const core_1 = require("@ton/core");
5
8
  const WalletV5OutActions_1 = require("./WalletV5OutActions");
6
9
  const outActionSetIsPublicKeyEnabledTag = 0x20cbb95a;
@@ -33,7 +36,6 @@ function storeOutActionExtendedV5Beta(action) {
33
36
  throw new Error('Unknown action type' + action?.type);
34
37
  }
35
38
  }
36
- exports.storeOutActionExtendedV5Beta = storeOutActionExtendedV5Beta;
37
39
  function loadOutActionV5BetaExtended(slice) {
38
40
  const tag = slice.loadUint(32);
39
41
  switch (tag) {
@@ -56,7 +58,6 @@ function loadOutActionV5BetaExtended(slice) {
56
58
  throw new Error(`Unknown extended out action tag 0x${tag.toString(16)}`);
57
59
  }
58
60
  }
59
- exports.loadOutActionV5BetaExtended = loadOutActionV5BetaExtended;
60
61
  function storeOutListExtendedV5Beta(actions) {
61
62
  const [action, ...rest] = actions;
62
63
  if (!action || !(0, WalletV5OutActions_1.isOutActionExtended)(action)) {
@@ -75,7 +76,6 @@ function storeOutListExtendedV5Beta(actions) {
75
76
  .storeRef((0, core_1.beginCell)().store(storeOutListExtendedV5Beta(rest)).endCell());
76
77
  };
77
78
  }
78
- exports.storeOutListExtendedV5Beta = storeOutListExtendedV5Beta;
79
79
  function loadOutListExtendedV5Beta(slice) {
80
80
  const actions = [];
81
81
  while (slice.loadUint(1)) {
@@ -89,4 +89,3 @@ function loadOutListExtendedV5Beta(slice) {
89
89
  }
90
90
  return actions.concat(commonAction);
91
91
  }
92
- exports.loadOutListExtendedV5Beta = loadOutListExtendedV5Beta;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Builder, Slice } from '@ton/core';
3
2
  export interface WalletIdV5Beta {
4
3
  readonly walletVersion: 'v5';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeWalletIdV5Beta = exports.loadWalletIdV5Beta = void 0;
3
+ exports.loadWalletIdV5Beta = loadWalletIdV5Beta;
4
+ exports.storeWalletIdV5Beta = storeWalletIdV5Beta;
4
5
  const core_1 = require("@ton/core");
5
6
  const walletV5BetaVersionsSerialisation = {
6
7
  v5: 0
@@ -19,7 +20,6 @@ function loadWalletIdV5Beta(value) {
19
20
  }
20
21
  return { networkGlobalId, workchain, walletVersion, subwalletNumber };
21
22
  }
22
- exports.loadWalletIdV5Beta = loadWalletIdV5Beta;
23
23
  function storeWalletIdV5Beta(walletId) {
24
24
  return (builder) => {
25
25
  builder.storeInt(walletId.networkGlobalId, 32);
@@ -28,4 +28,3 @@ function storeWalletIdV5Beta(walletId) {
28
28
  builder.storeUint(walletId.subwalletNumber, 32);
29
29
  };
30
30
  }
31
- exports.storeWalletIdV5Beta = storeWalletIdV5Beta;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isOutActionBasic = exports.isOutActionExtended = void 0;
3
+ exports.isOutActionExtended = isOutActionExtended;
4
+ exports.isOutActionBasic = isOutActionBasic;
4
5
  function isOutActionExtended(action) {
5
6
  return (action.type === 'setIsPublicKeyEnabled' || action.type === 'addExtension' || action.type === 'removeExtension');
6
7
  }
7
- exports.isOutActionExtended = isOutActionExtended;
8
8
  function isOutActionBasic(action) {
9
9
  return !isOutActionExtended(action);
10
10
  }
11
- exports.isOutActionBasic = isOutActionBasic;
@@ -5,7 +5,6 @@
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
- /// <reference types="node" />
9
8
  import { Address, Cell, Contract, ContractProvider, MessageRelaxed, Sender, SendMode } from "@ton/core";
10
9
  import { Maybe } from "../../utils/maybe";
11
10
  import { SendArgsSignable, SendArgsSigned } from "../signing/singer";
@@ -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();
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patchV5R1ActionsSendMode = exports.toSafeV5R1SendMode = exports.loadOutListExtendedV5R1 = exports.storeOutListExtendedV5R1 = exports.loadOutActionExtendedV5R1 = exports.storeOutActionExtendedV5R1 = void 0;
3
+ exports.storeOutActionExtendedV5R1 = storeOutActionExtendedV5R1;
4
+ exports.loadOutActionExtendedV5R1 = loadOutActionExtendedV5R1;
5
+ exports.storeOutListExtendedV5R1 = storeOutListExtendedV5R1;
6
+ exports.loadOutListExtendedV5R1 = loadOutListExtendedV5R1;
7
+ exports.toSafeV5R1SendMode = toSafeV5R1SendMode;
8
+ exports.patchV5R1ActionsSendMode = patchV5R1ActionsSendMode;
4
9
  const core_1 = require("@ton/core");
5
10
  const WalletV5OutActions_1 = require("../v5beta/WalletV5OutActions");
6
11
  const outActionSetIsPublicKeyEnabledTag = 0x04;
@@ -33,7 +38,6 @@ function storeOutActionExtendedV5R1(action) {
33
38
  throw new Error('Unknown action type' + action?.type);
34
39
  }
35
40
  }
36
- exports.storeOutActionExtendedV5R1 = storeOutActionExtendedV5R1;
37
41
  function loadOutActionExtendedV5R1(slice) {
38
42
  const tag = slice.loadUint(8);
39
43
  switch (tag) {
@@ -56,7 +60,6 @@ function loadOutActionExtendedV5R1(slice) {
56
60
  throw new Error(`Unknown extended out action tag 0x${tag.toString(16)}`);
57
61
  }
58
62
  }
59
- exports.loadOutActionExtendedV5R1 = loadOutActionExtendedV5R1;
60
63
  function storeOutListExtendedV5R1(actions) {
61
64
  const extendedActions = actions.filter(WalletV5OutActions_1.isOutActionExtended);
62
65
  const basicActions = actions.filter(WalletV5OutActions_1.isOutActionBasic);
@@ -77,7 +80,6 @@ function storeOutListExtendedV5R1(actions) {
77
80
  }
78
81
  };
79
82
  }
80
- exports.storeOutListExtendedV5R1 = storeOutListExtendedV5R1;
81
83
  function packExtendedActionsRec(extendedActions) {
82
84
  const [first, ...rest] = extendedActions;
83
85
  let builder = (0, core_1.beginCell)()
@@ -108,7 +110,6 @@ function loadOutListExtendedV5R1(slice) {
108
110
  }
109
111
  return actions;
110
112
  }
111
- exports.loadOutListExtendedV5R1 = loadOutListExtendedV5R1;
112
113
  /**
113
114
  * Safety rules -- actions of external messages must have +2 in the SendMode. Internal messages actions may have arbitrary SendMode.
114
115
  */
@@ -118,11 +119,9 @@ function toSafeV5R1SendMode(sendMode, authType) {
118
119
  }
119
120
  return sendMode | core_1.SendMode.IGNORE_ERRORS;
120
121
  }
121
- exports.toSafeV5R1SendMode = toSafeV5R1SendMode;
122
122
  function patchV5R1ActionsSendMode(actions, authType) {
123
123
  return actions.map(action => action.type === 'sendMsg' ? ({
124
124
  ...action,
125
125
  mode: toSafeV5R1SendMode(action.mode, authType)
126
126
  }) : action);
127
127
  }
128
- exports.patchV5R1ActionsSendMode = patchV5R1ActionsSendMode;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Builder, Slice } from '@ton/core';
3
2
  /**
4
3
  * schema:
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeWalletIdV5R1 = exports.loadWalletIdV5R1 = exports.isWalletIdV5R1ClientContext = void 0;
3
+ exports.isWalletIdV5R1ClientContext = isWalletIdV5R1ClientContext;
4
+ exports.loadWalletIdV5R1 = loadWalletIdV5R1;
5
+ exports.storeWalletIdV5R1 = storeWalletIdV5R1;
4
6
  const core_1 = require("@ton/core");
5
7
  function isWalletIdV5R1ClientContext(context) {
6
8
  return typeof context !== 'number';
7
9
  }
8
- exports.isWalletIdV5R1ClientContext = isWalletIdV5R1ClientContext;
9
10
  const walletV5R1VersionsSerialisation = {
10
11
  v5r1: 0
11
12
  };
@@ -45,7 +46,6 @@ function loadWalletIdV5R1(value, networkGlobalId) {
45
46
  };
46
47
  }
47
48
  }
48
- exports.loadWalletIdV5R1 = loadWalletIdV5R1;
49
49
  function storeWalletIdV5R1(walletId) {
50
50
  return (builder) => {
51
51
  let context;
@@ -66,4 +66,3 @@ function storeWalletIdV5R1(walletId) {
66
66
  return builder.storeInt(BigInt(walletId.networkGlobalId) ^ BigInt(context), 32);
67
67
  };
68
68
  }
69
- exports.storeWalletIdV5R1 = storeWalletIdV5R1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/ton",
3
- "version": "15.0.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.56.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",
@@ -36,7 +36,7 @@
36
36
  "ts-loader": "^9.2.5",
37
37
  "ts-node": "^10.7.0",
38
38
  "typedoc": "^0.23.24",
39
- "typescript": "^4.4.2",
39
+ "typescript": "^5.6.3",
40
40
  "webpack": "^5.51.2"
41
41
  },
42
42
  "dependencies": {
@@ -47,7 +47,7 @@
47
47
  "zod": "^3.21.4"
48
48
  },
49
49
  "peerDependencies": {
50
- "@ton/core": ">=0.56.0",
50
+ "@ton/core": ">=0.60.0",
51
51
  "@ton/crypto": ">=3.2.0"
52
52
  },
53
53
  "publishConfig": {