Skip to content

feat(staking,vesting,accounts): provider-lane writes + native transfer - #200

Merged
MuncleUscles merged 1 commit into
v2-devfrom
feat/provider-write-and-transfer
Jul 10, 2026
Merged

feat(staking,vesting,accounts): provider-lane writes + native transfer#200
MuncleUscles merged 1 commit into
v2-devfrom
feat/provider-write-and-transfer

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Summary

Two SDK changes on the shared write core. The local-key path is unchanged and remains the regression gate.

B1 — provider-aware executeWrite (staking + vesting)

executeWrite in src/staking/actions.ts and src/vesting/actions.ts now branches on account.type === "local":

  • local: unchanged statements (getTransactionCount -> prepareTransactionRequest{type:"legacy"} -> signTransaction guard -> sign -> sendRawTransaction), moved verbatim inside the if.
  • else (Address-only / provider): best-effort eth_gasPrice then client.request({method:"eth_sendTransaction", ...}) with type:"0x0", wallet manages the nonce. Mirrors the proven IC provider lane in src/contracts/actions.ts (~:2169-2178 / :2412-2422).

Shared preflight simulate + gas estimate stay before the branch; the publicClient.waitForTransactionReceipt wait, revert diagnostics, and returned {transactionHash, blockNumber, gasUsed} shape are unchanged. Discriminator is strictly account.type === "local" (inner signTransaction guard retained). No src/types/* write-path changes.

B2 — native transfer action

src/accounts/actions.ts: factory is now accountActions(client, publicClient) and exposes transfer({to, value}): Promise<TransactionReceipt> — local-key only (throws a clear "requires a local-key account" error for missing / non-local / Address-only accounts). Mirrors the executeWrite local lane 1:1. Plumbed in src/client/client.ts (passes the in-scope publicClient) and typed in src/types/clients.ts.

Testing

  • npm run build (incl. DTS) green; npm run lint clean.
  • npm test (vitest --typecheck): 115 passed / 8 files (was 98 / 7). Existing local-lane write tests unchanged.
  • New: tests/staking-actions.test.ts (local validatorJoin anchor + provider validatorDeposit/delegatorExit/validatorJoin event-decode); provider-lane describe in tests/vesting-actions.test.ts; transfer cases in tests/accounts-actions.test.ts; transfer type assertion in tests/client.test-d.ts.

Unblocks CLI browser-wallet writes routing through the SDK.

Note: the existing getCurrentNonce invocations in tests/accounts-actions.test.ts gained a second publicClient argument — an unavoidable consequence of the mandated accountActions(client, publicClient) signature change, not a write-path regression edit.

Do not merge — shared write core; human review before it lands on v2-dev.

B1: executeWrite in staking + vesting now branches on account.type === "local".
The local-key path (getTransactionCount -> prepareTransactionRequest -> sign ->
sendRawTransaction) is unchanged and stays the regression gate. Address-only /
injected-provider accounts route through client.request eth_sendTransaction
(wallet manages nonce + signing), mirroring the proven IC provider lane in
src/contracts/actions.ts. Shared preflight simulate + gas estimate and the
post-mine receipt wait / revert diagnostics are unchanged around the branch.
B2: new accountActions.transfer({to, value}) for native GEN transfers, local-key
only, mirroring the executeWrite local lane. accountActions now takes publicClient.
Unblocks CLI browser-wallet writes routing through the SDK.
@coderabbitai

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b10a2228-4753-461b-babd-cf122e30fe58

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/provider-write-and-transfer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MuncleUscles
MuncleUscles merged commit bf42f13 into v2-devJul 10, 2026
8 of 9 checks passed
@MuncleUscles
MuncleUscles deleted the feat/provider-write-and-transfer branch July 10, 2026 08:07
Sign up for freeto 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.

1 participant

@MuncleUscles