Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions .changeset/rename-provider-to-wireprovider.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/truapi-sandbox-bootstrap.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [ ] Ran `npm run changeset` and selected the package + bump type (patch / minor / major)
- [ ] Ran `npm run version-packages` to consume the changeset
- [ ] `js/packages/truapi/package.json` version is bumped
- [ ] `@parity/truapi-host` depends on `^<current @parity/truapi version>`
- [ ] `js/packages/truapi/CHANGELOG.md` has the new entry
- [ ] `rust/crates/truapi/Cargo.toml` version matches `js/packages/truapi/package.json`
- [ ] No leftover files under `.changeset/` (other than `config.json`)
15 changes: 8 additions & 7 deletions .github/workflows/release-version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ jobs:
with:
persist-credentials: false

- name: Verify package.json and Cargo.toml versions match
- name: Verify release versions
run: npm run check-release-versions

- name: Verify changesets were consumed
run: |
set -euo pipefail
pkg_version=$(jq -r '.version' js/packages/truapi/package.json)
cargo_version=$(awk -F'"' '/^version = "/ { print $2; exit }' rust/crates/truapi/Cargo.toml)
echo "package.json: ${pkg_version}"
echo "Cargo.toml: ${cargo_version}"
if [ "${pkg_version}" != "${cargo_version}" ]; then
echo "::error::Version mismatch — js/packages/truapi/package.json (${pkg_version}) and rust/crates/truapi/Cargo.toml (${cargo_version}) must match on a release: PR. Run \`npm run version-packages\` from the repo root to sync."
remaining_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' -print)"
if [ -n "${remaining_changesets}" ]; then
echo "::error::Release PR still contains unconsumed changesets. Run npm run version-packages."
echo "${remaining_changesets}"
exit 1
fi
65 changes: 42 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,57 @@ jobs:

- name: Resolve target packages
id: version
env:
RELEASE_COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
run: |
set -euo pipefail
packages=(
"@parity/truapi js/packages/truapi"
"@parity/truapi-host js/packages/truapi-host"
)
pending="$(mktemp)"
for entry in "${packages[@]}"; do
name="${entry%% *}"
path="${entry#* }"
version="$(jq -r '.version' "${path}/package.json")"
tag="${name}@${version}"
if npm_status="$(npm view "${tag}" version --registry=https://registry.npmjs.org 2>&1)"; then
echo "Package ${tag} already exists on npm; skipping ${name}."
elif grep -Eq 'E404|404 Not Found' <<< "${npm_status}"; then
echo "Publishing ${tag}."
echo "${name}|${path}|${version}|${tag}" >> "${pending}"
else
echo "${npm_status}" >&2
subject="${RELEASE_COMMIT_MESSAGE%%$'\n'*}"
release="${subject#release: }"
name="${release% *}"
declared_version="${release##* }"

case "${name}" in
@parity/truapi) path="js/packages/truapi" ;;
@parity/truapi-host) path="js/packages/truapi-host" ;;
*)
echo "::error::Unsupported release commit subject: ${subject}"
exit 1
fi
done
if [ -s "${pending}" ]; then
;;
esac

version="$(jq -r '.version' "${path}/package.json")"
if [ "${declared_version}" != "${version}" ]; then
echo "::error::Release subject declares ${declared_version}, but ${path}/package.json is ${version}."
exit 1
fi

