@tonappchain/sdk 0.7.0-rc27 → 0.7.0-rc28

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.
@@ -30,3 +30,4 @@ export declare const missingGasLimitError: FormatError;
30
30
  export declare const missingDecimals: MetadataError;
31
31
  export declare const missingJettonDataError: MetadataError;
32
32
  export declare const zeroRawAmountError: (assetAddress: string) => TokenError;
33
+ export declare const sendCrossChainTransactionFailedError: (msg: string) => WalletError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
3
+ exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
4
4
  const errors_1 = require("./errors");
5
5
  exports.emptyContractError = new errors_1.ContractError('unexpected empty contract code of given jetton.', 100);
6
6
  const operationFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch OperationId: ${msg}`, 101, inner);
@@ -53,3 +53,5 @@ exports.missingDecimals = new errors_1.MetadataError('Missing decimals in jetton
53
53
  exports.missingJettonDataError = new errors_1.MetadataError('Jetton data should be available for TON origin', 129);
54
54
  const zeroRawAmountError = (assetAddress) => new errors_1.TokenError(`FT asset with zero rawAmount/amount is not allowed: ${assetAddress}`, 130);
55
55
  exports.zeroRawAmountError = zeroRawAmountError;
56
+ const sendCrossChainTransactionFailedError = (msg) => new errors_1.WalletError(`failed to send cross chain transaction: ${msg}`, 131);
57
+ exports.sendCrossChainTransactionFailedError = sendCrossChainTransactionFailedError;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TONTransactionManager = void 0;
4
4
  const assets_1 = require("../assets");
5
5
  const errors_1 = require("../errors");
6
+ const instances_1 = require("../errors/instances");
6
7
  const Consts_1 = require("./Consts");
7
8
  const Logger_1 = require("./Logger");
8
9
  const Utils_1 = require("./Utils");
@@ -141,6 +142,9 @@ class TONTransactionManager {
141
142
  await assets_1.TON.checkBalance(sender, this.config, [transaction]);
142
143
  this.logger.debug(`Sending transaction: ${(0, Utils_1.formatObjectForLogging)(transactionLinker)}`);
143
144
  const sendTransactionResult = await sender.sendShardTransaction(transaction, this.config.network, this.config.TONParams.contractOpener);
145
+ if (!sendTransactionResult.success || sendTransactionResult.error) {
146
+ throw (0, instances_1.sendCrossChainTransactionFailedError)(sendTransactionResult.error?.message ?? 'Transaction failed to send');
147
+ }
144
148
  const shouldWaitForOperationId = tx.options?.waitOperationId ?? true;
145
149
  if (!shouldWaitForOperationId) {
146
150
  return { sendTransactionResult, ...transactionLinker };
@@ -163,7 +167,12 @@ class TONTransactionManager {
163
167
  const { transactions, transactionLinkers } = await this.prepareBatchTransactions(txs, sender);
164
168
  await assets_1.TON.checkBalance(sender, this.config, transactions);
165
169
  this.logger.debug(`Sending transactions: ${(0, Utils_1.formatObjectForLogging)(transactionLinkers)}`);
166
- await sender.sendShardTransactions(transactions, this.config.network, this.config.TONParams.contractOpener);
170
+ const results = await sender.sendShardTransactions(transactions, this.config.network, this.config.TONParams.contractOpener);
171
+ for (const result of results) {
172
+ if (!result.success || result.error) {
173
+ throw (0, instances_1.sendCrossChainTransactionFailedError)(result.error?.message ?? 'Transaction failed to send');
174
+ }
175
+ }
167
176
  const shouldWaitForOperationIds = options?.waitOperationIds ?? true;
168
177
  return shouldWaitForOperationIds
169
178
  ? await this.waitForOperationIds(transactionLinkers, caller, options?.waitOptions ?? {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonappchain/sdk",
3
- "version": "0.7.0-rc27",
3
+ "version": "0.7.0-rc28",
4
4
  "repository": "https://github.com/TacBuild/tac-sdk.git",
5
5
  "author": "TAC. <developers@tac>",
6
6
  "license": "MIT",