@atomiqlabs/chain-evm 1.0.0-dev.46 → 1.0.0-dev.48

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.
@@ -4,6 +4,7 @@ exports.EVMTransactions = void 0;
4
4
  const EVMModule_1 = require("../EVMModule");
5
5
  const ethers_1 = require("ethers");
6
6
  const Utils_1 = require("../../../utils/Utils");
7
+ const MAX_UNCONFIRMED_TXNS = 10;
7
8
  class EVMTransactions extends EVMModule_1.EVMModule {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -116,7 +117,7 @@ class EVMTransactions extends EVMModule_1.EVMModule {
116
117
  " waitForConfirmation: " + waitForConfirmation + " parallel: " + parallel);
117
118
  const txIds = [];
118
119
  if (parallel) {
119
- const promises = [];
120
+ let promises = [];
120
121
  for (let i = 0; i < txs.length; i++) {
121
122
  let tx;
122
123
  if (signer.isBrowserWallet) {
@@ -131,6 +132,10 @@ class EVMTransactions extends EVMModule_1.EVMModule {
131
132
  promises.push(this.confirmTransaction(tx, abortSignal));
132
133
  txIds.push(tx.hash);
133
134
  this.logger.debug("sendAndConfirm(): transaction sent (" + (i + 1) + "/" + signedTxs.length + "): " + tx.hash);
135
+ if (promises.length >= MAX_UNCONFIRMED_TXNS) {
136
+ await Promise.all(promises);
137
+ promises = [];
138
+ }
134
139
  }
135
140
  if (promises.length > 0)
136
141
  await Promise.all(promises);
@@ -468,11 +468,11 @@ EVMSpvVaultContract.GasCosts = {
468
468
  DEPOSIT_ERC20: 40000,
469
469
  OPEN: 80000 + 21000,
470
470
  CLAIM_BASE: 85000 + 21000,
471
- CLAIM_NATIVE_TRANSFER: 7500,
471
+ CLAIM_NATIVE_TRANSFER: 35000,
472
472
  CLAIM_ERC20_TRANSFER: 40000,
473
473
  CLAIM_EXECUTION_SCHEDULE: 30000,
474
474
  FRONT_BASE: 75000 + 21000,
475
- FRONT_NATIVE_TRANSFER: 7500,
475
+ FRONT_NATIVE_TRANSFER: 35000,
476
476
  FRONT_ERC20_TRANSFER: 40000,
477
477
  FRONT_EXECUTION_SCHEDULE: 30000
478
478
  };
@@ -131,7 +131,7 @@ exports.EVMSwapClaim = EVMSwapClaim;
131
131
  EVMSwapClaim.GasCosts = {
132
132
  BASE: 30000 + 21000,
133
133
  ERC20_TRANSFER: 40000,
134
- NATIVE_TRANSFER: 7500,
134
+ NATIVE_TRANSFER: 35500,
135
135
  LP_VAULT_TRANSFER: 10000,
136
136
  REPUTATION: 25000
137
137
  };
@@ -161,7 +161,7 @@ exports.EVMSwapRefund = EVMSwapRefund;
161
161
  EVMSwapRefund.GasCosts = {
162
162
  BASE: 35000 + 21000,
163
163
  ERC20_TRANSFER: 40000,
164
- NATIVE_TRANSFER: 7500,
164
+ NATIVE_TRANSFER: 35500,
165
165
  LP_VAULT_TRANSFER: 10000,
166
166
  REPUTATION: 25000
167
167
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-evm",
3
- "version": "1.0.0-dev.46",
3
+ "version": "1.0.0-dev.48",
4
4
  "description": "EVM specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -18,6 +18,8 @@ export type EVMTxTrace = {
18
18
  type: "CREATE" | "CALL" | "STATICCALL"
19
19
  };
20
20
 
21
+ const MAX_UNCONFIRMED_TXNS = 10;
22
+
21
23
  export class EVMTransactions extends EVMModule<any> {
22
24
 
23
25
  private readonly latestConfirmedNonces: {[address: string]: number} = {};
@@ -140,7 +142,7 @@ export class EVMTransactions extends EVMModule<any> {
140
142
 
141
143
  const txIds: string[] = [];
142
144
  if(parallel) {
143
- const promises: Promise<void>[] = [];
145
+ let promises: Promise<void>[] = [];
144
146
  for(let i=0;i<txs.length;i++) {
145
147
  let tx: {nonce: number, from: string, hash: string};
146
148
  if(signer.isBrowserWallet) {
@@ -153,6 +155,10 @@ export class EVMTransactions extends EVMModule<any> {
153
155
  if(waitForConfirmation) promises.push(this.confirmTransaction(tx, abortSignal));
154
156
  txIds.push(tx.hash);
155
157
  this.logger.debug("sendAndConfirm(): transaction sent ("+(i+1)+"/"+signedTxs.length+"): "+tx.hash);
158
+ if(promises.length >= MAX_UNCONFIRMED_TXNS) {
159
+ await Promise.all(promises);
160
+ promises = [];
161
+ }
156
162
  }
157
163
  if(promises.length>0) await Promise.all(promises);
158
164
  } else {
@@ -61,12 +61,12 @@ export class EVMSpvVaultContract<ChainId extends string>
61
61
  OPEN: 80_000 + 21_000,
62
62
 
63
63
  CLAIM_BASE: 85_000 + 21_000,
64
- CLAIM_NATIVE_TRANSFER: 7_500,
64
+ CLAIM_NATIVE_TRANSFER: 35_000,
65
65
  CLAIM_ERC20_TRANSFER: 40_000,
66
66
  CLAIM_EXECUTION_SCHEDULE: 30_000,
67
67
 
68
68
  FRONT_BASE: 75_000 + 21_000,
69
- FRONT_NATIVE_TRANSFER: 7_500,
69
+ FRONT_NATIVE_TRANSFER: 35_000,
70
70
  FRONT_ERC20_TRANSFER: 40_000,
71
71
  FRONT_EXECUTION_SCHEDULE: 30_000
72
72
  };
@@ -15,7 +15,7 @@ export class EVMSwapClaim extends EVMSwapModule {
15
15
  private static readonly GasCosts = {
16
16
  BASE: 30_000 + 21_000,
17
17
  ERC20_TRANSFER: 40_000,
18
- NATIVE_TRANSFER: 7500,
18
+ NATIVE_TRANSFER: 35_500,
19
19
  LP_VAULT_TRANSFER: 10_000,
20
20
  REPUTATION: 25_000
21
21
  };
@@ -19,7 +19,7 @@ export class EVMSwapRefund extends EVMSwapModule {
19
19
  private static readonly GasCosts = {
20
20
  BASE: 35_000 + 21_000,
21
21
  ERC20_TRANSFER: 40_000,
22
- NATIVE_TRANSFER: 7500,
22
+ NATIVE_TRANSFER: 35_500,
23
23
  LP_VAULT_TRANSFER: 10_000,
24
24
  REPUTATION: 25_000
25
25
  };