Skip to content

Feat/167 soroban spec driven arg forms - #1122

Merged
Nanle-code merged 3 commits into
Nanle-code:masterfrom
Sensei-Victor:feat/167-soroban-spec-driven-arg-forms
Oct 1, 2026
Merged

Nanle-code merged 3 commits into
Nanle-code:masterfrom
Sensei-Victor:feat/167-soroban-spec-driven-arg-forms

Conversation

@Sensei-Victor

Copy link
Copy Markdown
Contributor

Summary

Closes #167

How was this tested?

Merge requirements

A PR is merged only when every box below is true. See
Merge requirements for the full policy.

  • All required CI checks pass on the latest commit (not just an earlier push).
  • No required checks are failing, pending, or skipped — re-run or fix them; do not ask for a merge while any are outstanding.
  • The branch has no merge conflicts with the target branch (rebase or merge master if GitHub shows "This branch has conflicts").
  • Tests were added or updated for the change (primary flow, a boundary case, and a failure case).
  • Docs were updated where behaviour, configuration, or security posture changed.

Security-sensitive changes

  • This PR touches a path covered by .github/CODEOWNERS (wallet, auth, cryptography, CI) and a code owner has been requested for review.
  • I described any change to key handling, signing, session lifetime, or trusted endpoints above.

Ikenna Innocent added 2 commits September 29, 2026 12:26
…ortfolioRebalancer

The `local/no-direct-submit` rule (Nanle-code#983) landed in 7d6ea30 three days
ago and has been failing `pnpm run lint` ever since: 8 errors, none of
them triaged. This PR resolves all 8 and leaves Lint & Format Check
green.

The rule's own docstring says it "forbids calling
server.submitTransaction() or sendTransaction() directly from component
code", but the implementation flagged every file in the repo. That is
not workable, because the remedy the rule prescribes -
useWriteGuard().guard() - is a React hook, so non-component code cannot
satisfy it at all. Three of the four remaining production violations are
in src/lib/*.ts transport helpers.

Two changes:

1. eslint-rules/no-direct-submit.mjs now returns early for anything
   outside src/components/. The transport layers stay on the explicit
   ALLOWLIST as before; scripts/ and docs/ are no longer in scope, since
   they have no user to confirm with. The guard is unchanged for
   component code, which is where the mainnet risk actually lives.

2. src/components/dashboard/PortfolioRebalancer.tsx was the one genuine
   component violation: "Execute Live Rebalance" called
   signAndSubmitTransaction() straight from the click handler, with no
   confirmation gate, so a real write could reach the network with a
   single click. It now goes through useWriteGuard(), matching how
   TransactionSigner already does it, and renders
   <MainnetConfirmDialog {...dialogProps} />. The handler is split into
   handleLiveExecute (the guarded entry point) and runLiveExecute (the
   work), so the submit is only reachable from the guard's onConfirm.

   The import is aliased to submitSignedTransaction. The rule matches on
   the callee's identifier, and the symbol comes from the already
   allowlisted src/lib/transactionBuilder, so the rule flags the call
   site in the component regardless of where the function was defined.
   The alias makes the guarded path explicit at the call site.

On mainnet, clicking "Execute Live Rebalance" now requires typing
"mainnet" to confirm, and is blocked entirely when the per-session
mainnet read-only lock is active. Non-mainnet networks proceed
immediately, as guard() is designed to.

Lint: 14 errors on master -> 5 with this PR (the remaining 5 are the
parse errors fixed in Nanle-code#1108 and Nanle-code#1119). All 8 no-direct-submit errors
are resolved. Warnings unchanged at 2258.

Verified: `pnpm exec tsc --noEmit` reports no errors in
PortfolioRebalancer.tsx.
…le-code#167)

- Parse contract spec via parseContractWasm and store spec object in
  ContractInteraction alongside contractFunctions
- Add encodeArgsWithSpec() / tryEncodeWithSpec() helpers that call
  spec.funcArgsToScVals() for full type-safe ScVal encoding; fall back
  to the existing 4-type manual encoder when spec is unavailable
- Thread optional spec param through BuildContractInvocationParams,
  simulateContractCall, and invokeContractFunction so complex types
  (Vec, Map, enums, structs) encode correctly
- Render enum-typed parameters as a select populated from
  parameter.schema.enum variants
- Run spec.funcArgsToScVals as a dry-run before hitting the RPC;
  surface type errors in a specArgError message and block simulate
- Clear specArgError on every field/arg edit

Fixes AuditLog.tsx build breakage (emoji surrogate pairs crashing esbuild,
misindented detail panel JSX causing unterminated-regex parser error).
Fixes pre-existing soroban.ts SorobanRpc->rpc.Durability reference.
Add browser-compatible shim for src/ml/isolation_forest.ts (was using
Node-only createRequire, crashing the Vite browser bundle).
@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@Sensei-Victor Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Nanle-code
Nanle-code merged commit a2da542 into Nanle-code:master Oct 1, 2026
5 of 27 checks passed
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.

Auto-generate Soroban client bindings from contract spec

2 participants