Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbrugneaux committed Sep 16, 2024
1 parent 05b7ec6 commit 0348f44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
18 changes: 9 additions & 9 deletions packages/web3-eth/src/rpc_method_wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export async function getTransaction<ReturnFormat extends DataFormat>(
return isNullish(response)
? response
: formatTransaction(response, returnFormat, {
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
fillInputAndData: true,
});
}
Expand All @@ -450,7 +450,7 @@ export async function getPendingTransactions<ReturnFormat extends DataFormat>(
transaction as unknown as Transaction,
returnFormat ?? web3Context.defaultReturnFormat,
{
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
fillInputAndData: true,
},
),
Expand Down Expand Up @@ -491,7 +491,7 @@ export async function getTransactionFromBlock<ReturnFormat extends DataFormat>(
return isNullish(response)
? response
: formatTransaction(response, returnFormat ?? web3Context.defaultReturnFormat, {
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
fillInputAndData: true,
});
}
Expand Down Expand Up @@ -611,7 +611,7 @@ export function sendTransaction<
},
ETH_DATA_FORMAT,
{
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
},
);

Expand Down Expand Up @@ -855,7 +855,7 @@ export async function signTransaction<ReturnFormat extends DataFormat>(
const response = await ethRpcMethods.signTransaction(
web3Context.requestManager,
formatTransaction(transaction, ETH_DATA_FORMAT, {
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
}),
);
// Some clients only return the encoded signed transaction (e.g. Ganache)
Expand All @@ -871,7 +871,7 @@ export async function signTransaction<ReturnFormat extends DataFormat>(
returnFormat,
),
tx: formatTransaction((response as SignedTransactionInfoAPI).tx, returnFormat, {
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
fillInputAndData: true,
}),
};
Expand All @@ -896,7 +896,7 @@ export async function call<ReturnFormat extends DataFormat>(
const response = await ethRpcMethods.call(
web3Context.requestManager,
formatTransaction(transaction, ETH_DATA_FORMAT, {
transactionSchema: web3Context.config.customTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
}),
blockNumberFormatted,
);
Expand All @@ -916,7 +916,7 @@ export async function estimateGas<ReturnFormat extends DataFormat>(
returnFormat: ReturnFormat,
) {
const transactionFormatted = formatTransaction(transaction, ETH_DATA_FORMAT, {
transactionSchema: web3Context.config.customTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
});
const blockNumberFormatted = isBlockTag(blockNumber as string)
? (blockNumber as BlockTag)
Expand Down Expand Up @@ -1089,7 +1089,7 @@ export async function createAccessList<ReturnFormat extends DataFormat>(
const response = (await ethRpcMethods.createAccessList(
web3Context.requestManager,
formatTransaction(transaction, ETH_DATA_FORMAT, {
transactionSchema: web3Context.config.customTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
}),
blockNumberFormatted,
)) as unknown as AccessListResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ export const prepareTransactionForSigning = async (
fillGasLimit,
})) as unknown as PopulatedUnsignedTransaction;
const formattedTransaction = formatTransaction(populatedTransaction, ETH_DATA_FORMAT, {
transactionSchema: web3Context.config.customTransactionSchema as CustomTransactionSchema,
transactionSchema: web3Context.config.customTransactionSchema as unknown as CustomTransactionSchema,
}) as unknown as FormatType<PopulatedUnsignedTransaction, typeof ETH_DATA_FORMAT>;

validateTransactionForSigning(
formattedTransaction as unknown as FormatType<Transaction, typeof ETH_DATA_FORMAT>,
undefined,
{
transactionSchema: web3Context.config
.customTransactionSchema as CustomTransactionSchema,
.customTransactionSchema as unknown as CustomTransactionSchema,
},
);

Expand Down
1 change: 0 additions & 1 deletion packages/web3-eth/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
ETH_DATA_FORMAT,
} from 'web3-types';
import {
ValidationSchemaInput,
isAddress,
isHexStrict,
isHexString32Bytes,
Expand Down

0 comments on commit 0348f44

Please sign in to comment.