Skip to content

Simplify web tutorials and enable all in CI#166

Open
WiktorStarczewski wants to merge 9 commits intomainfrom
wiktor-opt
Open

Simplify web tutorials and enable all in CI#166
WiktorStarczewski wants to merge 9 commits intomainfrom
wiktor-opt

Conversation

@WiktorStarczewski
Copy link
Contributor

Summary

  • Remove unnecessary client.sync() calls — waitFor() and execute() already sync internally, so explicit syncs after these calls were redundant
  • Extract MASM code from inline template literals into separate .masm files with a webpack loader
  • Simplify counter value display using Word.toU64s() instead of manual hex conversion
  • Update getOrImport helpers to accept bech32 strings directly
  • Update tutorials for simplified notes API (listAvailable, send, consume)
  • Update send() API from authenticated: false to returnNote: true
  • Enable all web tutorials in CI (previously incrementCounterContract and foreignProcedureInvocation were skipped)
  • Fix empty array expansion in run_tutorials.sh for set -u compatibility

Test plan

  • All 5 web tutorials pass (yarn tutorials --web)
  • Previously skipped tutorials (incrementCounterContract, foreignProcedureInvocation) pass when explicitly run

- listAvailable now returns InputNoteRecord[] directly
- consume accepts notes array instead of noteIds
- Remove .inputNoteRecord() and .map(n => n.id()) boilerplate
Remove Address.fromBech32(...).accountId() ceremony — getOrImport
already accepts AccountRef (which includes bech32 strings).
Move inline MASM template strings from foreignProcedureInvocation.ts
into dedicated .masm files (counter_contract.masm, count_reader.masm).
Add webpack asset/source rule for .masm imports and a TypeScript module
declaration. Restructure FPI tutorial to show file creation steps.
Extract inline MASM from incrementCounterContract.ts into the shared
counter_contract.masm file. Restructure counter contract tutorial with
dedicated MASM and bundler config steps.

Remove unnecessary client.sync() calls across all web tutorials where
local state is already up to date (after account creation, after
consume with no subsequent chain query, etc.).
waitFor() already calls syncStateWithTimeout(0) on each polling
iteration, so explicit sync after it is redundant. execute() updates
local account state directly, so sync before accounts.get() is also
unnecessary.
Enable incrementCounterContract and foreignProcedureInvocation in CI by
clearing WEB_SKIPPED. Guard empty-array references with the
${arr[@]+"${arr[@]}"} idiom so set -u does not trigger unbound-variable
errors.
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.

1 participant