Skip to content

Feature Request: Allow state wallet to sign state while user wallet sends transaction #78

@cqlyj

Description

@cqlyj

Problem

The SDK does not support the common state channel pattern where:

  • state wallet signs the off-chain state (e.g., channel creation)
  • user wallet sends the on-chain transaction (pays gas)

Currently, createChannel does not expose a way to separate these roles. This leads to contract signature errors or prevents best-practice separation of keys.

Example (Desired Usage)

const client = new NitroliteClient({
  publicClient,
  walletClient, // p1: user wallet (sends tx)
  stateWalletClient, // p2: state wallet (signs state)
  chainId,
  addresses,
});

await client.createChannel({
  initialAllocationAmounts: [BigInt(100), BigInt(0)],
  stateData: "0x",
});
// Expectation: p2 signs the state, p1 sends the transaction

Expected

  • SDK should always use stateWalletClient for state signing (if provided), and walletClient for sending transactions.

Why

  • This is standard in state channel protocols
  • Needed for security and protocol compliance

Suggestion

  • Update SDK to support this pattern and document it with an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions