Skip to content

fix(signer): route product-account signing through host_create_transaction#96

Merged
TarikGul merged 5 commits into
mainfrom
rh/signer-create-transaction
May 24, 2026
Merged

fix(signer): route product-account signing through host_create_transaction#96
TarikGul merged 5 commits into
mainfrom
rh/signer-create-transaction

Conversation

@ReinhardHatko

Copy link
Copy Markdown
Contributor

Summary

Both product-account signer entry points — the getSigner() returned from HostProvider.getProductAccount(...) and the standalone HostProvider.getProductAccountSigner(...) method — now pass signerType: "createTransaction" to Nova's accountsProvider.getProductAccountSigner(...). Previously they were called with no second argument and defaulted to the deprecated "signPayload" PJS-style path, which strips unknown signed extensions and throws "PJS does not support this signed-extension: AsPgas" on chains that ship the AsPgas extension (Paseo Next).

Legacy-account signing is unchanged — Nova's getLegacyAccountSigner doesn't expose a signerType switch.

What changed

  • Widen AccountsProvider.getProductAccountSigner type to accept the optional signerType?: "signPayload" | "createTransaction" arg (added in Nova 0.7.9).
  • Pass "createTransaction" from both call sites, factored into a PRODUCT_SIGNER_TYPE constant that carries the AsPgas rationale in its JSDoc.

Compatibility

Requires @novasamatech/product-sdk 0.7.9+ and a host build (Polkadot Desktop / Mobile) that implements host_create_transaction. Older Nova versions ignore the extra argument at runtime, so the call-site change is backward-compatible — but apps hitting older hosts will need a host upgrade before signing works again.

Version bump

@parity/product-sdk-signer 0.2.40.2.5 (patch). Changeset included.

Test plan

  • pnpm --filter "@parity/product-sdk-signer" build
  • pnpm --filter "@parity/product-sdk-signer" test (79 tests)
  • pnpm --filter "@parity/product-sdk-signer-demo" exec playwright test e2e/product-account.spec.ts
  • CI green
  • Smoke-test a contract tx against Paseo Next from a real product host to confirm AsPgas no longer trips signing

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown

📦 Bundle size impact

Comparing 2026-05-24T18:25:25.386Z2026-05-24T18:25:15.464Z

Package Entry Bundled before Bundled after Δ Ship gzip Δ Shake ratio
🟢 @parity/product-sdk . 6.29 MB 6.29 MB +29 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./core 6.29 MB 6.29 MB +29 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./react 6.30 MB 6.30 MB +29 B (+0.0%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./wallet 235.4 KB 235.4 KB +29 B (+0.0%) 0 B 1% (was 1%)
🟢 @parity/product-sdk-signer . 235.4 KB 235.4 KB +29 B (+0.0%) +191 B 1% (was 1%)

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

@TarikGul

Copy link
Copy Markdown
Member

Yea we are just waiting for paritytech/triangle-js-sdks#168 to be merged and released right?

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​parity/​host-api-test-sdk@​0.8.372100100100100

View full report

@TarikGul

Copy link
Copy Markdown
Member

Picking this up to land — refines the change and migrates the tx-demo so the e2e suite can actually verify it.

What this PR does now

  • packages/signer/src/providers/host.ts — pins product-account
    signing to signerType: "createTransaction" (PRODUCT_SIGNER_TYPE
    constant), widens the internal AccountsProvider.getProductAccountSigner
    type to accept the optional arg, and updates both call sites. Defensive:
    @novasamatech/host-api-wrapper@0.7.9 already defaults to
    "createTransaction", the pin guards against an upstream default flip.
  • Regression test asserting both signer entry points pass
    "createTransaction".
  • examples/tx-demo/src/main.ts — migrated from
    manager.connect() + selectAccount + manager.getSigner() to
    manager.getProductAccount("tx-demo.dot", 0) + productAccount.getSigner().
    The legacy-account path routes through PJS, which has no signerType
    switch and throws on AsPgas. Product-account routing avoids that path
    entirely. Fixture already maps productAccounts: { "tx-demo.dot/0": "bob" }.
  • Unskipped 4 e2e specs previously blocked behind
    TODO(truapi-migration):
    • tx-demo/dispatch-error.spec.ts
    • tx-demo/finalized.spec.ts
    • tx-demo/on-status.spec.ts
    • tx-demo/submit-remark.spec.ts (both inner tests)
  • 4 signing-log assertions updated from "payload"
    "createTransaction" to match what host-api-test-sdk@0.8.3 records
    for the new routing.
  • Catalog bump @parity/host-api-test-sdk ^0.8.2^0.8.3
    required because 0.8.3 returns a real signed v4 extrinsic the chain
    will accept (0.8.2 echoed callData).
  • contracts-demo/submit.spec.ts comment rescoped to the remaining
    contract-redeploy blocker (AsPgas is no longer the blocker for that
    spec).

Versions

  • @parity/product-sdk-signer: 0.3.0 → 0.3.1 (patch). No public-API
    change — signerType is internal. Changeset moved to
    pending-changesets/ since the PR is still in review.

@TarikGul

Copy link
Copy Markdown
Member

rel: #97

@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.

👍

@TarikGul TarikGul merged commit b31edc3 into main May 24, 2026
12 checks passed
Imod7 added a commit that referenced this pull request May 25, 2026
)

* feat(contracts-demo): migrate to @t3rminal/bulletin-index v3 on Paseo v2
- new address: 0x3331A87C2B9312E246E6A7eE8D0C0AdD8d282B6F (CDM v3)
- shop: address -> shopKey: bytes32
- owner() removed
- new dateExists(shopKey, date) and getMetadata(shopKey, date)
- shopKey argument added in storeDailyReport
- new registry and metadataCid fields in the CDM manifest
- new ipfs suffix in bulletin url
- target key rotated

* refactor(contracts-demo): migrate to product-account signing
- mirroring tx-demo (#96)

* test(contracts-demo): revive Group 2 e2e specs against v2 ABI

* docs(contracts-demo): fix stale references in e2e + UI comments

* Update product-sdk/examples/contracts-demo/src/main.ts

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>

* docs: update signing comments in signer + tx-demo + contracts-demo

---------

Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
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.

4 participants