Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
34522ff
parse: begin stdlib-compliant parse refactor
Fang- Jun 2, 2025
d50fb46
tests: add `@n` and `@f` parsing tests
Fang- Jun 2, 2025
4ee5073
render: begin stdlib-compliant render refactor
Fang- Jun 2, 2025
b2e7b53
render: fix rendering zero `@uw`
Fang- Jun 2, 2025
7bae0a3
render: support text auras: tas, ta, t
Fang- Jun 2, 2025
b8a907c
parse: support escaped text in `@t`
Fang- Jun 5, 2025
4a4a480
render: fix `@da` rendering
Fang- Jun 6, 2025
a956bba
render: fix `@q` rendering
Fang- Jun 10, 2025
33e6962
render: support character aura: c
Fang- Jun 10, 2025
6478dd0
parse: improved da support
Fang- Jun 10, 2025
6022fa8
parse: support %blob and %many coins
Fang- Jun 13, 2025
42feb58
parse: refactor integer regexes
Fang- Jun 13, 2025
5219efb
render: fix signed atom rendering, add tests
Fang- Jun 13, 2025
1aadd88
parse: add signed atom tests
Fang- Jun 13, 2025
1e30add
tests: add fuzz tests
Fang- Jun 13, 2025
3d2cac0
parse: better utf-32 codepoint parsing support
Fang- Jun 13, 2025
c1187c0
parse: no bytes should give 0n bigint
Fang- Jun 13, 2025
679f435
render: support %blob coins
Fang- Jun 13, 2025
f0122b2
types: consolidate
Fang- Jun 13, 2025
b99b9f0
tests: consolidate static test atoms
Fang- Jun 13, 2025
d41c615
various: minor cleanup
Fang- Jun 13, 2025
0c58221
tests: additional parse failure tests
Fang- Jun 13, 2025
71ce7fa
parse: local uv/uw parsing implementation
Fang- Jun 13, 2025
e20bae9
parse: make q implementation pass tests
Fang- Sep 16, 2025
fb88a4c
various: remove unused files and utilities
Fang- Sep 17, 2025
c57e071
lib: refine exports
Fang- Sep 17, 2025
85fa061
parse: add tryParse alias for slaw
Fang- Oct 3, 2025
7e517f6
tests: fix imports
Fang- Oct 3, 2025
6692f25
parse: conform `@q` behavior to old tests
Fang- Oct 3, 2025
8ef8cc1
parse: add valid() syntax tester
Fang- Oct 3, 2025
e360468
parse: comment touch-ups
Fang- Oct 3, 2025
65364f9
tests: fuzz test portability (for ci)
Fang- Oct 3, 2025
0b596fd
ci: remove size-limit check
Fang- Oct 3, 2025
820888d
parse, render: support float auras, r*
Fang- Oct 12, 2025
6ed9422
parse, render: simplify p and q modules
Fang- Oct 17, 2025
084b9d5
lib: move code around, do renamings
Fang- Oct 17, 2025
88785ea
lib: remove jsverify dependency
Fang- Oct 17, 2025
6f26b87
lib: update export shape, readme
Fang- Oct 17, 2025
4837b43
parse: unify r-parsing counter
Fang- Oct 17, 2025
a642f98
tests: correct long `@q` rendering
Fang- Oct 17, 2025
61a4c06
tests: note about `@r` aura fuzzing
Fang- Oct 17, 2025
7b8eac8
lib: consistently note `@uc` as unsupported
Fang- Oct 17, 2025
b07fc48
parse: support `@if`, `@is`
Fang- Oct 19, 2025
77c4a12
render: support `@if`, `@is`
Fang- Oct 19, 2025
359d11c
tests: improve fuzz tests
Fang- Oct 20, 2025
a2d272c
parse: support `@dr`
Fang- Oct 25, 2025
f9c0acf
render: support `@dr`
Fang- Oct 25, 2025
c7a03a0
lib: add some `@dr` utilities
Fang- Oct 25, 2025
79bfaaf
lib: rename da.ts to d.ts
Fang- Oct 25, 2025
d1efc74
parse: support UIP-135 style dates
Fang- Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/size.yml

This file was deleted.

92 changes: 39 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@
# `@urbit/aura`

This NPM package is intended to ease the flow of developing FE applications for urbit, by adding parsing and formatting functions for the various urbit auras
Hoon literal syntax parsing and rendering. Approaching two nines of parity with hoon stdlib.

## API
Supports all standard auras (except `@dr` and `@uc`).

```typescript
// @da manipulation
function parseDa(da: string): bigint;
function formatDa(da: bigint): string;
// Given a bigint representing an urbit date, returns a unix timestamp.
function daToUnix(da: bigint): number;
// Given a unix timestamp, returns a bigint representing an urbit date
function unixToDa(unix: number): bigint;
## API overview

Atoms are native `bigint`s. Top-level library functions reflect the hoon stdlib. Aliases are provided for your comfort. Summary of exports below.

// @p manipulation
// Convert a number to a @p-encoded string.
function patp(arg: string | number | bigint): string;
function hex2patp(hex: string): string;
function patp2hex(name: string): string;
function patp2bn(name: string): bigint;
function patp2dec(name: string): string;
// Determine the ship class of a @p value.
function clan(who: string): string;
// Determine the parent of a @p value.
function sein(name: string): strin;
// Validate a @p string.
function isValidPatp(str: string): boolean;
// Ensure @p is sigged.
function preSig(ship: string): string;
// Remove sig from @p
function deSig(ship: string): string;
// Trim @p to short form
function cite(ship: string): string | null;
### Parsing

```typescript
const parse = slav;
const tryParse = slaw;
function valid(:aura, :string): boolean;
function slav(:aura, :string): bigint; // throws on failure
function slaw(:aura, :string): bigint | null;
function nuck(:string): coin | null;
```

// @q manipulation
// Convert a number to a @q-encoded string.
function patq(arg: string | number | bigint): string;
function hex2patq(arg: string): string;
function patq2hex(name: string): string;
function patq2bn(name: string): bigint;
function patq2dec(name: string): string;
// Validate a @q string.
function isValidPatq(str: string): boolean;
// Equality comparison on @q values.
function eqPatq(p: string, q: string): boolean;
### Rendering

// @ud manipulation
function parseUd(ud: string): bigint;
function formatUd(ud: bigint): string;
```typescript
const render = scot;
function scot(:aura, :bigint): string;
function rend(:coin): string;
```

// @uv manipulation
function parseUv(x: string): bigint;
function formatUv(x: bigint | string): string;
### Utilities

// @uw manipulation
function parseUw(x: string): bigint;
function formatUw(x: bigint | string): string;
We provide some utilities for desirable operations on specific auras. These too generally match their hoon stdlib equivalents.

// @ux manipulation
function parseUx(ux: string): string;
function formatUx(hex: string): string;
``;
```typescript
const da = {
function toUnix(:bigint): number,
function fromUnix(:number): bigint,
};
const p = {
type rank = 'czar' | 'king' | 'duke' | 'earl' | 'pawn',
type size = 'galaxy' | 'star' | 'planet' | 'moon' | 'comet',
function cite(:bigint | string): string,
function sein(:bigint): bigint,
function sein(:string): string, // throws on bad input
function clan(:bigint | string): rank, // throws on bad input
function kind(:bigint | string): size, // throws on bad input
function rankToSize(:rank): size,
function sizeToRank(:size): rank,
};
```
85 changes: 0 additions & 85 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@tsconfig/recommended": "^1.0.2",
"dts-cli": "^2.0.0",
"husky": "^7.0.4",
"jsverify": "^0.8.4",
"tslib": "^2.5.0",
"typescript": "^5.0.4"
},
Expand Down
Loading