Skip to content

Commit d4858f2

Browse files
committed
docs: ✏️ Added readme file for the utils package
1 parent 6247d8c commit d4858f2

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

packages/utils/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# @windingtree/sdk-utils
2+
3+
The `@windingtree/sdk-utils` package provides a collection of helper utilities that are used throughout the Winding Tree SDK. It includes functions for working with H3 spatial indexing, text encoding and decoding, time calculations and conversions, generating unique identifiers (UIDs), and Ethereum wallet operations.
4+
5+
## Installation
6+
7+
```bash
8+
pnpm i @windingtree/sdk-utils
9+
```
10+
11+
## Key Functions
12+
13+
This package provides several key utility functions:
14+
15+
- H3 functions for converting latitude/longitude points to H3 indexes and vice versa
16+
- Text encoding and decoding functions
17+
- Time utilities for parsing formatted string durations into seconds, calculating backoff with jitter, and checking if a timestamp has expired
18+
- Unique identifier (UID) utilities
19+
- Wallet functions for generating mnemonics and deriving accounts from them
20+
21+
## Usage
22+
23+
You can import individual utilities from the package as needed. For example:
24+
25+
```typescript
26+
import { parseSeconds, nowSec, isExpired } from '@windingtree/sdk-utils';
27+
28+
const duration = parseSeconds('2h');
29+
const currentTime = nowSec();
30+
const expired = isExpired(BigInt(currentTime + Number(duration)));
31+
```
32+
33+
## Documentation
34+
35+
For full documentation and examples, visit [windingtree.github.io/sdk](https://windingtree.github.io/sdk)
36+
37+
## Testing
38+
39+
```bash
40+
pnpm test
41+
```
42+
43+
## Contributing
44+
45+
[Contribution guidelines](https://windingtree.github.io/sdk/#/docs/contribution)

0 commit comments

Comments
 (0)