@tonappchain/sdk 0.6.1-v3.0.5 → 0.6.1

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/README.md CHANGED
@@ -155,11 +155,14 @@ const evmProxyMsg: EvmProxyMsg = {
155
155
  const assets: AssetBridgingData[] = [
156
156
  {
157
157
  address: TVMtokenAAddress,
158
- amount: tokenAAmount
158
+ amount: tokenAAmount,
159
+ type: AssetType.FT,
160
+
159
161
  },
160
162
  {
161
163
  address: TVMtokenBAddress,
162
- amount: tokenBAmount
164
+ amount: tokenBAmount,
165
+ type: AssetType.FT,
163
166
  }
164
167
  ];
165
168
 
@@ -6,7 +6,8 @@ export declare class ContractError extends ErrorWithStatusCode {
6
6
  constructor(message: string, errorCode: number);
7
7
  }
8
8
  export declare class FetchError extends ErrorWithStatusCode {
9
- constructor(message: string, errorCode: number);
9
+ readonly inner?: unknown;
10
+ constructor(message: string, errorCode: number, inner?: unknown);
10
11
  }
11
12
  export declare class AddressError extends ErrorWithStatusCode {
12
13
  constructor(message: string, errorCode: number);
@@ -16,9 +16,10 @@ class ContractError extends ErrorWithStatusCode {
16
16
  }
17
17
  exports.ContractError = ContractError;
18
18
  class FetchError extends ErrorWithStatusCode {
19
- constructor(message, errorCode) {
19
+ constructor(message, errorCode, inner) {
20
20
  super(message, errorCode);
21
21
  this.name = 'FetchError';
22
+ this.inner = inner;
22
23
  }
23
24
  }
24
25
  exports.FetchError = FetchError;
@@ -11,7 +11,7 @@ export declare const notMultiplyOf8Error: BitError;
11
11
  export declare const prefixError: MetadataError;
12
12
  export declare const emptySettingError: (setting: string) => SettingError;
13
13
  export declare const invalidMethodNameError: (methodName: string) => EVMCallError;
14
- export declare const simulationError: FetchError;
14
+ export declare const simulationError: (inner: unknown) => FetchError;
15
15
  export declare const profilingFetchError: (msg: string) => FetchError;
16
16
  export declare const emptyArrayError: (msg: string) => FetchError;
17
17
  export declare const invalidAssetType: FormatError;
@@ -21,7 +21,8 @@ const emptySettingError = (setting) => new errors_1.SettingError(`unexpected emp
21
21
  exports.emptySettingError = emptySettingError;
22
22
  const invalidMethodNameError = (methodName) => new errors_1.EVMCallError(`Invalid Solidity method name: "${methodName}". Method must be either a valid identifier or have parameters (bytes,bytes).`, 111);
23
23
  exports.invalidMethodNameError = invalidMethodNameError;
24
- exports.simulationError = new errors_1.FetchError('Failed to simulate EVM call', 112);
24
+ const simulationError = (inner) => new errors_1.FetchError(`Failed to simulate EVM call: ${inner}`, 112, inner);
25
+ exports.simulationError = simulationError;
25
26
  const profilingFetchError = (msg) => new errors_1.FetchError(`failed to fetch stage profiling: ${msg}`, 113);
26
27
  exports.profilingFetchError = profilingFetchError;
27
28
  const emptyArrayError = (msg) => new errors_1.FetchError(`empty array: ${msg}`, 114);
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { TacSdk } from './sdk/TacSdk';
2
2
  export { OperationTracker } from './sdk/OperationTracker';
3
- export { startTracking } from './sdk/StartTracking';
3
+ export { startTracking, startTrackingMultiple } from './sdk/StartTracking';
4
4
  export * from './sender';
5
5
  export * from './structs/Struct';
6
6
  export { Network, SimplifiedStatuses } from './structs/Struct';
package/dist/index.js CHANGED
@@ -14,13 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.LiteSequencerClient = exports.readJettonMetadata = exports.liteClientOpener = exports.orbsOpener = exports.HighloadWalletV3 = exports.JettonWalletOpCodes = exports.JettonWallet = exports.SimplifiedStatuses = exports.Network = exports.startTracking = exports.OperationTracker = exports.TacSdk = void 0;
17
+ exports.LiteSequencerClient = exports.readJettonMetadata = exports.liteClientOpener = exports.orbsOpener = exports.HighloadWalletV3 = exports.JettonWalletOpCodes = exports.JettonWallet = exports.SimplifiedStatuses = exports.Network = exports.startTrackingMultiple = exports.startTracking = exports.OperationTracker = exports.TacSdk = void 0;
18
18
  var TacSdk_1 = require("./sdk/TacSdk");
19
19
  Object.defineProperty(exports, "TacSdk", { enumerable: true, get: function () { return TacSdk_1.TacSdk; } });
20
20
  var OperationTracker_1 = require("./sdk/OperationTracker");
21
21
  Object.defineProperty(exports, "OperationTracker", { enumerable: true, get: function () { return OperationTracker_1.OperationTracker; } });
22
22
  var StartTracking_1 = require("./sdk/StartTracking");
23
23
  Object.defineProperty(exports, "startTracking", { enumerable: true, get: function () { return StartTracking_1.startTracking; } });
24
+ Object.defineProperty(exports, "startTrackingMultiple", { enumerable: true, get: function () { return StartTracking_1.startTrackingMultiple; } });
24
25
  __exportStar(require("./sender"), exports);
25
26
  __exportStar(require("./structs/Struct"), exports);
26
27
  var Struct_1 = require("./structs/Struct");
@@ -6,3 +6,10 @@ export declare function startTracking(transactionLinker: TransactionLinker, netw
6
6
  returnValue?: boolean;
7
7
  tableView?: boolean;
8
8
  }): Promise<void | ExecutionStages>;
9
+ export declare function startTrackingMultiple(transactionLinkers: TransactionLinker[], network: Network, options?: {
10
+ customLiteSequencerEndpoints?: string[];
11
+ delay?: number;
12
+ maxIterationCount?: number;
13
+ returnValue?: boolean;
14
+ tableView?: boolean;
15
+ }): Promise<void | ExecutionStages[]>;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startTracking = startTracking;
7
+ exports.startTrackingMultiple = startTrackingMultiple;
7
8
  const Struct_1 = require("../structs/Struct");
8
9
  const Consts_1 = require("./Consts");
9
10
  const OperationTracker_1 = require("./OperationTracker");
@@ -74,6 +75,35 @@ async function startTracking(transactionLinker, network, options) {
74
75
  console.log(formatExecutionStages(profilingData));
75
76
  }
76
77
  }
78
+ async function startTrackingMultiple(transactionLinkers, network, options) {
79
+ const { customLiteSequencerEndpoints, delay = 10, maxIterationCount = Consts_1.MAX_ITERATION_COUNT, returnValue = false, tableView = true, } = options || {};
80
+ console.log(`Start tracking ${transactionLinkers.length} operations`);
81
+ const results = await Promise.all(transactionLinkers.map((linker, index) => {
82
+ console.log(`\nProcessing operation ${index + 1}/${transactionLinkers.length}`);
83
+ return startTracking(linker, network, {
84
+ customLiteSequencerEndpoints,
85
+ delay,
86
+ maxIterationCount,
87
+ returnValue: true,
88
+ tableView: false,
89
+ });
90
+ }));
91
+ if (returnValue) {
92
+ return results;
93
+ }
94
+ if (tableView) {
95
+ results.forEach((result, index) => {
96
+ console.log(`\nResults for operation ${index + 1}:`);
97
+ printExecutionStagesTable(result);
98
+ });
99
+ }
100
+ else {
101
+ results.forEach((result, index) => {
102
+ console.log(`\nResults for operation ${index + 1}:`);
103
+ console.log(formatExecutionStages(result));
104
+ });
105
+ }
106
+ }
77
107
  function formatExecutionStages(stages) {
78
108
  const { operationType, metaInfo, ...stagesData } = stages;
79
109
  return Object.entries(stagesData).map(([stage, data]) => ({
@@ -432,7 +432,6 @@ class TacSdk {
432
432
  },
433
433
  evmValidExecutors: evmValidExecutors,
434
434
  extraData: '0x',
435
- feeAssetAddress: '',
436
435
  shardsKey: transactionLinker.shardsKey,
437
436
  tonAssets: rawAssets.map((asset) => ({
438
437
  amount: asset.rawAmount.toString(),
@@ -492,16 +491,18 @@ class TacSdk {
492
491
  })),
493
492
  feeSymbol: feeSymbol,
494
493
  };
494
+ let lastError;
495
495
  for (const endpoint of this.liteSequencerEndpoints) {
496
496
  try {
497
497
  const response = await axios_1.default.post(`${endpoint}/ton/calculator/ton-executor-fee`, requestBody);
498
498
  return response.data.response;
499
499
  }
500
500
  catch (error) {
501
- console.error(`Error while calulating tvm executor fee ${endpoint}:`, error);
501
+ console.error(`Error while calculating tvm executor fee ${endpoint}:`, error);
502
+ lastError = error;
502
503
  }
503
504
  }
504
- throw errors_1.simulationError;
505
+ throw (0, errors_1.simulationError)(lastError);
505
506
  }
506
507
  async prepareCrossChainTransaction(evmProxyMsg, caller, assets, options) {
507
508
  let { forceSend = false, isRoundTrip = undefined, protocolFee = undefined, evmValidExecutors = [], evmExecutorFee = undefined, tvmValidExecutors = [], tvmExecutorFee = undefined, } = options || {};
@@ -721,6 +722,7 @@ class TacSdk {
721
722
  return (await this.TONParams.contractOpener.getContractState(ton_1.Address.parse(address))).state === 'active';
722
723
  }
723
724
  async simulateTACMessage(req) {
725
+ let lastError;
724
726
  for (const endpoint of this.liteSequencerEndpoints) {
725
727
  try {
726
728
  const response = await axios_1.default.post(new URL('tac/simulator/simulate-message', endpoint).toString(), req, {
@@ -730,9 +732,10 @@ class TacSdk {
730
732
  }
731
733
  catch (error) {
732
734
  console.error(`Error while simulating with ${endpoint}:`, error);
735
+ lastError = error;
733
736
  }
734
737
  }
735
- throw errors_1.simulationError;
738
+ throw (0, errors_1.simulationError)(lastError);
736
739
  }
737
740
  }
738
741
  exports.TacSdk = TacSdk;
@@ -181,7 +181,6 @@ export type TACSimulationRequest = {
181
181
  };
182
182
  evmValidExecutors: string[];
183
183
  extraData: string;
184
- feeAssetAddress: string;
185
184
  shardsKey: string;
186
185
  tonAssets: {
187
186
  amount: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonappchain/sdk",
3
- "version": "0.6.1-v3.0.5",
3
+ "version": "0.6.1",
4
4
  "repository": "https://github.com/TacBuild/tac-sdk.git",
5
5
  "author": "TAC. <developers@tac>",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "@aws-crypto/sha256-js": "^5.2.0",
21
21
  "@orbs-network/ton-access": "^2.3.3",
22
22
  "@ton/ton": "15.1.0",
23
- "@tonappchain/artifacts": "0.0.17-v3.0.5",
23
+ "@tonappchain/artifacts": "0.0.17",
24
24
  "@tonappchain/ton-lite-client": "3.0.6",
25
25
  "@tonconnect/ui": "^2.0.11",
26
26
  "bn.js": "^5.2.1",