Skip to content

Commit b4e9adc

Browse files
committed
feat: add devnet modules
1 parent 193c03b commit b4e9adc

File tree

146 files changed

+6716
-2308
lines changed

Some content is hidden

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

146 files changed

+6716
-2308
lines changed

docs/content/docs/modules/core/Script.mdx

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ parent: Modules
2222
- [FromCDDL](#fromcddl)
2323
- [ScriptCDDL](#scriptcddl)
2424
- [utils](#utils)
25+
- [FromCBORBytes](#fromcborbytes)
26+
- [FromCBORHex](#fromcborhex)
2527
- [Script (type alias)](#script-type-alias)
2628
- [ScriptCDDL (type alias)](#scriptcddl-type-alias)
2729
- [fromCBOR](#fromcbor)
28-
- [fromCBORHex](#fromcborhex)
30+
- [fromCBORHex](#fromcborhex-1)
2931
- [toCBOR](#tocbor)
3032
- [toCBORHex](#tocborhex)
3133

@@ -157,6 +159,79 @@ Added in v2.0.0
157159

158160
# utils
159161

162+
## FromCBORBytes
163+
164+
**Signature**
165+
166+
```ts
167+
export declare const FromCBORBytes: (
168+
options?: CBOR.CodecOptions
169+
) => Schema.transform<
170+
Schema.transformOrFail<
171+
typeof Schema.Uint8ArrayFromSelf,
172+
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
173+
never
174+
>,
175+
Schema.transformOrFail<
176+
Schema.Union<
177+
[
178+
Schema.Tuple2<
179+
Schema.Literal<[0n]>,
180+
Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
181+
>,
182+
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
183+
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
184+
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
185+
]
186+
>,
187+
Schema.SchemaClass<
188+
NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
189+
NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
190+
never
191+
>,
192+
never
193+
>
194+
>
195+
```
196+
197+
## FromCBORHex
198+
199+
**Signature**
200+
201+
```ts
202+
export declare const FromCBORHex: (
203+
options?: CBOR.CodecOptions
204+
) => Schema.transform<
205+
Schema.transform<Schema.Schema<string, string, never>, Schema.Schema<Uint8Array, Uint8Array, never>>,
206+
Schema.transform<
207+
Schema.transformOrFail<
208+
typeof Schema.Uint8ArrayFromSelf,
209+
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
210+
never
211+
>,
212+
Schema.transformOrFail<
213+
Schema.Union<
214+
[
215+
Schema.Tuple2<
216+
Schema.Literal<[0n]>,
217+
Schema.Schema<NativeScripts.NativeScriptCDDL, NativeScripts.NativeScriptCDDL, never>
218+
>,
219+
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
220+
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
221+
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>
222+
]
223+
>,
224+
Schema.SchemaClass<
225+
NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
226+
NativeScripts.NativeScript | PlutusV1.PlutusV1 | PlutusV2.PlutusV2 | PlutusV3.PlutusV3,
227+
never
228+
>,
229+
never
230+
>
231+
>
232+
>
233+
```
234+
160235
## Script (type alias)
161236

162237
**Signature**

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

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

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: 146
3+
nav_order: 153
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: 147
3+
nav_order: 154
44
parent: Modules
55
---
66

docs/content/docs/modules/sdk/Devnet/Devnet.mdx

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Devnet/Devnet.ts
3-
nav_order: 148
3+
nav_order: 155
44
parent: Modules
55
---
66

@@ -14,6 +14,8 @@ parent: Modules
1414
- [Cluster](#cluster-1)
1515
- [container](#container)
1616
- [Container](#container-1)
17+
- [genesis](#genesis)
18+
- [Genesis](#genesis-1)
1719
- [utils](#utils)
1820
- [CardanoDevNetError (class)](#cardanodevneterror-class)
1921
- [DevNetCluster (interface)](#devnetcluster-interface)
@@ -31,14 +33,14 @@ Cluster management operations for Cardano DevNet.
3133

3234
```ts
3335
export declare const Cluster: {
34-
readonly make: (config?: DevnetDefault.DevNetConfig) => Effect.Effect<DevNetCluster, CardanoDevNetError>
35-
readonly makeOrThrow: (config?: DevnetDefault.DevNetConfig) => Promise<DevNetCluster>
36-
readonly start: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
37-
readonly startOrThrow: (cluster: DevNetCluster) => Promise<void>
38-
readonly stop: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
39-
readonly stopOrThrow: (cluster: DevNetCluster) => Promise<void>
40-
readonly remove: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
41-
readonly removeOrThrow: (cluster: DevNetCluster) => Promise<void>
36+
readonly makeEffect: (config?: DevnetDefault.DevNetConfig) => Effect.Effect<DevNetCluster, CardanoDevNetError>
37+
readonly make: (config?: DevnetDefault.DevNetConfig) => Promise<DevNetCluster>
38+
readonly startEffect: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
39+
readonly start: (cluster: DevNetCluster) => Promise<void>
40+
readonly stopEffect: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
41+
readonly stop: (cluster: DevNetCluster) => Promise<void>
42+
readonly removeEffect: (cluster: DevNetCluster) => Effect.Effect<void, CardanoDevNetError>
43+
readonly remove: (cluster: DevNetCluster) => Promise<void>
4244
}
4345
```
4446
@@ -54,19 +56,50 @@ Individual container management operations.
5456
5557
```ts
5658
export declare const Container: {
57-
readonly start: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
58-
readonly startOrThrow: (container: DevNetContainer) => Promise<void>
59-
readonly stop: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
60-
readonly stopOrThrow: (container: DevNetContainer) => Promise<void>
61-
readonly remove: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
62-
readonly removeOrThrow: (container: DevNetContainer) => Promise<void>
63-
readonly getStatus: (
59+
readonly startEffect: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
60+
readonly start: (container: DevNetContainer) => Promise<void>
61+
readonly stopEffect: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
62+
readonly stop: (container: DevNetContainer) => Promise<void>
63+
readonly removeEffect: (container: DevNetContainer) => Effect.Effect<void, CardanoDevNetError>
64+
readonly remove: (container: DevNetContainer) => Promise<void>
65+
readonly getStatusEffect: (
6466
container: DevNetContainer
6567
) => Effect.Effect<Docker.ContainerInspectInfo | undefined, CardanoDevNetError>
66-
readonly getStatusOrThrow: (container: DevNetContainer) => Promise<Docker.ContainerInspectInfo | undefined>
67-
readonly isImageAvailable: (imageName: string) => Effect.Effect<boolean, CardanoDevNetError>
68-
readonly isImageAvailableOrThrow: (imageName: string) => Promise<boolean>
69-
readonly downloadImage: (imageName: string) => Effect.Effect<void, CardanoDevNetError>
68+
readonly getStatus: (container: DevNetContainer) => Promise<Docker.ContainerInspectInfo | undefined>
69+
readonly isImageAvailableEffect: (imageName: string) => Effect.Effect<boolean, CardanoDevNetError, never>
70+
readonly isImageAvailable: (imageName: string) => Promise<boolean>
71+
readonly downloadImageEffect: (imageName: string) => Effect.Effect<void, CardanoDevNetError, never>
72+
readonly downloadImage: (imageName: string) => Promise<void>
73+
readonly ensureImageAvailableEffect: (imageName: string) => Effect.Effect<void, CardanoDevNetError, never>
74+
readonly ensureImageAvailable: (imageName: string) => Promise<void>
75+
readonly execCommandEffect: (
76+
container: DevNetContainer,
77+
command: Array<string>
78+
) => Effect.Effect<string, CardanoDevNetError>
79+
readonly execCommand: (container: DevNetContainer, command: Array<string>) => Promise<string>
80+
}
81+
```
82+
83+
Added in v2.0.0
84+
85+
# genesis
86+
87+
## Genesis
88+
89+
Genesis UTxO operations for deterministic calculation and querying.
90+
91+
**Signature**
92+
93+
```ts
94+
export declare const Genesis: {
95+
readonly calculateUtxosFromConfig: (
96+
genesisConfig: DevnetDefault.ShelleyGenesis
97+
) => Effect.Effect<ReadonlyArray<UTxO.UTxO>, CardanoDevNetError>
98+
readonly calculateUtxosFromConfigOrThrow: (
99+
genesisConfig: DevnetDefault.ShelleyGenesis
100+
) => Promise<readonly UTxO.UTxO[]>
101+
readonly queryUtxos: (cluster: DevNetCluster) => Effect.Effect<ReadonlyArray<UTxO.UTxO>, CardanoDevNetError>
102+
readonly queryUtxosOrThrow: (cluster: DevNetCluster) => Promise<readonly UTxO.UTxO[]>
70103
}
71104
```
72105

docs/content/docs/modules/sdk/Devnet/DevnetDefault.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: sdk/Devnet/DevnetDefault.ts
3-
nav_order: 149
3+
nav_order: 156
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: 150
3+
nav_order: 157
44
parent: Modules
55
---
66

docs/content/docs/modules/sdk/Label.mdx

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

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: sdk/Network.ts
3+
nav_order: 159
4+
parent: Modules
5+
---
6+
7+
## Network overview
8+
9+
Network type for Cardano networks.
10+
11+
Added in v2.0.0
12+
13+
---
14+
15+
<h2 className="text-delta">Table of contents</h2>
16+
17+
- [constants](#constants)
18+
- [SLOT_CONFIG_NETWORK](#slot_config_network)
19+
- [model](#model)
20+
- [Network (type alias)](#network-type-alias)
21+
- [SlotConfig (interface)](#slotconfig-interface)
22+
- [transformation](#transformation)
23+
- [slotToUnixTime](#slottounixtime)
24+
- [unixTimeToSlot](#unixtimetoslot)
25+
26+
---
27+
28+
# constants
29+
30+
## SLOT_CONFIG_NETWORK
31+
32+
Network-specific slot configurations for all Cardano networks.
33+
34+
- **Mainnet**: Production network starting at Shelley era
35+
- **Preview**: Preview testnet for protocol updates
36+
- **Preprod**: Pre-production testnet
37+
- **Custom**: Customizable for emulator/devnet (initialized with zeros)
38+
39+
**Signature**
40+
41+
```ts
42+
export declare const SLOT_CONFIG_NETWORK: Record<Network, SlotConfig>
43+
```
44+
45+
Added in v2.0.0
46+
47+
# model
48+
49+
## Network (type alias)
50+
51+
Network type for Cardano networks.
52+
53+
**Signature**
54+
55+
```ts
56+
export type Network = "Mainnet" | "Preview" | "Preprod" | "Custom"
57+
```
58+
59+
Added in v2.0.0
60+
61+
## SlotConfig (interface)
62+
63+
Slot configuration for a Cardano network.
64+
Defines the relationship between slots and Unix time.
65+
66+
**Signature**
67+
68+
```ts
69+
export interface SlotConfig {
70+
/**
71+
* Unix timestamp (in milliseconds) of the network start (Shelley era).
72+
*/
73+
readonly zeroTime: bigint
74+
75+
/**
76+
* First slot number of the Shelley era.
77+
*/
78+
readonly zeroSlot: bigint
79+
80+
/**
81+
* Duration of each slot in milliseconds (typically 1000ms = 1 second).
82+
*/
83+
readonly slotLength: number
84+
}
85+
```
86+
87+
Added in v2.0.0
88+
89+
# transformation
90+
91+
## slotToUnixTime
92+
93+
Convert a slot number to Unix time (in milliseconds).
94+
95+
**Signature**
96+
97+
```ts
98+
export declare const slotToUnixTime: (slot: bigint, slotConfig: SlotConfig) => bigint
99+
```
100+
101+
Added in v2.0.0
102+
103+
## unixTimeToSlot
104+
105+
Convert a Unix time (in milliseconds) to the enclosing slot number.
106+
107+
**Signature**
108+
109+
```ts
110+
export declare const unixTimeToSlot: (unixTime: bigint, slotConfig: SlotConfig) => bigint
111+
```
112+
113+
Added in v2.0.0

docs/content/docs/modules/sdk/OutRef.mdx

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

0 commit comments

Comments
 (0)