Skip to content

feat: create transaction refinement#168

Merged
johnthecat merged 18 commits into
mainfrom
feat/create-transaction-refinement
May 19, 2026
Merged

feat: create transaction refinement#168
johnthecat merged 18 commits into
mainfrom
feat/create-transaction-refinement

Conversation

@johnthecat

@johnthecat johnthecat commented May 11, 2026

Copy link
Copy Markdown
Contributor

Refines host_create_transaction and the product-account signer

Cleans up the create-transaction API and makes getProductAccountSigner actually produce a usable PAPI signer.

Protocol changes

host_create_transaction / host_create_transaction_with_legacy_account:

  • The account moves into the payload as a typed signer field. The separate accountId parameter is gone.
  • The context block (runtime metadata, token symbol/decimals, best block height) is dropped — the signer is online and reads those from the chain.
  • The VersionedTxPayload envelope is gone — pass TxPayloadV1<Signer> directly. signer is required (was Option<str>).

Before:

fn host_create_transaction(
  accountId: ProductAccountId,
  payload: VersionedTxPayload // wraps TxPayloadV1 { signer, callData, extensions, txExtVersion, context }
) -> Result<Vec<u8>, CreateTransactionErr>;

After:

fn host_create_transaction(
  payload: TxPayloadV1<ProductAccountId> // { signer, genesisHash, callData, extensions, txExtVersion }
) -> Result<Vec<u8>, CreateTransactionErr>;

product-sdk

  • getProductAccountSigner(account) now returns a PolkadotSigner whose signTx routes through host_create_transaction and returns a fully signed extrinsic. Previously it returned a detached signature via host_sign_payload and made the caller assemble the extrinsic.

  • New top-level accounts export — a ready-to-use provider built on the default sandbox transport, so products that don't need a custom transport can skip createAccountsProvider():

    import { accounts } from '@novasamatech/product-sdk';
    
    const result = await accounts.getProductAccount('product.dot', 0);
    if (result.isOk()) {
      const signer = accounts.getProductAccountSigner(result.value);
      await tx.signAndSubmit(signer);
    }
  • Signer.createTransaction payload shape changes to match the new TxPayloadV1 (no version, no context, typed signer).

  • Exports ProductAccountId and LegacyAccount types.

  • New runtime dependency: @polkadot-api/substrate-bindings (used to read the extrinsic version from metadata).

host-papp

  • UserSession gains createTransaction(payload). The Host can now delegate product-account transaction signing to the paired Polkadot Mobile app over SSO via the new CreateTransactionRequest / CreateTransactionResponse message pair. Legacy-account signing stays Host-local.

Compatibility

No shim. host_create_transaction had no production consumers and host_create_transaction_with_legacy_account is only reachable via product-sdk, which is bumped in lockstep.

@johnthecat johnthecat self-assigned this May 11, 2026
@socket-security

socket-security Bot commented May 11, 2026

Copy link
Copy Markdown

@johnthecat johnthecat force-pushed the feat/create-transaction-refinement branch from 2736b27 to d342e03 Compare May 15, 2026 13:28
@johnthecat johnthecat merged commit 4efeb84 into main May 19, 2026
5 checks passed
@johnthecat johnthecat deleted the feat/create-transaction-refinement branch June 11, 2026 09:06
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.

3 participants