Comparing version 4.6.1-dev.53e2466.0 to 4.6.1-dev.5d2f2aa.0
@@ -47,3 +47,6 @@ /** | ||
export { detectTransactionType } from './utils/detect_transaction_type.js'; | ||
export { transactionBuilder } from './utils/transaction_builder.js'; | ||
export { transactionBuilder, getTransactionFromOrToAttr } from './utils/transaction_builder.js'; | ||
export { waitForTransactionReceipt } from './utils/wait_for_transaction_receipt.js'; | ||
export { trySendTransaction } from './utils/try_send_transaction.js'; | ||
export { SendTxHelper } from './utils/send_tx_helper.js'; | ||
export default Web3Eth; |
@@ -33,3 +33,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transactionBuilder = exports.detectTransactionType = void 0; | ||
exports.SendTxHelper = exports.trySendTransaction = exports.waitForTransactionReceipt = exports.getTransactionFromOrToAttr = exports.transactionBuilder = exports.detectTransactionType = void 0; | ||
/** | ||
@@ -84,3 +84,10 @@ * The `web3-eth` package allows you to interact with an Ethereum blockchain and Ethereum smart contracts. | ||
Object.defineProperty(exports, "transactionBuilder", { enumerable: true, get: function () { return transaction_builder_js_1.transactionBuilder; } }); | ||
Object.defineProperty(exports, "getTransactionFromOrToAttr", { enumerable: true, get: function () { return transaction_builder_js_1.getTransactionFromOrToAttr; } }); | ||
var wait_for_transaction_receipt_js_1 = require("./utils/wait_for_transaction_receipt.js"); | ||
Object.defineProperty(exports, "waitForTransactionReceipt", { enumerable: true, get: function () { return wait_for_transaction_receipt_js_1.waitForTransactionReceipt; } }); | ||
var try_send_transaction_js_1 = require("./utils/try_send_transaction.js"); | ||
Object.defineProperty(exports, "trySendTransaction", { enumerable: true, get: function () { return try_send_transaction_js_1.trySendTransaction; } }); | ||
var send_tx_helper_js_1 = require("./utils/send_tx_helper.js"); | ||
Object.defineProperty(exports, "SendTxHelper", { enumerable: true, get: function () { return send_tx_helper_js_1.SendTxHelper; } }); | ||
exports.default = web3_eth_js_1.Web3Eth; | ||
//# sourceMappingURL=index.js.map |
import { FormatType, DataFormat, EthExecutionAPI, Web3BaseWalletAccount, HexString, TransactionReceipt, Transaction, TransactionCall, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex, TransactionWithFromAndToLocalWalletIndex, TransactionHash } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { SendSignedTransactionEvents, SendTransactionEvents, SendTransactionOptions } from '../types.js'; | ||
@@ -33,5 +34,6 @@ export declare class SendTxHelper<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>, TxType = Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex> { | ||
}): Promise<unknown>; | ||
emitConfirmation({ receipt, transactionHash, }: { | ||
emitConfirmation({ receipt, transactionHash, customTransactionReceiptSchema, }: { | ||
receipt: ResolveType; | ||
transactionHash: TransactionHash; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
}): void; | ||
@@ -38,0 +40,0 @@ handleResolve({ receipt, tx }: { |
@@ -146,5 +146,5 @@ "use strict"; | ||
} | ||
emitConfirmation({ receipt, transactionHash, }) { | ||
emitConfirmation({ receipt, transactionHash, customTransactionReceiptSchema, }) { | ||
if (this.promiEvent.listenerCount('confirmation') > 0) { | ||
(0, watch_transaction_for_confirmations_js_1.watchTransactionForConfirmations)(this.web3Context, this.promiEvent, receipt, transactionHash, this.returnFormat); | ||
(0, watch_transaction_for_confirmations_js_1.watchTransactionForConfirmations)(this.web3Context, this.promiEvent, receipt, transactionHash, this.returnFormat, customTransactionReceiptSchema); | ||
} | ||
@@ -151,0 +151,0 @@ } |
import { Web3Context } from 'web3-core'; | ||
import { EthExecutionAPI, Bytes, TransactionReceipt, DataFormat } from 'web3-types'; | ||
export declare function waitForTransactionReceipt<ReturnFormat extends DataFormat>(web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat): Promise<TransactionReceipt>; | ||
export declare function waitForTransactionReceipt<ReturnFormat extends DataFormat>(web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat, customGetTransactionReceipt?: (web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat) => Promise<TransactionReceipt>): Promise<TransactionReceipt>; |
@@ -36,3 +36,3 @@ "use strict"; | ||
const rpc_method_wrappers_js_1 = require("../rpc_method_wrappers.js"); | ||
function waitForTransactionReceipt(web3Context, transactionHash, returnFormat) { | ||
function waitForTransactionReceipt(web3Context, transactionHash, returnFormat, customGetTransactionReceipt) { | ||
var _a; | ||
@@ -43,3 +43,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
return (0, rpc_method_wrappers_js_1.getTransactionReceipt)(web3Context, transactionHash, returnFormat); | ||
return (customGetTransactionReceipt !== null && customGetTransactionReceipt !== void 0 ? customGetTransactionReceipt : rpc_method_wrappers_js_1.getTransactionReceipt)(web3Context, transactionHash, returnFormat); | ||
} | ||
@@ -46,0 +46,0 @@ catch (error) { |
import { EthExecutionAPI, TransactionReceipt } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { DataFormat } from 'web3-types'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { SendSignedTransactionEvents, SendTransactionEvents } from '../types.js'; | ||
@@ -9,2 +10,3 @@ export declare type Web3PromiEventEventTypeBase<ReturnFormat extends DataFormat> = SendTransactionEvents<ReturnFormat> | SendSignedTransactionEvents<ReturnFormat>; | ||
transactionReceipt: TransactionReceipt; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventTypeBase<ReturnFormat>>; | ||
@@ -18,2 +20,2 @@ returnFormat: ReturnFormat; | ||
*/ | ||
export declare const watchTransactionByPolling: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
export declare const watchTransactionByPolling: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; |
@@ -21,3 +21,3 @@ "use strict"; | ||
*/ | ||
const watchTransactionByPolling = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }) => { | ||
const watchTransactionByPolling = ({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }) => { | ||
var _a; | ||
@@ -36,3 +36,3 @@ // Having a transactionReceipt means that the transaction has already been included | ||
confirmations: (0, web3_utils_1.format)({ format: 'uint' }, confirmations, returnFormat), | ||
receipt: (0, web3_utils_1.format)(schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: (0, web3_utils_1.format)(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, nextBlock.hash, returnFormat), | ||
@@ -39,0 +39,0 @@ }); |
@@ -8,2 +8,2 @@ import { TransactionReceipt } from 'web3-types'; | ||
*/ | ||
export declare const watchTransactionBySubscription: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
export declare const watchTransactionBySubscription: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; |
@@ -20,3 +20,3 @@ "use strict"; | ||
*/ | ||
const watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }) => { | ||
const watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }) => { | ||
// The following variable will stay true except if the data arrived, | ||
@@ -44,3 +44,3 @@ // or if watching started after an error had occurred. | ||
confirmations: (0, web3_utils_1.format)({ format: 'uint' }, confirmations, returnFormat), | ||
receipt: (0, web3_utils_1.format)(schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: (0, web3_utils_1.format)(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, newBlockHeader.parentHash, returnFormat), | ||
@@ -60,2 +60,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -69,2 +70,3 @@ }); | ||
transactionReceipt, | ||
customTransactionReceiptSchema, | ||
transactionPromiEvent, | ||
@@ -71,0 +73,0 @@ returnFormat, |
import { Bytes, EthExecutionAPI, TransactionReceipt } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { DataFormat } from 'web3-types'; | ||
import { Web3PromiEventEventTypeBase } from './watch_transaction_by_polling.js'; | ||
export declare function watchTransactionForConfirmations<ReturnFormat extends DataFormat, Web3PromiEventEventType extends Web3PromiEventEventTypeBase<ReturnFormat>, ResolveType = TransactionReceipt>(web3Context: Web3Context<EthExecutionAPI>, transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventType>, transactionReceipt: TransactionReceipt, transactionHash: Bytes, returnFormat: ReturnFormat): void; | ||
export declare function watchTransactionForConfirmations<ReturnFormat extends DataFormat, Web3PromiEventEventType extends Web3PromiEventEventTypeBase<ReturnFormat>, ResolveType = TransactionReceipt>(web3Context: Web3Context<EthExecutionAPI>, transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventType>, transactionReceipt: TransactionReceipt, transactionHash: Bytes, returnFormat: ReturnFormat, customTransactionReceiptSchema?: JsonSchema): void; |
@@ -10,3 +10,3 @@ "use strict"; | ||
const watch_transaction_by_subscription_js_1 = require("./watch_transaction_by_subscription.js"); | ||
function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat) { | ||
function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat, customTransactionReceiptSchema) { | ||
if ((0, web3_validator_1.isNullish)(transactionReceipt) || (0, web3_validator_1.isNullish)(transactionReceipt.blockHash)) | ||
@@ -23,3 +23,3 @@ throw new web3_errors_1.TransactionMissingReceiptOrBlockHashError({ | ||
confirmations: (0, web3_utils_1.format)({ format: 'uint' }, 1, returnFormat), | ||
receipt: (0, web3_utils_1.format)(schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: (0, web3_utils_1.format)(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : schemas_js_1.transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: (0, web3_utils_1.format)({ format: 'bytes32' }, transactionReceipt.blockHash, returnFormat), | ||
@@ -34,2 +34,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -43,2 +44,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -45,0 +47,0 @@ }); |
@@ -63,4 +63,7 @@ /* | ||
export { detectTransactionType } from './utils/detect_transaction_type.js'; | ||
export { transactionBuilder } from './utils/transaction_builder.js'; | ||
export { transactionBuilder, getTransactionFromOrToAttr } from './utils/transaction_builder.js'; | ||
export { waitForTransactionReceipt } from './utils/wait_for_transaction_receipt.js'; | ||
export { trySendTransaction } from './utils/try_send_transaction.js'; | ||
export { SendTxHelper } from './utils/send_tx_helper.js'; | ||
export default Web3Eth; | ||
//# sourceMappingURL=index.js.map |
@@ -143,5 +143,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
emitConfirmation({ receipt, transactionHash, }) { | ||
emitConfirmation({ receipt, transactionHash, customTransactionReceiptSchema, }) { | ||
if (this.promiEvent.listenerCount('confirmation') > 0) { | ||
watchTransactionForConfirmations(this.web3Context, this.promiEvent, receipt, transactionHash, this.returnFormat); | ||
watchTransactionForConfirmations(this.web3Context, this.promiEvent, receipt, transactionHash, this.returnFormat, customTransactionReceiptSchema); | ||
} | ||
@@ -148,0 +148,0 @@ } |
@@ -33,3 +33,3 @@ /* | ||
import { getTransactionReceipt } from '../rpc_method_wrappers.js'; | ||
export function waitForTransactionReceipt(web3Context, transactionHash, returnFormat) { | ||
export function waitForTransactionReceipt(web3Context, transactionHash, returnFormat, customGetTransactionReceipt) { | ||
var _a; | ||
@@ -40,3 +40,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
return getTransactionReceipt(web3Context, transactionHash, returnFormat); | ||
return (customGetTransactionReceipt !== null && customGetTransactionReceipt !== void 0 ? customGetTransactionReceipt : getTransactionReceipt)(web3Context, transactionHash, returnFormat); | ||
} | ||
@@ -43,0 +43,0 @@ catch (error) { |
@@ -18,3 +18,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
*/ | ||
export const watchTransactionByPolling = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }) => { | ||
export const watchTransactionByPolling = ({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }) => { | ||
var _a; | ||
@@ -33,3 +33,3 @@ // Having a transactionReceipt means that the transaction has already been included | ||
confirmations: format({ format: 'uint' }, confirmations, returnFormat), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: format({ format: 'bytes32' }, nextBlock.hash, returnFormat), | ||
@@ -36,0 +36,0 @@ }); |
@@ -17,3 +17,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
*/ | ||
export const watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }) => { | ||
export const watchTransactionBySubscription = ({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }) => { | ||
// The following variable will stay true except if the data arrived, | ||
@@ -41,3 +41,3 @@ // or if watching started after an error had occurred. | ||
confirmations: format({ format: 'uint' }, confirmations, returnFormat), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: format({ format: 'bytes32' }, newBlockHeader.parentHash, returnFormat), | ||
@@ -57,2 +57,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -66,2 +67,3 @@ }); | ||
transactionReceipt, | ||
customTransactionReceiptSchema, | ||
transactionPromiEvent, | ||
@@ -68,0 +70,0 @@ returnFormat, |
@@ -7,3 +7,3 @@ import { format } from 'web3-utils'; | ||
import { watchTransactionBySubscription } from './watch_transaction_by_subscription.js'; | ||
export function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat) { | ||
export function watchTransactionForConfirmations(web3Context, transactionPromiEvent, transactionReceipt, transactionHash, returnFormat, customTransactionReceiptSchema) { | ||
if (isNullish(transactionReceipt) || isNullish(transactionReceipt.blockHash)) | ||
@@ -20,3 +20,3 @@ throw new TransactionMissingReceiptOrBlockHashError({ | ||
confirmations: format({ format: 'uint' }, 1, returnFormat), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format(customTransactionReceiptSchema !== null && customTransactionReceiptSchema !== void 0 ? customTransactionReceiptSchema : transactionReceiptSchema, transactionReceipt, returnFormat), | ||
latestBlockHash: format({ format: 'bytes32' }, transactionReceipt.blockHash, returnFormat), | ||
@@ -31,2 +31,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -40,2 +41,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -42,0 +44,0 @@ }); |
@@ -47,4 +47,7 @@ /** | ||
export { detectTransactionType } from './utils/detect_transaction_type.js'; | ||
export { transactionBuilder } from './utils/transaction_builder.js'; | ||
export { transactionBuilder, getTransactionFromOrToAttr } from './utils/transaction_builder.js'; | ||
export { waitForTransactionReceipt } from './utils/wait_for_transaction_receipt.js'; | ||
export { trySendTransaction } from './utils/try_send_transaction.js'; | ||
export { SendTxHelper } from './utils/send_tx_helper.js'; | ||
export default Web3Eth; | ||
//# sourceMappingURL=index.d.ts.map |
import { FormatType, DataFormat, EthExecutionAPI, Web3BaseWalletAccount, HexString, TransactionReceipt, Transaction, TransactionCall, TransactionWithFromLocalWalletIndex, TransactionWithToLocalWalletIndex, TransactionWithFromAndToLocalWalletIndex, TransactionHash } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { SendSignedTransactionEvents, SendTransactionEvents, SendTransactionOptions } from '../types.js'; | ||
@@ -33,5 +34,6 @@ export declare class SendTxHelper<ReturnFormat extends DataFormat, ResolveType = FormatType<TransactionReceipt, ReturnFormat>, TxType = Transaction | TransactionWithFromLocalWalletIndex | TransactionWithToLocalWalletIndex | TransactionWithFromAndToLocalWalletIndex> { | ||
}): Promise<unknown>; | ||
emitConfirmation({ receipt, transactionHash, }: { | ||
emitConfirmation({ receipt, transactionHash, customTransactionReceiptSchema, }: { | ||
receipt: ResolveType; | ||
transactionHash: TransactionHash; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
}): void; | ||
@@ -38,0 +40,0 @@ handleResolve({ receipt, tx }: { |
import { Web3Context } from 'web3-core'; | ||
import { EthExecutionAPI, Bytes, TransactionReceipt, DataFormat } from 'web3-types'; | ||
export declare function waitForTransactionReceipt<ReturnFormat extends DataFormat>(web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat): Promise<TransactionReceipt>; | ||
export declare function waitForTransactionReceipt<ReturnFormat extends DataFormat>(web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat, customGetTransactionReceipt?: (web3Context: Web3Context<EthExecutionAPI>, transactionHash: Bytes, returnFormat: ReturnFormat) => Promise<TransactionReceipt>): Promise<TransactionReceipt>; | ||
//# sourceMappingURL=wait_for_transaction_receipt.d.ts.map |
import { EthExecutionAPI, TransactionReceipt } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { DataFormat } from 'web3-types'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { SendSignedTransactionEvents, SendTransactionEvents } from '../types.js'; | ||
@@ -9,2 +10,3 @@ export declare type Web3PromiEventEventTypeBase<ReturnFormat extends DataFormat> = SendTransactionEvents<ReturnFormat> | SendSignedTransactionEvents<ReturnFormat>; | ||
transactionReceipt: TransactionReceipt; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventTypeBase<ReturnFormat>>; | ||
@@ -18,3 +20,3 @@ returnFormat: ReturnFormat; | ||
*/ | ||
export declare const watchTransactionByPolling: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
export declare const watchTransactionByPolling: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
//# sourceMappingURL=watch_transaction_by_polling.d.ts.map |
@@ -8,3 +8,3 @@ import { TransactionReceipt } from 'web3-types'; | ||
*/ | ||
export declare const watchTransactionBySubscription: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
export declare const watchTransactionBySubscription: <ReturnFormat extends DataFormat, ResolveType = TransactionReceipt>({ web3Context, transactionReceipt, transactionPromiEvent, customTransactionReceiptSchema, returnFormat, }: WaitProps<ReturnFormat, ResolveType>) => void; | ||
//# sourceMappingURL=watch_transaction_by_subscription.d.ts.map |
import { Bytes, EthExecutionAPI, TransactionReceipt } from 'web3-types'; | ||
import { Web3Context, Web3PromiEvent } from 'web3-core'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { DataFormat } from 'web3-types'; | ||
import { Web3PromiEventEventTypeBase } from './watch_transaction_by_polling.js'; | ||
export declare function watchTransactionForConfirmations<ReturnFormat extends DataFormat, Web3PromiEventEventType extends Web3PromiEventEventTypeBase<ReturnFormat>, ResolveType = TransactionReceipt>(web3Context: Web3Context<EthExecutionAPI>, transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventType>, transactionReceipt: TransactionReceipt, transactionHash: Bytes, returnFormat: ReturnFormat): void; | ||
export declare function watchTransactionForConfirmations<ReturnFormat extends DataFormat, Web3PromiEventEventType extends Web3PromiEventEventTypeBase<ReturnFormat>, ResolveType = TransactionReceipt>(web3Context: Web3Context<EthExecutionAPI>, transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventType>, transactionReceipt: TransactionReceipt, transactionHash: Bytes, returnFormat: ReturnFormat, customTransactionReceiptSchema?: JsonSchema): void; | ||
//# sourceMappingURL=watch_transaction_for_confirmations.d.ts.map |
{ | ||
"name": "web3-eth", | ||
"version": "4.6.1-dev.53e2466.0+53e2466", | ||
"version": "4.6.1-dev.5d2f2aa.0+5d2f2aa", | ||
"description": "Web3 module to interact with the Ethereum blockchain and smart contracts.", | ||
@@ -33,3 +33,3 @@ "main": "./lib/commonjs/index.js", | ||
"build:check": "node -e \"require('./lib')\"", | ||
"lint": "eslint --ext .js,.ts .", | ||
"lint": "eslint --cache --cache-strategy content --ext .ts .", | ||
"lint:fix": "eslint --fix --ext .js,.ts .", | ||
@@ -63,18 +63,18 @@ "format": "prettier --write '**/*'", | ||
"typescript": "^4.7.4", | ||
"web3-providers-http": "4.1.1-dev.53e2466.0+53e2466" | ||
"web3-providers-http": "4.1.1-dev.5d2f2aa.0+5d2f2aa" | ||
}, | ||
"dependencies": { | ||
"setimmediate": "^1.0.5", | ||
"web3-core": "4.3.3-dev.53e2466.0+53e2466", | ||
"web3-errors": "1.1.5-dev.53e2466.0+53e2466", | ||
"web3-eth-abi": "4.2.2-dev.53e2466.0+53e2466", | ||
"web3-eth-accounts": "4.1.3-dev.53e2466.0+53e2466", | ||
"web3-net": "4.0.8-dev.53e2466.0+53e2466", | ||
"web3-providers-ws": "4.0.8-dev.53e2466.0+53e2466", | ||
"web3-rpc-methods": "1.2.1-dev.53e2466.0+53e2466", | ||
"web3-types": "1.6.1-dev.53e2466.0+53e2466", | ||
"web3-utils": "4.2.4-dev.53e2466.0+53e2466", | ||
"web3-validator": "2.0.6-dev.53e2466.0+53e2466" | ||
"web3-core": "4.3.3-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-errors": "1.1.5-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-eth-abi": "4.2.2-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-eth-accounts": "4.1.3-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-net": "4.0.8-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-providers-ws": "4.0.8-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-rpc-methods": "1.2.1-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-types": "1.6.1-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-utils": "4.2.4-dev.5d2f2aa.0+5d2f2aa", | ||
"web3-validator": "2.0.6-dev.5d2f2aa.0+5d2f2aa" | ||
}, | ||
"gitHead": "53e24664e4c660826eb10207b480848e677a73e6" | ||
"gitHead": "5d2f2aa2cc628e0d73507687449737dfa419e2e4" | ||
} |
@@ -66,4 +66,7 @@ /* | ||
export { detectTransactionType } from './utils/detect_transaction_type.js'; | ||
export { transactionBuilder } from './utils/transaction_builder.js'; | ||
export { transactionBuilder, getTransactionFromOrToAttr } from './utils/transaction_builder.js'; | ||
export { waitForTransactionReceipt } from './utils/wait_for_transaction_receipt.js'; | ||
export { trySendTransaction } from './utils/try_send_transaction.js'; | ||
export { SendTxHelper } from './utils/send_tx_helper.js'; | ||
export default Web3Eth; |
@@ -36,3 +36,3 @@ /* | ||
import { Web3Context, Web3EventEmitter, Web3PromiEvent } from 'web3-core'; | ||
import { isNullish } from 'web3-validator'; | ||
import { isNullish, JsonSchema } from 'web3-validator'; | ||
import { | ||
@@ -261,5 +261,7 @@ ContractExecutionError, | ||
transactionHash, | ||
customTransactionReceiptSchema, | ||
}: { | ||
receipt: ResolveType; | ||
transactionHash: TransactionHash; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
}) { | ||
@@ -277,2 +279,3 @@ if (this.promiEvent.listenerCount('confirmation') > 0) { | ||
this.returnFormat, | ||
customTransactionReceiptSchema, | ||
); | ||
@@ -279,0 +282,0 @@ } |
@@ -33,15 +33,26 @@ /* | ||
returnFormat: ReturnFormat, | ||
customGetTransactionReceipt?: ( | ||
web3Context: Web3Context<EthExecutionAPI>, | ||
transactionHash: Bytes, | ||
returnFormat: ReturnFormat, | ||
) => Promise<TransactionReceipt>, | ||
): Promise<TransactionReceipt> { | ||
const pollingInterval = | ||
web3Context.transactionReceiptPollingInterval ?? web3Context.transactionPollingInterval; | ||
const [awaitableTransactionReceipt, IntervalId] = pollTillDefinedAndReturnIntervalId(async () => { | ||
try { | ||
return getTransactionReceipt(web3Context, transactionHash, returnFormat); | ||
} catch (error) { | ||
console.warn('An error happen while trying to get the transaction receipt', error); | ||
return undefined; | ||
} | ||
}, pollingInterval); | ||
const [awaitableTransactionReceipt, IntervalId] = pollTillDefinedAndReturnIntervalId( | ||
async () => { | ||
try { | ||
return (customGetTransactionReceipt ?? getTransactionReceipt)( | ||
web3Context, | ||
transactionHash, | ||
returnFormat, | ||
); | ||
} catch (error) { | ||
console.warn('An error happen while trying to get the transaction receipt', error); | ||
return undefined; | ||
} | ||
}, | ||
pollingInterval, | ||
); | ||
@@ -69,8 +80,6 @@ const [timeoutId, rejectOnTimeout] = rejectIfTimeout( | ||
} finally { | ||
if(timeoutId) | ||
clearTimeout(timeoutId); | ||
if(IntervalId) | ||
clearInterval(IntervalId); | ||
if (timeoutId) clearTimeout(timeoutId); | ||
if (IntervalId) clearInterval(IntervalId); | ||
blockTimeoutResourceCleaner.clean(); | ||
} | ||
} |
@@ -23,2 +23,3 @@ /* | ||
import { DataFormat } from 'web3-types'; | ||
import { JsonSchema } from 'web3-validator'; | ||
import { SendSignedTransactionEvents, SendTransactionEvents } from '../types.js'; | ||
@@ -34,2 +35,3 @@ import { transactionReceiptSchema } from '../schemas.js'; | ||
transactionReceipt: TransactionReceipt; | ||
customTransactionReceiptSchema?: JsonSchema; | ||
transactionPromiEvent: Web3PromiEvent<ResolveType, Web3PromiEventEventTypeBase<ReturnFormat>>; | ||
@@ -51,2 +53,3 @@ returnFormat: ReturnFormat; | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -73,3 +76,7 @@ }: WaitProps<ReturnFormat, ResolveType>) => { | ||
confirmations: format({ format: 'uint' }, confirmations, returnFormat), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format( | ||
customTransactionReceiptSchema ?? transactionReceiptSchema, | ||
transactionReceipt, | ||
returnFormat, | ||
), | ||
latestBlockHash: format( | ||
@@ -76,0 +83,0 @@ { format: 'bytes32' }, |
@@ -24,3 +24,2 @@ /* | ||
import { WaitProps, watchTransactionByPolling } from './watch_transaction_by_polling.js'; | ||
/** | ||
@@ -37,2 +36,3 @@ * This function watches a Transaction by subscribing to new heads. | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -71,3 +71,7 @@ }: WaitProps<ReturnFormat, ResolveType>) => { | ||
), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format( | ||
customTransactionReceiptSchema ?? transactionReceiptSchema, | ||
transactionReceipt, | ||
returnFormat, | ||
), | ||
latestBlockHash: format( | ||
@@ -91,2 +95,3 @@ { format: 'bytes32' }, | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -101,2 +106,3 @@ }); | ||
transactionReceipt, | ||
customTransactionReceiptSchema, | ||
transactionPromiEvent, | ||
@@ -103,0 +109,0 @@ returnFormat, |
@@ -20,3 +20,3 @@ /* | ||
import { format } from 'web3-utils'; | ||
import { isNullish } from 'web3-validator'; | ||
import { isNullish, JsonSchema } from 'web3-validator'; | ||
@@ -45,2 +45,3 @@ import { | ||
returnFormat: ReturnFormat, | ||
customTransactionReceiptSchema?: JsonSchema, | ||
) { | ||
@@ -60,3 +61,7 @@ if (isNullish(transactionReceipt) || isNullish(transactionReceipt.blockHash)) | ||
confirmations: format({ format: 'uint' }, 1, returnFormat), | ||
receipt: format(transactionReceiptSchema, transactionReceipt, returnFormat), | ||
receipt: format( | ||
customTransactionReceiptSchema ?? transactionReceiptSchema, | ||
transactionReceipt, | ||
returnFormat, | ||
), | ||
latestBlockHash: format({ format: 'bytes32' }, transactionReceipt.blockHash, returnFormat), | ||
@@ -72,2 +77,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -80,2 +86,3 @@ }); | ||
transactionPromiEvent, | ||
customTransactionReceiptSchema, | ||
returnFormat, | ||
@@ -82,0 +89,0 @@ }); |
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 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 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 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 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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
1311133
23264