Skip to content

Commit

Permalink
feat: disable eth_getTransactionCount for tron (#2151)
Browse files Browse the repository at this point in the history
Co-authored-by: iGroza <[email protected]>
iGroza and iGroza authored Oct 16, 2024
1 parent 8616fcd commit e06b8e8
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/services/eth-network/eth-network.ts
Original file line number Diff line number Diff line change
@@ -45,7 +45,11 @@ export class EthNetwork {
throw new Error('Invalid "to" address');
}
const rpcProvider = await getRpcProvider(provider);
const nonce = await rpcProvider.getTransactionCount(from, 'latest');
let nonce: number | undefined;

if (provider.isEVM) {
nonce = await rpcProvider.getTransactionCount(from, 'latest');
}

const transaction = {
to: to,
2 changes: 1 addition & 1 deletion src/services/eth-sign.ts
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ const prepareTransaction = async (from: string, tx: TransactionRequest) => {
tx.value = ZERO_HEX_NUMBER;
}

if (!tx.nonce) {
if (!tx.nonce && Provider.selectedProvider.isEVM) {
const rpcProvider = await app.getRpcProvider();
tx.nonce = await rpcProvider.getTransactionCount(from, 'latest');
}
6 changes: 5 additions & 1 deletion src/services/sign-json-rpc-request.ts
Original file line number Diff line number Diff line change
@@ -164,7 +164,11 @@ export class SignJsonRpcRequest {
: request.params;

const {address} = await instanceProvider.getAccountInfo(path);
const nonce = await rpcProvider.getTransactionCount(address, 'latest');
let nonce: number | undefined;

if (Provider.selectedProvider.isEVM) {
nonce = await rpcProvider.getTransactionCount(address, 'latest');
}

const minGas = new Balance(signTransactionRequest.gasLimit ?? 0);

0 comments on commit e06b8e8

Please sign in to comment.