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
33 changes: 33 additions & 0 deletions .changeset/fine-geckos-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
"@evolution-sdk/devnet": patch
"@evolution-sdk/aiken-uplc": patch
"@evolution-sdk/evolution": patch
"docs": patch
---

Add governance and pool operation APIs to transaction builder

This release adds comprehensive support for Conway-era governance operations and stake pool management:

**New Delegation APIs**
- `delegateToPool`: Delegate stake to a pool (with optional registration)
- `delegateToDRep`: Delegate voting power to a DRep (with optional registration)
- `delegateToPoolAndDRep`: Delegate to both pool and DRep simultaneously

**DRep Operations**
- `registerDRep`: Register as a Delegated Representative
- `updateDRep`: Update DRep anchor/metadata
- `deregisterDRep`: Deregister DRep and reclaim deposit

**Constitutional Committee Operations**
- `authCommitteeHot`: Authorize hot credential for committee member
- `resignCommitteeCold`: Resign from constitutional committee

**Stake Pool Operations**
- `registerPool`: Register a new stake pool with parameters
- `retirePool`: Retire a stake pool at specified epoch

**Transaction Balance Improvements**
- Proper accounting for certificate deposits and refunds
- Withdrawal balance calculations
- Minimum 1 input requirement enforcement (replay attack prevention)
8 changes: 5 additions & 3 deletions docs/content/docs/modules/core/Redeemer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ FastCheck arbitrary for generating random RedeemerTag values.
**Signature**

```ts
export declare const arbitraryRedeemerTag: FastCheck.Arbitrary<"spend" | "mint" | "cert" | "reward">
export declare const arbitraryRedeemerTag: FastCheck.Arbitrary<
"spend" | "mint" | "cert" | "reward" | "vote" | "propose"
>
```

Added in v2.0.0
Expand Down Expand Up @@ -267,12 +269,12 @@ Added in v2.0.0

Redeemer tag enum for different script execution contexts.

CDDL: redeemer_tag = 0 ; spend | 1 ; mint | 2 ; cert | 3 ; reward
CDDL: redeemer_tag = 0 ; spend | 1 ; mint | 2 ; cert | 3 ; reward | 4 ; vote | 5 ; propose

**Signature**

```ts
export declare const RedeemerTag: Schema.Literal<["spend", "mint", "cert", "reward"]>
export declare const RedeemerTag: Schema.Literal<["spend", "mint", "cert", "reward", "vote", "propose"]>
```

Added in v2.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Credential.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Credential.ts
nav_order: 182
nav_order: 185
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Datum.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Datum.ts
nav_order: 183
nav_order: 186
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Delegation.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Delegation.ts
nav_order: 184
nav_order: 187
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/EvalRedeemer.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/EvalRedeemer.ts
nav_order: 185
nav_order: 188
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Network.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Network.ts
nav_order: 186
nav_order: 189
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/OutRef.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/OutRef.ts
nav_order: 187
nav_order: 190
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/PolicyId.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/PolicyId.ts
nav_order: 188
nav_order: 191
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/PoolParams.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/PoolParams.ts
nav_order: 189
nav_order: 192
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/ProtocolParameters.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/ProtocolParameters.ts
nav_order: 190
nav_order: 193
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Relay.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Relay.ts
nav_order: 196
nav_order: 199
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/RewardAddress.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/RewardAddress.ts
nav_order: 197
nav_order: 200
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Script.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Script.ts
nav_order: 198
nav_order: 201
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Type.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Type.ts
nav_order: 199
nav_order: 202
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/UTxO.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/UTxO.ts
nav_order: 201
nav_order: 204
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/Unit.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/Unit.ts
nav_order: 200
nav_order: 203
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/RedeemerBuilder.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/RedeemerBuilder.ts
nav_order: 171
nav_order: 174
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/SignBuilder.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/SignBuilder.ts
nav_order: 172
nav_order: 175
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/SignBuilderImpl.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/SignBuilderImpl.ts
nav_order: 173
nav_order: 176
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/SubmitBuilder.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/SubmitBuilder.ts
nav_order: 174
nav_order: 177
parent: Modules
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/SubmitBuilderImpl.ts
nav_order: 175
nav_order: 178
parent: Modules
---

Expand Down
68 changes: 53 additions & 15 deletions docs/content/docs/modules/sdk/builders/TransactionBuilder.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/TransactionBuilder.ts
nav_order: 176
nav_order: 179
parent: Modules
---

