@ton/sandbox 0.23.0 → 0.25.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.
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export { Treasury, TreasuryContract, } from './treasury/Treasury';
10
10
  export { prettyLogTransaction, prettyLogTransactions, } from './utils/prettyLogTransaction';
11
11
  export { printTransactionFees, } from './utils/printTransactionFees';
12
12
  export { internal, } from './utils/message';
13
+ export { ExtraCurrency, } from './utils/ec';
@@ -0,0 +1,6 @@
1
+ import { Dictionary } from "@ton/core";
2
+ export type ExtraCurrency = {
3
+ [key: number]: bigint;
4
+ };
5
+ export declare function extractEc(cc: Dictionary<number, bigint>): ExtraCurrency;
6
+ export declare function packEc(ec: Iterable<[number, bigint]>): Dictionary<number, bigint>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packEc = exports.extractEc = void 0;
4
+ const core_1 = require("@ton/core");
5
+ function extractEc(cc) {
6
+ const r = {};
7
+ for (const [k, v] of cc) {
8
+ r[k] = v;
9
+ }
10
+ return r;
11
+ }
12
+ exports.extractEc = extractEc;
13
+ function packEc(ec) {
14
+ const r = core_1.Dictionary.empty(core_1.Dictionary.Keys.Uint(32), core_1.Dictionary.Values.BigVarUint(5));
15
+ for (const [k, v] of ec) {
16
+ r.set(k, v);
17
+ }
18
+ return r;
19
+ }
20
+ exports.packEc = packEc;
@@ -1,4 +1,5 @@
1
- import { Address, Cell, Message, StateInit } from "@ton/core";
1
+ import { Address, Cell, Dictionary, Message, StateInit } from "@ton/core";
2
+ import { ExtraCurrency } from "./ec";
2
3
  /**
3
4
  * Creates {@link Message} from params.
4
5
  */
@@ -15,4 +16,5 @@ export declare function internal(params: {
15
16
  forwardFee?: bigint;
16
17
  createdAt?: number;
17
18
  createdLt?: bigint;
19
+ ec?: Dictionary<number, bigint> | [number, bigint][] | ExtraCurrency;
18
20
  }): Message;
@@ -2,16 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.internal = void 0;
4
4
  const core_1 = require("@ton/core");
5
+ const ec_1 = require("./ec");
5
6
  /**
6
7
  * Creates {@link Message} from params.
7
8
  */
8
9
  function internal(params) {
10
+ let ecd = undefined;
11
+ if (params.ec !== undefined) {
12
+ if (Array.isArray(params.ec)) {
13
+ ecd = (0, ec_1.packEc)(params.ec);
14
+ }
15
+ else if (params.ec instanceof core_1.Dictionary) {
16
+ ecd = params.ec;
17
+ }
18
+ else {
19
+ ecd = (0, ec_1.packEc)(Object.entries(params.ec).map(([k, v]) => [Number(k), v]));
20
+ }
21
+ }
9
22
  return {
10
23
  info: {
11
24
  type: 'internal',
12
25
  dest: params.to,
13
26
  src: params.from,
14
- value: { coins: params.value },
27
+ value: { coins: params.value, other: ecd },
15
28
  bounce: params.bounce ?? true,
16
29
  ihrDisabled: params.ihrDisabled ?? true,
17
30
  bounced: params.bounced ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/sandbox",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "TON transaction emulator",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/ton-org/sandbox"
14
14
  },
15
15
  "devDependencies": {
16
- "@ton/core": "^0.58.1",
16
+ "@ton/core": "^0.59.1",
17
17
  "@ton/crypto": "3.3.0",
18
18
  "@ton/test-utils": "^0.3.1",
19
19
  "@ton/ton": "^15.0.0",