snipe/web/node_modules/@exodus/bytes/bigint.js
pyr0ball 7a704441a6 feat(snipe): Vue 3 frontend scaffold + Docker web service
- web/: Vue 3 + Vite + UnoCSS + Pinia, dark tactical theme (amber/#0d1117)
- AppNav, ListingCard, SearchView with filters/sort, composables
  (useSnipeMode, useKonamiCode, useMotion), Pinia search store
- Steal shimmer, auction countdown, Snipe Mode easter egg all native in Vue
- docker/web/: nginx + multi-stage Dockerfile (node build → nginx serve)
- compose.yml: api (8510) + web (8509) services
- Dockerfile CMD updated to uvicorn for upcoming FastAPI layer
- Clean build: 0 TS errors, 380 modules
2026-03-25 15:11:35 -07:00

14 lines
599 B
JavaScript

import { toHex, fromHex } from '@exodus/bytes/hex.js'
import { assert } from './fallback/_utils.js'
const _0n = BigInt(0)
export function fromBigInt(x, { length, format } = {}) {
assert(Number.isSafeInteger(length) && length > 0, 'Expected length arg to be a positive integer')
assert(typeof x === 'bigint' && x >= _0n, 'Expected a non-negative bigint')
const hex = x.toString(16)
assert(length * 2 >= hex.length, `Can not fit supplied number into ${length} bytes`)
return fromHex(hex.padStart(length * 2, '0'), format)
}
export const toBigInt = (a) => BigInt('0x' + (toHex(a) || '0'))