@ethersproject/providers
Advanced tools
Comparing version 5.3.0 to 5.3.1
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.3.0"; | ||
export declare const version = "providers/5.3.1"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "providers/5.3.0"; | ||
export const version = "providers/5.3.1"; | ||
//# sourceMappingURL=_version.js.map |
@@ -184,14 +184,23 @@ "use strict"; | ||
sendTransaction(transaction) { | ||
return this.sendUncheckedTransaction(transaction).then((hash) => { | ||
return poll(() => { | ||
return this.provider.getTransaction(hash).then((tx) => { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// This cannot be mined any earlier than any recent block | ||
const blockNumber = yield this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval); | ||
// Send the transaction | ||
const hash = yield this.sendUncheckedTransaction(transaction); | ||
try { | ||
// Unfortunately, JSON-RPC only provides and opaque transaction hash | ||
// for a response, and we need the actual transaction, so we poll | ||
// for it; it should show up very quickly | ||
return yield poll(() => __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.provider.getTransaction(hash); | ||
if (tx === null) { | ||
return undefined; | ||
} | ||
return this.provider._wrapTransaction(tx, hash); | ||
}); | ||
}, { oncePoll: this.provider }).catch((error) => { | ||
return this.provider._wrapTransaction(tx, hash, blockNumber); | ||
}), { oncePoll: this.provider }); | ||
} | ||
catch (error) { | ||
error.transactionHash = hash; | ||
throw error; | ||
}); | ||
} | ||
}); | ||
@@ -198,0 +207,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.3.0"; | ||
export declare const version = "providers/5.3.1"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "providers/5.3.0"; | ||
exports.version = "providers/5.3.1"; | ||
//# sourceMappingURL=_version.js.map |
@@ -235,14 +235,41 @@ "use strict"; | ||
JsonRpcSigner.prototype.sendTransaction = function (transaction) { | ||
var _this = this; | ||
return this.sendUncheckedTransaction(transaction).then(function (hash) { | ||
return web_1.poll(function () { | ||
return _this.provider.getTransaction(hash).then(function (tx) { | ||
if (tx === null) { | ||
return undefined; | ||
} | ||
return _this.provider._wrapTransaction(tx, hash); | ||
}); | ||
}, { oncePoll: _this.provider }).catch(function (error) { | ||
error.transactionHash = hash; | ||
throw error; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var blockNumber, hash, error_1; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval)]; | ||
case 1: | ||
blockNumber = _a.sent(); | ||
return [4 /*yield*/, this.sendUncheckedTransaction(transaction)]; | ||
case 2: | ||
hash = _a.sent(); | ||
_a.label = 3; | ||
case 3: | ||
_a.trys.push([3, 5, , 6]); | ||
return [4 /*yield*/, web_1.poll(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var tx; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.provider.getTransaction(hash)]; | ||
case 1: | ||
tx = _a.sent(); | ||
if (tx === null) { | ||
return [2 /*return*/, undefined]; | ||
} | ||
return [2 /*return*/, this.provider._wrapTransaction(tx, hash, blockNumber)]; | ||
} | ||
}); | ||
}); }, { oncePoll: this.provider })]; | ||
case 4: | ||
// Unfortunately, JSON-RPC only provides and opaque transaction hash | ||
// for a response, and we need the actual transaction, so we poll | ||
// for it; it should show up very quickly | ||
return [2 /*return*/, _a.sent()]; | ||
case 5: | ||
error_1 = _a.sent(); | ||
error_1.transactionHash = hash; | ||
throw error_1; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -399,3 +426,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var chainId, error_1, error_2, getNetwork; | ||
var chainId, error_2, error_3, getNetwork; | ||
return __generator(this, function (_a) { | ||
@@ -415,3 +442,3 @@ switch (_a.label) { | ||
case 4: | ||
error_1 = _a.sent(); | ||
error_2 = _a.sent(); | ||
_a.label = 5; | ||
@@ -425,3 +452,3 @@ case 5: | ||
case 7: | ||
error_2 = _a.sent(); | ||
error_3 = _a.sent(); | ||
return [3 /*break*/, 8]; | ||
@@ -555,3 +582,3 @@ case 8: return [3 /*break*/, 9]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var args, error_3; | ||
var args, error_4; | ||
return __generator(this, function (_a) { | ||
@@ -570,4 +597,4 @@ switch (_a.label) { | ||
case 3: | ||
error_3 = _a.sent(); | ||
return [2 /*return*/, checkError(method, error_3, params)]; | ||
error_4 = _a.sent(); | ||
return [2 /*return*/, checkError(method, error_4, params)]; | ||
case 4: return [2 /*return*/]; | ||
@@ -574,0 +601,0 @@ } |
@@ -49,3 +49,3 @@ { | ||
], | ||
"gitHead": "4e6d121fb8aa7327290afab7653364be8ddd8d81", | ||
"gitHead": "412bbe29394661192d7279094783401d300a1f81", | ||
"keywords": [ | ||
@@ -71,5 +71,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0x37c36f8ca7b2a69f18b0913872779a05a0548e76abe72868d0c65aa8c382a8a3", | ||
"tarballHash": "0xcc7b538634c932a19b36f816b83b91016d62c5ba71c052e4e0f41bd8c8f181c2", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.3.0" | ||
"version": "5.3.1" | ||
} |
@@ -1,1 +0,1 @@ | ||
export const version = "providers/5.3.0"; | ||
export const version = "providers/5.3.1"; |
@@ -210,14 +210,22 @@ "use strict"; | ||
sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> { | ||
return this.sendUncheckedTransaction(transaction).then((hash) => { | ||
return poll(() => { | ||
return this.provider.getTransaction(hash).then((tx: TransactionResponse) => { | ||
if (tx === null) { return undefined; } | ||
return this.provider._wrapTransaction(tx, hash); | ||
}); | ||
}, { oncePoll: this.provider }).catch((error: Error) => { | ||
(<any>error).transactionHash = hash; | ||
throw error; | ||
}); | ||
}); | ||
async sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> { | ||
// This cannot be mined any earlier than any recent block | ||
const blockNumber = await this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval); | ||
// Send the transaction | ||
const hash = await this.sendUncheckedTransaction(transaction); | ||
try { | ||
// Unfortunately, JSON-RPC only provides and opaque transaction hash | ||
// for a response, and we need the actual transaction, so we poll | ||
// for it; it should show up very quickly | ||
return await poll(async () => { | ||
const tx = await this.provider.getTransaction(hash); | ||
if (tx === null) { return undefined; } | ||
return this.provider._wrapTransaction(tx, hash, blockNumber); | ||
}, { oncePoll: this.provider }); | ||
} catch (error) { | ||
(<any>error).transactionHash = hash; | ||
throw error; | ||
} | ||
} | ||
@@ -224,0 +232,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
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
1047908
15688