Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 12, 2024
1 parent 64cce4d commit b424a80
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/error.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
BaseError,
RpcRequestError,
InvalidInputRpcError,
// InvalidInputRpcError,
ExecutionRevertedError,
TransactionRejectedRpcError,
// TransactionRejectedRpcError,
} from "viem";

/**
Expand Down Expand Up @@ -46,8 +46,8 @@ export function errorSnapshot(header: string, err: any): string {
export function containsNodeError(err: BaseError): boolean {
try {
return (
err instanceof TransactionRejectedRpcError ||
err instanceof InvalidInputRpcError ||
// err instanceof TransactionRejectedRpcError ||
// err instanceof InvalidInputRpcError ||
err instanceof ExecutionRevertedError ||
(err instanceof RpcRequestError && err.code === ExecutionRevertedError.code) ||
("cause" in err && containsNodeError(err.cause as any))
Expand Down
17 changes: 15 additions & 2 deletions src/processOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,19 @@ export async function processPair(args: {
// submit the tx
let txhash, txUrl;
try {
// const gasPriceBigInt = await viemClient.getGasPrice();
// const nonce = await viemClient.getTransactionCount({
// blockTag: "latest",
// address:
// flashbotSigner !== undefined
// ? flashbotSigner.account.address
// : signer.account.address,
// });
// rawtx.gasPrice = (gasPriceBigInt * 107n) / 100n;
// if (flashbotSigner) {
// rawtx.gas = await flashbotSigner.estimateGas(rawtx);
// }
// rawtx.nonce = nonce;
txhash =
flashbotSigner !== undefined
? await flashbotSigner.sendTransaction(rawtx)
Expand All @@ -637,7 +650,7 @@ export async function processPair(args: {
},
withBigintSerializer,
);
spanAttributes["txNoneNodeError"] = containsNodeError(e as BaseError);
spanAttributes["txNoneNodeError"] = !containsNodeError(e as BaseError);
result.error = e;
result.reason = ProcessPairHaltReason.TxFailed;
throw result;
Expand Down Expand Up @@ -775,7 +788,7 @@ export async function processPair(args: {
result.report.actualGasCost = ethers.utils.formatUnits(actualGasCost);
}
result.error = e;
spanAttributes["txNoneNodeError"] = containsNodeError(e);
spanAttributes["txNoneNodeError"] = !containsNodeError(e);
result.reason = ProcessPairHaltReason.TxMineFailed;
throw result;
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export type RawTx = {
data: `0x${string}`;
gasPrice?: bigint;
gas?: bigint;
nonce?: number;
};

export type DryrunValue = {
Expand Down

0 comments on commit b424a80

Please sign in to comment.