Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing null return types in base-provider #2316

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/providers/src.ts/base-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ export class Event {
return this.tag.split(":")[0]
}

get hash(): string {
get hash(): null | string {
const comps = this.tag.split(":");
if (comps[0] !== "tx") { return null; }
return comps[1];
}

get filter(): Filter {
get filter(): null | Filter {
const comps = this.tag.split(":");
if (comps[0] !== "filter") { return null; }
const address = comps[1];
Expand Down Expand Up @@ -296,7 +296,7 @@ export class Resolver implements EnsResolver {
}
}

_getAddress(coinType: number, hexBytes: string): string {
_getAddress(coinType: number, hexBytes: string): null | string {
const coinInfo = coinInfos[String(coinType)];

if (coinInfo == null) {
Expand Down Expand Up @@ -358,7 +358,7 @@ export class Resolver implements EnsResolver {
}


async getAddress(coinType?: number): Promise<string> {
async getAddress(coinType?: number): Promise<null | string> {
if (coinType == null) { coinType = 60; }

// If Ethereum, use the standard `addr(bytes32)`
Expand Down Expand Up @@ -490,7 +490,7 @@ export class Resolver implements EnsResolver {
return null;
}

async getContentHash(): Promise<string> {
async getContentHash(): Promise<null | string> {

// keccak256("contenthash()")
const hexBytes = await this._fetchBytes("0xbc1c58d1");
Expand Down Expand Up @@ -521,7 +521,7 @@ export class Resolver implements EnsResolver {
});
}

async getText(key: string): Promise<string> {
async getText(key: string): Promise<null | string> {

// The key encoded as parameter to fetchBytes
let keyBytes = toUtf8Bytes(key);
Expand Down Expand Up @@ -1644,7 +1644,7 @@ export class BaseProvider extends Provider implements EnsProvider {
}
}

async _getResolver(name: string): Promise<string> {
async _getResolver(name: string): Promise<null | string> {
// Get the resolver from the blockchain
const network = await this.getNetwork();

Expand Down