harb/kraiken-lib
openhands 6eacfe1975 fix: \uint256ToBytesLittleEndian\ silently truncates above 2³²−1 (#294)
Expand the output buffer from 4 bytes to 32 bytes and iterate all 32
positions, so values ≥ 2³² are encoded correctly instead of silently
dropped. Update tests to assert 32-byte output and add coverage for
2³², 2¹²⁸, and max uint256 roundtrips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 06:42:59 +00:00
..
src fix: \uint256ToBytesLittleEndian\ silently truncates above 2³²−1 (#294) 2026-02-27 06:42:59 +00:00
.gitignore fix: kraiken-lib: fix broken tests + raise coverage to 95% (#286) 2026-02-26 01:09:55 +00:00
.lintstagedrc.json tax rate, version and compose (#70) 2025-10-07 19:26:08 +02:00
.prettierignore tax rate, version and compose (#70) 2025-10-07 19:26:08 +02:00
.prettierrc lint/lib (#49) 2025-10-03 11:57:01 +02:00
AGENTS.md refactor: migrate kraiken-lib to explicit subpath imports (BREAKING CHANGE) (#89) 2025-11-20 18:54:53 +01:00
codegen.yml health checks (#39) 2025-10-02 14:37:59 +02:00
eslint.config.js tax rate, version and compose (#70) 2025-10-07 19:26:08 +02:00
package-lock.json fix: Ponder: fix mintNextHourProjected divisor, dead param, dead code (#308) 2026-02-27 05:47:51 +00:00
package.json fix: kraiken-lib: fix broken tests + raise coverage to 95% (#286) 2026-02-26 00:27:12 +00:00
README.md refactor: migrate kraiken-lib to explicit subpath imports (BREAKING CHANGE) (#89) 2025-11-20 18:54:53 +01:00
tsconfig.json fix/podman-postgres-integration (#37) 2025-10-01 20:26:49 +02:00
vitest.config.ts fix: kraiken-lib: fix broken tests + raise coverage to 95% (#286) 2026-02-26 01:09:55 +00:00
yarn.lock fix: CI failure in bootstrap (#286) 2026-02-26 00:27:23 +00:00

Test

yarn test

Import

yarn add kraiken-lib

then

import { bytesToUint256LittleEndian, uint256ToBytesLittleEndian } from "kraiken-lib/subgraph";

uint256ToBytesLittleEndian(3n);

get Snatch List

import { getSnatchList } from "kraiken-lib/snatch";

const positionIds = getSnatchList(positions, neededShares, maxTaxRateDecimal, stakeTotalSupply);