docs: fixed typos in comments; h/t @ly0va (#1838).
This commit is contained in:
parent
7a404fb8ed
commit
fb6d141723
@ -239,7 +239,7 @@ export const FormatTypes: { [ name: string ]: string } = Object.freeze({
|
|||||||
// Human-Readable with Minimal spacing and without names (compact human-readable)
|
// Human-Readable with Minimal spacing and without names (compact human-readable)
|
||||||
minimal: "minimal",
|
minimal: "minimal",
|
||||||
|
|
||||||
// Human-Readble with nice spacing, including all names
|
// Human-Readable with nice spacing, including all names
|
||||||
full: "full",
|
full: "full",
|
||||||
|
|
||||||
// JSON-format a la Solidity
|
// JSON-format a la Solidity
|
||||||
@ -306,7 +306,7 @@ export class ParamType {
|
|||||||
// Format the parameter fragment
|
// Format the parameter fragment
|
||||||
// - sighash: "(uint256,address)"
|
// - sighash: "(uint256,address)"
|
||||||
// - minimal: "tuple(uint256,address) indexed"
|
// - minimal: "tuple(uint256,address) indexed"
|
||||||
// - full: "tuple(uint256 foo, addres bar) indexed baz"
|
// - full: "tuple(uint256 foo, address bar) indexed baz"
|
||||||
format(format?: string): string {
|
format(format?: string): string {
|
||||||
if (!format) { format = FormatTypes.sighash; }
|
if (!format) { format = FormatTypes.sighash; }
|
||||||
if (!FormatTypes[format]) {
|
if (!FormatTypes[format]) {
|
||||||
|
@ -215,7 +215,7 @@ export class Interface {
|
|||||||
return this.functions[matching[0]];
|
return this.functions[matching[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normlize the signature and lookup the function
|
// Normalize the signature and lookup the function
|
||||||
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
||||||
@ -248,7 +248,7 @@ export class Interface {
|
|||||||
return this.events[matching[0]];
|
return this.events[matching[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normlize the signature and lookup the function
|
// Normalize the signature and lookup the function
|
||||||
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
||||||
@ -282,7 +282,7 @@ export class Interface {
|
|||||||
return this.errors[matching[0]];
|
return this.errors[matching[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normlize the signature and lookup the function
|
// Normalize the signature and lookup the function
|
||||||
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||||
@ -521,7 +521,7 @@ export class Interface {
|
|||||||
} else if (param.type === "bytes") {
|
} else if (param.type === "bytes") {
|
||||||
topics.push(keccak256(value))
|
topics.push(keccak256(value))
|
||||||
} else if (param.baseType === "tuple" || param.baseType === "array") {
|
} else if (param.baseType === "tuple" || param.baseType === "array") {
|
||||||
// @TOOD
|
// @TODO
|
||||||
throw new Error("not implemented");
|
throw new Error("not implemented");
|
||||||
} else {
|
} else {
|
||||||
topics.push(this._abiCoder.encode([ param.type] , [ value ]));
|
topics.push(this._abiCoder.encode([ param.type] , [ value ]));
|
||||||
@ -658,7 +658,7 @@ export class Interface {
|
|||||||
|
|
||||||
// @TODO: If anonymous, and the only method, and the input count matches, should we parse?
|
// @TODO: If anonymous, and the only method, and the input count matches, should we parse?
|
||||||
// Probably not, because just because it is the only event in the ABI does
|
// Probably not, because just because it is the only event in the ABI does
|
||||||
// not mean we have the full ABI; maybe jsut a fragment?
|
// not mean we have the full ABI; maybe just a fragment?
|
||||||
|
|
||||||
|
|
||||||
return new LogDescription({
|
return new LogDescription({
|
||||||
|
@ -49,7 +49,7 @@ export interface ExternallyOwnedAccount {
|
|||||||
// key or mnemonic) in a function, so that console.log does not leak
|
// key or mnemonic) in a function, so that console.log does not leak
|
||||||
// the data
|
// the data
|
||||||
|
|
||||||
// @TODO: This is a temporary measure to preserse backwards compatibility
|
// @TODO: This is a temporary measure to preserve backwards compatibility
|
||||||
// In v6, the method on TypedDataSigner will be added to Signer
|
// In v6, the method on TypedDataSigner will be added to Signer
|
||||||
export interface TypedDataSigner {
|
export interface TypedDataSigner {
|
||||||
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
|
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
|
||||||
@ -70,7 +70,7 @@ export abstract class Signer {
|
|||||||
// i.e. "0x1234" is a SIX (6) byte string, NOT 2 bytes of data
|
// i.e. "0x1234" is a SIX (6) byte string, NOT 2 bytes of data
|
||||||
abstract signMessage(message: Bytes | string): Promise<string>;
|
abstract signMessage(message: Bytes | string): Promise<string>;
|
||||||
|
|
||||||
// Signs a transaxction and returns the fully serialized, signed transaction.
|
// Signs a transaction and returns the fully serialized, signed transaction.
|
||||||
// The EXACT transaction MUST be signed, and NO additional properties to be added.
|
// The EXACT transaction MUST be signed, and NO additional properties to be added.
|
||||||
// - This MAY throw if signing transactions is not supports, but if
|
// - This MAY throw if signing transactions is not supports, but if
|
||||||
// it does, sentTransaction MUST be overridden.
|
// it does, sentTransaction MUST be overridden.
|
||||||
@ -104,14 +104,14 @@ export abstract class Signer {
|
|||||||
return await this.provider.getTransactionCount(this.getAddress(), blockTag);
|
return await this.provider.getTransactionCount(this.getAddress(), blockTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populates "from" if unspecified, and estimates the gas for the transation
|
// Populates "from" if unspecified, and estimates the gas for the transaction
|
||||||
async estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber> {
|
async estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber> {
|
||||||
this._checkProvider("estimateGas");
|
this._checkProvider("estimateGas");
|
||||||
const tx = await resolveProperties(this.checkTransaction(transaction));
|
const tx = await resolveProperties(this.checkTransaction(transaction));
|
||||||
return await this.provider.estimateGas(tx);
|
return await this.provider.estimateGas(tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populates "from" if unspecified, and calls with the transation
|
// Populates "from" if unspecified, and calls with the transaction
|
||||||
async call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string> {
|
async call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string> {
|
||||||
this._checkProvider("call");
|
this._checkProvider("call");
|
||||||
const tx = await resolveProperties(this.checkTransaction(transaction));
|
const tx = await resolveProperties(this.checkTransaction(transaction));
|
||||||
@ -212,7 +212,7 @@ export abstract class Signer {
|
|||||||
tx.to.catch((error) => { });
|
tx.to.catch((error) => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow mixing pre-eip-1559 and eip-1559 proerties
|
// Do not allow mixing pre-eip-1559 and eip-1559 properties
|
||||||
const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null);
|
const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null);
|
||||||
if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) {
|
if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) {
|
||||||
logger.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction);
|
logger.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction);
|
||||||
|
@ -312,7 +312,7 @@ export class LinkNode extends ValueNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
throwError("labels can only be targetted as offsets", this.location);
|
throwError("labels can only be targeted as offsets", this.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOffset && assembler.positionIndependentCode) {
|
if (isOffset && assembler.positionIndependentCode) {
|
||||||
@ -975,7 +975,7 @@ class SemanticChecker extends Assembler {
|
|||||||
|
|
||||||
if (node.location.statement) {
|
if (node.location.statement) {
|
||||||
if (node instanceof PopNode) {
|
if (node instanceof PopNode) {
|
||||||
// $$ by istelf is useless and is intended to be an operand
|
// $$ by itself is useless and is intended to be an operand
|
||||||
errors.push({
|
errors.push({
|
||||||
message: `$$ must be an operand`,
|
message: `$$ must be an operand`,
|
||||||
severity: SemanticErrorSeverity.error,
|
severity: SemanticErrorSeverity.error,
|
||||||
@ -1079,7 +1079,7 @@ class CodeGenerationAssembler extends Assembler {
|
|||||||
return this._changed;
|
return this._changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the assmebler for another run with updated values
|
// Reset the assembler for another run with updated values
|
||||||
reset(): void {
|
reset(): void {
|
||||||
this._changed = false;
|
this._changed = false;
|
||||||
this._objectCache = { };
|
this._objectCache = { };
|
||||||
@ -1172,7 +1172,7 @@ class CodeGenerationAssembler extends Assembler {
|
|||||||
// This is used by evaluate to access properties in JavaScript
|
// This is used by evaluate to access properties in JavaScript
|
||||||
// - "defines" allow meta-programming values to be used
|
// - "defines" allow meta-programming values to be used
|
||||||
// - jump destinations are available as numbers
|
// - jump destinations are available as numbers
|
||||||
// - bytecode and data are available as an immuatble DataSource
|
// - bytecode and data are available as an immutable DataSource
|
||||||
get(name: string, source: Node): any {
|
get(name: string, source: Node): any {
|
||||||
if (name === "defines") {
|
if (name === "defines") {
|
||||||
return this.defines;
|
return this.defines;
|
||||||
@ -1277,8 +1277,8 @@ type _Location = {
|
|||||||
export function parse(code: string, options?: ParserOptions): Node {
|
export function parse(code: string, options?: ParserOptions): Node {
|
||||||
if (options == null) { options = { }; }
|
if (options == null) { options = { }; }
|
||||||
|
|
||||||
// Since jison allows \n, \r or \r\n line endings, we need some
|
// Since Jison allows \n, \r or \r\n line endings, we need some
|
||||||
// twekaing to get the correct position
|
// tweaking to get the correct position
|
||||||
const lines: Array<{ line: string, offset: number }> = [ ];
|
const lines: Array<{ line: string, offset: number }> = [ ];
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
code.split(/(\r\n?|\n)/g).forEach((clump, index) => {
|
code.split(/(\r\n?|\n)/g).forEach((clump, index) => {
|
||||||
|
@ -264,7 +264,7 @@ export class BigNumber implements Hexable {
|
|||||||
|
|
||||||
if (anyValue) {
|
if (anyValue) {
|
||||||
|
|
||||||
// Hexable interface (takes piority)
|
// Hexable interface (takes priority)
|
||||||
if (anyValue.toHexString) {
|
if (anyValue.toHexString) {
|
||||||
const hex = anyValue.toHexString();
|
const hex = anyValue.toHexString();
|
||||||
if (typeof(hex) === "string") {
|
if (typeof(hex) === "string") {
|
||||||
@ -309,7 +309,7 @@ function toHex(value: string | BN): string {
|
|||||||
// Strip off the negative sign
|
// Strip off the negative sign
|
||||||
value = value.substring(1);
|
value = value.substring(1);
|
||||||
|
|
||||||
// Cannot have mulitple negative signs (e.g. "--0x04")
|
// Cannot have multiple negative signs (e.g. "--0x04")
|
||||||
if (value[0] === "-") { logger.throwArgumentError("invalid hex", "value", value); }
|
if (value[0] === "-") { logger.throwArgumentError("invalid hex", "value", value); }
|
||||||
|
|
||||||
// Call toHex on the positive component
|
// Call toHex on the positive component
|
||||||
|
@ -78,7 +78,7 @@ function _getPrompt(prompt: string, options: PromptOptions, callback: (ctrlC: bo
|
|||||||
respond(null, chr);
|
respond(null, chr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// More passsword characters
|
// More password characters
|
||||||
if (options.mask) {
|
if (options.mask) {
|
||||||
process.stdout.write('*');
|
process.stdout.write('*');
|
||||||
} else {
|
} else {
|
||||||
|
@ -231,7 +231,7 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen
|
|||||||
|
|
||||||
// If there was no "gasLimit" override, but the ABI specifies a default, use it
|
// If there was no "gasLimit" override, but the ABI specifies a default, use it
|
||||||
if (tx.gasLimit == null && fragment.gas != null) {
|
if (tx.gasLimit == null && fragment.gas != null) {
|
||||||
// Conmpute the intrinisic gas cost for this transaction
|
// Compute the intrinsic gas cost for this transaction
|
||||||
// @TODO: This is based on the yellow paper as of Petersburg; this is something
|
// @TODO: This is based on the yellow paper as of Petersburg; this is something
|
||||||
// we may wish to parameterize in v6 as part of the Network object. Since this
|
// we may wish to parameterize in v6 as part of the Network object. Since this
|
||||||
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
// is always a non-nil to address, we can ignore G_create, but may wish to add
|
||||||
@ -257,7 +257,7 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen
|
|||||||
tx.value = roValue;
|
tx.value = roValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remvoe the overrides
|
// Remove the overrides
|
||||||
delete overrides.nonce;
|
delete overrides.nonce;
|
||||||
delete overrides.gasLimit;
|
delete overrides.gasLimit;
|
||||||
delete overrides.gasPrice;
|
delete overrides.gasPrice;
|
||||||
@ -354,7 +354,7 @@ function buildSend(contract: Contract, fragment: FunctionFragment): ContractFunc
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the contract was just deployed, wait until it is minded
|
// If the contract was just deployed, wait until it is mined
|
||||||
if (contract.deployTransaction != null) {
|
if (contract.deployTransaction != null) {
|
||||||
await contract._deployed();
|
await contract._deployed();
|
||||||
}
|
}
|
||||||
@ -363,7 +363,7 @@ function buildSend(contract: Contract, fragment: FunctionFragment): ContractFunc
|
|||||||
|
|
||||||
const tx = await contract.signer.sendTransaction(txRequest);
|
const tx = await contract.signer.sendTransaction(txRequest);
|
||||||
|
|
||||||
// Tweak the tw.wait so the receipt has extra properties
|
// Tweak the tx.wait so the receipt has extra properties
|
||||||
const wait = tx.wait.bind(tx);
|
const wait = tx.wait.bind(tx);
|
||||||
tx.wait = (confirmations?: number) => {
|
tx.wait = (confirmations?: number) => {
|
||||||
return wait(confirmations).then((receipt: ContractReceipt) => {
|
return wait(confirmations).then((receipt: ContractReceipt) => {
|
||||||
@ -501,7 +501,7 @@ class ErrorRunningEvent extends RunningEvent {
|
|||||||
// options to configure both.
|
// options to configure both.
|
||||||
|
|
||||||
// A Fragment Event will populate all the properties that Wildcard
|
// A Fragment Event will populate all the properties that Wildcard
|
||||||
// will, and additioanlly dereference the arguments when emitting
|
// will, and additionally dereference the arguments when emitting
|
||||||
class FragmentRunningEvent extends RunningEvent {
|
class FragmentRunningEvent extends RunningEvent {
|
||||||
readonly address: string;
|
readonly address: string;
|
||||||
readonly interface: Interface;
|
readonly interface: Interface;
|
||||||
@ -555,7 +555,7 @@ class FragmentRunningEvent extends RunningEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Wildard Event will attempt to populate:
|
// A Wildcard Event will attempt to populate:
|
||||||
// - event The name of the event name
|
// - event The name of the event name
|
||||||
// - eventSignature The full signature of the event
|
// - eventSignature The full signature of the event
|
||||||
// - decode A function to decode data and topics
|
// - decode A function to decode data and topics
|
||||||
@ -618,7 +618,7 @@ export class BaseContract {
|
|||||||
|
|
||||||
_deployedPromise: Promise<Contract>;
|
_deployedPromise: Promise<Contract>;
|
||||||
|
|
||||||
// A list of RunningEvents to track listsners for each event tag
|
// A list of RunningEvents to track listeners for each event tag
|
||||||
_runningEvents: { [ eventTag: string ]: RunningEvent };
|
_runningEvents: { [ eventTag: string ]: RunningEvent };
|
||||||
|
|
||||||
// Wrapped functions to call emit and allow deregistration from the provider
|
// Wrapped functions to call emit and allow deregistration from the provider
|
||||||
@ -1146,7 +1146,7 @@ export class ContractFactory {
|
|||||||
defineReadOnly(this, "signer", signer || null);
|
defineReadOnly(this, "signer", signer || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Future; rename to populteTransaction?
|
// @TODO: Future; rename to populateTransaction?
|
||||||
getDeployTransaction(...args: Array<any>): TransactionRequest {
|
getDeployTransaction(...args: Array<any>): TransactionRequest {
|
||||||
let tx: TransactionRequest = { };
|
let tx: TransactionRequest = { };
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ export class Eip1193Bridge extends EventEmitter {
|
|||||||
return result.toHexString();
|
return result.toHexString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TOOD: Transform? No uncles?
|
// @TODO: Transform? No uncles?
|
||||||
case "eth_getBlockByHash":
|
case "eth_getBlockByHash":
|
||||||
case "eth_getBlockByNumber": {
|
case "eth_getBlockByNumber": {
|
||||||
if (params[1]) {
|
if (params[1]) {
|
||||||
|
@ -142,7 +142,7 @@ export class HDNode implements ExternallyOwnedAccount {
|
|||||||
|
|
||||||
get extendedKey(): string {
|
get extendedKey(): string {
|
||||||
// We only support the mainnet values for now, but if anyone needs
|
// We only support the mainnet values for now, but if anyone needs
|
||||||
// testnet values, let me know. I believe current senitment is that
|
// testnet values, let me know. I believe current sentiment is that
|
||||||
// we should always use mainnet, and use BIP-44 to derive the network
|
// we should always use mainnet, and use BIP-44 to derive the network
|
||||||
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
||||||
// - Testnet: public=0x043587CF, private=0x04358394
|
// - Testnet: public=0x043587CF, private=0x04358394
|
||||||
|
@ -123,7 +123,7 @@ export enum ErrorCode {
|
|||||||
// - reason: The reason (only for EIP848 "Error(string)")
|
// - reason: The reason (only for EIP848 "Error(string)")
|
||||||
CALL_EXCEPTION = "CALL_EXCEPTION",
|
CALL_EXCEPTION = "CALL_EXCEPTION",
|
||||||
|
|
||||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
// Insufficient funds (< value + gasLimit * gasPrice)
|
||||||
// - transaction: the transaction attempted
|
// - transaction: the transaction attempted
|
||||||
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ export class BaseProvider extends Provider implements EnsProvider {
|
|||||||
|
|
||||||
// This will always return the most recently established network.
|
// This will always return the most recently established network.
|
||||||
// For "any", this can change (a "network" event is emitted before
|
// For "any", this can change (a "network" event is emitted before
|
||||||
// any change is refelcted); otherwise this cannot change
|
// any change is reflected); otherwise this cannot change
|
||||||
get ready(): Promise<Network> {
|
get ready(): Promise<Network> {
|
||||||
return poll(() => {
|
return poll(() => {
|
||||||
return this._ready().then((network) => {
|
return this._ready().then((network) => {
|
||||||
|
@ -417,7 +417,7 @@ export class EtherscanProvider extends BaseProvider{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: The `page` page parameter only allows pagination within the
|
// Note: The `page` page parameter only allows pagination within the
|
||||||
// 10,000 window abailable without a page and offset parameter
|
// 10,000 window available without a page and offset parameter
|
||||||
// Error: Result window is too large, PageNo x Offset size must
|
// Error: Result window is too large, PageNo x Offset size must
|
||||||
// be less than or equal to 10000
|
// be less than or equal to 10000
|
||||||
async getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>> {
|
async getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>> {
|
||||||
|
@ -105,7 +105,7 @@ export interface FallbackProviderConfig {
|
|||||||
// this provider and if its result comes back before a quorum is reached
|
// this provider and if its result comes back before a quorum is reached
|
||||||
// it will be incorporated into the vote
|
// it will be incorporated into the vote
|
||||||
// - lower values will cause more network traffic but may result in a
|
// - lower values will cause more network traffic but may result in a
|
||||||
// faster retult.
|
// faster result.
|
||||||
stallTimeout?: number;
|
stallTimeout?: number;
|
||||||
|
|
||||||
// How much this provider contributes to the quorum; sometimes a specific
|
// How much this provider contributes to the quorum; sometimes a specific
|
||||||
|
@ -249,7 +249,7 @@ export class Formatter {
|
|||||||
blockTag(blockTag: any): string {
|
blockTag(blockTag: any): string {
|
||||||
if (blockTag == null) { return "latest"; }
|
if (blockTag == null) { return "latest"; }
|
||||||
|
|
||||||
if (blockTag === "earliest") { return "0x0"; }
|
if (blockTag === "earliest") { return "0x0"; }
|
||||||
|
|
||||||
if (blockTag === "latest" || blockTag === "pending") {
|
if (blockTag === "latest" || blockTag === "pending") {
|
||||||
return blockTag;
|
return blockTag;
|
||||||
|
@ -102,7 +102,7 @@ export {
|
|||||||
UrlJsonRpcProvider,
|
UrlJsonRpcProvider,
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Concreate Providers
|
// Concrete Providers
|
||||||
|
|
||||||
FallbackProvider,
|
FallbackProvider,
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ const logger = new Logger(version);
|
|||||||
|
|
||||||
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
|
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
|
||||||
|
|
||||||
// These are load-balancer-based applicatoin IDs
|
// These are load-balancer-based application IDs
|
||||||
const defaultApplicationIds: Record<string, string> = {
|
const defaultApplicationIds: Record<string, string> = {
|
||||||
homestead: "6004bcd10040261633ade990",
|
homestead: "6004bcd10040261633ade990",
|
||||||
ropsten: "6004bd4d0040261633ade991",
|
ropsten: "6004bd4d0040261633ade991",
|
||||||
|
@ -20,7 +20,7 @@ const logger = new Logger(version);
|
|||||||
* will stall responses to ensure a consistent state, while this
|
* will stall responses to ensure a consistent state, while this
|
||||||
* WebSocket provider assumes the connected backend will manage this.
|
* WebSocket provider assumes the connected backend will manage this.
|
||||||
*
|
*
|
||||||
* For example, if a polling provider emits an event which indicats
|
* For example, if a polling provider emits an event which indicates
|
||||||
* the event occurred in blockhash XXX, a call to fetch that block by
|
* the event occurred in blockhash XXX, a call to fetch that block by
|
||||||
* its hash XXX, if not present will retry until it is present. This
|
* its hash XXX, if not present will retry until it is present. This
|
||||||
* can occur when querying a pool of nodes that are mildly out of sync
|
* can occur when querying a pool of nodes that are mildly out of sync
|
||||||
|
@ -43,7 +43,7 @@ export enum Utf8ErrorReason {
|
|||||||
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
|
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
|
||||||
UTF16_SURROGATE = "UTF-16 surrogate",
|
UTF16_SURROGATE = "UTF-16 surrogate",
|
||||||
|
|
||||||
// The string is an overlong reperesentation
|
// The string is an overlong representation
|
||||||
// - offset = start of this codepoint
|
// - offset = start of this codepoint
|
||||||
// - badCodepoint = the computed codepoint; already bounds checked
|
// - badCodepoint = the computed codepoint; already bounds checked
|
||||||
OVERLONG = "overlong representation",
|
OVERLONG = "overlong representation",
|
||||||
@ -171,7 +171,7 @@ function getUtf8CodePoints(bytes: BytesLike, onError?: Utf8ErrorFunc): Array<num
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See above loop for invalid contimuation byte
|
// See above loop for invalid continuation byte
|
||||||
if (res === null) { continue; }
|
if (res === null) { continue; }
|
||||||
|
|
||||||
// Maximum code point
|
// Maximum code point
|
||||||
|
@ -270,7 +270,7 @@ function _serialize(transaction: UnsignedTransaction, signature?: SignatureLike)
|
|||||||
raw.push("0x");
|
raw.push("0x");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requesting an unsigned transation
|
// Requesting an unsigned transaction
|
||||||
if (!signature) {
|
if (!signature) {
|
||||||
return RLP.encode(raw);
|
return RLP.encode(raw);
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ function _parse(rawTransaction: Uint8Array): Transaction {
|
|||||||
tx.v = 0;
|
tx.v = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Signed Tranasaction
|
// Signed Transaction
|
||||||
|
|
||||||
tx.chainId = Math.floor((tx.v - 35) / 2);
|
tx.chainId = Math.floor((tx.v - 35) / 2);
|
||||||
if (tx.chainId < 0) { tx.chainId = 0; }
|
if (tx.chainId < 0) { tx.chainId = 0; }
|
||||||
|
@ -69,7 +69,7 @@ export async function getUrl(href: string, options?: Options): Promise<GetUrlRes
|
|||||||
if (options == null) { options = { }; }
|
if (options == null) { options = { }; }
|
||||||
|
|
||||||
// @TODO: Once we drop support for node 8, we can pass the href
|
// @TODO: Once we drop support for node 8, we can pass the href
|
||||||
// firectly into request and skip adding the components
|
// directly into request and skip adding the components
|
||||||
// to this request object
|
// to this request object
|
||||||
const url = parse(href);
|
const url = parse(href);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ export function _fetchData<T = Uint8Array>(connection: string | ConnectionInfo,
|
|||||||
|
|
||||||
runningTimeout.cancel();
|
runningTimeout.cancel();
|
||||||
|
|
||||||
// If we had a processFunc, it eitehr returned a T or threw above.
|
// If we had a processFunc, it either returned a T or threw above.
|
||||||
// The "body" is now a Uint8Array.
|
// The "body" is now a Uint8Array.
|
||||||
return <T>(<unknown>body);
|
return <T>(<unknown>body);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user