@cryptorubic/web3 0.3.4 → 0.3.5

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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "v0.3.4",
3
+ "version": "0.3.5",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "bignumber.js": "9.1.2",
7
- "@cryptorubic/core": "v0.3.4",
7
+ "@cryptorubic/core": "0.3.5",
8
8
  "viem": "^2.19.1",
9
9
  "web3-utils": "^4.3.1",
10
10
  "@ton/ton": "^15.1.0",
11
11
  "@solana/web3.js": "1.95.3",
12
12
  "@solflare-wallet/utl-sdk": "^1.4.0",
13
13
  "@ethersproject/bignumber": "^5.7.0",
14
- "@cryptorubic/tron-types": "v0.3.4",
14
+ "@cryptorubic/tron-types": "0.3.5",
15
15
  "bitcoin-address-validation": "^2.2.3",
16
16
  "axios": "0.27.2",
17
17
  "crc-32": "^1.2.2",
@@ -18,7 +18,7 @@ export declare class EvmAdapter extends AbstractAdapter<PublicActions & PublicCl
18
18
  multicallByContract<T>(contracts: MulticallParameters, allowErrors?: boolean): Promise<MulticallResponse<T>[]>;
19
19
  multicallByAddress<T>(address: string, abi: Abi, method: string, methodArgs?: unknown[][], allowErrors?: boolean): Promise<MulticallResponse<T>[]>;
20
20
  static encodeMethodCall(contractAddress: string, contractAbi: Abi, method: string, parameters?: unknown[], value?: string): EvmTransactionConfig;
21
- simulateTransaction(config: EvmTransactionConfig, from: string): Promise<string>;
21
+ simulateTransaction(config: EvmTransactionConfig, from: string, timeout?: number): Promise<string>;
22
22
  callForTokensInfo(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<EvmBlockchainName>[]>;
23
23
  getGasPrice(): Promise<string>;
24
24
  checkEnoughBalance(token: TokenAmount | PriceTokenAmount, walletAddress: string, amount?: BigNumber): Promise<boolean>;
@@ -137,7 +137,7 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
137
137
  throw err;
138
138
  }
139
139
  }
140
- async simulateTransaction(config, from) {
140
+ async simulateTransaction(config, from, timeout = 15000) {
141
141
  try {
142
142
  const callParams = {
143
143
  account: from,
@@ -145,8 +145,11 @@ class EvmAdapter extends abstract_adapter_1.AbstractAdapter {
145
145
  to: config.to,
146
146
  ...(config.value && { value: BigInt(config.value) }),
147
147
  };
148
- const gasLimitWei = await this.public.estimateGas(callParams);
149
- return gasLimitWei.toString();
148
+ const gasLimitWei = await Promise.race([
149
+ this.public.estimateGas(callParams),
150
+ new Promise((_, reject) => setTimeout(() => reject('Timeout'), timeout)),
151
+ ]);
152
+ return gasLimitWei?.toString();
150
153
  }
151
154
  catch (err) {
152
155
  this.logger?.customError('Error while simulating transaction', err);