Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zemse committed Feb 21, 2023
1 parent 0095d4d commit 0770179
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/target-ethers-v6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<img src="https://github.com/Neufund/TypeChain/blob/d82f3cc644a11e22ca8e42505c16f035e2f2555d/docs/images/typechain-logo.png?raw=true" width="300" alt="TypeChain">
<h3 align="center">TypeChain target Ethers-v6</h3>
<p align="center">馃攲 TypeScript bindings for Ethers 5.x.x smartcontracts</p>
<p align="center">馃攲 TypeScript bindings for Ethers 6.x.x smartcontracts</p>

<p align="center">
<a href="https://github.com/ethereum-ts/TypeChain/actions"><img alt="Build Status" src="https://github.com/ethereum-ts/TypeChain/workflows/CI/badge.svg"></a>
Expand All @@ -17,8 +17,7 @@
</p>
</p>

This package requires TypeScript >= 4.0. If you need support for earlier TS versions check out: 1.0 version of this
package.
This package requires TypeScript >= 4.7 and `moduleResolution` to be set as `node16` or `nodenext`.

## [TypeChain readme](https://github.com/ethereum-ts/TypeChain)

Expand All @@ -27,10 +26,12 @@ package.
The main files generated by this target are `<contract-name>.ts`. They declare typesafe interfaces for your contracts on
top of ethers `Contract` instances:

- typed contract's methods, available both at `contract.someMethod(...)` and `contract.functions.someMethod(...)`
- typed contract's methods, available both at `contract.someMethod(...)`, `contract.someMethod.call(...)`,
`contract.someMethod.staticcall(...)` and `contract.someMethod.send(...)`
- typed events in `contract.interface.events.AnEvent` and filters in `contract.filters.AnEvent`
- typed method gas estimates in `contract.estimateGas.someMethod`
- typed method gas estimates in `contract.someMethod.estimateGas(...)`
- overrides for the event listener methods (`on`, `once`, etc) that return the same contract type.
- address argument types are `AddressLike`, meaning you can pass a signer or contract.

Note: these are just _type declarations_ to help you call the blockchain properly, so they're not available at runtime,
and all of the contracts are still instances of the same `Contract` class.
Expand All @@ -53,7 +54,6 @@ so you can easily connect to a deployed instance without having to pass the ABI
Suppose you have an `Erc20Token.sol` solidity interface and a `DummyToken.sol` contract implementing it.

```typescript
import { BigNumber } from 'ethers';
import { Wallet } from 'ethers';

import { DummyTokenFactory } from 'typechain-out-dir/DummyTokenFactory';
Expand All @@ -70,7 +70,7 @@ async function deployTestToken(ownerPK: string): Promise<DummyToken> {

// to call existing contracts, a factory for both the concrete contract and for the interface
// can be used since the ABI is the same
async function getTokenBalance(walletAddress: string, tokenAddress: string): Promise<BigNumber> {
async function getTokenBalance(walletAddress: string, tokenAddress: string): Promise<bigint> {
const token = Erc20TokenFactory.connect(tokenAddress, provider);
return token.balanceOf(walletAddress);
}
Expand Down

0 comments on commit 0770179

Please sign in to comment.