Skip to content

Commit 85bad27

Browse files
committed
fix: added default value for unknown chain steth_permit
1 parent 7a59f27 commit 85bad27

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/http/estimate/estimate.service.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,24 @@ export class EstimateService {
2323

2424
async getEstimate(params: EstimateOptionsDto): Promise<EstimateDto | null> {
2525
const { token, requestCount } = params;
26+
const isSteth = token === 'steth';
27+
const helperGasLimit =
28+
(isSteth
29+
? WITHDRAWAL_QUEUE_REQUEST_STETH_PERMIT_GAS_LIMIT_DEFAULT
30+
: WITHDRAWAL_QUEUE_REQUEST_WSTETH_PERMIT_GAS_LIMIT_DEFAULT) * requestCount;
31+
2632
const chainId = this.configService.get('CHAIN_ID');
2733
const permits = ESTIMATE_ACCOUNT_PERMITS[chainId];
28-
const isSteth = token === 'steth';
34+
35+
if (!permits) {
36+
return { gasLimit: helperGasLimit };
37+
}
2938

3039
const permit = isSteth ? permits.steth_permit : permits.wsteth_permit;
3140
const method = isSteth
3241
? this.contract.estimateGas.requestWithdrawalsWithPermit
3342
: this.contract.estimateGas.requestWithdrawalsWstETHWithPermit;
3443

35-
const helperGasLimit =
36-
(isSteth
37-
? WITHDRAWAL_QUEUE_REQUEST_STETH_PERMIT_GAS_LIMIT_DEFAULT
38-
: WITHDRAWAL_QUEUE_REQUEST_WSTETH_PERMIT_GAS_LIMIT_DEFAULT) * requestCount;
39-
4044
try {
4145
const gasLimit = await method(Array(Number(requestCount)).fill(BigNumber.from(100)), ESTIMATE_ACCOUNT, permit, {
4246
from: ESTIMATE_ACCOUNT,

0 commit comments

Comments
 (0)