@tonappchain/sdk 0.7.0-rc29 → 0.7.0-rc30

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.
@@ -31,3 +31,4 @@ export declare const missingDecimals: MetadataError;
31
31
  export declare const missingJettonDataError: MetadataError;
32
32
  export declare const zeroRawAmountError: (assetAddress: string) => TokenError;
33
33
  export declare const sendCrossChainTransactionFailedError: (msg: string) => WalletError;
34
+ export declare const convertCurrencyZeroValueError: FormatError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.convertCurrencyZeroValueError = 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);
@@ -55,3 +55,4 @@ const zeroRawAmountError = (assetAddress) => new errors_1.TokenError(`FT asset w
55
55
  exports.zeroRawAmountError = zeroRawAmountError;
56
56
  const sendCrossChainTransactionFailedError = (msg) => new errors_1.WalletError(`failed to send cross chain transaction: ${msg}`, 131);
57
57
  exports.sendCrossChainTransactionFailedError = sendCrossChainTransactionFailedError;
58
+ exports.convertCurrencyZeroValueError = new errors_1.FormatError('Value cannot be zero for currency conversion', 132);
@@ -78,6 +78,7 @@ class Configuration {
78
78
  const artifacts = network === Struct_1.Network.MAINNET ? artifacts_1.mainnet : network === Struct_1.Network.TESTNET ? artifacts_1.testnet : artifacts_1.dev;
79
79
  let provider;
80
80
  let settingsAddress;
81
+ let saFactoryAddress;
81
82
  if (network === Struct_1.Network.DEV) {
82
83
  if (!TACParams || !TACParams.provider) {
83
84
  throw new Error('For dev network, a custom provider must be provided in TACParams');
@@ -86,11 +87,16 @@ class Configuration {
86
87
  if (!TACParams.settingsAddress) {
87
88
  throw new Error('For dev network, a custom settings address must be provided in TACParams');
88
89
  }
89
- settingsAddress = TACParams.settingsAddress.toString();
90
+ settingsAddress = TACParams.settingsAddress;
91
+ if (!TACParams.saFactoryAddress) {
92
+ throw new Error('For dev network, a custom smart account factory address must be provided in TACParams');
93
+ }
94
+ saFactoryAddress = TACParams.saFactoryAddress;
90
95
  }
91
96
  else {
92
97
  provider = TACParams?.provider ?? ethers_1.ethers.getDefaultProvider(artifacts.TAC_RPC_ENDPOINT);
93
- settingsAddress = TACParams?.settingsAddress?.toString() ?? artifacts.TAC_SETTINGS_ADDRESS;
98
+ settingsAddress = TACParams?.settingsAddress ?? artifacts.TAC_SETTINGS_ADDRESS;
99
+ saFactoryAddress = TACParams?.saFactoryAddress ?? artifacts.TAC_SMART_ACCOUNT_FACTORY_ADDRESS;
94
100
  }
95
101
  Validator_1.Validator.validateEVMAddress(settingsAddress);
96
102
  const settingsAbi = artifacts.tac.compilationArtifacts.ISettings.abi;
@@ -117,7 +123,7 @@ class Configuration {
117
123
  const tokenUtilsAbi = artifacts.tac.compilationArtifacts.ITokenUtils.abi;
118
124
  const tokenUtils = new ethers_1.ethers.Contract(tokenUtilsAddress, tokenUtilsAbi, provider);
119
125
  const TacSAFactoryAbi = artifacts.tac.compilationArtifacts.ISAFactory.abi;
120
- const smartAccountFactory = new ethers_1.ethers.Contract(artifacts.TAC_SMART_ACCOUNT_FACTORY_ADDRESS, TacSAFactoryAbi, provider);
126
+ const smartAccountFactory = new ethers_1.ethers.Contract(saFactoryAddress, TacSAFactoryAbi, provider);
121
127
  return {
122
128
  provider,
123
129
  settings,
@@ -123,6 +123,9 @@ class LiteSequencerClient {
123
123
  }
124
124
  }
125
125
  async convertCurrency(params) {
126
+ if (params.value === 0n) {
127
+ throw instances_1.convertCurrencyZeroValueError;
128
+ }
126
129
  try {
127
130
  const payload = {
128
131
  currency: params.currency,
@@ -1,6 +1,6 @@
1
1
  import { SandboxContract } from '@ton/sandbox';
2
2
  import { OpenedContract } from '@ton/ton';
3
- import { AbstractProvider, Addressable } from 'ethers';
3
+ import { AbstractProvider } from 'ethers';
4
4
  import { JettonMinter, JettonMinterData } from '../../artifacts/tonTypes';
5
5
  import type { FT, NFT } from '../assets';
6
6
  import type { Asset, ContractOpener, ILogger } from '../interfaces';
@@ -44,7 +44,11 @@ export type TACParams = {
44
44
  /**
45
45
  * Address of TAC settings contract. Use only for tests.
46
46
  */
47
- settingsAddress?: string | Addressable;
47
+ settingsAddress?: string;
48
+ /**
49
+ * Address of TAC smart account factory contract. Use only for tests.
50
+ */
51
+ saFactoryAddress?: string;
48
52
  };
49
53
  export type TONParams = {
50
54
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonappchain/sdk",
3
- "version": "0.7.0-rc29",
3
+ "version": "0.7.0-rc30",
4
4
  "repository": "https://github.com/TacBuild/tac-sdk.git",
5
5
  "author": "TAC. <developers@tac>",
6
6
  "license": "MIT",