-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Open
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
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 transactionExpected
- SDK should always use
stateWalletClientfor state signing (if provided), andwalletClientfor 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
Labels
enhancementNew feature or requestNew feature or request