Skip to content

refactor(as): consolidate the AS SDK into assemblyscript/ (one package, like go/ and rust/) - #18

Merged
zarah-s merged 1 commit into
mainfrom
go-sdk/as-consolidate
Jul 29, 2026
Merged

refactor(as): consolidate the AS SDK into assemblyscript/ (one package, like go/ and rust/)#18
zarah-s merged 1 commit into
mainfrom
go-sdk/as-consolidate

Conversation

@zarah-s

@zarah-s zarah-s commented Jul 29, 2026

Copy link
Copy Markdown
Member

Mano's AS runtime foundation (#14) landed in a separate assemblyscript-sdk/ (@pyde-net/sdk) folder, but go/ and rust/ each keep raw + ergonomic in ONE folder. This consolidates the ergonomic layer into the existing assemblyscript/ (@pyde-net/host) so the cross-language layout is consistent.

  • moves the 10 ergonomic modules into assemblyscript/assembly/ alongside the raw host_fns.ts + child.ts
  • rewires imports: @pyde-net/host/assembly./host_fns; example + tests → @pyde-net/host
  • index.ts now exports the ergonomic surface + child; the raw declarations stay in ./host_fns, re-exported via ./raw, so caller (raw) and ctx.caller don't collide (mirrors how go/ hides its raw bindings)
  • @pyde-net/host absorbs the SDK (as-bignum dep, asbuild + parity test), bumped to alpha.10; asconfig gains runtime: stub
  • moves the scalar-store-as acceptance example + codec-parity test in

BREAKING: @pyde-net/host no longer re-exports the raw host fns at the top level — import them from @pyde-net/host/assembly/raw (or /host_fns).

Verified locally: package builds; codec parity 47×2 byte-identical to Rust borsh; child test 13/13; the acceptance example builds against the consolidated package.

Heads-up for @manoahLinks: base future AS-SDK work on the consolidated assemblyscript/ (@pyde-net/host) — the ergonomic layer now lives there, not in assemblyscript-sdk/.

…e, like go/)

Mano's runtime foundation landed in a separate assemblyscript-sdk/
(@pyde-net/sdk) folder; go/ and rust/ each keep raw + ergonomic in ONE
folder. This merges the ergonomic layer into the existing assemblyscript/
(@pyde-net/host) so there's one AS package per the cross-language layout.

- move assembly/{abort,borsh,calldata,codec,ctx,exit,hash,raw,types,u128}.ts
  into assemblyscript/assembly/ (alongside the raw host_fns.ts + child.ts)
- rewire imports: @pyde-net/host/assembly -> ./host_fns (same package now);
  the example + tests -> @pyde-net/host
- index.ts now exports the ergonomic surface (codec/types/u128/borsh +
  ctx/calldata/exit/hash) + child; the raw declarations stay in ./host_fns,
  re-exported via ./raw, so `caller` (raw) and `ctx.caller` don't collide
  (mirrors how go/ hides the raw bindings)
- package.json: @pyde-net/host absorbs the SDK (as-bignum dep, asbuild +
  parity test), bumped to alpha.10; asconfig gains runtime:stub
- move the scalar-store-as example + codec-parity test in

BREAKING: @pyde-net/host no longer re-exports the raw host fns at the top
level — import them from "@pyde-net/host/assembly/raw" (or /host_fns).

Verified: package builds; codec parity 47×2 byte-identical to Rust borsh;
child test 13/13; the acceptance example builds against the consolidated
package.
@zarah-s
zarah-s merged commit 2eee8bb into main Jul 29, 2026
0 of 5 checks passed
@zarah-s
zarah-s deleted the go-sdk/as-consolidate branch July 29, 2026 11:33
zarah-s pushed a commit that referenced this pull request Jul 30, 2026
…le (#21)

Adds the generated-entry-dispatch section otigen's AS codegen needs as its
canonical reference: the `__<fn>_impl` author seam, the full otigen.toml →
AssemblyScript type-mapping table, the index.ts + abort wiring, the
signature-drift rules, and how the seam is opted into and out of.

Also corrects two things the Phase 1 consolidation (#18) left stale:

- The Install example imported `sload` / `sstore` / `emit_event` /
  `hash_poseidon2` from `@pyde-net/host/assembly`. Since #18, index.ts
  re-exports the ergonomic wrappers and the raw externs live behind
  `/assembly/raw`, so that snippet fails with `Element not found` — the
  first thing a new author would copy. Replaced with both subpaths and
  why they're split; the replacement was compiled with asc to confirm
  every name resolves.
- The opening claimed "One file, no runtime code, no external
  dependencies". All three stopped being true with the borsh / codec /
  u128 / ctx / calldata / exit / hash modules and the as-bignum
  dependency, and it contradicted the codecs the new section documents.

Docs only — no code, no ABI, no package surface change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant