Skip to content

feat: soroban-best-practice-snippets#936

Merged
0xVida merged 1 commit into
0xVida:mainfrom
Salmatcre8:feat/soroban-snippets
Jun 1, 2026
Merged

feat: soroban-best-practice-snippets#936
0xVida merged 1 commit into
0xVida:mainfrom
Salmatcre8:feat/soroban-snippets

Conversation

@Salmatcre8
Copy link
Copy Markdown
Contributor

Summary

Adds a second, distinct set of 58 advanced Soroban best-practice VS Code snippets in extension/snippets/soroban-advanced-snippets.json, registered alongside the existing snippet file. All work is confined to the extension/ directory.

Closes #877

Why a new file (not edits to the existing one)

The existing extension/snippets/soroban-snippets.json already ships 60 foundational snippets. Rather than disturb those, this PR adds a separate soroban-advanced-snippets.json focused on higher-level patterns the original set does not cover, under a dedicated sba- prefix namespace so there are zero prefix collisions.

What's included (58 snippets, all documented)

  • SEP-41 / token internals — allowance get/approve/spend, transfer_from, balance helpers, internal do_transfer, mint/burn with supply tracking + events.
  • Access control & safety — role-based access control (grant/revoke), reentrancy guard, nonce/replay protection, timelock & deadline guards, two-step ownership transfer, initialized guard.
  • Safe math — checked arithmetic, overflow-safe mul_div, basis-points helper, clamp.
  • Cross-contract & deployment — typed client calls, fallible try_* calls, deployer factory, contractimport!, native __constructor.
  • Crypto — keccak256/sha256 hashing, ed25519 verify, secp256k1 recover.
  • Testing — proptest scaffold, ledger time advance, expect-error, auth-tree assertions, SAC registration, event assertions, deploy-wasm-in-test.
  • Project scaffolding — recommended Cargo.toml release profile, Makefile, and stellar CLI deploy/invoke command references.

Each snippet has a prefix, a body, and a description (the integrated documentation shown in the IntelliSense popup).

Verified terminal output

Since this is a snippet/JSON contribution (no runnable UI to screenshot), here is the verification output proving the deliverable meets the acceptance criteria. Both registered files parse as valid JSON and conform to the VS Code snippet schema:

registered snippet files:
  - rust -> ./snippets/soroban-snippets.json
  - rust -> ./snippets/soroban-advanced-snippets.json

  ./snippets/soroban-snippets.json: 60 snippets, 60 documented, dup-prefixes: none
  ./snippets/soroban-advanced-snippets.json: 58 snippets, 58 documented, dup-prefixes: none

TOTAL SNIPPETS ACROSS REGISTERED FILES: 118
SCHEMA PROBLEMS: 0

total prefixes: 118 | unique: 118 | ALL UNIQUE: true

(The new file alone provides 58 snippets — already above the 50+ requirement — and every prefix is unique across both files.)

Acceptance criteria

  • 50+ unique snippets for common Soroban operations (58 new; 118 total, all unique prefixes)
  • Integrated documentation for each snippet (every snippet has a description)
  • Deliverable snippets/soroban-*-snippets.json present and registered in package.json

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Salmatcre8 is attempting to deploy a commit to the vidatg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Salmatcre8 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

@0xVida 0xVida merged commit a96b234 into 0xVida:main Jun 1, 2026
0 of 3 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.

[Extension] Custom Snippets for Soroban Best Practices

2 participants