5
5
* @flow
6
6
*/
7
7
8
- /**
9
- * @param {Uint8Array} bytes
10
- * @returns {TransactionMetadatum}
11
- */
12
- declare export function encode_arbitrary_bytes_as_metadatum(
13
- bytes: Uint8Array
14
- ): TransactionMetadatum;
15
-
16
- /**
17
- * @param {TransactionMetadatum} metadata
18
- * @returns {Uint8Array}
19
- */
20
- declare export function decode_arbitrary_bytes_from_metadatum(
21
- metadata: TransactionMetadatum
22
- ): Uint8Array;
23
-
24
- /**
25
- * @param {string} json
26
- * @param {number} schema
27
- * @returns {TransactionMetadatum}
28
- */
29
- declare export function encode_json_str_to_metadatum(
30
- json: string,
31
- schema: number
32
- ): TransactionMetadatum;
33
-
34
- /**
35
- * @param {TransactionMetadatum} metadatum
36
- * @param {number} schema
37
- * @returns {string}
38
- */
39
- declare export function decode_metadatum_to_json_str(
40
- metadatum: TransactionMetadatum,
41
- schema: number
42
- ): string;
43
-
44
8
/**
45
9
* @param {TransactionHash} tx_body_hash
46
10
* @param {ByronAddress} addr
@@ -165,6 +129,42 @@ declare export function encode_json_str_to_native_script(
165
129
schema: number
166
130
): NativeScript;
167
131
132
+ /**
133
+ * @param {Uint8Array} bytes
134
+ * @returns {TransactionMetadatum}
135
+ */
136
+ declare export function encode_arbitrary_bytes_as_metadatum(
137
+ bytes: Uint8Array
138
+ ): TransactionMetadatum;
139
+
140
+ /**
141
+ * @param {TransactionMetadatum} metadata
142
+ * @returns {Uint8Array}
143
+ */
144
+ declare export function decode_arbitrary_bytes_from_metadatum(
145
+ metadata: TransactionMetadatum
146
+ ): Uint8Array;
147
+
148
+ /**
149
+ * @param {string} json
150
+ * @param {number} schema
151
+ * @returns {TransactionMetadatum}
152
+ */
153
+ declare export function encode_json_str_to_metadatum(
154
+ json: string,
155
+ schema: number
156
+ ): TransactionMetadatum;
157
+
158
+ /**
159
+ * @param {TransactionMetadatum} metadatum
160
+ * @param {number} schema
161
+ * @returns {string}
162
+ */
163
+ declare export function decode_metadatum_to_json_str(
164
+ metadatum: TransactionMetadatum,
165
+ schema: number
166
+ ): string;
167
+
168
168
/**
169
169
* @param {string} password
170
170
* @param {string} salt
@@ -246,17 +246,6 @@ declare export var NativeScriptKind: {|
246
246
+TimelockExpiry: 5, // 5
247
247
|};
248
248
249
- /**
250
- * Each new language uses a different namespace for hashing its script
251
- * This is because you could have a language where the same bytes have different semantics
252
- * So this avoids scripts in different languages mapping to the same hash
253
- * Note that the enum value here is different than the enum value for deciding the cost model of a script
254
- */
255
-
256
- declare export var ScriptHashNamespace: {|
257
- +NativeScript: 0, // 0
258
- |};
259
-
260
249
/**
261
250
*/
262
251
@@ -278,6 +267,7 @@ declare export var StakeCredKind: {|
278
267
279
268
declare export var LanguageKind: {|
280
269
+PlutusV1: 0, // 0
270
+ +PlutusV2: 1, // 1
281
271
|};
282
272
283
273
/**
@@ -301,6 +291,29 @@ declare export var RedeemerTagKind: {|
301
291
+Reward: 3, // 3
302
292
|};
303
293
294
+ /**
295
+ * Each new language uses a different namespace for hashing its script
296
+ * This is because you could have a language where the same bytes have different semantics
297
+ * So this avoids scripts in different languages mapping to the same hash
298
+ * Note that the enum value here is different than the enum value for deciding the cost model of a script
299
+ * https://github.com/input-output-hk/cardano-ledger/blob/9c3b4737b13b30f71529e76c5330f403165e28a6/eras/alonzo/impl/src/Cardano/Ledger/Alonzo.hs#L127
300
+ */
301
+
302
+ declare export var ScriptHashNamespace: {|
303
+ +NativeScript: 0, // 0
304
+ +PlutusV1: 1, // 1
305
+ +PlutusV2: 2, // 2
306
+ |};
307
+
308
+ /**
309
+ * Used to choose the schema for a script JSON string
310
+ */
311
+
312
+ declare export var ScriptSchema: {|
313
+ +Wallet: 0, // 0
314
+ +Node: 1, // 1
315
+ |};
316
+
304
317
/**
305
318
*/
306
319
@@ -321,15 +334,6 @@ declare export var MetadataJsonSchema: {|
321
334
+DetailedSchema: 2, // 2
322
335
|};
323
336
324
- /**
325
- * Used to choosed the schema for a script JSON string
326
- */
327
-
328
- declare export var ScriptSchema: {|
329
- +Wallet: 0, // 0
330
- +Node: 1, // 1
331
- |};
332
-
333
337
/**
334
338
*/
335
339
@@ -2175,6 +2179,11 @@ declare export class Language {
2175
2179
*/
2176
2180
static new_plutus_v1(): Language;
2177
2181
2182
+ /**
2183
+ * @returns {Language}
2184
+ */
2185
+ static new_plutus_v2(): Language;
2186
+
2178
2187
/**
2179
2188
* @returns {number}
2180
2189
*/
@@ -3145,6 +3154,12 @@ declare export class PlutusScript {
3145
3154
*/
3146
3155
static from_bytes(bytes: Uint8Array): PlutusScript;
3147
3156
3157
+ /**
3158
+ * @param {number} namespace
3159
+ * @returns {ScriptHash}
3160
+ */
3161
+ hash(namespace: number): ScriptHash;
3162
+
3148
3163
/**
3149
3164
* Creates a new Plutus script from the RAW bytes of the compiled script.
3150
3165
* This does NOT include any CBOR encoding around these bytes (e.g. from "cborBytes" in cardano-cli)
@@ -4071,6 +4086,28 @@ declare export class RedeemerTag {
4071
4086
*/
4072
4087
kind(): number;
4073
4088
}
4089
+ /**
4090
+ */
4091
+ declare export class RedeemerWitnessKey {
4092
+ free(): void;
4093
+
4094
+ /**
4095
+ * @returns {RedeemerTag}
4096
+ */
4097
+ tag(): RedeemerTag;
4098
+
4099
+ /**
4100
+ * @returns {BigNum}
4101
+ */
4102
+ index(): BigNum;
4103
+
4104
+ /**
4105
+ * @param {RedeemerTag} tag
4106
+ * @param {BigNum} index
4107
+ * @returns {RedeemerWitnessKey}
4108
+ */
4109
+ static new(tag: RedeemerTag, index: BigNum): RedeemerWitnessKey;
4110
+ }
4074
4111
/**
4075
4112
*/
4076
4113
declare export class Redeemers {
@@ -4199,6 +4236,91 @@ declare export class Relays {
4199
4236
*/
4200
4237
add(elem: Relay): void;
4201
4238
}
4239
+ /**
4240
+ */
4241
+ declare export class RequiredWitnessSet {
4242
+ free(): void;
4243
+
4244
+ /**
4245
+ * @param {Vkeywitness} vkey
4246
+ */
4247
+ add_vkey(vkey: Vkeywitness): void;
4248
+
4249
+ /**
4250
+ * @param {Vkey} vkey
4251
+ */
4252
+ add_vkey_key(vkey: Vkey): void;
4253
+
4254
+ /**
4255
+ * @param {Ed25519KeyHash} hash
4256
+ */
4257
+ add_vkey_key_hash(hash: Ed25519KeyHash): void;
4258
+
4259
+ /**
4260
+ * @param {BootstrapWitness} bootstrap
4261
+ */
4262
+ add_bootstrap(bootstrap: BootstrapWitness): void;
4263
+
4264
+ /**
4265
+ * @param {Vkey} bootstrap
4266
+ */
4267
+ add_bootstrap_key(bootstrap: Vkey): void;
4268
+
4269
+ /**
4270
+ * @param {Ed25519KeyHash} hash
4271
+ */
4272
+ add_bootstrap_key_hash(hash: Ed25519KeyHash): void;
4273
+
4274
+ /**
4275
+ * @param {NativeScript} native_script
4276
+ */
4277
+ add_native_script(native_script: NativeScript): void;
4278
+
4279
+ /**
4280
+ * @param {ScriptHash} native_script
4281
+ */
4282
+ add_native_script_hash(native_script: ScriptHash): void;
4283
+
4284
+ /**
4285
+ * @param {PlutusScript} plutus_script
4286
+ */
4287
+ add_plutus_script(plutus_script: PlutusScript): void;
4288
+
4289
+ /**
4290
+ * @param {ScriptHash} plutus_script
4291
+ */
4292
+ add_plutus_hash(plutus_script: ScriptHash): void;
4293
+
4294
+ /**
4295
+ * @param {PlutusData} plutus_datum
4296
+ */
4297
+ add_plutus_datum(plutus_datum: PlutusData): void;
4298
+
4299
+ /**
4300
+ * @param {DataHash} plutus_datum
4301
+ */
4302
+ add_plutus_datum_hash(plutus_datum: DataHash): void;
4303
+
4304
+ /**
4305
+ * @param {Redeemer} redeemer
4306
+ */
4307
+ add_redeemer(redeemer: Redeemer): void;
4308
+
4309
+ /**
4310
+ * @param {RedeemerWitnessKey} redeemer
4311
+ */
4312
+ add_redeemer_tag(redeemer: RedeemerWitnessKey): void;
4313
+
4314
+ /**
4315
+ * @param {RequiredWitnessSet} requirements
4316
+ */
4317
+ add_all(requirements: RequiredWitnessSet): void;
4318
+
4319
+ /**
4320
+ * @returns {RequiredWitnessSet}
4321
+ */
4322
+ static new(): RequiredWitnessSet;
4323
+ }
4202
4324
/**
4203
4325
*/
4204
4326
declare export class RewardAddress {
@@ -5933,6 +6055,62 @@ declare export class TransactionWitnessSet {
5933
6055
*/
5934
6056
static new(): TransactionWitnessSet;
5935
6057
}
6058
+ /**
6059
+ * Builder de-duplicates witnesses as they are added
6060
+ */
6061
+ declare export class TransactionWitnessSetBuilder {
6062
+ free(): void;
6063
+
6064
+ /**
6065
+ * @param {Vkeywitness} vkey
6066
+ */
6067
+ add_vkey(vkey: Vkeywitness): void;
6068
+
6069
+ /**
6070
+ * @param {BootstrapWitness} bootstrap
6071
+ */
6072
+ add_bootstrap(bootstrap: BootstrapWitness): void;
6073
+
6074
+ /**
6075
+ * @param {NativeScript} native_script
6076
+ */
6077
+ add_native_script(native_script: NativeScript): void;
6078
+
6079
+ /**
6080
+ * @param {PlutusScript} plutus_script
6081
+ */
6082
+ add_plutus_script(plutus_script: PlutusScript): void;
6083
+
6084
+ /**
6085
+ * @param {PlutusData} plutus_datum
6086
+ */
6087
+ add_plutus_datum(plutus_datum: PlutusData): void;
6088
+
6089
+ /**
6090
+ * @param {Redeemer} redeemer
6091
+ */
6092
+ add_redeemer(redeemer: Redeemer): void;
6093
+
6094
+ /**
6095
+ * @param {RequiredWitnessSet} required_wits
6096
+ */
6097
+ add_required_wits(required_wits: RequiredWitnessSet): void;
6098
+
6099
+ /**
6100
+ * @returns {TransactionWitnessSetBuilder}
6101
+ */
6102
+ static new(): TransactionWitnessSetBuilder;
6103
+
6104
+ /**
6105
+ * @param {TransactionWitnessSet} wit_set
6106
+ */
6107
+ add_existing(wit_set: TransactionWitnessSet): void;
6108
+
6109
+ /**
6110
+ * @returns {TransactionWitnessSet}
6111
+ */
6112
+ build(): TransactionWitnessSet;
6113
+ }
5936
6114
/**
5937
6115
*/
5938
6116
declare export class TransactionWitnessSets {
0 commit comments