forked from ethers-io/ethers.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
3,042 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const version = "5.0.0-beta.129"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "5.0.0-beta.129"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Network } from "@ethersproject/networks"; | ||
import { UrlJsonRpcProvider } from "./url-json-rpc-provider"; | ||
export declare class AlchemyProvider extends UrlJsonRpcProvider { | ||
readonly apiKey: string; | ||
static getApiKey(apiKey: string): string; | ||
static getUrl(network: Network, apiKey: string): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var errors = __importStar(require("@ethersproject/errors")); | ||
var url_json_rpc_provider_1 = require("./url-json-rpc-provider"); | ||
// This key was provided to ethers.js by Alchemy to be used by the | ||
// default provider, but it is recommended that for your own | ||
// production environments, that you acquire your own API key at: | ||
// https://dashboard.alchemyapi.io | ||
var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; | ||
var AlchemyProvider = /** @class */ (function (_super) { | ||
__extends(AlchemyProvider, _super); | ||
function AlchemyProvider() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
AlchemyProvider.getApiKey = function (apiKey) { | ||
if (apiKey == null) { | ||
return defaultApiKey; | ||
} | ||
return apiKey; | ||
}; | ||
AlchemyProvider.getUrl = function (network, apiKey) { | ||
var host = null; | ||
switch (network.name) { | ||
case "homestead": | ||
host = "eth-mainnet.alchemyapi.io/jsonrpc/"; | ||
break; | ||
case "ropsten": | ||
host = "eth-ropsten.alchemyapi.io/jsonrpc/"; | ||
break; | ||
case "rinkeby": | ||
host = "eth-rinkeby.alchemyapi.io/jsonrpc/"; | ||
break; | ||
case "kovan": | ||
host = "eth-kovan.alchemyapi.io/jsonrpc/"; | ||
break; | ||
default: | ||
errors.throwArgumentError("unsupported network", "network", arguments[0]); | ||
} | ||
return ("https:/" + "/" + host + apiKey); | ||
}; | ||
return AlchemyProvider; | ||
}(url_json_rpc_provider_1.UrlJsonRpcProvider)); | ||
exports.AlchemyProvider = AlchemyProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; | ||
import { Network, Networkish } from "@ethersproject/networks"; | ||
import { Transaction } from "@ethersproject/transactions"; | ||
import { Formatter } from "./formatter"; | ||
/** | ||
* EventType | ||
* - "block" | ||
* - "pending" | ||
* - "error" | ||
* - filter | ||
* - topics array | ||
* - transaction hash | ||
*/ | ||
declare class Event { | ||
readonly listener: Listener; | ||
readonly once: boolean; | ||
readonly tag: string; | ||
constructor(tag: string, listener: Listener, once: boolean); | ||
pollable(): boolean; | ||
} | ||
export declare class BaseProvider extends Provider { | ||
_network: Network; | ||
_events: Array<Event>; | ||
formatter: Formatter; | ||
_emitted: { | ||
[eventName: string]: number | "pending"; | ||
}; | ||
_pollingInterval: number; | ||
_poller: any; | ||
_lastBlockNumber: number; | ||
_fastBlockNumber: number; | ||
_fastBlockNumberPromise: Promise<number>; | ||
_fastQueryDate: number; | ||
/** | ||
* ready | ||
* | ||
* A Promise<Network> that resolves only once the provider is ready. | ||
* | ||
* Sub-classes that call the super with a network without a chainId | ||
* MUST set this. Standard named networks have a known chainId. | ||
* | ||
*/ | ||
ready: Promise<Network>; | ||
constructor(network: Networkish | Promise<Network>); | ||
static getFormatter(): Formatter; | ||
poll(): void; | ||
resetEventsBlock(blockNumber: number): void; | ||
readonly network: Network; | ||
getNetwork(): Promise<Network>; | ||
readonly blockNumber: number; | ||
polling: boolean; | ||
pollingInterval: number; | ||
_getFastBlockNumber(): Promise<number>; | ||
_setFastBlockNumber(blockNumber: number): void; | ||
waitForTransaction(transactionHash: string, confirmations?: number): Promise<TransactionReceipt>; | ||
_runPerform(method: string, params: { | ||
[key: string]: () => any; | ||
}): Promise<any>; | ||
getBlockNumber(): Promise<number>; | ||
getGasPrice(): Promise<BigNumber>; | ||
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>; | ||
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>; | ||
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; | ||
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; | ||
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse; | ||
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>; | ||
_getTransactionRequest(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<Transaction>; | ||
_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>; | ||
call(transaction: TransactionRequest | Promise<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; | ||
estimateGas(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<BigNumber>; | ||
_getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>; | ||
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>; | ||
getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>; | ||
getTransaction(transactionHash: string): Promise<TransactionResponse>; | ||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>; | ||
getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>; | ||
getEtherPrice(): Promise<number>; | ||
_getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>; | ||
_getResolver(name: string): Promise<string>; | ||
resolveName(name: string | Promise<string>): Promise<string>; | ||
lookupAddress(address: string | Promise<string>): Promise<string>; | ||
perform(method: string, params: any): Promise<any>; | ||
_startPending(): void; | ||
_stopPending(): void; | ||
_checkPolling(): void; | ||
_addEventListener(eventName: EventType, listener: Listener, once: boolean): this; | ||
on(eventName: EventType, listener: Listener): this; | ||
once(eventName: EventType, listener: Listener): this; | ||
emit(eventName: EventType, ...args: Array<any>): boolean; | ||
listenerCount(eventName?: EventType): number; | ||
listeners(eventName?: EventType): Array<Listener>; | ||
off(eventName: EventType, listener?: Listener): this; | ||
removeAllListeners(eventName?: EventType): this; | ||
} | ||
export {}; |
Oops, something went wrong.