Vara.eth Injected App Builder
Use this skill for full injected-transaction application flows: deploy or attach a program, top up executable balance, initialize, seed required state, build the frontend interaction layer, send injected writes, read Vara.eth state, and verify the end-to-end user path.
Start Here
Read ../../playbooks/vara-eth-injected-app-workflow.md before implementing or documenting the flow.
Use supporting skills only for the slice that applies:
- Contract behavior changes:
../vara-eth-contract-writer/SKILL.md.
- General CLI, TypeScript, ABI, replies, state reads:
../vara-eth-app-builder/SKILL.md.
- Broader product/UI packaging beyond injected writes:
../vara-eth-full-app-builder/SKILL.md.
- Solidity adapter or callback flows:
../vara-eth-solidity-integrator/SKILL.md.
Use ../../references/flow-checks.md as the final checklist.
Core Rule
Do not treat a frontend injected transaction as just a button plus wallet connect. A usable app needs:
- a program created on the intended Router from validated code,
- executable balance,
- init success,
- required setup/state seeding,
- a typed payload and state-read layer,
- wallet signing for injected writes,
- separate UI states for signing, promise waiting, state read, and confirmation.
Workflow
- Confirm the target architecture: injected writes plus Vara.eth state reads.
- Verify the Router, Ethereum RPC, Vara.eth RPC, sender, and existing artifacts. If the user wants fresh code, ignore stale
CODE_ID values and upload the current .opt.wasm.
- Build artifacts if needed with
cargo build --release; locate .opt.wasm and .idl.
- Use
ethexe tx upload --watch and wait for validation approval.
- Create the program from the validated
code_id; capture actor_id as the program id.
- Top up executable balance with wVARA and wait for mirror state change.
- Initialize with an IDL/generated-client encoded constructor payload. Do not guess constructor bytes.
- Send required setup messages through injected transactions only when they carry zero ETH value; verify each reply.
- Smoke-read program-specific state to prove readiness.
- Build or repair the frontend interaction module before UI components.
- Wire the UI to wallet connect, injected submit, promise validation, state read, errors, and timing/cost instrumentation.
- Run TypeScript checks and any available build/test commands.
Frontend Pattern
Use the browser wallet as an EIP-1193 signer, not as proof that the app is using normal Ethereum transactions.
The interaction layer should:
- request accounts with
eth_requestAccounts,
- create an Ethereum
publicClient from the Ethereum RPC,
- create a wallet client from
custom(window.ethereum),
- convert it to a Vara.eth signer,
- create
VaraEthApi with a WsVaraEthProvider for the Vara.eth RPC,
- encode Sails payloads outside React components,
- submit writes with
api.createInjectedTransaction({ destination, payload, value: 0n }),
- wait with
sendAndWaitForPromise(),
- validate the promise signature,
- read results with
calculateReplyForHandle(...).
Keep RPC URLs, Router address, and Program ID in env/config placeholders. Do not commit private keys or personal live addresses.
Operational Checks
For deploy/activation, verify these observable signals:
- upload receipt,
- validation approval,
- create receipt and returned
actor_id,
- executable-balance top-up state change,
- init reply code,
- setup injected reply codes,
- program-specific state read.
For frontend, verify:
- missing config does not crash the app,
- wallet connection errors are visible,
- injected submit is distinct from state read,
- result read happens after the injected promise,
- UI exposes failed promise/reply states,
npm run check or the local package check passes.
Measuring Cost
To measure one injected action:
- Read mirror state and record
executable_balance and state_hash.
- Send the injected transaction and wait for the promise.
- Poll mirror state until
state_hash or executable_balance changes.
- Compute
before - after in raw units and format with 12 wVARA decimals.
Do not assume the balance immediately after sendAndWaitForPromise() is final.
Common Pitfalls
- Uploading to the wrong Router from a stale
.env.example.
- Using old code ids when the requested task is to deploy fresh code.
- Forgetting executable balance before init or injected messages.
- Mixing IDL parser versions with the generated IDL syntax.
- Sending injected messages with non-zero ETH value.
- Showing success after the promise while the app still needs a state read.
- Measuring cost without waiting for state visibility.
Final Response
Report:
- Router, code id, program id, and whether they are placeholders or live values.
- Which activation steps completed.
- Which injected messages and state reads verified readiness.
- Which checks ran.
- Any remaining manual wallet or network actions.
1---2name: vara-eth-injected-app-builder3description: Build, repair, deploy, activate, or review Vara.eth apps that use injected transactions for writes and Vara.eth RPC state reads. Use when Codex is asked to make a browser/frontend dApp where MetaMask or another EIP-1193 wallet signs an injected Vara.eth transaction, when configuring `createInjectedTransaction`, when preparing an existing Rust/Sails program for injected frontend use, or when measuring injected transaction latency/cost through executable balance reads.4---56# Vara.eth Injected App Builder78Use this skill for full injected-transaction application flows: deploy or attach a program, top up executable balance, initialize, seed required state, build the frontend interaction layer, send injected writes, read Vara.eth state, and verify the end-to-end user path.910## Start Here1112Read `../../playbooks/vara-eth-injected-app-workflow.md` before implementing or documenting the flow.1314Use supporting skills only for the slice that applies:1516- Contract behavior changes: `../vara-eth-contract-writer/SKILL.md`.17- General CLI, TypeScript, ABI, replies, state reads: `../vara-eth-app-builder/SKILL.md`.18- Broader product/UI packaging beyond injected writes: `../vara-eth-full-app-builder/SKILL.md`.19- Solidity adapter or callback flows: `../vara-eth-solidity-integrator/SKILL.md`.2021Use `../../references/flow-checks.md` as the final checklist.2223## Core Rule2425Do not treat a frontend injected transaction as just a button plus wallet connect. A usable app needs:2627- a program created on the intended Router from validated code,28- executable balance,29- init success,30- required setup/state seeding,31- a typed payload and state-read layer,32- wallet signing for injected writes,33- separate UI states for signing, promise waiting, state read, and confirmation.3435## Workflow36371. Confirm the target architecture: injected writes plus Vara.eth state reads.382. Verify the Router, Ethereum RPC, Vara.eth RPC, sender, and existing artifacts. If the user wants fresh code, ignore stale `CODE_ID` values and upload the current `.opt.wasm`.393. Build artifacts if needed with `cargo build --release`; locate `.opt.wasm` and `.idl`.404. Use `ethexe tx upload --watch` and wait for validation approval.415. Create the program from the validated `code_id`; capture `actor_id` as the program id.426. Top up executable balance with wVARA and wait for mirror state change.437. Initialize with an IDL/generated-client encoded constructor payload. Do not guess constructor bytes.448. Send required setup messages through injected transactions only when they carry zero ETH value; verify each reply.459. Smoke-read program-specific state to prove readiness.4610. Build or repair the frontend interaction module before UI components.4711. Wire the UI to wallet connect, injected submit, promise validation, state read, errors, and timing/cost instrumentation.4812. Run TypeScript checks and any available build/test commands.4950## Frontend Pattern5152Use the browser wallet as an EIP-1193 signer, not as proof that the app is using normal Ethereum transactions.5354The interaction layer should:5556- request accounts with `eth_requestAccounts`,57- create an Ethereum `publicClient` from the Ethereum RPC,58- create a wallet client from `custom(window.ethereum)`,59- convert it to a Vara.eth signer,60- create `VaraEthApi` with a `WsVaraEthProvider` for the Vara.eth RPC,61- encode Sails payloads outside React components,62- submit writes with `api.createInjectedTransaction({ destination, payload, value: 0n })`,63- wait with `sendAndWaitForPromise()`,64- validate the promise signature,65- read results with `calculateReplyForHandle(...)`.6667Keep RPC URLs, Router address, and Program ID in env/config placeholders. Do not commit private keys or personal live addresses.6869## Operational Checks7071For deploy/activation, verify these observable signals:7273- upload receipt,74- validation approval,75- create receipt and returned `actor_id`,76- executable-balance top-up state change,77- init reply code,78- setup injected reply codes,79- program-specific state read.8081For frontend, verify:8283- missing config does not crash the app,84- wallet connection errors are visible,85- injected submit is distinct from state read,86- result read happens after the injected promise,87- UI exposes failed promise/reply states,88- `npm run check` or the local package check passes.8990## Measuring Cost9192To measure one injected action:93941. Read mirror state and record `executable_balance` and `state_hash`.952. Send the injected transaction and wait for the promise.963. Poll mirror state until `state_hash` or `executable_balance` changes.974. Compute `before - after` in raw units and format with 12 wVARA decimals.9899Do not assume the balance immediately after `sendAndWaitForPromise()` is final.100101## Common Pitfalls102103- Uploading to the wrong Router from a stale `.env.example`.104- Using old code ids when the requested task is to deploy fresh code.105- Forgetting executable balance before init or injected messages.106- Mixing IDL parser versions with the generated IDL syntax.107- Sending injected messages with non-zero ETH value.108- Showing success after the promise while the app still needs a state read.109- Measuring cost without waiting for state visibility.110111## Final Response112113Report:114115- Router, code id, program id, and whether they are placeholders or live values.116- Which activation steps completed.117- Which injected messages and state reads verified readiness.118- Which checks ran.119- Any remaining manual wallet or network actions.