Skip to content

Commit f0ee4dc

Browse files
Merge pull request #107 from IntersectMBO/feat/add-txbuilder-api-certificates
feat/add txbuilder api certificates
2 parents 5b8478e + 8c9dc71 commit f0ee4dc

File tree

133 files changed

+4421
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+4421
-274
lines changed

.changeset/bitter-pets-pay.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
"@evolution-sdk/evolution": patch
3+
"@evolution-sdk/devnet": patch
4+
---
5+
6+
### Added: Redeemer Labels for Script Debugging
7+
8+
Added optional `label` property to redeemer operations (`collectFrom`, `withdraw`, `mint`, and stake operations) to help identify which script failed during evaluation.
9+
10+
```typescript
11+
client.newTx()
12+
.collectFrom({
13+
inputs: [utxo],
14+
redeemer: makeSpendRedeemer(999n),
15+
label: "coordinator-spend-utxo" // Shows in failure output
16+
})
17+
.withdraw({
18+
stakeCredential,
19+
amount: 0n,
20+
redeemer: makeWithdrawRedeemer([999n]),
21+
label: "coordinator-withdrawal"
22+
})
23+
```
24+
25+
When scripts fail, the `EvaluationError` now includes a structured `failures` array:
26+
27+
```typescript
28+
interface ScriptFailure {
29+
purpose: "spend" | "mint" | "withdraw" | "cert"
30+
index: number
31+
label?: string // User-provided label
32+
redeemerKey: string // e.g., "spend:0", "withdraw:0"
33+
utxoRef?: string // For spend failures
34+
credential?: string // For withdraw/cert failures
35+
policyId?: string // For mint failures
36+
validationError: string
37+
traces: string[]
38+
}
39+
```
40+
41+
### Added: Stake Operations
42+
43+
Full support for Conway-era stake operations:
44+
45+
- `registerStake` - Register stake credential (RegCert)
46+
- `deregisterStake` - Deregister stake credential (UnregCert)
47+
- `delegateTo` - Delegate to pool and/or DRep (StakeDelegation, VoteDelegCert, StakeVoteDelegCert)
48+
- `registerAndDelegateTo` - Combined registration + delegation (StakeRegDelegCert, VoteRegDelegCert, StakeVoteRegDelegCert)
49+
- `withdraw` - Withdraw staking rewards (supports coordinator pattern with amount: 0n)
50+
51+
All operations support script-controlled credentials with RedeemerBuilder for deferred redeemer resolution.

docs/content/docs/modules/core/Address.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export interface AddressDetails {
8989
readonly bech32: string
9090
readonly hex: string
9191
}
92-
readonly paymentCredential: Credential.CredentialSchema
93-
readonly stakingCredential?: Credential.CredentialSchema
92+
readonly paymentCredential: Credential.Credential
93+
readonly stakingCredential?: Credential.Credential
9494
}
9595
```
9696

@@ -258,7 +258,7 @@ Returns undefined if the address cannot be parsed
258258
**Signature**
259259
260260
```ts
261-
export declare const getPaymentCredential: (address: string) => Credential.CredentialSchema | undefined
261+
export declare const getPaymentCredential: (address: string) => Credential.Credential | undefined
262262
```
263263
264264
Added in v1.0.0
@@ -271,7 +271,7 @@ Returns undefined if the address has no staking credential or cannot be parsed
271271
**Signature**
272272
273273
```ts
274-
export declare const getStakingCredential: (address: string) => Credential.CredentialSchema | undefined
274+
export declare const getStakingCredential: (address: string) => Credential.Credential | undefined
275275
```
276276
277277
Added in v1.0.0

docs/content/docs/modules/core/Credential.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ parent: Modules
1414
- [toCBORBytes](#tocborbytes)
1515
- [toCBORHex](#tocborhex)
1616
- [model](#model)
17-
- [CredentialSchema (type alias)](#credentialschema-type-alias)
17+
- [Credential (type alias)](#credential-type-alias)
1818
- [parsing](#parsing)
1919
- [fromCBORBytes](#fromcborbytes)
2020
- [fromCBORHex](#fromcborhex)
2121
- [predicates](#predicates)
2222
- [is](#is)
2323
- [schemas](#schemas)
24-
- [CredentialSchema](#credentialschema)
24+
- [Credential](#credential)
2525
- [FromCDDL](#fromcddl)
2626
- [testing](#testing)
2727
- [arbitrary](#arbitrary)
2828
- [utils](#utils)
2929
- [CDDLSchema](#cddlschema)
30-
- [Credential (type alias)](#credential-type-alias)
30+
- [CredentialEncoded (type alias)](#credentialencoded-type-alias)
3131
- [FromCBORBytes](#fromcborbytes-1)
3232
- [FromCBORHex](#fromcborhex-1)
3333
- [makeKeyHash](#makekeyhash)
@@ -44,7 +44,7 @@ Convert a Credential to CBOR bytes.
4444
**Signature**
4545

4646
```ts
47-
export declare const toCBORBytes: (credential: CredentialSchema, options?: CBOR.CodecOptions) => Uint8Array
47+
export declare const toCBORBytes: (credential: Credential, options?: CBOR.CodecOptions) => Uint8Array
4848
```
4949
5050
Added in v2.0.0
@@ -56,22 +56,22 @@ Convert a Credential to CBOR hex string.
5656
**Signature**
5757
5858
```ts
59-
export declare const toCBORHex: (credential: CredentialSchema, options?: CBOR.CodecOptions) => string
59+
export declare const toCBORHex: (credential: Credential, options?: CBOR.CodecOptions) => string
6060
```
6161
6262
Added in v2.0.0
6363
6464
# model
6565
66-
## CredentialSchema (type alias)
66+
## Credential (type alias)
6767
6868
Type representing a credential that can be either a key hash or script hash
6969
Used in various address formats to identify ownership
7070
7171
**Signature**
7272
7373
```ts
74-
export type CredentialSchema = typeof CredentialSchema.Type
74+
export type Credential = typeof Credential.Type
7575
```
7676
7777
Added in v2.0.0
@@ -85,7 +85,7 @@ Parse a Credential from CBOR bytes.
8585
**Signature**
8686
8787
```ts
88-
export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => CredentialSchema
88+
export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => Credential
8989
```
9090
9191
Added in v2.0.0
@@ -97,7 +97,7 @@ Parse a Credential from CBOR hex string.
9797
**Signature**
9898
9999
```ts
100-
export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => CredentialSchema
100+
export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => Credential
101101
```
102102
103103
Added in v2.0.0
@@ -121,7 +121,7 @@ Added in v2.0.0
121121
122122
# schemas
123123
124-
## CredentialSchema
124+
## Credential
125125
126126
Credential schema representing either a key hash or script hash
127127
credential = [0, addr_keyhash // 1, script_hash]
@@ -130,7 +130,7 @@ Used to identify ownership of addresses or stake rights
130130
**Signature**
131131
132132
```ts
133-
export declare const CredentialSchema: Schema.Union<[typeof KeyHash.KeyHash, typeof ScriptHash.ScriptHash]>
133+
export declare const Credential: Schema.Union<[typeof KeyHash.KeyHash, typeof ScriptHash.ScriptHash]>
134134
```
135135
136136
Added in v2.0.0
@@ -177,12 +177,12 @@ Added in v2.0.0
177177
export declare const CDDLSchema: Schema.Tuple2<Schema.Literal<[0n, 1n]>, typeof Schema.Uint8ArrayFromSelf>
178178
```
179179
180-
## Credential (type alias)
180+
## CredentialEncoded (type alias)
181181
182182
**Signature**
183183
184184
```ts
185-
export type Credential = typeof CredentialSchema.Encoded
185+
export type CredentialEncoded = typeof Credential.Encoded
186186
```
187187
188188
## FromCBORBytes
@@ -235,13 +235,13 @@ export declare const FromCBORHex: (
235235
**Signature**
236236
237237
```ts
238-
export declare const makeKeyHash: (hash: Uint8Array) => CredentialSchema
238+
export declare const makeKeyHash: (hash: Uint8Array) => Credential
239239
```
240240
241241
## makeScriptHash
242242
243243
**Signature**
244244
245245
```ts
246-
export declare const makeScriptHash: (hash: Uint8Array) => CredentialSchema
246+
export declare const makeScriptHash: (hash: Uint8Array) => Credential
247247
```

docs/content/docs/modules/core/GovernanceAction.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,8 @@ export declare const match: <R>(
217217
NoConfidenceAction: (govActionId: GovActionId | null) => R
218218
UpdateCommitteeAction: (
219219
govActionId: GovActionId | null,
220-
membersToRemove: ReadonlyArray<typeof CommiteeColdCredential.CommitteeColdCredential.CredentialSchema.Type>,
221-
membersToAdd: ReadonlyMap<
222-
typeof CommiteeColdCredential.CommitteeColdCredential.CredentialSchema.Type,
223-
EpochNo.EpochNo
224-
>,
220+
membersToRemove: ReadonlyArray<typeof CommiteeColdCredential.CommitteeColdCredential.Credential.Type>,
221+
membersToAdd: ReadonlyMap<typeof CommiteeColdCredential.CommitteeColdCredential.Credential.Type, EpochNo.EpochNo>,
225222
threshold: UnitInterval.UnitInterval
226223
) => R
227224
NewConstitutionAction: (govActionId: GovActionId | null, constitution: Constituion.Constitution) => R

docs/content/docs/modules/core/VotingProcedures.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ Pattern match on a Voter.
292292

293293
```ts
294294
export declare const matchVoter: <R>(patterns: {
295-
ConstitutionalCommitteeVoter: (credential: Credential.CredentialSchema) => R
295+
ConstitutionalCommitteeVoter: (credential: Credential.Credential) => R
296296
DRepVoter: (drep: DRep.DRep) => R
297297
StakePoolVoter: (poolKeyHash: PoolKeyHash.PoolKeyHash) => R
298298
}) => (voter: Voter) => R

docs/content/docs/modules/sdk/Credential.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Credential.ts
3-
nav_order: 177
3+
nav_order: 179
44
parent: Modules
55
---
66

@@ -26,7 +26,7 @@ parent: Modules
2626
**Signature**
2727

2828
```ts
29-
export type Credential = typeof CoreCredential.CredentialSchema.Encoded
29+
export type Credential = typeof CoreCredential.Credential.Encoded
3030
```
3131
3232
## KeyHash (type alias)

docs/content/docs/modules/sdk/Datum.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Datum.ts
3-
nav_order: 178
3+
nav_order: 180
44
parent: Modules
55
---
66

docs/content/docs/modules/sdk/Delegation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Delegation.ts
3-
nav_order: 179
3+
nav_order: 181
44
parent: Modules
55
---
66

docs/content/docs/modules/sdk/EvalRedeemer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/EvalRedeemer.ts
3-
nav_order: 180
3+
nav_order: 182
44
parent: Modules
55
---
66

docs/content/docs/modules/sdk/Network.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Network.ts
3-
nav_order: 181
3+
nav_order: 183
44
parent: Modules
55
---
66

0 commit comments

Comments
 (0)