@ethersproject/providers
Advanced tools
Comparing version 5.0.0-beta.138 to 5.0.0-beta.139
@@ -1,1 +0,1 @@ | ||
export declare const version = "providers/5.0.0-beta.138"; | ||
export declare const version = "providers/5.0.0-beta.139"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "providers/5.0.0-beta.138"; | ||
exports.version = "providers/5.0.0-beta.139"; |
@@ -463,3 +463,4 @@ "use strict"; | ||
transactionHash: tx.hash, | ||
transaction: tx | ||
transaction: tx, | ||
receipt: receipt | ||
}); | ||
@@ -466,0 +467,0 @@ } |
@@ -7,2 +7,5 @@ import { BaseProvider } from "./base-provider"; | ||
constructor(providers: Array<BaseProvider>, quorum?: number, weights?: Array<number>); | ||
static doPerform(provider: BaseProvider, method: string, params: { | ||
[name: string]: any; | ||
}): Promise<any>; | ||
perform(method: string, params: { | ||
@@ -9,0 +12,0 @@ [name: string]: any; |
@@ -60,13 +60,14 @@ "use strict"; | ||
else if (typeof (result) === "object") { | ||
var bare_1 = {}; | ||
var keys = Object.keys(result); | ||
keys.sort(); | ||
keys.forEach(function (key) { | ||
return "{" + keys.map(function (key) { | ||
var value = result[key]; | ||
if (typeof (value) === "function") { | ||
return; | ||
value = "function{}"; | ||
} | ||
bare_1[key] = serialize(value); | ||
}); | ||
return JSON.stringify(bare_1); | ||
else { | ||
value = serialize(value); | ||
} | ||
return JSON.stringify(key) + "=" + serialize(value); | ||
}).join(",") + "}"; | ||
} | ||
@@ -128,2 +129,32 @@ return JSON.stringify(result); | ||
} | ||
FallbackProvider.doPerform = function (provider, method, params) { | ||
switch (method) { | ||
case "getBlockNumber": | ||
case "getGasPrice": | ||
case "getEtherPrice": | ||
return provider[method](); | ||
case "getBalance": | ||
case "getTransactionCount": | ||
case "getCode": | ||
return provider[method](params.address, params.blockTag || "latest"); | ||
case "getStorageAt": | ||
return provider.getStorageAt(params.address, params.position, params.blockTag || "latest"); | ||
case "sendTransaction": | ||
return provider.sendTransaction(params.signedTransaction); | ||
case "getBlock": | ||
return provider[(params.includeTransactions ? "getBlockWithTransactions" : "getBlock")](params.blockTag || params.blockHash); | ||
case "call": | ||
case "estimateGas": | ||
return provider[method](params.transaction); | ||
case "getTransaction": | ||
case "getTransactionReceipt": | ||
return provider[method](params.transactionHash); | ||
case "getLogs": | ||
return provider.getLogs(params.filter); | ||
} | ||
return logger.throwError("unknown method error", logger_1.Logger.errors.UNKNOWN_ERROR, { | ||
method: method, | ||
params: params | ||
}); | ||
}; | ||
FallbackProvider.prototype.perform = function (method, params) { | ||
@@ -146,3 +177,3 @@ var _this = this; | ||
}); | ||
return provider.perform(method, params).then(function (result) { | ||
return FallbackProvider.doPerform(provider, method, params).then(function (result) { | ||
var duration = now() - t0; | ||
@@ -228,2 +259,9 @@ _this.emit("debug", { | ||
if (runners.length === 0 && inflightWeight === 0) { | ||
if (firstError === null) { | ||
firstError = logger.makeError("failed to meet quorum", logger_1.Logger.errors.SERVER_ERROR, { | ||
results: Object.keys(results).map(function (u) { | ||
return { result: u, weight: results[u].reduce(function (accum, r) { return (accum + r.weight); }, 0) }; | ||
}) | ||
}); | ||
} | ||
reject(firstError); | ||
@@ -230,0 +268,0 @@ return; |
@@ -6,2 +6,3 @@ import { Block, BlockTag, EventType, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { AlchemyProvider } from "./alchemy-provider"; | ||
import { CloudflareProvider } from "./cloudflare-provider"; | ||
import { EtherscanProvider } from "./etherscan-provider"; | ||
@@ -16,2 +17,2 @@ import { FallbackProvider } from "./fallback-provider"; | ||
import { Formatter } from "./formatter"; | ||
export { Provider, BaseProvider, FallbackProvider, AlchemyProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, NodesmithProvider, Web3Provider, IpcProvider, JsonRpcSigner, getNetwork, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, AsyncSendable, Network, Networkish }; | ||
export { Provider, BaseProvider, FallbackProvider, AlchemyProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, NodesmithProvider, Web3Provider, IpcProvider, JsonRpcSigner, getNetwork, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, AsyncSendable, Network, Networkish }; |
@@ -11,2 +11,4 @@ "use strict"; | ||
exports.AlchemyProvider = alchemy_provider_1.AlchemyProvider; | ||
var cloudflare_provider_1 = require("./cloudflare-provider"); | ||
exports.CloudflareProvider = cloudflare_provider_1.CloudflareProvider; | ||
var etherscan_provider_1 = require("./etherscan-provider"); | ||
@@ -13,0 +15,0 @@ exports.EtherscanProvider = etherscan_provider_1.EtherscanProvider; |
@@ -337,3 +337,3 @@ "use strict"; | ||
} | ||
return Promise.reject(new Error("invalid block tag or block hash")); | ||
return logger.throwArgumentError("invalid block tag or block hash", "params", params); | ||
case "getTransaction": | ||
@@ -340,0 +340,0 @@ return this.send("eth_getTransactionByHash", [params.transactionHash]); |
{ | ||
"name": "@ethersproject/providers", | ||
"version": "5.0.0-beta.138", | ||
"version": "5.0.0-beta.139", | ||
"description": "Ethereum Providers for ethers.", | ||
@@ -46,3 +46,3 @@ "main": "index.js", | ||
}, | ||
"tarballHash": "0x6abea26a92ded226995535bd9c4ba1fd126e3280b227933846c59d41efd59e9f" | ||
"tarballHash": "0x1d0aba901a5ea2a68bda4c1decc89c6778faf24a29a3df62db8327431c3a90ab" | ||
} |
@@ -29,5 +29,5 @@ "use strict"; | ||
// Normalize the Network and API Key | ||
network = _newTarget.getNetwork(network); | ||
apiKey = _newTarget.getApiKey(apiKey); | ||
var url = _newTarget.getUrl(network, apiKey); | ||
network = properties_1.getStatic((_newTarget), "getNetwork")(network); | ||
apiKey = properties_1.getStatic((_newTarget), "getApiKey")(apiKey); | ||
var url = properties_1.getStatic((_newTarget), "getUrl")(network, apiKey); | ||
_this = _super.call(this, url, network) || this; | ||
@@ -34,0 +34,0 @@ properties_1.defineReadOnly(_this, "apiKey", apiKey); |
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
137196
35
3125