Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions AGENTS.md → .agents/skills/tempo-codegen/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Agent Guidelines
---
name: tempo-codegen
description: Skill for generating Tempo code.
---

This document provides guidelines for AI code generation agents working on this codebase.

## Code Generation

### `viem/tempo`
# Tempo Code Generation

When generating actions (in `src/tempo/actions/`), follow these guidelines.

An example of a generated action set can be found in `src/tempo/actions/token.ts`.

#### Source of Truth
## Source of Truth

- **All actions must be based on precompile contract specifications** in `test/tempo/docs/specs/`.
- It could be likely that some interfaces may be inconsistent between the specs (`test/tempo/docs/specs`) and the precompiles (`test/tempo/crates/contracts/src/precompiles`). Always prefer the precompile interfaces over the specs.
- If the specification is unclear or missing details, **prompt the developer** for guidance rather than making assumptions

#### Documentation Requirements
## Documentation Requirements

All actions **must include comprehensive JSDoc** with:

Expand Down Expand Up @@ -57,17 +56,17 @@ Example:
*/
```

#### Action Types
## Action Types

##### Read-Only Actions
### Read-Only Actions

For view/pure functions that only read state:

- Use `readContract` from `viem/actions`
- Return type should use `ReadContractReturnType`
- Parameters extend `ReadParameters`

##### Mutate-Based Actions
### Mutate-Based Actions

For state-changing functions, **both variants must be implemented**:

Expand Down Expand Up @@ -118,11 +117,11 @@ export async function myActionSync<
}
```

#### Namespace Properties
## Namespace Properties

All actions **must include** the following components within their namespace:

##### 1. `Parameters` Type
### 1. `Parameters` Type

```typescript
// Read actions
Expand All @@ -135,7 +134,7 @@ export type Parameters<
> = WriteParameters<chain, account> & Args
```

##### 2. `Args` Type
### 2. `Args` Type

Arguments must be documented with JSDoc.

Expand All @@ -146,7 +145,7 @@ export type Args = {
}
```

##### 3. `ReturnValue` Type
### 3. `ReturnValue` Type

```typescript
// Read actions
Expand All @@ -156,7 +155,7 @@ export type ReturnValue = ReadContractReturnType<typeof Abis.myAbi, 'functionNam
export type ReturnValue = WriteContractReturnType
```

##### 4. `ErrorType` Type (for write actions)
### 4. `ErrorType` Type (for write actions)

Write actions must include an `ErrorType` export. Use `BaseErrorType` from `viem` as a placeholder with a TODO comment for future exhaustive error typing:

Expand All @@ -165,7 +164,7 @@ Write actions must include an `ErrorType` export. Use `BaseErrorType` from `viem
export type ErrorType = BaseErrorType
```

##### 5. `call` Function
### 5. `call` Function

**Required for all actions** - enables composition with other viem actions:

Expand Down Expand Up @@ -214,7 +213,7 @@ The `call` function enables these use cases:
- `estimateContractGas` - Estimate gas costs
- `simulateContract` - Simulate execution

##### 6. `extractEvent` Function (for mutate-based actions)
### 6. `extractEvent` Function (for mutate-based actions)

**Required for all actions that emit events**:

Expand All @@ -237,7 +236,7 @@ export function extractEvent(logs: Log[]) {
}
```

##### 7. `inner` Function (for write actions)
### 7. `inner` Function (for write actions)

```typescript
/** @internal */
Expand All @@ -259,7 +258,7 @@ export async function inner<
}
```

#### Namespace Structure
## Namespace Structure

Organize actions using namespace pattern:

Expand All @@ -277,7 +276,7 @@ export namespace myAction {
}
```

#### Decision-Making
## Decision-Making

When encountering situations that require judgment:

Expand All @@ -287,20 +286,20 @@ When encountering situations that require judgment:
- **Parameter transformations**: Confirm expected input/output formats
- **Edge cases**: Discuss handling strategy with developer

#### Naming Conventions
## Naming Conventions

- Action names should match contract function names (in camelCase)
- Sync variants use `Sync` suffix (e.g., `myActionSync`)
- Event names in `extractEvent` should match contract event names exactly
- Namespace components should be exported within the action's namespace

#### Testing
## Testing

Tests should be co-located with actions in `*action-name*.test.ts` files. Reference contract tests in `test/tempo/crates/precompiles/` for expected behavior.

See `src/tempo/actions/token.test.ts` for a comprehensive example of test patterns and structure.

##### Test Structure
### Test Structure

Organize tests by action name with a default test case and behavior-specific tests:

Expand Down
15 changes: 15 additions & 0 deletions .changeset/brave-clouds-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"viem": major
---

- `viem/tempo` **(Breaking)**: Renamed `tempoTestnet` → `tempoModerato`. The old export is deprecated but still available as an alias.
- `viem/tempo` **(Breaking)**: Renamed `reward.start` → `reward.distribute`: Renamed for distributing rewards (no longer supports streaming).
- `viem/tempo` **(Breaking)**: Renamed `reward.getTotalPerSecond` → `reward.getGlobalRewardPerToken`: Returns the global reward per token value instead of per-second rate.
- `viem/tempo` **(Breaking)**: Renamed `reward.watchRewardScheduled` → `reward.watchRewardDistributed`: Watches for reward distributed events.
- `viem/tempo` **(Breaking)**: Removed `nonce.getNonceKeyCount`.
- `viem/tempo` **(Breaking)**: Removed `nonce.watchActiveKeyCountChanged`.
- `viem/tempo` **(Breaking)**: Removed `amm.watchFeeSwap` (FeeSwap event no longer emitted by protocol).
- `viem/tempo` **(Breaking)**: `OrderPlaced` event now includes `isFlipOrder` and `flipTick` fields. The `FlipOrderPlaced` event has been removed and merged into `OrderPlaced`.
- `viem/tempo` **(Breaking)**: Renamed `Address.stablecoinExchange` → `Address.stablecoinDex`.
- `viem/tempo` **(Breaking)**: Renamed `Abis.stablecoinExchange` → `Abis.stablecoinDex`.
- `viem/tempo`: Added `dex.cancelStale` action to cancel stale orders from restricted makers.
5 changes: 5 additions & 0 deletions .changeset/quiet-doors-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

`viem/tempo`: Added `salt` parameter to `token.create`.
6 changes: 3 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
VITE_NETWORK_TRANSPORT_MODE: ${{ matrix.transport-mode }}
VITE_SHARD_ID: ${{ matrix.shard }}
VITE_TEMPO_ENV: localnet
VITE_TEMPO_TAG: https://rpc.testnet.tempo.xyz
VITE_TEMPO_TAG: latest

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -147,8 +147,8 @@ jobs:
strategy:
matrix:
node-env:
# - devnet
- testnet
- devnet
# - testnet
steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ vectors/**/*.json
site/dist
.vercel
vocs.config.tsx.timestamp*
_
1 change: 0 additions & 1 deletion CLAUDE.md

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"ethers": "^6.15.0",
"knip": "^5.64.0",
"micro-eth-signer": "^0.14.0",
"ox": "~0.11.1",
"ox": "~0.11.3",
"permissionless": "^0.2.57",
"prool": "~0.2.1",
"prool": "~0.2.2",
"publint": "^0.2.12",
"sherif": "^0.8.4",
"simple-git-hooks": "^2.13.1",
Expand Down
Loading
Loading