Skip to content

Commit f116b9b

Browse files
[NO-JIRA] Fix client gas config (#153)
* remove gas overrides from read functions erc721 * set gas limit * remove gas overrides from read functions erc20 * remove gas overrides from read functions erc721 by id
1 parent 85019e1 commit f116b9b

File tree

4 files changed

+46
-53
lines changed

4 files changed

+46
-53
lines changed

clients/config/overrides.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import { CallOverrides } from "@ethersproject/contracts";
44
export const defaultGasOverrides: CallOverrides = {
55
maxPriorityFeePerGas: 10e9, // 10 Gwei
66
maxFeePerGas: 15e9,
7+
gasLimit: 200000, // Expected when setting the above properties
78
};

clients/erc20.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class ERC20Client {
2020
* @returns a promise that resolves with a BigNumber that represents the amount of tokens in existence
2121
*/
2222
public async totalSupply(provider: Provider, overrides: CallOverrides = {}): Promise<BigNumber> {
23-
return this.contract.connect(provider).totalSupply({ ...defaultGasOverrides, ...overrides });
23+
return this.contract.connect(provider).totalSupply(overrides);
2424
}
2525

2626
/**
@@ -31,7 +31,7 @@ export class ERC20Client {
3131
account: PromiseOrValue<string>,
3232
overrides: CallOverrides = {}
3333
): Promise<BigNumber> {
34-
return this.contract.connect(provider).balanceOf(account, { ...defaultGasOverrides, ...overrides });
34+
return this.contract.connect(provider).balanceOf(account, overrides);
3535
}
3636

3737
/**
@@ -43,7 +43,7 @@ export class ERC20Client {
4343
spender: PromiseOrValue<string>,
4444
overrides: CallOverrides = {}
4545
): Promise<BigNumber> {
46-
return this.contract.connect(provider).allowance(owner, spender, { ...defaultGasOverrides, ...overrides });
46+
return this.contract.connect(provider).allowance(owner, spender, overrides);
4747
}
4848

4949
/**

clients/erc721-mint-by-id.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ export class ERC721MintByIDClient {
3131
* @returns the DEFAULT_ADMIN_ROLE as a string.
3232
*/
3333
public async DEFAULT_ADMIN_ROLE(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
34-
return await this.contract.connect(provider).DEFAULT_ADMIN_ROLE({ ...defaultGasOverrides, ...overrides });
34+
return await this.contract.connect(provider).DEFAULT_ADMIN_ROLE(overrides);
3535
}
3636

3737
/**
3838
* @returns the MINTER_ROLE as a string.
3939
*/
4040
public async MINTER_ROLE(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
41-
return await this.contract.connect(provider).MINTER_ROLE({ ...defaultGasOverrides, ...overrides });
41+
return await this.contract.connect(provider).MINTER_ROLE(overrides);
4242
}
4343

4444
/**
@@ -49,28 +49,28 @@ export class ERC721MintByIDClient {
4949
owner: PromiseOrValue<string>,
5050
overrides: CallOverrides = {}
5151
): Promise<BigNumber> {
52-
return await this.contract.connect(provider).balanceOf(owner, { ...defaultGasOverrides, ...overrides });
52+
return await this.contract.connect(provider).balanceOf(owner, overrides);
5353
}
5454

5555
/**
5656
* @returns the baseURI as a string.
5757
*/
5858
public async baseURI(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
59-
return await this.contract.connect(provider).baseURI({ ...defaultGasOverrides, ...overrides });
59+
return await this.contract.connect(provider).baseURI(overrides);
6060
}
6161

6262
/**
6363
* @returns the contractURI as a string.
6464
*/
6565
public async contractURI(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
66-
return await this.contract.connect(provider).contractURI({ ...defaultGasOverrides, ...overrides });
66+
return await this.contract.connect(provider).contractURI(overrides);
6767
}
6868

6969
/**
7070
* @returns admin addresses as an array of strings.
7171
*/
7272
public async getAdmins(provider: Provider, overrides: CallOverrides = {}): Promise<string[]> {
73-
return await this.contract.connect(provider).getAdmins({ ...defaultGasOverrides, ...overrides });
73+
return await this.contract.connect(provider).getAdmins(overrides);
7474
}
7575

7676
/**
@@ -81,7 +81,7 @@ export class ERC721MintByIDClient {
8181
tokenId: PromiseOrValue<BigNumberish>,
8282
overrides: CallOverrides = {}
8383
): Promise<string> {
84-
return await this.contract.connect(provider).getApproved(tokenId, { ...defaultGasOverrides, ...overrides });
84+
return await this.contract.connect(provider).getApproved(tokenId, overrides);
8585
}
8686

8787
/**
@@ -92,7 +92,7 @@ export class ERC721MintByIDClient {
9292
role: PromiseOrValue<BytesLike>,
9393
overrides: CallOverrides = {}
9494
): Promise<string> {
95-
return await this.contract.connect(provider).getRoleAdmin(role, { ...defaultGasOverrides, ...overrides });
95+
return await this.contract.connect(provider).getRoleAdmin(role, overrides);
9696
}
9797

9898
/**
@@ -104,7 +104,7 @@ export class ERC721MintByIDClient {
104104
index: PromiseOrValue<BigNumberish>,
105105
overrides: CallOverrides = {}
106106
): Promise<string> {
107-
return await this.contract.connect(provider).getRoleMember(role, index, { ...defaultGasOverrides, ...overrides });
107+
return await this.contract.connect(provider).getRoleMember(role, index, overrides);
108108
}
109109

110110
/**
@@ -115,7 +115,7 @@ export class ERC721MintByIDClient {
115115
role: PromiseOrValue<BytesLike>,
116116
overrides: CallOverrides = {}
117117
): Promise<BigNumber> {
118-
return await this.contract.connect(provider).getRoleMemberCount(role, { ...defaultGasOverrides, ...overrides });
118+
return await this.contract.connect(provider).getRoleMemberCount(role, overrides);
119119
}
120120

121121
/**
@@ -127,7 +127,7 @@ export class ERC721MintByIDClient {
127127
account: PromiseOrValue<string>,
128128
overrides: CallOverrides = {}
129129
): Promise<boolean> {
130-
return await this.contract.connect(provider).hasRole(role, account, { ...defaultGasOverrides, ...overrides });
130+
return await this.contract.connect(provider).hasRole(role, account, overrides);
131131
}
132132

133133
/**
@@ -139,16 +139,14 @@ export class ERC721MintByIDClient {
139139
operator: PromiseOrValue<string>,
140140
overrides: CallOverrides = {}
141141
): Promise<boolean> {
142-
return await this.contract
143-
.connect(provider)
144-
.isApprovedForAll(owner, operator, { ...defaultGasOverrides, ...overrides });
142+
return await this.contract.connect(provider).isApprovedForAll(owner, operator, overrides);
145143
}
146144

147145
/**
148146
* @returns the name of the contract as a string.
149147
*/
150148
public async name(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
151-
return await this.contract.connect(provider).name({ ...defaultGasOverrides, ...overrides });
149+
return await this.contract.connect(provider).name(overrides);
152150
}
153151

154152
/**
@@ -159,7 +157,7 @@ export class ERC721MintByIDClient {
159157
tokenId: PromiseOrValue<BigNumberish>,
160158
overrides: CallOverrides = {}
161159
): Promise<string> {
162-
return await this.contract.connect(provider).ownerOf(tokenId, { ...defaultGasOverrides, ...overrides });
160+
return await this.contract.connect(provider).ownerOf(tokenId, overrides);
163161
}
164162

165163
/**
@@ -172,14 +170,14 @@ export class ERC721MintByIDClient {
172170
tokenId: PromiseOrValue<BigNumberish>,
173171
overrides: CallOverrides = {}
174172
): Promise<BigNumber> {
175-
return await this.contract.connect(provider).nonces(tokenId, { ...defaultGasOverrides, ...overrides });
173+
return await this.contract.connect(provider).nonces(tokenId, overrides);
176174
}
177175

178176
/**
179177
* @returns the operator allowlist as a string.
180178
*/
181179
public async operatorAllowlist(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
182-
return await this.contract.connect(provider).operatorAllowlist({ ...defaultGasOverrides, ...overrides });
180+
return await this.contract.connect(provider).operatorAllowlist(overrides);
183181
}
184182

185183
/**
@@ -191,16 +189,14 @@ export class ERC721MintByIDClient {
191189
_salePrice: PromiseOrValue<BigNumberish>,
192190
overrides: CallOverrides = {}
193191
): Promise<[string, BigNumber]> {
194-
return await this.contract
195-
.connect(provider)
196-
.royaltyInfo(_tokenId, _salePrice, { ...defaultGasOverrides, ...overrides });
192+
return await this.contract.connect(provider).royaltyInfo(_tokenId, _salePrice, overrides);
197193
}
198194

199195
/**
200196
* @returns the symbol of the contract as a string.
201197
*/
202198
public async symbol(provider: Provider, overrides: CallOverrides = {}): Promise<string> {
203-
return await this.contract.connect(provider).symbol({ ...defaultGasOverrides, ...overrides });
199+
return await this.contract.connect(provider).symbol(overrides);
204200
}
205201

206202
/**
@@ -211,14 +207,14 @@ export class ERC721MintByIDClient {
211207
tokenId: PromiseOrValue<BigNumberish>,
212208
overrides: CallOverrides = {}
213209
): Promise<string> {
214-
return await this.contract.connect(provider).tokenURI(tokenId, { ...defaultGasOverrides, ...overrides });
210+
return await this.contract.connect(provider).tokenURI(tokenId, overrides);
215211
}
216212

217213
/**
218214
* @returns returns the total amount of tokens stored by the contract.
219215
*/
220216
public async totalSupply(provider: Provider, overrides: CallOverrides = {}): Promise<BigNumber> {
221-
return await this.contract.connect(provider).totalSupply({ ...defaultGasOverrides, ...overrides });
217+
return await this.contract.connect(provider).totalSupply(overrides);
222218
}
223219

224220
/**

0 commit comments

Comments
 (0)