Comparing version 4.7.1-dev.fd2982d.0 to 4.8.0
import { FormatType, DataFormat, EthExecutionAPI, SignedTransactionInfoAPI, Address, BlockNumberOrTag, Bytes, Filter, Numbers, TransactionReceipt, Transaction, TransactionCall, Web3EthExecutionAPI, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex, TransactionWithFromAndToLocalWalletIndex, TransactionForAccessList, Eip712TypedData } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { SendSignedTransactionEvents, SendSignedTransactionOptions, SendTransactionEvents, SendTransactionOptions } from './types.js'; | ||
import { SendSignedTransactionEvents, SendSignedTransactionOptions, SendTransactionEvents, SendTransactionOptions, TransactionMiddleware } from './types.js'; | ||
/** | ||
@@ -404,3 +404,3 @@ * View additional documentations here: {@link Web3Eth.getProtocolVersion} | ||
*/ | ||
export declare function sendTransaction<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>>(web3Context: Web3Context<EthExecutionAPI>, transaction: Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex, returnFormat: ReturnFormat, options?: SendTransactionOptions<ResolveType>): Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>; | ||
export declare function sendTransaction<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>>(web3Context: Web3Context<EthExecutionAPI>, transactionObj: Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex, returnFormat: ReturnFormat, options?: SendTransactionOptions<ResolveType>, transactionMiddleware?: TransactionMiddleware): Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>; | ||
/** | ||
@@ -407,0 +407,0 @@ * View additional documentations here: {@link Web3Eth.sendSignedTransaction} |
@@ -346,3 +346,3 @@ "use strict"; | ||
*/ | ||
function sendTransaction(web3Context, transaction, returnFormat, options = { checkRevertBeforeSending: true }) { | ||
function sendTransaction(web3Context, transactionObj, returnFormat, options = { checkRevertBeforeSending: true }, transactionMiddleware) { | ||
const promiEvent = new web3_core_1.Web3PromiEvent((resolve, reject) => { | ||
@@ -357,2 +357,6 @@ setImmediate(() => { | ||
}); | ||
let transaction = Object.assign({}, transactionObj); | ||
if (!(0, web3_validator_1.isNullish)(transactionMiddleware)) { | ||
transaction = yield transactionMiddleware.processTransaction(transaction); | ||
} | ||
let transactionFormatted = (0, format_transaction_js_1.formatTransaction)(Object.assign(Object.assign({}, transaction), { from: (0, transaction_builder_js_1.getTransactionFromOrToAttr)('from', web3Context, transaction), to: (0, transaction_builder_js_1.getTransactionFromOrToAttr)('to', web3Context, transaction) }), web3_types_1.ETH_DATA_FORMAT); | ||
@@ -359,0 +363,0 @@ try { |
import { ContractExecutionError, TransactionRevertedWithoutReasonError, TransactionRevertInstructionError, TransactionRevertWithCustomError, InvalidResponseError, TransactionPollingTimeoutError } from 'web3-errors'; | ||
import { FormatType, ETH_DATA_FORMAT, DataFormat, Bytes, ContractAbi, HexString, Numbers, Transaction, TransactionReceipt } from 'web3-types'; | ||
import { FormatType, ETH_DATA_FORMAT, DataFormat, Bytes, ContractAbi, HexString, Numbers, Transaction, TransactionReceipt, TransactionWithFromAndToLocalWalletIndex, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex } from 'web3-types'; | ||
export declare type InternalTransaction = FormatType<Transaction, typeof ETH_DATA_FORMAT>; | ||
@@ -40,1 +40,7 @@ export declare type SendTransactionEventsBase<ReturnFormat extends DataFormat, TxType> = { | ||
} | ||
export declare type TransactionMiddlewareData = Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex; | ||
export interface TransactionMiddleware { | ||
processTransaction(transaction: TransactionMiddlewareData, options?: { | ||
[key: string]: unknown; | ||
}): Promise<TransactionMiddlewareData>; | ||
} |
@@ -323,3 +323,3 @@ /* | ||
*/ | ||
export function sendTransaction(web3Context, transaction, returnFormat, options = { checkRevertBeforeSending: true }) { | ||
export function sendTransaction(web3Context, transactionObj, returnFormat, options = { checkRevertBeforeSending: true }, transactionMiddleware) { | ||
const promiEvent = new Web3PromiEvent((resolve, reject) => { | ||
@@ -334,2 +334,6 @@ setImmediate(() => { | ||
}); | ||
let transaction = Object.assign({}, transactionObj); | ||
if (!isNullish(transactionMiddleware)) { | ||
transaction = yield transactionMiddleware.processTransaction(transaction); | ||
} | ||
let transactionFormatted = formatTransaction(Object.assign(Object.assign({}, transaction), { from: getTransactionFromOrToAttr('from', web3Context, transaction), to: getTransactionFromOrToAttr('to', web3Context, transaction) }), ETH_DATA_FORMAT); | ||
@@ -336,0 +340,0 @@ try { |
import { FormatType, DataFormat, EthExecutionAPI, SignedTransactionInfoAPI, Address, BlockNumberOrTag, Bytes, Filter, Numbers, TransactionReceipt, Transaction, TransactionCall, Web3EthExecutionAPI, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex, TransactionWithFromAndToLocalWalletIndex, TransactionForAccessList, Eip712TypedData } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { SendSignedTransactionEvents, SendSignedTransactionOptions, SendTransactionEvents, SendTransactionOptions } from './types.js'; | ||
import { SendSignedTransactionEvents, SendSignedTransactionOptions, SendTransactionEvents, SendTransactionOptions, TransactionMiddleware } from './types.js'; | ||
/** | ||
@@ -404,3 +404,3 @@ * View additional documentations here: {@link Web3Eth.getProtocolVersion} | ||
*/ | ||
export declare function sendTransaction<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>>(web3Context: Web3Context<EthExecutionAPI>, transaction: Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex, returnFormat: ReturnFormat, options?: SendTransactionOptions<ResolveType>): Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>; | ||
export declare function sendTransaction<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>>(web3Context: Web3Context<EthExecutionAPI>, transactionObj: Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex, returnFormat: ReturnFormat, options?: SendTransactionOptions<ResolveType>, transactionMiddleware?: TransactionMiddleware): Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>; | ||
/** | ||
@@ -407,0 +407,0 @@ * View additional documentations here: {@link Web3Eth.sendSignedTransaction} |
import { ContractExecutionError, TransactionRevertedWithoutReasonError, TransactionRevertInstructionError, TransactionRevertWithCustomError, InvalidResponseError, TransactionPollingTimeoutError } from 'web3-errors'; | ||
import { FormatType, ETH_DATA_FORMAT, DataFormat, Bytes, ContractAbi, HexString, Numbers, Transaction, TransactionReceipt } from 'web3-types'; | ||
import { FormatType, ETH_DATA_FORMAT, DataFormat, Bytes, ContractAbi, HexString, Numbers, Transaction, TransactionReceipt, TransactionWithFromAndToLocalWalletIndex, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex } from 'web3-types'; | ||
export declare type InternalTransaction = FormatType<Transaction, typeof ETH_DATA_FORMAT>; | ||
@@ -40,2 +40,8 @@ export declare type SendTransactionEventsBase<ReturnFormat extends DataFormat, TxType> = { | ||
} | ||
export declare type TransactionMiddlewareData = Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex; | ||
export interface TransactionMiddleware { | ||
processTransaction(transaction: TransactionMiddlewareData, options?: { | ||
[key: string]: unknown; | ||
}): Promise<TransactionMiddlewareData>; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "web3-eth", | ||
"version": "4.7.1-dev.fd2982d.0+fd2982d", | ||
"version": "4.8.0", | ||
"description": "Web3 module to interact with the Ethereum blockchain and smart contracts.", | ||
@@ -62,18 +62,18 @@ "main": "./lib/commonjs/index.js", | ||
"typescript": "^4.7.4", | ||
"web3-providers-http": "4.1.1-dev.fd2982d.0+fd2982d" | ||
"web3-providers-http": "^4.1.0" | ||
}, | ||
"dependencies": { | ||
"setimmediate": "^1.0.5", | ||
"web3-core": "4.4.1-dev.fd2982d.0+fd2982d", | ||
"web3-errors": "1.2.1-dev.fd2982d.0+fd2982d", | ||
"web3-eth-abi": "4.2.3-dev.fd2982d.0+fd2982d", | ||
"web3-eth-accounts": "4.1.3-dev.fd2982d.0+fd2982d", | ||
"web3-net": "4.1.1-dev.fd2982d.0+fd2982d", | ||
"web3-providers-ws": "4.0.8-dev.fd2982d.0+fd2982d", | ||
"web3-rpc-methods": "1.3.1-dev.fd2982d.0+fd2982d", | ||
"web3-types": "1.6.1-dev.fd2982d.0+fd2982d", | ||
"web3-utils": "4.3.1-dev.fd2982d.0+fd2982d", | ||
"web3-validator": "2.0.7-dev.fd2982d.0+fd2982d" | ||
"web3-core": "^4.5.0", | ||
"web3-errors": "^1.2.0", | ||
"web3-eth-abi": "^4.2.2", | ||
"web3-eth-accounts": "^4.1.2", | ||
"web3-net": "^4.1.0", | ||
"web3-providers-ws": "^4.0.7", | ||
"web3-rpc-methods": "^1.3.0", | ||
"web3-types": "^1.7.0", | ||
"web3-utils": "^4.3.0", | ||
"web3-validator": "^2.0.6" | ||
}, | ||
"gitHead": "fd2982d1afacd6bf89084324b478ec04af18052e" | ||
"gitHead": "d6d4c6df8f6b6323bc5fe277cbee969c28c845a7" | ||
} |
@@ -73,2 +73,3 @@ /* | ||
SendTransactionOptions, | ||
TransactionMiddleware, | ||
} from './types.js'; | ||
@@ -548,3 +549,3 @@ // eslint-disable-next-line import/no-cycle | ||
web3Context: Web3Context<EthExecutionAPI>, | ||
transaction: | ||
transactionObj: | ||
| Transaction | ||
@@ -556,2 +557,3 @@ | TransactionWithFromLocalWalletIndex | ||
options: SendTransactionOptions<ResolveType> = { checkRevertBeforeSending: true }, | ||
transactionMiddleware?: TransactionMiddleware | ||
): Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>> { | ||
@@ -569,2 +571,8 @@ const promiEvent = new Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>( | ||
let transaction = {...transactionObj}; | ||
if(!isNullish(transactionMiddleware)){ | ||
transaction = await transactionMiddleware.processTransaction(transaction); | ||
} | ||
let transactionFormatted: | ||
@@ -571,0 +579,0 @@ | Transaction |
@@ -36,2 +36,5 @@ /* | ||
TransactionReceipt, | ||
TransactionWithFromAndToLocalWalletIndex, | ||
TransactionWithFromLocalWalletIndex, | ||
TransactionWithToLocalWalletIndex, | ||
} from 'web3-types'; | ||
@@ -92,1 +95,15 @@ | ||
} | ||
export type TransactionMiddlewareData = Transaction | ||
| TransactionWithFromLocalWalletIndex | ||
| TransactionWithToLocalWalletIndex | ||
| TransactionWithFromAndToLocalWalletIndex; | ||
export interface TransactionMiddleware{ | ||
// for transaction processing before signing | ||
processTransaction( | ||
transaction: TransactionMiddlewareData, | ||
options?: { [key: string]: unknown }, | ||
): Promise<TransactionMiddlewareData>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1318560
23357
1
0
+ Added@ethereumjs/rlp@4.0.1(transitive)
+ Added@noble/curves@1.4.2(transitive)
+ Added@noble/hashes@1.4.0(transitive)
+ Added@scure/base@1.1.9(transitive)
+ Added@scure/bip32@1.4.0(transitive)
+ Added@scure/bip39@1.3.0(transitive)
+ Added@types/node@22.7.4(transitive)
+ Added@types/ws@8.5.3(transitive)
+ Addedabitype@0.7.1(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addedcross-fetch@4.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedethereum-cryptography@2.2.1(transitive)
+ Addedeventemitter3@5.0.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arguments@1.1.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-generator-function@1.0.10(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedisomorphic-ws@5.0.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtypescript@5.6.2(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedutil@0.12.5(transitive)
+ Addedweb3-core@4.6.0(transitive)
+ Addedweb3-errors@1.3.0(transitive)
+ Addedweb3-eth-abi@4.2.4(transitive)
+ Addedweb3-eth-accounts@4.2.1(transitive)
+ Addedweb3-eth-iban@4.0.7(transitive)
+ Addedweb3-net@4.1.0(transitive)
+ Addedweb3-providers-http@4.2.0(transitive)
+ Addedweb3-providers-ipc@4.0.7(transitive)
+ Addedweb3-providers-ws@4.0.8(transitive)
+ Addedweb3-rpc-methods@1.3.0(transitive)
+ Addedweb3-types@1.8.0(transitive)
+ Addedweb3-utils@4.3.1(transitive)
+ Addedweb3-validator@2.0.6(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
+ Addedws@8.18.0(transitive)
+ Addedzod@3.23.8(transitive)
Updatedweb3-core@^4.5.0
Updatedweb3-errors@^1.2.0
Updatedweb3-eth-abi@^4.2.2
Updatedweb3-eth-accounts@^4.1.2
Updatedweb3-net@^4.1.0
Updatedweb3-providers-ws@^4.0.7
Updatedweb3-rpc-methods@^1.3.0
Updatedweb3-types@^1.7.0
Updatedweb3-utils@^4.3.0
Updatedweb3-validator@^2.0.6