Skip to content

Commit

Permalink
fix: perform transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Dec 25, 2023
1 parent 9cb9675 commit 3696a19
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/sdk/src/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,24 @@ export default class LidoSDKCore extends LidoSDKCacheable {
const account = await this.useAccount(props.account);
const isContract = await this.isContract(account.address);

const overrides: TransactionOptions = {
let overrides: TransactionOptions = {
account,
chain: this.chain,
gas: undefined,
maxFeePerGas: undefined,
maxPriorityFeePerGas: undefined,
};

if (!isContract) {
if (isContract) {
// passing these stub params prevent unnecessary possibly errorish RPC calls
overrides = {
...overrides,
gas: 21000n,
maxFeePerGas: 1n,
maxPriorityFeePerGas: 1n,
nonce: 1,
};
} else {
callback({ stage: TransactionCallbackStage.GAS_LIMIT });
const feeData = await this.getFeeData();
overrides.maxFeePerGas = feeData.maxFeePerGas;
Expand Down Expand Up @@ -518,11 +527,6 @@ export default class LidoSDKCore extends LidoSDKCacheable {
const transactionHash = await withSDKError(
sendTransaction({
...overrides,
// passing these stub params prevent unnecessary errorish RPC calls
gas: 1n,
maxFeePerGas: 1n,
maxPriorityFeePerGas: 1n,
nonce: 1,
}),
ERROR_CODE.TRANSACTION_ERROR,
);
Expand Down

0 comments on commit 3696a19

Please sign in to comment.