Skip to content

Commit

Permalink
chore: simplify txParams handling
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 26, 2023
1 parent 39088fc commit bb639eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ WalletMiddlewareOptions): JsonRpcMiddleware<any, Block> {
throw rpcErrors.invalidInput();
}

const params = req.params as [TransactionParams?];
const params = req.params[0] as TransactionParams | undefined;
const txParams: TransactionParams = {
...params[0],
from: await validateAndNormalizeKeyholder(params[0]?.from || '', req),
...params,
from: await validateAndNormalizeKeyholder(params?.from || '', req),
};
res.result = await processTransaction(txParams, req);
}
Expand All @@ -177,10 +177,10 @@ WalletMiddlewareOptions): JsonRpcMiddleware<any, Block> {
throw rpcErrors.invalidInput();
}

const params = req.params as [TransactionParams?];
const params = req.params[0] as TransactionParams | undefined;
const txParams: TransactionParams = {
...params[0],
from: await validateAndNormalizeKeyholder(params[0]?.from || '', req),
...params,
from: await validateAndNormalizeKeyholder(params?.from || '', req),
};
res.result = await processSignTransaction(txParams, req);
}
Expand Down

0 comments on commit bb639eb

Please sign in to comment.