tag="${name}@${version}"
if npm_status="$(npm view "${tag}" version --registry=https://registry.npmjs.org 2>&1)"; then
echo "Package ${tag} already exists on npm; nothing to publish."
echo "proceed=false" >> "$GITHUB_OUTPUT"
elif grep -Eq 'E404|404 Not Found' <<< "${npm_status}"; then
echo "Publishing ${tag}."
echo "proceed=true" >> "$GITHUB_OUTPUT"
{
echo "packages<<EOF"
cat "${pending}"
echo "${name}|${path}|${version}|${tag}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
else
echo "No unpublished package tags found."
echo "proceed=false" >> "$GITHUB_OUTPUT"
echo "${npm_status}" >&2
exit 1
fi

- name: Verify release manifests
if: steps.version.outputs.proceed == 'true'
run: |
set -euo pipefail
npm run check-release-versions
remaining_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' -print)"
if [ -n "${remaining_changesets}" ]; then
echo "::error::Release commit still contains unconsumed changesets. Run npm run version-packages."
echo "${remaining_changesets}"
exit 1
fi

- if: steps.version.outputs.proceed == 'true'
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

12 changes: 7 additions & 5 deletions docs/RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ npm run version-packages # consumes the changeset, bumps package.json + writ
The first command writes a markdown file under `.changeset/`; the second
consumes it, bumps the selected package `package.json`, appends the package
`CHANGELOG.md`, deletes the changeset file, and then runs
`scripts/sync-cargo-version.mjs` to keep `rust/crates/truapi/Cargo.toml`
aligned with `js/packages/truapi/package.json`. A protocol release should
therefore include the `@parity/truapi` package, its changelog, and the Cargo
version. A host-runtime-only release can bump `@parity/truapi-host` without
changing the Rust crate version.
`scripts/sync-release-versions.mjs`. That script keeps
`rust/crates/truapi/Cargo.toml` and the host package's `@parity/truapi`
dependency aligned with `js/packages/truapi/package.json`; the command then
refreshes `package-lock.json`. A protocol release should therefore include the
`@parity/truapi` package, its changelog, the Cargo version, the host dependency,
and the lockfile. A host-runtime-only release can bump
`@parity/truapi-host` without changing the Rust crate version.

### 3. Open a release PR

Expand Down
2 changes: 1 addition & 1 deletion js/packages/truapi-host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"test": "bun test"
},
"dependencies": {
"@parity/truapi": "file:../truapi"
"@parity/truapi": "^0.4.0"
},
"devDependencies": {
"@types/bun": "^1.3.0",
Expand Down
15 changes: 15 additions & 0 deletions js/packages/truapi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @parity/truapi

## 0.4.0

### Minor Changes

- Add the `coinPayment` client namespace (RFC 0017 Coinage Payment): `createPurse`, `queryPurse`, `rebalancePurse`, `deletePurse`, `deposit`, `refund`, `createCheque`, `createReceivable`, and `listenForPayment`, with the `CoinPayment*` / `HostCoinPayment*` / `VersionedHostCoinPayment*` request/response/error types and their wire discriminants.

**Breaking:** the `CallError<D>` SCALE codec now decodes to a tagged `CallErrorValue<D>` union (`Domain` / `Denied` / `Unsupported` / `MalformedFrame` / `HostFailure`) instead of projecting only the domain error and throwing on framework-level failures. The `Transport.truapiVersion` field is removed and `Transport.codecVersion` is deprecated; generated handshake calls read the codec version directly.
Comment thread
pgherveou marked this conversation as resolved.

## 0.3.2

### Minor Changes

- Rename the exported `Provider` transport type to `WireProvider` to make its role explicit. It is the low-level SCALE-wire-frame pipe (a `MessagePort` or iframe `postMessage` channel) that `createTransport` runs on. The `createIframeProvider` / `createMessagePortProvider` factories are unchanged; only the type name moves. Consumers importing `Provider` should import `WireProvider` instead.
- Add the `@parity/truapi/sandbox` entry point: host-environment detection (`isCorrectEnvironment`), a lazily-built cached client (`getClientSync`, `null` outside a host container), and a `subscribeConnectionStatus` connected/disconnected listener. Browser-embedded hosts can bootstrap a client without assembling the transport by hand.

## 0.3.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion js/packages/truapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parity/truapi",
"version": "0.3.1",
"version": "0.4.0",
"description": "TrUAPI TypeScript transport, SCALE codecs, and generated API client",
"license": "MIT",
"author": "Parity Technologies <admin@parity.io>",
Expand Down
Loading