Expand Down Expand Up @@ -52,7 +52,6 @@ double-spending. UTxOs can come from any source (wallet, DeFi protocols, other p
- [TxContext (class)](#txcontext-class)
- [errors](#errors)
- [EvaluationError (class)](#evaluationerror-class)
- [formatFailures (method)](#formatfailures-method)
- [ScriptFailure (interface)](#scriptfailure-interface)
- [TransactionBuilderError (class)](#transactionbuildererror-class)
- [model](#model)
Expand Down Expand Up @@ -408,11 +407,60 @@ export interface TransactionBuilderBase {
* Queues a deferred operation that will be executed when build() is called.
* Returns the same builder for method chaining.
*
* @deprecated Use delegateToPool, delegateToDRep, or delegateToPoolAndDRep instead
* @since 2.0.0
* @category staking-methods
*/
readonly delegateTo: (params: DelegateToParams) => this

/**
* Delegate stake to a pool.
*
* Creates a StakeDelegation certificate to delegate your stake credential
* to a specific stake pool for earning staking rewards.
*
* For script-controlled credentials, provide a redeemer.
*
* Queues a deferred operation that will be executed when build() is called.
* Returns the same builder for method chaining.
*
* @since 2.0.0
* @category staking-methods
*/
readonly delegateToPool: (params: DelegateToPoolParams) => this

/**
* Delegate voting power to a DRep.
*
* Creates a VoteDelegCert certificate to delegate your governance voting power
* to a Delegated Representative (Conway era).
*
* For script-controlled credentials, provide a redeemer.
*
* Queues a deferred operation that will be executed when build() is called.
* Returns the same builder for method chaining.
*
* @since 2.0.0
* @category staking-methods
*/
readonly delegateToDRep: (params: DelegateToDRepParams) => this

/**
* Delegate both stake and voting power.
*
* Creates a StakeVoteDelegCert certificate to simultaneously delegate your
* stake to a pool and your voting power to a DRep (Conway era).
*
* For script-controlled credentials, provide a redeemer.
*
* Queues a deferred operation that will be executed when build() is called.
* Returns the same builder for method chaining.
*
* @since 2.0.0
* @category staking-methods
*/
readonly delegateToPoolAndDRep: (params: DelegateToPoolAndDRepParams) => this

/**
* Withdraw staking rewards from a stake credential.
*
Expand Down Expand Up @@ -1068,16 +1116,6 @@ export declare class EvaluationError

Added in v2.0.0

### formatFailures (method)

Format failures into a human-readable string.

**Signature**

```ts
formatFailures(): string
```

## ScriptFailure (interface)

Represents a single script failure from Ogmios evaluation.
Expand Down Expand Up @@ -1157,7 +1195,7 @@ Added in v2.0.0

Data required by script evaluators: cost models, execution limits, and slot configuration.

**NOTE: NOT YET IMPLEMENTED** - Reserved for future UPLC script evaluation support.
Used by custom evaluators for local UPLC script evaluation.

**Signature**

Expand All @@ -1184,8 +1222,7 @@ Added in v2.0.0

Interface for evaluating transaction scripts and computing execution units.

**NOTE: NOT YET IMPLEMENTED** - Reserved for future custom script evaluation support.
When implemented, this will enable custom evaluation strategies including local UPLC execution.
Implement this interface to provide custom script evaluation strategies, such as local UPLC execution.

**Signature**

Expand Down Expand Up @@ -1273,6 +1310,7 @@ export interface TxBuilderState {
readonly referenceInputs: ReadonlyArray<CoreUTxO.UTxO> // Reference inputs (UTxOs with reference scripts)
readonly certificates: ReadonlyArray<Certificate.Certificate> // Certificates for staking operations
readonly withdrawals: Map<RewardAccount.RewardAccount, bigint> // Withdrawal amounts by reward account
readonly poolDeposits: Map<string, bigint> // Pool deposits keyed by pool key hash
readonly mint?: Mint.Mint // Assets being minted/burned (positive = mint, negative = burn)
readonly collateral?: {
// Collateral data for script transactions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/TransactionResult.ts
nav_order: 177
nav_order: 180
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/TxBuilderImpl.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/TxBuilderImpl.ts
nav_order: 178
nav_order: 181
parent: Modules
---

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/modules/sdk/builders/Unfrack.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: sdk/builders/Unfrack.ts
nav_order: 179
nav_order: 182
parent: Modules
---

Expand Down
Loading