Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Add Typescript declarations #56

Closed
wants to merge 3 commits into from
Closed

Conversation

timhc22
Copy link

@timhc22 timhc22 commented Mar 17, 2021

No description provided.

@timhc22 timhc22 mentioned this pull request Mar 17, 2021
.gitignore Outdated
@@ -2,3 +2,4 @@ node_modules
dist
yarn-error.log
*.DS_Store
.idea
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is .idea ? Can you remove it?

src/index.d.ts Outdated
provider: ethers.providers.Provider;
signer: any;
ens: any;
name(name: any): Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: any should be name: string

src/index.d.ts Outdated
signer: any;
ens: any;
name(name: any): Name;
resolver(address: any): Resolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

src/index.d.ts Outdated
ens: any;
name(name: any): Name;
resolver(address: any): Resolver;
getName(address: any): Promise<{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

src/index.d.ts Outdated
getName(address: any): Promise<{
name: any;
}>;
getNameWithResolver(address: any, resolverAddr: any): Promise<{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both address and resolverAddress should be string

src/index.d.ts Outdated
getNameWithResolver(address: any, resolverAddr: any): Promise<{
name: any;
}>;
setReverseRecord(name: any, overrides: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name should be string

src/index.d.ts Outdated
namehash: string;
ens: any;
ensWithSigner: any;
name: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name should be string

src/index.d.ts Outdated
signer: any;
resolver: any;
getOwner(): Promise<any>;
setOwner(address: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

src/index.d.ts Outdated
getOwner(): Promise<any>;
setOwner(address: any): Promise<any>;
getResolver(): Promise<any>;
setResolver(address: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

src/index.d.ts Outdated
setResolver(address: any): Promise<any>;
getTTL(): Promise<any>;
getResolverAddr(): Promise<any>;
getAddress(coinId: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coinId is number

src/index.d.ts Outdated
getTTL(): Promise<any>;
getResolverAddr(): Promise<any>;
getAddress(coinId: any): Promise<any>;
setAddress(key: any, address: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key and address should be string

src/index.d.ts Outdated
setSubnodeOwner(label: any, newOwner: any): Promise<any>;
setSubnodeRecord(label: any, newOwner: any, resolver: any, ttl?: number): Promise<any>;
createSubdomain(label: any): Promise<any>;
deleteSubdomain(label: any): Promise<any>;
Copy link
Member

@makoto makoto Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All label, newOwner, resolverandkeyabove should bestring`

}
declare class Resolver {
constructor({ address, ens }: {
address: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

address: any;
ens: any;
});
address: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address: any should be address:string

src/index.d.ts Outdated
});
address: any;
ens: any;
name(name: any): Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: any should be name:string

src/index.js Outdated
/**
* Get ENS Contract
*
* // todo is Provider here meant to be provider from web3-core ? (may need to upgrade web3 library)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save as above

src/index.js Outdated
@@ -19,10 +19,25 @@ function getEnsAddress(networkId) {
}
}

/**
* Get Resolver Contract
* // todo is Provider here meant to be provider from web3-core ? (may need to upgrade web3 library)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provider is used at ethers.Contract so whatever the type definition ethers.io uses. Ethers.js is written in Type script so probably you can import type from there?

@@ -0,0 +1,12 @@
export function decodeContenthash(encoded: any): {
protocolType: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string

@makoto
Copy link
Member

makoto commented Mar 17, 2021

Do we need any instruction on README on how to use this type definitions?

@timhc22 timhc22 closed this Mar 18, 2021
@martriay
Copy link

Why was this closed?

@timhc22
Copy link
Author

timhc22 commented Mar 28, 2021

@martriay, I made an error, it is still open, but here:

ensdomains/ensjs#58

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants