# @windingtree/sdk-utils

> Utility class for interaction with the protocol smart contracts

Latest version **1.2.3** (published 2024-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @windingtree/sdk-utils
pnpm add @windingtree/sdk-utils
yarn add @windingtree/sdk-utils
bun add @windingtree/sdk-utils
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2024-01-17 |
| First published | 2023-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 55.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Kostiantyn Smyrnov |
| Maintainers | valera_rozuvan, kostysh, kvakes, tomashq |

## Links

- npm: https://www.npmjs.com/package/@windingtree/sdk-utils
- Repository: https://github.com/windingtree/sdk.git#readme
- Homepage: https://github.com/windingtree/sdk/tree/readme#readme
- Issues: https://github.com/windingtree/sdk/issues
- npm.io page: https://npm.io/package/@windingtree/sdk-utils

## Dependencies (3)

- [viem](https://npm.io/package/viem.md) ^1.19.13
- [h3-js](https://npm.io/package/h3-js.md) ^4.1.0
- [luxon](https://npm.io/package/luxon.md) ^3.4.4

## Recent versions

- 1.2.3 (latest) — 2024-01-17
- 1.2.3-beta.0 (beta) — 2024-01-17
- 1.2.2 — 2023-12-11
- 1.2.1 — 2023-10-31
- 1.2.0 — 2023-10-25
- 1.2.0-beta.1 — 2023-10-25
- 1.2.0-beta.0 — 2023-07-31
- 1.1.0 — 2023-07-27
- 1.1.0-beta.3 — 2023-07-27
- 1.1.0-beta.2 — 2023-07-27
- 1.1.0-beta.1 — 2023-07-23
- 1.1.0-beta.0 — 2023-07-23

## README

# @windingtree/sdk-utils

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.

## Installation

```bash
pnpm i @windingtree/sdk-utils
```

## Key Functions

This package provides several key utility functions:

- H3 functions for converting latitude/longitude points to H3 indexes and vice versa
- Text encoding and decoding functions
- Time utilities for parsing formatted string durations into seconds, calculating backoff with jitter, and checking if a timestamp has expired
- Unique identifier (UID) utilities
- Wallet functions for generating mnemonics and deriving accounts from them

## Usage

You can import individual utilities from the package as needed. For example:

```typescript
import { parseSeconds, nowSec, isExpired } from '@windingtree/sdk-utils';

const duration = parseSeconds('2h');
const currentTime = nowSec();
const expired = isExpired(BigInt(currentTime + Number(duration)));
```

## Documentation

For full documentation and examples, visit [windingtree.github.io/sdk](https://windingtree.github.io/sdk)

## Testing

```bash
pnpm test
```

## Contributing

[Contribution guidelines](https://windingtree.github.io/sdk/#/docs/contribution)

---
_Source: https://npm.io/package/@windingtree/sdk-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
