Skip to content

feat(host,signer): wrap account.signVrf in the accounts surface - #292

Merged
Imod7 merged 6 commits into
mainfrom
feat/accounts-sign-vrf
Aug 11, 2026
Merged

feat(host,signer): wrap account.signVrf in the accounts surface#292
Imod7 merged 6 commits into
mainfrom
feat/accounts-sign-vrf

Conversation

@Imod7

@Imod7 Imod7 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #288
Part of #286

Description

Adds signVrf to the accounts surface so products can produce an sr25519 VRF signature
over a Merlin transcript without going through the raw truAPI client.

Changes

File Change Impact
packages/host/src/accounts.ts signVrf on AccountsProvider and its adapter, plus the VrfTranscriptItem, VrfSignature and ProductAccountLookup types New public method. Callers pass and receive Uint8Array; the adapter handles hex encoding and the tagged derivation index
packages/host/src/index.ts Export the three new types Types are usable by name
packages/host/src/testing.ts Test driving the shipped fake through the real adapter Catches a fake that stops matching what the adapter decodes. This fake is the only way a product can test a VRF flow
packages/signer/src/providers/host.ts HostProvider.signVrf, the internal provider interface, and type re-exports from host Same call reachable from the signer, with the signer error types
packages/signer/src/signer-manager.ts SignerManager.signVrf Reachable from the object most products already hold
packages/signer/src/index.ts Export the three types Types are usable by name
pending-changesets/accounts-sign-vrf.md Changeset, minor for host, signer and the umbrella Release notes and version bumps

Two earlier commits also route getProductAccount and getProductAccountSigner through
one account-reference type, so the tagged derivation index is built in a single place.

Why these changes

The hosts have implemented account.signVrf for a while, but no SDK accessor exposed it.
Products that needed it had to call getTruApi() directly and hand roll hex encoding,
account addressing and error handling. That also pins the product to the truAPI wire
format, which the SDK is supposed to absorb.

The concrete consumer is the airdrop lottery ticket on the People chain, which cannot be
produced in hosted mode today.

Breaking change

AccountsProvider is an exported interface and signVrf is a required member, so
anything that implements it, including hand written test doubles, must add the method.
Code that only calls the provider is unaffected. The fake in
@parity/product-sdk-host/testing already implements it.

Testing

cd product-sdk
pnpm install
pnpm -r build
pnpm -r --no-bail test -- --run
pnpm typecheck
pnpm check

Unit test results:

 pnpm --filter "@parity/product-sdk-host"   test -- --run
 pnpm --filter "@parity/product-sdk-signer" test -- --run
Package Before After
@parity/product-sdk-host 87 passed 92 passed
@parity/product-sdk-signer 107 passed 113 passed

All other packages are unchanged and green. pnpm typecheck and pnpm check are clean.

@github-actions

Copy link
Copy Markdown

📦 Bundle size impact

Comparing 2026-08-11T11:23:30.079Z2026-08-11T11:23:39.051Z

Package Entry Bundled before Bundled after Δ Ship gzip Δ Shake ratio
🟢 @parity/product-sdk . 6.33 MB 6.33 MB +775 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./core 6.33 MB 6.33 MB +775 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./host 84.2 KB 84.4 KB +221 B (+0.3%) 0 B 2% (was 2%)
🟢 @parity/product-sdk ./react 6.34 MB 6.34 MB +775 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./wallet 182.0 KB 182.7 KB +771 B (+0.4%) 0 B 1% (was 1%)
🟢 @parity/product-sdk-host . 84.2 KB 84.4 KB +221 B (+0.3%) +94 B 2% (was 2%)
🟢 @parity/product-sdk-signer . 182.0 KB 182.7 KB +771 B (+0.4%) +241 B 1% (was 1%)
🟢 @parity/product-sdk-statement-store . 95.7 KB 95.9 KB +221 B (+0.2%) 0 B 10% (was 11%)

Thresholds — warn: ≥10% or ≥5.0 KB · fail: ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB.

@TarikGul TarikGul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - lets get the e2e test fixed.

@Imod7

Imod7 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Looks good - lets get the e2e test fixed.

Thanks! On the e2e failures, I looked into these and I also run locally and they are not coming from this PR. I will dig more in the e2e failures and I will open a separate PR for this.

@Imod7
Imod7 merged commit 1981a2d into main Aug 11, 2026
12 of 14 checks passed
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.

Wrap account.signVrf (RFC-0023) in the accounts surface

2 participants