git clone --depth 1 https://github.com/anthropics/claude-plugins-community /tmp/tres-tx-story && cp -r /tmp/tres-tx-story/tres-finance-plugin/skills/tres-tx-story ~/.claude/skills/tres-tx-storySKILL.md
# TRES Transaction Story
Fetch a transaction by hash from TRES Finance, render a flow diagram of all asset
movements, and explain in plain English what happened.
## MCP Server
All calls use the `TRES Finance MCP` server (URL: `https://ai.tres.finance/mcp`).
---
## Step 1 — Authenticate
Call `get_viewer` (no arguments) to verify the session.
---
## Step 2 — Fetch the Transaction
Query the transaction using its hash as the `identifier`:
```graphql
query GetTransactionByHash($hash: String!, $currency: String) {
transaction(identifier: $hash, currency: $currency, limit: 1) {
results {
id
identifier
platform
timestamp
success
decodedFunctionName
methodId
fromAddress { identifier displayName isInternal customAccountName }
toAddress { identifier displayName isInternal customAccountName }
contract { identifier contractName protocols applications }
classification { activity action functionName }
ledgerSummary
applications
protocols
internalAccounts { id name }
children {
id
amount
balanceFactor
platform
type
fiatValue
nonTaxableType
isInternalTransfer
financialActionGroup
belongsTo { id name identifier }
sender { identifier displayName isInternal customAccountName }
recipient { identifier displayName isInternal customAccountName }
asset {
identifier
symbol: key
assetClass { id symbol verificationStatus }
}
}
}
}
}
```
Variables: `{ "hash": "<user_provided_hash>", "currency": "usd" }`
> **Fallback**: If `identifier` returns 0 results, retry with `identifier_Contains`
> using the last 20 characters of the hash. Hashes on some chains may be stored
> without the `0x` prefix — strip it and retry if still empty.
---
## Step 3 — Parse the Data
From the result, extract:
| Field | Purpose |
|---|---|
| `identifier` | The tx hash |
| `platform` | Blockchain (ETHEREUM, SOLANA, etc.) |
| `timestamp` | Date/time |
| `success` | Did it succeed? |
| `decodedFunctionName` | What smart-contract function was called |
| `fromAddress` / `toAddress` | Top-level sender → receiver |
| `contract.contractName` | Smart contract involved (if any) |
| `classification.activity` + `.action` | TRES classification label |
| `children[]` | Each sub-transaction (individual token movement) |
For each child sub-transaction, extract:
- `asset.assetClass.symbol` — the token symbol (e.g. ETH, USDC)
- `amount` — quantity moved
- `fiatValue` — USD equivalent
- `balanceFactor` — `1` = inflow, `-1` = outflow
- `belongsTo.name` — which internal wallet this belongs to
- `sender.identifier` / `recipient.identifier` — counterparties
- `type` — GAS, TOKEN_TRANSFER, etc.
---
## Step 4 — Render the Diagram
Use the `show_widget` tool (Visualizer) to render an HTML widget containing an inline SVG diagram.
---
### PRE-RENDER CHECKLIST — do this before writing a single SVG element
**A. Prepare all label strings first**
For every arrow label (token amount + symbol), apply these formatting rules:
1. Format the amount:
- amount ≥ 1,000,000 → `"1.2M"` style (1 decimal)
- amount ≥ 1,000 → `"264K"` or `"12,233"` (comma-separated integer)
- amount ≥ 1 → round to 2 decimal places max
- amount < 1 → keep up to 4 significant figures (e.g. `"0.033"`)
2. Truncate the symbol:
- symbol ≤ 6 chars → use as-is (ETH, USDC, DAI, CRV)
- symbol 7–10 chars → use as-is only if the full label fits (see step 3)
- symbol > 10 chars OR contains `+` OR is a compound LP token → replace with `"LP tokens"`
3. Measure the full label: `label = amount + " " + symbol`. Count characters. Multiply by 7. That's the pixel width.
4. The available space for a label = the arrow's x-span minus 20px safety margin.
- Left gap (wallet→contract): x goes from 136 to 248 → span = 112px → max label = 13 chars
- Right gap (contract→wallet): x goes from 408 to 504 → span = 96px → max label = 11 chars
5. If `label_px_width > available_space`, shorten further: abbreviate amount to 1 sig fig, or use symbol-only if still too wide.
**B. Count the arrows and calculate SVG height**
- Count non-gas arrows (outflows + inflows). Call this `N`.
- Each arrow row occupies 34px of vertical space.
- Base node centre Y = 50 + (N × 34) / 2 (so arrows fan symmetrically around the node centre).
- Gas arrow hangs 60px below the bottom of the left wallet circle.
- SVG height = node_centre_y + node_radius + 80 (gas arrow + label + padding).
- Minimum SVG height = 230px.
**C. Lay out arrow Y positions**
- Space arrows evenly, 34px apart, centred on `node_centre_y`.
- First arrow y = node_centre_y - ((N-1) × 34) / 2
- Each subsequent arrow y += 34
- Outflow arrows (wallet → contract) use left half of diagram.
- Inflow arrows (contract → wallet) use right half.
- If there is exactly 1 inflow and multiple outflows, centre the inflow arrow at `node_centre_y`.
---
### Fixed node positions (do not change these)
```
ViewBox width: 640
Left wallet circle: cx=90, cy=node_centre_y, r=46
Contract rect: x=248, y=node_centre_y-55, width=160, height=110, rx=12
Right wallet circle: cx=550, cy=node_centre_y, r=46
Arrow x coordinates:
Outflow (left→centre): x1=136, x2=246 midpoint_x=191
Inflow (centre→right): x1=410, x2=504 midpoint_x=457
Gas (downward): x1=x2=90, y1=node_centre_y+46
```
These x values are derived from the node edges and must not be adjusted. They guarantee labels always fall in the clear gap between nodes.
---
### Arrow label placement rules (no exceptions)
```
Label x = midpoint_x of arrow (191 for outflows, 457 for inflows)
Label y = arrow_y - 12
text-anchor = "middle"
font-size = 10.5px
font-weight = 500
```
**Never** place a label at the same y as another label. If two arrows are only 34px apart, their labels (at y-12) are 34px apart — that is sufficient. Never stacExplain a topic like I'm a 5 year old. Use when the user types /eli5 <topic> or asks for a dead-simple picture explainer of how something works.
Use the `quickdesign` CLI to generate AI media — UGC promo videos, image edits, product creatives, video upscales — through Seedance, Kling, Sora2, Nano Banana, and GPT Image. Invoke this skill whenever the user asks for a talking-avatar video, multi-segment ad / promo / explainer, image edit (object swap, angle change, state change), product photoshoot, or video upscale via QuickDesign.
Use only when the user explicitly asks for a TestDino audit of Playwright automated test code. Routes through the audit tools the TestDino MCP server exposes (get_audit_report + submit_audit_report, or the legacy test_audit). For generic code review or non-Playwright targets, do a normal review instead.
Use when the user wants to check TestDino connection status, validate their PAT, discover available organizations and projects, or find the right projectId. Always call this first when the project context is ambiguous before any other TestDino tool.
Use when the user wants to manage a manual execution run or update case-level results inside a run — listing runs, creating runs for a release, inspecting a run, assigning cases, or marking case results (passed/failed/blocked/skipped/retest/untested). Accepts counter-style IDs like RUN-12 and TC-156.
Use when the user wants to create, update, or browse manual QA test cases and suites in TestDino — not execution runs. Covers list_manual_test_suites, list_manual_test_cases, get_manual_test_case, create_manual_test_case, update_manual_test_case, create_manual_test_suite.
Use when the user wants to browse, inspect, create, or update releases/milestones in a TestDino project. Covers list_releases, get_release, create_release, and update_release. Accepts counter-style IDs like MS-12.
Use when the user wants to inspect automated test runs, list failed or flaky tests, debug a failing testcase with historical context, or filter runs by branch, commit, author, environment, browser, status, or tags. Includes list_testruns, get_run_details, list_testcase, get_testcase_details, and debug_testcase.