@helios-lang/effect 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/bun.lock +60 -0
  2. package/dist/Ledger/NetworkParams.js +40 -0
  3. package/dist/Ledger/NetworkParams.js.map +1 -0
  4. package/dist/Ledger/index.js +1 -0
  5. package/dist/Ledger/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/tsconfig.build.tsbuildinfo +1 -0
  8. package/tsconfig.check.tsbuildinfo +1 -0
  9. package/tsconfig.tsbuildinfo +1 -0
  10. package/types/Address.d.ts +5 -0
  11. package/types/Address.d.ts.map +1 -0
  12. package/types/Bech32.d.ts +30 -0
  13. package/types/Bech32.d.ts.map +1 -0
  14. package/types/Cbor.d.ts +430 -0
  15. package/types/Cbor.d.ts.map +1 -0
  16. package/types/Ledger/Address.d.ts +109 -0
  17. package/types/Ledger/Address.d.ts.map +1 -0
  18. package/types/Ledger/AssetClass.d.ts +101 -0
  19. package/types/Ledger/AssetClass.d.ts.map +1 -0
  20. package/types/Ledger/Assets.d.ts +70 -0
  21. package/types/Ledger/Assets.d.ts.map +1 -0
  22. package/types/Ledger/Credential.d.ts +26 -0
  23. package/types/Ledger/Credential.d.ts.map +1 -0
  24. package/types/Ledger/DatumHash.d.ts +40 -0
  25. package/types/Ledger/DatumHash.d.ts.map +1 -0
  26. package/types/Ledger/IsMainnet.d.ts +6 -0
  27. package/types/Ledger/IsMainnet.d.ts.map +1 -0
  28. package/types/Ledger/MintingPolicy.d.ts +39 -0
  29. package/types/Ledger/MintingPolicy.d.ts.map +1 -0
  30. package/types/Ledger/NetworkParams.d.ts +40 -0
  31. package/types/Ledger/NetworkParams.d.ts.map +1 -0
  32. package/types/Ledger/PubKeyHash.d.ts +40 -0
  33. package/types/Ledger/PubKeyHash.d.ts.map +1 -0
  34. package/types/Ledger/TxId.d.ts +10 -0
  35. package/types/Ledger/TxId.d.ts.map +1 -0
  36. package/types/Ledger/TxInput.d.ts +55 -0
  37. package/types/Ledger/TxInput.d.ts.map +1 -0
  38. package/types/Ledger/TxOutput.d.ts +63 -0
  39. package/types/Ledger/TxOutput.d.ts.map +1 -0
  40. package/types/Ledger/TxOutputDatum.d.ts +41 -0
  41. package/types/Ledger/TxOutputDatum.d.ts.map +1 -0
  42. package/types/Ledger/TxOutputId.d.ts +14 -0
  43. package/types/Ledger/TxOutputId.d.ts.map +1 -0
  44. package/types/Ledger/ValidatorHash.d.ts +40 -0
  45. package/types/Ledger/ValidatorHash.d.ts.map +1 -0
  46. package/types/Ledger/index.d.ts +16 -0
  47. package/types/Ledger/index.d.ts.map +1 -0
  48. package/types/Uplc/Cek.d.ts +72 -0
  49. package/types/Uplc/Cek.d.ts.map +1 -0
  50. package/types/Uplc/Data.d.ts +530 -0
  51. package/types/Uplc/Data.d.ts.map +1 -0
  52. package/types/Uplc/DataSchema.d.ts +227 -0
  53. package/types/Uplc/DataSchema.d.ts.map +1 -0
  54. package/types/Uplc/Primitive.d.ts +26 -0
  55. package/types/Uplc/Primitive.d.ts.map +1 -0
  56. package/types/Uplc/index.d.ts +3 -0
  57. package/types/Uplc/index.d.ts.map +1 -0
  58. package/types/index.d.ts +5 -0
  59. package/types/index.d.ts.map +1 -0
  60. package/types/internal/Base32.d.ts +49 -0
  61. package/types/internal/Base32.d.ts.map +1 -0
  62. package/types/internal/BigEndian.d.ts +22 -0
  63. package/types/internal/BigEndian.d.ts.map +1 -0
  64. package/types/internal/Bits.d.ts +123 -0
  65. package/types/internal/Bits.d.ts.map +1 -0
  66. package/types/internal/Bytes.d.ts +88 -0
  67. package/types/internal/Bytes.d.ts.map +1 -0
  68. package/types/internal/Flat.d.ts +71 -0
  69. package/types/internal/Flat.d.ts.map +1 -0
  70. package/types/internal/Float.d.ts +38 -0
  71. package/types/internal/Float.d.ts.map +1 -0
  72. package/types/internal/Utf8.d.ts +24 -0
  73. package/types/internal/Utf8.d.ts.map +1 -0
  74. package/src/Bech32.test.ts +0 -117
  75. package/src/Bech32.ts +0 -198
  76. package/src/Cbor.test.ts +0 -1610
  77. package/src/Cbor.ts +0 -1704
  78. package/src/Ledger/Address.ts +0 -248
  79. package/src/Ledger/AssetClass.ts +0 -90
  80. package/src/Ledger/Assets.ts +0 -164
  81. package/src/Ledger/Credential.ts +0 -29
  82. package/src/Ledger/DatumHash.ts +0 -36
  83. package/src/Ledger/IsMainnet.ts +0 -6
  84. package/src/Ledger/MintingPolicy.ts +0 -57
  85. package/src/Ledger/PubKeyHash.ts +0 -36
  86. package/src/Ledger/TxId.ts +0 -31
  87. package/src/Ledger/TxInput.test.ts +0 -21
  88. package/src/Ledger/TxInput.ts +0 -66
  89. package/src/Ledger/TxOutput.ts +0 -166
  90. package/src/Ledger/TxOutputDatum.ts +0 -64
  91. package/src/Ledger/TxOutputId.ts +0 -63
  92. package/src/Ledger/ValidatorHash.ts +0 -36
  93. package/src/Ledger/index.ts +0 -14
  94. package/src/Uplc/Cek.ts +0 -92
  95. package/src/Uplc/Data.test.ts +0 -321
  96. package/src/Uplc/Data.ts +0 -657
  97. package/src/Uplc/Primitive.ts +0 -56
  98. package/src/Uplc/index.ts +0 -2
  99. package/src/index.ts +0 -4
  100. package/src/internal/Base32.test.ts +0 -219
  101. package/src/internal/Base32.ts +0 -341
  102. package/src/internal/BigEndian.test.ts +0 -79
  103. package/src/internal/BigEndian.ts +0 -67
  104. package/src/internal/Bits.test.ts +0 -300
  105. package/src/internal/Bits.ts +0 -398
  106. package/src/internal/Bytes.test.ts +0 -369
  107. package/src/internal/Bytes.ts +0 -343
  108. package/src/internal/Flat.test.ts +0 -29
  109. package/src/internal/Flat.ts +0 -387
  110. package/src/internal/Float.test.ts +0 -51
  111. package/src/internal/Float.ts +0 -190
  112. package/src/internal/Utf8.test.ts +0 -69
  113. package/src/internal/Utf8.ts +0 -58
