# @graphprotocol/gds-utils

General utility functions for The Graph Design System.

## Installation

```bash
pnpm add @graphprotocol/gds-utils
```

## Utilities

### BigInt Formatting

```ts
import { bigIntToNumber, formatBigInt, numberToBigInt, parseBigInt } from '@graphprotocol/gds-utils'

// Format a BigInt with decimals (precision defaults to 18)
formatBigInt(1000000000000000000n) // "1"
formatBigInt(1500000000000000000n) // "1.5"

// Parse a string to BigInt
parseBigInt('1.5') // 1500000000000000000n

// Convert between BigInt and number
bigIntToNumber(1000000000000000000n) // 1
numberToBigInt(1.5) // 1500000000000000000n

// Custom precision
formatBigInt(1000000n, { precision: 6n }) // "1"
```

### String Utilities

```ts
import { camelToKebab } from '@graphprotocol/gds-utils'

camelToKebab('backgroundColor') // "background-color"
camelToKebab('HTMLElement') // "html-element"
```

### Identicon Generation

```ts
import { createIdenticon } from '@graphprotocol/gds-utils'

// Generate a deterministic identicon SVG from an Ethereum address
const svg = createIdenticon('0x1234...')
```

## License

MIT
