Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
jobs:
smoke:
name: Testnet Smoke Tests
# The v2 line intentionally targets the resolution-kernel train and does
# not support the currently deployed pre-train testnets. Its live coverage
# comes from the cross-repository E2E stack until those testnets upgrade.
if: github.event_name != 'pull_request' || github.base_ref != 'v2-dev'
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
Expand Down
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ values in wallet or app UI before signing.
const estimate = await client.estimateTransactionFees({
leaderTimeunitsAllocation: 100n,
validatorTimeunitsAllocation: 200n,
rotations: [0n],
});

const txHash = await client.writeContract({
Expand All @@ -132,6 +131,10 @@ const txHash = await client.writeContract({
});
```

When `rotations` is omitted from an estimate, the SDK funds every round through
the chain's `defaultConsensusMaxRotations`. Pass `rotations` explicitly—including
`[0n]`—when the transaction should use a lower rotation budget.

If `fees.distribution` is provided without `feeValue`, the SDK derives the fee
deposit from FeeManager on network backends, or from `sim_getFeeConfig` on
Studio. Use `messageAllocations` with `estimateTransactionFees` for transactions
Expand Down Expand Up @@ -267,11 +270,10 @@ transaction hash; on Studio/localnet it is the target GenLayer transaction id.
A transaction can be finalized by consensus but still have a failed execution. Always check `txExecutionResult` before reading contract state:

```typescript
import { ExecutionResult, TransactionStatus } from "genlayer-js/types";
import { ExecutionResult } from "genlayer-js/types";

const receipt = await client.waitForTransactionReceipt({
const receipt = await client.waitForFinalization({
hash: txHash,
status: TransactionStatus.FINALIZED,
});

if (receipt.txExecutionResultName === ExecutionResult.FINISHED_WITH_RETURN) {
Expand All @@ -297,6 +299,27 @@ Transactions can emit messages to other contracts. These messages create new chi
```typescript
const tx = await client.getTransaction({ hash: txHash });

// The default model is derived from the exact stored state. Processing entries
// have a phase; decided entries have an outcome.
console.log(tx.lifecycle);
// {state: "processing", phase: "revealing"}
// {state: "decided", outcome: "accepted"}

// Advanced protocol consumers can explicitly request timestamp projection and
// the exact resolution action/source. Current Studio can prove only the stored
// status, so unsupported action/decision fields remain inactive there.
const protocolLifecycle = await client.advanced.getTransactionLifecycle({ hash: txHash });
console.log(protocolLifecycle.storedStatus);
console.log(protocolLifecycle.projectedStatus);
console.log(protocolLifecycle.resolutionSource);
if (protocolLifecycle.resolutionAction === "Finalize") {
// Finalize is the protocol's current action/capability, not a transaction status.
}

// The train retains the authoritative execution hash, not the old receipt
// bytes. `txReceipt` is therefore unavailable on train transactions.
console.log(tx.txExecutionHash);

// Messages emitted by the contract during execution
console.log(tx.messages);
// [{messageType, recipient, value, data, onAcceptance, saltNonce}, ...]
Expand Down Expand Up @@ -428,9 +451,12 @@ const epochInfo = await client.getEpochInfo();
// totalClaimed: "500 GEN", // Total claimed rewards
// }

// Get active validators
// Get validators currently eligible for consensus duties
const validators = await client.getActiveValidators();

// Inspect every identity in the append-only joined registry
const joinedValidators = await client.getJoinedValidators();

// Check if address is a validator
const isValidator = await client.isValidator("0x...");

Expand Down
Loading
Loading