@@ -0,0 +1,430 @@
1
+ import { Effect } from "effect";
2
+ import * as Bytes from "./internal/Bytes.js";
3
+ export type Decoder<T> = (stream: Bytes.Stream) => Effect.Effect<T, Bytes.EndOfStreamError | DecodeError>;
4
+ export type IndexedDecoder<T> = (stream: Bytes.Stream, index: number) => Effect.Effect<T, Bytes.EndOfStreamError | DecodeError>;
5
+ export type DecodeEffect<T> = Effect.Effect<T, Bytes.EndOfStreamError | DecodeError>;
6
+ export type PeekEffect<T> = Effect.Effect<T, Bytes.EndOfStreamError>;
7
+ declare const DecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
8
+ readonly _tag: "Cbor.DecodeError";
9
+ } & Readonly<A>;
10
+ export declare class DecodeError extends DecodeError_base<{
11
+ message: string;
12
+ }> {
13
+ constructor(_stream: Bytes.Stream, message: string);
14
+ }
15
+ /**
16
+ * Decodes a CBOR encoded `boolean`.
17
+ * Throws an error if the next element in bytes isn't a `boolean`.
18
+ * @param bytes
19
+ * @returns
20
+ */
21
+ export declare const decodeBool: (bytes: Bytes.BytesLike) => DecodeEffect<boolean>;
22
+ /**
23
+ * Encodes a `boolean` into its CBOR representation.
24
+ * @param b
25
+ * @returns
26
+ */
27
+ export declare function encodeBool(b: boolean): number[];
28
+ /**
29
+ * @param bytes
30
+ * @returns
31
+ */
32
+ export declare const isBool: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
33
+ /**
34
+ * Unwraps a CBOR encoded list of bytes
35
+ * @param bytes
36
+ * cborbytes, mutated to form remaining
37
+ * @returns byteArray
38
+ */
39
+ export declare const decodeBytes: (bytes: Bytes.BytesLike) => DecodeEffect<number[]>;
40
+ /**
41
+ * Wraps a list of bytes using CBOR. Optionally splits the bytes into chunks.
42
+ * @example
43
+ * bytesToHex(Cbor.encodeBytes("4d01000033222220051200120011")) == "4e4d01000033222220051200120011"
44
+ * @param bytes
45
+ * @param splitIntoChunks
46
+ * @returns
47
+ * cbor bytes
48
+ */
49
+ export declare function encodeBytes(bytes: string | number[] | Uint8Array, splitIntoChunks?: boolean): number[];
50
+ /**
51
+ * @param bytes
52
+ * @returns
53
+ */
54
+ export declare const isBytes: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
55
+ /**
56
+ * @param bytes
57
+ * @returns
58
+ */
59
+ export declare const isDefBytes: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
60
+ /**
61
+ * @param bytes
62
+ * @returns
63
+ */
64
+ export declare const isIndefBytes: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
65
+ /**
66
+ * The homogenous field type case is used by the uplc ConstrData (undetermined number of UplcData items)
67
+ * @template Decoders
68
+ * Note: the conditional tuple check loses the tupleness if we just check against array, hence first we check against a tuple, and then an array (needed for the empty case)
69
+ * @param fieldDecoder
70
+ * Array for heterogenous item types, single function for homogenous item types
71
+ * @returns
72
+ */
73
+ export declare const decodeConstr: <Decoders extends [Decoder<any>, ...Decoder<any>[]] | Array<Decoder<any>> | Decoder<any>>(fieldDecoder: Decoders extends [Decoder<any>, ...Decoder<any>[]] ? [...Decoders] : Decoders extends Array<any> ? [...Decoders] : Decoders) => (bytes: Bytes.BytesLike) => DecodeEffect<[number, Decoders extends Array<any> ? { [D in keyof Decoders]: Decoders[D] extends Decoder<infer T> ? T : never; } : Decoders extends Decoder<infer T> ? T[] : never]>;
74
+ /**
75
+ * @param bytes
76
+ * @returns
77
+ */
78
+ export declare const decodeConstrLazy: (bytes: Bytes.BytesLike) => DecodeEffect<[number, <T>(itemDecoder: Decoder<T>) => DecodeEffect<T>]>;
79
+ /**
80
+ * Note: internally the indef list format is used if the number of fields is > 0, if the number of fields is 0 the def list format is used
81
+ * see [well-typed/cborg/serialise/src/Codec/Serialise/Class.hs](https://github.com/well-typed/cborg/blob/4bdc818a1f0b35f38bc118a87944630043b58384/serialise/src/Codec/Serialise/Class.hs#L181).
82
+ * @param tag
83
+ * @param fields
84
+ * @returns
85
+ */
86
+ export declare function encodeConstr(tag: number, fields: readonly number[][]): number[];
87
+ /**
88
+ * @param bytes
89
+ * @returns
90
+ */
91
+ export declare const isConstr: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
92
+ /**
93
+ * @param bytes
94
+ * @returns
95
+ */
96
+ export declare const decodeFloat: (bytes: Bytes.BytesLike) => DecodeEffect<number>;
97
+ /**
98
+ * @param bytes
99
+ * @returns
100
+ */
101
+ export declare const decodeFloat16: (bytes: Bytes.BytesLike) => DecodeEffect<number>;
102
+ /**
103
+ * @param bytes
104
+ * @returns
105
+ */
106
+ export declare const decodeFloat32: (bytes: Bytes.BytesLike) => DecodeEffect<number>;
107
+ /**
108
+ * @param bytes
109
+ * @returns
110
+ */
111
+ export declare const decodeFloat64: (bytes: Bytes.BytesLike) => DecodeEffect<number>;
112
+ /**
113
+ * @param f
114
+ * @returns
115
+ */
116
+ export declare function encodeFloat16(f: number): number[];
117
+ /**
118
+ * @param f
119
+ * @returns
120
+ */
121
+ export declare function encodeFloat32(f: number): number[];
122
+ /**
123
+ * @param f
124
+ * @returns
125
+ */
126
+ export declare function encodeFloat64(f: number): number[];
127
+ /**
128
+ * @param bytes
129
+ * @returns
130
+ */
131
+ export declare const isFloat: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
132
+ /**
133
+ * @param bytes
134
+ * @returns
135
+ */
136
+ export declare const isFloat16: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
137
+ /**
138
+ * @param bytes
139
+ * @returns
140
+ */
141
+ export declare const isFloat32: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
142
+ /**
143
+ * @param bytes
144
+ * @returns
145
+ */
146
+ export declare const isFloat64: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
147
+ /**
148
+ * @param bytes
149
+ * @returns
150
+ * [majorType, n]
151
+ */
152
+ export declare const decodeDefHead: (bytes: Bytes.BytesLike) => DecodeEffect<[number, bigint]>;
153
+ /**
154
+ * @param m major type
155
+ * @param n size parameter
156
+ * @returns uint8 bytes
157
+ * @throws
158
+ * If n is out of range (i.e. very very large)
159
+ */
160
+ export declare function encodeDefHead(m: number, n: number | bigint): number[];
161
+ /**
162
+ * @param m
163
+ * @returns
164
+ */
165
+ export declare function encodeIndefHead(m: number): number[];
166
+ /**
167
+ * @param bytes
168
+ * @returns
169
+ */
170
+ export declare const peekMajorType: (bytes: Bytes.BytesLike) => PeekEffect<number>;
171
+ /**
172
+ * @param bytes
173
+ * @returns
174
+ */
175
+ export declare const peekMajorAndSimpleMinorType: (bytes: Bytes.BytesLike) => PeekEffect<[number, number]>;
176
+ /**
177
+ * Decodes a CBOR encoded bigint integer.
178
+ * @param bytes
179
+ * @returns
180
+ */
181
+ export declare const decodeInt: (bytes: Bytes.BytesLike) => DecodeEffect<bigint>;
182
+ /**
183
+ * Encodes a bigint integer using CBOR.
184
+ * @param n
185
+ * @returns
186
+ */
187
+ export declare function encodeInt(n: number | bigint): number[];
188
+ /**
189
+ * @param bytes
190
+ * @returns
191
+ */
192
+ export declare const isInt: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
193
+ /**
194
+ * Decodes a CBOR encoded list.
195
+ * A decoder function is called with the bytes of every contained item (nothing is returning directly).
196
+ * @template T
197
+ * @param itemDecoder
198
+ * @returns
199
+ */
200
+ export declare const decodeList: <T>(itemDecoder: IndexedDecoder<T>) => ((bytes: Bytes.BytesLike) => DecodeEffect<T[]>);
201
+ /**
202
+ * @param bytes
203
+ * @returns
204
+ *
205
+ *
206
+ */
207
+ export declare const decodeListLazy: (bytes: Bytes.BytesLike) => DecodeEffect<(<T>(itemDecoder: IndexedDecoder<T>) => DecodeEffect<T>)>;
208
+ /**
209
+ * @param bytes
210
+ * @returns
211
+ */
212
+ export declare const decodeListLazyOption: (bytes: Bytes.BytesLike) => DecodeEffect<(<T>(itemDecoder: IndexedDecoder<T>) => DecodeEffect<T | undefined>)>;
213
+ /**
214
+ * This follows the serialization format that the Haskell input-output-hk/plutus UPLC evaluator (i.e. empty lists use `encodeDefList`, non-empty lists use `encodeIndefList`).
215
+ * See [well-typed/cborg/serialise/src/Codec/Serialise/Class.hs](https://github.com/well-typed/cborg/blob/4bdc818a1f0b35f38bc118a87944630043b58384/serialise/src/Codec/Serialise/Class.hs#L181).
216
+ * @param items already encoded
217
+ * @returns
218
+ */
219
+ export declare function encodeList(items: readonly number[][]): number[];
220
+ /**
221
+ * Encodes a list of CBOR encodeable items using CBOR indefinite length encoding.
222
+ * @param list Each item is either already serialized.
223
+ * @returns
224
+ */
225
+ export declare function encodeIndefList(list: readonly number[][]): number[];
226
+ /**
227
+ * Encodes a list of CBOR encodeable items using CBOR definite length encoding
228
+ * (i.e. header bytes of the element represent the length of the list).
229
+ * @param items Each item is already serialized
230
+ * @returns
231
+ */
232
+ export declare function encodeDefList(items: readonly number[][]): number[];
233
+ /**
234
+ * @param bytes
235
+ * @returns
236
+ */
237
+ export declare const isList: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
238
+ /**
239
+ * @param bytes
240
+ * @returns
241
+ */
242
+ export declare const isDefList: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
243
+ /**
244
+ * @param bytes
245
+ * @returns
246
+ */
247
+ export declare const isIndefList: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
248
+ /**
249
+ * Decodes a CBOR encoded map.
250
+ * Calls a decoder function for each key-value pair (nothing is returned directly).
251
+ *
252
+ * The decoder function is responsible for separating the key from the value,
253
+ * which are simply stored as consecutive CBOR elements.
254
+ * @param keyDecoder
255
+ * @param valueDecoder
256
+ * @returns
257
+ */
258
+ export declare const decodeMap: <TKey, TValue>(keyDecoder: Decoder<TKey>, valueDecoder: Decoder<TValue>) => (bytes: Bytes.BytesLike) => DecodeEffect<[TKey, TValue][]>;
259
+ /**
260
+ * Unlike lists, the default serialization format for maps seems to always be the defined format
261
+ * @param pairs already encoded
262
+ * @returns
263
+ */
264
+ export declare function encodeMap(pairs: [number[], number[]][]): number[];
265
+ /**
266
+ * Encodes a list of key-value pairs.
267
+ * @param pairs
268
+ * Each key and each value is an already encoded list of CBOR bytes.
269
+ * @returns
270
+ */
271
+ export declare function encodeDefMap(pairs: [number[], number[]][]): number[];
272
+ /**
273
+ * Encodes a list of key-value pairs using the length undefined format.
274
+ * @param pairs
275
+ * Each key and each value is an already encoded list of CBOR bytes.
276
+ * @returns
277
+ */
278
+ export declare function encodeIndefMap(pairs: [number[], number[]][]): number[];
279
+ /**
280
+ * @param bytes
281
+ * @returns
282
+ */
283
+ export declare const isMap: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
284
+ /**
285
+ * Checks if next element in `bytes` is a `null`.
286
+ * Throws an error if it isn't.
287
+ * @param bytes
288
+ * @returns
289
+ */
290
+ export declare const decodeNull: (bytes: Bytes.BytesLike) => DecodeEffect<null>;
291
+ /**
292
+ * Encode `null` into its CBOR representation.
293
+ * @param _null ignored
294
+ * @returns
295
+ */
296
+ export declare function encodeNull(_null?: null): number[];
297
+ /**
298
+ * @param bytes
299
+ * @returns
300
+ */
301
+ export declare const isNull: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
302
+ /**
303
+ * Decodes a CBOR encoded object with integer keys.
304
+ * For each field a decoder is called which takes the field index and the field bytes as arguments.
305
+ * @template Decoders
306
+ * @param fieldDecoders
307
+ * @returns
308
+ */
309
+ export declare const decodeObjectIKey: <Decoders extends {
310
+ [key: number]: Decoder<any>;
311
+ }>(fieldDecoders: Decoders) => (bytes: Bytes.BytesLike) => DecodeEffect<{ [D in keyof Decoders]+?: Decoders[D] extends Decoder<infer T> ? T : never; }>;
312
+ /**
313
+ * Decodes a CBOR encoded object with string keys.
314
+ * For each field a decoder is called which takes the field index and the field bytes as arguments.
315
+ * @template Decoders
316
+ * @param fieldDecoders
317
+ * @returns
318
+ */
319
+ export declare const decodeObjectSKey: <Decoders extends {
320
+ [key: string]: Decoder<any>;
321
+ }>(fieldDecoders: Decoders) => (bytes: Bytes.BytesLike) => DecodeEffect<{ [D in keyof Decoders]+?: Decoders[D] extends Decoder<infer T> ? T : never; }>;
322
+ /**
323
+ * Encodes an object with optional fields using integer keys.
324
+ * @param object
325
+ * A `Map` with integer keys representing the field indices.
326
+ * @returns
327
+ */
328
+ export declare function encodeObjectIKey(object: Map<number, number[]> | Record<number, number[]>): number[];
329
+ /**
330
+ * Encodes an object with optional fields using string keys.
331
+ * @param object
332
+ * A `Map` with string keys representing the field indices.
333
+ * @returns
334
+ */
335
+ export declare function encodeObjectSKey(object: Map<string, number[]> | Record<string, number[]>): number[];
336
+ /**
337
+ * @param bytes
338
+ * @returns
339
+ */
340
+ export declare const isObject: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
341
+ /**
342
+ * Like a list, but with an optional 258 tag
343
+ * See: https://github.com/Emurgo/cardano-serialization-lib/releases/tag/13.0.0
344
+ * @template T
345
+ * @param itemDecoder
346
+ * @returns
347
+ */
348
+ export declare const decodeSet: <T>(itemDecoder: Decoder<T>) => (bytes: Bytes.BytesLike) => DecodeEffect<T[]>;
349
+ /**
350
+ * A tagged def list (tag 258n)
351
+ * @param items
352
+ * @returns
353
+ */
354
+ export declare function encodeSet(items: number[][]): number[];
355
+ /**
356
+ * @param bytes
357
+ * @returns
358
+ */
359
+ export declare const isSet: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
360
+ /**
361
+ * @param bytes
362
+ * @returns
363
+ */
364
+ export declare const decodeString: (bytes: Bytes.BytesLike) => DecodeEffect<string>;
365
+ /**
366
+ * Encodes a Utf8 string into Cbor bytes.
367
+ * Strings can be split into lists with chunks of up to 64 bytes
368
+ * to play nice with Cardano tx metadata constraints.
369
+ * @param str
370
+ * @param split
371
+ * @returns
372
+ */
373
+ export declare function encodeString(str: string, split?: boolean): number[];
374
+ /**
375
+ * @param bytes
376
+ * @returns
377
+ */
378
+ export declare const isString: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
379
+ /**
380
+ * @param bytes
381
+ * @returns
382
+ */
383
+ export declare const decodeTag: (bytes: Bytes.BytesLike) => DecodeEffect<bigint>;
384
+ /**
385
+ * Unrelated to constructor
386
+ * @param tag
387
+ * @returns
388
+ */
389
+ export declare function encodeTag(tag: number | bigint): number[];
390
+ /**
391
+ * @param bytes
392
+ * @returns
393
+ */
394
+ export declare const isTag: (bytes: Bytes.BytesLike) => PeekEffect<boolean>;
395
+ /**
396
+ * @param bytes
397
+ * @returns
398
+ */
399
+ export declare const peekTag: (bytes: Bytes.BytesLike) => PeekEffect<bigint | undefined>;
400
+ /**
401
+ * @param bytes
402
+ * @returns
403
+ */
404
+ export declare const decodeTagged: (bytes: Bytes.BytesLike) => DecodeEffect<[number, <T>(itemDecoder: Decoder<T>) => DecodeEffect<T>]>;
405
+ /**
406
+ * @template Decoders
407
+ * @template OptionalDecoders
408
+ * @param itemDecoders
409
+ * @param optionalDecoders
410
+ * Defaults to empty tuple
411
+ * @returns
412
+ */
413
+ export declare const decodeTuple: <Decoders extends Array<Decoder<any>>, OptionalDecoders extends Array<Decoder<any>>>(itemDecoders: [...Decoders], optionalDecoders?: [...OptionalDecoders] | []) => (bytes: Bytes.BytesLike) => DecodeEffect<[...{ [D in keyof Decoders]: Decoders[D] extends Decoder<infer T> ? T : never; }, ...{ [D in keyof OptionalDecoders]: OptionalDecoders[D] extends Decoder<infer T> ? T | undefined : never; }]>;
414
+ /**
415
+ * @param bytes
416
+ * @returns
417
+ */
418
+ export declare function decodeTupleLazy(bytes: Bytes.BytesLike): DecodeEffect<(<T>(itemDecoder: Decoder<T>) => DecodeEffect<T>)>;
419
+ /**
420
+ * @param tuple
421
+ * @returns
422
+ */
423
+ export declare function encodeTuple(tuple: number[][]): number[];
424
+ /**
425
+ * @param bytes
426
+ * @returns
427
+ */
428
+ export declare function isTuple(bytes: Bytes.BytesLike): PeekEffect<boolean>;
429
+ export {};
430
+ //# sourceMappingURL=Cbor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cbor.d.ts","sourceRoot":"","sources":["../src/Cbor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAU,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAA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,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,GACxE,EACD,GAAG,GACA,CAAC,IAAI,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,SAAS,OAAO,CAChE,MAAM,CAAC,CACR,GACG,CAAC,GAAG,SAAS,GACb,KAAK,GACV,CACF,CAoDC,CAAA;AAEN;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,CAAC,SAAS,GACrB,YAAY,EAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAAC,CAE/D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAEvD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAEnE"}
@@ -0,0 +1,109 @@
1
+ import { Schema } from "effect";
2
+ import * as Cbor from "../Cbor.js";
3
+ import * as Bytes from "../internal/Bytes.js";
4
+ import { Data } from "../Uplc/index.js";
5
+ import * as Credential from "./Credential.js";
6
+ import { IsMainnet } from "./IsMainnet.js";
7
+ export declare function isValid(addr: string): boolean;
8
+ export declare const Address: Schema.brand<Schema.filter<typeof Schema.String>, "Address">;
9
+ export type Address = Schema.Schema.Type<typeof Address>;
10
+ export declare const FromUplcData: Schema.transformOrFail<Schema.transformOrFail<Schema.SchemaClass<{
11
+ readonly bytes: Uint8Array<ArrayBufferLike>;
12
+ } | {
13
+ readonly int: bigint;
14
+ } | {
15
+ readonly list: readonly Data.Data[];
16
+ } | {
17
+ readonly map: readonly {
18
+ readonly k: Data.Data;
19
+ readonly v: Data.Data;
20
+ }[];
21
+ } | {
22
+ readonly fields: readonly Data.Data[];
23
+ readonly constructor: number;
24
+ }, {
25
+ readonly bytes: Uint8Array<ArrayBufferLike>;
26
+ } | {
27
+ readonly int: bigint;
28
+ } | {
29
+ readonly list: readonly Data.Data[];
30
+ } | {
31
+ readonly map: readonly {
32
+ readonly k: Data.Data;
33
+ readonly v: Data.Data;
34
+ }[];
35
+ } | {
36
+ readonly fields: readonly Data.Data[];
37
+ readonly constructor: number;
38
+ }, never>, Schema.Struct<{
39
+ spendingCredential: Schema.transform<Schema.Schema<({
40
+ _tag: "PubKey";
41
+ } & {
42
+ hash: string;
43
+ }) | ({
44
+ _tag: "Validator";
45
+ } & {
46
+ hash: string;
47
+ }), Data.Data, never>, Schema.Union<[Schema.TaggedStruct<"PubKey", {
48
+ hash: Schema.brand<Schema.filter<typeof Schema.String>, "PubKeyHash">;
49
+ }>, Schema.TaggedStruct<"Validator", {
50
+ hash: Schema.brand<Schema.filter<typeof Schema.String>, "ValidatorHash">;
51
+ }>]>>;
52
+ stakingCredential: Schema.transformOrFail<Schema.SchemaClass<{
53
+ readonly bytes: Uint8Array<ArrayBufferLike>;
54
+ } | {
55
+ readonly int: bigint;
56
+ } | {
57
+ readonly list: readonly Data.Data[];
58
+ } | {
59
+ readonly map: readonly {
60
+ readonly k: Data.Data;
61
+ readonly v: Data.Data;
62
+ }[];
63
+ } | {
64
+ readonly fields: readonly Data.Data[];
65
+ readonly constructor: number;
66
+ }, {
67
+ readonly bytes: Uint8Array<ArrayBufferLike>;
68
+ } | {
69
+ readonly int: bigint;
70
+ } | {
71
+ readonly list: readonly Data.Data[];
72
+ } | {
73
+ readonly map: readonly {
74
+ readonly k: Data.Data;
75
+ readonly v: Data.Data;
76
+ }[];
77
+ } | {
78
+ readonly fields: readonly Data.Data[];
79
+ readonly constructor: number;
80
+ }, never>, Schema.Option<Schema.Schema<{
81
+ readonly hash: string & import("effect/Brand").Brand<"PubKeyHash">;
82
+ readonly _tag: "PubKey";
83
+ } | {
84
+ readonly hash: string & import("effect/Brand").Brand<"ValidatorHash">;
85
+ readonly _tag: "Validator";
86
+ }, {
87
+ readonly bytes: Uint8Array<ArrayBufferLike>;
88
+ } | {
89
+ readonly int: bigint;
90
+ } | {
91
+ readonly list: readonly Data.Data[];
92
+ } | {
93
+ readonly map: readonly {
94
+ readonly k: Data.Data;
95
+ readonly v: Data.Data;
96
+ }[];
97
+ } | {
98
+ readonly fields: readonly Data.Data[];
99
+ readonly constructor: number;
100
+ }, never>>, never>;
101
+ }>, never>, Schema.brand<Schema.filter<typeof Schema.String>, "Address">, IsMainnet>;
102
+ export declare function make(isMainnet: boolean, spendingCredential: Credential.Credential, stakingCredential?: Credential.Credential): Address;
103
+ export declare const decode: (bytes: Bytes.BytesLike) => Cbor.DecodeEffect<Address>;
104
+ export declare function encode(address: Address): number[];
105
+ export declare function bytes(address: Address): number[];
106
+ export declare function isMainnet(address: Address): boolean;
107
+ export declare function spendingCredential(address: Address): Credential.Credential;
108
+ export declare function stakingCredential(address: Address): Credential.Credential | undefined;
109
+ //# sourceMappingURL=Address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/Ledger/Address.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE5D,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI1C,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO7C;AAED,eAAO,MAAM,OAAO,8DAKnB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,CAAA;AAExD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oFAiCxB,CAAA;AAED,wBAAgB,IAAI,CAClB,SAAS,EAAE,OAAO,EAClB,kBAAkB,EAAE,UAAU,CAAC,UAAU,EACzC,iBAAiB,CAAC,EAAE,UAAU,CAAC,UAAU,GACxC,OAAO,CAWT;AAkID,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,CAAC,SAAS,KAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAiBtE,CAAA;AAEH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAEjD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAEhD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC,UAAU,CAE1E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,GACf,UAAU,CAAC,UAAU,GAAG,SAAS,CAEnC"}
@@ -0,0 +1,101 @@
1
+ import { Schema } from "effect";
2
+ import * as Bytes from "../internal/Bytes.js";
3
+ import { Data } from "../Uplc";
4
+ import * as MintingPolicy from "./MintingPolicy.js";
5
+ export declare function isValid(assetClass: string): assetClass is AssetClass;
6
+ export declare const AssetClass: Schema.transform<typeof Schema.String, Schema.brand<Schema.filter<typeof Schema.String>, "AssetClass">>;
7
+ export type AssetClass = Schema.Schema.Type<typeof AssetClass>;
8
+ export declare const ADA: AssetClass;
9
+ export declare function make(policy: MintingPolicy.MintingPolicy, tokenName: Bytes.BytesLike): string;
10
+ export declare const FromUplcData: Schema.transform<Schema.transformOrFail<Schema.SchemaClass<{
11
+ readonly bytes: Uint8Array<ArrayBufferLike>;
12
+ } | {
13
+ readonly int: bigint;
14
+ } | {
15
+ readonly list: readonly Data.Data[];
16
+ } | {
17
+ readonly map: readonly {
18
+ readonly k: Data.Data;
19
+ readonly v: Data.Data;
20
+ }[];
21
+ } | {
22
+ readonly fields: readonly Data.Data[];
23
+ readonly constructor: number;
24
+ }, {
25
+ readonly bytes: Uint8Array<ArrayBufferLike>;
26
+ } | {
27
+ readonly int: bigint;
28
+ } | {
29
+ readonly list: readonly Data.Data[];
30
+ } | {
31
+ readonly map: readonly {
32
+ readonly k: Data.Data;
33
+ readonly v: Data.Data;
34
+ }[];
35
+ } | {
36
+ readonly fields: readonly Data.Data[];
37
+ readonly constructor: number;
38
+ }, never>, Schema.Struct<{
39
+ policy: Schema.transform<Schema.transformOrFail<Schema.SchemaClass<{
40
+ readonly bytes: Uint8Array<ArrayBufferLike>;
41
+ } | {
42
+ readonly int: bigint;
43
+ } | {
44
+ readonly list: readonly Data.Data[];
45
+ } | {
46
+ readonly map: readonly {
47
+ readonly k: Data.Data;
48
+ readonly v: Data.Data;
49
+ }[];
50
+ } | {
51
+ readonly fields: readonly Data.Data[];
52
+ readonly constructor: number;
53
+ }, {
54
+ readonly bytes: Uint8Array<ArrayBufferLike>;
55
+ } | {
56
+ readonly int: bigint;
57
+ } | {
58
+ readonly list: readonly Data.Data[];
59
+ } | {
60
+ readonly map: readonly {
61
+ readonly k: Data.Data;
62
+ readonly v: Data.Data;
63
+ }[];
64
+ } | {
65
+ readonly fields: readonly Data.Data[];
66
+ readonly constructor: number;
67
+ }, never>, typeof Schema.Uint8ArrayFromSelf, never>, Schema.Option<Schema.brand<Schema.filter<typeof Schema.String>, "ValidatorHash">>>;
68
+ tokenName: Schema.transformOrFail<Schema.SchemaClass<{
69
+ readonly bytes: Uint8Array<ArrayBufferLike>;
70
+ } | {
71
+ readonly int: bigint;
72
+ } | {
73
+ readonly list: readonly Data.Data[];
74
+ } | {
75
+ readonly map: readonly {
76
+ readonly k: Data.Data;
77
+ readonly v: Data.Data;
78
+ }[];
79
+ } | {
80
+ readonly fields: readonly Data.Data[];
81
+ readonly constructor: number;
82
+ }, {
83
+ readonly bytes: Uint8Array<ArrayBufferLike>;
84
+ } | {
85
+ readonly int: bigint;
86
+ } | {
87
+ readonly list: readonly Data.Data[];
88
+ } | {
89
+ readonly map: readonly {
90
+ readonly k: Data.Data;
91
+ readonly v: Data.Data;
92
+ }[];
93
+ } | {
94
+ readonly fields: readonly Data.Data[];
95
+ readonly constructor: number;
96
+ }, never>, typeof Schema.Uint8ArrayFromSelf, never>;
97
+ }>, never>, Schema.transform<typeof Schema.String, Schema.brand<Schema.filter<typeof Schema.String>, "AssetClass">>>;
98
+ export declare function pretty(assetClass: string): string;
99
+ export declare function policy(assetClass: string): MintingPolicy.MintingPolicy;
100
+ export declare function tokenName(assetClass: string): string;
101
+ //# sourceMappingURL=AssetClass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetClass.d.ts","sourceRoot":"","sources":["../../src/Ledger/AssetClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAGnD,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,IAAI,UAAU,CAOpE;AAED,eAAO,MAAM,UAAU,yGAWtB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAA;AAE9D,eAAO,MAAM,GAAG,EAAS,UAAU,CAAA;AAEnC,wBAAgB,IAAI,CAClB,MAAM,EAAE,aAAa,CAAC,aAAa,EACnC,SAAS,EAAE,KAAK,CAAC,SAAS,UAO3B;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oHAsBxB,CAAA;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC,aAAa,CAMtE;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMpD"}