Skip to content

Commit fdc508e

Browse files
committed
update template readme & docs for utilities
1 parent eb937f5 commit fdc508e

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ const { connectedAccount, signer } = ... // from subconnect or talisman-connect
211211
- `useWatchContractEvent`: Help watch for a specific contract event and perform a specific action
212212
- `usePSP22Balance`: Fetch balance of an address from a PSP22 contract with ability to watch for balance changing
213213

214+
#### Utilities
215+
216+
- `formatBalance`: Format a balance value to a human-readable string
217+
214218
### Usage
215219

216220
#### `useTypink`
@@ -362,6 +366,16 @@ useWatchContractEvent(
362366
// ...
363367
```
364368

369+
#### `formatBalance`
370+
371+
Format a balance value to a human-readable string
372+
373+
```typescript
374+
import { popTestnet } from 'typink';
375+
376+
formatBalance(1e12, popTestnet); // 100 PAS
377+
```
378+
365379
### Examples
366380

367381
- [Demo](https://github.com/dedotdev/typink/tree/main/examples/demo) (https://typink-demo.netlify.app/)
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Typink Dapp Template
22

3-
To getting started, clone the repo & run `yarn install && yarn start` to start the application at `https://localhost:8080`
3+
### Getting started
44

5-
Demostrate fully-typed react hooks to interact with ink! smart contract powered by [Dedot](http://dedot.dev/)!
5+
To get started, install dependencies & start the application
66

7-
![typink-dapp](https://github.com/user-attachments/assets/2e69fd61-9968-461d-a56c-034dca8123ec)
8-
9-
10-
Typesafe react hooks to interact with ink! contracts
11-
12-
![typink-hooks](https://github.com/user-attachments/assets/7b914317-a09c-40bb-95e0-f01ae896dd17)
7+
```shell
8+
yarn install && yarn start
9+
```
10+
### Documentation
11+
- [Provider & Hooks](https://github.com/dedotdev/typink/tree/main?tab=readme-ov-file#providers--hooks)
12+
- [Utilities](https://github.com/dedotdev/typink/tree/main?tab=readme-ov-file#utilities)
1313

14+
---
1415
Imagine sending a hello world message to the world using ink! contracts 😎
1516

1617
![greeting-the-world](https://github.com/user-attachments/assets/b1f5476d-9b8d-4773-826f-d5d29988146a)

0 commit comments

Comments
 (0)